Title: [248906] trunk
Revision
248906
Author
ysuz...@apple.com
Date
2019-08-20 10:37:07 -0700 (Tue, 20 Aug 2019)

Log Message

[JSC] Array.prototype.toString should not get "join" function each time
https://bugs.webkit.org/show_bug.cgi?id=200905

Reviewed by Mark Lam.

JSTests:

* stress/array-prototype-join-change.js: Added.
(shouldBe):
(array2.join):
(DerivedArray):
(DerivedArray.prototype.join):
(array3.__proto__.join):
(Array.prototype.join):

Source/_javascript_Core:

We avoid looking up `join` every time Array#toString is called. This patch implements the most profitable and easy
case first as we are doing optimization for Array#slice: non-modified original Array. Configuring watchpoint for
Array.prototype.join change and use this information and structure information to determine whether `join` lookup
in Array.prototype.toString is unnecessary. This improves JetStream2/3d-raytrace-SP score by 1.6%

    ToT:     363.56
    Patched: 369.26

This patch also renames InlineWatchpointSet fields from Watchpoint to WatchpointSet since they are not Watchpoint.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::isWatchingArrayIteratorProtocolWatchpoint):
(JSC::DFG::Graph::isWatchingNumberToStringWatchpoint):
* runtime/ArrayPrototype.cpp:
(JSC::speciesWatchpointIsValid):
(JSC::canUseDefaultArrayJoinForToString):
(JSC::arrayProtoFuncToString):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::tryInstallArraySpeciesWatchpoint):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::arrayIteratorProtocolWatchpointSet):
(JSC::JSGlobalObject::mapIteratorProtocolWatchpointSet):
(JSC::JSGlobalObject::setIteratorProtocolWatchpointSet):
(JSC::JSGlobalObject::stringIteratorProtocolWatchpointSet):
(JSC::JSGlobalObject::mapSetWatchpointSet):
(JSC::JSGlobalObject::setAddWatchpointSet):
(JSC::JSGlobalObject::arraySpeciesWatchpointSet):
(JSC::JSGlobalObject::arrayJoinWatchpointSet):
(JSC::JSGlobalObject::numberToStringWatchpointSet):
(JSC::JSGlobalObject::arrayIteratorProtocolWatchpoint): Deleted.
(JSC::JSGlobalObject::mapIteratorProtocolWatchpoint): Deleted.
(JSC::JSGlobalObject::setIteratorProtocolWatchpoint): Deleted.
(JSC::JSGlobalObject::stringIteratorProtocolWatchpoint): Deleted.
(JSC::JSGlobalObject::mapSetWatchpoint): Deleted.
(JSC::JSGlobalObject::setAddWatchpoint): Deleted.
(JSC::JSGlobalObject::arraySpeciesWatchpoint): Deleted.
(JSC::JSGlobalObject::numberToStringWatchpoint): Deleted.
* runtime/JSGlobalObjectInlines.h:
(JSC::JSGlobalObject::isArrayPrototypeIteratorProtocolFastAndNonObservable):
(JSC::JSGlobalObject::isMapPrototypeIteratorProtocolFastAndNonObservable):
(JSC::JSGlobalObject::isSetPrototypeIteratorProtocolFastAndNonObservable):
(JSC::JSGlobalObject::isStringPrototypeIteratorProtocolFastAndNonObservable):
(JSC::JSGlobalObject::isMapPrototypeSetFastAndNonObservable):
(JSC::JSGlobalObject::isSetPrototypeAddFastAndNonObservable):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (248905 => 248906)


