Skip to content

Commit c731d80

Browse files
author
Mark Lam
committed
Move m_doesGC from Heap to VM.
https://bugs.webkit.org/show_bug.cgi?id=232975 rdar://85277492 Reviewed by Filip Pizlo. Source/JavaScriptCore: m_doesGC is only needed for ENABLE(DFG_DOES_GC_VALIDATION), and is used for checking if the VM thread's execution is in a state that can allow GC to run. Hence, it is more related to VM thread execution as opposed to the state of the Heap. This patch moves m_doesGC from Heap to VM to get it out of the way of upcoming Global GC work. Also change DeferGC, DeferGCForAWhile, and GCDeferralContext to take a VM& instead of a Heap&. DeferGC and GCDeferralContext need to access VM& in order to call VM::verifyCanGC(). DeferGCForAWhile does not need VM&, but we're changing it to be consistent with DeferGC. There should be no perf impact for this change. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::jettison): * bytecode/UnlinkedFunctionExecutable.cpp: (JSC::UnlinkedFunctionExecutable::decodeCachedCodeBlocks): * bytecode/Watchpoint.cpp: (JSC::WatchpointSet::fireAllWatchpoints): * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::generate): * dfg/DFGDoesGCCheck.cpp: * dfg/DFGOSRExit.cpp: (JSC::DFG::JSC_DEFINE_JIT_OPERATION): (JSC::DFG::OSRExit::compileExit): * dfg/DFGOperations.cpp: (JSC::DFG::JSC_DEFINE_JIT_OPERATION): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileLoopHint): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): (JSC::FTL::JSC_DEFINE_JIT_OPERATION): * ftl/FTLOperations.cpp: (JSC::FTL::JSC_DEFINE_JIT_OPERATION): * heap/CompleteSubspace.cpp: (JSC::CompleteSubspace::tryAllocateSlow): (JSC::CompleteSubspace::reallocatePreciseAllocationNonVirtual): * heap/CompleteSubspaceInlines.h: (JSC::CompleteSubspace::allocateNonVirtual): * heap/DeferGC.h: (JSC::DeferGC::DeferGC): Deleted. (JSC::DeferGC::~DeferGC): Deleted. (JSC::DeferGCForAWhile::DeferGCForAWhile): Deleted. (JSC::DeferGCForAWhile::~DeferGCForAWhile): Deleted. * heap/DeferGCInlines.h: Added. (JSC::DeferGC::DeferGC): (JSC::DeferGC::~DeferGC): (JSC::DeferGCForAWhile::DeferGCForAWhile): (JSC::DeferGCForAWhile::~DeferGCForAWhile): * heap/GCDeferralContext.h: * heap/GCDeferralContextInlines.h: (JSC::GCDeferralContext::GCDeferralContext): (JSC::GCDeferralContext::~GCDeferralContext): * heap/Heap.cpp: (JSC::Heap::collectNow): (JSC::Heap::collectAsync): (JSC::Heap::collectSync): (JSC::Heap::stopIfNecessarySlow): (JSC::Heap::collectIfNecessaryOrDefer): * heap/Heap.h: (JSC::Heap::addressOfDoesGC): Deleted. (JSC::Heap::setDoesGCExpectation): Deleted. (JSC::Heap::verifyCanGC): Deleted. * heap/HeapInlines.h: (JSC::Heap::acquireAccess): (JSC::Heap::stopIfNecessary): * heap/HeapSnapshotBuilder.cpp: (JSC::HeapSnapshotBuilder::json): * heap/IncrementalSweeper.cpp: (JSC::IncrementalSweeper::sweepNextBlock): * heap/LocalAllocatorInlines.h: (JSC::LocalAllocator::allocate): * heap/PreciseAllocation.cpp: (JSC::PreciseAllocation::tryCreate): (JSC::PreciseAllocation::createForLowerTier): * inspector/JSInjectedScriptHost.cpp: (Inspector::JSInjectedScriptHost::queryHolders): * inspector/agents/InspectorHeapAgent.cpp: (Inspector::InspectorHeapAgent::getPreview): (Inspector::InspectorHeapAgent::getRemoteObject): * inspector/agents/InspectorScriptProfilerAgent.cpp: (Inspector::InspectorScriptProfilerAgent::trackingComplete): * interpreter/ShadowChickenInlines.h: (JSC::ShadowChicken::iterate): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITWorklist.cpp: (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::removeAllReadyPlansForVM): * jit/Repatch.cpp: (JSC::fireWatchpointsAndClearStubIfNeeded): (JSC::tryCacheGetBy): (JSC::tryCacheArrayGetByVal): (JSC::tryCachePutBy): (JSC::tryCacheArrayPutByVal): (JSC::tryCacheDeleteBy): (JSC::tryCacheInBy): (JSC::tryCacheHasPrivateBrand): (JSC::tryCacheCheckPrivateBrand): (JSC::tryCacheSetPrivateBrand): (JSC::tryCacheInstanceOf): (JSC::linkPolymorphicCall): * jsc.cpp: (JSC_DEFINE_HOST_FUNCTION): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): (JSC::LLInt::LLINT_SLOW_PATH_DECL): * runtime/CachedTypes.cpp: (JSC::decodeCodeBlockImpl): * runtime/ConcurrentJSLock.h: (JSC::GCSafeConcurrentJSLocker::GCSafeConcurrentJSLocker): * runtime/ExceptionFuzz.cpp: (JSC::doExceptionFuzzing): * runtime/JSArray.cpp: (JSC::JSArray::unshiftCountWithArrayStorage): * runtime/JSArrayBufferView.cpp: (JSC::JSArrayBufferView::slowDownAndWasteMemory): * runtime/JSCellInlines.h: * runtime/JSGenericTypedArrayViewInlines.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::haveABadTime): * runtime/JSObject.cpp: (JSC::JSObject::enterDictionaryIndexingModeWhenArrayStorageAlreadyExists): (JSC::JSObject::createInitialUndecided): (JSC::JSObject::createInitialInt32): (JSC::JSObject::createInitialDouble): (JSC::JSObject::createInitialContiguous): (JSC::JSObject::createArrayStorage): (JSC::JSObject::convertUndecidedToArrayStorage): (JSC::JSObject::convertInt32ToArrayStorage): (JSC::JSObject::convertDoubleToArrayStorage): (JSC::JSObject::convertContiguousToArrayStorage): (JSC::JSObject::increaseVectorLength): (JSC::JSObject::ensureLengthSlow): (JSC::JSObject::reallocateAndShrinkButterfly): (JSC::createCustomGetterFunction): (JSC::createCustomSetterFunction): * runtime/JSString.h: (JSC::jsSingleCharacterString): (JSC::JSString::toAtomString const): (JSC::JSString::toExistingAtomString const): (JSC::JSString::value const): (JSC::JSString::tryGetValue const): (JSC::JSRopeString::unsafeView const): (JSC::JSRopeString::viewWithUnderlyingString const): (JSC::JSString::unsafeView const): * runtime/JSSymbolTableObject.h: (JSC::symbolTablePut): * runtime/RegExpKey.h: * runtime/RegExpMatchesArray.cpp: (JSC::createEmptyRegExpMatchesArray): * runtime/RegExpMatchesArray.h: (JSC::createRegExpMatchesArray): * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::stackTracesAsJSON): (JSC::SamplingProfiler::reportTopFunctions): (JSC::SamplingProfiler::reportTopBytecodes): * runtime/ScriptExecutable.cpp: (JSC::ScriptExecutable::prepareForExecutionImpl): * runtime/Structure.cpp: (JSC::Structure::materializePropertyTable): (JSC::Structure::addNewPropertyTransition): (JSC::Structure::removeNewPropertyTransition): (JSC::Structure::changePrototypeTransition): (JSC::Structure::attributeChangeTransition): (JSC::Structure::toDictionaryTransition): (JSC::Structure::nonPropertyTransitionSlow): (JSC::Structure::flattenDictionaryStructure): * runtime/StructureInlines.h: (JSC::Structure::add): (JSC::Structure::remove): (JSC::Structure::attributeChange): * runtime/VM.h: (JSC::VM::addressOfDoesGC): (JSC::VM::setDoesGCExpectation): (JSC::VM::verifyCanGC): Source/WebCore: * bindings/js/GCController.cpp: (WebCore::GCController::dumpHeap): * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::createCrossOriginFunction): (WebCore::JSDOMGlobalObject::createCrossOriginGetterSetter): Canonical link: https://commits.webkit.org/244137@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285636 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent e31f42e commit c731d80

