Title: [200743] trunk/Source/_javascript_Core
Revision
200743
Author
commit-qu...@webkit.org
Date
2016-05-11 23:34:41 -0700 (Wed, 11 May 2016)

Log Message

[JSC] Make sure StringRange is passed to Vector by register
https://bugs.webkit.org/show_bug.cgi?id=157603

Patch by Benjamin Poulain <bpoul...@apple.com> on 2016-05-11
Reviewed by Darin Adler.

This is bizarre, but on my SDK, Vector::append(StringRange)
is passing the values on the stack.
The two integers are written to the stack, the address given
to append(), then append() reads it back and store it.

This patch changes the code to use constructAndAppend(), ensuring
the values are used directly.

On my machine, this helps Sunspider and Octane.
This might be something wrong with my SDK but the fix is so easy
that we might as well do this.

* runtime/StringPrototype.cpp:
(JSC::removeUsingRegExpSearch):
(JSC::replaceUsingRegExpSearch):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (200742 => 200743)


--- trunk/Source/_javascript_Core/ChangeLog	2016-05-12 06:23:19 UTC (rev 200742)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-05-12 06:34:41 UTC (rev 200743)
@@ -1,3 +1,26 @@
+2016-05-11  Benjamin Poulain  <bpoul...@apple.com>
+
+        [JSC] Make sure StringRange is passed to Vector by register
+        https://bugs.webkit.org/show_bug.cgi?id=157603
+
+        Reviewed by Darin Adler.
+
+        This is bizarre, but on my SDK, Vector::append(StringRange)
+        is passing the values on the stack.
+        The two integers are written to the stack, the address given
+        to append(), then append() reads it back and store it.
+
+        This patch changes the code to use constructAndAppend(), ensuring
+        the values are used directly.
+
+        On my machine, this helps Sunspider and Octane.
+        This might be something wrong with my SDK but the fix is so easy
+        that we might as well do this.
+
+        * runtime/StringPrototype.cpp:
+        (JSC::removeUsingRegExpSearch):
+        (JSC::replaceUsingRegExpSearch):
+
 2016-05-11  Zan Dobersek  <zdober...@igalia.com>
 
         ARMv7Assembler: suppress a -Wnarrowing warning when compiling with GCC

Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.cpp (200742 => 200743)


--- trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2016-05-12 06:23:19 UTC (rev 200742)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2016-05-12 06:34:41 UTC (rev 200743)
@@ -448,7 +448,7 @@
             break;
 
         if (lastIndex < result.start)
-            sourceRanges.append(StringRange(lastIndex, result.start - lastIndex));
+            sourceRanges.constructAndAppend(lastIndex, result.start - lastIndex);
 
         lastIndex = result.end;
         startPosition = lastIndex;
@@ -465,7 +465,7 @@
         return JSValue::encode(string);
 
     if (static_cast<unsigned>(lastIndex) < sourceLen)
-        sourceRanges.append(StringRange(lastIndex, sourceLen - lastIndex));
+        sourceRanges.constructAndAppend(lastIndex, sourceLen - lastIndex);
 
     return JSValue::encode(jsSpliceSubstrings(exec, string, source, sourceRanges.data(), sourceRanges.size()));
 }
@@ -517,7 +517,7 @@
                 if (!result)
                     break;
 
-                sourceRanges.append(StringRange(lastIndex, result.start - lastIndex));
+                sourceRanges.constructAndAppend(lastIndex, result.start - lastIndex);
 
                 unsigned i = 0;
                 for (; i < regExp->numSubpatterns() + 1; ++i) {
@@ -556,7 +556,7 @@
                 if (!result)
                     break;
 
-                sourceRanges.append(StringRange(lastIndex, result.start - lastIndex));
+                sourceRanges.constructAndAppend(lastIndex, result.start - lastIndex);
 
                 unsigned i = 0;
                 for (; i < regExp->numSubpatterns() + 1; ++i) {
@@ -597,7 +597,7 @@
                 break;
 
             if (callType != CallType::None) {
-                sourceRanges.append(StringRange(lastIndex, result.start - lastIndex));
+                sourceRanges.constructAndAppend(lastIndex, result.start - lastIndex);
 
                 MarkedArgumentBuffer args;
 
@@ -620,7 +620,7 @@
             } else {
                 int replLen = replacementString.length();
                 if (lastIndex < result.start || replLen) {
-                    sourceRanges.append(StringRange(lastIndex, result.start - lastIndex));
+                    sourceRanges.constructAndAppend(lastIndex, result.start - lastIndex);
 
                     if (replLen)
                         replacements.append(substituteBackreferences(replacementString, source, ovector, regExp));
@@ -645,7 +645,7 @@
         return JSValue::encode(string);
 
     if (static_cast<unsigned>(lastIndex) < sourceLen)
-        sourceRanges.append(StringRange(lastIndex, sourceLen - lastIndex));
+        sourceRanges.constructAndAppend(lastIndex, sourceLen - lastIndex);
 
     return JSValue::encode(jsSpliceSubstringsWithSeparators(exec, string, source, sourceRanges.data(), sourceRanges.size(), replacements.data(), replacements.size()));
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to