LinkBuffer and ExecutableAllocator shouldn't have anything to do with VM
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Mar 2017 22:55:53 +0000 (22:55 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Mar 2017 22:55:53 +0000 (22:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170210

Reviewed by Mark Lam.

Source/JavaScriptCore:

This is one more step in the direction of PIC-ified Wasm.
LinkBuffer and ExecutableAllocator have no business knowing about VM.

* assembler/LinkBuffer.cpp:
(JSC::LinkBuffer::allocate):
* assembler/LinkBuffer.h:
(JSC::LinkBuffer::LinkBuffer):
(JSC::LinkBuffer::vm): Deleted.
* b3/B3Compile.cpp:
(JSC::B3::compile):
* b3/B3Compile.h:
* b3/air/testair.cpp:
* b3/testb3.cpp:
(JSC::B3::compileProc):
(JSC::B3::compileAndRun):
(JSC::B3::testLoadAcq42):
(JSC::B3::testAddArgZeroImmZDef):
(JSC::B3::testAddLoadTwice):
(JSC::B3::testMulLoadTwice):
(JSC::B3::testMulAddArgsLeft):
(JSC::B3::testMulAddArgsRight):
(JSC::B3::testMulAddArgsLeft32):
(JSC::B3::testMulAddArgsRight32):
(JSC::B3::testMulSubArgsLeft):
(JSC::B3::testMulSubArgsRight):
(JSC::B3::testMulSubArgsLeft32):
(JSC::B3::testMulSubArgsRight32):
(JSC::B3::testMulNegArgs):
(JSC::B3::testMulNegArgs32):
(JSC::B3::testCompareFloatToDoubleThroughPhi):
(JSC::B3::testDoubleToFloatThroughPhi):
(JSC::B3::testReduceFloatToDoubleValidates):
(JSC::B3::testDoubleProducerPhiToFloatConversion):
(JSC::B3::testDoubleProducerPhiToFloatConversionWithDoubleConsumer):
(JSC::B3::testDoubleProducerPhiWithNonFloatConst):
(JSC::B3::testIToD64Arg):
(JSC::B3::testIToF64Arg):
(JSC::B3::testIToD32Arg):
(JSC::B3::testIToF32Arg):
(JSC::B3::testIToD64Mem):
(JSC::B3::testIToF64Mem):
(JSC::B3::testIToD32Mem):
(JSC::B3::testIToF32Mem):
(JSC::B3::testIToDReducedToIToF64Arg):
(JSC::B3::testIToDReducedToIToF32Arg):
(JSC::B3::testStoreRelAddLoadAcq32):
(JSC::B3::testStoreRelAddLoadAcq8):
(JSC::B3::testStoreRelAddFenceLoadAcq8):
(JSC::B3::testStoreRelAddLoadAcq16):
(JSC::B3::testStoreRelAddLoadAcq64):
(JSC::B3::testBranch):
(JSC::B3::testBranchPtr):
(JSC::B3::testDiamond):
(JSC::B3::testBranchNotEqual):
(JSC::B3::testBranchNotEqualCommute):
(JSC::B3::testBranchNotEqualNotEqual):
(JSC::B3::testBranchEqual):
(JSC::B3::testBranchEqualEqual):
(JSC::B3::testBranchEqualCommute):
(JSC::B3::testBranchEqualEqual1):
(JSC::B3::testBranchLoadPtr):
(JSC::B3::testBranchLoad32):
(JSC::B3::testBranchLoad8S):
(JSC::B3::testBranchLoad8Z):
(JSC::B3::testBranchLoad16S):
(JSC::B3::testBranchLoad16Z):
(JSC::B3::testBranch8WithLoad8ZIndex):
(JSC::B3::testComplex):
(JSC::B3::testSimpleCheck):
(JSC::B3::testCheckFalse):
(JSC::B3::testCheckTrue):
(JSC::B3::testCheckLessThan):
(JSC::B3::testCheckMegaCombo):
(JSC::B3::testCheckTrickyMegaCombo):
(JSC::B3::testCheckTwoMegaCombos):
(JSC::B3::testCheckTwoNonRedundantMegaCombos):
(JSC::B3::testCheckAddImm):
(JSC::B3::testCheckAddImmCommute):
(JSC::B3::testCheckAddImmSomeRegister):
(JSC::B3::testCheckAdd):
(JSC::B3::testCheckAdd64):
(JSC::B3::testCheckAddFold):
(JSC::B3::testCheckAddFoldFail):
(JSC::B3::testCheckAddSelfOverflow64):
(JSC::B3::testCheckAddSelfOverflow32):
(JSC::B3::testCheckSubImm):
(JSC::B3::testCheckSubBadImm):
(JSC::B3::testCheckSub):
(JSC::B3::testCheckSub64):
(JSC::B3::testCheckSubFold):
(JSC::B3::testCheckSubFoldFail):
(JSC::B3::testCheckNeg):
(JSC::B3::testCheckNeg64):
(JSC::B3::testCheckMul):
(JSC::B3::testCheckMulMemory):
(JSC::B3::testCheckMul2):
(JSC::B3::testCheckMul64):
(JSC::B3::testCheckMulFold):
(JSC::B3::testCheckMulFoldFail):
(JSC::B3::testCheckMul64SShr):
(JSC::B3::testSwitch):
(JSC::B3::testSwitchChillDiv):
(JSC::B3::testSwitchTargettingSameBlock):
(JSC::B3::testSwitchTargettingSameBlockFoldPathConstant):
(JSC::B3::testBasicSelect):
(JSC::B3::testSelectTest):
(JSC::B3::testSelectCompareDouble):
(JSC::B3::testSelectDouble):
(JSC::B3::testSelectDoubleTest):
(JSC::B3::testSelectDoubleCompareDouble):
(JSC::B3::testSelectFloatCompareFloat):
(JSC::B3::testSelectFold):
(JSC::B3::testSelectInvert):
(JSC::B3::testCheckSelect):
(JSC::B3::testCheckSelectCheckSelect):
(JSC::B3::testCheckSelectAndCSE):
(JSC::B3::testTrivialInfiniteLoop):
(JSC::B3::testFoldPathEqual):
(JSC::B3::testLShiftSelf32):
(JSC::B3::testRShiftSelf32):
(JSC::B3::testURShiftSelf32):
(JSC::B3::testLShiftSelf64):
(JSC::B3::testRShiftSelf64):
(JSC::B3::testURShiftSelf64):
(JSC::B3::testPatchpointDoubleRegs):
(JSC::B3::testSpillDefSmallerThanUse):
(JSC::B3::testSpillUseLargerThanDef):
(JSC::B3::testLateRegister):
(JSC::B3::testInterpreter):
(JSC::B3::testEntrySwitchSimple):
(JSC::B3::testEntrySwitchNoEntrySwitch):
(JSC::B3::testEntrySwitchWithCommonPaths):
(JSC::B3::testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint):
(JSC::B3::testEntrySwitchLoop):
(JSC::B3::testSomeEarlyRegister):
(JSC::B3::testTerminalPatchpointThatNeedsToBeSpilled):
(JSC::B3::testTerminalPatchpointThatNeedsToBeSpilled2):
(JSC::B3::testPatchpointTerminalReturnValue):
(JSC::B3::testMemoryFence):
(JSC::B3::testStoreFence):
(JSC::B3::testLoadFence):
(JSC::B3::testPCOriginMapDoesntInsertNops):
(JSC::B3::testPinRegisters):
(JSC::B3::testX86LeaAddAddShlLeft):
(JSC::B3::testX86LeaAddAddShlRight):
(JSC::B3::testX86LeaAddAdd):
(JSC::B3::testX86LeaAddShlRight):
(JSC::B3::testX86LeaAddShlLeftScale1):
(JSC::B3::testX86LeaAddShlLeftScale2):
(JSC::B3::testX86LeaAddShlLeftScale4):
(JSC::B3::testX86LeaAddShlLeftScale8):
(JSC::B3::testAddShl32):
(JSC::B3::testAddShl64):
(JSC::B3::testAddShl65):
(JSC::B3::testLoadBaseIndexShift2):
(JSC::B3::testLoadBaseIndexShift32):
(JSC::B3::testOptimizeMaterialization):
(JSC::B3::testAtomicWeakCAS):
(JSC::B3::testAtomicStrongCAS):
(JSC::B3::testAtomicXchg):
(JSC::B3::testDepend32):
(JSC::B3::testDepend64):
(JSC::B3::testWasmBoundsCheck):
(JSC::B3::testWasmAddress):
(JSC::B3::run):
(JSC::B3::compile): Deleted.
* bytecode/PolymorphicAccess.cpp:
(JSC::PolymorphicAccess::regenerate):
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):
* dfg/DFGLazyJSValue.cpp:
(JSC::DFG::LazyJSValue::emit):
* dfg/DFGOSRExitCompiler.cpp:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
* dfg/DFGThunks.cpp:
(JSC::DFG::osrExitGenerationThunkGenerator):
(JSC::DFG::osrEntryThunkGenerator):
* ftl/FTLCompile.cpp:
(JSC::FTL::compile):
* ftl/FTLLazySlowPath.cpp:
(JSC::FTL::LazySlowPath::generate):
* ftl/FTLLink.cpp:
(JSC::FTL::link):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstruct):
(JSC::FTL::DFG::LowerDFGToB3::compileTailCall):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
(JSC::FTL::DFG::LowerDFGToB3::compileCallEval):
* ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::compileStub):
* ftl/FTLOSRExitHandle.cpp:
(JSC::FTL::OSRExitHandle::emitExitThunk):
* ftl/FTLSlowPathCall.cpp:
(JSC::FTL::SlowPathCallContext::makeCall):
* ftl/FTLSlowPathCall.h:
(JSC::FTL::callOperation):
* ftl/FTLState.h:
* ftl/FTLThunks.cpp:
(JSC::FTL::genericGenerationThunkGenerator):
(JSC::FTL::slowPathCallThunkGenerator):
* ftl/FTLThunks.h:
(JSC::FTL::generateIfNecessary):
(JSC::FTL::Thunks::getSlowPathCallThunk):
* jit/AssemblyHelpers.cpp:
(JSC::AssemblyHelpers::emitDumbVirtualCall):
* jit/AssemblyHelpers.h:
* jit/ExecutableAllocator.cpp:
(JSC::ExecutableAllocator::initializeAllocator):
(JSC::ExecutableAllocator::singleton):
(JSC::ExecutableAllocator::ExecutableAllocator):
(JSC::ExecutableAllocator::allocate):
* jit/ExecutableAllocator.h:
* jit/JIT.cpp:
(JSC::JIT::compileWithoutLinking):
* jit/JITCall.cpp:
(JSC::JIT::compileCallEvalSlowCase):
* jit/JITMathIC.h:
(JSC::JITMathIC::generateOutOfLine):
* jit/JITOpcodes.cpp:
(JSC::JIT::privateCompileHasIndexedProperty):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::privateCompileHasIndexedProperty):
* jit/JITOperations.cpp:
* jit/JITOperations.h:
* jit/JITPropertyAccess.cpp:
(JSC::JIT::stringGetByValStubGenerator):
(JSC::JIT::privateCompileGetByVal):
(JSC::JIT::privateCompileGetByValWithCachedId):
(JSC::JIT::privateCompilePutByVal):
(JSC::JIT::privateCompilePutByValWithCachedId):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::stringGetByValStubGenerator):
* jit/JITStubRoutine.h:
* jit/Repatch.cpp:
(JSC::ftlThunkAwareRepatchCall):
(JSC::linkPolymorphicCall):
* jit/SpecializedThunkJIT.h:
(JSC::SpecializedThunkJIT::finalize):
* jit/ThunkGenerators.cpp:
(JSC::throwExceptionFromCallSlowPathGenerator):
(JSC::linkCallThunkGenerator):
(JSC::linkPolymorphicCallThunkGenerator):
(JSC::virtualThunkFor):
(JSC::nativeForGenerator):
(JSC::arityFixupGenerator):
(JSC::unreachableGenerator):
(JSC::boundThisNoArgsFunctionCallGenerator):
(JSC::throwExceptionFromWasmThunkGenerator):
* llint/LLIntThunks.cpp:
(JSC::LLInt::generateThunkWithJumpTo):
* runtime/SamplingProfiler.cpp:
(JSC::SamplingProfiler::takeSample):
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
* runtime/VMTraps.cpp:
(JSC::VMTraps::tryInstallTrapBreakpoints):
* tools/VMInspector.cpp:
* wasm/WasmBinding.cpp:
(JSC::Wasm::wasmToJs):
(JSC::Wasm::wasmToWasm):
(JSC::Wasm::exitStubGenerator):
* wasm/WasmPlan.cpp:
(JSC::Wasm::Plan::complete):
* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::compile):
(JSC::Yarr::jitCompile):

Source/WebCore:

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::compileSelector):
(WebCore::SelectorCompiler::SelectorCodeGenerator::compile):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214571 268f45cc-cd09-0410-ab3c-d52691b4dbfc

53 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/assembler/LinkBuffer.cpp
Source/JavaScriptCore/assembler/LinkBuffer.h
Source/JavaScriptCore/b3/B3Compile.cpp
Source/JavaScriptCore/b3/B3Compile.h
Source/JavaScriptCore/b3/air/testair.cpp
Source/JavaScriptCore/b3/testb3.cpp
Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp
Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp
Source/JavaScriptCore/dfg/DFGOSRExitCompiler.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
Source/JavaScriptCore/dfg/DFGThunks.cpp
Source/JavaScriptCore/ftl/FTLCompile.cpp
Source/JavaScriptCore/ftl/FTLLazySlowPath.cpp
Source/JavaScriptCore/ftl/FTLLink.cpp
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
Source/JavaScriptCore/ftl/FTLOSRExitHandle.cpp
Source/JavaScriptCore/ftl/FTLSlowPathCall.cpp
Source/JavaScriptCore/ftl/FTLSlowPathCall.h
Source/JavaScriptCore/ftl/FTLState.h
Source/JavaScriptCore/ftl/FTLThunks.cpp
Source/JavaScriptCore/ftl/FTLThunks.h
Source/JavaScriptCore/jit/AssemblyHelpers.cpp
Source/JavaScriptCore/jit/AssemblyHelpers.h
Source/JavaScriptCore/jit/ExecutableAllocator.cpp
Source/JavaScriptCore/jit/ExecutableAllocator.h
Source/JavaScriptCore/jit/JIT.cpp
Source/JavaScriptCore/jit/JITCall.cpp
Source/JavaScriptCore/jit/JITMathIC.h
Source/JavaScriptCore/jit/JITOpcodes.cpp
Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
Source/JavaScriptCore/jit/JITOperations.cpp
Source/JavaScriptCore/jit/JITOperations.h
Source/JavaScriptCore/jit/JITPropertyAccess.cpp
Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
Source/JavaScriptCore/jit/JITStubRoutine.h
Source/JavaScriptCore/jit/Repatch.cpp
Source/JavaScriptCore/jit/SpecializedThunkJIT.h
Source/JavaScriptCore/jit/ThunkGenerators.cpp
Source/JavaScriptCore/llint/LLIntThunks.cpp
Source/JavaScriptCore/runtime/SamplingProfiler.cpp
Source/JavaScriptCore/runtime/VM.cpp
Source/JavaScriptCore/runtime/VM.h
Source/JavaScriptCore/runtime/VMTraps.cpp
Source/JavaScriptCore/tools/VMInspector.cpp
Source/JavaScriptCore/wasm/WasmBinding.cpp
Source/JavaScriptCore/wasm/WasmPlan.cpp
Source/JavaScriptCore/yarr/YarrJIT.cpp
Source/WebCore/ChangeLog
Source/WebCore/cssjit/SelectorCompiler.cpp