60 files changed

Lines changed: 471 additions & 217 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ set(JavaScriptCore_PRIVATE_FRAMEWORK_HEADERS
730730
heap/ConstraintParallelism.h
731731
heap/ConstraintVolatility.h
732732
heap/DeferGC.h
733+
heap/DeferGCInlines.h
733734
heap/DeleteAllCodeEffort.h
734735
heap/DestructionMode.h
735736
heap/FastMallocAlignedMemoryAllocator.h

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,196 @@
1+
2021-11-10 Mark Lam <mark.lam@apple.com>
2+
3+
Move m_doesGC from Heap to VM.
4+
https://bugs.webkit.org/show_bug.cgi?id=232975
5+
rdar://85277492
6+
7+
Reviewed by Filip Pizlo.
8+
9+
m_doesGC is only needed for ENABLE(DFG_DOES_GC_VALIDATION), and is used for checking
10+
if the VM thread's execution is in a state that can allow GC to run. Hence, it is
11+
more related to VM thread execution as opposed to the state of the Heap. This patch
12+
moves m_doesGC from Heap to VM to get it out of the way of upcoming Global GC work.
13+
14+
Also change DeferGC, DeferGCForAWhile, and GCDeferralContext to take a VM& instead
15+
of a Heap&. DeferGC and GCDeferralContext need to access VM& in order to call
16+
VM::verifyCanGC(). DeferGCForAWhile does not need VM&, but we're changing it to be
17+
consistent with DeferGC. There should be no perf impact for this change.
18+
19+
* CMakeLists.txt:
20+
* JavaScriptCore.xcodeproj/project.pbxproj:
21+
* bytecode/CodeBlock.cpp:
22+
(JSC::CodeBlock::jettison):
23+
* bytecode/UnlinkedFunctionExecutable.cpp:
24+
(JSC::UnlinkedFunctionExecutable::decodeCachedCodeBlocks):
25+
* bytecode/Watchpoint.cpp:
26+
(JSC::WatchpointSet::fireAllWatchpoints):
27+
* bytecompiler/BytecodeGenerator.h:
28+
(JSC::BytecodeGenerator::generate):
29+
* dfg/DFGDoesGCCheck.cpp:
30+
* dfg/DFGOSRExit.cpp:
31+
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
32+
(JSC::DFG::OSRExit::compileExit):
33+
* dfg/DFGOperations.cpp:
34+
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
35+
* dfg/DFGSpeculativeJIT.cpp:
36+
(JSC::DFG::SpeculativeJIT::compileLoopHint):
37+
* dfg/DFGSpeculativeJIT32_64.cpp:
38+
(JSC::DFG::SpeculativeJIT::compile):
39+
* dfg/DFGSpeculativeJIT64.cpp:
40+
(JSC::DFG::SpeculativeJIT::compile):
41+
* ftl/FTLLowerDFGToB3.cpp:
42+
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
43+
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
44+
* ftl/FTLOSRExitCompiler.cpp:
45+
(JSC::FTL::compileStub):
46+
(JSC::FTL::JSC_DEFINE_JIT_OPERATION):
47+
* ftl/FTLOperations.cpp:
48+
(JSC::FTL::JSC_DEFINE_JIT_OPERATION):
49+
* heap/CompleteSubspace.cpp:
50+
(JSC::CompleteSubspace::tryAllocateSlow):
51+
(JSC::CompleteSubspace::reallocatePreciseAllocationNonVirtual):
52+
* heap/CompleteSubspaceInlines.h:
53+
(JSC::CompleteSubspace::allocateNonVirtual):
54+
* heap/DeferGC.h:
55+
(JSC::DeferGC::DeferGC): Deleted.
56+
(JSC::DeferGC::~DeferGC): Deleted.
57+
(JSC::DeferGCForAWhile::DeferGCForAWhile): Deleted.
58+
(JSC::DeferGCForAWhile::~DeferGCForAWhile): Deleted.
59+
* heap/DeferGCInlines.h: Added.
60+
(JSC::DeferGC::DeferGC):
61+
(JSC::DeferGC::~DeferGC):
62+
(JSC::DeferGCForAWhile::DeferGCForAWhile):
63+
(JSC::DeferGCForAWhile::~DeferGCForAWhile):
64+
* heap/GCDeferralContext.h:
65+
* heap/GCDeferralContextInlines.h:
66+
(JSC::GCDeferralContext::GCDeferralContext):
67+
(JSC::GCDeferralContext::~GCDeferralContext):
68+
* heap/Heap.cpp:
69+
(JSC::Heap::collectNow):
70+
(JSC::Heap::collectAsync):
71+
(JSC::Heap::collectSync):
72+
(JSC::Heap::stopIfNecessarySlow):
73+
(JSC::Heap::collectIfNecessaryOrDefer):
74+
* heap/Heap.h:
75+
(JSC::Heap::addressOfDoesGC): Deleted.
76+
(JSC::Heap::setDoesGCExpectation): Deleted.
77+
(JSC::Heap::verifyCanGC): Deleted.
78+
* heap/HeapInlines.h:
79+
(JSC::Heap::acquireAccess):
80+
(JSC::Heap::stopIfNecessary):
81+
* heap/HeapSnapshotBuilder.cpp:
82+
(JSC::HeapSnapshotBuilder::json):
83+
* heap/IncrementalSweeper.cpp:
84+
(JSC::IncrementalSweeper::sweepNextBlock):
85+
* heap/LocalAllocatorInlines.h:
86+
(JSC::LocalAllocator::allocate):
87+
* heap/PreciseAllocation.cpp:
88+
(JSC::PreciseAllocation::tryCreate):
89+
(JSC::PreciseAllocation::createForLowerTier):
90+
* inspector/JSInjectedScriptHost.cpp:
91+
(Inspector::JSInjectedScriptHost::queryHolders):
92+
* inspector/agents/InspectorHeapAgent.cpp:
93+
(Inspector::InspectorHeapAgent::getPreview):
94+
(Inspector::InspectorHeapAgent::getRemoteObject):
95+
* inspector/agents/InspectorScriptProfilerAgent.cpp:
96+
(Inspector::InspectorScriptProfilerAgent::trackingComplete):
97+
* interpreter/ShadowChickenInlines.h:
98+
(JSC::ShadowChicken::iterate):
99+
* jit/JITOperations.cpp:
100+
(JSC::JSC_DEFINE_JIT_OPERATION):
101+
* jit/JITWorklist.cpp:
102+
(JSC::JITWorklist::completeAllReadyPlansForVM):
103+
(JSC::JITWorklist::waitUntilAllPlansForVMAreReady):
104+
(JSC::JITWorklist::completeAllPlansForVM):
105+
(JSC::JITWorklist::removeAllReadyPlansForVM):
106+
* jit/Repatch.cpp:
107+
(JSC::fireWatchpointsAndClearStubIfNeeded):
108+
(JSC::tryCacheGetBy):
109+
(JSC::tryCacheArrayGetByVal):
110+
(JSC::tryCachePutBy):
111+
(JSC::tryCacheArrayPutByVal):
112+
(JSC::tryCacheDeleteBy):
113+
(JSC::tryCacheInBy):
114+
(JSC::tryCacheHasPrivateBrand):
115+
(JSC::tryCacheCheckPrivateBrand):
116+
(JSC::tryCacheSetPrivateBrand):
117+
(JSC::tryCacheInstanceOf):
118+
(JSC::linkPolymorphicCall):
119+
* jsc.cpp:
120+
(JSC_DEFINE_HOST_FUNCTION):
121+
* llint/LLIntSlowPaths.cpp:
122+
(JSC::LLInt::jitCompileAndSetHeuristics):
123+
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
124+
* runtime/CachedTypes.cpp:
125+
(JSC::decodeCodeBlockImpl):
126+
* runtime/ConcurrentJSLock.h:
127+
(JSC::GCSafeConcurrentJSLocker::GCSafeConcurrentJSLocker):
128+
* runtime/ExceptionFuzz.cpp:
129+
(JSC::doExceptionFuzzing):
130+
* runtime/JSArray.cpp:
131+
(JSC::JSArray::unshiftCountWithArrayStorage):
132+
* runtime/JSArrayBufferView.cpp:
133+
(JSC::JSArrayBufferView::slowDownAndWasteMemory):
134+
* runtime/JSCellInlines.h:
135+
* runtime/JSGenericTypedArrayViewInlines.h:
136+
* runtime/JSGlobalObject.cpp:
137+
(JSC::JSGlobalObject::haveABadTime):
138+
* runtime/JSObject.cpp:
139+
(JSC::JSObject::enterDictionaryIndexingModeWhenArrayStorageAlreadyExists):
140+
(JSC::JSObject::createInitialUndecided):
141+
(JSC::JSObject::createInitialInt32):
142+
(JSC::JSObject::createInitialDouble):
143+
(JSC::JSObject::createInitialContiguous):
144+
(JSC::JSObject::createArrayStorage):
145+
(JSC::JSObject::convertUndecidedToArrayStorage):
146+
(JSC::JSObject::convertInt32ToArrayStorage):
147+
(JSC::JSObject::convertDoubleToArrayStorage):
148+
(JSC::JSObject::convertContiguousToArrayStorage):
149+
(JSC::JSObject::increaseVectorLength):
150+
(JSC::JSObject::ensureLengthSlow):
151+
(JSC::JSObject::reallocateAndShrinkButterfly):
152+
(JSC::createCustomGetterFunction):
153+
(JSC::createCustomSetterFunction):
154+
* runtime/JSString.h:
155+
(JSC::jsSingleCharacterString):
156+
(JSC::JSString::toAtomString const):
157+
(JSC::JSString::toExistingAtomString const):
158+
(JSC::JSString::value const):
159+
(JSC::JSString::tryGetValue const):
160+
(JSC::JSRopeString::unsafeView const):
161+
(JSC::JSRopeString::viewWithUnderlyingString const):
162+
(JSC::JSString::unsafeView const):
163+
* runtime/JSSymbolTableObject.h:
164+
(JSC::symbolTablePut):
165+
* runtime/RegExpKey.h:
166+
* runtime/RegExpMatchesArray.cpp:
167+
(JSC::createEmptyRegExpMatchesArray):
168+
* runtime/RegExpMatchesArray.h:
169+
(JSC::createRegExpMatchesArray):
170+
* runtime/SamplingProfiler.cpp:
171+
(JSC::SamplingProfiler::stackTracesAsJSON):
172+
(JSC::SamplingProfiler::reportTopFunctions):
173+
(JSC::SamplingProfiler::reportTopBytecodes):
174+
* runtime/ScriptExecutable.cpp:
175+
(JSC::ScriptExecutable::prepareForExecutionImpl):
176+
* runtime/Structure.cpp:
177+
(JSC::Structure::materializePropertyTable):
178+
(JSC::Structure::addNewPropertyTransition):
179+
(JSC::Structure::removeNewPropertyTransition):
180+
(JSC::Structure::changePrototypeTransition):
181+
(JSC::Structure::attributeChangeTransition):
182+
(JSC::Structure::toDictionaryTransition):
183+
(JSC::Structure::nonPropertyTransitionSlow):
184+
(JSC::Structure::flattenDictionaryStructure):
185+
* runtime/StructureInlines.h:
186+
(JSC::Structure::add):
187+
(JSC::Structure::remove):
188+
(JSC::Structure::attributeChange):
189+
* runtime/VM.h:
190+
(JSC::VM::addressOfDoesGC):
191+
(JSC::VM::setDoesGCExpectation):
192+
(JSC::VM::verifyCanGC):
193+
1194
2021-11-10 Saam Barati <sbarati@apple.com>
2195

3196
in_by_val should not constant fold to in_by_id when the property is a property index

‎Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,6 +2051,7 @@
20512051
FE99B2491C24C3D300C82159 /* JITNegGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE99B2481C24B6D300C82159 /* JITNegGenerator.h */; };
20522052
FE9F3FB92613C7890069E89F /* ResourceExhaustion.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9F3FB82613C7880069E89F /* ResourceExhaustion.h */; };
20532053
FE9F3FC826163CA90069E89F /* DeferTermination.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9F3FC626163CA90069E89F /* DeferTermination.h */; settings = {ATTRIBUTES = (Private, ); }; };
2054+
FE9FA7C5273C8B26005D9E70 /* DeferGCInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9FA7C4273C8B26005D9E70 /* DeferGCInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
20542055
FEA08620182B7A0400F6D851 /* Breakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0861E182B7A0400F6D851 /* Breakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
20552056
FEA08621182B7A0400F6D851 /* DebuggerPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */; settings = {ATTRIBUTES = (Private, ); }; };
20562057
FEA3BBA8212B655900E93AD1 /* CallFrameInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA3BBA7212B655800E93AD1 /* CallFrameInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5514,6 +5515,7 @@
55145515
FE9F3FB82613C7880069E89F /* ResourceExhaustion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceExhaustion.h; sourceTree = "<group>"; };
55155516
FE9F3FBA2613C87C0069E89F /* ResourceExhaustion.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceExhaustion.cpp; sourceTree = "<group>"; };
55165517
FE9F3FC626163CA90069E89F /* DeferTermination.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeferTermination.h; sourceTree = "<group>"; };
5518+
FE9FA7C4273C8B26005D9E70 /* DeferGCInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeferGCInlines.h; sourceTree = "<group>"; };
55175519
FEA0861E182B7A0400F6D851 /* Breakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Breakpoint.h; sourceTree = "<group>"; };
55185520
FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerPrimitives.h; sourceTree = "<group>"; };
55195521
FEA3BBA7212B655800E93AD1 /* CallFrameInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallFrameInlines.h; sourceTree = "<group>"; };
@@ -6523,6 +6525,7 @@
65236525
0F7DF12F1E2970D50095951B /* ConstraintVolatility.h */,
65246526
2A7A58EE1808A4C40020BDF7 /* DeferGC.cpp */,
65256527
0F136D4B174AD69B0075B354 /* DeferGC.h */,
6528+
FE9FA7C4273C8B26005D9E70 /* DeferGCInlines.h */,
65266529
0FBB73BA1DEF8644002C009E /* DeleteAllCodeEffort.h */,
65276530
0F9630371D4192C3005609D9 /* DestructionMode.cpp */,
65286531
0F9630381D4192C3005609D9 /* DestructionMode.h */,
@@ -10776,6 +10779,7 @@
1077610779
BC18C4630E16F5CD00B34460 /* SourceProvider.h in Headers */,
1077710780
E49DC16C12EF294E00184A1F /* SourceProviderCache.h in Headers */,
1077810781
E49DC16D12EF295300184A1F /* SourceProviderCacheItem.h in Headers */,
10782+
FE9FA7C5273C8B26005D9E70 /* DeferGCInlines.h in Headers */,
1077910783
0FDE87FC1DFE6E510064C390 /* SpaceTimeMutatorScheduler.h in Headers */,
1078010784
0FB7F39E15ED8E4600F167B2 /* SparseArrayValueMap.h in Headers */,
1078110785
A7386554118697B400540279 /* SpecializedThunkJIT.h in Headers */,