--- trunk/JSTests/ChangeLog	2019-08-20 17:35:46 UTC (rev 248905)
+++ trunk/JSTests/ChangeLog	2019-08-20 17:37:07 UTC (rev 248906)
@@ -1,3 +1,18 @@
+2019-08-20  Yusuke Suzuki  <ysuz...@apple.com>
+
+        [JSC] Array.prototype.toString should not get "join" function each time
+        https://bugs.webkit.org/show_bug.cgi?id=200905
+
+        Reviewed by Mark Lam.
+
+        * stress/array-prototype-join-change.js: Added.
+        (shouldBe):
+        (array2.join):
+        (DerivedArray):
+        (DerivedArray.prototype.join):
+        (array3.__proto__.join):
+        (Array.prototype.join):
+
 2019-08-20  Justin Michaud  <justin_mich...@apple.com>
 
         Fix InBounds speculation of typed array PutByVal and add extra step to integer range optimization to search for equality relationships on the RHS value

Added: trunk/JSTests/stress/array-prototype-join-change.js (0 => 248906)


--- trunk/JSTests/stress/array-prototype-join-change.js	                        (rev 0)
+++ trunk/JSTests/stress/array-prototype-join-change.js	2019-08-20 17:37:07 UTC (rev 248906)
@@ -0,0 +1,32 @@
+function shouldBe(actual, expected) {
+    if (actual !== expected)
+        throw new Error('bad value: ' + actual);
+}
+
+var array = [0, 1, 2, 3];
+shouldBe(`${array}`, `0,1,2,3`);
+
+var array2 = [0, 1, 2, 3];
+array2.join = function () { return `42`; }
+shouldBe(`${array2}`, `42`);
+
+class DerivedArray extends Array {
+    constructor()
+    {
+        super(0, 1, 2, 3);
+    }
+
+    join()
+    {
+        return `0`;
+    }
+}
+var derived = new DerivedArray();
+shouldBe(`${derived}`, `0`);
+
+var array3 = [0, 1, 2, 3];
+array3.__proto__ = { toString: Array.prototype.toString, join() { return `41`; } };
+shouldBe(`${array3}`, `41`);
+
+Array.prototype.join = function() { return `40`; };
+shouldBe(`${array}`, `40`);

Modified: trunk/Source/_javascript_Core/ChangeLog (248905 => 248906)


