Changeset 35230 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jul 17, 2008, 4:53:39 PM (17 years ago)
Author:
[email protected]
Message:

2008-07-17 Geoffrey Garen <[email protected]>

Reviewed by John Sullivan and Oliver Hunt.


A tiny bit of tidying in function call register allocation.


This patch saves one register when invoking a function expression and/or
a new expression that is stored in a temporary.


Since it's just one register, I can't make a testcase for it.

  • VM/CodeGenerator.cpp: (KJS::CodeGenerator::emitCall): No need to ref the function we're calling or its base. We'd like the call frame to overlap with them, if possible. op_call will read the function and its base before writing the call frame, so this is safe.
  • kjs/nodes.cpp: (KJS::NewExprNode::emitCode): No need to ref the function we're new-ing, for the same reasons stated above.


(KJS::FunctionCallValueNode::emitCode): ditto

Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r35229 r35230  
     12008-07-17  Geoffrey Garen  <[email protected]>
     2
     3        Reviewed by John Sullivan and Oliver Hunt.
     4       
     5        A tiny bit of tidying in function call register allocation.
     6       
     7        This patch saves one register when invoking a function expression and/or
     8        a new expression that is stored in a temporary.
     9       
     10        Since it's just one register, I can't make a testcase for it.
     11
     12        * VM/CodeGenerator.cpp:
     13        (KJS::CodeGenerator::emitCall): No need to ref the function we're calling
     14        or its base. We'd like the call frame to overlap with them, if possible.
     15        op_call will read the function and its base before writing the call frame,
     16        so this is safe.
     17
     18        * kjs/nodes.cpp:
     19        (KJS::NewExprNode::emitCode): No need to ref the function we're new-ing,
     20        for the same reasons stated above.
     21       
     22        (KJS::FunctionCallValueNode::emitCode): ditto
     23
    1242008-07-17  Steve Falkenburg  <[email protected]>
    225
  • trunk/JavaScriptCore/VM/CodeGenerator.cpp

    r35037 r35230  
    863863{
    864864    ASSERT(opcodeID == op_call || opcodeID == op_call_eval);
    865 
    866     RefPtr<RegisterID> refFunc = func;
    867     RefPtr<RegisterID> refBase = base;
     865   
     866    // Ordinarily, we might ref "func" and "base", to avoid allocating new
     867    // temporaries in the same registers. In this case, though, we actually
     868    // want the call frame we allocate to overlap "func" and "base", if they're
     869    // not otherwise referenced. op_call will read "func" and "base" before
     870    // writing out the call frame, so this is safe.
    868871
    869872    // Reserve space for call frame.
     
    898901RegisterID* CodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode* argumentsNode)
    899902{
     903    // Ordinarily, we might ref "func", to avoid allocating a new temporary in
     904    // the same register. In this case, though, we actually want the call
     905    // frame we allocate to overlap "func", if it's not otherwise referenced.
     906    // op_construct will read "func" before writing out the call frame, so this
     907    // is safe.
     908
    900909    // Reserve space for call frame.
    901910    Vector<RefPtr<RegisterID>, RegisterFile::CallFrameHeaderSize> callFrame;
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r35226 r35230  
    400400RegisterID* NewExprNode::emitCode(CodeGenerator& generator, RegisterID* dst)
    401401{
    402     RefPtr<RegisterID> r0 = generator.emitNode(m_expr.get());
    403     return generator.emitConstruct(generator.finalDestination(dst), r0.get(), m_args.get());
     402    RegisterID* r0 = generator.emitNode(m_expr.get());
     403    return generator.emitConstruct(generator.finalDestination(dst), r0, m_args.get());
    404404}
    405405
     
    414414RegisterID* FunctionCallValueNode::emitCode(CodeGenerator& generator, RegisterID* dst)
    415415{
    416     RefPtr<RegisterID> func = generator.emitNode(m_expr.get());
    417     return generator.emitCall(generator.finalDestination(dst), func.get(), 0, m_args.get());
     416    RegisterID* func = generator.emitNode(m_expr.get());
     417    return generator.emitCall(generator.finalDestination(dst), func, 0, m_args.get());
    418418}
    419419
Note: See TracChangeset for help on using the changeset viewer.