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

Unified Diff: src/compiler/scheduler.cc

Issue 681263004: Run ControlReducer early after graph building, then again later. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments. Created 6 years, 2 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 | « src/compiler/pipeline.cc ('k') | test/cctest/compiler/test-scheduler.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 d9e67ee20a875e24f75d8f6972bc646a863e4ca7..274447e59f13d6bea7a636a9df2b800a8bac7856 100644
--- a/src/compiler/scheduler.cc
+++ b/src/compiler/scheduler.cc
@@ -241,9 +241,7 @@ class CFGBuilder {
// backwards from end through control edges, building and connecting the
// basic blocks for control nodes.
void Run() {
- Graph* graph = scheduler_->graph_;
- FixNode(schedule_->start(), graph->start());
- Queue(graph->end());
+ Queue(scheduler_->graph_->end());
while (!queue_.empty()) { // Breadth-first backwards traversal.
Node* node = queue_.front();
@@ -258,7 +256,7 @@ class CFGBuilder {
ConnectBlocks(*i); // Connect block to its predecessor/successors.
}
- FixNode(schedule_->end(), graph->end());
+ FixNode(schedule_->end(), scheduler_->graph_->end());
Michael Starzinger 2014/10/29 15:23:21 nit: Can we fix the end node in BuildBlocks as wel
titzer 2014/10/29 15:24:04 Done.
}
// Run the control flow graph construction for a minimal control-connected
@@ -293,7 +291,6 @@ class CFGBuilder {
private:
void FixNode(BasicBlock* block, Node* node) {
schedule_->AddNode(block, node);
- scheduler_->GetData(node)->is_connected_control_ = true;
scheduler_->UpdatePlacement(node, Scheduler::kFixed);
}
@@ -301,21 +298,30 @@ class CFGBuilder {
// Mark the connected control nodes as they queued.
Scheduler::SchedulerData* data = scheduler_->GetData(node);
if (!data->is_connected_control_) {
+ data->is_connected_control_ = true;
BuildBlocks(node);
queue_.push(node);
control_.push_back(node);
- data->is_connected_control_ = true;
}
}
void BuildBlocks(Node* node) {
switch (node->opcode()) {
+ case IrOpcode::kStart:
+ FixNode(schedule_->start(), node);
+ break;
case IrOpcode::kLoop:
case IrOpcode::kMerge:
- case IrOpcode::kTerminate:
BuildBlockForNode(node);
break;
+ case IrOpcode::kTerminate: {
+ // Put Terminate in the loop to which it refers.
+ Node* loop = NodeProperties::GetControlInput(node);
+ BasicBlock* block = BuildBlockForNode(loop);
+ FixNode(block, node);
+ break;
+ }
case IrOpcode::kBranch:
BuildBlocksForSuccessors(node, IrOpcode::kIfTrue, IrOpcode::kIfFalse);
break;
@@ -343,13 +349,15 @@ class CFGBuilder {
}
}
- void BuildBlockForNode(Node* node) {
- if (schedule_->block(node) == NULL) {
- BasicBlock* block = schedule_->NewBasicBlock();
+ BasicBlock* BuildBlockForNode(Node* node) {
+ BasicBlock* block = schedule_->block(node);
+ if (block == NULL) {
+ block = schedule_->NewBasicBlock();
Trace("Create block B%d for #%d:%s\n", block->id().ToInt(), node->id(),
node->op()->mnemonic());
FixNode(block, node);
}
+ return block;
}
void BuildBlocksForSuccessors(Node* node, IrOpcode::Value a,
« no previous file with comments | « src/compiler/pipeline.cc ('k') | test/cctest/compiler/test-scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698