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/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
638 // scheduled into. | 638 // scheduled into. |
639 int max = static_cast<int>(schedule_->rpo_order()->size()); | 639 int max = static_cast<int>(schedule_->rpo_order()->size()); |
640 for (int i = max - 1; i >= 0; i--) { | 640 for (int i = max - 1; i >= 0; i--) { |
641 BasicBlock* block = schedule_->rpo_order()->at(i); | 641 BasicBlock* block = schedule_->rpo_order()->at(i); |
642 // TODO(titzer): we place at most one floating control structure per | 642 // TODO(titzer): we place at most one floating control structure per |
643 // basic block because scheduling currently can interleave phis from | 643 // basic block because scheduling currently can interleave phis from |
644 // one subgraph with the merges from another subgraph. | 644 // one subgraph with the merges from another subgraph. |
645 bool one_placed = false; | 645 bool one_placed = false; |
646 for (int j = static_cast<int>(block->nodes_.size()) - 1; j >= 0; j--) { | 646 for (int j = static_cast<int>(block->nodes_.size()) - 1; j >= 0; j--) { |
647 Node* node = block->nodes_[j]; | 647 Node* node = block->nodes_[j]; |
648 SchedulerData* data = GetData(node); | 648 if (!one_placed && (NodeProperties::IsControl(node) || |
649 if (data->is_floating_control_ && !data->is_connected_control_ && | 649 OperatorProperties::HasControlInput(node->op()))) { |
650 !one_placed) { | 650 Node* ctl = NodeProperties::IsControl(node) |
651 Trace(" Floating control #%d:%s was scheduled in B%d\n", node->id(), | 651 ? node |
652 node->op()->mnemonic(), block->id()); | 652 : NodeProperties::GetControlInput(node); |
653 ConnectFloatingControlSubgraph(block, node); | 653 SchedulerData* data = GetData(ctl); |
654 one_placed = true; | 654 if (data->is_floating_control_ && !data->is_connected_control_) { |
655 Trace(" Floating control #%d:%s was scheduled in B%d\n", ctl->id(), | |
656 ctl->op()->mnemonic(), block->id()); | |
657 ConnectFloatingControlSubgraph(block, ctl); | |
658 one_placed = true; | |
titzer
2014/09/25 12:19:24
So this basically matches the first node that is e
sigurds
2014/09/26 11:35:24
This is a valid point, I added a unit test to expo
| |
659 } | |
655 } | 660 } |
656 } | 661 } |
657 } | 662 } |
658 | 663 |
659 return true; | 664 return true; |
660 } | 665 } |
661 | 666 |
662 | 667 |
663 void Scheduler::ConnectFloatingControlSubgraph(BasicBlock* block, Node* end) { | 668 void Scheduler::ConnectFloatingControlSubgraph(BasicBlock* block, Node* end) { |
664 Node* block_start = block->nodes_[0]; | 669 Node* block_start = block->nodes_[0]; |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1117 | 1122 |
1118 #if DEBUG | 1123 #if DEBUG |
1119 if (FLAG_trace_turbo_scheduler) PrintRPO(num_loops, loops, final_order); | 1124 if (FLAG_trace_turbo_scheduler) PrintRPO(num_loops, loops, final_order); |
1120 VerifySpecialRPO(num_loops, loops, final_order); | 1125 VerifySpecialRPO(num_loops, loops, final_order); |
1121 #endif | 1126 #endif |
1122 return final_order; | 1127 return final_order; |
1123 } | 1128 } |
1124 } | 1129 } |
1125 } | 1130 } |
1126 } // namespace v8::internal::compiler | 1131 } // namespace v8::internal::compiler |
OLD | NEW |