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

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: 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
« src/compiler/ast-graph-builder.cc ('K') | « src/compiler/pipeline.cc ('k') | no next file » | 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 d1da320bd0d48dd23e299a2de1ff52a75f207d96..4b176f56c975dfe60205039e1e76f9305535ec92 100644
--- a/src/compiler/scheduler.cc
+++ b/src/compiler/scheduler.cc
@@ -239,9 +239,16 @@ class CFGBuilder {
switch (node->opcode()) {
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);
+ BuildBlockForNode(loop);
+ BasicBlock* block = schedule_->block(loop);
Michael Starzinger 2014/10/29 12:14:02 nit: This probably should use the return value of
titzer 2014/10/29 15:17:09 Done. While doing this I noticed a bug and had to
+ FixNode(block, node);
+ break;
+ }
case IrOpcode::kBranch:
BuildBlocksForSuccessors(node, IrOpcode::kIfTrue, IrOpcode::kIfFalse);
break;
@@ -269,13 +276,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,
« src/compiler/ast-graph-builder.cc ('K') | « src/compiler/pipeline.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698