Ignore:
Timestamp:
Feb 6, 2015, 1:39:04 PM (10 years ago)
Author:
[email protected]
Message:

It should be possible to use the DFG SetArgument node to indicate that someone set the value of a local out-of-band
https://bugs.webkit.org/show_bug.cgi?id=141337

Reviewed by Mark Lam.

This mainly involved ensuring that SetArgument behaves just like SetLocal from a CPS standpoint, but with a special case for those SetArguments that
are associated with the prologue.

  • dfg/DFGCPSRethreadingPhase.cpp:

(JSC::DFG::CPSRethreadingPhase::run):
(JSC::DFG::CPSRethreadingPhase::canonicalizeSet):
(JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock):
(JSC::DFG::CPSRethreadingPhase::specialCaseArguments):
(JSC::DFG::CPSRethreadingPhase::canonicalizeSetLocal): Deleted.
(JSC::DFG::CPSRethreadingPhase::canonicalizeSetArgument): Deleted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGCPSRethreadingPhase.cpp

    r179477 r179756  
    5555        m_graph.clearReplacements();
    5656        canonicalizeLocalsInBlocks();
     57        specialCaseArguments();
    5758        propagatePhis<LocalOperand>();
    5859        propagatePhis<ArgumentOperand>();
     
    234235    }
    235236   
    236     void canonicalizeSetLocal(Node* node)
    237     {
    238         m_block->variablesAtTail.setOperand(node->local(), node);
    239     }
    240    
    241237    template<NodeType nodeType, OperandKind operandKind>
    242238    void canonicalizeFlushOrPhantomLocalFor(Node* node, VariableAccessData* variable, size_t idx)
     
    299295    }
    300296   
    301     void canonicalizeSetArgument(Node* node)
    302     {
    303         VirtualRegister local = node->local();
    304         ASSERT(local.isArgument());
    305         int argument = local.toArgument();
    306         m_block->variablesAtHead.setArgumentFirstTime(argument, node);
    307         m_block->variablesAtTail.setArgumentFirstTime(argument, node);
     297    void canonicalizeSet(Node* node)
     298    {
     299        m_block->variablesAtTail.setOperand(node->local(), node);
    308300    }
    309301   
     
    370362               
    371363            case SetLocal:
    372                 canonicalizeSetLocal(node);
     364                canonicalizeSet(node);
    373365                break;
    374366               
     
    382374               
    383375            case SetArgument:
    384                 canonicalizeSetArgument(node);
     376                canonicalizeSet(node);
    385377                break;
    386378               
     
    403395            canonicalizeLocalsInBlock();
    404396        }
     397    }
     398   
     399    void specialCaseArguments()
     400    {
     401        // Normally, a SetArgument denotes the start of a live range for a local's value on the stack.
     402        // But those SetArguments used for the actual arguments to the machine CodeBlock get
     403        // special-cased. We could have instead used two different node types - one for the arguments
     404        // at the prologue case, and another for the other uses. But this seemed like IR overkill.
     405        for (unsigned i = m_graph.m_arguments.size(); i--;)
     406            m_graph.block(0)->variablesAtHead.setArgumentFirstTime(i, m_graph.m_arguments[i]);
    405407    }
    406408   
Note: See TracChangeset for help on using the changeset viewer.