index 8324545..7c918d9 100644 (file)
@@ -1,3 +1,283 @@
+2017-03-29  Saam Barati  <sbarati@apple.com>
+
+        LinkBuffer and ExecutableAllocator shouldn't have anything to do with VM
+        https://bugs.webkit.org/show_bug.cgi?id=170210
+
+        Reviewed by Mark Lam.
+
+        This is one more step in the direction of PIC-ified Wasm.
+        LinkBuffer and ExecutableAllocator have no business knowing about VM.
+
+        * assembler/LinkBuffer.cpp:
+        (JSC::LinkBuffer::allocate):
+        * assembler/LinkBuffer.h:
+        (JSC::LinkBuffer::LinkBuffer):
+        (JSC::LinkBuffer::vm): Deleted.
+        * b3/B3Compile.cpp:
+        (JSC::B3::compile):
+        * b3/B3Compile.h:
+        * b3/air/testair.cpp:
+        * b3/testb3.cpp:
+        (JSC::B3::compileProc):
+        (JSC::B3::compileAndRun):
+        (JSC::B3::testLoadAcq42):
+        (JSC::B3::testAddArgZeroImmZDef):
+        (JSC::B3::testAddLoadTwice):
+        (JSC::B3::testMulLoadTwice):
+        (JSC::B3::testMulAddArgsLeft):
+        (JSC::B3::testMulAddArgsRight):
+        (JSC::B3::testMulAddArgsLeft32):
+        (JSC::B3::testMulAddArgsRight32):
+        (JSC::B3::testMulSubArgsLeft):
+        (JSC::B3::testMulSubArgsRight):
+        (JSC::B3::testMulSubArgsLeft32):
+        (JSC::B3::testMulSubArgsRight32):
+        (JSC::B3::testMulNegArgs):
+        (JSC::B3::testMulNegArgs32):
+        (JSC::B3::testCompareFloatToDoubleThroughPhi):
+        (JSC::B3::testDoubleToFloatThroughPhi):
+        (JSC::B3::testReduceFloatToDoubleValidates):
+        (JSC::B3::testDoubleProducerPhiToFloatConversion):
+        (JSC::B3::testDoubleProducerPhiToFloatConversionWithDoubleConsumer):
+        (JSC::B3::testDoubleProducerPhiWithNonFloatConst):
+        (JSC::B3::testIToD64Arg):
+        (JSC::B3::testIToF64Arg):
+        (JSC::B3::testIToD32Arg):
+        (JSC::B3::testIToF32Arg):
+        (JSC::B3::testIToD64Mem):
+        (JSC::B3::testIToF64Mem):
+        (JSC::B3::testIToD32Mem):
+        (JSC::B3::testIToF32Mem):
+        (JSC::B3::testIToDReducedToIToF64Arg):
+        (JSC::B3::testIToDReducedToIToF32Arg):
+        (JSC::B3::testStoreRelAddLoadAcq32):
+        (JSC::B3::testStoreRelAddLoadAcq8):
+        (JSC::B3::testStoreRelAddFenceLoadAcq8):
+        (JSC::B3::testStoreRelAddLoadAcq16):
+        (JSC::B3::testStoreRelAddLoadAcq64):
+        (JSC::B3::testBranch):
+        (JSC::B3::testBranchPtr):
+        (JSC::B3::testDiamond):
+        (JSC::B3::testBranchNotEqual):
+        (JSC::B3::testBranchNotEqualCommute):
+        (JSC::B3::testBranchNotEqualNotEqual):
+        (JSC::B3::testBranchEqual):
+        (JSC::B3::testBranchEqualEqual):
+        (JSC::B3::testBranchEqualCommute):
+        (JSC::B3::testBranchEqualEqual1):
+        (JSC::B3::testBranchLoadPtr):
+        (JSC::B3::testBranchLoad32):
+        (JSC::B3::testBranchLoad8S):
+        (JSC::B3::testBranchLoad8Z):
+        (JSC::B3::testBranchLoad16S):
+        (JSC::B3::testBranchLoad16Z):
+        (JSC::B3::testBranch8WithLoad8ZIndex):
+        (JSC::B3::testComplex):
+        (JSC::B3::testSimpleCheck):
+        (JSC::B3::testCheckFalse):
+        (JSC::B3::testCheckTrue):
+        (JSC::B3::testCheckLessThan):
+        (JSC::B3::testCheckMegaCombo):
+        (JSC::B3::testCheckTrickyMegaCombo):
+        (JSC::B3::testCheckTwoMegaCombos):
+        (JSC::B3::testCheckTwoNonRedundantMegaCombos):
+        (JSC::B3::testCheckAddImm):
+        (JSC::B3::testCheckAddImmCommute):
+        (JSC::B3::testCheckAddImmSomeRegister):
+        (JSC::B3::testCheckAdd):
+        (JSC::B3::testCheckAdd64):
+        (JSC::B3::testCheckAddFold):
+        (JSC::B3::testCheckAddFoldFail):
+        (JSC::B3::testCheckAddSelfOverflow64):
+        (JSC::B3::testCheckAddSelfOverflow32):
+        (JSC::B3::testCheckSubImm):
+        (JSC::B3::testCheckSubBadImm):
+        (JSC::B3::testCheckSub):
+        (JSC::B3::testCheckSub64):
+        (JSC::B3::testCheckSubFold):
+        (JSC::B3::testCheckSubFoldFail):
+        (JSC::B3::testCheckNeg):
+        (JSC::B3::testCheckNeg64):
+        (JSC::B3::testCheckMul):
+        (JSC::B3::testCheckMulMemory):
+        (JSC::B3::testCheckMul2):
+        (JSC::B3::testCheckMul64):
+        (JSC::B3::testCheckMulFold):
+        (JSC::B3::testCheckMulFoldFail):
+        (JSC::B3::testCheckMul64SShr):
+        (JSC::B3::testSwitch):
+        (JSC::B3::testSwitchChillDiv):
+        (JSC::B3::testSwitchTargettingSameBlock):
+        (JSC::B3::testSwitchTargettingSameBlockFoldPathConstant):
+        (JSC::B3::testBasicSelect):
+        (JSC::B3::testSelectTest):
+        (JSC::B3::testSelectCompareDouble):
+        (JSC::B3::testSelectDouble):
+        (JSC::B3::testSelectDoubleTest):
+        (JSC::B3::testSelectDoubleCompareDouble):
+        (JSC::B3::testSelectFloatCompareFloat):
+        (JSC::B3::testSelectFold):
+        (JSC::B3::testSelectInvert):
+        (JSC::B3::testCheckSelect):
+        (JSC::B3::testCheckSelectCheckSelect):
+        (JSC::B3::testCheckSelectAndCSE):
+        (JSC::B3::testTrivialInfiniteLoop):
+        (JSC::B3::testFoldPathEqual):
+        (JSC::B3::testLShiftSelf32):
+        (JSC::B3::testRShiftSelf32):
+        (JSC::B3::testURShiftSelf32):
+        (JSC::B3::testLShiftSelf64):
+        (JSC::B3::testRShiftSelf64):
+        (JSC::B3::testURShiftSelf64):
+        (JSC::B3::testPatchpointDoubleRegs):
+        (JSC::B3::testSpillDefSmallerThanUse):
+        (JSC::B3::testSpillUseLargerThanDef):
+        (JSC::B3::testLateRegister):
+        (JSC::B3::testInterpreter):
+        (JSC::B3::testEntrySwitchSimple):
+        (JSC::B3::testEntrySwitchNoEntrySwitch):
+        (JSC::B3::testEntrySwitchWithCommonPaths):
+        (JSC::B3::testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint):
+        (JSC::B3::testEntrySwitchLoop):
+        (JSC::B3::testSomeEarlyRegister):
+        (JSC::B3::testTerminalPatchpointThatNeedsToBeSpilled):
+        (JSC::B3::testTerminalPatchpointThatNeedsToBeSpilled2):
+        (JSC::B3::testPatchpointTerminalReturnValue):
+        (JSC::B3::testMemoryFence):
+        (JSC::B3::testStoreFence):
+        (JSC::B3::testLoadFence):
+        (JSC::B3::testPCOriginMapDoesntInsertNops):
+        (JSC::B3::testPinRegisters):
+        (JSC::B3::testX86LeaAddAddShlLeft):
+        (JSC::B3::testX86LeaAddAddShlRight):
+        (JSC::B3::testX86LeaAddAdd):
+        (JSC::B3::testX86LeaAddShlRight):
+        (JSC::B3::testX86LeaAddShlLeftScale1):
+        (JSC::B3::testX86LeaAddShlLeftScale2):
+        (JSC::B3::testX86LeaAddShlLeftScale4):
+        (JSC::B3::testX86LeaAddShlLeftScale8):
+        (JSC::B3::testAddShl32):
+        (JSC::B3::testAddShl64):
+        (JSC::B3::testAddShl65):
+        (JSC::B3::testLoadBaseIndexShift2):
+        (JSC::B3::testLoadBaseIndexShift32):
+        (JSC::B3::testOptimizeMaterialization):
+        (JSC::B3::testAtomicWeakCAS):
+        (JSC::B3::testAtomicStrongCAS):
+        (JSC::B3::testAtomicXchg):
+        (JSC::B3::testDepend32):
+        (JSC::B3::testDepend64):
+        (JSC::B3::testWasmBoundsCheck):
+        (JSC::B3::testWasmAddress):
+        (JSC::B3::run):
+        (JSC::B3::compile): Deleted.
+        * bytecode/PolymorphicAccess.cpp:
+        (JSC::PolymorphicAccess::regenerate):
+        * dfg/DFGJITCompiler.cpp:
+        (JSC::DFG::JITCompiler::compile):
+        (JSC::DFG::JITCompiler::compileFunction):
+        * dfg/DFGLazyJSValue.cpp:
+        (JSC::DFG::LazyJSValue::emit):
+        * dfg/DFGOSRExitCompiler.cpp:
+        * dfg/DFGSpeculativeJIT32_64.cpp:
+        (JSC::DFG::SpeculativeJIT::emitCall):
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::emitCall):
+        * dfg/DFGThunks.cpp:
+        (JSC::DFG::osrExitGenerationThunkGenerator):
+        (JSC::DFG::osrEntryThunkGenerator):
+        * ftl/FTLCompile.cpp:
+        (JSC::FTL::compile):
+        * ftl/FTLLazySlowPath.cpp:
+        (JSC::FTL::LazySlowPath::generate):
+        * ftl/FTLLink.cpp:
+        (JSC::FTL::link):
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstruct):
+        (JSC::FTL::DFG::LowerDFGToB3::compileTailCall):
+        (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
+        (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
+        (JSC::FTL::DFG::LowerDFGToB3::compileCallEval):
+        * ftl/FTLOSRExitCompiler.cpp:
+        (JSC::FTL::compileStub):
+        * ftl/FTLOSRExitHandle.cpp:
+        (JSC::FTL::OSRExitHandle::emitExitThunk):
+        * ftl/FTLSlowPathCall.cpp:
+        (JSC::FTL::SlowPathCallContext::makeCall):
+        * ftl/FTLSlowPathCall.h:
+        (JSC::FTL::callOperation):
+        * ftl/FTLState.h:
+        * ftl/FTLThunks.cpp:
+        (JSC::FTL::genericGenerationThunkGenerator):
+        (JSC::FTL::slowPathCallThunkGenerator):
+        * ftl/FTLThunks.h:
+        (JSC::FTL::generateIfNecessary):
+        (JSC::FTL::Thunks::getSlowPathCallThunk):
+        * jit/AssemblyHelpers.cpp:
+        (JSC::AssemblyHelpers::emitDumbVirtualCall):
+        * jit/AssemblyHelpers.h:
+        * jit/ExecutableAllocator.cpp:
+        (JSC::ExecutableAllocator::initializeAllocator):
+        (JSC::ExecutableAllocator::singleton):
+        (JSC::ExecutableAllocator::ExecutableAllocator):
+        (JSC::ExecutableAllocator::allocate):
+        * jit/ExecutableAllocator.h:
+        * jit/JIT.cpp:
+        (JSC::JIT::compileWithoutLinking):
+        * jit/JITCall.cpp:
+        (JSC::JIT::compileCallEvalSlowCase):
+        * jit/JITMathIC.h:
+        (JSC::JITMathIC::generateOutOfLine):
+        * jit/JITOpcodes.cpp:
+        (JSC::JIT::privateCompileHasIndexedProperty):
+        * jit/JITOpcodes32_64.cpp:
+        (JSC::JIT::privateCompileHasIndexedProperty):
+        * jit/JITOperations.cpp:
+        * jit/JITOperations.h:
+        * jit/JITPropertyAccess.cpp:
+        (JSC::JIT::stringGetByValStubGenerator):
+        (JSC::JIT::privateCompileGetByVal):
+        (JSC::JIT::privateCompileGetByValWithCachedId):
+        (JSC::JIT::privateCompilePutByVal):
+        (JSC::JIT::privateCompilePutByValWithCachedId):
+        * jit/JITPropertyAccess32_64.cpp:
+        (JSC::JIT::stringGetByValStubGenerator):
+        * jit/JITStubRoutine.h:
+        * jit/Repatch.cpp:
+        (JSC::ftlThunkAwareRepatchCall):
+        (JSC::linkPolymorphicCall):
+        * jit/SpecializedThunkJIT.h:
+        (JSC::SpecializedThunkJIT::finalize):
+        * jit/ThunkGenerators.cpp:
+        (JSC::throwExceptionFromCallSlowPathGenerator):
+        (JSC::linkCallThunkGenerator):
+        (JSC::linkPolymorphicCallThunkGenerator):
+        (JSC::virtualThunkFor):
+        (JSC::nativeForGenerator):
+        (JSC::arityFixupGenerator):
+        (JSC::unreachableGenerator):
+        (JSC::boundThisNoArgsFunctionCallGenerator):
+        (JSC::throwExceptionFromWasmThunkGenerator):
+        * llint/LLIntThunks.cpp:
+        (JSC::LLInt::generateThunkWithJumpTo):
+        * runtime/SamplingProfiler.cpp:
+        (JSC::SamplingProfiler::takeSample):
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        * runtime/VM.h:
+        * runtime/VMTraps.cpp:
+        (JSC::VMTraps::tryInstallTrapBreakpoints):
+        * tools/VMInspector.cpp:
+        * wasm/WasmBinding.cpp:
+        (JSC::Wasm::wasmToJs):
+        (JSC::Wasm::wasmToWasm):
+        (JSC::Wasm::exitStubGenerator):
+        * wasm/WasmPlan.cpp:
+        (JSC::Wasm::Plan::complete):
+        * yarr/YarrJIT.cpp:
+        (JSC::Yarr::YarrGenerator::compile):
+        (JSC::Yarr::jitCompile):
+
 2017-03-29  Keith Miller  <keith_miller@apple.com>
 
         WebAssembly: Worklist should periodically check in to see if there are higher priority jobs to do.
index 03e62ac..6384656 100644 (file)
@@ -32,7 +32,6 @@
 #include "JITCode.h"
 #include "JSCInlines.h"
 #include "Options.h"
-#include "VM.h"
 #include <wtf/CompilationThread.h>
 
 namespace JSC {
@@ -242,8 +241,7 @@ void LinkBuffer::allocate(MacroAssembler& macroAssembler, void* ownerUID, JITCom
         initialSize = macroAssembler.m_assembler.codeSize();
     }
     
-    ASSERT(m_vm != nullptr);
-    m_executableMemory = m_vm->executableAllocator.allocate(*m_vm, initialSize, ownerUID, effort);
+    m_executableMemory = ExecutableAllocator::singleton().allocate(initialSize, ownerUID, effort);
     if (!m_executableMemory)
         return;
     m_code = m_executableMemory->start();
index efb26f9..a65db69 100644 (file)
@@ -43,7 +43,6 @@
 namespace JSC {
 
 class CodeBlock;
-class VM;
 
 // LinkBuffer:
 //
@@ -79,11 +78,10 @@ class LinkBuffer {
 #endif
 
 public:
-    LinkBuffer(VM& vm, MacroAssembler& macroAssembler, void* ownerUID, JITCompilationEffort effort = JITCompilationMustSucceed)
+    LinkBuffer(MacroAssembler& macroAssembler, void* ownerUID, JITCompilationEffort effort = JITCompilationMustSucceed)
         : m_size(0)
         , m_didAllocate(false)
         , m_code(0)
-        , m_vm(&vm)
 #ifndef NDEBUG
         , m_completed(false)
 #endif
@@ -95,7 +93,6 @@ public:
         : m_size(size)
         , m_didAllocate(false)
         , m_code(code)
-        , m_vm(0)
 #ifndef NDEBUG
         , m_completed(false)
 #endif
@@ -253,8 +250,6 @@ public:
     bool wasAlreadyDisassembled() const { return m_alreadyDisassembled; }
     void didAlreadyDisassemble() { m_alreadyDisassembled = true; }
 
-    VM& vm() { return *m_vm; }
-
 private:
 #if ENABLE(BRANCH_COMPACTION)
     int executableOffsetFor(int location)
@@ -305,7 +300,6 @@ private:
 #endif
     bool m_didAllocate;
     void* m_code;
-    VM* m_vm;
 #ifndef NDEBUG
     bool m_completed;
 #endif
index 42d6ad2..dd27012 100644 (file)
@@ -38,7 +38,7 @@
 
 namespace JSC { namespace B3 {
 
-Compilation compile(VM& vm, Procedure& proc, unsigned optLevel)
+Compilation compile(Procedure& proc, unsigned optLevel)
 {
     TimingScope timingScope("Compilation");
     
@@ -46,7 +46,7 @@ Compilation compile(VM& vm, Procedure& proc, unsigned optLevel)
     
     CCallHelpers jit;
     generate(proc, jit);
-    LinkBuffer linkBuffer(vm, jit, nullptr);
+    LinkBuffer linkBuffer(jit, nullptr);
 
     return Compilation(FINALIZE_CODE(linkBuffer, ("B3::Compilation")), proc.releaseByproducts());
 }
index 37db160..9538cc0 100644 (file)
@@ -45,7 +45,7 @@ class Procedure;
 // Then you keep the Compilation object alive for as long as you want to be able to run the code.
 // If this API feels too high-level, you can use B3::generate() directly.
 
-JS_EXPORT_PRIVATE Compilation compile(VM&, Procedure&, unsigned optLevel = 1);
+JS_EXPORT_PRIVATE Compilation compile(Procedure&, unsigned optLevel = 1);
 
 } } // namespace JSC::B3
 
index c39c4a8..87b353a 100644 (file)
@@ -36,7 +36,6 @@
 #include "JSCInlines.h"
 #include "LinkBuffer.h"
 #include "PureNaN.h"
-#include "VM.h"
 #include <cmath>
 #include <map>
 #include <string>
@@ -80,14 +79,12 @@ StaticLock crashLock;
         CRASH();                                                        \
     } while (false)
 
-VM* vm;
-
 std::unique_ptr<B3::Compilation> compile(B3::Procedure& proc)
 {
     prepareForGeneration(proc.code());
     CCallHelpers jit;
     generate(proc.code(), jit);
-    LinkBuffer linkBuffer(*vm, jit, nullptr);
+    LinkBuffer linkBuffer(jit, nullptr);
 
     return std::make_unique<B3::Compilation>(
         FINALIZE_CODE(linkBuffer, ("testair compilation")), proc.releaseByproducts());
@@ -1849,7 +1846,6 @@ void testX86VMULSDBaseIndexNeedRex()
 void run(const char* filter)
 {
     JSC::initializeThreading();
-    vm = &VM::create(LargeHeap).leakRef();
 
     Deque<RefPtr<SharedTask<void()>>> tasks;
 
index 672d79b..bd6d8fe 100644 (file)
@@ -66,7 +66,6 @@
 #include "JSCInlines.h"
 #include "LinkBuffer.h"
 #include "PureNaN.h"
-#include "VM.h"
 #include <cmath>
 #include <string>
 #include <wtf/FastTLS.h>
@@ -118,11 +117,9 @@ StaticLock crashLock;
         CRASH(); \
     } while (false)
 
-VM* vm;
-
-std::unique_ptr<Compilation> compile(Procedure& procedure, unsigned optLevel = 1)
+std::unique_ptr<Compilation> compileProc(Procedure& procedure, unsigned optLevel = 1)
 {
-    return std::make_unique<Compilation>(B3::compile(*vm, procedure, optLevel));
+    return std::make_unique<Compilation>(B3::compile(procedure, optLevel));
 }
 
 template<typename T, typename... Arguments>
@@ -141,7 +138,7 @@ T invoke(const Compilation& code, Arguments... arguments)
 template<typename T, typename... Arguments>
 T compileAndRun(Procedure& procedure, Arguments... arguments)
 {
-    return invoke<T>(*compile(procedure), arguments...);
+    return invoke<T>(*compileProc(procedure), arguments...);
 }
 
 void lowerToAirForTesting(Procedure& proc)
@@ -312,7 +309,7 @@ void testLoadAcq42()
             root->appendNew<ConstPtrValue>(proc, Origin(), &x),
             0, HeapRange(42), HeapRange(42)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     if (isARM64())
         checkUsesInstruction(*code, "lda");
     CHECK(invoke<int>(*code) == 42);
@@ -615,7 +612,7 @@ void testAddArgZeroImmZDef()
             arg,
             constZero));
 
-    auto code = compile(proc, 0);
+    auto code = compileProc(proc, 0);
     CHECK(invoke<int64_t>(*code, 0x0123456789abcdef) == 0x89abcdef);
 }
 
@@ -632,7 +629,7 @@ void testAddLoadTwice()
             proc, Return, Origin(),
             root->appendNew<Value>(proc, Add, Origin(), load, load));
 
-        auto code = compile(proc, optLevel);
+        auto code = compileProc(proc, optLevel);
         CHECK(invoke<int32_t>(*code) == 42 * 2);
     };
 
