Title: [127809] trunk/Source
Revision
127809
Author
msab...@apple.com
Date
2012-09-06 18:29:12 -0700 (Thu, 06 Sep 2012)

Log Message

16 bit JSRopeString up converts an 8 bit fibers to 16 bits during resolution
https://bugs.webkit.org/show_bug.cgi?id=95810

Reviewed by Benjamin Poulain.

Source/_javascript_Core: 

Added 8 bit path that copies the contents of an 8 bit fiber to the 16 bit buffer
when resolving a 16 bit rope.

* runtime/JSString.cpp:
(JSC::JSRopeString::resolveRopeSlowCase):

Source/WTF: 

New copy routine that takes an 8 bit source and a 16 bit destination.  Used when copying
the contents of an 8 bit fiber to the 16 bit buffer when resolving a 16 bit rope.

* wtf/text/StringImpl.h:
(WTF::StringImpl::copyChars):
(StringImpl):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (127808 => 127809)


--- trunk/Source/_javascript_Core/ChangeLog	2012-09-07 01:29:12 UTC (rev 127808)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-09-07 01:29:12 UTC (rev 127809)
@@ -1,3 +1,16 @@
+2012-09-06  Michael Saboff  <msab...@apple.com>
+
+        16 bit JSRopeString up converts an 8 bit fibers to 16 bits during resolution
+        https://bugs.webkit.org/show_bug.cgi?id=95810
+
+        Reviewed by Benjamin Poulain.
+
+        Added 8 bit path that copies the contents of an 8 bit fiber to the 16 bit buffer
+        when resolving a 16 bit rope.
+
+        * runtime/JSString.cpp:
+        (JSC::JSRopeString::resolveRopeSlowCase):
+
 2012-09-06  Gavin Barraclough  <barraclo...@apple.com>
 
         JS test suite puts incorrect limitations on Function.toString()

Modified: trunk/Source/_javascript_Core/runtime/JSString.cpp (127808 => 127809)


--- trunk/Source/_javascript_Core/runtime/JSString.cpp	2012-09-07 01:29:12 UTC (rev 127808)
+++ trunk/Source/_javascript_Core/runtime/JSString.cpp	2012-09-07 01:29:12 UTC (rev 127809)
@@ -130,7 +130,10 @@
     for (size_t i = 0; i < s_maxInternalRopeLength && m_fibers[i]; ++i) {
         StringImpl* string = m_fibers[i]->m_value.impl();
         unsigned length = string->length();
-        StringImpl::copyChars(position, string->characters(), length);
+        if (string->is8Bit())
+            StringImpl::copyChars(position, string->characters8(), length);
+        else
+            StringImpl::copyChars(position, string->characters16(), length);
         position += length;
         m_fibers[i].clear();
     }
@@ -202,7 +205,10 @@
         StringImpl* string = static_cast<StringImpl*>(currentFiber->m_value.impl());
         unsigned length = string->length();
         position -= length;
-        StringImpl::copyChars(position, string->characters(), length);
+        if (string->is8Bit())
+            StringImpl::copyChars(position, string->characters8(), length);
+        else
+            StringImpl::copyChars(position, string->characters16(), length);
     }
 
     ASSERT(buffer == position);

Modified: trunk/Source/WTF/ChangeLog (127808 => 127809)


--- trunk/Source/WTF/ChangeLog	2012-09-07 01:29:12 UTC (rev 127808)
+++ trunk/Source/WTF/ChangeLog	2012-09-07 01:29:12 UTC (rev 127809)
@@ -1,5 +1,19 @@
 2012-09-06  Michael Saboff  <msab...@apple.com>
 
+        16 bit JSRopeString up converts an 8 bit fibers to 16 bits during resolution
+        https://bugs.webkit.org/show_bug.cgi?id=95810
+
+        Reviewed by Benjamin Poulain.
+
+        New copy routine that takes an 8 bit source and a 16 bit destination.  Used when copying
+        the contents of an 8 bit fiber to the 16 bit buffer when resolving a 16 bit rope.
+
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::copyChars):
+        (StringImpl):
+
+2012-09-06  Michael Saboff  <msab...@apple.com>
+
         Unreviewed fix to r127799.
         https://bugs.webkit.org/show_bug.cgi?id=95807
 

Modified: trunk/Source/WTF/wtf/text/StringImpl.h (127808 => 127809)


--- trunk/Source/WTF/wtf/text/StringImpl.h	2012-09-07 01:29:12 UTC (rev 127808)
+++ trunk/Source/WTF/wtf/text/StringImpl.h	2012-09-07 01:29:12 UTC (rev 127809)
@@ -611,6 +611,12 @@
             memcpy(destination, source, numCharacters * sizeof(T));
     }
 
+    ALWAYS_INLINE static void copyChars(UChar* destination, const LChar* source, unsigned numCharacters)
+    {
+        for (unsigned i = 0; i < numCharacters; ++i)
+            destination[i] = source[i];
+    }
+
     // Some string features, like refcounting and the atomicity flag, are not
     // thread-safe. We achieve thread safety by isolation, giving each thread
     // its own copy of the string.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to