Title: [252766] trunk
Revision
252766
Author
[email protected]
Date
2019-11-22 01:39:04 -0800 (Fri, 22 Nov 2019)

Log Message

replaceUsingStringSearch() should not use CachedCall with host functions.
https://bugs.webkit.org/show_bug.cgi?id=204494
<rdar://problem/57421078>

Reviewed by Ross Kirsling.

JSTests:

* stress/string-replaceAll-2.js:

Source/_javascript_Core:

The CachedCall mechanism does not support calling hist functions.

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

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (252765 => 252766)


--- trunk/JSTests/ChangeLog	2019-11-22 06:46:54 UTC (rev 252765)
+++ trunk/JSTests/ChangeLog	2019-11-22 09:39:04 UTC (rev 252766)
@@ -1,3 +1,13 @@
+2019-11-21  Mark Lam  <[email protected]>
+
+        replaceUsingStringSearch() should not use CachedCall with host functions.
+        https://bugs.webkit.org/show_bug.cgi?id=204494
+        <rdar://problem/57421078>
+
+        Reviewed by Ross Kirsling.
+
+        * stress/string-replaceAll-2.js:
+
 2019-11-21  Ross Kirsling  <[email protected]>
 
         Unreviewed test262 gardening following r252680.

Modified: trunk/JSTests/stress/string-replaceAll-2.js (252765 => 252766)


--- trunk/JSTests/stress/string-replaceAll-2.js	2019-11-22 06:46:54 UTC (rev 252765)
+++ trunk/JSTests/stress/string-replaceAll-2.js	2019-11-22 09:39:04 UTC (rev 252766)
@@ -112,6 +112,18 @@
     { result: '12324', visits: 0 }, // replaceAll '0'
 ]);
 
+test("function parseInt", parseInt, [
+    { result: '1NaN324', visits: 0 }, // replace '2'
+    { result: '1NaN324', visits: 0 }, // replace /2/g
+    { result: '1NaN324', visits: 0 }, // replaceAll '2'
+    { result: 'NaN12324', visits: 0 }, // replace ''
+    { result: 'NaN1NaN2NaN3NaN2NaN4NaN', visits: 0 }, // replace /(?:)/g
+    { result: 'NaN1NaN2NaN3NaN2NaN4NaN', visits: 0 }, // replaceAll ''
+    { result: '12324', visits: 0 }, // replace '0'
+    { result: '12324', visits: 0 }, // replace /0/g
+    { result: '12324', visits: 0 }, // replaceAll '0'
+]);
+
 var proxy = new Proxy(foo, {
     apply() {
         visits++;

Modified: trunk/Source/_javascript_Core/ChangeLog (252765 => 252766)


--- trunk/Source/_javascript_Core/ChangeLog	2019-11-22 06:46:54 UTC (rev 252765)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-11-22 09:39:04 UTC (rev 252766)
@@ -1,3 +1,16 @@
+2019-11-21  Mark Lam  <[email protected]>
+
+        replaceUsingStringSearch() should not use CachedCall with host functions.
+        https://bugs.webkit.org/show_bug.cgi?id=204494
+        <rdar://problem/57421078>
+
+        Reviewed by Ross Kirsling.
+
+        The CachedCall mechanism does not support calling hist functions.
+
+        * runtime/StringPrototype.cpp:
+        (JSC::replaceUsingStringSearch):
+
 2019-11-21  Saam Barati  <[email protected]>
 
         GetByStatus should not say it took the slow path for multiple identifiers and should have a way to indicate if the StructureStubInfo it saw took the slow path

Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.cpp (252765 => 252766)


--- trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2019-11-22 06:46:54 UTC (rev 252765)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2019-11-22 09:39:04 UTC (rev 252766)
@@ -793,12 +793,9 @@
     if (callType == CallType::None) {
         replaceString = replaceValue.toWTFString(globalObject);
         RETURN_IF_EXCEPTION(scope, nullptr);
-    } else {
-        JSFunction* function = jsDynamicCast<JSFunction*>(vm, replaceValue);
-        if (function) {
-            cachedCall.emplace(globalObject, callFrame, function, 3);
-            cachedCall->setThis(jsUndefined());
-        }
+    } else if (callType == CallType::JS) {
+        cachedCall.emplace(globalObject, callFrame, jsCast<JSFunction*>(replaceValue), 3);
+        cachedCall->setThis(jsUndefined());
     }
 
     size_t matchStart = string.find(searchString);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to