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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.