@@ -984,7 +981,7 @@ void testMulLoadTwice()
             proc, Return, Origin(),
             root->appendNew<Value>(proc, Mul, Origin(), load, load));
 
-        auto code = compile(proc, optLevel);
+        auto code = compileProc(proc, optLevel);
         CHECK(invoke<int32_t>(*code) == 42 * 42);
     };
 
@@ -1004,7 +1001,7 @@ void testMulAddArgsLeft()
     Value* added = root->appendNew<Value>(proc, Add, Origin(), multiplied, arg2);
     root->appendNewControlValue(proc, Return, Origin(), added);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto testValues = int64Operands();
     for (auto a : testValues) {
@@ -1028,7 +1025,7 @@ void testMulAddArgsRight()
     Value* added = root->appendNew<Value>(proc, Add, Origin(), arg0, multiplied);
     root->appendNewControlValue(proc, Return, Origin(), added);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto testValues = int64Operands();
     for (auto a : testValues) {
@@ -1055,7 +1052,7 @@ void testMulAddArgsLeft32()
     Value* added = root->appendNew<Value>(proc, Add, Origin(), multiplied, arg2);
     root->appendNewControlValue(proc, Return, Origin(), added);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto testValues = int32Operands();
     for (auto a : testValues) {
@@ -1082,7 +1079,7 @@ void testMulAddArgsRight32()
     Value* added = root->appendNew<Value>(proc, Add, Origin(), arg0, multiplied);
     root->appendNewControlValue(proc, Return, Origin(), added);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto testValues = int32Operands();
     for (auto a : testValues) {
@@ -1106,7 +1103,7 @@ void testMulSubArgsLeft()
     Value* added = root->appendNew<Value>(proc, Sub, Origin(), multiplied, arg2);
     root->appendNewControlValue(proc, Return, Origin(), added);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto testValues = int64Operands();
     for (auto a : testValues) {
@@ -1130,7 +1127,7 @@ void testMulSubArgsRight()
     Value* added = root->appendNew<Value>(proc, Sub, Origin(), arg0, multiplied);
     root->appendNewControlValue(proc, Return, Origin(), added);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto testValues = int64Operands();
     for (auto a : testValues) {
@@ -1157,7 +1154,7 @@ void testMulSubArgsLeft32()
     Value* added = root->appendNew<Value>(proc, Sub, Origin(), multiplied, arg2);
     root->appendNewControlValue(proc, Return, Origin(), added);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto testValues = int32Operands();
     for (auto a : testValues) {
@@ -1184,7 +1181,7 @@ void testMulSubArgsRight32()
     Value* added = root->appendNew<Value>(proc, Sub, Origin(), arg0, multiplied);
     root->appendNewControlValue(proc, Return, Origin(), added);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto testValues = int32Operands();
     for (auto a : testValues) {
@@ -1208,7 +1205,7 @@ void testMulNegArgs()
     Value* added = root->appendNew<Value>(proc, Sub, Origin(), zero, multiplied);
     root->appendNewControlValue(proc, Return, Origin(), added);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto testValues = int64Operands();
     for (auto a : testValues) {
@@ -1232,7 +1229,7 @@ void testMulNegArgs32()
     Value* added = root->appendNew<Value>(proc, Sub, Origin(), zero, multiplied);
     root->appendNewControlValue(proc, Return, Origin(), added);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto testValues = int32Operands();
     for (auto a : testValues) {
@@ -4636,7 +4633,7 @@ void testCompareFloatToDoubleThroughPhi(float a, float b)
     Value* equal = tail->appendNew<Value>(proc, Equal, Origin(), doubleInput, arg2AsFRoundedDouble);
     tail->appendNewControlValue(proc, Return, Origin(), equal);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     int32_t integerA = bitwise_cast<int32_t>(a);
     double doubleB = b;
     CHECK(invoke<int64_t>(*code, 1, integerA, doubleB) == (a == b));
@@ -4685,7 +4682,7 @@ void testDoubleToFloatThroughPhi(float value)
     Value* floatResult = tail->appendNew<Value>(proc, DoubleToFloat, Origin(), doubleInput);
     tail->appendNewControlValue(proc, Return, Origin(), floatResult);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(isIdentical(invoke<float>(*code, 1, bitwise_cast<int32_t>(value)), value + 42.5f));
     CHECK(isIdentical(invoke<float>(*code, 0, bitwise_cast<int32_t>(value)), static_cast<float>(M_PI)));
 }
@@ -4740,7 +4737,7 @@ void testReduceFloatToDoubleValidates()
             result);
     tail->appendNewControlValue(proc, Return, Origin(), result);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(isIdentical(invoke<float>(*code, 1), 11.5f * 11.5f + static_cast<float>(bitwise_cast<double>(static_cast<uint64_t>(1))) + 11.5f));
     CHECK(isIdentical(invoke<float>(*code, 0), 10.5f * 10.5f + static_cast<float>(bitwise_cast<double>(static_cast<uint64_t>(0))) + 10.5f));
 }
@@ -4780,7 +4777,7 @@ void testDoubleProducerPhiToFloatConversion(float value)
     Value* floatResult = tail->appendNew<Value>(proc, DoubleToFloat, Origin(), finalAdd);
     tail->appendNewControlValue(proc, Return, Origin(), floatResult);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(isIdentical(invoke<float>(*code, 1, bitwise_cast<int32_t>(value)), value + value));
     CHECK(isIdentical(invoke<float>(*code, 0, bitwise_cast<int32_t>(value)), 42.5f + value));
 }
@@ -4829,7 +4826,7 @@ void testDoubleProducerPhiToFloatConversionWithDoubleConsumer(float value)
 
     tail->appendNewControlValue(proc, Return, Origin(), doubleAdd);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(isIdentical(invoke<double>(*code, 1, bitwise_cast<int32_t>(value)), (value + value) + static_cast<double>(value)));
     CHECK(isIdentical(invoke<double>(*code, 0, bitwise_cast<int32_t>(value)), static_cast<double>((42.5f + value) + 42.5f)));
 }
@@ -4869,7 +4866,7 @@ void testDoubleProducerPhiWithNonFloatConst(float value, double constValue)
     Value* floatResult = tail->appendNew<Value>(proc, DoubleToFloat, Origin(), finalAdd);
     tail->appendNewControlValue(proc, Return, Origin(), floatResult);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(isIdentical(invoke<float>(*code, 1, bitwise_cast<int32_t>(value)), value + value));
     CHECK(isIdentical(invoke<float>(*code, 0, bitwise_cast<int32_t>(value)), static_cast<float>(constValue + value)));
 }
@@ -5225,7 +5222,7 @@ void testIToD64Arg()
     Value* srcAsDouble = root->appendNew<Value>(proc, IToD, Origin(), src);
     root->appendNewControlValue(proc, Return, Origin(), srcAsDouble);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     for (auto testValue : int64Operands())
         CHECK(isIdentical(invoke<double>(*code, testValue.value), static_cast<double>(testValue.value)));
 }
@@ -5238,7 +5235,7 @@ void testIToF64Arg()
     Value* srcAsFloat = root->appendNew<Value>(proc, IToF, Origin(), src);
     root->appendNewControlValue(proc, Return, Origin(), srcAsFloat);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     for (auto testValue : int64Operands())
         CHECK(isIdentical(invoke<float>(*code, testValue.value), static_cast<float>(testValue.value)));
 }
@@ -5252,7 +5249,7 @@ void testIToD32Arg()
     Value* srcAsDouble = root->appendNew<Value>(proc, IToD, Origin(), src);
     root->appendNewControlValue(proc, Return, Origin(), srcAsDouble);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     for (auto testValue : int32Operands())
         CHECK(isIdentical(invoke<double>(*code, testValue.value), static_cast<double>(testValue.value)));
 }
@@ -5266,7 +5263,7 @@ void testIToF32Arg()
     Value* srcAsFloat = root->appendNew<Value>(proc, IToF, Origin(), src);
     root->appendNewControlValue(proc, Return, Origin(), srcAsFloat);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     for (auto testValue : int32Operands())
         CHECK(isIdentical(invoke<float>(*code, testValue.value), static_cast<float>(testValue.value)));
 }
@@ -5280,7 +5277,7 @@ void testIToD64Mem()
     Value* srcAsDouble = root->appendNew<Value>(proc, IToD, Origin(), loadedSrc);
     root->appendNewControlValue(proc, Return, Origin(), srcAsDouble);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     int64_t inMemoryValue;
     for (auto testValue : int64Operands()) {
         inMemoryValue = testValue.value;
@@ -5298,7 +5295,7 @@ void testIToF64Mem()
     Value* srcAsFloat = root->appendNew<Value>(proc, IToF, Origin(), loadedSrc);
     root->appendNewControlValue(proc, Return, Origin(), srcAsFloat);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     int64_t inMemoryValue;
     for (auto testValue : int64Operands()) {
         inMemoryValue = testValue.value;
@@ -5316,7 +5313,7 @@ void testIToD32Mem()
     Value* srcAsDouble = root->appendNew<Value>(proc, IToD, Origin(), loadedSrc);
     root->appendNewControlValue(proc, Return, Origin(), srcAsDouble);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     int32_t inMemoryValue;
     for (auto testValue : int32Operands()) {
         inMemoryValue = testValue.value;
@@ -5334,7 +5331,7 @@ void testIToF32Mem()
     Value* srcAsFloat = root->appendNew<Value>(proc, IToF, Origin(), loadedSrc);
     root->appendNewControlValue(proc, Return, Origin(), srcAsFloat);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     int32_t inMemoryValue;
     for (auto testValue : int32Operands()) {
         inMemoryValue = testValue.value;
@@ -5392,7 +5389,7 @@ void testIToDReducedToIToF64Arg()
     Value* floatResult = root->appendNew<Value>(proc, DoubleToFloat, Origin(), srcAsDouble);
     root->appendNewControlValue(proc, Return, Origin(), floatResult);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     for (auto testValue : int64Operands())
         CHECK(isIdentical(invoke<float>(*code, testValue.value), static_cast<float>(testValue.value)));
 }
@@ -5407,7 +5404,7 @@ void testIToDReducedToIToF32Arg()
     Value* floatResult = root->appendNew<Value>(proc, DoubleToFloat, Origin(), srcAsDouble);
     root->appendNewControlValue(proc, Return, Origin(), floatResult);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     for (auto testValue : int32Operands())
         CHECK(isIdentical(invoke<float>(*code, testValue.value), static_cast<float>(testValue.value)));
 }
@@ -5789,7 +5786,7 @@ void testStoreRelAddLoadAcq32(int amount)
         proc, Return, Origin(),
         root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     if (isARM64()) {
         checkUsesInstruction(*code, "lda");
         checkUsesInstruction(*code, "stl");
@@ -5862,7 +5859,7 @@ void testStoreRelAddLoadAcq8(int amount, B3::Opcode loadOpcode)
         proc, Return, Origin(),
         root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     if (isARM64()) {
         checkUsesInstruction(*code, "lda");
         checkUsesInstruction(*code, "stl");
@@ -5901,7 +5898,7 @@ void testStoreRelAddFenceLoadAcq8(int amount, B3::Opcode loadOpcode)
         proc, Return, Origin(),
         root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     if (isARM64()) {
         checkUsesInstruction(*code, "lda");
         checkUsesInstruction(*code, "stl");
@@ -5974,7 +5971,7 @@ void testStoreRelAddLoadAcq16(int amount, B3::Opcode loadOpcode)
         proc, Return, Origin(),
         root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     if (isARM64()) {
         checkUsesInstruction(*code, "lda");
         checkUsesInstruction(*code, "stl");
@@ -6043,7 +6040,7 @@ void testStoreRelAddLoadAcq64(int amount)
         proc, Return, Origin(),
         root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     if (isARM64()) {
         checkUsesInstruction(*code, "lda");
         checkUsesInstruction(*code, "stl");
@@ -7049,7 +7046,7 @@ void testBranch()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<int>(*code, 42) == 1);
     CHECK(invoke<int>(*code, 0) == 0);
 }
@@ -7074,7 +7071,7 @@ void testBranchPtr()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<int>(*code, static_cast<intptr_t>(42)) == 1);
     CHECK(invoke<int>(*code, static_cast<intptr_t>(0)) == 0);
 }
@@ -7107,7 +7104,7 @@ void testDiamond()
     elseResult->setPhi(phi);
     done->appendNewControlValue(proc, Return, Origin(), phi);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<int>(*code, 42) == 1);
     CHECK(invoke<int>(*code, 0) == 0);
 }
@@ -7137,7 +7134,7 @@ void testBranchNotEqual()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<int>(*code, 42) == 1);
     CHECK(invoke<int>(*code, 0) == 0);
 }
@@ -7167,7 +7164,7 @@ void testBranchNotEqualCommute()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<int>(*code, 42) == 1);
     CHECK(invoke<int>(*code, 0) == 0);
 }
@@ -7200,7 +7197,7 @@ void testBranchNotEqualNotEqual()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<int>(*code, 42) == 1);
     CHECK(invoke<int>(*code, 0) == 0);
 }
@@ -7230,7 +7227,7 @@ void testBranchEqual()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 1));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<int>(*code, 42) == 1);
     CHECK(invoke<int>(*code, 0) == 0);
 }
@@ -7263,7 +7260,7 @@ void testBranchEqualEqual()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<int>(*code, 42) == 1);
     CHECK(invoke<int>(*code, 0) == 0);
 }
@@ -7293,7 +7290,7 @@ void testBranchEqualCommute()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 1));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<int>(*code, 42) == 1);
     CHECK(invoke<int>(*code, 0) == 0);
 }
@@ -7326,7 +7323,7 @@ void testBranchEqualEqual1()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 1));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<int>(*code, 42) == 1);
     CHECK(invoke<int>(*code, 0) == 0);
 }
@@ -7741,7 +7738,7 @@ void testBranchLoadPtr()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     intptr_t cond;
     cond = 42;
     CHECK(invoke<int>(*code, &cond) == 1);
@@ -7771,7 +7768,7 @@ void testBranchLoad32()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     int32_t cond;
     cond = 42;
     CHECK(invoke<int>(*code, &cond) == 1);
@@ -7801,7 +7798,7 @@ void testBranchLoad8S()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     int8_t cond;
     cond = -1;
     CHECK(invoke<int>(*code, &cond) == 1);
@@ -7831,7 +7828,7 @@ void testBranchLoad8Z()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     uint8_t cond;
     cond = 1;
     CHECK(invoke<int>(*code, &cond) == 1);
@@ -7861,7 +7858,7 @@ void testBranchLoad16S()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     int16_t cond;
     cond = -1;
     CHECK(invoke<int>(*code, &cond) == 1);
@@ -7891,7 +7888,7 @@ void testBranchLoad16Z()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     uint16_t cond;
     cond = 1;
     CHECK(invoke<int>(*code, &cond) == 1);
@@ -7931,7 +7928,7 @@ void testBranch8WithLoad8ZIndex()
         proc, Return, Origin(),
         elseCase->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     uint32_t cond;
     cond = 0xffffffffU; // All bytes are 0xff.
     CHECK(invoke<int>(*code, &cond - 2, (sizeof(uint32_t) * 2) >> logScale) == 1);
@@ -8068,7 +8065,7 @@ void testComplex(unsigned numVars, unsigned numConstructs)
 
     current->appendNewControlValue(proc, Return, Origin(), vars[0]);
 
-    compile(proc);
+    compileProc(proc);
 
     double after = monotonicallyIncreasingTimeMS();
     dataLog(toCString("    That took ", after - before, " ms.\n"));
@@ -8617,7 +8614,7 @@ void testSimpleCheck()
     root->appendNewControlValue(
         proc, Return, Origin(), root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     
     CHECK(invoke<int>(*code, 0) == 0);
     CHECK(invoke<int>(*code, 1) == 42);
@@ -8636,7 +8633,7 @@ void testCheckFalse()
     root->appendNewControlValue(
         proc, Return, Origin(), root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     
     CHECK(invoke<int>(*code) == 0);
 }
@@ -8662,7 +8659,7 @@ void testCheckTrue()
     root->appendNewControlValue(
         proc, Return, Origin(), root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     
     CHECK(invoke<int>(*code) == 42);
 }
@@ -8693,7 +8690,7 @@ void testCheckLessThan()
     root->appendNewControlValue(
         proc, Return, Origin(), root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     
     CHECK(invoke<int>(*code, 42) == 0);
     CHECK(invoke<int>(*code, 1000) == 0);
@@ -8739,7 +8736,7 @@ void testCheckMegaCombo()
     root->appendNewControlValue(
         proc, Return, Origin(), root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     int8_t value;
     value = 42;
@@ -8794,7 +8791,7 @@ void testCheckTrickyMegaCombo()
     root->appendNewControlValue(
         proc, Return, Origin(), root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     int8_t value;
     value = 42;
@@ -8858,7 +8855,7 @@ void testCheckTwoMegaCombos()
     root->appendNewControlValue(
         proc, Return, Origin(), root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     int8_t value;
     value = 42;
@@ -8939,7 +8936,7 @@ void testCheckTwoNonRedundantMegaCombos()
     elseCase->appendNewControlValue(
         proc, Return, Origin(), elseCase->appendNew<Const32Value>(proc, Origin(), 45));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     int8_t value;
 
@@ -8994,7 +8991,7 @@ void testCheckAddImm()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkAdd));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0) == 42.0);
     CHECK(invoke<double>(*code, 1) == 43.0);
@@ -9030,7 +9027,7 @@ void testCheckAddImmCommute()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkAdd));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0) == 42.0);
     CHECK(invoke<double>(*code, 1) == 43.0);