‎Source/JavaScriptCore/bytecode/CodeBlock.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2275,7 +2275,7 @@ void CodeBlock::jettison(Profiler::JettisonReason reason, ReoptimizationMode mod
22752275
}
22762276
#endif // ENABLE(DFG_JIT)
22772277

2278-
DeferGCForAWhile deferGC(*heap());
2278+
DeferGCForAWhile deferGC(vm);
22792279

22802280
// We want to accomplish two things here:
22812281
// 1) Make sure that if this CodeBlock is on the stack right now, then if we return to it

‎Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ void UnlinkedFunctionExecutable::decodeCachedCodeBlocks(VM& vm)
265265
int32_t cachedCodeBlockForCallOffset = m_cachedCodeBlockForCallOffset;
266266
int32_t cachedCodeBlockForConstructOffset = m_cachedCodeBlockForConstructOffset;
267267

268-
DeferGC deferGC(vm.heap);
268+
DeferGC deferGC(vm);
269269

270270
// No need to clear m_unlinkedCodeBlockForCall here, since we moved the decoder out of the same slot
271271
if (cachedCodeBlockForCallOffset)

‎Source/JavaScriptCore/bytecode/Watchpoint.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2012-2015 Apple Inc. All rights reserved.
2+
* Copyright (C) 2012-2021 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -135,7 +135,7 @@ void WatchpointSet::fireAllWatchpoints(VM& vm, const FireDetail& detail)
135135
// for most Watchpoints to be destructed while they're in the middle of firing.
136136
// This GC could also destroy us, and we're not in a safe state to be destroyed.
137137
// The safest thing to do is to DeferGCForAWhile to prevent this GC from happening.
138-
DeferGCForAWhile deferGC(vm.heap);
138+
DeferGCForAWhile deferGC(vm);
139139

