Changeset 37670 in webkit for trunk/JavaScriptCore/VM/Machine.h


Ignore:
Timestamp:
Oct 17, 2008, 7:51:52 PM (17 years ago)
Author:
[email protected]
Message:

2008-10-17 Gavin Barraclough <[email protected]>

Optimize op_call by allowing call sites to be directly linked to callees.

For the hot path of op_call, CTI now generates a check (initially for an impossible
value), and the first time the call is executed we attempt to link the call directly
to the callee. WWe can currently only do so if the arity of the caller and callee
match. The (optimized) setup for the call on the hot path is linked directly to
the ctiCode for the callee, without indirection.


Two forms of the slow case of the call are generated, the first will be executed the
first time the call is reached. As well as this path attempting to link the call to
a callee, it also relinks the slow case to a second slow case, which will not continue
to attempt relinking the call. (This policy could be changed in future, but for not
this is intended to prevent thrashing).

If a callee that the caller has been linked to is garbage collected, then the link
in the caller's JIt code will be reset back to a value that cannot match - to prevent
any false positive matches.

~20% progression on deltablue & richards, >12% overall reduction in v8-tests
runtime, one or two percent progression on sunspider.

Reviewed by Oliver Hunt.

  • VM/CTI.cpp: (JSC::): (JSC::CTI::emitNakedCall): (JSC::unreachable): (JSC::CTI::compileOpCallInitializeCallFrame): (JSC::CTI::compileOpCallSetupArgs): (JSC::CTI::compileOpCall): (JSC::CTI::privateCompileMainPass): (JSC::CTI::privateCompileSlowCases): (JSC::CTI::privateCompile): (JSC::CTI::unlinkCall): (JSC::CTI::linkCall):
  • VM/CTI.h:
  • VM/CodeBlock.cpp: (JSC::CodeBlock::~CodeBlock): (JSC::CodeBlock::unlinkCallers): (JSC::CodeBlock::derefStructureIDs):
  • VM/CodeBlock.h: (JSC::StructureStubInfo::StructureStubInfo): (JSC::CallLinkInfo::CallLinkInfo): (JSC::CodeBlock::addCaller): (JSC::CodeBlock::removeCaller): (JSC::CodeBlock::getStubInfo):
  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::emitCall): (JSC::CodeGenerator::emitConstruct):
  • VM/Machine.cpp: (JSC::Machine::cti_op_call_profiler): (JSC::Machine::cti_op_call_JSFunction): (JSC::Machine::cti_vm_lazyLinkCall): (JSC::Machine::cti_op_construct_JSConstructFast): (JSC::Machine::cti_op_construct_JSConstruct): (JSC::Machine::cti_op_construct_NotJSConstruct):
  • VM/Machine.h:
  • kjs/JSFunction.cpp: (JSC::JSFunction::~JSFunction):
  • kjs/JSFunction.h:
  • kjs/nodes.h: (JSC::FunctionBodyNode::):
  • masm/X86Assembler.h: (JSC::X86Assembler::getDifferenceBetweenLabels):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/Machine.h

    r37647 r37670  
    189189        static void SFX_CALL cti_op_tear_off_activation(CTI_ARGS);
    190190        static void SFX_CALL cti_op_tear_off_arguments(CTI_ARGS);
    191         static void SFX_CALL cti_op_ret_profiler(CTI_ARGS);
    192191        static void SFX_CALL cti_op_ret_scopeChain(CTI_ARGS);
    193192        static JSValue* SFX_CALL cti_op_new_array(CTI_ARGS);
    194193        static JSValue* SFX_CALL cti_op_resolve(CTI_ARGS);
    195194        static JSValue* SFX_CALL cti_op_resolve_global(CTI_ARGS);
     195        static JSValue* SFX_CALL cti_op_construct_JSConstructFast(CTI_ARGS);
    196196        static VoidPtrPair SFX_CALL cti_op_construct_JSConstruct(CTI_ARGS);
    197197        static JSValue* SFX_CALL cti_op_construct_NotJSConstruct(CTI_ARGS);
     
    256256        static void SFX_CALL cti_op_debug(CTI_ARGS);
    257257
     258        static void SFX_CALL cti_op_call_profiler(CTI_ARGS);
     259        static void SFX_CALL cti_op_ret_profiler(CTI_ARGS);
     260
    258261        static void* SFX_CALL cti_vm_throw(CTI_ARGS);
    259262        static void* SFX_CALL cti_vm_compile(CTI_ARGS);
     263        static void* SFX_CALL cti_vm_lazyLinkCall(CTI_ARGS);
    260264        static JSValue* SFX_CALL cti_op_push_activation(CTI_ARGS);
    261265       
Note: See TracChangeset for help on using the changeset viewer.