@@ -9065,7 +9062,7 @@ void testCheckAddImmSomeRegister()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkAdd));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0) == 42.0);
     CHECK(invoke<double>(*code, 1) == 43.0);
@@ -9102,7 +9099,7 @@ void testCheckAdd()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkAdd));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0, 42) == 42.0);
     CHECK(invoke<double>(*code, 1, 42) == 43.0);
@@ -9135,7 +9132,7 @@ void testCheckAdd64()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkAdd));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0ll, 42ll) == 42.0);
     CHECK(invoke<double>(*code, 1ll, 42ll) == 43.0);
@@ -9156,7 +9153,7 @@ void testCheckAddFold(int a, int b)
         });
     root->appendNewControlValue(proc, Return, Origin(), checkAdd);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<int>(*code) == a + b);
 }
@@ -9177,7 +9174,7 @@ void testCheckAddFoldFail(int a, int b)
         });
     root->appendNewControlValue(proc, Return, Origin(), checkAdd);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<int>(*code) == 42);
 }
@@ -9284,7 +9281,7 @@ void testCheckAddSelfOverflow64()
 
     root->appendNewControlValue(proc, Return, Origin(), checkAdd);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<int64_t>(*code, 0ll) == 0);
     CHECK(invoke<int64_t>(*code, 1ll) == 2);
@@ -9315,7 +9312,7 @@ void testCheckAddSelfOverflow32()
 
     root->appendNewControlValue(proc, Return, Origin(), checkAdd);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<int32_t>(*code, 0ll) == 0);
     CHECK(invoke<int32_t>(*code, 1ll) == 2);
@@ -9350,7 +9347,7 @@ void testCheckSubImm()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkSub));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0) == -42.0);
     CHECK(invoke<double>(*code, 1) == -41.0);
@@ -9392,7 +9389,7 @@ void testCheckSubBadImm()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkSub));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0) == -static_cast<double>(badImm));
     CHECK(invoke<double>(*code, -1) == -static_cast<double>(badImm) - 1);
@@ -9429,7 +9426,7 @@ void testCheckSub()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkSub));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0, 42) == -42.0);
     CHECK(invoke<double>(*code, 1, 42) == -41.0);
@@ -9467,7 +9464,7 @@ void testCheckSub64()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkSub));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0ll, 42ll) == -42.0);
     CHECK(invoke<double>(*code, 1ll, 42ll) == -41.0);
@@ -9488,7 +9485,7 @@ void testCheckSubFold(int a, int b)
         });
     root->appendNewControlValue(proc, Return, Origin(), checkSub);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<int>(*code) == a - b);
 }
@@ -9509,7 +9506,7 @@ void testCheckSubFoldFail(int a, int b)
         });
     root->appendNewControlValue(proc, Return, Origin(), checkSub);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<int>(*code) == 42);
 }
@@ -9538,7 +9535,7 @@ void testCheckNeg()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkNeg));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0) == 0.0);
     CHECK(invoke<double>(*code, 1) == -1.0);
@@ -9568,7 +9565,7 @@ void testCheckNeg64()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkNeg));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0ll) == 0.0);
     CHECK(invoke<double>(*code, 1ll) == -1.0);
@@ -9605,7 +9602,7 @@ void testCheckMul()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkMul));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0, 42) == 0.0);
     CHECK(invoke<double>(*code, 1, 42) == 42.0);
@@ -9646,7 +9643,7 @@ void testCheckMulMemory()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkMul));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     left = 0;
     right = 42;
@@ -9693,7 +9690,7 @@ void testCheckMul2()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkMul));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0) == 0.0);
     CHECK(invoke<double>(*code, 1) == 2.0);
@@ -9726,7 +9723,7 @@ void testCheckMul64()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkMul));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0, 42) == 0.0);
     CHECK(invoke<double>(*code, 1, 42) == 42.0);
@@ -9747,7 +9744,7 @@ void testCheckMulFold(int a, int b)
         });
     root->appendNewControlValue(proc, Return, Origin(), checkMul);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<int>(*code) == a * b);
 }
@@ -9768,7 +9765,7 @@ void testCheckMulFoldFail(int a, int b)
         });
     root->appendNewControlValue(proc, Return, Origin(), checkMul);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<int>(*code) == 42);
 }
@@ -9884,7 +9881,7 @@ void testCheckMul64SShr()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, IToD, Origin(), checkMul));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     CHECK(invoke<double>(*code, 0ll, 42ll) == 0.0);
     CHECK(invoke<double>(*code, 1ll, 42ll) == 0.0);
@@ -10734,7 +10731,7 @@ void testSwitch(unsigned degree, unsigned gap = 1)
         switchValue->appendCase(SwitchCase(gap * i, FrequentedBlock(newBlock)));
     }
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     for (unsigned i = 0; i < degree; ++i) {
         CHECK(invoke<int32_t>(*code, i * gap, 42, 11) == ((i & 1) ? 11 : 42));
@@ -10777,7 +10774,7 @@ void testSwitchChillDiv(unsigned degree, unsigned gap = 1)
         switchValue->appendCase(SwitchCase(gap * i, FrequentedBlock(newBlock)));
     }
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     for (unsigned i = 0; i < degree; ++i) {
         dataLog("i = ", i, "\n");
@@ -10816,7 +10813,7 @@ void testSwitchTargettingSameBlock()
     switchValue->appendCase(SwitchCase(3, FrequentedBlock(otherTarget)));
     switchValue->appendCase(SwitchCase(13, FrequentedBlock(otherTarget)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     for (unsigned i = 0; i < 20; ++i) {
         int32_t expected = (i == 3 || i == 13) ? 42 : 5;
@@ -10844,7 +10841,7 @@ void testSwitchTargettingSameBlockFoldPathConstant()
     switchValue->appendCase(SwitchCase(3, FrequentedBlock(otherTarget)));
     switchValue->appendCase(SwitchCase(13, FrequentedBlock(otherTarget)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     for (unsigned i = 0; i < 20; ++i) {
         int32_t expected = (i == 3 || i == 13) ? i : 42;
@@ -11202,7 +11199,7 @@ void testBasicSelect()
             root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1),
             root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR2)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<intptr_t>(*code, 42, 1, 2) == 1);
     CHECK(invoke<intptr_t>(*code, 42, 642462, 32533) == 642462);
     CHECK(invoke<intptr_t>(*code, 43, 1, 2) == 2);
@@ -11221,7 +11218,7 @@ void testSelectTest()
             root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1),
             root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR2)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<intptr_t>(*code, 42, 1, 2) == 1);
     CHECK(invoke<intptr_t>(*code, 42, 642462, 32533) == 642462);
     CHECK(invoke<intptr_t>(*code, 0, 1, 2) == 2);
@@ -11243,7 +11240,7 @@ void testSelectCompareDouble()
             root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
             root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<intptr_t>(*code, -1.0, 1.0, 1, 2) == 1);
     CHECK(invoke<intptr_t>(*code, 42.5, 42.51, 642462, 32533) == 642462);
     CHECK(invoke<intptr_t>(*code, PNaN, 0.0, 1, 2) == 2);
@@ -11340,7 +11337,7 @@ void testSelectDouble()
             root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR0),
             root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR1)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<double>(*code, 42, 1.5, 2.6) == 1.5);
     CHECK(invoke<double>(*code, 42, 642462.7, 32533.8) == 642462.7);
     CHECK(invoke<double>(*code, 43, 1.9, 2.0) == 2.0);
@@ -11359,7 +11356,7 @@ void testSelectDoubleTest()
             root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR0),
             root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR1)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<double>(*code, 42, 1.5, 2.6) == 1.5);
     CHECK(invoke<double>(*code, 42, 642462.7, 32533.8) == 642462.7);
     CHECK(invoke<double>(*code, 0, 1.9, 2.0) == 2.0);
@@ -11381,7 +11378,7 @@ void testSelectDoubleCompareDouble()
             root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR2),
             root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR3)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<double>(*code, -1.0, 1.0, 1.1, 2.2) == 1.1);
     CHECK(invoke<double>(*code, 42.5, 42.51, 642462.3, 32533.4) == 642462.3);
     CHECK(invoke<double>(*code, PNaN, 0.0, 1.5, 2.6) == 2.6);
@@ -11467,7 +11464,7 @@ void testSelectDoubleCompareDouble(bool (*operation)(double, double))
                     arg1),
                 arg2,
                 arg3));
-        auto code = compile(proc);
+        auto code = compileProc(proc);
 
         for (auto& left : floatingPointOperands<double>()) {
             for (auto& right : floatingPointOperands<double>()) {
@@ -11494,7 +11491,7 @@ void testSelectDoubleCompareDouble(bool (*operation)(double, double))
         keepValuesLive->setGenerator([&] (CCallHelpers&, const StackmapGenerationParams&) { });
 
         root->appendNewControlValue(proc, Return, Origin(), result);
-        auto code = compile(proc);
+        auto code = compileProc(proc);
 
         for (auto& left : floatingPointOperands<double>()) {
             for (auto& right : floatingPointOperands<double>()) {
@@ -11521,7 +11518,7 @@ void testSelectDoubleCompareDouble(bool (*operation)(double, double))
         keepValuesLive->setGenerator([&] (CCallHelpers&, const StackmapGenerationParams&) { });
 
         root->appendNewControlValue(proc, Return, Origin(), result);
-        auto code = compile(proc);
+        auto code = compileProc(proc);
 
         for (auto& left : floatingPointOperands<double>()) {
             for (auto& right : floatingPointOperands<double>()) {
@@ -11549,7 +11546,7 @@ void testSelectDoubleCompareDouble(bool (*operation)(double, double))
         keepValuesLive->setGenerator([&] (CCallHelpers&, const StackmapGenerationParams&) { });
 
         root->appendNewControlValue(proc, Return, Origin(), result);
-        auto code = compile(proc);
+        auto code = compileProc(proc);
 
         for (auto& left : floatingPointOperands<double>()) {
             for (auto& right : floatingPointOperands<double>()) {
@@ -11575,7 +11572,7 @@ void testSelectDoubleCompareDouble(bool (*operation)(double, double))
                     arg1),
                 arg2,
                 arg0));
-        auto code = compile(proc);
+        auto code = compileProc(proc);
 
         for (auto& left : floatingPointOperands<double>()) {
             for (auto& right : floatingPointOperands<double>()) {
@@ -11601,7 +11598,7 @@ void testSelectDoubleCompareDouble(bool (*operation)(double, double))
         keepValuesLive->setGenerator([&] (CCallHelpers&, const StackmapGenerationParams&) { });
 
         root->appendNewControlValue(proc, Return, Origin(), result);
-        auto code = compile(proc);
+        auto code = compileProc(proc);
 
         for (auto& left : floatingPointOperands<double>()) {
             for (auto& right : floatingPointOperands<double>()) {
@@ -11653,7 +11650,7 @@ void testSelectFloatCompareFloat(bool (*operation)(float, float))
                     arg1),
                 arg2,
                 arg3));
-        auto code = compile(proc);
+        auto code = compileProc(proc);
 
         for (auto& left : floatingPointOperands<float>()) {
             for (auto& right : floatingPointOperands<float>()) {
@@ -11688,7 +11685,7 @@ void testSelectFloatCompareFloat(bool (*operation)(float, float))
         keepValuesLive->setGenerator([&] (CCallHelpers&, const StackmapGenerationParams&) { });
 
         root->appendNewControlValue(proc, Return, Origin(), result);
-        auto code = compile(proc);
+        auto code = compileProc(proc);
 
         for (auto& left : floatingPointOperands<float>()) {
             for (auto& right : floatingPointOperands<float>()) {
@@ -11723,7 +11720,7 @@ void testSelectFloatCompareFloat(bool (*operation)(float, float))
         keepValuesLive->setGenerator([&] (CCallHelpers&, const StackmapGenerationParams&) { });
 
         root->appendNewControlValue(proc, Return, Origin(), result);
-        auto code = compile(proc);
+        auto code = compileProc(proc);
 
         for (auto& left : floatingPointOperands<float>()) {
             for (auto& right : floatingPointOperands<float>()) {
@@ -11759,7 +11756,7 @@ void testSelectFloatCompareFloat(bool (*operation)(float, float))
         keepValuesLive->setGenerator([&] (CCallHelpers&, const StackmapGenerationParams&) { });
 
         root->appendNewControlValue(proc, Return, Origin(), result);
-        auto code = compile(proc);
+        auto code = compileProc(proc);
 
         for (auto& left : floatingPointOperands<float>()) {
             for (auto& right : floatingPointOperands<float>()) {
@@ -11791,7 +11788,7 @@ void testSelectFloatCompareFloat(bool (*operation)(float, float))
                     arg1),
                 arg2,
                 arg0));
-        auto code = compile(proc);
+        auto code = compileProc(proc);
 
         for (auto& left : floatingPointOperands<float>()) {
             for (auto& right : floatingPointOperands<float>()) {
@@ -11823,7 +11820,7 @@ void testSelectFloatCompareFloat(bool (*operation)(float, float))
         keepValuesLive->setGenerator([&] (CCallHelpers&, const StackmapGenerationParams&) { });
 
         root->appendNewControlValue(proc, Return, Origin(), result);
-        auto code = compile(proc);
+        auto code = compileProc(proc);
 
         for (auto& left : floatingPointOperands<float>()) {
             for (auto& right : floatingPointOperands<float>()) {
@@ -11860,7 +11857,7 @@ void testSelectFold(intptr_t value)
             root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
             root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<intptr_t>(*code, 1, 2) == (value == 42 ? 1 : 2));
     CHECK(invoke<intptr_t>(*code, 642462, 32533) == (value == 42 ? 642462 : 32533));
 }
@@ -11883,7 +11880,7 @@ void testSelectInvert()
             root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1),
             root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR2)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<intptr_t>(*code, 42, 1, 2) == 1);
     CHECK(invoke<intptr_t>(*code, 42, 642462, 32533) == 642462);
     CHECK(invoke<intptr_t>(*code, 43, 1, 2) == 2);
@@ -11926,7 +11923,7 @@ void testCheckSelect()
         proc, Return, Origin(),
         root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(generationCount == 1);
     CHECK(invoke<int>(*code, true) == 0);
     CHECK(invoke<int>(*code, false) == 666);
@@ -11997,7 +11994,7 @@ void testCheckSelectCheckSelect()
         proc, Return, Origin(),
         root->appendNew<Const32Value>(proc, Origin(), 0));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(generationCount == 1);
     CHECK(generationCount2 == 1);
     CHECK(invoke<int>(*code, true, true) == 0);
@@ -12043,7 +12040,7 @@ void testCheckSelectAndCSE()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, Add, Origin(), addValue, addValue2));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(generationCount == 1);
     CHECK(invoke<int>(*code, true) == 0);
     CHECK(invoke<int>(*code, false) == 666);
@@ -12452,7 +12449,7 @@ void testTrivialInfiniteLoop()
     root->appendNewControlValue(proc, Jump, Origin(), FrequentedBlock(loop));
     loop->appendNewControlValue(proc, Jump, Origin(), FrequentedBlock(loop));
 
-    compile(proc);
+    compileProc(proc);
 }
 
 void testFoldPathEqual()
@@ -12477,7 +12474,7 @@ void testFoldPathEqual()
         elseBlock->appendNew<Value>(
             proc, Equal, Origin(), arg, elseBlock->appendNew<ConstPtrValue>(proc, Origin(), 0)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<intptr_t>(*code, 0) == 1);
     CHECK(invoke<intptr_t>(*code, 1) == 0);
     CHECK(invoke<intptr_t>(*code, 42) == 0);
@@ -12494,7 +12491,7 @@ void testLShiftSelf32()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, Shl, Origin(), arg, arg));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto check = [&] (int32_t value) {
         CHECK(invoke<int32_t>(*code, value) == value << (value & 31));
@@ -12517,7 +12514,7 @@ void testRShiftSelf32()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, SShr, Origin(), arg, arg));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto check = [&] (int32_t value) {
         CHECK(invoke<int32_t>(*code, value) == value >> (value & 31));
@@ -12540,7 +12537,7 @@ void testURShiftSelf32()
         proc, Return, Origin(),
         root->appendNew<Value>(proc, ZShr, Origin(), arg, arg));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto check = [&] (uint32_t value) {
         CHECK(invoke<uint32_t>(*code, value) == value >> (value & 31));
@@ -12562,7 +12559,7 @@ void testLShiftSelf64()
         root->appendNew<Value>(
             proc, Shl, Origin(), arg, root->appendNew<Value>(proc, Trunc, Origin(), arg)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto check = [&] (int64_t value) {
         CHECK(invoke<int64_t>(*code, value) == value << (value & 63));
@@ -12586,7 +12583,7 @@ void testRShiftSelf64()
         root->appendNew<Value>(
             proc, SShr, Origin(), arg, root->appendNew<Value>(proc, Trunc, Origin(), arg)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto check = [&] (int64_t value) {
         CHECK(invoke<int64_t>(*code, value) == value >> (value & 63));
@@ -12610,7 +12607,7 @@ void testURShiftSelf64()
         root->appendNew<Value>(
             proc, ZShr, Origin(), arg, root->appendNew<Value>(proc, Trunc, Origin(), arg)));
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
 
     auto check = [&] (uint64_t value) {
         CHECK(invoke<uint64_t>(*code, value) == value >> (value & 63));
@@ -12643,7 +12640,7 @@ void testPatchpointDoubleRegs()
 
     root->appendNewControlValue(proc, Return, Origin(), patchpoint);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(numCalls == 1);
     CHECK(invoke<double>(*code, 42.5) == 42.5);
 }
@@ -12676,7 +12673,7 @@ void testSpillDefSmallerThanUse()
     Value* result = root->appendNew<Value>(proc, Sub, Origin(), forceSpill, arg64);
     root->appendNewControlValue(proc, Return, Origin(), result);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<int64_t>(*code, 0xffffffff00000000) == 0);
 }
 
@@ -12730,7 +12727,7 @@ void testSpillUseLargerThanDef()
     elseResult->setPhi(phi);
     tail->appendNewControlValue(proc, Return, Origin(), phi);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<uint64_t>(*code, 1, 0xffffffff00000000) == 0);
     CHECK(invoke<uint64_t>(*code, 0, 0xffffffff00000000) == 0xffffffff00000000);
 
@@ -12812,7 +12809,7 @@ void testLateRegister()
         });
     root->appendNewControlValue(proc, Return, Origin(), secondPatchpoint);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK(invoke<uint64_t>(*code) == result);
 }
 
@@ -12986,7 +12983,7 @@ void testInterpreter()
         proc, Return, Origin(),
         stop->appendIntConstant(proc, Origin(), pointerType(), 0));
     
