Changeset 214531 in webkit for trunk/Source/JavaScriptCore/ftl


Ignore:
Timestamp:
Mar 28, 2017, 11:15:23 PM (8 years ago)
Author:
[email protected]
Message:

AssemblyHelpers should not have a VM field
https://bugs.webkit.org/show_bug.cgi?id=170207

Reviewed by Yusuke Suzuki.

APIs that need VM should take one as a parameter. When doing position
independent code for Wasm, we can't tie code generation to a VM.

  • b3/B3Compile.cpp:

(JSC::B3::compile):

  • b3/air/testair.cpp:
  • b3/testb3.cpp:

(JSC::B3::testEntrySwitchSimple):
(JSC::B3::testEntrySwitchNoEntrySwitch):
(JSC::B3::testEntrySwitchWithCommonPaths):
(JSC::B3::testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint):
(JSC::B3::testEntrySwitchLoop):

  • bytecode/AccessCase.cpp:

(JSC::AccessCase::generateWithGuard):
(JSC::AccessCase::generateImpl):

  • bytecode/DOMJITAccessCasePatchpointParams.cpp:

(JSC::SlowPathCallGeneratorWithArguments::generateImpl):

  • bytecode/InlineAccess.cpp:

(JSC::InlineAccess::dumpCacheSizesAndCrash):
(JSC::InlineAccess::generateSelfPropertyAccess):
(JSC::InlineAccess::generateSelfPropertyReplace):
(JSC::InlineAccess::generateArrayLength):
(JSC::InlineAccess::rewireStubAsJump):

  • bytecode/InlineAccess.h:
  • bytecode/PolymorphicAccess.cpp:

(JSC::AccessGenerationState::emitExplicitExceptionHandler):
(JSC::PolymorphicAccess::regenerate):

  • bytecode/PolymorphicAccess.h:

(JSC::AccessGenerationState::AccessGenerationState):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::JITCompiler):
(JSC::DFG::JITCompiler::compileExceptionHandlers):
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):
(JSC::DFG::JITCompiler::exceptionCheck):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::exceptionCheckWithCallFrameRollback):
(JSC::DFG::JITCompiler::fastExceptionCheck):
(JSC::DFG::JITCompiler::vm):

  • dfg/DFGOSRExitCompiler.cpp:
  • dfg/DFGOSRExitCompiler.h:
  • dfg/DFGOSRExitCompiler32_64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompiler64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompilerCommon.cpp:

(JSC::DFG::adjustAndJumpToTarget):

  • dfg/DFGOSRExitCompilerCommon.h:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::emitAllocateRawObject):
(JSC::DFG::SpeculativeJIT::checkArray):
(JSC::DFG::SpeculativeJIT::compileCurrentBlock):
(JSC::DFG::SpeculativeJIT::compileInstanceOfForObject):
(JSC::DFG::SpeculativeJIT::compileMakeRope):
(JSC::DFG::SpeculativeJIT::compileGetGlobalObject):
(JSC::DFG::SpeculativeJIT::compileNewFunctionCommon):
(JSC::DFG::SpeculativeJIT::compileCreateActivation):
(JSC::DFG::SpeculativeJIT::compileCreateDirectArguments):
(JSC::DFG::SpeculativeJIT::compileSpread):
(JSC::DFG::SpeculativeJIT::compileArraySlice):
(JSC::DFG::SpeculativeJIT::compileNukeStructureAndSetButterfly):
(JSC::DFG::SpeculativeJIT::compileNewStringObject):
(JSC::DFG::SpeculativeJIT::compileNewTypedArray):
(JSC::DFG::SpeculativeJIT::compileStoreBarrier):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::emitAllocateJSObjectWithKnownSize):
(JSC::DFG::SpeculativeJIT::emitAllocateJSObject):
(JSC::DFG::SpeculativeJIT::emitAllocateVariableSizedJSObject):
(JSC::DFG::SpeculativeJIT::emitAllocateDestructibleObject):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::emitCall):
(JSC::DFG::SpeculativeJIT::compileLogicalNot):
(JSC::DFG::SpeculativeJIT::emitBranch):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNullOrUndefined):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNullOrUndefined):
(JSC::DFG::SpeculativeJIT::emitCall):
(JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::compileLogicalNot):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::emitBranch):
(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize):

  • dfg/DFGThunks.cpp:

(JSC::DFG::osrEntryThunkGenerator):

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • ftl/FTLJITFinalizer.h:
  • ftl/FTLLazySlowPath.cpp:

(JSC::FTL::LazySlowPath::generate):

  • ftl/FTLLazySlowPathCall.h:

(JSC::FTL::createLazyCallGenerator):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::lower):
(JSC::FTL::DFG::LowerDFGToB3::compileCreateActivation):
(JSC::FTL::DFG::LowerDFGToB3::compileNewFunction):
(JSC::FTL::DFG::LowerDFGToB3::compileCreateDirectArguments):
(JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray):
(JSC::FTL::DFG::LowerDFGToB3::compileMakeRope):
(JSC::FTL::DFG::LowerDFGToB3::compileNotifyWrite):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
(JSC::FTL::DFG::LowerDFGToB3::compileCallEval):
(JSC::FTL::DFG::LowerDFGToB3::compileIsObjectOrNull):
(JSC::FTL::DFG::LowerDFGToB3::compileIsFunction):
(JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject):
(JSC::FTL::DFG::LowerDFGToB3::compileMaterializeCreateActivation):
(JSC::FTL::DFG::LowerDFGToB3::compileCheckTraps):
(JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl):
(JSC::FTL::DFG::LowerDFGToB3::allocateObject):
(JSC::FTL::DFG::LowerDFGToB3::allocateJSArray):
(JSC::FTL::DFG::LowerDFGToB3::buildTypeOf):

  • ftl/FTLOSRExitCompiler.cpp:

(JSC::FTL::compileStub):

  • ftl/FTLSlowPathCall.h:

(JSC::FTL::callOperation):

  • ftl/FTLState.h:

(JSC::FTL::State::vm):

  • ftl/FTLThunks.cpp:

(JSC::FTL::genericGenerationThunkGenerator):
(JSC::FTL::slowPathCallThunkGenerator):

  • jit/AssemblyHelpers.cpp:

(JSC::AssemblyHelpers::jitReleaseAssertNoException):
(JSC::AssemblyHelpers::callExceptionFuzz):
(JSC::AssemblyHelpers::emitJumpIfException):
(JSC::AssemblyHelpers::emitExceptionCheck):
(JSC::AssemblyHelpers::emitNonPatchableExceptionCheck):
(JSC::AssemblyHelpers::emitLoadStructure):
(JSC::AssemblyHelpers::emitRandomThunk):
(JSC::AssemblyHelpers::restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer):
(JSC::AssemblyHelpers::emitConvertValueToBoolean):
(JSC::AssemblyHelpers::debugCall):

  • jit/AssemblyHelpers.h:

(JSC::AssemblyHelpers::AssemblyHelpers):
(JSC::AssemblyHelpers::codeBlock):
(JSC::AssemblyHelpers::copyCalleeSavesToVMEntryFrameCalleeSavesBuffer):
(JSC::AssemblyHelpers::copyCalleeSavesFromFrameOrRegisterToVMEntryFrameCalleeSavesBuffer):
(JSC::AssemblyHelpers::barrierBranch):
(JSC::AssemblyHelpers::barrierStoreLoadFence):
(JSC::AssemblyHelpers::mutatorFence):
(JSC::AssemblyHelpers::storeButterfly):
(JSC::AssemblyHelpers::nukeStructureAndStoreButterfly):
(JSC::AssemblyHelpers::jumpIfMutatorFenceNotNeeded):
(JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize):
(JSC::AssemblyHelpers::emitAllocateJSObject):
(JSC::AssemblyHelpers::emitAllocateVariableSizedCell):
(JSC::AssemblyHelpers::emitAllocateVariableSizedJSObject):
(JSC::AssemblyHelpers::emitAllocateDestructibleObject):
(JSC::AssemblyHelpers::vm): Deleted.
(JSC::AssemblyHelpers::debugCall): Deleted.

  • jit/CCallHelpers.cpp:

(JSC::CCallHelpers::ensureShadowChickenPacket):

  • jit/CCallHelpers.h:

(JSC::CCallHelpers::CCallHelpers):
(JSC::CCallHelpers::jumpToExceptionHandler):

  • jit/JIT.cpp:

(JSC::JIT::emitEnterOptimizationCheck):
(JSC::JIT::privateCompileExceptionHandlers):

  • jit/JIT.h:

(JSC::JIT::exceptionCheck):
(JSC::JIT::exceptionCheckWithCallFrameRollback):

  • jit/JITMathIC.h:

(JSC::JITMathIC::generateOutOfLine):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_instanceof):
(JSC::JIT::emit_op_is_undefined):
(JSC::JIT::emit_op_jfalse):
(JSC::JIT::emit_op_jeq_null):
(JSC::JIT::emit_op_jneq_null):
(JSC::JIT::emit_op_jtrue):
(JSC::JIT::emit_op_throw):
(JSC::JIT::emit_op_catch):
(JSC::JIT::emit_op_eq_null):
(JSC::JIT::emit_op_neq_null):
(JSC::JIT::emitSlow_op_loop_hint):
(JSC::JIT::emit_op_log_shadow_chicken_prologue):
(JSC::JIT::emit_op_log_shadow_chicken_tail):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::privateCompileCTINativeCall):
(JSC::JIT::emit_op_new_object):
(JSC::JIT::emit_op_jfalse):
(JSC::JIT::emit_op_jtrue):
(JSC::JIT::emit_op_throw):
(JSC::JIT::emit_op_catch):
(JSC::JIT::emit_op_create_this):
(JSC::JIT::emit_op_log_shadow_chicken_prologue):
(JSC::JIT::emit_op_log_shadow_chicken_tail):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emitWriteBarrier):

  • jit/JSInterfaceJIT.h:

(JSC::JSInterfaceJIT::JSInterfaceJIT):
(JSC::JSInterfaceJIT::vm):

  • jit/Repatch.cpp:

(JSC::tryCacheGetByID):
(JSC::tryCachePutByID):
(JSC::linkPolymorphicCall):
(JSC::resetGetByID):
(JSC::resetPutByID):

  • jit/SetupVarargsFrame.cpp:

(JSC::emitSetupVarargsFrameFastCase):

  • jit/SetupVarargsFrame.h:
  • jit/SpecializedThunkJIT.h:

(JSC::SpecializedThunkJIT::loadArgumentWithSpecificClass):

  • jit/ThunkGenerators.cpp:

(JSC::throwExceptionFromCallSlowPathGenerator):
(JSC::linkCallThunkGenerator):
(JSC::linkPolymorphicCallThunkGenerator):
(JSC::virtualThunkFor):
(JSC::nativeForGenerator):
(JSC::randomThunkGenerator):
(JSC::boundThisNoArgsFunctionCallGenerator):
(JSC::throwExceptionFromWasmThunkGenerator):

  • wasm/WasmB3IRGenerator.cpp:

(JSC::Wasm::parseAndCompile):

  • wasm/WasmBinding.cpp:

(JSC::Wasm::wasmToJs):
(JSC::Wasm::wasmToWasm):