--- trunk/Source/_javascript_Core/ChangeLog	2019-08-20 17:35:46 UTC (rev 248905)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-08-20 17:37:07 UTC (rev 248906)
@@ -1,3 +1,59 @@
+2019-08-20  Yusuke Suzuki  <ysuz...@apple.com>
+
+        [JSC] Array.prototype.toString should not get "join" function each time
+        https://bugs.webkit.org/show_bug.cgi?id=200905
+
+        Reviewed by Mark Lam.
+
+        We avoid looking up `join` every time Array#toString is called. This patch implements the most profitable and easy
+        case first as we are doing optimization for Array#slice: non-modified original Array. Configuring watchpoint for
+        Array.prototype.join change and use this information and structure information to determine whether `join` lookup
+        in Array.prototype.toString is unnecessary. This improves JetStream2/3d-raytrace-SP score by 1.6%
+
+            ToT:     363.56
+            Patched: 369.26
+
+        This patch also renames InlineWatchpointSet fields from Watchpoint to WatchpointSet since they are not Watchpoint.
+
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
+        * dfg/DFGGraph.h:
+        (JSC::DFG::Graph::isWatchingArrayIteratorProtocolWatchpoint):
+        (JSC::DFG::Graph::isWatchingNumberToStringWatchpoint):
+        * runtime/ArrayPrototype.cpp:
+        (JSC::speciesWatchpointIsValid):
+        (JSC::canUseDefaultArrayJoinForToString):
+        (JSC::arrayProtoFuncToString):
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::JSGlobalObject):
+        (JSC::JSGlobalObject::init):
+        (JSC::JSGlobalObject::tryInstallArraySpeciesWatchpoint):
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::arrayIteratorProtocolWatchpointSet):
+        (JSC::JSGlobalObject::mapIteratorProtocolWatchpointSet):
+        (JSC::JSGlobalObject::setIteratorProtocolWatchpointSet):
+        (JSC::JSGlobalObject::stringIteratorProtocolWatchpointSet):
+        (JSC::JSGlobalObject::mapSetWatchpointSet):
+        (JSC::JSGlobalObject::setAddWatchpointSet):
+        (JSC::JSGlobalObject::arraySpeciesWatchpointSet):
+        (JSC::JSGlobalObject::arrayJoinWatchpointSet):
+        (JSC::JSGlobalObject::numberToStringWatchpointSet):
+        (JSC::JSGlobalObject::arrayIteratorProtocolWatchpoint): Deleted.
+        (JSC::JSGlobalObject::mapIteratorProtocolWatchpoint): Deleted.
+        (JSC::JSGlobalObject::setIteratorProtocolWatchpoint): Deleted.
+        (JSC::JSGlobalObject::stringIteratorProtocolWatchpoint): Deleted.
+        (JSC::JSGlobalObject::mapSetWatchpoint): Deleted.
+        (JSC::JSGlobalObject::setAddWatchpoint): Deleted.
+        (JSC::JSGlobalObject::arraySpeciesWatchpoint): Deleted.
+        (JSC::JSGlobalObject::numberToStringWatchpoint): Deleted.
+        * runtime/JSGlobalObjectInlines.h:
+        (JSC::JSGlobalObject::isArrayPrototypeIteratorProtocolFastAndNonObservable):
+        (JSC::JSGlobalObject::isMapPrototypeIteratorProtocolFastAndNonObservable):
+        (JSC::JSGlobalObject::isSetPrototypeIteratorProtocolFastAndNonObservable):
+        (JSC::JSGlobalObject::isStringPrototypeIteratorProtocolFastAndNonObservable):
+        (JSC::JSGlobalObject::isMapPrototypeSetFastAndNonObservable):
+        (JSC::JSGlobalObject::isSetPrototypeAddFastAndNonObservable):
+
 2019-08-20  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Support for _javascript_ BigInt

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (248905 => 248906)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2019-08-20 17:35:46 UTC (rev 248905)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2019-08-20 17:37:07 UTC (rev 248906)
@@ -2351,13 +2351,13 @@
 
                 // FIXME: We could easily relax the Array/Object.prototype transition as long as we OSR exitted if we saw a hole.
                 // https://bugs.webkit.org/show_bug.cgi?id=173171
