| 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 if (!has_floating_control_) return false; | 631 if (!has_floating_control_) return false; |
| 632 | 632 |
| 633 Trace("Connecting floating control...\n"); | 633 Trace("Connecting floating control...\n"); |
| 634 | 634 |
| 635 // Process blocks and instructions backwards to find and connect floating | 635 // Process blocks and instructions backwards to find and connect floating |
| 636 // control nodes into the control graph according to the block they were | 636 // control nodes into the control graph according to the block they were |
| 637 // scheduled into. | 637 // scheduled into. |
| 638 int max = static_cast<int>(schedule_->rpo_order()->size()); | 638 int max = static_cast<int>(schedule_->rpo_order()->size()); |
| 639 for (int i = max - 1; i >= 0; i--) { | 639 for (int i = max - 1; i >= 0; i--) { |
| 640 BasicBlock* block = schedule_->rpo_order()->at(i); | 640 BasicBlock* block = schedule_->rpo_order()->at(i); |
| 641 // TODO(titzer): we place at most one floating control structure per |
| 642 // basic block because scheduling currently can interleave phis from |
| 643 // one subgraph with the merges from another subgraph. |
| 644 bool one_placed = false; |
| 641 for (int j = static_cast<int>(block->nodes_.size()) - 1; j >= 0; j--) { | 645 for (int j = static_cast<int>(block->nodes_.size()) - 1; j >= 0; j--) { |
| 642 Node* node = block->nodes_[j]; | 646 Node* node = block->nodes_[j]; |
| 643 SchedulerData* data = GetData(node); | 647 SchedulerData* data = GetData(node); |
| 644 if (data->is_floating_control_ && !data->is_connected_control_) { | 648 if (data->is_floating_control_ && !data->is_connected_control_ && |
| 649 !one_placed) { |
| 645 Trace(" Floating control #%d:%s was scheduled in B%d\n", node->id(), | 650 Trace(" Floating control #%d:%s was scheduled in B%d\n", node->id(), |
| 646 node->op()->mnemonic(), block->id()); | 651 node->op()->mnemonic(), block->id()); |
| 647 ConnectFloatingControlSubgraph(block, node); | 652 ConnectFloatingControlSubgraph(block, node); |
| 653 one_placed = true; |
| 648 } | 654 } |
| 649 } | 655 } |
| 650 } | 656 } |
| 651 | 657 |
| 652 return true; | 658 return true; |
| 653 } | 659 } |
| 654 | 660 |
| 655 | 661 |
| 656 void Scheduler::ConnectFloatingControlSubgraph(BasicBlock* block, Node* end) { | 662 void Scheduler::ConnectFloatingControlSubgraph(BasicBlock* block, Node* end) { |
| 657 Node* block_start = block->nodes_[0]; | 663 Node* block_start = block->nodes_[0]; |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 | 1116 |
| 1111 #if DEBUG | 1117 #if DEBUG |
| 1112 if (FLAG_trace_turbo_scheduler) PrintRPO(num_loops, loops, final_order); | 1118 if (FLAG_trace_turbo_scheduler) PrintRPO(num_loops, loops, final_order); |
| 1113 VerifySpecialRPO(num_loops, loops, final_order); | 1119 VerifySpecialRPO(num_loops, loops, final_order); |
| 1114 #endif | 1120 #endif |
| 1115 return final_order; | 1121 return final_order; |
| 1116 } | 1122 } |
| 1117 } | 1123 } |
| 1118 } | 1124 } |
| 1119 } // namespace v8::internal::compiler | 1125 } // namespace v8::internal::compiler |
| OLD | NEW |