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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 buffer[0] = schedule_->block(successors[0]); | 408 buffer[0] = schedule_->block(successors[0]); |
409 buffer[1] = schedule_->block(successors[1]); | 409 buffer[1] = schedule_->block(successors[1]); |
410 } | 410 } |
411 | 411 |
412 void ConnectBranch(Node* branch) { | 412 void ConnectBranch(Node* branch) { |
413 BasicBlock* successor_blocks[2]; | 413 BasicBlock* successor_blocks[2]; |
414 CollectSuccessorBlocks(branch, successor_blocks, IrOpcode::kIfTrue, | 414 CollectSuccessorBlocks(branch, successor_blocks, IrOpcode::kIfTrue, |
415 IrOpcode::kIfFalse); | 415 IrOpcode::kIfFalse); |
416 | 416 |
417 // Consider branch hints. | 417 // Consider branch hints. |
418 // TODO(turbofan): Propagate the deferred flag to all blocks dominated by | |
419 // this IfTrue/IfFalse later. | |
420 switch (BranchHintOf(branch->op())) { | 418 switch (BranchHintOf(branch->op())) { |
421 case BranchHint::kNone: | 419 case BranchHint::kNone: |
422 break; | 420 break; |
423 case BranchHint::kTrue: | 421 case BranchHint::kTrue: |
424 successor_blocks[1]->set_deferred(true); | 422 successor_blocks[1]->set_deferred(true); |
425 break; | 423 break; |
426 case BranchHint::kFalse: | 424 case BranchHint::kFalse: |
427 successor_blocks[0]->set_deferred(true); | 425 successor_blocks[0]->set_deferred(true); |
428 break; | 426 break; |
429 } | 427 } |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 // For multiple predecessors, walk up the dominator tree until a common | 1052 // For multiple predecessors, walk up the dominator tree until a common |
1055 // dominator is found. Visitation order guarantees that all predecessors | 1053 // dominator is found. Visitation order guarantees that all predecessors |
1056 // except for backwards edges have been visited. | 1054 // except for backwards edges have been visited. |
1057 for (++pred; pred != end; ++pred) { | 1055 for (++pred; pred != end; ++pred) { |
1058 // Don't examine backwards edges. | 1056 // Don't examine backwards edges. |
1059 if ((*pred)->dominator_depth() < 0) continue; | 1057 if ((*pred)->dominator_depth() < 0) continue; |
1060 dominator = GetCommonDominator(dominator, *pred); | 1058 dominator = GetCommonDominator(dominator, *pred); |
1061 } | 1059 } |
1062 current->set_dominator(dominator); | 1060 current->set_dominator(dominator); |
1063 current->set_dominator_depth(dominator->dominator_depth() + 1); | 1061 current->set_dominator_depth(dominator->dominator_depth() + 1); |
| 1062 // Propagate "deferredness" of the dominator. |
| 1063 if (dominator->deferred()) current->set_deferred(true); |
1064 Trace("Block B%d's idom is B%d, depth = %d\n", current->id().ToInt(), | 1064 Trace("Block B%d's idom is B%d, depth = %d\n", current->id().ToInt(), |
1065 dominator->id().ToInt(), current->dominator_depth()); | 1065 dominator->id().ToInt(), current->dominator_depth()); |
1066 } | 1066 } |
1067 } | 1067 } |
1068 | 1068 |
1069 | 1069 |
1070 // ----------------------------------------------------------------------------- | 1070 // ----------------------------------------------------------------------------- |
1071 // Phase 3: Prepare use counts for nodes. | 1071 // Phase 3: Prepare use counts for nodes. |
1072 | 1072 |
1073 | 1073 |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 for (NodeVectorIter i = nodes->begin(); i != nodes->end(); ++i) { | 1461 for (NodeVectorIter i = nodes->begin(); i != nodes->end(); ++i) { |
1462 schedule_->SetBlockForNode(to, *i); | 1462 schedule_->SetBlockForNode(to, *i); |
1463 scheduled_nodes_[to->id().ToSize()].push_back(*i); | 1463 scheduled_nodes_[to->id().ToSize()].push_back(*i); |
1464 } | 1464 } |
1465 nodes->clear(); | 1465 nodes->clear(); |
1466 } | 1466 } |
1467 | 1467 |
1468 } // namespace compiler | 1468 } // namespace compiler |
1469 } // namespace internal | 1469 } // namespace internal |
1470 } // namespace v8 | 1470 } // namespace v8 |
OLD | NEW |