Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Unified Diff: src/compiler/scheduler.cc

Issue 882103002: [turbofan] Remove use of generic algorithm from Scheduler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/typer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/scheduler.cc
diff --git a/src/compiler/scheduler.cc b/src/compiler/scheduler.cc
index abf6f9cd1f3afa5430f383bb948ce567bf5ecde4..f512cd243384227a3da65c1269cfee7ea35f598f 100644
--- a/src/compiler/scheduler.cc
+++ b/src/compiler/scheduler.cc
@@ -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());
+ }
+ }
}
« no previous file with comments | « no previous file | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698