-                if (globalObject->arraySpeciesWatchpoint().state() == IsWatched
+                if (globalObject->arraySpeciesWatchpointSet().state() == IsWatched
                     && globalObject->havingABadTimeWatchpoint()->isStillValid()
                     && arrayPrototypeStructure->transitionWatchpointSetIsStillValid()
                     && objectPrototypeStructure->transitionWatchpointSetIsStillValid()
                     && globalObject->arrayPrototypeChainIsSane()) {
 
-                    m_graph.watchpoints().addLazily(globalObject->arraySpeciesWatchpoint());
+                    m_graph.watchpoints().addLazily(globalObject->arraySpeciesWatchpointSet());
                     m_graph.watchpoints().addLazily(globalObject->havingABadTimeWatchpoint());
                     m_graph.registerAndWatchStructureTransition(arrayPrototypeStructure);
                     m_graph.registerAndWatchStructureTransition(objectPrototypeStructure);

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.h (248905 => 248906)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.h	2019-08-20 17:35:46 UTC (rev 248905)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.h	2019-08-20 17:37:07 UTC (rev 248906)
@@ -800,7 +800,7 @@
     bool isWatchingArrayIteratorProtocolWatchpoint(Node* node)
     {
         JSGlobalObject* globalObject = globalObjectFor(node->origin.semantic);
-        InlineWatchpointSet& set = globalObject->arrayIteratorProtocolWatchpoint();
+        InlineWatchpointSet& set = globalObject->arrayIteratorProtocolWatchpointSet();
         return isWatchingGlobalObjectWatchpoint(globalObject, set);
     }
 
@@ -807,7 +807,7 @@
     bool isWatchingNumberToStringWatchpoint(Node* node)
     {
         JSGlobalObject* globalObject = globalObjectFor(node->origin.semantic);
-        InlineWatchpointSet& set = globalObject->numberToStringWatchpoint();
+        InlineWatchpointSet& set = globalObject->numberToStringWatchpointSet();
         return isWatchingGlobalObjectWatchpoint(globalObject, set);
     }
 

Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (248905 => 248906)


--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2019-08-20 17:35:46 UTC (rev 248905)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2019-08-20 17:37:07 UTC (rev 248906)
@@ -196,15 +196,15 @@
     JSGlobalObject* globalObject = thisObject->globalObject(vm);
     ArrayPrototype* arrayPrototype = globalObject->arrayPrototype();
 
-    if (globalObject->arraySpeciesWatchpoint().stateOnJSThread() == ClearWatchpoint) {
+    if (globalObject->arraySpeciesWatchpointSet().stateOnJSThread() == ClearWatchpoint) {
         dataLogLnIf(ArrayPrototypeInternal::verbose, "Initializing Array species watchpoints for Array.prototype: ", pointerDump(arrayPrototype), " with structure: ", pointerDump(arrayPrototype->structure(vm)), "\nand Array: ", pointerDump(globalObject->arrayConstructor()), " with structure: ", pointerDump(globalObject->arrayConstructor()->structure(vm)));
         globalObject->tryInstallArraySpeciesWatchpoint(exec);
-        ASSERT(globalObject->arraySpeciesWatchpoint().stateOnJSThread() != ClearWatchpoint);
+        ASSERT(globalObject->arraySpeciesWatchpointSet().stateOnJSThread() != ClearWatchpoint);
     }
 
     return !thisObject->hasCustomProperties(vm)
         && arrayPrototype == thisObject->getPrototypeDirect(vm)
-        && globalObject->arraySpeciesWatchpoint().stateOnJSThread() == IsWatched;
+        && globalObject->arraySpeciesWatchpointSet().stateOnJSThread() == IsWatched;
 }
 
 enum class SpeciesConstructResult {
@@ -576,6 +576,21 @@
     RELEASE_AND_RETURN(scope, joiner.join(state));
 }
 
+inline bool canUseDefaultArrayJoinForToString(VM& vm, JSObject* thisObject)
+{
+    JSGlobalObject* globalObject = thisObject->globalObject();
+
+    if (globalObject->arrayJoinWatchpointSet().stateOnJSThread() != IsWatched)
+        return false;
+
+    Structure* structure = thisObject->structure(vm);
+
+    // This is the fast case. Many arrays will be an original array.
+    // We are doing very simple check here. If we do more complicated checks like looking into getDirect "join" of thisObject,
+    // it would be possible that just looking into "join" function will show the same performance.
+    return globalObject->isOriginalArrayStructure(structure);
+}
+
 EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
 {
     VM& vm = exec->vm();
@@ -585,27 +600,29 @@
     // 1. Let array be the result of calling ToObject on the this value.
     JSObject* thisObject = thisValue.toObject(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    
-    // 2. Let func be the result of calling the [[Get]] internal method of array with argument "join".
-    JSValue function = JSValue(thisObject).get(exec, vm.propertyNames->join);
-    RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-    // 3. If IsCallable(func) is false, then let func be the standard built-in method Object.prototype.toString (15.2.4.2).
-    bool customJoinCase = false;
-    if (!function.isCell())
-        customJoinCase = true;
-    CallData callData;
-    CallType callType = getCallData(vm, function, callData);
-    if (callType == CallType::None)
-        customJoinCase = true;
+    if (!canUseDefaultArrayJoinForToString(vm, thisObject)) {
+        // 2. Let func be the result of calling the [[Get]] internal method of array with argument "join".
+        JSValue function = JSValue(thisObject).get(exec, vm.propertyNames->join);
+        RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-    if (UNLIKELY(customJoinCase))
-        RELEASE_AND_RETURN(scope, JSValue::encode(jsMakeNontrivialString(exec, "[object ", thisObject->methodTable(vm)->className(thisObject, vm), "]")));
+        // 3. If IsCallable(func) is false, then let func be the standard built-in method Object.prototype.toString (15.2.4.2).
+        bool customJoinCase = false;
+        if (!function.isCell())
+            customJoinCase = true;
+        CallData callData;
+        CallType callType = getCallData(vm, function, callData);
+        if (callType == CallType::None)
+            customJoinCase = true;
 
-    // 4. Return the result of calling the [[Call]] internal method of func providing array as the this value and an empty arguments list.
-    if (!isJSArray(thisObject) || callType != CallType::Host || callData.native.function != arrayProtoFuncJoin)
-        RELEASE_AND_RETURN(scope, JSValue::encode(call(exec, function, callType, callData, thisObject, *vm.emptyList)));
+        if (UNLIKELY(customJoinCase))
+            RELEASE_AND_RETURN(scope, JSValue::encode(jsMakeNontrivialString(exec, "[object ", thisObject->methodTable(vm)->className(thisObject, vm), "]")));
 
+        // 4. Return the result of calling the [[Call]] internal method of func providing array as the this value and an empty arguments list.
+        if (!isJSArray(thisObject) || callType != CallType::Host || callData.native.function != arrayProtoFuncJoin)
+            RELEASE_AND_RETURN(scope, JSValue::encode(call(exec, function, callType, callData, thisObject, *vm.emptyList)));
+    }
+
     ASSERT(isJSArray(thisValue));
     JSArray* thisArray = asArray(thisValue);
 

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (248905 => 248906)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2019-08-20 17:35:46 UTC (rev 248905)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2019-08-20 17:37:07 UTC (rev 248906)
@@ -417,14 +417,15 @@
     , m_havingABadTimeWatchpoint(adoptRef(new WatchpointSet(IsWatched)))
     , m_varInjectionWatchpoint(adoptRef(new WatchpointSet(IsWatched)))
     , m_weakRandom(Options::forceWeakRandomSeed() ? Options::forcedWeakRandomSeed() : static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)))
-    , m_arrayIteratorProtocolWatchpoint(IsWatched)
-    , m_mapIteratorProtocolWatchpoint(IsWatched)
-    , m_setIteratorProtocolWatchpoint(IsWatched)
-    , m_stringIteratorProtocolWatchpoint(IsWatched)
-    , m_mapSetWatchpoint(IsWatched)
-    , m_setAddWatchpoint(IsWatched)
-    , m_arraySpeciesWatchpoint(ClearWatchpoint)
-    , m_numberToStringWatchpoint(IsWatched)
+    , m_arrayIteratorProtocolWatchpointSet(IsWatched)
+    , m_mapIteratorProtocolWatchpointSet(IsWatched)
+    , m_setIteratorProtocolWatchpointSet(IsWatched)
+    , m_stringIteratorProtocolWatchpointSet(IsWatched)
+    , m_mapSetWatchpointSet(IsWatched)
+    , m_setAddWatchpointSet(IsWatched)
+    , m_arraySpeciesWatchpointSet(ClearWatchpoint)
+    , m_arrayJoinWatchpointSet(IsWatched)
+    , m_numberToStringWatchpointSet(IsWatched)
     , m_runtimeFlags()
     , m_stackTraceLimit(Options::defaultErrorStackTraceLimit())
     , m_globalObjectMethodTable(globalObjectMethodTable ? globalObjectMethodTable : &s_globalObjectMethodTable)
@@ -1145,57 +1146,62 @@
 
     {
         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(arrayIteratorPrototype, m_vm.propertyNames->next);
-        m_arrayIteratorPrototypeNext = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_arrayIteratorProtocolWatchpoint);
+        m_arrayIteratorPrototypeNext = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_arrayIteratorProtocolWatchpointSet);
         m_arrayIteratorPrototypeNext->install(vm);
     }
     {
         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this->arrayPrototype(), m_vm.propertyNames->iteratorSymbol);
