[turbofan] Remove use of generic algorithm from Scheduler.

R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/882103002

Cr-Commit-Position: refs/heads/master@{#26319}
This commit is contained in:
titzer 2015-01-29 01:56:42 -08:00 committed by Commit bot
parent f5479ca675
commit fca95cf753
2 changed files with 23 additions and 5 deletions

View File

@ -8,10 +8,10 @@
#include "src/compiler/common-operator.h"
#include "src/compiler/control-equivalence.h"
#include "src/compiler/graph.h"
#include "src/compiler/graph-inl.h"
#include "src/compiler/node.h"
#include "src/compiler/node-marker.h"
#include "src/compiler/node-properties.h"
#include "src/zone-containers.h"
namespace v8 {
namespace internal {
@ -1046,7 +1046,7 @@ void Scheduler::GenerateImmediateDominatorTree() {
// Phase 3: Prepare use counts for nodes.
class PrepareUsesVisitor : public NullNodeVisitor {
class PrepareUsesVisitor {
public:
explicit PrepareUsesVisitor(Scheduler* scheduler)
: scheduler_(scheduler), schedule_(scheduler->schedule_) {}
@ -1089,10 +1089,29 @@ class PrepareUsesVisitor : public NullNodeVisitor {
void Scheduler::PrepareUses() {
Trace("--- PREPARE USES -------------------------------------------\n");
// Count the uses of every node, it will be used to ensure that all of a
// Count the uses of every node, which is used to ensure that all of a
// node's uses are scheduled before the node itself.
PrepareUsesVisitor prepare_uses(this);
graph_->VisitNodeInputsFromEnd(&prepare_uses);
// TODO(turbofan): simplify the careful pre/post ordering here.
BoolVector visited(graph_->NodeCount(), false, zone_);
ZoneStack<Node::InputEdges::iterator> stack(zone_);
Node* node = graph_->end();
prepare_uses.Pre(node);
visited[node->id()] = true;
stack.push(node->input_edges().begin());
while (!stack.empty()) {
Edge edge = *stack.top();
Node* node = edge.to();
if (visited[node->id()]) {
prepare_uses.PostEdge(edge.from(), edge.index(), edge.to());
if (++stack.top() == edge.from()->input_edges().end()) stack.pop();
} else {
prepare_uses.Pre(node);
visited[node->id()] = true;
if (node->InputCount() > 0) stack.push(node->input_edges().begin());
}
}
}

View File

@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "src/bootstrapper.h"
#include "src/compiler/graph-inl.h"
#include "src/compiler/graph-reducer.h"
#include "src/compiler/js-operator.h"
#include "src/compiler/node.h"