140140
while (!m_set.isEmpty()) {
141141
Watchpoint* watchpoint = m_set.begin();

‎Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2008-2019 Apple Inc. All rights reserved.
2+
* Copyright (C) 2008-2021 Apple Inc. All rights reserved.
33
* Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
44
* Copyright (C) 2012 Igalia, S.L.
55
*
@@ -382,7 +382,7 @@ namespace JSC {
382382
if (UNLIKELY(Options::reportBytecodeCompileTimes()))
383383
before = MonotonicTime::now();
384384

385-
DeferGC deferGC(vm.heap);
385+
DeferGC deferGC(vm);
386386
auto bytecodeGenerator = makeUnique<BytecodeGenerator>(vm, node, unlinkedCodeBlock, codeGenerationMode, parentScopeTDZVariables, privateNameEnvironment);
387387
unsigned size;
388388
auto result = bytecodeGenerator->generate(size);

‎Source/JavaScriptCore/dfg/DFGDoesGCCheck.cpp‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020 Apple Inc. All rights reserved.
2+
* Copyright (C) 2020-2021 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -30,7 +30,6 @@
3030
#include "CodeBlock.h"
3131
#include "DFGGraph.h"
3232
#include "DFGNodeType.h"
33-
#include "Heap.h"
3433
#include "JSCJSValueInlines.h"
3534
#include "Options.h"
3635
#include "VMInspector.h"

‎Source/JavaScriptCore/dfg/DFGOSRExit.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ JSC_DEFINE_JIT_OPERATION(operationCompileOSRExit, void, (CallFrame* callFrame, v
150150
if constexpr (validateDFGDoesGC) {
151151
// We're about to exit optimized code. So, there's no longer any optimized
152152
// code running that expects no GC.
153-
vm.heap.setDoesGCExpectation(true, DoesGCCheck::Special::DFGOSRExit);
153+
vm.setDoesGCExpectation(true, DoesGCCheck::Special::DFGOSRExit);
154154
}
155155

156156
if (vm.callFrameForCatch)
@@ -162,7 +162,7 @@ JSC_DEFINE_JIT_OPERATION(operationCompileOSRExit, void, (CallFrame* callFrame, v
162162

163163
// It's sort of preferable that we don't GC while in here. Anyways, doing so wouldn't
164164
// really be profitable.
165-
DeferGCForAWhile deferGC(vm.heap);
165+
DeferGCForAWhile deferGC(vm);
166166

167167
uint32_t exitIndex = vm.osrExitIndex;
168168
OSRExit& exit = codeBlock->jitCode()->dfg()->m_osrExit[exitIndex];
@@ -757,10 +757,10 @@ void OSRExit::compileExit(CCallHelpers& jit, VM& vm, const OSRExit& exit, const
757757
DoesGCCheck check;
758758
check.u.encoded = DoesGCCheck::encode(true, DoesGCCheck::Special::DFGOSRExit);
759759
#if USE(JSVALUE64)
760-
jit.store64(CCallHelpers::TrustedImm64(check.u.encoded), vm.heap.addressOfDoesGC());
760+
jit.store64(CCallHelpers::TrustedImm64(check.u.encoded), vm.addressOfDoesGC());
761761
#else
762-
jit.store32(CCallHelpers::TrustedImm32(check.u.other), &vm.heap.addressOfDoesGC()->u.other);
763-
jit.store32(CCallHelpers::TrustedImm32(check.u.nodeIndex), &vm.heap.addressOfDoesGC()->u.nodeIndex);
762+
jit.store32(CCallHelpers::TrustedImm32(check.u.other), &vm.addressOfDoesGC()->u.other);
763+
jit.store32(CCallHelpers::TrustedImm32(check.u.nodeIndex), &vm.addressOfDoesGC()->u.nodeIndex);
764764
#endif
765765
}
766766
}

‎Source/JavaScriptCore/dfg/DFGOperations.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,7 @@ JSC_DEFINE_JIT_OPERATION(operationCreateDirectArgumentsDuringExit, JSCell*, (VM*
21172117
CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
21182118
JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
21192119

2120-
DeferGCForAWhile deferGC(vm.heap);
2120+
DeferGCForAWhile deferGC(vm);
21212121

21222122
CodeBlock* codeBlock;
21232123
if (inlineCallFrame)
@@ -2147,7 +2147,7 @@ JSC_DEFINE_JIT_OPERATION(operationCreateClonedArgumentsDuringExit, JSCell*, (VM*
21472147
CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
21482148
JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
21492149

2150-
DeferGCForAWhile deferGC(vm.heap);
2150+
DeferGCForAWhile deferGC(vm);
21512151

21522152
CodeBlock* codeBlock;
21532153
if (inlineCallFrame)
@@ -3735,7 +3735,7 @@ JSC_DEFINE_JIT_OPERATION(operationTriggerReoptimizationNow, void, (CodeBlock* co
37353735
{
37363736
// It's sort of preferable that we don't GC while in here. Anyways, doing so wouldn't
37373737
// really be profitable.
3738-
DeferGCForAWhile deferGC(codeBlock->vm().heap);
3738+
DeferGCForAWhile deferGC(codeBlock->vm());
37393739

37403740
sanitizeStackForVM(codeBlock->vm());
37413741

@@ -3855,7 +3855,7 @@ JSC_DEFINE_JIT_OPERATION(operationTriggerTierUpNow, void, (VM* vmPointer))
38553855
VM& vm = *vmPointer;
38563856
CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
38573857
JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
3858-
DeferGCForAWhile deferGC(vm.heap);
3858+
DeferGCForAWhile deferGC(vm);
38593859
CodeBlock* codeBlock = callFrame->codeBlock();
38603860

38613861
sanitizeStackForVM(vm);
@@ -4121,7 +4121,7 @@ JSC_DEFINE_JIT_OPERATION(operationTriggerTierUpNowInLoop, void, (VM* vmPointer,
41214121
VM& vm = *vmPointer;
41224122
CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
41234123
JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
4124-
DeferGCForAWhile deferGC(vm.heap);
4124+
DeferGCForAWhile deferGC(vm);
41254125
CodeBlock* codeBlock = callFrame->codeBlock();
41264126
BytecodeIndex bytecodeIndex = BytecodeIndex::fromBits(bytecodeIndexBits);
41274127

@@ -4153,7 +4153,7 @@ JSC_DEFINE_JIT_OPERATION(operationTriggerOSREntryNow, char*, (VM* vmPointer, uns
41534153
VM& vm = *vmPointer;
41544154
CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
41554155
JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
4156-
DeferGCForAWhile deferGC(vm.heap);
4156+
DeferGCForAWhile deferGC(vm);
41574157
CodeBlock* codeBlock = callFrame->codeBlock();
41584158
BytecodeIndex bytecodeIndex = BytecodeIndex::fromBits(bytecodeIndexBits);
41594159

0 commit comments

Comments
 (0)