-        m_arrayPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_arrayIteratorProtocolWatchpoint);
+        m_arrayPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_arrayIteratorProtocolWatchpointSet);
         m_arrayPrototypeSymbolIteratorWatchpoint->install(vm);
     }
+    {
+        ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this->arrayPrototype(), m_vm.propertyNames->join);
+        m_arrayPrototypeJoinWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_arrayJoinWatchpointSet);
+        m_arrayPrototypeJoinWatchpoint->install(vm);
+    }
 
     {
         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(mapIteratorPrototype, m_vm.propertyNames->next);
-        m_mapIteratorPrototypeNextWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_mapIteratorProtocolWatchpoint);
+        m_mapIteratorPrototypeNextWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_mapIteratorProtocolWatchpointSet);
         m_mapIteratorPrototypeNextWatchpoint->install(vm);
     }
     {
         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_mapPrototype.get(), m_vm.propertyNames->iteratorSymbol);
-        m_mapPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_mapIteratorProtocolWatchpoint);
+        m_mapPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_mapIteratorProtocolWatchpointSet);
         m_mapPrototypeSymbolIteratorWatchpoint->install(vm);
     }
 
     {
         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(setIteratorPrototype, m_vm.propertyNames->next);
-        m_setIteratorPrototypeNextWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_setIteratorProtocolWatchpoint);
+        m_setIteratorPrototypeNextWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_setIteratorProtocolWatchpointSet);
         m_setIteratorPrototypeNextWatchpoint->install(vm);
     }
     {
         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_setPrototype.get(), m_vm.propertyNames->iteratorSymbol);
