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

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: Fix the glitch. 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..f2e14255509328fc536cd59b609d4ce65ad019b7 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();
@@ -257,8 +255,6 @@ class CFGBuilder {
for (NodeVector::iterator i = control_.begin(); i != control_.end(); ++i) {
ConnectBlocks(*i); // Connect block to its predecessor/successors.
}
-
- FixNode(schedule_->end(), graph->end());
}
// Run the control flow graph construction for a minimal control-connected
@@ -293,29 +289,40 @@ 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);
}
void Queue(Node* node) {
- // Mark the connected control nodes as they queued.
+ // Mark the connected control nodes as they are 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::kEnd:
+ FixNode(schedule_->end(), node);
+ break;
+ 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 +350,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