diff options
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp')
| -rw-r--r-- | Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp b/Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp index eb3232e69..e390300a7 100644 --- a/Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp @@ -30,6 +30,7 @@ #include "DFGGraph.h" #include "DFGScoreBoard.h" +#include "JSCellInlines.h" namespace JSC { namespace DFG { @@ -47,7 +48,7 @@ public: m_graph.m_preservedVars.dump(WTF::dataFile()); dataLogF("\n"); #endif - ScoreBoard scoreBoard(m_graph, m_graph.m_preservedVars); + ScoreBoard scoreBoard(m_graph.m_preservedVars); scoreBoard.assertClear(); #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) bool needsNewLine = false; @@ -59,47 +60,56 @@ public: if (!block->isReachable) continue; for (size_t indexInBlock = 0; indexInBlock < block->size(); ++indexInBlock) { - NodeIndex nodeIndex = block->at(indexInBlock); + Node* node = block->at(indexInBlock); #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) if (needsNewLine) dataLogF("\n"); - dataLogF(" @%u:", nodeIndex); + dataLogF(" @%u:", node->index()); needsNewLine = true; #endif - Node& node = m_graph[nodeIndex]; - if (!node.shouldGenerate() || node.op() == Phi || node.op() == Flush) + if (!node->shouldGenerate()) continue; - if (node.op() == GetLocal) - ASSERT(!m_graph[node.child1()].hasResult()); + switch (node->op()) { + case Phi: + case Flush: + case PhantomLocal: + continue; + case GetLocal: + ASSERT(!node->child1()->hasResult()); + break; + default: + break; + } // First, call use on all of the current node's children, then // allocate a VirtualRegister for this node. We do so in this // order so that if a child is on its last use, and a // VirtualRegister is freed, then it may be reused for node. - if (node.flags() & NodeHasVarArgs) { - for (unsigned childIdx = node.firstChild(); childIdx < node.firstChild() + node.numChildren(); childIdx++) + if (node->flags() & NodeHasVarArgs) { + for (unsigned childIdx = node->firstChild(); childIdx < node->firstChild() + node->numChildren(); childIdx++) scoreBoard.useIfHasResult(m_graph.m_varArgChildren[childIdx]); } else { - scoreBoard.useIfHasResult(node.child1()); - scoreBoard.useIfHasResult(node.child2()); - scoreBoard.useIfHasResult(node.child3()); + scoreBoard.useIfHasResult(node->child1()); + scoreBoard.useIfHasResult(node->child2()); + scoreBoard.useIfHasResult(node->child3()); } - if (!node.hasResult()) + if (!node->hasResult()) continue; VirtualRegister virtualRegister = scoreBoard.allocate(); #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) - dataLogF(" Assigning virtual register %u to node %u.", - virtualRegister, nodeIndex); + dataLogF( + " Assigning virtual register %u to node %u.", + virtualRegister, node->index()); #endif - node.setVirtualRegister(virtualRegister); + node->setVirtualRegister(virtualRegister); // 'mustGenerate' nodes have their useCount artificially elevated, // call use now to account for this. - if (node.mustGenerate()) - scoreBoard.use(nodeIndex); + if (node->mustGenerate()) + scoreBoard.use(node); } scoreBoard.assertClear(); } |
