[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

barraclough at apple.com barraclough at apple.com
Thu Apr 8 02:14:31 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit e67ccbfd9b792e51c0269f1ef7b7dc8b3461f4c4
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Mar 8 20:31:02 2010 +0000

    Reverting 55035, this caused a regression.
    (https://bugs.webkit.org/show_bug.cgi?id=35843)
    
    Reviewed by NOBODY (reverting regression).
    
    * runtime/JSString.cpp:
    (JSC::JSString::resolveRope):
    (JSC::JSString::getStringPropertyDescriptor):
    * runtime/JSString.h:
    (JSC::jsSingleCharacterSubstring):
    (JSC::JSString::getIndex):
    (JSC::JSString::getStringPropertySlot):
    * runtime/UStringImpl.cpp:
    * runtime/UStringImpl.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55679 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 64eee67..fd4b694 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-03-08  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by NOBODY (reverting regression).
+
+        Reverting 55035, this caused a regression.
+        (https://bugs.webkit.org/show_bug.cgi?id=35843)
+
+        * runtime/JSString.cpp:
+        (JSC::JSString::resolveRope):
+        (JSC::JSString::getStringPropertyDescriptor):
+        * runtime/JSString.h:
+        (JSC::jsSingleCharacterSubstring):
+        (JSC::JSString::getIndex):
+        (JSC::JSString::getStringPropertySlot):
+        * runtime/UStringImpl.cpp:
+        * runtime/UStringImpl.h:
+
 2010-03-08  Stuart Morgan  <stuartmorgan at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/JavaScriptCore/runtime/JSString.cpp b/JavaScriptCore/runtime/JSString.cpp
index d155b69..a72457e 100644
--- a/JavaScriptCore/runtime/JSString.cpp
+++ b/JavaScriptCore/runtime/JSString.cpp
@@ -50,6 +50,13 @@ void JSString::resolveRope(ExecState* exec) const
     if (PassRefPtr<UStringImpl> newImpl = UStringImpl::tryCreateUninitialized(m_length, buffer))
         m_value = newImpl;
     else {
+        for (unsigned i = 0; i < m_fiberCount; ++i) {
+            m_other.m_fibers[i]->deref();
+            m_other.m_fibers[i] = 0;
+        }
+        m_fiberCount = 0;
+        ASSERT(!isRope());
+        ASSERT(m_value == UString());
         throwOutOfMemoryError(exec);
         return;
     }
@@ -180,7 +187,7 @@ bool JSString::getStringPropertyDescriptor(ExecState* exec, const Identifier& pr
     bool isStrictUInt32;
     unsigned i = propertyName.toStrictUInt32(&isStrictUInt32);
     if (isStrictUInt32 && i < m_length) {
-        descriptor.setDescriptor(getIndex(exec, i), DontDelete | ReadOnly);
+        descriptor.setDescriptor(jsSingleCharacterSubstring(exec, value(exec), i), DontDelete | ReadOnly);
         return true;
     }
     
diff --git a/JavaScriptCore/runtime/JSString.h b/JavaScriptCore/runtime/JSString.h
index 91eeee0..0162282 100644
--- a/JavaScriptCore/runtime/JSString.h
+++ b/JavaScriptCore/runtime/JSString.h
@@ -41,6 +41,7 @@ namespace JSC {
 
     JSString* jsSingleCharacterString(JSGlobalData*, UChar);
     JSString* jsSingleCharacterString(ExecState*, UChar);
+    JSString* jsSingleCharacterSubstring(JSGlobalData*, const UString&, unsigned offset);
     JSString* jsSingleCharacterSubstring(ExecState*, const UString&, unsigned offset);
     JSString* jsSubstring(JSGlobalData*, const UString&, unsigned offset, unsigned length);
     JSString* jsSubstring(ExecState*, const UString&, unsigned offset, unsigned length);
@@ -364,10 +365,8 @@ namespace JSC {
         return fixupVPtr(globalData, new (globalData) JSString(globalData, UString(&c, 1)));
     }
 
-    inline JSString* jsSingleCharacterSubstring(ExecState* exec, const UString& s, unsigned offset)
+    inline JSString* jsSingleCharacterSubstring(JSGlobalData* globalData, const UString& s, unsigned offset)
     {
-        JSGlobalData* globalData = &exec->globalData();
-
         ASSERT(offset < static_cast<unsigned>(s.size()));
         UChar c = s.data()[offset];
         if (c <= 0xFF)
@@ -392,21 +391,7 @@ namespace JSC {
     inline JSString* JSString::getIndex(ExecState* exec, unsigned i)
     {
         ASSERT(canGetIndex(i));
-        if (!isRope())
-            return jsSingleCharacterSubstring(exec, m_value, i);
-
-        if (i < m_other.m_fibers[0]->length())
-            return jsString(exec, singleCharacterSubstring(m_other.m_fibers[0], i));
-        i -= m_other.m_fibers[0]->length();
-
-        ASSERT(m_fiberCount >= 2);
-        if (i < m_other.m_fibers[1]->length())
-            return jsString(exec, singleCharacterSubstring(m_other.m_fibers[1], i));
-        i -= m_other.m_fibers[1]->length();
-
-        ASSERT(m_fiberCount == 3);
-        ASSERT(i < m_other.m_fibers[2]->length());
-        return jsString(exec, singleCharacterSubstring(m_other.m_fibers[2], i));
+        return jsSingleCharacterSubstring(&exec->globalData(), value(exec), i);
     }
 
     inline JSString* jsString(JSGlobalData* globalData, const UString& s)
@@ -460,6 +445,7 @@ namespace JSC {
     inline JSString* jsEmptyString(ExecState* exec) { return jsEmptyString(&exec->globalData()); }
     inline JSString* jsString(ExecState* exec, const UString& s) { return jsString(&exec->globalData(), s); }
     inline JSString* jsSingleCharacterString(ExecState* exec, UChar c) { return jsSingleCharacterString(&exec->globalData(), c); }
+    inline JSString* jsSingleCharacterSubstring(ExecState* exec, const UString& s, unsigned offset) { return jsSingleCharacterSubstring(&exec->globalData(), s, offset); }
     inline JSString* jsSubstring(ExecState* exec, const UString& s, unsigned offset, unsigned length) { return jsSubstring(&exec->globalData(), s, offset, length); }
     inline JSString* jsNontrivialString(ExecState* exec, const UString& s) { return jsNontrivialString(&exec->globalData(), s); }
     inline JSString* jsNontrivialString(ExecState* exec, const char* s) { return jsNontrivialString(&exec->globalData(), s); }
@@ -475,7 +461,7 @@ namespace JSC {
         bool isStrictUInt32;
         unsigned i = propertyName.toStrictUInt32(&isStrictUInt32);
         if (isStrictUInt32 && i < m_length) {
-            slot.setValue(getIndex(exec, i));
+            slot.setValue(jsSingleCharacterSubstring(exec, value(exec), i));
             return true;
         }
 
@@ -485,7 +471,7 @@ namespace JSC {
     ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
     {
         if (propertyName < m_length) {
-            slot.setValue(getIndex(exec, propertyName));
+            slot.setValue(jsSingleCharacterSubstring(exec, value(exec), propertyName));
             return true;
         }
 
diff --git a/JavaScriptCore/runtime/UStringImpl.cpp b/JavaScriptCore/runtime/UStringImpl.cpp
index 1fe3eb2..afd8244 100644
--- a/JavaScriptCore/runtime/UStringImpl.cpp
+++ b/JavaScriptCore/runtime/UStringImpl.cpp
@@ -149,24 +149,4 @@ void URopeImpl::destructNonRecursive()
     }
 }
 
-PassRefPtr<UStringImpl> singleCharacterSubstring(UStringOrRopeImpl* impl, unsigned index)
-{
-top:
-    if (impl->isRope()) {
-        URopeImpl* rope = static_cast<URopeImpl*>(impl);
-        for (unsigned i = 0; i < rope->m_fiberCount; ++i) {
-            UStringOrRopeImpl* currentFiber = rope->fibers(i);
-            unsigned fiberLength = currentFiber->length();
-            if (index < fiberLength) {
-                impl = currentFiber;
-                goto top;
-            }
-            index -= fiberLength;
-        }
-        CRASH();
-    }
-
-    return static_cast<UStringImpl*>(impl)->singleCharacterSubstring(index);
-}
-
 } // namespace JSC
diff --git a/JavaScriptCore/runtime/UStringImpl.h b/JavaScriptCore/runtime/UStringImpl.h
index cfc2c74..a1d7bb8 100644
--- a/JavaScriptCore/runtime/UStringImpl.h
+++ b/JavaScriptCore/runtime/UStringImpl.h
@@ -213,8 +213,6 @@ public:
         ASSERT(!isStatic() || !isIdentifier());
     }
 
-    PassRefPtr<UStringImpl> singleCharacterSubstring(unsigned index) { ASSERT(index < length()); return create(this, index, 1); }
-
 private:
     // For SmallStringStorage, which allocates an array and uses an in-place new.
     UStringImpl() { }
@@ -345,7 +343,6 @@ private:
     Fiber m_fibers[1];
 
     friend class UStringOrRopeImpl;
-    friend PassRefPtr<UStringImpl> singleCharacterSubstring(UStringOrRopeImpl* ropeoid, unsigned index);
 };
 
 inline void UStringOrRopeImpl::deref()
@@ -358,8 +355,6 @@ inline void UStringOrRopeImpl::deref()
 
 bool equal(const UStringImpl*, const UStringImpl*);
 
-PassRefPtr<UStringImpl> singleCharacterSubstring(UStringOrRopeImpl* ropeoid, unsigned index);
-
 }
 
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list