Ignore:
Timestamp:
Nov 30, 2015, 8:43:28 PM (10 years ago)
Author:
[email protected]
Message:

FTL lazy slow paths should work with B3
https://bugs.webkit.org/show_bug.cgi?id=151667

Reviewed by Geoffrey Garen.

This adds all of the glue necessary to make FTL::LazySlowPath work with B3. The B3 approach
allows us to put all of the code in FTL::LowerDFGToLLVM, instead of having supporting data
structures on the side and a bunch of complex code in FTLCompile.cpp.

  • b3/B3CheckSpecial.cpp:

(JSC::B3::CheckSpecial::generate):

  • b3/B3LowerToAir.cpp:

(JSC::B3::Air::LowerToAir::run):

  • b3/B3PatchpointSpecial.cpp:

(JSC::B3::PatchpointSpecial::generate):

  • b3/B3StackmapValue.h:
  • ftl/FTLJSTailCall.cpp:

(JSC::FTL::DFG::recoveryFor):
(JSC::FTL::JSTailCall::emit):

  • ftl/FTLLazySlowPath.cpp:

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

  • ftl/FTLLazySlowPath.h:

(JSC::FTL::LazySlowPath::createGenerator):
(JSC::FTL::LazySlowPath::patchableJump):
(JSC::FTL::LazySlowPath::done):
(JSC::FTL::LazySlowPath::patchpoint):
(JSC::FTL::LazySlowPath::usedRegisters):
(JSC::FTL::LazySlowPath::callSiteIndex):
(JSC::FTL::LazySlowPath::stub):

  • ftl/FTLLocation.cpp:

(JSC::FTL::Location::forValueRep):
(JSC::FTL::Location::forStackmaps):
(JSC::FTL::Location::dump):
(JSC::FTL::Location::isGPR):
(JSC::FTL::Location::gpr):
(JSC::FTL::Location::isFPR):
(JSC::FTL::Location::fpr):
(JSC::FTL::Location::restoreInto):

  • ftl/FTLLocation.h:

(JSC::FTL::Location::Location):
(JSC::FTL::Location::forRegister):
(JSC::FTL::Location::forIndirect):
(JSC::FTL::Location::forConstant):
(JSC::FTL::Location::kind):
(JSC::FTL::Location::hasReg):
(JSC::FTL::Location::reg):
(JSC::FTL::Location::hasOffset):
(JSC::FTL::Location::offset):
(JSC::FTL::Location::hash):
(JSC::FTL::Location::hasDwarfRegNum): Deleted.
(JSC::FTL::Location::dwarfRegNum): Deleted.
(JSC::FTL::Location::hasDwarfReg): Deleted.
(JSC::FTL::Location::dwarfReg): Deleted.

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::DFG::LowerDFGToLLVM::LowerDFGToLLVM):
(JSC::FTL::DFG::LowerDFGToLLVM::lazySlowPath):

  • jit/RegisterSet.cpp:

(JSC::RegisterSet::stubUnavailableRegisters):
(JSC::RegisterSet::macroScratchRegisters):
(JSC::RegisterSet::calleeSaveRegisters):

  • jit/RegisterSet.h:
File:
1 edited

Legend:

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

    r192525 r192856  
    3535
    3636LazySlowPath::LazySlowPath(
    37     CodeLocationLabel patchpoint, CodeLocationLabel exceptionTarget,
    38     const RegisterSet& usedRegisters, CallSiteIndex callSiteIndex, RefPtr<Generator> generator,
    39     GPRReg newZeroReg, ScratchRegisterAllocator scratchRegisterAllocator)
     37#if FTL_USES_B3
     38    CodeLocationJump patchableJump, CodeLocationLabel done,
     39#else // FTL_USES_B3
     40    CodeLocationLabel patchpoint,
     41#endif // FTL_USES_B3
     42    CodeLocationLabel exceptionTarget,
     43    const RegisterSet& usedRegisters, CallSiteIndex callSiteIndex, RefPtr<Generator> generator
     44#if !FTL_USES_B3
     45    , GPRReg newZeroReg, ScratchRegisterAllocator scratchRegisterAllocator
     46#endif // !FTL_USES_B3
     47    )
     48#if FTL_USES_B3
     49    : m_patchableJump(patchableJump)
     50    , m_done(done)
     51#else // FTL_USES_B3
    4052    : m_patchpoint(patchpoint)
     53#endif // FTL_USES_B3
    4154    , m_exceptionTarget(exceptionTarget)
    4255    , m_usedRegisters(usedRegisters)
    4356    , m_callSiteIndex(callSiteIndex)
    4457    , m_generator(generator)
     58#if !FTL_USES_B3
    4559    , m_newZeroValueRegister(newZeroReg)
    4660    , m_scratchRegisterAllocator(scratchRegisterAllocator)
     61#endif // !FTL_USES_B3
    4762{
    4863}
     
    6479    params.lazySlowPath = this;
    6580
     81#if !FTL_USES_B3
    6682    unsigned bytesSaved = m_scratchRegisterAllocator.preserveReusedRegistersByPushing(jit, ScratchRegisterAllocator::ExtraStackSpace::NoExtraSpace);
    6783    // This is needed because LLVM may create a stackmap location that is the register SP.
     
    7288    if (m_newZeroValueRegister != InvalidGPRReg)
    7389        jit.move(CCallHelpers::TrustedImm32(0), m_newZeroValueRegister);
     90#endif // !FTL_USES_B3
    7491
    7592    m_generator->run(jit, params);
    7693
     94#if !FTL_USES_B3
    7795    CCallHelpers::Label doneLabel;
    7896    CCallHelpers::Jump jumpToEndOfPatchpoint;
     
    82100        jumpToEndOfPatchpoint = jit.jump();
    83101    }
     102#endif // !FTL_USES_B3
    84103
    85104    LinkBuffer linkBuffer(vm, jit, codeBlock, JITCompilationMustSucceed);
     105#if FTL_USES_B3
     106    linkBuffer.link(params.doneJumps, m_done);
     107#else // FTL_USES_B3
    86108    if (bytesSaved) {
    87109        linkBuffer.link(params.doneJumps, linkBuffer.locationOf(doneLabel));
     
    89111    } else
    90112        linkBuffer.link(params.doneJumps, m_patchpoint.labelAtOffset(MacroAssembler::maxJumpReplacementSize()));
     113#endif // FTL_USES_B3
    91114    if (m_exceptionTarget)
    92115        linkBuffer.link(exceptionJumps, m_exceptionTarget);
    93116    m_stub = FINALIZE_CODE_FOR(codeBlock, linkBuffer, ("Lazy slow path call stub"));
    94117
     118#if FTL_USES_B3
     119    MacroAssembler::repatchJump(m_patchableJump, CodeLocationLabel(m_stub.code()));
     120#else // FTL_USES_B3
    95121    MacroAssembler::replaceWithJump(m_patchpoint, CodeLocationLabel(m_stub.code()));
     122#endif // FTL_USES_B3
    96123}
    97124
Note: See TracChangeset for help on using the changeset viewer.