-        m_setPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_setIteratorProtocolWatchpoint);
+        m_setPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_setIteratorProtocolWatchpointSet);
         m_setPrototypeSymbolIteratorWatchpoint->install(vm);
     }
 
     {
         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_stringIteratorPrototype.get(), m_vm.propertyNames->next);
-        m_stringIteratorPrototypeNextWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_stringIteratorProtocolWatchpoint);
+        m_stringIteratorPrototypeNextWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_stringIteratorProtocolWatchpointSet);
         m_stringIteratorPrototypeNextWatchpoint->install(vm);
     }
     {
         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_stringPrototype.get(), m_vm.propertyNames->iteratorSymbol);
-        m_stringPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_stringIteratorProtocolWatchpoint);
+        m_stringPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_stringIteratorProtocolWatchpointSet);
         m_stringPrototypeSymbolIteratorWatchpoint->install(vm);
     }
 
     {
         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_mapPrototype.get(), m_vm.propertyNames->set);
-        m_mapPrototypeSetWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_mapSetWatchpoint);
+        m_mapPrototypeSetWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_mapSetWatchpointSet);
         m_mapPrototypeSetWatchpoint->install(vm);
     }
 
     {
         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_setPrototype.get(), m_vm.propertyNames->add);
-        m_setPrototypeAddWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_setAddWatchpoint);
+        m_setPrototypeAddWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_setAddWatchpointSet);
         m_setPrototypeAddWatchpoint->install(vm);
     }
 
@@ -1206,7 +1212,7 @@
         this->symbolPrototype();
 
         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(numberPrototype, m_vm.propertyNames->toString);
-        m_numberPrototypeToStringWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_numberToStringWatchpoint);
+        m_numberPrototypeToStringWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_numberToStringWatchpointSet);
         m_numberPrototypeToStringWatchpoint->install(vm);
         m_numberProtoToStringFunction.set(vm, this, jsCast<JSFunction*>(numberPrototype->getDirect(vm, vm.propertyNames->toString)));
     }
