Ignore:
Timestamp:
Jul 29, 2016, 1:58:35 PM (9 years ago)
Author:
[email protected]
Message:

[JSC] Use the same data structures for DFG and Air Liveness Analysis
https://bugs.webkit.org/show_bug.cgi?id=160346

Reviewed by Geoffrey Garen.

In Air, we minimized memory accesses during liveness analysis
with a couple of tricks:
-Use a single Sparse Set ADT for the live value of each block.
-Manipulate compact positive indices instead of hashing values.

This patch brings the same ideas to DFG.

This patch still uses the same fixpoint algorithms.
The reason is Edge's KillStatus used by other phases. We cannot
use a block-boundary liveness algorithm and update KillStatus
simultaneously. It's something I'll probably revisit at some point.

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::AbstractInterpreter<AbstractStateType>::forAllValues):
(JSC::DFG::AbstractInterpreter<AbstractStateType>::dump):

  • dfg/DFGBasicBlock.h:
  • dfg/DFGGraph.h:

(JSC::DFG::Graph::maxNodeCount):
(JSC::DFG::Graph::nodeAt):

  • dfg/DFGInPlaceAbstractState.cpp:

(JSC::DFG::setLiveValues):
(JSC::DFG::InPlaceAbstractState::endBasicBlock):

  • dfg/DFGLivenessAnalysisPhase.cpp:

(JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase):
(JSC::DFG::LivenessAnalysisPhase::run):
(JSC::DFG::LivenessAnalysisPhase::processBlock):
(JSC::DFG::LivenessAnalysisPhase::addChildUse):
(JSC::DFG::LivenessAnalysisPhase::process): Deleted.

File:
1 edited

Legend:

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

    r200034 r203921  
    7575}
    7676
    77 static void setLiveValues(HashMap<Node*, AbstractValue>& values, HashSet<Node*>& live)
     77static void setLiveValues(HashMap<Node*, AbstractValue>& values, const Vector<Node*>& liveNodes)
    7878{
    7979    values.clear();
    80    
    81     HashSet<Node*>::iterator iter = live.begin();
    82     HashSet<Node*>::iterator end = live.end();
    83     for (; iter != end; ++iter)
    84         values.add(*iter, AbstractValue());
    85 }
    86 
    87 static void setLiveValues(Vector<BasicBlock::SSAData::NodeAbstractValuePair>& values, HashSet<Node*>& live)
     80    for (Node* node : liveNodes)
     81        values.add(node, AbstractValue());
     82}
     83
     84static void setLiveValues(Vector<BasicBlock::SSAData::NodeAbstractValuePair>& values, const Vector<Node*>& live)
    8885{
    8986    values.resize(0);
     
    204201            changed |= block->valuesAtTail[i].merge(m_variables[i]);
    205202
    206         HashSet<Node*>::iterator iter = block->ssa->liveAtTail.begin();
    207         HashSet<Node*>::iterator end = block->ssa->liveAtTail.end();
    208         for (; iter != end; ++iter) {
    209             Node* node = *iter;
     203        for (Node* node : block->ssa->liveAtTail) {
    210204            changed |= block->ssa->valuesAtTail.find(node)->value.merge(forNode(node));
    211205        }
Note: See TracChangeset for help on using the changeset viewer.