Location:
trunk/Source/JavaScriptCore/ftl
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp

    r214069 r214531  
    127127    codeBlock->clearExceptionHandlers();
    128128
    129     CCallHelpers jit(&vm, codeBlock);
     129    CCallHelpers jit(codeBlock);
    130130    B3::generate(*state.proc, jit);
    131131
    132132    // Emit the exception handler.
    133133    *state.exceptionHandler = jit.label();
    134     jit.copyCalleeSavesToVMEntryFrameCalleeSavesBuffer();
    135     jit.move(MacroAssembler::TrustedImmPtr(jit.vm()), GPRInfo::argumentGPR0);
     134    jit.copyCalleeSavesToVMEntryFrameCalleeSavesBuffer(vm);
     135    jit.move(MacroAssembler::TrustedImmPtr(&vm), GPRInfo::argumentGPR0);
    136136    jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1);
    137137    CCallHelpers::Call call = jit.call();
    138     jit.jumpToExceptionHandler();
     138    jit.jumpToExceptionHandler(vm);
    139139    jit.addLinkTask(
    140140        [=] (LinkBuffer& linkBuffer) {
  • trunk/Source/JavaScriptCore/ftl/FTLJITFinalizer.h

    r214069 r214531  
    3131#include "FTLGeneratedFunction.h"
    3232#include "FTLJITCode.h"
    33 #include "FTLSlowPathCall.h"
    3433#include "LinkBuffer.h"
    3534#include "MacroAssembler.h"
  • trunk/Source/JavaScriptCore/ftl/FTLLazySlowPath.cpp

    r196729 r214531  
    5858    VM& vm = *codeBlock->vm();
    5959
    60     CCallHelpers jit(&vm, codeBlock);
     60    CCallHelpers jit(codeBlock);
    6161    GenerationParams params;
    6262    CCallHelpers::JumpList exceptionJumps;
  • trunk/Source/JavaScriptCore/ftl/FTLLazySlowPathCall.h

    r206525 r214531  
    3939template<typename ResultType, typename... ArgumentTypes>
    4040RefPtr<LazySlowPath::Generator> createLazyCallGenerator(
    41     FunctionPtr function, ResultType result, ArgumentTypes... arguments)
     41    VM& vm, FunctionPtr function, ResultType result, ArgumentTypes... arguments)
    4242{
    4343    return LazySlowPath::createGenerator(
    44         [=] (CCallHelpers& jit, LazySlowPath::GenerationParams& params) {
     44        [=, &vm] (CCallHelpers& jit, LazySlowPath::GenerationParams& params) {
    4545            callOperation(
    46                 params.lazySlowPath->usedRegisters(), jit, params.lazySlowPath->callSiteIndex(),
     46                vm, params.lazySlowPath->usedRegisters(), jit, params.lazySlowPath->callSiteIndex(),
    4747                params.exceptionJumps, function, result, arguments...);
    4848            params.doneJumps.append(jit.jump());
  • trunk/Source/JavaScriptCore/ftl/FTLLink.cpp

    r214069 r214531  
    6161    // Create the entrypoint. Note that we use this entrypoint totally differently
    6262    // depending on whether we're doing OSR entry or not.
    63     CCallHelpers jit(&vm, codeBlock);
     63    CCallHelpers jit(codeBlock);
    6464   
    6565    std::unique_ptr<LinkBuffer> linkBuffer;
     
    143143
    144144            auto noException = jit.branch32(CCallHelpers::GreaterThanOrEqual, GPRInfo::returnValueGPR, CCallHelpers::TrustedImm32(0));
    145             jit.copyCalleeSavesToVMEntryFrameCalleeSavesBuffer();
    146             jit.move(CCallHelpers::TrustedImmPtr(jit.vm()), GPRInfo::argumentGPR0);
     145            jit.copyCalleeSavesToVMEntryFrameCalleeSavesBuffer(vm);
     146            jit.move(CCallHelpers::TrustedImmPtr(&vm), GPRInfo::argumentGPR0);
    147147            jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1);
    148148            CCallHelpers::Call callLookupExceptionHandlerFromCallerFrame = jit.call();
    149             jit.jumpToExceptionHandler();
     149            jit.jumpToExceptionHandler(vm);
    150150            noException.link(&jit);
    151151
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r214296 r214531  
    201201        m_out.storePtr(m_out.constIntPtr(bitwise_cast<intptr_t>(codeBlock())), addressFor(CallFrameSlot::codeBlock));
    202202
     203        VM* vm = &this->vm();
     204
    203205        // Stack Overflow Check.
    204206        unsigned exitFrameSize = m_graph.requiredRegisterCountForExit() * sizeof(Register);
    205         MacroAssembler::AbsoluteAddress addressOfStackLimit(vm().addressOfSoftStackLimit());
     207        MacroAssembler::AbsoluteAddress addressOfStackLimit(vm->addressOfSoftStackLimit());
    206208        PatchpointValue* stackOverflowHandler = m_out.patchpoint(Void);
    207209        CallSiteIndex callSiteIndex = callSiteIndexForCodeOrigin(m_ftlState, CodeOrigin(0));
     
    227229                        MacroAssembler::TrustedImm32(callSiteIndex.bits()),
    228230                        CCallHelpers::tagFor(VirtualRegister(CallFrameSlot::argumentCount)));
    229                     jit.copyCalleeSavesToVMEntryFrameCalleeSavesBuffer();
     231                    jit.copyCalleeSavesToVMEntryFrameCalleeSavesBuffer(*vm);
    230232
    231233                    jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
     
    233235                    CCallHelpers::Call throwCall = jit.call();
    234236
    235                     jit.move(CCallHelpers::TrustedImmPtr(jit.vm()), GPRInfo::argumentGPR0);
     237                    jit.move(CCallHelpers::TrustedImmPtr(vm), GPRInfo::argumentGPR0);
    236238                    jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1);
    237239                    CCallHelpers::Call lookupExceptionHandlerCall = jit.call();
    238                     jit.jumpToExceptionHandler();
     240                    jit.jumpToExceptionHandler(*vm);
    239241
    240242                    jit.addLinkTask(
     
    40734075       
    40744076        m_out.appendTo(slowPath, continuation);
     4077        VM& vm = this->vm();
    40754078        LValue callResult = lazySlowPath(
    4076             [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    4077                 return createLazyCallGenerator(
     4079            [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     4080                return createLazyCallGenerator(vm,
    40784081                    operationCreateActivationDirect, locations[0].directGPR(),
    40794082                    CCallHelpers::TrustedImmPtr(structure.get()), locations[1].directGPR(),
     
    41374140        Vector<LValue> slowPathArguments;
    41384141        slowPathArguments.append(scope);
     4142        VM& vm = this->vm();
    41394143        LValue callResult = lazySlowPath(
    4140             [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     4144            [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    41414145                if (isGeneratorFunction) {
    4142                     return createLazyCallGenerator(
     4146                    return createLazyCallGenerator(vm,
    41434147                        operationNewGeneratorFunctionWithInvalidatedReallocationWatchpoint,
    41444148                        locations[0].directGPR(), locations[1].directGPR(),
     
    41464150                }
    41474151                if (isAsyncFunction) {
    4148                     return createLazyCallGenerator(
     4152                    return createLazyCallGenerator(vm,
    41494153                        operationNewAsyncFunctionWithInvalidatedReallocationWatchpoint,
    41504154                        locations[0].directGPR(), locations[1].directGPR(),
    41514155                        CCallHelpers::TrustedImmPtr(executable));
    41524156                }
    4153                 return createLazyCallGenerator(
     4157                return createLazyCallGenerator(vm,
    41544158                    operationNewFunctionWithInvalidatedReallocationWatchpoint,
    41554159                    locations[0].directGPR(), locations[1].directGPR(),
     
    42094213       
    42104214        m_out.appendTo(slowPath, continuation);
     4215        VM& vm = this->vm();
    42114216        LValue callResult = lazySlowPath(
    4212             [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    4213                 return createLazyCallGenerator(
     4217            [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     4218                return createLazyCallGenerator(vm,
    42144219                    operationCreateDirectArguments, locations[0].directGPR(),
    42154220                    CCallHelpers::TrustedImmPtr(structure.get()), locations[1].directGPR(),
     
    48214826            LValue storageValue = m_out.phi(pointerType(), noStorage, haveStorage);
    48224827
     4828            VM& vm = this->vm();
    48234829            LValue slowResultValue = lazySlowPath(
    4824                 [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    4825                     return createLazyCallGenerator(
     4830                [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     4831                    return createLazyCallGenerator(vm,
    48264832                        operationNewTypedArrayWithSizeForType(type), locations[0].directGPR(),
    48274833                        CCallHelpers::TrustedImmPtr(structure.get()), locations[1].directGPR(),
     
    50845090        m_out.appendTo(slowPath, continuation);
    50855091        LValue slowResultValue;
     5092        VM& vm = this->vm();
    50865093        switch (numKids) {
    50875094        case 2:
    50885095            slowResultValue = lazySlowPath(
    5089                 [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    5090                     return createLazyCallGenerator(
     5096                [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     5097                    return createLazyCallGenerator(vm,
    50915098                        operationMakeRope2, locations[0].directGPR(), locations[1].directGPR(),
    50925099                        locations[2].directGPR());
     
    50955102        case 3:
    50965103            slowResultValue = lazySlowPath(
    5097                 [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    5098                     return createLazyCallGenerator(
     5104                [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     5105                    return createLazyCallGenerator(vm,
    50995106                        operationMakeRope3, locations[0].directGPR(), locations[1].directGPR(),
    51005107                        locations[2].directGPR(), locations[3].directGPR());
     
    55135520        LBasicBlock lastNext = m_out.appendTo(isNotInvalidated, continuation);
    55145521
     5522        VM& vm = this->vm();
    55155523        lazySlowPath(
    5516             [=] (const Vector<Location>&) -> RefPtr<LazySlowPath::Generator> {
    5517                 return createLazyCallGenerator(
     5524            [=, &vm] (const Vector<Location>&) -> RefPtr<LazySlowPath::Generator> {
     5525                return createLazyCallGenerator(vm,
    55185526                    operationNotifyWrite, InvalidGPRReg, CCallHelpers::TrustedImmPtr(set));
    55195527            });
     
    64496457                    jit.move(CCallHelpers::TrustedImmPtr(callee), GPRInfo::nonPreservedNonArgumentGPR);
    64506458                    jit.call(GPRInfo::nonPreservedNonArgumentGPR);
    6451                     exceptions->append(jit.emitExceptionCheck(AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
     6459                    exceptions->append(jit.emitExceptionCheck(state->vm(), AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
    64526460                };
    64536461
     
    67566764                    jit.move(CCallHelpers::TrustedImmPtr(callee), GPRInfo::nonPreservedNonArgumentGPR);
    67576765                    jit.call(GPRInfo::nonPreservedNonArgumentGPR);
    6758                     exceptions->append(jit.emitExceptionCheck(AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
     6766                    exceptions->append(jit.emitExceptionCheck(state->vm(), AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
    67596767                };
    67606768
     
    67726780
    67736781                    // emitSetupVarargsFrameFastCase modifies the stack pointer if it succeeds.
    6774                     emitSetupVarargsFrameFastCase(jit, scratchGPR2, scratchGPR1, scratchGPR2, scratchGPR3, inlineCallFrame, data->firstVarArgOffset, slowCase);
     6782                    emitSetupVarargsFrameFastCase(state->vm(), jit, scratchGPR2, scratchGPR1, scratchGPR2, scratchGPR3, inlineCallFrame, data->firstVarArgOffset, slowCase);
    67756783
    67766784                    CCallHelpers::Jump done = jit.jump();
     
    69436951                jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(operationCallEval)), GPRInfo::nonPreservedNonArgumentGPR);
    69446952                jit.call(GPRInfo::nonPreservedNonArgumentGPR);
    6945                 exceptions->append(jit.emitExceptionCheck(AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
     6953                exceptions->append(jit.emitExceptionCheck(state->vm(), AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
    69466954               
    69476955                CCallHelpers::Jump done = jit.branchTest64(CCallHelpers::NonZero, GPRInfo::returnValueGPR);
     
    79867994       
    79877995        m_out.appendTo(slowPath, notCellCase);
     7996        VM& vm = this->vm();
    79887997        LValue slowResultValue = lazySlowPath(
    7989             [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    7990                 return createLazyCallGenerator(
     7998            [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     7999                return createLazyCallGenerator(vm,
    79918000                    operationObjectIsObject, locations[0].directGPR(),
    79928001                    CCallHelpers::TrustedImmPtr(globalObject), locations[1].directGPR());
     
    80368045       
    80378046        m_out.appendTo(slowPath, continuation);
     8047        VM& vm = this->vm();
    80388048        LValue slowResultValue = lazySlowPath(
    8039             [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    8040                 return createLazyCallGenerator(
     8049            [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     8050                return createLazyCallGenerator(vm,
    80418051                    operationObjectIsFunction, locations[0].directGPR(),
    80428052                    CCallHelpers::TrustedImmPtr(globalObject), locations[1].directGPR());
     
    87808790                LValue butterflyValue = m_out.phi(pointerType(), noButterfly, haveButterfly);
    87818791
     8792                VM& vm = this->vm();
    87828793                LValue slowObjectValue;
    87838794                if (hasIndexingHeader) {
    87848795                    slowObjectValue = lazySlowPath(
    8785                         [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    8786                             return createLazyCallGenerator(
     8796                        [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     8797                            return createLazyCallGenerator(vm,
    87878798                                operationNewObjectWithButterflyWithIndexingHeaderAndVectorLength,
    87888799                                locations[0].directGPR(), CCallHelpers::TrustedImmPtr(structure.get()),
     
    87928803                } else {
    87938804                    slowObjectValue = lazySlowPath(
    8794                         [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    8795                             return createLazyCallGenerator(
     8805                        [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     8806                            return createLazyCallGenerator(vm,
    87968807                                operationNewObjectWithButterfly, locations[0].directGPR(),
    87978808                                CCallHelpers::TrustedImmPtr(structure.get()), locations[1].directGPR());
     
    89919002        // FIXME: It may be worth creating an operation that calls a constructor on JSLexicalEnvironment that
    89929003        // doesn't initialize every slot because we are guaranteed to do that here.
     9004        VM& vm = this->vm();
    89939005        LValue callResult = lazySlowPath(
    8994             [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    8995                 return createLazyCallGenerator(
     9006            [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     9007                return createLazyCallGenerator(vm,
    89969008                    operationCreateActivationDirect, locations[0].directGPR(),
    89979009                    CCallHelpers::TrustedImmPtr(structure.get()), locations[1].directGPR(),
     
    90469058        LBasicBlock lastNext = m_out.appendTo(needTrapHandling, continuation);
    90479059
     9060        VM& vm = this->vm();
    90489061        lazySlowPath(
    9049             [=] (const Vector<Location>&) -> RefPtr<LazySlowPath::Generator> {
    9050                 return createLazyCallGenerator(operationHandleTraps, InvalidGPRReg);
     9062            [=, &vm] (const Vector<Location>&) -> RefPtr<LazySlowPath::Generator> {
     9063                return createLazyCallGenerator(vm, operationHandleTraps, InvalidGPRReg);
    90519064            });
    90529065        m_out.jump(continuation);
     
    97139726       
    97149727        LValue slowButterflyValue;
     9728        VM& vm = this->vm();
    97159729        if (sizeInValues == initialOutOfLineCapacity) {
    97169730            slowButterflyValue = lazySlowPath(
    9717                 [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    9718                     return createLazyCallGenerator(
     9731                [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     9732                    return createLazyCallGenerator(vm,
    97199733                        operationAllocateSimplePropertyStorageWithInitialCapacity,
    97209734                        locations[0].directGPR());
     
    97229736        } else {
    97239737            slowButterflyValue = lazySlowPath(
    9724                 [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    9725                     return createLazyCallGenerator(
     9738                [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     9739                    return createLazyCallGenerator(vm,
    97269740                        operationAllocateSimplePropertyStorage, locations[0].directGPR(),
    97279741                        CCallHelpers::TrustedImmPtr(sizeInValues));
     
    1080210816        m_out.appendTo(slowPath, continuation);
    1080310817
     10818        VM& vm = this->vm();
    1080410819        LValue slowResultValue = lazySlowPath(
    10805             [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    10806                 return createLazyCallGenerator(
     10820            [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     10821                return createLazyCallGenerator(vm,
    1080710822                    operationNewObject, locations[0].directGPR(),
    1080810823                    CCallHelpers::TrustedImmPtr(structure.get()));
     
    1092010935        LValue butterflyValue = m_out.phi(pointerType(), noButterfly, haveButterfly);
    1092110936
     10937        VM& vm = this->vm();
    1092210938        LValue slowResultValue = lazySlowPath(
    10923             [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    10924                 return createLazyCallGenerator(
     10939            [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     10940                return createLazyCallGenerator(vm,
    1092510941                    operationNewArrayWithSize, locations[0].directGPR(),
    1092610942                    locations[1].directGPR(), locations[2].directGPR(), locations[3].directGPR());
     
    1166811684       
    1166911685        m_out.appendTo(slowPath, unreachable);
     11686        VM& vm = this->vm();
    1167011687        LValue result = lazySlowPath(
    11671             [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
    11672                 return createLazyCallGenerator(
     11688            [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     11689                return createLazyCallGenerator(vm,
    1167311690                    operationTypeOfObjectAsTypeofType, locations[0].directGPR(),
    1167411691                    CCallHelpers::TrustedImmPtr(globalObject), locations[1].directGPR());
  • trunk/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp

    r214069 r214531  
    182182    static_assert(MacroAssembler::framePointerRegister == GPRInfo::callFrameRegister, "MacroAssembler::framePointerRegister and GPRInfo::callFrameRegister must be the same");
    183183
    184     CCallHelpers jit(vm, codeBlock);
     184    CCallHelpers jit(codeBlock);
    185185
    186186    // The first thing we need to do is restablish our frame in the case of an exception.
    187187    if (exit.isGenericUnwindHandler()) {
    188188        RELEASE_ASSERT(vm->callFrameForCatch); // The first time we hit this exit, like at all other times, this field should be non-null.
    189         jit.restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer();
     189        jit.restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer(*vm);
    190190        jit.loadPtr(vm->addressOfCallFrameForCatch(), MacroAssembler::framePointerRegister);
    191191        jit.addPtr(CCallHelpers::TrustedImm32(codeBlock->stackPointerOffset() * sizeof(Register)),
     
    490490    handleExitCounts(jit, exit);
    491491    reifyInlinedCallFrames(jit, exit);
    492     adjustAndJumpToTarget(jit, exit);
     492    adjustAndJumpToTarget(*vm, jit, exit);
    493493   
    494494    LinkBuffer patchBuffer(*vm, jit, codeBlock);
  • trunk/Source/JavaScriptCore/ftl/FTLSlowPathCall.h

    r206525 r214531  
    3030#include "CCallHelpers.h"
    3131#include "FTLSlowPathCallKey.h"
    32 #include "JITOperations.h"
     32#include "FTLState.h"
    3333
    3434namespace JSC { namespace FTL {
    35 
    36 class State;
    3735
    3836class SlowPathCall {
     
    8078template<typename... ArgumentTypes>
    8179SlowPathCall callOperation(
    82     const RegisterSet& usedRegisters, CCallHelpers& jit, CCallHelpers::JumpList* exceptionTarget,
     80    VM& vm, const RegisterSet& usedRegisters, CCallHelpers& jit, CCallHelpers::JumpList* exceptionTarget,
    8381    FunctionPtr function, GPRReg resultGPR, ArgumentTypes... arguments)
    8482{
     
    9088    }
    9189    if (exceptionTarget)
    92         exceptionTarget->append(jit.emitExceptionCheck());
     90        exceptionTarget->append(jit.emitExceptionCheck(vm));
    9391    return call;
    9492}
     
    9694template<typename... ArgumentTypes>
    9795SlowPathCall callOperation(
    98     const RegisterSet& usedRegisters, CCallHelpers& jit, CallSiteIndex callSiteIndex,
     96    VM& vm, const RegisterSet& usedRegisters, CCallHelpers& jit, CallSiteIndex callSiteIndex,
    9997    CCallHelpers::JumpList* exceptionTarget, FunctionPtr function, GPRReg resultGPR,
    10098    ArgumentTypes... arguments)
     
    105103            CCallHelpers::tagFor(CallFrameSlot::argumentCount));
    106104    }
    107     return callOperation(usedRegisters, jit, exceptionTarget, function, resultGPR, arguments...);
     105    return callOperation(vm, usedRegisters, jit, exceptionTarget, function, resultGPR, arguments...);
    108106}
    109107
     
    116114{
    117115    return callOperation(
    118         usedRegisters, jit, callSiteIndexForCodeOrigin(state, codeOrigin), exceptionTarget, function,
     116        state.vm(), usedRegisters, jit, callSiteIndexForCodeOrigin(state, codeOrigin), exceptionTarget, function,
    119117        result, arguments...);
    120118}
  • trunk/Source/JavaScriptCore/ftl/FTLState.h

    r206525 r214531  
    6565    State(DFG::Graph& graph);
    6666    ~State();
     67
     68    VM& vm() { return graph.m_vm; }
    6769   
    6870    // None of these things is owned by State. It is the responsibility of
  • trunk/Source/JavaScriptCore/ftl/FTLThunks.cpp

    r193485 r214531  
    5050    VM* vm, FunctionPtr generationFunction, const char* name, unsigned extraPopsToRestore, FrameAndStackAdjustmentRequirement frameAndStackAdjustmentRequirement)
    5151{
    52     AssemblyHelpers jit(vm, 0);
     52    AssemblyHelpers jit(nullptr);
    5353
    5454    if (frameAndStackAdjustmentRequirement == FrameAndStackAdjustmentRequirement::Needed) {
     
    167167MacroAssemblerCodeRef slowPathCallThunkGenerator(VM& vm, const SlowPathCallKey& key)
    168168{
    169     AssemblyHelpers jit(&vm, 0);
     169    AssemblyHelpers jit(nullptr);
    170170   
    171171    // We want to save the given registers at the given offset, then we want to save the
Note: See TracChangeset for help on using the changeset viewer.