Ignore:
Timestamp:
Mar 16, 2017, 2:19:23 PM (8 years ago)
Author:
[email protected]
Message:

FTL should support global and eval code
https://bugs.webkit.org/show_bug.cgi?id=169656

Reviewed by Geoffrey Garen and Saam Barati.

JSTests:

Added basic performance tests of global and eval code. These tests will run a lot faster in with
the FTL because of the object allocation.

  • microbenchmarks/eval-code-ftl-reentry.js: Added.
  • microbenchmarks/eval-code-ftl.js: Added.
  • microbenchmarks/global-code-ftl.js: Added.
  • stress/arith-log-on-various-types.js: This was a flaky fail with concurrent JIT, so I stopped running it with concurrent JIT. The failure was its assertion about how many times something gets compiled.

Source/JavaScriptCore:

Turned off the restriction against global and eval code running in the FTL, and then fixed all of
the things that didn't work.

This is a big speed-up on microbenchmarks that I wrote for this patch. One of the reasons why we
hadn't done this earlier is that we've never seen a benchmark that needed it. Global and eval
code rarely gets FTL-hot. Still, this seems like possibly a small JetStream speed-up.

  • dfg/DFGJITCode.cpp:

(JSC::DFG::JITCode::setOSREntryBlock): I outlined this for better debugging.

  • dfg/DFGJITCode.h:

(JSC::DFG::JITCode::setOSREntryBlock): Deleted.

  • dfg/DFGNode.h:

(JSC::DFG::Node::isSemanticallySkippable): It turns out that global code often has InvalidationPoints before LoopHints. They are also skippable from the standpoint of OSR entrypoint analysis.

  • dfg/DFGOperations.cpp: Don't do any normal compiles of global code - just do OSR compiles.
  • ftl/FTLCapabilities.cpp: Enable FTL for global and eval code.

(JSC::FTL::canCompile):

  • ftl/FTLCompile.cpp: Just debugging clean-ups.

(JSC::FTL::compile):

  • ftl/FTLJITFinalizer.cpp: Implement finalize() and ensure that we only do things with the entrypoint buffer if we have one. We won't have one for eval code that we aren't OSR entering into.

(JSC::FTL::JITFinalizer::finalize):
(JSC::FTL::JITFinalizer::finalizeFunction):
(JSC::FTL::JITFinalizer::finalizeCommon):

  • ftl/FTLJITFinalizer.h:
  • ftl/FTLLink.cpp: When entering a function normally, we need the "entrypoint" to put the arity check code. Global and eval code don't need this.

(JSC::FTL::link):

  • ftl/FTLOSREntry.cpp: Fix a dataLog statement.

(JSC::FTL::prepareOSREntry):

  • ftl/FTLOSRExitCompiler.cpp: Remove dead code that happened to assert that we're exiting from a function.

(JSC::FTL::compileStub):

File:
1 edited

Legend:

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

    r208720 r214069  
    395395    }
    396396   
    397     jit.load32(CCallHelpers::payloadFor(CallFrameSlot::argumentCount), GPRInfo::regT2);
    398    
    399     // Let's say that the FTL function had failed its arity check. In that case, the stack will
    400     // contain some extra stuff.
    401     //
    402     // We compute the padded stack space:
    403     //
    404     //     paddedStackSpace = roundUp(codeBlock->numParameters - regT2 + 1)
    405     //
    406     // The stack will have regT2 + CallFrameHeaderSize stuff.
    407     // We want to make the stack look like this, from higher addresses down:
    408     //
    409     //     - argument padding
    410     //     - actual arguments
    411     //     - call frame header
    412 
    413     // This code assumes that we're dealing with FunctionCode.
    414     RELEASE_ASSERT(codeBlock->codeType() == FunctionCode);
    415    
    416     jit.add32(
    417         MacroAssembler::TrustedImm32(-codeBlock->numParameters()), GPRInfo::regT2,
    418         GPRInfo::regT3);
    419     MacroAssembler::Jump arityIntact = jit.branch32(
    420         MacroAssembler::GreaterThanOrEqual, GPRInfo::regT3, MacroAssembler::TrustedImm32(0));
    421     jit.neg32(GPRInfo::regT3);
    422     jit.add32(MacroAssembler::TrustedImm32(1 + stackAlignmentRegisters() - 1), GPRInfo::regT3);
    423     jit.and32(MacroAssembler::TrustedImm32(-stackAlignmentRegisters()), GPRInfo::regT3);
    424     jit.add32(GPRInfo::regT3, GPRInfo::regT2);
    425     arityIntact.link(&jit);
    426 
    427397    CodeBlock* baselineCodeBlock = jit.baselineCodeBlockFor(exit.m_codeOrigin);
    428398
Note: See TracChangeset for help on using the changeset viewer.