Ignore:
Timestamp:
May 5, 2009, 4:34:23 AM (16 years ago)
Author:
[email protected]
Message:

Bug 25559: Improve native function call performance
<https://bugs.webkit.org/show_bug.cgi?id=25559>

Reviewed by Gavin Barraclough

In order to cache calls to native functions we now make the standard
prototype functions use a small assembly thunk that converts the JS
calling convention into the native calling convention. As this is
only beneficial in the JIT we use the NativeFunctionWrapper typedef
to alternate between PrototypeFunction and JSFunction to keep the
code sane. This change from PrototypeFunction to NativeFunctionWrapper
is the bulk of this patch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/parser/Nodes.cpp

    r43156 r43220  
    26862686FunctionBodyNode::FunctionBodyNode(JSGlobalData* globalData)
    26872687    : ScopeNode(globalData)
     2688#if ENABLE(JIT)
     2689    , m_jitCode(0)
     2690#endif
    26882691    , m_parameters(0)
    26892692    , m_parameterCount(0)
     
    26942697FunctionBodyNode::FunctionBodyNode(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, const SourceCode& sourceCode, CodeFeatures features, int numConstants)
    26952698    : ScopeNode(globalData, sourceCode, children, varStack, funcStack, features, numConstants)
     2699#if ENABLE(JIT)
     2700    , m_jitCode(0)
     2701#endif
    26962702    , m_parameters(0)
    26972703    , m_parameterCount(0)
     
    27312737        m_code->mark();
    27322738}
     2739
     2740#if ENABLE(JIT)
     2741PassRefPtr<FunctionBodyNode> FunctionBodyNode::createNativeThunk(JSGlobalData* globalData)
     2742{
     2743    PassRefPtr<FunctionBodyNode> body = new FunctionBodyNode(globalData);
     2744    body->m_jitCode = globalData->jitStubs.ctiNativeCallThunk();
     2745    return body;
     2746}
     2747#endif
    27332748
    27342749FunctionBodyNode* FunctionBodyNode::create(JSGlobalData* globalData)
     
    27602775    destroyData();
    27612776}
     2777
     2778#if ENABLE(JIT)
     2779void FunctionBodyNode::generateJITCode(ScopeChainNode* scopeChainNode)
     2780{
     2781    bytecode(scopeChainNode);
     2782    ASSERT(m_code);
     2783    ASSERT(!m_code->jitCode());
     2784    JIT::compile(scopeChainNode->globalData, m_code.get());
     2785    ASSERT(m_code->jitCode());
     2786    m_jitCode = m_code->jitCode();
     2787}
     2788#endif
    27622789
    27632790CodeBlock& FunctionBodyNode::bytecodeForExceptionInfoReparse(ScopeChainNode* scopeChainNode, CodeBlock* codeBlockBeingRegeneratedFrom)
Note: See TracChangeset for help on using the changeset viewer.