summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-09-13 12:51:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 20:50:05 +0200
commitd441d6f39bb846989d95bcf5caf387b42414718d (patch)
treee367e64a75991c554930278175d403c072de6bb8 /Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp
parent0060b2994c07842f4c59de64b5e3e430525c4b90 (diff)
downloadqtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit. Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp')
-rw-r--r--Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp46
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();
}