Changeset 252766 in webkit


Ignore:
Timestamp:
Nov 22, 2019 1:39:04 AM (4 years ago)
Author:
mark.lam@apple.com
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/JavaScriptCore:

The CachedCall mechanism does not support calling hist functions.

  • runtime/StringPrototype.cpp:

(JSC::replaceUsingStringSearch):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r252765 r252766  
     12019-11-21  Mark Lam  <mark.lam@apple.com>
     2
     3        replaceUsingStringSearch() should not use CachedCall with host functions.
     4        https://bugs.webkit.org/show_bug.cgi?id=204494
     5        <rdar://problem/57421078>
     6
     7        Reviewed by Ross Kirsling.
     8
     9        * stress/string-replaceAll-2.js:
     10
    1112019-11-21  Ross Kirsling  <ross.kirsling@sony.com>
    212
  • trunk/JSTests/stress/string-replaceAll-2.js

    r252758 r252766  
    108108    { result: '51525352545', visits: 6 }, // replace /(?:)/g
    109109    { result: '51525352545', visits: 6 }, // replaceAll ''
     110    { result: '12324', visits: 0 }, // replace '0'
     111    { result: '12324', visits: 0 }, // replace /0/g
     112    { result: '12324', visits: 0 }, // replaceAll '0'
     113]);
     114
     115test("function parseInt", parseInt, [
     116    { result: '1NaN324', visits: 0 }, // replace '2'
     117    { result: '1NaN324', visits: 0 }, // replace /2/g
     118    { result: '1NaN324', visits: 0 }, // replaceAll '2'
     119    { result: 'NaN12324', visits: 0 }, // replace ''
     120    { result: 'NaN1NaN2NaN3NaN2NaN4NaN', visits: 0 }, // replace /(?:)/g
     121    { result: 'NaN1NaN2NaN3NaN2NaN4NaN', visits: 0 }, // replaceAll ''
    110122    { result: '12324', visits: 0 }, // replace '0'
    111123    { result: '12324', visits: 0 }, // replace /0/g
  • trunk/Source/JavaScriptCore/ChangeLog

    r252763 r252766  
     12019-11-21  Mark Lam  <mark.lam@apple.com>
     2
     3        replaceUsingStringSearch() should not use CachedCall with host functions.
     4        https://bugs.webkit.org/show_bug.cgi?id=204494
     5        <rdar://problem/57421078>
     6
     7        Reviewed by Ross Kirsling.
     8
     9        The CachedCall mechanism does not support calling hist functions.
     10
     11        * runtime/StringPrototype.cpp:
     12        (JSC::replaceUsingStringSearch):
     13
    1142019-11-21  Saam Barati  <sbarati@apple.com>
    215
  • trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp

    r252758 r252766  
    794794        replaceString = replaceValue.toWTFString(globalObject);
    795795        RETURN_IF_EXCEPTION(scope, nullptr);
    796     } else {
    797         JSFunction* function = jsDynamicCast<JSFunction*>(vm, replaceValue);
    798         if (function) {
    799             cachedCall.emplace(globalObject, callFrame, function, 3);
    800             cachedCall->setThis(jsUndefined());
    801         }
     796    } else if (callType == CallType::JS) {
     797        cachedCall.emplace(globalObject, callFrame, jsCast<JSFunction*>(replaceValue), 3);
     798        cachedCall->setThis(jsUndefined());
    802799    }
    803800
Note: See TracChangeset for help on using the changeset viewer.