⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 237447 in webkit


Ignore:
Timestamp:
Oct 26, 2018, 12:56:56 AM (8 years ago)
Author:
yusukesuzuki@slowstart.org
Message:

[JSC] havingABadTimeWatchpoint is not required in Array#indexOf optimization
​https://bugs.webkit.org/show_bug.cgi?id=190941

Reviewed by Saam Barati.

While "Rest" operation fast path requires havingABadTimeWatchpoint since it allocates
JSArray, Array#{indexOf,lastIndexOf} do not require it when we use the fast path for them.
This patch removes watching on havingABadTimeWatchpoint in Array#indexOf. The test causing
"havingABadTime" is already included in our test suites (e.g. array-indexof-have-a-bad-time.js).

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleIntrinsicCall):

  • runtime/JSArrayInlines.h:

(JSC::JSArray::canDoFastIndexedAccess):

  • runtime/JSGlobalObject.h:
  • runtime/JSGlobalObjectInlines.h:

(JSC::JSGlobalObject::isArrayPrototypeIteratorProtocolFastAndNonObservable):
(JSC::JSGlobalObject::isArrayPrototypeIndexedAccessFastAndNonObservable): Deleted.

Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r237445 r237447  
     12018-10-25  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
     2
     3        [JSC] havingABadTimeWatchpoint is not required in Array#indexOf optimization
     4        https://bugs.webkit.org/show_bug.cgi?id=190941
     5
     6        Reviewed by Saam Barati.
     7
     8        While "Rest" operation fast path requires havingABadTimeWatchpoint since it allocates
     9        JSArray, Array#{indexOf,lastIndexOf} do not require it when we use the fast path for them.
     10        This patch removes watching on havingABadTimeWatchpoint in Array#indexOf. The test causing
     11        "havingABadTime" is already included in our test suites (e.g. array-indexof-have-a-bad-time.js).
     12
     13        * dfg/DFGByteCodeParser.cpp:
     14        (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
     15        * runtime/JSArrayInlines.h:
     16        (JSC::JSArray::canDoFastIndexedAccess):
     17        * runtime/JSGlobalObject.h:
     18        * runtime/JSGlobalObjectInlines.h:
     19        (JSC::JSGlobalObject::isArrayPrototypeIteratorProtocolFastAndNonObservable):
     20        (JSC::JSGlobalObject::isArrayPrototypeIndexedAccessFastAndNonObservable): Deleted.
     21
    1222018-10-25  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
    223
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r237285 r237447  
    23632363            // FIXME: We could easily relax the Array/Object.prototype transition as long as we OSR exitted if we saw a hole.
    23642364            // https://bugs.webkit.org/show_bug.cgi?id=173171
    2365             if (globalObject->havingABadTimeWatchpoint()->isStillValid()
    2366                 && arrayPrototypeStructure->transitionWatchpointSetIsStillValid()
     2365            if (arrayPrototypeStructure->transitionWatchpointSetIsStillValid()
    23672366                && objectPrototypeStructure->transitionWatchpointSetIsStillValid()
    23682367                && globalObject->arrayPrototypeChainIsSane()) {
    23692368
    2370                 m_graph.watchpoints().addLazily(globalObject->havingABadTimeWatchpoint());
    23712369                m_graph.registerAndWatchStructureTransition(arrayPrototypeStructure);
    23722370                m_graph.registerAndWatchStructureTransition(objectPrototypeStructure);
  • trunk/Source/JavaScriptCore/runtime/JSArrayInlines.h

    r236697 r237447  
    7575{
    7676    JSGlobalObject* globalObject = this->globalObject();
    77     if (!globalObject->isArrayPrototypeIndexedAccessFastAndNonObservable())
     77    if (!globalObject->arrayPrototypeChainIsSane())
    7878        return false;
    7979
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r236240 r237447  
    477477    PoisonedUniquePtr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_numberPrototypeToStringWatchpoint;
    478478
    479     bool isArrayPrototypeIndexedAccessFastAndNonObservable();
    480479    bool isArrayPrototypeIteratorProtocolFastAndNonObservable();
    481480    bool isMapPrototypeIteratorProtocolFastAndNonObservable();
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectInlines.h

    r236240 r237447  
    5353}
    5454
    55 ALWAYS_INLINE bool JSGlobalObject::isArrayPrototypeIndexedAccessFastAndNonObservable()
    56 {
    57     // We're fast if we don't have any indexed properties on the prototype.
    58     return !isHavingABadTime() && arrayPrototypeChainIsSane();
    59 }
    60 
    6155ALWAYS_INLINE bool JSGlobalObject::isArrayPrototypeIteratorProtocolFastAndNonObservable()
    6256{
    … …  
    6963    // executing concurrently.
    7064
    71     return arrayIteratorProtocolWatchpoint().isStillValid() && isArrayPrototypeIndexedAccessFastAndNonObservable();
     65    return arrayIteratorProtocolWatchpoint().isStillValid() && !isHavingABadTime() && arrayPrototypeChainIsSane();
    7266}
    7367
Note: See TracChangeset for help on using the changeset viewer.