@@ -1889,7 +1895,7 @@
     ArrayConstructor* arrayConstructor = this->arrayConstructor();
 
     auto invalidateWatchpoint = [&] {
-        m_arraySpeciesWatchpoint.invalidate(vm, StringFireDetail("Was not able to set up array species watchpoint."));
+        m_arraySpeciesWatchpointSet.invalidate(vm, StringFireDetail("Was not able to set up array species watchpoint."));
     };
 
     PropertySlot constructorSlot(arrayPrototype, PropertySlot::InternalMethodType::VMInquiry);
@@ -1929,13 +1935,13 @@
     }
 
     // We only watch this from the DFG, and the DFG makes sure to only start watching if the watchpoint is in the IsWatched state.
-    RELEASE_ASSERT(!m_arraySpeciesWatchpoint.isBeingWatched());
-    m_arraySpeciesWatchpoint.touch(vm, "Set up array species watchpoint.");
+    RELEASE_ASSERT(!m_arraySpeciesWatchpointSet.isBeingWatched());
+    m_arraySpeciesWatchpointSet.touch(vm, "Set up array species watchpoint.");
 
-    m_arrayPrototypeConstructorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, constructorCondition, m_arraySpeciesWatchpoint);
+    m_arrayPrototypeConstructorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, constructorCondition, m_arraySpeciesWatchpointSet);
     m_arrayPrototypeConstructorWatchpoint->install(vm);
 
-    m_arrayConstructorSpeciesWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, speciesCondition, m_arraySpeciesWatchpoint);
+    m_arrayConstructorSpeciesWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, speciesCondition, m_arraySpeciesWatchpointSet);
     m_arrayConstructorSpeciesWatchpoint->install(vm);
 }
 

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (248905 => 248906)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2019-08-20 17:35:46 UTC (rev 248905)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2019-08-20 17:37:07 UTC (rev 248906)
@@ -452,31 +452,34 @@
 
     JSCallee* stackOverflowFrameCallee() const { return m_stackOverflowFrameCallee.get(); }
 
-    InlineWatchpointSet& arrayIteratorProtocolWatchpoint() { return m_arrayIteratorProtocolWatchpoint; }
-    InlineWatchpointSet& mapIteratorProtocolWatchpoint() { return m_mapIteratorProtocolWatchpoint; }
-    InlineWatchpointSet& setIteratorProtocolWatchpoint() { return m_setIteratorProtocolWatchpoint; }
-    InlineWatchpointSet& stringIteratorProtocolWatchpoint() { return m_stringIteratorProtocolWatchpoint; }
-    InlineWatchpointSet& mapSetWatchpoint() { return m_mapSetWatchpoint; }
-    InlineWatchpointSet& setAddWatchpoint() { return m_setAddWatchpoint; }
-    InlineWatchpointSet& arraySpeciesWatchpoint() { return m_arraySpeciesWatchpoint; }
-    InlineWatchpointSet& numberToStringWatchpoint()
+    InlineWatchpointSet& arrayIteratorProtocolWatchpointSet() { return m_arrayIteratorProtocolWatchpointSet; }
+    InlineWatchpointSet& mapIteratorProtocolWatchpointSet() { return m_mapIteratorProtocolWatchpointSet; }
+    InlineWatchpointSet& setIteratorProtocolWatchpointSet() { return m_setIteratorProtocolWatchpointSet; }
+    InlineWatchpointSet& stringIteratorProtocolWatchpointSet() { return m_stringIteratorProtocolWatchpointSet; }
+    InlineWatchpointSet& mapSetWatchpointSet() { return m_mapSetWatchpointSet; }
+    InlineWatchpointSet& setAddWatchpointSet() { return m_setAddWatchpointSet; }
+    InlineWatchpointSet& arraySpeciesWatchpointSet() { return m_arraySpeciesWatchpointSet; }
+    InlineWatchpointSet& arrayJoinWatchpointSet() { return m_arrayJoinWatchpointSet; }
+    InlineWatchpointSet& numberToStringWatchpointSet()
     {
         RELEASE_ASSERT(VM::canUseJIT());
-        return m_numberToStringWatchpoint;
+        return m_numberToStringWatchpointSet;
     }
     // If this hasn't been invalidated, it means the array iterator protocol
     // is not observable to user code yet.