-    auto interpreter = compile(proc);
+    auto interpreter = compileProc(proc);
     
     Vector<intptr_t> data;
     Vector<intptr_t> code;
@@ -13136,7 +13133,7 @@ void testEntrySwitchSimple()
     
     CCallHelpers jit;
     generate(proc, jit);
-    LinkBuffer linkBuffer(*vm, jit, nullptr);
+    LinkBuffer linkBuffer(jit, nullptr);
     CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0));
     CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1));
     CodeLocationLabel labelThree = linkBuffer.locationOf(proc.entrypointLabel(2));
@@ -13169,7 +13166,7 @@ void testEntrySwitchNoEntrySwitch()
     
     CCallHelpers jit;
     generate(proc, jit);
-    LinkBuffer linkBuffer(*vm, jit, nullptr);
+    LinkBuffer linkBuffer(jit, nullptr);
     CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0));
     CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1));
     CodeLocationLabel labelThree = linkBuffer.locationOf(proc.entrypointLabel(2));
@@ -13256,7 +13253,7 @@ void testEntrySwitchWithCommonPaths()
     
     CCallHelpers jit;
     generate(proc, jit);
-    LinkBuffer linkBuffer(*vm, jit, nullptr);
+    LinkBuffer linkBuffer(jit, nullptr);
     CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0));
     CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1));
     CodeLocationLabel labelThree = linkBuffer.locationOf(proc.entrypointLabel(2));
@@ -13373,7 +13370,7 @@ void testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint()
     
     CCallHelpers jit;
     generate(proc, jit);
-    LinkBuffer linkBuffer(*vm, jit, nullptr);
+    LinkBuffer linkBuffer(jit, nullptr);
     CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0));
     CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1));
     CodeLocationLabel labelThree = linkBuffer.locationOf(proc.entrypointLabel(2));
@@ -13451,7 +13448,7 @@ void testEntrySwitchLoop()
     
     CCallHelpers jit;
     generate(proc, jit);
-    LinkBuffer linkBuffer(*vm, jit, nullptr);
+    LinkBuffer linkBuffer(jit, nullptr);
     CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0));
     CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1));
     
@@ -13500,7 +13497,7 @@ void testSomeEarlyRegister()
         
         root->appendNew<Value>(proc, Return, Origin(), patchpoint);
         
-        compile(proc);
+        compileProc(proc);
         CHECK(ranFirstPatchpoint);
         CHECK(ranSecondPatchpoint);
     };
@@ -13614,7 +13611,7 @@ void testTerminalPatchpointThatNeedsToBeSpilled()
     
     slowPath->appendNew<Value>(proc, Return, Origin(), slowPath->appendNew<Const32Value>(proc, Origin(), 20));
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK_EQ(invoke<int>(*code), 10);
 }
 
@@ -13702,7 +13699,7 @@ void testTerminalPatchpointThatNeedsToBeSpilled2()
     Options::maxB3TailDupBlockSize() = 0;
     Options::maxB3TailDupBlockSuccessors() = 0;
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK_EQ(invoke<int>(*code, 1), 1);
     CHECK_EQ(invoke<int>(*code, 0), 0);
     CHECK_EQ(invoke<int>(*code, 42), 666);
@@ -13776,7 +13773,7 @@ void testPatchpointTerminalReturnValue(bool successIsRare)
     slowPathUpsilon->setPhi(phi);
     continuation->appendNew<Value>(proc, Return, Origin(), phi);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK_EQ(invoke<int>(*code, 0), 31);
     CHECK_EQ(invoke<int>(*code, 1), 32);
     CHECK_EQ(invoke<int>(*code, 41), 72);
@@ -13794,7 +13791,7 @@ void testMemoryFence()
     root->appendNew<FenceValue>(proc, Origin());
     root->appendNew<Value>(proc, Return, Origin(), root->appendIntConstant(proc, Origin(), Int32, 42));
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK_EQ(invoke<int>(*code), 42);
     if (isX86())
         checkUsesInstruction(*code, "lock or $0x0, (%rsp)");
@@ -13813,7 +13810,7 @@ void testStoreFence()
     root->appendNew<FenceValue>(proc, Origin(), HeapRange::top(), HeapRange());
     root->appendNew<Value>(proc, Return, Origin(), root->appendIntConstant(proc, Origin(), Int32, 42));
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK_EQ(invoke<int>(*code), 42);
     checkDoesNotUseInstruction(*code, "lock");
     checkDoesNotUseInstruction(*code, "mfence");
@@ -13830,7 +13827,7 @@ void testLoadFence()
     root->appendNew<FenceValue>(proc, Origin(), HeapRange(), HeapRange::top());
     root->appendNew<Value>(proc, Return, Origin(), root->appendIntConstant(proc, Origin(), Int32, 42));
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK_EQ(invoke<int>(*code), 42);
     checkDoesNotUseInstruction(*code, "lock");
     checkDoesNotUseInstruction(*code, "mfence");
@@ -14055,7 +14052,7 @@ void testPCOriginMapDoesntInsertNops()
 
     root->appendNew<Value>(proc, Return, Origin());
 
-    compile(proc);
+    compileProc(proc);
 }
 
 void testPinRegisters()
@@ -14090,7 +14087,7 @@ void testPinRegisters()
                 CHECK_EQ(params[0].gpr(), GPRInfo::regCS0);
             });
         root->appendNew<Value>(proc, Return, Origin());
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         bool usesCSRs = false;
         for (Air::BasicBlock* block : proc.code()) {
             for (Air::Inst& inst : *block) {
@@ -14129,7 +14126,7 @@ void testX86LeaAddAddShlLeft()
         root->appendNew<ConstPtrValue>(proc, Origin(), 100));
     root->appendNew<Value>(proc, Return, Origin(), result);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     checkUsesInstruction(*code, "lea 0x64(%rdi,%rsi,4), %rax");
     CHECK_EQ(invoke<intptr_t>(*code, 1, 2), (1 + (2 << 2)) + 100);
 }
@@ -14151,7 +14148,7 @@ void testX86LeaAddAddShlRight()
         root->appendNew<ConstPtrValue>(proc, Origin(), 100));
     root->appendNew<Value>(proc, Return, Origin(), result);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     checkUsesInstruction(*code, "lea 0x64(%rdi,%rsi,4), %rax");
     CHECK_EQ(invoke<intptr_t>(*code, 1, 2), (1 + (2 << 2)) + 100);
 }
@@ -14170,7 +14167,7 @@ void testX86LeaAddAdd()
         root->appendNew<ConstPtrValue>(proc, Origin(), 100));
     root->appendNew<Value>(proc, Return, Origin(), result);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK_EQ(invoke<intptr_t>(*code, 1, 2), (1 + 2) + 100);
     checkDisassembly(
         *code,
@@ -14195,7 +14192,7 @@ void testX86LeaAddShlRight()
             root->appendNew<Const32Value>(proc, Origin(), 2)));
     root->appendNew<Value>(proc, Return, Origin(), result);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     checkUsesInstruction(*code, "lea (%rdi,%rsi,4), %rax");
     CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + (2 << 2));
 }
@@ -14214,7 +14211,7 @@ void testX86LeaAddShlLeftScale1()
             root->appendNew<Const32Value>(proc, Origin(), 0)));
     root->appendNew<Value>(proc, Return, Origin(), result);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + 2);
     checkDisassembly(
         *code,
@@ -14239,7 +14236,7 @@ void testX86LeaAddShlLeftScale2()
             root->appendNew<Const32Value>(proc, Origin(), 1)));
     root->appendNew<Value>(proc, Return, Origin(), result);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     checkUsesInstruction(*code, "lea (%rdi,%rsi,2), %rax");
     CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + (2 << 1));
 }
@@ -14258,7 +14255,7 @@ void testX86LeaAddShlLeftScale4()
         root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
     root->appendNew<Value>(proc, Return, Origin(), result);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     checkUsesInstruction(*code, "lea (%rdi,%rsi,4), %rax");
     CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + (2 << 2));
 }
@@ -14277,7 +14274,7 @@ void testX86LeaAddShlLeftScale8()
             root->appendNew<Const32Value>(proc, Origin(), 3)));
     root->appendNew<Value>(proc, Return, Origin(), result);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     checkUsesInstruction(*code, "lea (%rdi,%rsi,8), %rax");
     CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + (2 << 3));
 }
@@ -14296,7 +14293,7 @@ void testAddShl32()
             root->appendNew<Const32Value>(proc, Origin(), 32)));
     root->appendNew<Value>(proc, Return, Origin(), result);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + (static_cast<intptr_t>(2) << static_cast<intptr_t>(32)));
 }
 
@@ -14314,7 +14311,7 @@ void testAddShl64()
             root->appendNew<Const32Value>(proc, Origin(), 64)));
     root->appendNew<Value>(proc, Return, Origin(), result);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + 2);
 }
 
@@ -14332,7 +14329,7 @@ void testAddShl65()
             root->appendNew<Const32Value>(proc, Origin(), 65)));
     root->appendNew<Value>(proc, Return, Origin(), result);
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + (2 << 1));
 }
 
@@ -14396,7 +14393,7 @@ void testLoadBaseIndexShift2()
                     proc, Shl, Origin(),
                     root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1),
                     root->appendNew<Const32Value>(proc, Origin(), 2)))));
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     if (isX86())
         checkUsesInstruction(*code, "(%rdi,%rsi,4)");
     int32_t value = 12341234;
@@ -14420,7 +14417,7 @@ void testLoadBaseIndexShift32()
                     proc, Shl, Origin(),
                     root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1),
                     root->appendNew<Const32Value>(proc, Origin(), 32)))));
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     int32_t value = 12341234;
     char* ptr = bitwise_cast<char*>(&value);
     for (unsigned i = 0; i < 10; ++i)
@@ -14437,7 +14434,7 @@ void testOptimizeMaterialization()
         root->appendNew<ConstPtrValue>(proc, Origin(), 0x123423453456llu + 35));
     root->appendNew<Value>(proc, Return, Origin());
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     bool found = false;
     for (Air::BasicBlock* block : proc.code()) {
         for (Air::Inst& inst : *block) {
@@ -14493,7 +14490,7 @@ void testAtomicWeakCAS()
         
         done->appendNew<Value>(proc, Return, Origin());
         
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14524,7 +14521,7 @@ void testAtomicWeakCAS()
         
         done->appendNew<Value>(proc, Return, Origin());
         
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14558,7 +14555,7 @@ void testAtomicWeakCAS()
         
         fail->appendNew<Value>(proc, Return, Origin());
         
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14600,7 +14597,7 @@ void testAtomicWeakCAS()
         
         fail->appendNew<Value>(proc, Return, Origin());
         
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14626,7 +14623,7 @@ void testAtomicWeakCAS()
                 root->appendIntConstant(proc, Origin(), type, 0xbeef),
                 root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0)));
         
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14655,7 +14652,7 @@ void testAtomicWeakCAS()
                     root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0)),
                 root->appendNew<Const32Value>(proc, Origin(), 0)));
         
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14682,7 +14679,7 @@ void testAtomicWeakCAS()
                 root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
                 42));
         
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14746,7 +14743,7 @@ void testAtomicStrongCAS()
         
         fail->appendNew<Value>(proc, Return, Origin());
         
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14787,7 +14784,7 @@ void testAtomicStrongCAS()
         
         fail->appendNew<Value>(proc, Return, Origin());
         
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14828,7 +14825,7 @@ void testAtomicStrongCAS()
         
         fail->appendNew<Value>(proc, Return, Origin());
         
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14853,7 +14850,7 @@ void testAtomicStrongCAS()
                 root->appendIntConstant(proc, Origin(), type, 0xbeef),
                 root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0)));
         
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14885,7 +14882,7 @@ void testAtomicStrongCAS()
                     root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0)),
                 root->appendIntConstant(proc, Origin(), type, 42)));
         
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14916,7 +14913,7 @@ void testAtomicStrongCAS()
                     root->appendIntConstant(proc, Origin(), type, 42)),
                 root->appendNew<Const32Value>(proc, Origin(), 0)));
             
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 42;
         value[1] = 13;
@@ -14997,7 +14994,7 @@ void testAtomicXchg(B3::Opcode opcode)
                 root->appendIntConstant(proc, Origin(), type, 1),
                 root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0)));
     
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 5;
         value[1] = 100;
@@ -15017,7 +15014,7 @@ void testAtomicXchg(B3::Opcode opcode)
                 root->appendIntConstant(proc, Origin(), type, 42),
                 root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0)));
     
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 5;
         value[1] = 100;
@@ -15036,7 +15033,7 @@ void testAtomicXchg(B3::Opcode opcode)
             root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
         root->appendNew<Value>(proc, Return, Origin());
     
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 5;
         value[1] = 100;
@@ -15056,7 +15053,7 @@ void testAtomicXchg(B3::Opcode opcode)
             0, HeapRange(42), HeapRange());
         root->appendNew<Value>(proc, Return, Origin());
     
-        auto code = compile(proc);
+        auto code = compileProc(proc);
         T value[2];
         value[0] = 5;
         value[1] = 100;
