Changeset 284576 in webkit
- Timestamp:
- Oct 20, 2021, 3:08:45 PM (5 years ago)
- Location:
- trunk/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
-
trunk/Source/JavaScriptCore/ChangeLog
r284573 r284576 1 2021-10-20 Justin Michaud <justin_michaud@apple.com> 2 3 We should watch isHavingABadTime if we read from the structureCache 4 https://bugs.webkit.org/show_bug.cgi?id=232019 5 6 Reviewed by Yusuke Suzuki. 7 8 We should lock the structure cache when we clear it, and the compiler thread should 9 watch isHavingABadTime in the case that the cache might get cleared. 10 11 * dfg/DFGAbstractInterpreterInlines.h: 12 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 13 * dfg/DFGConstantFoldingPhase.cpp: 14 (JSC::DFG::ConstantFoldingPhase::foldConstants): 15 * runtime/JSGlobalObject.cpp: 16 (JSC::JSGlobalObject::haveABadTime): 17 * runtime/StructureCache.cpp: 18 (JSC::StructureCache::clear): 19 * runtime/StructureCache.h: 20 (JSC::StructureCache::clear): Deleted. 21 1 22 2021-10-20 Michael Saboff <msaboff@apple.com> 2 23 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r284330 r284576 3127 3127 if (base.isNull()) 3128 3128 structure = globalObject->nullPrototypeObjectStructure(); 3129 else if (base.isObject()) 3130 structure = m_vm.structureCache.emptyObjectStructureConcurrently(globalObject, base.getObject(), JSFinalObject::defaultInlineCapacity()); 3129 else if (base.isObject()) { 3130 // Having a bad time clears the structureCache, and so it should invalidate this structure. 3131 bool isHavingABadTime = globalObject->isHavingABadTime(); 3132 WTF::loadLoadFence(); 3133 if (!isHavingABadTime) 3134 m_graph.watchpoints().addLazily(globalObject->havingABadTimeWatchpoint()); 3135 // Normally, we would always install a watchpoint. In this case, however, if we haveABadTime, we 3136 // still want to optimize. There is no watchpoint for that case though, so we need to make sure this load 3137 // does not get hoisted above the check. 3138 WTF::loadLoadFence(); 3139 structure = m_vm.structureCache 3140 .emptyObjectStructureConcurrently(globalObject, base.getObject(), JSFinalObject::defaultInlineCapacity()); 3141 } 3131 3142 3132 3143 if (structure) { -
trunk/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp
r284330 r284576 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) { -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r284435 r284576 1985 1985 return; 1986 1986 1987 // This must happen first, because the compiler thread may race with haveABadTime. 1988 // Let R_BT, W_BT <- Read/Fire the watchpoint, R_SC, W_SC <- Read/clear the structure cache. 1989 // The possible interleavings are: 1990 // R_BT, R_SC, W_SC, W_BT: Compiler thread installs a watchpoint, and the code is discarded. 1991 // R_BT, W_SC, R_SC, W_BT: ^ Same 1992 // R_BT, W_SC, W_BT, W_SC: ^ Same 1993 // W_SC, R_BT, R_SC, W_BT: ^ Same 1994 // W_SC, R_BT, W_BT, R_SC: ^ Same 1995 // W_SC, W_BT, R_BT, R_SC: No watchpoint is installed, but we could not see old structures from the cache. 1987 1996 vm.structureCache.clear(); // We may be caching array structures in here. 1988 1997 -
trunk/Source/JavaScriptCore/runtime/StructureCache.cpp
r277909 r284576 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) -
trunk/Source/JavaScriptCore/runtime/StructureCache.h
r244313 r284576 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.