-    InlineWatchpointSet m_arrayIteratorProtocolWatchpoint;
-    InlineWatchpointSet m_mapIteratorProtocolWatchpoint;
-    InlineWatchpointSet m_setIteratorProtocolWatchpoint;
-    InlineWatchpointSet m_stringIteratorProtocolWatchpoint;
-    InlineWatchpointSet m_mapSetWatchpoint;
-    InlineWatchpointSet m_setAddWatchpoint;
-    InlineWatchpointSet m_arraySpeciesWatchpoint;
-    InlineWatchpointSet m_numberToStringWatchpoint;
+    InlineWatchpointSet m_arrayIteratorProtocolWatchpointSet;
+    InlineWatchpointSet m_mapIteratorProtocolWatchpointSet;
+    InlineWatchpointSet m_setIteratorProtocolWatchpointSet;
+    InlineWatchpointSet m_stringIteratorProtocolWatchpointSet;
+    InlineWatchpointSet m_mapSetWatchpointSet;
+    InlineWatchpointSet m_setAddWatchpointSet;
+    InlineWatchpointSet m_arraySpeciesWatchpointSet;
+    InlineWatchpointSet m_arrayJoinWatchpointSet;
+    InlineWatchpointSet m_numberToStringWatchpointSet;
     std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_arrayConstructorSpeciesWatchpoint;
     std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_arrayPrototypeConstructorWatchpoint;
     std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_arrayPrototypeSymbolIteratorWatchpoint;
+    std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_arrayPrototypeJoinWatchpoint;
     std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_arrayIteratorPrototypeNext;
     std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_mapPrototypeSymbolIteratorWatchpoint;
     std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_mapIteratorPrototypeNextWatchpoint;

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectInlines.h (248905 => 248906)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectInlines.h	2019-08-20 17:35:46 UTC (rev 248905)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectInlines.h	2019-08-20 17:37:07 UTC (rev 248906)
@@ -62,7 +62,7 @@
     // carefully set up watchpoints to have correct ordering while JS code is
     // executing concurrently.
 
-    return arrayIteratorProtocolWatchpoint().isStillValid() && !isHavingABadTime() && arrayPrototypeChainIsSane();
+    return arrayIteratorProtocolWatchpointSet().isStillValid() && !isHavingABadTime() && arrayPrototypeChainIsSane();
 }
 
 // We're non-observable if the iteration protocol hasn't changed.
@@ -73,27 +73,27 @@
 // executing concurrently.
 ALWAYS_INLINE bool JSGlobalObject::isMapPrototypeIteratorProtocolFastAndNonObservable()
 {
-    return mapIteratorProtocolWatchpoint().isStillValid();
+    return mapIteratorProtocolWatchpointSet().isStillValid();
 }
 
 ALWAYS_INLINE bool JSGlobalObject::isSetPrototypeIteratorProtocolFastAndNonObservable()
 {
-    return setIteratorProtocolWatchpoint().isStillValid();
+    return setIteratorProtocolWatchpointSet().isStillValid();
 }
 
 ALWAYS_INLINE bool JSGlobalObject::isStringPrototypeIteratorProtocolFastAndNonObservable()
 {
-    return stringIteratorProtocolWatchpoint().isStillValid();
+    return stringIteratorProtocolWatchpointSet().isStillValid();
 }
 
 ALWAYS_INLINE bool JSGlobalObject::isMapPrototypeSetFastAndNonObservable()
 {
-    return mapSetWatchpoint().isStillValid();
+    return mapSetWatchpointSet().isStillValid();
 }
 
 ALWAYS_INLINE bool JSGlobalObject::isSetPrototypeAddFastAndNonObservable()
 {
-    return setAddWatchpoint().isStillValid();
+    return setAddWatchpointSet().isStillValid();
 }
 
 } // namespace JSC
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to