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 <deque> | 5 #include <deque> |
6 #include <queue> | 6 #include <queue> |
7 | 7 |
8 #include "src/compiler/scheduler.h" | 8 #include "src/compiler/scheduler.h" |
9 | 9 |
10 #include "src/bit-vector.h" | 10 #include "src/bit-vector.h" |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 | 1056 |
1057 | 1057 |
1058 void Scheduler::GenerateImmediateDominatorTree() { | 1058 void Scheduler::GenerateImmediateDominatorTree() { |
1059 Trace("--- IMMEDIATE BLOCK DOMINATORS -----------------------------\n"); | 1059 Trace("--- IMMEDIATE BLOCK DOMINATORS -----------------------------\n"); |
1060 | 1060 |
1061 // TODO(danno): Consider using Lengauer & Tarjan's if this becomes too slow. | 1061 // TODO(danno): Consider using Lengauer & Tarjan's if this becomes too slow. |
1062 | 1062 |
1063 // Build the block dominator tree. | 1063 // Build the block dominator tree. |
1064 schedule_->start()->set_dominator_depth(0); | 1064 schedule_->start()->set_dominator_depth(0); |
1065 typedef SpecialRPONumberer::BlockList BlockList; | 1065 typedef SpecialRPONumberer::BlockList BlockList; |
1066 for (BlockList* l = special_rpo_->order_; l != NULL; l = l->next) { | 1066 DCHECK_EQ(schedule_->start(), special_rpo_->order_->block); |
| 1067 for (BlockList* l = special_rpo_->order_->next; l != NULL; l = l->next) { |
1067 BasicBlock* current = l->block; | 1068 BasicBlock* current = l->block; |
1068 if (current == schedule_->start()) continue; | |
1069 BasicBlock::Predecessors::iterator pred = current->predecessors_begin(); | 1069 BasicBlock::Predecessors::iterator pred = current->predecessors_begin(); |
1070 BasicBlock::Predecessors::iterator end = current->predecessors_end(); | 1070 BasicBlock::Predecessors::iterator end = current->predecessors_end(); |
1071 DCHECK(pred != end); // All blocks except start have predecessors. | 1071 DCHECK(pred != end); // All blocks except start have predecessors. |
1072 BasicBlock* dominator = *pred; | 1072 BasicBlock* dominator = *pred; |
1073 // For multiple predecessors, walk up the dominator tree until a common | 1073 // For multiple predecessors, walk up the dominator tree until a common |
1074 // dominator is found. Visitation order guarantees that all predecessors | 1074 // dominator is found. Visitation order guarantees that all predecessors |
1075 // except for backwards edges have been visited. | 1075 // except for backwards edges have been visited. |
1076 for (++pred; pred != end; ++pred) { | 1076 for (++pred; pred != end; ++pred) { |
1077 // Don't examine backwards edges. | 1077 // Don't examine backwards edges. |
1078 if ((*pred)->dominator_depth() < 0) continue; | 1078 if ((*pred)->dominator_depth() < 0) continue; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 for (NodeVectorIter i = nodes->begin(); i != nodes->end(); ++i) { | 1503 for (NodeVectorIter i = nodes->begin(); i != nodes->end(); ++i) { |
1504 schedule_->SetBlockForNode(to, *i); | 1504 schedule_->SetBlockForNode(to, *i); |
1505 scheduled_nodes_[to->id().ToSize()].push_back(*i); | 1505 scheduled_nodes_[to->id().ToSize()].push_back(*i); |
1506 } | 1506 } |
1507 nodes->clear(); | 1507 nodes->clear(); |
1508 } | 1508 } |
1509 | 1509 |
1510 } // namespace compiler | 1510 } // namespace compiler |
1511 } // namespace internal | 1511 } // namespace internal |
1512 } // namespace v8 | 1512 } // namespace v8 |
OLD | NEW |