@@ -15089,7 +15086,7 @@ void testDepend32()
     values[0] = 42;
     values[1] = 0xbeef;
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     if (isARM64())
         checkUsesInstruction(*code, "eor");
     else if (isX86()) {
@@ -15119,7 +15116,7 @@ void testDepend64()
     values[0] = 42;
     values[1] = 0xbeef;
     
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     if (isARM64())
         checkUsesInstruction(*code, "eor");
     else if (isX86()) {
@@ -15154,7 +15151,7 @@ void testWasmBoundsCheck(unsigned offset)
     Value* result = root->appendNew<Const32Value>(proc, Origin(), 0x42);
     root->appendNewControlValue(proc, Return, Origin(), result);
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     CHECK_EQ(invoke<int32_t>(*code, 1, 2 + offset), 0x42);
     CHECK_EQ(invoke<int32_t>(*code, 3, 2 + offset), 42);
     CHECK_EQ(invoke<int32_t>(*code, 2, 2 + offset), 42);
@@ -15205,7 +15202,7 @@ void testWasmAddress()
     incUpsilon->setPhi(indexPhi);
 
 
-    auto code = compile(proc);
+    auto code = compileProc(proc);
     invoke<void>(*code, loopCount, numToStore, values.data());
     for (unsigned value : values)
         CHECK_EQ(numToStore, value);
@@ -15318,7 +15315,6 @@ double negativeZero()
 void run(const char* filter)
 {
     JSC::initializeThreading();
-    vm = &VM::create(LargeHeap).leakRef();
 
     Deque<RefPtr<SharedTask<void()>>> tasks;
 
@@ -15999,7 +15995,7 @@ void run(const char* filter)
     RUN(testTrunc((static_cast<int64_t>(1) << 40) + 42));
     RUN(testAdd1(45));
     RUN(testAdd1Ptr(51));
-    RUN(testAdd1Ptr(bitwise_cast<intptr_t>(vm)));
+    RUN(testAdd1Ptr(static_cast<intptr_t>(0xbaadbeef)));
     RUN(testNeg32(52));
     RUN(testNegPtr(53));
     RUN(testStoreAddLoad32(46));
index 6d11bb7..9a255c0 100644 (file)
@@ -514,7 +514,7 @@ AccessGenerationResult PolymorphicAccess::regenerate(
         callSiteIndexForExceptionHandling = state.callSiteIndexForExceptionHandling();
     }
 
-    LinkBuffer linkBuffer(vm, jit, codeBlock, JITCompilationCanFail);
+    LinkBuffer linkBuffer(jit, codeBlock, JITCompilationCanFail);
     if (linkBuffer.didFailToAllocate()) {
         if (verbose)
             dataLog("Did fail to allocate.\n");
index 1f69997..4d9c826 100644 (file)
@@ -394,7 +394,7 @@ void JITCompiler::compile()
     m_speculative->createOSREntries();
     setEndOfCode();
 
-    auto linkBuffer = std::make_unique<LinkBuffer>(*vm(), *this, m_codeBlock, JITCompilationCanFail);
+    auto linkBuffer = std::make_unique<LinkBuffer>(*this, m_codeBlock, JITCompilationCanFail);
     if (linkBuffer->didFailToAllocate()) {
         m_graph.m_plan.finalizer = std::make_unique<FailedFinalizer>(m_graph.m_plan);
         return;
@@ -488,7 +488,7 @@ void JITCompiler::compileFunction()
     setEndOfCode();
 
     // === Link ===
-    auto linkBuffer = std::make_unique<LinkBuffer>(*vm(), *this, m_codeBlock, JITCompilationCanFail);
+    auto linkBuffer = std::make_unique<LinkBuffer>(*this, m_codeBlock, JITCompilationCanFail);
     if (linkBuffer->didFailToAllocate()) {
         m_graph.m_plan.finalizer = std::make_unique<FailedFinalizer>(m_graph.m_plan);
         return;
index 941f804..5de429a 100644 (file)
@@ -229,7 +229,7 @@ void LazyJSValue::emit(CCallHelpers& jit, JSValueRegs result) const
     
     jit.addLinkTask(
         [codeBlock, label, thisValue] (LinkBuffer& linkBuffer) {
-            JSValue realValue = thisValue.getValue(linkBuffer.vm());
+            JSValue realValue = thisValue.getValue(*codeBlock->vm());
             RELEASE_ASSERT(realValue.isCell());
 
             codeBlock->addConstant(realValue);
index d8d19ec..d1fb549 100644 (file)
@@ -173,7 +173,7 @@ void compileOSRExit(ExecState* exec)
 
         exitCompiler.compileExit(*vm, exit, operands, recovery);
         
-        LinkBuffer patchBuffer(*vm, jit, codeBlock);
+        LinkBuffer patchBuffer(jit, codeBlock);
         exit.m_code = FINALIZE_CODE_IF(
             shouldDumpDisassembly() || Options::verboseOSR(),
             patchBuffer,
index c915f51..135e8a2 100644 (file)
@@ -1012,7 +1012,7 @@ void SpeculativeJIT::emitCall(Node* node)
         m_jit.addPtr(TrustedImm32(requiredBytes), JITCompiler::stackPointerRegister);
         m_jit.load32(JITCompiler::calleeFrameSlot(CallFrameSlot::callee).withOffset(PayloadOffset), GPRInfo::regT0);
         m_jit.load32(JITCompiler::calleeFrameSlot(CallFrameSlot::callee).withOffset(TagOffset), GPRInfo::regT1);
-        m_jit.emitDumbVirtualCall(info);
+        m_jit.emitDumbVirtualCall(*m_jit.vm(), info);
         
         done.link(&m_jit);
         setResultAndResetStack();
index 85eeb6b..ab0e569 100644 (file)
@@ -966,7 +966,7 @@ void SpeculativeJIT::emitCall(Node* node)
         // This is the part where we meant to make a normal call. Oops.
         m_jit.addPtr(TrustedImm32(requiredBytes), JITCompiler::stackPointerRegister);
         m_jit.load64(JITCompiler::calleeFrameSlot(CallFrameSlot::callee), GPRInfo::regT0);
-        m_jit.emitDumbVirtualCall(callLinkInfo);
+        m_jit.emitDumbVirtualCall(*m_jit.vm(), callLinkInfo);
         
         done.link(&m_jit);
         setResultAndResetStack();
index cf4854b..bba2250 100644 (file)
@@ -93,7 +93,7 @@ MacroAssemblerCodeRef osrExitGenerationThunkGenerator(VM* vm)
     
     jit.jump(MacroAssembler::AbsoluteAddress(&vm->osrExitJumpDestination));
     
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     
     patchBuffer.link(functionCall, compileOSRExit);
     
@@ -140,7 +140,7 @@ MacroAssemblerCodeRef osrEntryThunkGenerator(VM* vm)
 
     jit.jump(GPRInfo::regT1);
     
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     return FINALIZE_CODE(patchBuffer, ("DFG OSR entry thunk"));
 }
 
index a9f8665..d906405 100644 (file)
@@ -141,8 +141,7 @@ void compile(State& state, Safepoint::Result& safepointResult)
             linkBuffer.link(call, FunctionPtr(lookupExceptionHandler));
         });
 
-    state.finalizer->b3CodeLinkBuffer = std::make_unique<LinkBuffer>(
-        vm, jit, codeBlock, JITCompilationCanFail);
+    state.finalizer->b3CodeLinkBuffer = std::make_unique<LinkBuffer>(jit, codeBlock, JITCompilationCanFail);
     if (state.finalizer->b3CodeLinkBuffer->didFailToAllocate()) {
         state.allocationFailed = true;
         return;
index ab03220..1a15b9e 100644 (file)
@@ -55,8 +55,6 @@ void LazySlowPath::generate(CodeBlock* codeBlock)
 {
     RELEASE_ASSERT(!m_stub);
 
-    VM& vm = *codeBlock->vm();
-
     CCallHelpers jit(codeBlock);
     GenerationParams params;
     CCallHelpers::JumpList exceptionJumps;
@@ -65,7 +63,7 @@ void LazySlowPath::generate(CodeBlock* codeBlock)
 
     m_generator->run(jit, params);
 
-    LinkBuffer linkBuffer(vm, jit, codeBlock, JITCompilationMustSucceed);
+    LinkBuffer linkBuffer(jit, codeBlock, JITCompilationMustSucceed);
     linkBuffer.link(params.doneJumps, m_done);
     if (m_exceptionTarget)
         linkBuffer.link(exceptionJumps, m_exceptionTarget);
index 89cd376..15a7c07 100644 (file)
@@ -162,7 +162,7 @@ void link(State& state)
             jit.emitFunctionEpilogue();
             mainPathJumps.append(jit.jump());
 
-            linkBuffer = std::make_unique<LinkBuffer>(vm, jit, codeBlock, JITCompilationCanFail);
+            linkBuffer = std::make_unique<LinkBuffer>(jit, codeBlock, JITCompilationCanFail);
             if (linkBuffer->didFailToAllocate()) {
                 state.allocationFailed = true;
                 return;
@@ -186,7 +186,7 @@ void link(State& state)
         jit.emitFunctionEpilogue();
         CCallHelpers::Jump mainPathJump = jit.jump();
         
-        linkBuffer = std::make_unique<LinkBuffer>(vm, jit, codeBlock, JITCompilationCanFail);
+        linkBuffer = std::make_unique<LinkBuffer>(jit, codeBlock, JITCompilationCanFail);
         if (linkBuffer->didFailToAllocate()) {
             state.allocationFailed = true;
             return;
index a117b20..0843ed2 100644 (file)
@@ -5981,6 +5981,7 @@ private:
 
         CodeOrigin codeOrigin = codeOriginDescriptionOfCallSite();
         State* state = &m_ftlState;
+        VM* vm = &this->vm();
         patchpoint->setGenerator(
             [=] (CCallHelpers& jit, const StackmapGenerationParams& params) {
                 AllowMacroScratchRegisterUsage allowScratch(jit);
@@ -6019,7 +6020,7 @@ private:
                 jit.addLinkTask(
                     [=] (LinkBuffer& linkBuffer) {
                         MacroAssemblerCodePtr linkCall =
-                            linkBuffer.vm().getCTIStub(linkCallThunkGenerator).code();
+                            vm->getCTIStub(linkCallThunkGenerator).code();
                         linkBuffer.link(slowCall, FunctionPtr(linkCall.executableAddress()));
 
                         callLinkInfo->setCallLocations(
@@ -6278,6 +6279,7 @@ private:
 
         CodeOrigin codeOrigin = codeOriginDescriptionOfCallSite();
         State* state = &m_ftlState;
+        VM* vm = &this->vm();
         patchpoint->setGenerator(
             [=] (CCallHelpers& jit, const StackmapGenerationParams& params) {
                 AllowMacroScratchRegisterUsage allowScratch(jit);
@@ -6329,7 +6331,7 @@ private:
                 jit.addLinkTask(
                     [=] (LinkBuffer& linkBuffer) {
                         MacroAssemblerCodePtr linkCall =
-                            linkBuffer.vm().getCTIStub(linkCallThunkGenerator).code();
+                            vm->getCTIStub(linkCallThunkGenerator).code();
                         linkBuffer.link(slowCall, FunctionPtr(linkCall.executableAddress()));
 
                         callLinkInfo->setCallLocations(
@@ -6403,6 +6405,7 @@ private:
         
         CodeOrigin codeOrigin = codeOriginDescriptionOfCallSite();
         State* state = &m_ftlState;
+        VM* vm = &this->vm();
         patchpoint->setGenerator(
             [=] (CCallHelpers& jit, const StackmapGenerationParams& params) {
                 AllowMacroScratchRegisterUsage allowScratch(jit);
@@ -6456,7 +6459,7 @@ private:
                 auto callWithExceptionCheck = [&] (void* callee) {
                     jit.move(CCallHelpers::TrustedImmPtr(callee), GPRInfo::nonPreservedNonArgumentGPR);
                     jit.call(GPRInfo::nonPreservedNonArgumentGPR);
-                    exceptions->append(jit.emitExceptionCheck(state->vm(), AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
+                    exceptions->append(jit.emitExceptionCheck(*vm, AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
                 };
 
                 CCallHelpers::JumpList slowCase;
@@ -6582,7 +6585,7 @@ private:
                 jit.addLinkTask(
                     [=] (LinkBuffer& linkBuffer) {
                         MacroAssemblerCodePtr linkCall =
-                            linkBuffer.vm().getCTIStub(linkCallThunkGenerator).code();
+                            vm->getCTIStub(linkCallThunkGenerator).code();
                         linkBuffer.link(slowCall, FunctionPtr(linkCall.executableAddress()));
                         
                         callLinkInfo->setCallLocations(
@@ -6672,6 +6675,7 @@ private:
         
         CodeOrigin codeOrigin = codeOriginDescriptionOfCallSite();
         State* state = &m_ftlState;
+        VM* vm = &this->vm();
         patchpoint->setGenerator(
             [=] (CCallHelpers& jit, const StackmapGenerationParams& params) {
                 AllowMacroScratchRegisterUsage allowScratch(jit);
@@ -6763,7 +6767,7 @@ private:
                 auto callWithExceptionCheck = [&] (void* callee) {
                     jit.move(CCallHelpers::TrustedImmPtr(callee), GPRInfo::nonPreservedNonArgumentGPR);
                     jit.call(GPRInfo::nonPreservedNonArgumentGPR);
-                    exceptions->append(jit.emitExceptionCheck(state->vm(), AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
+                    exceptions->append(jit.emitExceptionCheck(*vm, AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
                 };
 
                 unsigned originalStackHeight = params.proc().frameSize();
@@ -6779,7 +6783,7 @@ private:
                         inlineCallFrame = node->origin.semantic.inlineCallFrame;
 
                     // emitSetupVarargsFrameFastCase modifies the stack pointer if it succeeds.
-                    emitSetupVarargsFrameFastCase(state->vm(), jit, scratchGPR2, scratchGPR1, scratchGPR2, scratchGPR3, inlineCallFrame, data->firstVarArgOffset, slowCase);
+                    emitSetupVarargsFrameFastCase(*vm, jit, scratchGPR2, scratchGPR1, scratchGPR2, scratchGPR3, inlineCallFrame, data->firstVarArgOffset, slowCase);
 
                     CCallHelpers::Jump done = jit.jump();
                     slowCase.link(&jit);
@@ -6861,7 +6865,7 @@ private:
                 jit.addLinkTask(
                     [=] (LinkBuffer& linkBuffer) {
                         MacroAssemblerCodePtr linkCall =
-                            linkBuffer.vm().getCTIStub(linkCallThunkGenerator).code();
+                            vm->getCTIStub(linkCallThunkGenerator).code();
                         linkBuffer.link(slowCall, FunctionPtr(linkCall.executableAddress()));
                         
                         callLinkInfo->setCallLocations(
@@ -6922,8 +6926,9 @@ private:
         
         CodeOrigin codeOrigin = codeOriginDescriptionOfCallSite();
         State* state = &m_ftlState;
+        VM& vm = this->vm();
         patchpoint->setGenerator(
-            [=] (CCallHelpers& jit, const StackmapGenerationParams& params) {
+            [=, &vm] (CCallHelpers& jit, const StackmapGenerationParams& params) {
                 AllowMacroScratchRegisterUsage allowScratch(jit);
                 CallSiteIndex callSiteIndex = state->jitCode->common.addUniqueCallSiteIndex(codeOrigin);
                 
@@ -6956,7 +6961,7 @@ private:
                 
                 jit.addPtr(CCallHelpers::TrustedImm32(requiredBytes), CCallHelpers::stackPointerRegister);
                 jit.load64(CCallHelpers::calleeFrameSlot(CallFrameSlot::callee), GPRInfo::regT0);
-                jit.emitDumbVirtualCall(callLinkInfo);
+                jit.emitDumbVirtualCall(vm, callLinkInfo);
                 
                 done.link(&jit);
                 jit.addPtr(
index 7f37820..f91df37 100644 (file)
@@ -491,7 +491,7 @@ static void compileStub(
     reifyInlinedCallFrames(jit, exit);
     adjustAndJumpToTarget(*vm, jit, exit);
     
-    LinkBuffer patchBuffer(*vm, jit, codeBlock);
+    LinkBuffer patchBuffer(jit, codeBlock);
     exit.m_code = FINALIZE_CODE_IF(
         shouldDumpDisassembly() || Options::verboseOSR() || Options::verboseFTLOSRExit(),
         patchBuffer,
index 11942b7..81e8eec 100644 (file)
@@ -44,13 +44,14 @@ void OSRExitHandle::emitExitThunk(State& state, CCallHelpers& jit)
     jit.pushToSaveImmediateWithoutTouchingRegisters(CCallHelpers::TrustedImm32(index));
     CCallHelpers::PatchableJump jump = jit.patchableJump();
     RefPtr<OSRExitHandle> self = this;
+    VM& vm = state.vm();
     jit.addLinkTask(
-        [self, jump, myLabel, compilation] (LinkBuffer& linkBuffer) {
+        [self, jump, myLabel, compilation, &vm] (LinkBuffer& linkBuffer) {
             self->exit.m_patchableJump = CodeLocationJump(linkBuffer.locationOf(jump));
 
             linkBuffer.link(
                 jump.m_jump,
-                CodeLocationLabel(linkBuffer.vm().getCTIStub(osrExitGenerationThunkGenerator).code()));
+                CodeLocationLabel(vm.getCTIStub(osrExitGenerationThunkGenerator).code()));
             if (compilation)
                 compilation->addOSRExitSite({ linkBuffer.locationOf(myLabel).executableAddress() });
         });
index eeba482..5fa5ecc 100644 (file)
@@ -118,16 +118,14 @@ SlowPathCallKey SlowPathCallContext::keyWithTarget(void* callTarget) const
     return SlowPathCallKey(m_thunkSaveSet, callTarget, m_argumentRegisters, m_offset);
 }
 
-SlowPathCall SlowPathCallContext::makeCall(void* callTarget)
+SlowPathCall SlowPathCallContext::makeCall(VM& vm, void* callTarget)
 {
     SlowPathCall result = SlowPathCall(m_jit.call(), keyWithTarget(callTarget));
 
     m_jit.addLinkTask(
-        [result] (LinkBuffer& linkBuffer) {
-            VM& vm = linkBuffer.vm();
-
+        [result, &vm] (LinkBuffer& linkBuffer) {
             MacroAssemblerCodeRef thunk =
-                vm.ftlThunks->getSlowPathCallThunk(vm, result.key());
+                vm.ftlThunks->getSlowPathCallThunk(result.key());
 
             linkBuffer.link(result.call(), CodeLocationLabel(thunk.code()));
         });
index 5356e0e..f33b5f7 100644 (file)
@@ -59,7 +59,7 @@ public:
 
     // NOTE: The call that this returns is already going to be linked by the JIT using addLinkTask(),
     // so there is no need for you to link it yourself.
-    SlowPathCall makeCall(void* callTarget);
+    SlowPathCall makeCall(VM&, void* callTarget);
 
 private:
     SlowPathCallKey keyWithTarget(void* callTarget) const;
@@ -84,7 +84,7 @@ SlowPathCall callOperation(
     {
         SlowPathCallContext context(usedRegisters, jit, sizeof...(ArgumentTypes) + 1, resultGPR);
         jit.setupArgumentsWithExecState(arguments...);
-        call = context.makeCall(function.value());
+        call = context.makeCall(vm, function.value());
     }
     if (exceptionTarget)
         exceptionTarget->append(jit.emitExceptionCheck(vm));
index 9df4b3d..d2953e1 100644 (file)
@@ -66,7 +66,7 @@ public:
     ~State();
 
     VM& vm() { return graph.m_vm; }
-    
+
     // None of these things is owned by State. It is the responsibility of
     // FTL phases to properly manage the lifecycle of the module and function.
     DFG::Graph& graph;
index bb77ea6..b0576d5 100644 (file)
@@ -117,7 +117,7 @@ static MacroAssemblerCodeRef genericGenerationThunkGenerator(
 
     jit.ret();
     
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     patchBuffer.link(functionCall, generationFunction);
     return FINALIZE_CODE(patchBuffer, ("%s", name));
 }
@@ -164,7 +164,7 @@ static void registerClobberCheck(AssemblyHelpers& jit, RegisterSet dontClobber)
     }
 }
 
-MacroAssemblerCodeRef slowPathCallThunkGenerator(VM& vm, const SlowPathCallKey& key)
+MacroAssemblerCodeRef slowPathCallThunkGenerator(const SlowPathCallKey& key)
 {
     AssemblyHelpers jit(nullptr);
     
@@ -222,7 +222,7 @@ MacroAssemblerCodeRef slowPathCallThunkGenerator(VM& vm, const SlowPathCallKey&
     
     jit.ret();
 
-    LinkBuffer patchBuffer(vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     patchBuffer.link(call, FunctionPtr(key.callTarget()));
     return FINALIZE_CODE(patchBuffer, ("FTL slow path call thunk for %s", toCString(key).data()));
 }
index 33e3b02..3ff5e17 100644 (file)
@@ -40,7 +40,7 @@ namespace FTL {
 
 MacroAssemblerCodeRef osrExitGenerationThunkGenerator(VM*);
 MacroAssemblerCodeRef lazySlowPathGenerationThunkGenerator(VM*);
-MacroAssemblerCodeRef slowPathCallThunkGenerator(VM&, const SlowPathCallKey&);
+MacroAssemblerCodeRef slowPathCallThunkGenerator(const SlowPathCallKey&);
 
 template<typename KeyTypeArgument>
 struct ThunkMap {
@@ -54,13 +54,13 @@ struct ThunkMap {
 
 template<typename MapType, typename GeneratorType>
 MacroAssemblerCodeRef generateIfNecessary(
-    VM& vm, MapType& map, const typename MapType::KeyType& key, GeneratorType generator)
+    MapType& map, const typename MapType::KeyType& key, GeneratorType generator)
 {
     typename MapType::ToThunkMap::iterator iter = map.m_toThunk.find(key);
     if (iter != map.m_toThunk.end())
         return iter->value;
     
-    MacroAssemblerCodeRef result = generator(vm, key);
+    MacroAssemblerCodeRef result = generator(key);
     map.m_toThunk.add(key, result);
     map.m_fromThunk.add(result.code(), key);
     return result;
@@ -76,10 +76,10 @@ typename MapType::KeyType keyForThunk(MapType& map, MacroAssemblerCodePtr ptr)
 
 class Thunks {
 public:
-    MacroAssemblerCodeRef getSlowPathCallThunk(VM& vm, const SlowPathCallKey& key)
+    MacroAssemblerCodeRef getSlowPathCallThunk(const SlowPathCallKey& key)
     {
         return generateIfNecessary(
-            vm, m_slowPathCallThunks, key, slowPathCallThunkGenerator);
+            m_slowPathCallThunks, key, slowPathCallThunkGenerator);
     }
     
     SlowPathCallKey keyForSlowPathCallThunk(MacroAssemblerCodePtr ptr)
index 0e61d8e..c214cbd 100644 (file)
@@ -627,14 +627,14 @@ void AssemblyHelpers::restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer(VM& vm
 #endif
 }
 
-void AssemblyHelpers::emitDumbVirtualCall(CallLinkInfo* info)
+void AssemblyHelpers::emitDumbVirtualCall(VM& vm, CallLinkInfo* info)
 {
     move(TrustedImmPtr(info), GPRInfo::regT2);
     Call call = nearCall();
     addLinkTask(
-        [=] (LinkBuffer& linkBuffer) {
-            MacroAssemblerCodeRef virtualThunk = virtualThunkFor(&linkBuffer.vm(), *info);
-            info->setSlowStub(createJITStubRoutine(virtualThunk, linkBuffer.vm(), nullptr, true));
+        [=, &vm] (LinkBuffer& linkBuffer) {
+            MacroAssemblerCodeRef virtualThunk = virtualThunkFor(&vm, *info);
+            info->setSlowStub(createJITStubRoutine(virtualThunk, vm, nullptr, true));
             linkBuffer.link(call, CodeLocationLabel(virtualThunk.code()));
         });
 }
index 2565944..9d4a8a5 100644 (file)
@@ -1409,7 +1409,7 @@ public:
         functor(TypeofType::Undefined, true);
     }
     
-    void emitDumbVirtualCall(CallLinkInfo*);
+    void emitDumbVirtualCall(VM&, CallLinkInfo*);
     
     Vector<BytecodeAndMachineOffset>& decodedCodeMapFor(CodeBlock*);
 
index 78e113c..41f58ec 100644 (file)
@@ -311,15 +311,25 @@ private:
 };
 
 static FixedVMPoolExecutableAllocator* allocator;
+static ExecutableAllocator* executableAllocator;
 
 void ExecutableAllocator::initializeAllocator()
 {
     ASSERT(!allocator);
     allocator = new FixedVMPoolExecutableAllocator();
     CodeProfiling::notifyAllocator(allocator);
+
+    executableAllocator = new ExecutableAllocator;
+}
+
+ExecutableAllocator& ExecutableAllocator::singleton()
+{
+    ASSERT(allocator);
+    ASSERT(executableAllocator);
+    return *executableAllocator;
 }
 
-ExecutableAllocator::ExecutableAllocator(VM&)
+ExecutableAllocator::ExecutableAllocator()
 {
     ASSERT(allocator);
 }
@@ -362,7 +372,7 @@ double ExecutableAllocator::memoryPressureMultiplier(size_t addedMemoryUsage)
     return result;
 }
 
-RefPtr<ExecutableMemoryHandle> ExecutableAllocator::allocate(VM&, size_t sizeInBytes, void* ownerUID, JITCompilationEffort effort)
+RefPtr<ExecutableMemoryHandle> ExecutableAllocator::allocate(size_t sizeInBytes, void* ownerUID, JITCompilationEffort effort)
 {
     if (Options::logExecutableAllocation()) {
         MetaAllocator::Statistics stats = allocator->currentStatistics();
index 300b306..6ee6fe2 100644 (file)
@@ -55,8 +55,6 @@
 
 namespace JSC {
 
-class VM;
-
 static const unsigned jitAllocationGranule = 32;
 
 typedef WTF::MetaAllocatorHandle ExecutableMemoryHandle;
@@ -117,9 +115,7 @@ class ExecutableAllocator {
     enum ProtectionSetting { Writable, Executable };
 
 public:
-    ExecutableAllocator(VM&);
-    ~ExecutableAllocator();
-    
+    static ExecutableAllocator& singleton();
     static void initializeAllocator();
 
     bool isValid() const;
@@ -134,13 +130,17 @@ public:
     static void dumpProfile() { }
 #endif
 
-    RefPtr<ExecutableMemoryHandle> allocate(VM&, size_t sizeInBytes, void* ownerUID, JITCompilationEffort);
+    RefPtr<ExecutableMemoryHandle> allocate(size_t sizeInBytes, void* ownerUID, JITCompilationEffort);
 
     bool isValidExecutableMemory(const AbstractLocker&, void* address);
 
     static size_t committedByteCount();
 
     Lock& getLock() const;
+private:
+
+    ExecutableAllocator();
+    ~ExecutableAllocator();
 };
 
 #endif // ENABLE(JIT) && ENABLE(ASSEMBLER)
index 4dfe329..c3f93fd 100644 (file)
@@ -716,7 +716,7 @@ void JIT::compileWithoutLinking(JITCompilationEffort effort)
         m_disassembler->setEndOfCode(label());
     m_pcToCodeOriginMapBuilder.appendItem(label(), PCToCodeOriginMapBuilder::defaultCodeOrigin());
 
-    m_linkBuffer = std::unique_ptr<LinkBuffer>(new LinkBuffer(*m_vm, *this, m_codeBlock, effort));
+    m_linkBuffer = std::unique_ptr<LinkBuffer>(new LinkBuffer(*this, m_codeBlock, effort));
 
     double after = 0;
     if (UNLIKELY(computeCompileTimes())) {
index ff1cc61..3b82e27 100644 (file)
@@ -121,7 +121,7 @@ void JIT::compileCallEvalSlowCase(Instruction* instruction, Vector<SlowCaseEntry
     addPtr(TrustedImm32(registerOffset * sizeof(Register) + sizeof(CallerFrameAndPC)), callFrameRegister, stackPointerRegister);
 
     load64(Address(stackPointerRegister, sizeof(Register) * CallFrameSlot::callee - sizeof(CallerFrameAndPC)), regT0);
-    emitDumbVirtualCall(info);
+    emitDumbVirtualCall(*vm(), info);
     addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, stackPointerRegister);
     checkStackPointerAlignment();
 
index 6e1cbbf..b637e6c 100644 (file)
@@ -128,7 +128,7 @@ public:
         return false;
     }
 
-    void generateOutOfLine(VM& vm, CodeBlock* codeBlock, FunctionPtr callReplacement)
+    void generateOutOfLine(CodeBlock* codeBlock, FunctionPtr callReplacement)
     {
         auto linkJumpToOutOfLineSnippet = [&] () {
             CCallHelpers jit(codeBlock);
@@ -160,7 +160,7 @@ public:
             if (generatedInline) {
                 auto jumpToDone = jit.jump();
 
-                LinkBuffer linkBuffer(vm, jit, codeBlock, JITCompilationCanFail);
+                LinkBuffer linkBuffer(jit, codeBlock, JITCompilationCanFail);
                 if (!linkBuffer.didFailToAllocate()) {
                     linkBuffer.link(generationState.slowPathJumps, slowPathStartLocation());
                     linkBuffer.link(jumpToDone, doneLocation());
@@ -200,7 +200,7 @@ public:
                 return;
             endJumpList.append(jit.jump());
 
-            LinkBuffer linkBuffer(vm, jit, codeBlock, JITCompilationCanFail);
+            LinkBuffer linkBuffer(jit, codeBlock, JITCompilationCanFail);
             if (linkBuffer.didFailToAllocate())
                 return;
 
index 2755bb0..452be1a 100644 (file)
@@ -1119,7 +1119,7 @@ void JIT::privateCompileHasIndexedProperty(ByValInfo* byValInfo, ReturnAddressPt
     move(TrustedImm64(JSValue::encode(jsBoolean(true))), regT0);
     Jump done = jump();
 
-    LinkBuffer patchBuffer(*m_vm, *this, m_codeBlock);
+    LinkBuffer patchBuffer(*this, m_codeBlock);
     
     patchBuffer.link(badType, CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(returnAddress.value())).labelAtOffset(byValInfo->returnAddressToSlowPath));
     patchBuffer.link(slowCases, CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(returnAddress.value())).labelAtOffset(byValInfo->returnAddressToSlowPath));
index dd72ad7..add4c2e 100644 (file)
@@ -126,7 +126,7 @@ JIT::CodeRef JIT::privateCompileCTINativeCall(VM* vm, NativeFunction func)
     jumpToExceptionHandler(*vm);
 
     // All trampolines constructed! copy the code, link up calls, and set the pointers on the Machine object.
-    LinkBuffer patchBuffer(*vm, *this, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(*this, GLOBAL_THUNK_ID);
 
     patchBuffer.link(nativeCall, FunctionPtr(func));
     return FINALIZE_CODE(patchBuffer, ("JIT CTI native call"));
@@ -1061,7 +1061,7 @@ void JIT::privateCompileHasIndexedProperty(ByValInfo* byValInfo, ReturnAddressPt
     move(TrustedImm32(1), regT0);
     Jump done = jump();
 
-    LinkBuffer patchBuffer(*m_vm, *this, m_codeBlock);
+    LinkBuffer patchBuffer(*this, m_codeBlock);
     
     patchBuffer.link(badType, CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(returnAddress.value())).labelAtOffset(byValInfo->returnAddressToSlowPath));
     patchBuffer.link(slowCases, CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(returnAddress.value())).labelAtOffset(byValInfo->returnAddressToSlowPath));
index 6a2391b..1c8fc05 100644 (file)
@@ -2375,7 +2375,7 @@ EncodedJSValue JIT_OPERATION operationValueAddProfiledOptimize(ExecState* exec,
     ASSERT(arithProfile);
     arithProfile->observeLHSAndRHS(op1, op2);
     auto nonOptimizeVariant = operationValueAddProfiledNoOptimize;
-    addIC->generateOutOfLine(*vm, exec->codeBlock(), nonOptimizeVariant);
+    addIC->generateOutOfLine(exec->codeBlock(), nonOptimizeVariant);
 
 #if ENABLE(MATH_IC_STATS)
     exec->codeBlock()->dumpMathICStats();
@@ -2408,7 +2408,7 @@ EncodedJSValue JIT_OPERATION operationValueAddOptimize(ExecState* exec, EncodedJ
     auto nonOptimizeVariant = operationValueAddNoOptimize;
     if (ArithProfile* arithProfile = addIC->arithProfile())
         arithProfile->observeLHSAndRHS(op1, op2);
-    addIC->generateOutOfLine(*vm, exec->codeBlock(), nonOptimizeVariant);
+    addIC->generateOutOfLine(exec->codeBlock(), nonOptimizeVariant);
 
 #if ENABLE(MATH_IC_STATS)
     exec->codeBlock()->dumpMathICStats();
@@ -2485,7 +2485,7 @@ EncodedJSValue JIT_OPERATION operationValueMulOptimize(ExecState* exec, EncodedJ
     auto nonOptimizeVariant = operationValueMulNoOptimize;
     if (ArithProfile* arithProfile = mulIC->arithProfile())
         arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
-    mulIC->generateOutOfLine(*vm, exec->codeBlock(), nonOptimizeVariant);
+    mulIC->generateOutOfLine(exec->codeBlock(), nonOptimizeVariant);
 
 #if ENABLE(MATH_IC_STATS)
     exec->codeBlock()->dumpMathICStats();
@@ -2512,7 +2512,7 @@ EncodedJSValue JIT_OPERATION operationValueMulProfiledOptimize(ExecState* exec,
     ASSERT(arithProfile);
     arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
     auto nonOptimizeVariant = operationValueMulProfiledNoOptimize;
-    mulIC->generateOutOfLine(*vm, exec->codeBlock(), nonOptimizeVariant);
+    mulIC->generateOutOfLine(exec->codeBlock(), nonOptimizeVariant);
 
 #if ENABLE(MATH_IC_STATS)
     exec->codeBlock()->dumpMathICStats();
@@ -2583,7 +2583,7 @@ EncodedJSValue JIT_OPERATION operationArithNegateProfiledOptimize(ExecState* exe
     ArithProfile* arithProfile = negIC->arithProfile();
     ASSERT(arithProfile);
     arithProfile->observeLHS(operand);
-    negIC->generateOutOfLine(vm, exec->codeBlock(), operationArithNegateProfiled);
+    negIC->generateOutOfLine(exec->codeBlock(), operationArithNegateProfiled);
 
 #if ENABLE(MATH_IC_STATS)
     exec->codeBlock()->dumpMathICStats();
@@ -2607,7 +2607,7 @@ EncodedJSValue JIT_OPERATION operationArithNegateOptimize(ExecState* exec, Encod
 
     if (ArithProfile* arithProfile = negIC->arithProfile())
         arithProfile->observeLHS(operand);
-    negIC->generateOutOfLine(vm, exec->codeBlock(), operationArithNegate);
+    negIC->generateOutOfLine(exec->codeBlock(), operationArithNegate);
 
 #if ENABLE(MATH_IC_STATS)
     exec->codeBlock()->dumpMathICStats();
@@ -2675,7 +2675,7 @@ EncodedJSValue JIT_OPERATION operationValueSubOptimize(ExecState* exec, EncodedJ
     auto nonOptimizeVariant = operationValueSubNoOptimize;
     if (ArithProfile* arithProfile = subIC->arithProfile())
         arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
-    subIC->generateOutOfLine(*vm, exec->codeBlock(), nonOptimizeVariant);
+    subIC->generateOutOfLine(exec->codeBlock(), nonOptimizeVariant);
 
 #if ENABLE(MATH_IC_STATS)
     exec->codeBlock()->dumpMathICStats();
@@ -2701,7 +2701,7 @@ EncodedJSValue JIT_OPERATION operationValueSubProfiledOptimize(ExecState* exec,
     ASSERT(arithProfile);
     arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
     auto nonOptimizeVariant = operationValueSubProfiledNoOptimize;
-    subIC->generateOutOfLine(*vm, exec->codeBlock(), nonOptimizeVariant);
+    subIC->generateOutOfLine(exec->codeBlock(), nonOptimizeVariant);
 
 #if ENABLE(MATH_IC_STATS)
     exec->codeBlock()->dumpMathICStats();
index 233b3ed..c7a3c8e 100644 (file)
@@ -60,6 +60,7 @@ class Structure;
 class StructureStubInfo;
 class Symbol;
 class SymbolTable;
+class VM;
 class WatchpointSet;
 
 struct ByValInfo;
index d14508e..332ccb2 100644 (file)
@@ -88,7 +88,7 @@ JIT::CodeRef JIT::stringGetByValStubGenerator(VM* vm)
     jit.move(TrustedImm32(0), regT0);
     jit.ret();
     
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     return FINALIZE_CODE(patchBuffer, ("String get_by_val stub"));
 }
 
@@ -1336,7 +1336,7 @@ void JIT::privateCompileGetByVal(ByValInfo* byValInfo, ReturnAddressPtr returnAd
     
     Jump done = jump();
 
-    LinkBuffer patchBuffer(*m_vm, *this, m_codeBlock);
+    LinkBuffer patchBuffer(*this, m_codeBlock);
     
     patchBuffer.link(badType, CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(returnAddress.value())).labelAtOffset(byValInfo->returnAddressToSlowPath));
     patchBuffer.link(slowCases, CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(returnAddress.value())).labelAtOffset(byValInfo->returnAddressToSlowPath));
@@ -1362,7 +1362,7 @@ void JIT::privateCompileGetByValWithCachedId(ByValInfo* byValInfo, ReturnAddress
     JITGetByIdGenerator gen = emitGetByValWithCachedId(byValInfo, currentInstruction, propertyName, fastDoneCase, slowDoneCase, slowCases);
 
     ConcurrentJSLocker locker(m_codeBlock->m_lock);
-    LinkBuffer patchBuffer(*m_vm, *this, m_codeBlock);
+    LinkBuffer patchBuffer(*this, m_codeBlock);
     patchBuffer.link(slowCases, CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(returnAddress.value())).labelAtOffset(byValInfo->returnAddressToSlowPath));
     patchBuffer.link(fastDoneCase, byValInfo->badTypeJump.labelAtOffset(byValInfo->badTypeJumpToDone));
     patchBuffer.link(slowDoneCase, byValInfo->badTypeJump.labelAtOffset(byValInfo->badTypeJumpToNextHotPath));
@@ -1419,7 +1419,7 @@ void JIT::privateCompilePutByVal(ByValInfo* byValInfo, ReturnAddressPtr returnAd
     
     Jump done = jump();
 
-    LinkBuffer patchBuffer(*m_vm, *this, m_codeBlock);
+    LinkBuffer patchBuffer(*this, m_codeBlock);
     patchBuffer.link(badType, CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(returnAddress.value())).labelAtOffset(byValInfo->returnAddressToSlowPath));
     patchBuffer.link(slowCases, CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(returnAddress.value())).labelAtOffset(byValInfo->returnAddressToSlowPath));
     patchBuffer.link(done, byValInfo->badTypeJump.labelAtOffset(byValInfo->badTypeJumpToDone));
@@ -1453,7 +1453,7 @@ void JIT::privateCompilePutByValWithCachedId(ByValInfo* byValInfo, ReturnAddress
     JITPutByIdGenerator gen = emitPutByValWithCachedId(byValInfo, currentInstruction, putKind, propertyName, doneCases, slowCases);
 
     ConcurrentJSLocker locker(m_codeBlock->m_lock);
-    LinkBuffer patchBuffer(*m_vm, *this, m_codeBlock);
+    LinkBuffer patchBuffer(*this, m_codeBlock);
     patchBuffer.link(slowCases, CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(returnAddress.value())).labelAtOffset(byValInfo->returnAddressToSlowPath));
     patchBuffer.link(doneCases, byValInfo->badTypeJump.labelAtOffset(byValInfo->badTypeJumpToDone));
     if (!m_exceptionChecks.empty())
index c632a95..cedf9fd 100644 (file)
@@ -177,7 +177,7 @@ JIT::CodeRef JIT::stringGetByValStubGenerator(VM* vm)
     jit.move(TrustedImm32(0), regT0);
     jit.ret();
     
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     return FINALIZE_CODE(patchBuffer, ("String get_by_val stub"));
 }
 
index 2bf37fa..66c4bd7 100644 (file)
@@ -33,6 +33,7 @@
 namespace JSC {
 
 class JITStubRoutineSet;
+class VM;
 
 // This is a base-class for JIT stub routines, and also the class you want
 // to instantiate directly if you have a routine that does not need any
index 7f41cfb..a034c5d 100644 (file)
@@ -91,7 +91,7 @@ void ftlThunkAwareRepatchCall(CodeBlock* codeBlock, CodeLocationCall call, Funct
                 MacroAssembler::readCallTarget(call).executableAddress()));
         key = key.withCallTarget(newCalleeFunction.executableAddress());
         newCalleeFunction = FunctionPtr(
-            thunks.getSlowPathCallThunk(vm, key).code().executableAddress());
+            thunks.getSlowPathCallThunk(key).code().executableAddress());
     }
 #else // ENABLE(FTL_JIT)
     UNUSED_PARAM(codeBlock);
@@ -931,7 +931,7 @@ void linkPolymorphicCall(
     stubJit.restoreReturnAddressBeforeReturn(GPRInfo::regT4);
     AssemblyHelpers::Jump slow = stubJit.jump();
         
-    LinkBuffer patchBuffer(vm, stubJit, owner, JITCompilationCanFail);
+    LinkBuffer patchBuffer(stubJit, owner, JITCompilationCanFail);
     if (patchBuffer.didFailToAllocate()) {
         linkVirtualFor(exec, callLinkInfo);
         return;
index 63c3ce0..1d3d117 100644 (file)
@@ -166,7 +166,7 @@ namespace JSC {
         
         MacroAssemblerCodeRef finalize(MacroAssemblerCodePtr fallback, const char* thunkKind)
         {
-            LinkBuffer patchBuffer(*m_vm, *this, GLOBAL_THUNK_ID);
+            LinkBuffer patchBuffer(*this, GLOBAL_THUNK_ID);
             patchBuffer.link(m_failures, CodeLocationLabel(fallback));
             for (unsigned i = 0; i < m_calls.size(); i++)
                 patchBuffer.link(m_calls[i].first, m_calls[i].second);
index 982c4b9..b5f490f 100644 (file)
@@ -77,7 +77,7 @@ MacroAssemblerCodeRef throwExceptionFromCallSlowPathGenerator(VM* vm)
     jit.call(GPRInfo::nonArgGPR0);
     jit.jumpToExceptionHandler(*vm);
 
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     return FINALIZE_CODE(patchBuffer, ("Throw exception from call slow path thunk"));
 }
 
@@ -142,7 +142,7 @@ MacroAssemblerCodeRef linkCallThunkGenerator(VM* vm)
     
     slowPathFor(jit, vm, operationLinkCall);
     
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     return FINALIZE_CODE(patchBuffer, ("Link call slow path thunk"));
 }
 
@@ -154,7 +154,7 @@ MacroAssemblerCodeRef linkPolymorphicCallThunkGenerator(VM* vm)
     
     slowPathFor(jit, vm, operationLinkPolymorphicCall);
     
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     return FINALIZE_CODE(patchBuffer, ("Link polymorphic call slow path thunk"));
 }
 
@@ -223,7 +223,7 @@ MacroAssemblerCodeRef virtualThunkFor(VM* vm, CallLinkInfo& callLinkInfo)
     
     slowPathFor(jit, vm, operationVirtualCall);
     
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     return FINALIZE_CODE(
         patchBuffer,
         ("Virtual %s slow path thunk",
@@ -382,7 +382,7 @@ static MacroAssemblerCodeRef nativeForGenerator(VM* vm, CodeSpecializationKind k
 
     jit.jumpToExceptionHandler(*vm);
 
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     return FINALIZE_CODE(patchBuffer, ("native %s%s trampoline", entryType == EnterViaJumpWithSavedTags ? "Tail With Saved Tags " : entryType == EnterViaJumpWithoutSavedTags ? "Tail Without Saved Tags " : "", toCString(kind).data()));
 }
 
@@ -529,7 +529,7 @@ MacroAssemblerCodeRef arityFixupGenerator(VM* vm)
     jit.ret();
 #endif
 
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     return FINALIZE_CODE(patchBuffer, ("fixup arity"));
 }
 
@@ -539,7 +539,7 @@ MacroAssemblerCodeRef unreachableGenerator(VM* vm)
 
     jit.breakpoint();
 
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     return FINALIZE_CODE(patchBuffer, ("unreachable thunk"));
 }
 
@@ -1127,7 +1127,7 @@ MacroAssemblerCodeRef boundThisNoArgsFunctionCallGenerator(VM* vm)
     jit.emitFunctionEpilogue();
     jit.ret();
     
-    LinkBuffer linkBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
     linkBuffer.link(noCode, CodeLocationLabel(vm->jitStubs->ctiNativeTailCallWithoutSavedTags(vm)));
     return FINALIZE_CODE(
         linkBuffer, ("Specialized thunk for bound function calls with no arguments"));
@@ -1167,7 +1167,7 @@ MacroAssemblerCodeRef throwExceptionFromWasmThunkGenerator(VM* vm)
         ASSERT(!!vm->callFrameForCatch);
     };
 
-    LinkBuffer linkBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
     linkBuffer.link(call, throwWasmException);
     return FINALIZE_CODE(
         linkBuffer, ("Throw exception from Wasm"));
index a9fa7dd..36f6486 100644 (file)
@@ -59,7 +59,7 @@ static MacroAssemblerCodeRef generateThunkWithJumpTo(VM* vm, void (*target)(), c
     jit.move(JSInterfaceJIT::TrustedImmPtr(bitwise_cast<void*>(target)), JSInterfaceJIT::regT0);
     jit.jump(JSInterfaceJIT::regT0);
     
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     return FINALIZE_CODE(patchBuffer, ("LLInt %s prologue thunk", thunkKind));
 }
 
index 8629964..328a471 100644 (file)
@@ -342,7 +342,7 @@ void SamplingProfiler::takeSample(const AbstractLocker&, std::chrono::microsecon
 
         LockHolder machineThreadsLocker(m_vm.heap.machineThreads().getLock());
         LockHolder codeBlockSetLocker(m_vm.heap.codeBlockSet().getLock());
-        LockHolder executableAllocatorLocker(m_vm.executableAllocator.getLock());
+        LockHolder executableAllocatorLocker(ExecutableAllocator::singleton().getLock());
 
         bool didSuspend = m_jscExecutionThread->suspend();
         if (didSuspend) {
@@ -364,7 +364,7 @@ void SamplingProfiler::takeSample(const AbstractLocker&, std::chrono::microsecon
             }
             // FIXME: Lets have a way of detecting when we're parsing code.
             // https://bugs.webkit.org/show_bug.cgi?id=152761
-            if (m_vm.executableAllocator.isValidExecutableMemory(executableAllocatorLocker, machinePC)) {
+            if (ExecutableAllocator::singleton().isValidExecutableMemory(executableAllocatorLocker, machinePC)) {
                 if (m_vm.isExecutingInRegExpJIT) {
                     // FIXME: We're executing a regexp. Lets gather more intersting data.
                     // https://bugs.webkit.org/show_bug.cgi?id=152729
index 022b02e..4af991e 100644 (file)
@@ -165,9 +165,6 @@ static bool enableAssembler(ExecutableAllocator& executableAllocator)
 
 VM::VM(VMType vmType, HeapType heapType)
     : m_apiLock(adoptRef(new JSLock(this)))
-#if ENABLE(ASSEMBLER)
-    , executableAllocator(*this)
-#endif
     , heap(this, heapType)
     , auxiliarySpace("Auxiliary", heap, AllocatorAttributes(DoesNotNeedDestruction, HeapCell::Auxiliary))
     , cellSpace("JSCell", heap, AllocatorAttributes(DoesNotNeedDestruction, HeapCell::JSCell))
@@ -198,7 +195,7 @@ VM::VM(VMType vmType, HeapType heapType)
     , m_rtTraceList(new RTTraceList())
 #endif
 #if ENABLE(ASSEMBLER)
-    , m_canUseAssembler(enableAssembler(executableAllocator))
+    , m_canUseAssembler(enableAssembler(ExecutableAllocator::singleton()))
 #endif
 #if ENABLE(JIT)
     , m_canUseJIT(m_canUseAssembler && Options::useJIT())
index 26ca730..d688c3f 100644 (file)
@@ -285,14 +285,6 @@ private:
     RefPtr<JSLock> m_apiLock;
 
 public:
-#if ENABLE(ASSEMBLER)
-    // executableAllocator should be destructed after the heap, as the heap can call executableAllocator
-    // in its destructor.
-    ExecutableAllocator executableAllocator;
-#endif
-
-    // The heap should be just after executableAllocator and before other members to ensure that it's
-    // destructed after all the objects that reference it.
     Heap heap;
     
     Subspace auxiliarySpace;
index c98a3dc..52763f8 100644 (file)
@@ -250,7 +250,7 @@ void VMTraps::tryInstallTrapBreakpoints(SignalContext& context, StackBounds stac
         return; // Let the SignalSender try again later.
 
     {
-        auto allocator = vm.executableAllocator;
+        auto& allocator = ExecutableAllocator::singleton();
         auto allocatorLocker = tryHoldLock(allocator.getLock());
         if (!allocatorLocker)
             return; // Let the SignalSender try again later.
index e39ac32..bbaaf6a 100644 (file)
@@ -107,8 +107,8 @@ auto VMInspector::isValidExecutableMemory(const VMInspector::Locker&, void* mach
 #if ENABLE(JIT)
     bool found = false;
     bool hasTimeout = false;
-    iterate([&] (VM& vm) -> FunctorStatus {
-        auto allocator = vm.executableAllocator;
+    iterate([&] (VM&) -> FunctorStatus {
+        auto& allocator = ExecutableAllocator::singleton();
         auto& lock = allocator.getLock();
 
         bool isSafeToLock = ensureIsSafeToLock(lock);
index d3a1949..b70458b 100644 (file)
@@ -114,7 +114,7 @@ static MacroAssemblerCodeRef wasmToJs(VM* vm, Bag<CallLinkInfo>& callLinkInfos,
                 ASSERT(!!vm->callFrameForCatch);
             };
 
-            LinkBuffer linkBuffer(*vm, jit, GLOBAL_THUNK_ID);
+            LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
             linkBuffer.link(call, throwBadI64);
             return FINALIZE_CODE(linkBuffer, ("WebAssembly->JavaScript invalid i64 use in import[%i]", importIndex));
         }
@@ -412,7 +412,7 @@ static MacroAssemblerCodeRef wasmToJs(VM* vm, Bag<CallLinkInfo>& callLinkInfos,
         });
     }
 
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     patchBuffer.link(slowCall, FunctionPtr(vm->getCTIStub(linkCallThunkGenerator).code().executableAddress()));
     CodeLocationLabel callReturnLocation(patchBuffer.locationOfNearCall(slowCall));
     CodeLocationLabel hotPathBegin(patchBuffer.locationOf(targetToCheck));
@@ -426,7 +426,7 @@ static MacroAssemblerCodeRef wasmToJs(VM* vm, Bag<CallLinkInfo>& callLinkInfos,
     return FINALIZE_CODE(patchBuffer, ("WebAssembly->JavaScript import[%i] %s", importIndex, signatureDescription.ascii().data()));
 }
 
-static MacroAssemblerCodeRef wasmToWasm(VM* vm, unsigned importIndex)
+static MacroAssemblerCodeRef wasmToWasm(unsigned importIndex)
 {
     const PinnedRegisterInfo& pinnedRegs = PinnedRegisterInfo::get();
     JIT jit;
@@ -462,7 +462,7 @@ static MacroAssemblerCodeRef wasmToWasm(VM* vm, unsigned importIndex)
     jit.loadPtr(JIT::Address(scratch, WebAssemblyFunction::offsetOfWasmEntryPointCode()), scratch);
     jit.jump(scratch);
 
-    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
+    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
     return FINALIZE_CODE(patchBuffer, ("WebAssembly->WebAssembly import[%i]", importIndex));
 }
 
@@ -470,7 +470,7 @@ WasmExitStubs exitStubGenerator(VM* vm, Bag<CallLinkInfo>& callLinkInfos, Signat
 {
     WasmExitStubs stubs;
     stubs.wasmToJs = wasmToJs(vm, callLinkInfos, signatureIndex, importIndex);
-    stubs.wasmToWasm = wasmToWasm(vm, importIndex);
+    stubs.wasmToWasm = wasmToWasm(importIndex);
     return stubs;
 }
 
index 1ddc693..113dc49 100644 (file)
@@ -274,13 +274,13 @@ void Plan::complete(const AbstractLocker&)
                 SignatureIndex signatureIndex = m_moduleInformation->internalFunctionSignatureIndices[functionIndex];
                 String signatureDescription = SignatureInformation::get(&m_vm, signatureIndex)->toString();
                 {
-                    LinkBuffer linkBuffer(m_vm, *context.wasmEntrypointJIT, nullptr);
+                    LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr);
                     m_wasmInternalFunctions[functionIndex]->wasmEntrypoint.compilation =
                     std::make_unique<B3::Compilation>(FINALIZE_CODE(linkBuffer, ("WebAssembly function[%i] %s", functionIndex, signatureDescription.ascii().data())), WTFMove(context.wasmEntrypointByproducts));
                 }
 
                 {
-                    LinkBuffer linkBuffer(m_vm, *context.jsEntrypointJIT, nullptr);
+                    LinkBuffer linkBuffer(*context.jsEntrypointJIT, nullptr);
                     linkBuffer.link(context.jsEntrypointToWasmEntrypointCall, FunctionPtr(m_wasmInternalFunctions[functionIndex]->wasmEntrypoint.compilation->code().executableAddress()));
 
                     m_wasmInternalFunctions[functionIndex]->jsToWasmEntrypoint.compilation =
index 26a22bd..daa0fc7 100644 (file)
@@ -2646,7 +2646,7 @@ public:
     {
     }
 
-    void compile(VM* vm, YarrCodeBlock& jitObject)
+    void compile(YarrCodeBlock& jitObject)
     {
         generateEnter();
 
@@ -2674,7 +2674,7 @@ public:
         generate();
         backtrack();
 
-        LinkBuffer linkBuffer(*vm, *this, REGEXP_CODE_ID, JITCompilationCanFail);
+        LinkBuffer linkBuffer(*this, REGEXP_CODE_ID, JITCompilationCanFail);
         if (linkBuffer.didFailToAllocate()) {
             jitObject.setFallBack(true);
             return;
@@ -2729,9 +2729,9 @@ private:
 void jitCompile(YarrPattern& pattern, YarrCharSize charSize, VM* vm, YarrCodeBlock& jitObject, YarrJITCompileMode mode)
 {
     if (mode == MatchOnly)
-        YarrGenerator<MatchOnly>(vm, pattern, charSize).compile(vm, jitObject);
+        YarrGenerator<MatchOnly>(vm, pattern, charSize).compile(jitObject);
     else
-        YarrGenerator<IncludeSubpatterns>(vm, pattern, charSize).compile(vm, jitObject);
+        YarrGenerator<IncludeSubpatterns>(vm, pattern, charSize).compile(jitObject);
 }
 
 }}
index 4bdb99b..7f53b6b 100644 (file)
@@ -1,3 +1,14 @@
+2017-03-29  Saam Barati  <sbarati@apple.com>
+
+        LinkBuffer and ExecutableAllocator shouldn't have anything to do with VM
+        https://bugs.webkit.org/show_bug.cgi?id=170210
+
+        Reviewed by Mark Lam.
+
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::compileSelector):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
+
 2017-03-29  Javier Fernandez  <jfernandez@igalia.com>
 
         [css-align] Adapt self-alignment properties to the new baseline syntax
index b51d586..6d5846a 100644 (file)
@@ -256,7 +256,7 @@ struct BacktrackingLevel {
 class SelectorCodeGenerator {
 public:
     SelectorCodeGenerator(const CSSSelector*, SelectorContext);
-    SelectorCompilationStatus compile(JSC::VM*, JSC::MacroAssemblerCodeRef&);
+    SelectorCompilationStatus compile(JSC::MacroAssemblerCodeRef&);
 
 private:
     static const Assembler::RegisterID returnRegister;
@@ -395,7 +395,7 @@ SelectorCompilationStatus compileSelector(const CSSSelector* lastSelector, JSC::
     if (!vm->canUseJIT())
         return SelectorCompilationStatus::CannotCompile;
     SelectorCodeGenerator codeGenerator(lastSelector, selectorContext);
-    return codeGenerator.compile(vm, codeRef);
+    return codeGenerator.compile(codeRef);
 }
 
 static inline FragmentRelation fragmentRelationForSelectorRelation(CSSSelector::RelationType relation)
@@ -1208,7 +1208,7 @@ void computeBacktrackingMemoryRequirements(SelectorFragmentList& selectorFragmen
     }
 }
 
-inline SelectorCompilationStatus SelectorCodeGenerator::compile(JSC::VM* vm, JSC::MacroAssemblerCodeRef& codeRef)
+inline SelectorCompilationStatus SelectorCodeGenerator::compile(JSC::MacroAssemblerCodeRef& codeRef)
 {
     switch (m_functionType) {
     case FunctionType::SimpleSelectorChecker:
@@ -1223,7 +1223,7 @@ inline SelectorCompilationStatus SelectorCodeGenerator::compile(JSC::VM* vm, JSC
         return SelectorCompilationStatus::CannotCompile;
     }
 
-    JSC::LinkBuffer linkBuffer(*vm, m_assembler, CSS_CODE_ID, JSC::JITCompilationCanFail);
+    JSC::LinkBuffer linkBuffer(m_assembler, CSS_CODE_ID, JSC::JITCompilationCanFail);
     if (!linkBuffer.isValid()) {
         // This could be SelectorCompilationStatus::NotCompiled but that would cause us to re-enter
         // the CSS JIT every time we evaluate that selector.