OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/scheduler.h" | 5 #include "src/compiler/scheduler.h" |
6 | 6 |
7 #include "src/bit-vector.h" | 7 #include "src/bit-vector.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/control-equivalence.h" | 9 #include "src/compiler/control-equivalence.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 special_rpo_->ComputeSpecialRPO(); | 1067 special_rpo_->ComputeSpecialRPO(); |
1068 } | 1068 } |
1069 | 1069 |
1070 | 1070 |
1071 void Scheduler::PropagateImmediateDominators(BasicBlock* block) { | 1071 void Scheduler::PropagateImmediateDominators(BasicBlock* block) { |
1072 for (/*nop*/; block != NULL; block = block->rpo_next()) { | 1072 for (/*nop*/; block != NULL; block = block->rpo_next()) { |
1073 auto pred = block->predecessors().begin(); | 1073 auto pred = block->predecessors().begin(); |
1074 auto end = block->predecessors().end(); | 1074 auto end = block->predecessors().end(); |
1075 DCHECK(pred != end); // All blocks except start have predecessors. | 1075 DCHECK(pred != end); // All blocks except start have predecessors. |
1076 BasicBlock* dominator = *pred; | 1076 BasicBlock* dominator = *pred; |
| 1077 bool deferred = dominator->deferred(); |
1077 // For multiple predecessors, walk up the dominator tree until a common | 1078 // For multiple predecessors, walk up the dominator tree until a common |
1078 // dominator is found. Visitation order guarantees that all predecessors | 1079 // dominator is found. Visitation order guarantees that all predecessors |
1079 // except for backwards edges have been visited. | 1080 // except for backwards edges have been visited. |
1080 for (++pred; pred != end; ++pred) { | 1081 for (++pred; pred != end; ++pred) { |
1081 // Don't examine backwards edges. | 1082 // Don't examine backwards edges. |
1082 if ((*pred)->dominator_depth() < 0) continue; | 1083 if ((*pred)->dominator_depth() < 0) continue; |
1083 dominator = BasicBlock::GetCommonDominator(dominator, *pred); | 1084 dominator = BasicBlock::GetCommonDominator(dominator, *pred); |
| 1085 deferred = deferred & (*pred)->deferred(); |
1084 } | 1086 } |
1085 block->set_dominator(dominator); | 1087 block->set_dominator(dominator); |
1086 block->set_dominator_depth(dominator->dominator_depth() + 1); | 1088 block->set_dominator_depth(dominator->dominator_depth() + 1); |
1087 // Propagate "deferredness" of the dominator. | 1089 block->set_deferred(deferred | block->deferred()); |
1088 if (dominator->deferred()) block->set_deferred(true); | |
1089 Trace("Block B%d's idom is B%d, depth = %d\n", block->id().ToInt(), | 1090 Trace("Block B%d's idom is B%d, depth = %d\n", block->id().ToInt(), |
1090 dominator->id().ToInt(), block->dominator_depth()); | 1091 dominator->id().ToInt(), block->dominator_depth()); |
1091 } | 1092 } |
1092 } | 1093 } |
1093 | 1094 |
1094 | 1095 |
1095 void Scheduler::GenerateImmediateDominatorTree() { | 1096 void Scheduler::GenerateImmediateDominatorTree() { |
1096 Trace("--- IMMEDIATE BLOCK DOMINATORS -----------------------------\n"); | 1097 Trace("--- IMMEDIATE BLOCK DOMINATORS -----------------------------\n"); |
1097 | 1098 |
1098 // Seed start block to be the first dominator. | 1099 // Seed start block to be the first dominator. |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1660 for (Node* const node : *nodes) { | 1661 for (Node* const node : *nodes) { |
1661 schedule_->SetBlockForNode(to, node); | 1662 schedule_->SetBlockForNode(to, node); |
1662 scheduled_nodes_[to->id().ToSize()].push_back(node); | 1663 scheduled_nodes_[to->id().ToSize()].push_back(node); |
1663 } | 1664 } |
1664 nodes->clear(); | 1665 nodes->clear(); |
1665 } | 1666 } |
1666 | 1667 |
1667 } // namespace compiler | 1668 } // namespace compiler |
1668 } // namespace internal | 1669 } // namespace internal |
1669 } // namespace v8 | 1670 } // namespace v8 |
OLD | NEW |