Title: [131648] trunk/Source/_javascript_Core
Revision
131648
Author
msab...@apple.com
Date
2012-10-17 14:54:43 -0700 (Wed, 17 Oct 2012)

Log Message

StringPrototype::jsSpliceSubstringsWithSeparators() doesn't optimally handle 8 bit strings
https://bugs.webkit.org/show_bug.cgi?id=99230

Reviewed by Geoffrey Garen.

Added code to select characters8() or characters16() on the not all 8 bit path for both the
processing of the source and the separators.

* runtime/StringPrototype.cpp:
(JSC::jsSpliceSubstringsWithSeparators):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (131647 => 131648)


--- trunk/Source/_javascript_Core/ChangeLog	2012-10-17 21:49:01 UTC (rev 131647)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-10-17 21:54:43 UTC (rev 131648)
@@ -1,3 +1,16 @@
+2012-10-17  Michael Saboff  <msab...@apple.com>
+
+        StringPrototype::jsSpliceSubstringsWithSeparators() doesn't optimally handle 8 bit strings
+        https://bugs.webkit.org/show_bug.cgi?id=99230
+
+        Reviewed by Geoffrey Garen.
+
+        Added code to select characters8() or characters16() on the not all 8 bit path for both the 
+        processing of the source and the separators.
+
+        * runtime/StringPrototype.cpp:
+        (JSC::jsSpliceSubstringsWithSeparators):
+
 2012-10-17  Filip Pizlo  <fpi...@apple.com>
 
         Array and object allocations via 'new Object' or 'new Array' should be inlined in bytecode to allow allocation site profiling

Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.cpp (131647 => 131648)


--- trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2012-10-17 21:49:01 UTC (rev 131647)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2012-10-17 21:54:43 UTC (rev 131648)
@@ -389,13 +389,19 @@
     for (int i = 0; i < maxCount; i++) {
         if (i < rangeCount) {
             if (int srcLen = substringRanges[i].length) {
-                StringImpl::copyChars(buffer + bufferPos, source.characters() + substringRanges[i].position, srcLen);
+                if (source.is8Bit())
+                    StringImpl::copyChars(buffer + bufferPos, source.characters8() + substringRanges[i].position, srcLen);
+                else
+                    StringImpl::copyChars(buffer + bufferPos, source.characters16() + substringRanges[i].position, srcLen);
                 bufferPos += srcLen;
             }
         }
         if (i < separatorCount) {
             if (int sepLen = separators[i].length()) {
-                StringImpl::copyChars(buffer + bufferPos, separators[i].characters(), sepLen);
+                if (separators[i].is8Bit())
+                    StringImpl::copyChars(buffer + bufferPos, separators[i].characters8(), sepLen);
+                else
+                    StringImpl::copyChars(buffer + bufferPos, separators[i].characters16(), sepLen);
                 bufferPos += sepLen;
             }
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to