Changeset 284808 in webkit
- Timestamp:
- Oct 25, 2021, 12:10:00 PM (5 years ago)
- Location:
- branches/safari-612-branch/Source/JavaScriptCore
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
dfg/DFGAbstractInterpreterInlines.h (modified) (1 diff)
-
dfg/DFGConstantFoldingPhase.cpp (modified) (1 diff)
-
runtime/JSGlobalObject.cpp (modified) (1 diff)
-
runtime/StructureCache.cpp (modified) (1 diff)
-
runtime/StructureCache.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612-branch/Source/JavaScriptCore/ChangeLog
r284807 r284808 1 2021-10-25 Null <null@apple.com> 2 3 Cherry-pick r284576. rdar://problem/84338462 4 5 We should watch isHavingABadTime if we read from the structureCache 6 https://bugs.webkit.org/show_bug.cgi?id=232019 7 8 Reviewed by Yusuke Suzuki. 9 10 We should lock the structure cache when we clear it, and the compiler thread should 11 watch isHavingABadTime in the case that the cache might get cleared. 12 13 * dfg/DFGAbstractInterpreterInlines.h: 14 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 15 * dfg/DFGConstantFoldingPhase.cpp: 16 (JSC::DFG::ConstantFoldingPhase::foldConstants): 17 * runtime/JSGlobalObject.cpp: 18 (JSC::JSGlobalObject::haveABadTime): 19 * runtime/StructureCache.cpp: 20 (JSC::StructureCache::clear): 21 * runtime/StructureCache.h: 22 (JSC::StructureCache::clear): Deleted. 23 24 25 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284576 268f45cc-cd09-0410-ab3c-d52691b4dbfc 26 27 2021-10-20 Justin Michaud <justin_michaud@apple.com> 28 29 We should watch isHavingABadTime if we read from the structureCache 30 https://bugs.webkit.org/show_bug.cgi?id=232019 31 32 Reviewed by Yusuke Suzuki. 33 34 We should lock the structure cache when we clear it, and the compiler thread should 35 watch isHavingABadTime in the case that the cache might get cleared. 36 37 * dfg/DFGAbstractInterpreterInlines.h: 38 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 39 * dfg/DFGConstantFoldingPhase.cpp: 40 (JSC::DFG::ConstantFoldingPhase::foldConstants): 41 * runtime/JSGlobalObject.cpp: 42 (JSC::JSGlobalObject::haveABadTime): 43 * runtime/StructureCache.cpp: 44 (JSC::StructureCache::clear): 45 * runtime/StructureCache.h: 46 (JSC::StructureCache::clear): Deleted. 47 1 48 2021-10-25 Null <null@apple.com> 2 49 -
branches/safari-612-branch/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r284401 r284808 3142 3142 if (base.isNull()) 3143 3143 structure = globalObject->nullPrototypeObjectStructure(); 3144 else if (base.isObject()) 3145 structure = m_vm.structureCache.emptyObjectStructureConcurrently(globalObject, base.getObject(), JSFinalObject::defaultInlineCapacity()); 3144 else if (base.isObject()) { 3145 // Having a bad time clears the structureCache, and so it should invalidate this structure. 3146 bool isHavingABadTime = globalObject->isHavingABadTime(); 3147 WTF::loadLoadFence(); 3148 if (!isHavingABadTime) 3149 m_graph.watchpoints().addLazily(globalObject->havingABadTimeWatchpoint()); 3150 // Normally, we would always install a watchpoint. In this case, however, if we haveABadTime, we 3151 // still want to optimize. There is no watchpoint for that case though, so we need to make sure this load 3152 // does not get hoisted above the check. 3153 WTF::loadLoadFence(); 3154 structure = m_vm.structureCache 3155 .emptyObjectStructureConcurrently(globalObject, base.getObject(), JSFinalObject::defaultInlineCapacity()); 3156 } 3146 3157 3147 3158 if (structure) { -
branches/safari-612-branch/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp
r284401 r284808 842 842 if (base.isNull()) 843 843 structure = globalObject->nullPrototypeObjectStructure(); 844 else if (base.isObject()) 845 structure = globalObject->vm().structureCache.emptyObjectStructureConcurrently(globalObject, base.getObject(), JSFinalObject::defaultInlineCapacity()); 844 else if (base.isObject()) { 845 // Having a bad time clears the structureCache, and so it should invalidate this structure. 846 bool isHavingABadTime = globalObject->isHavingABadTime(); 847 WTF::loadLoadFence(); 848 if (!isHavingABadTime) 849 m_graph.watchpoints().addLazily(globalObject->havingABadTimeWatchpoint()); 850 // Normally, we would always install a watchpoint. In this case, however, if we haveABadTime, we 851 // still want to optimize. There is no watchpoint for that case though, so we need to make sure this load 852 // does not get hoisted above the check. 853 WTF::loadLoadFence(); 854 structure = globalObject->vm().structureCache 855 .emptyObjectStructureConcurrently(globalObject, base.getObject(), JSFinalObject::defaultInlineCapacity()); 856 } 846 857 847 858 if (structure) { -
branches/safari-612-branch/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r284403 r284808 1929 1929 return; 1930 1930 1931 // This must happen first, because the compiler thread may race with haveABadTime. 1932 // Let R_BT, W_BT <- Read/Fire the watchpoint, R_SC, W_SC <- Read/clear the structure cache. 1933 // The possible interleavings are: 1934 // R_BT, R_SC, W_SC, W_BT: Compiler thread installs a watchpoint, and the code is discarded. 1935 // R_BT, W_SC, R_SC, W_BT: ^ Same 1936 // R_BT, W_SC, W_BT, W_SC: ^ Same 1937 // W_SC, R_BT, R_SC, W_BT: ^ Same 1938 // W_SC, R_BT, W_BT, R_SC: ^ Same 1939 // W_SC, W_BT, R_BT, R_SC: No watchpoint is installed, but we could not see old structures from the cache. 1931 1940 vm.structureCache.clear(); // We may be caching array structures in here. 1932 1941 -
branches/safari-612-branch/Source/JavaScriptCore/runtime/StructureCache.cpp
r277909 r284808 31 31 32 32 namespace JSC { 33 34 void StructureCache::clear() 35 { 36 Locker locker { m_lock }; 37 m_structures.clear(); 38 } 33 39 34 40 inline Structure* StructureCache::createEmptyStructure(JSGlobalObject* globalObject, JSObject* prototype, const TypeInfo& typeInfo, const ClassInfo* classInfo, IndexingType indexingType, unsigned inlineCapacity, bool makePolyProtoStructure, FunctionExecutable* executable) -
branches/safari-612-branch/Source/JavaScriptCore/runtime/StructureCache.h
r244313 r284808 49 49 } 50 50 51 void clear() { m_structures.clear(); }51 JS_EXPORT_PRIVATE void clear(); 52 52 53 53 JS_EXPORT_PRIVATE Structure* emptyObjectStructureForPrototype(JSGlobalObject*, JSObject*, unsigned inlineCapacity, bool makePolyProtoStructure = false, FunctionExecutable* = nullptr);
Note:
See TracChangeset
for help on using the changeset viewer.