Ignore:
Timestamp:
May 22, 2022, 3:00:56 AM (3 years ago)
Author:
[email protected]
Message:

Clear StructureCache if it has Structure with relevant JSGlobalObjects
https://bugs.webkit.org/show_bug.cgi?id=240768
rdar://93232129

Reviewed by Saam Barati.

We need to clear Structures in StructureCache when having-a-bad-time: it is possible that Structure could have this have-a-bad-time
relevant JSGlobalObjects in its prototype chain. We are clearing it for InternalFunction's allocation cache. We should do the
same thing for JSGlobalObject's StructureCache.

This patch adds new watchpoint, structureCacheClearedWatchpoint. And use it in DFG. This watchpoint fires when the cache is cleared,
and it can happen even though JSGlobalObject is not getting have-a-bad-time.

  • JSTests/stress/global-object-have-a-bad-time-dependency.js: Added.

(shouldBe):
(cons):

  • Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

  • Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):

  • Source/JavaScriptCore/runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::fireWatchpointAndMakeAllArrayStructuresSlowPut):
(JSC::JSGlobalObject::clearStructureCache):

  • Source/JavaScriptCore/runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::structureCacheClearedWatchpoint):
(JSC::JSGlobalObject::isStructureCacheCleared const):

  • Source/JavaScriptCore/runtime/StructureCache.h:

(JSC::StructureCache::forEach):

  • Source/JavaScriptCore/runtime/WeakGCMap.h:

Canonical link: https://commits.webkit.org/250845@main

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGGraph.h

    r292929 r294619  
    829829        JSGlobalObject* globalObject = globalObjectFor(node->origin.semantic);
    830830        InlineWatchpointSet& set = globalObject->numberToStringWatchpointSet();
     831        return isWatchingGlobalObjectWatchpoint(globalObject, set);
     832    }
     833
     834    bool isWatchingStructureCacheClearedWatchpoint(JSGlobalObject* globalObject)
     835    {
     836        if (m_plan.isUnlinked())
     837            return false;
     838
     839        InlineWatchpointSet& set = globalObject->structureCacheClearedWatchpoint();
    831840        return isWatchingGlobalObjectWatchpoint(globalObject, set);
    832841    }
Note: See TracChangeset for help on using the changeset viewer.