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/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
8 #include "src/compiler/graph-inl.h" | 8 #include "src/compiler/graph-inl.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
11 #include "src/compiler/node-properties-inl.h" | 11 #include "src/compiler/node-properties-inl.h" |
12 #include "src/data-flow.h" | 12 #include "src/data-flow.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace compiler { | 16 namespace compiler { |
17 | 17 |
18 Scheduler::Scheduler(Zone* zone, Graph* graph, Schedule* schedule) | 18 Scheduler::Scheduler(Zone* zone, Graph* graph, Schedule* schedule) |
19 : graph_(graph), | 19 : zone_(zone), |
| 20 graph_(graph), |
20 schedule_(schedule), | 21 schedule_(schedule), |
21 branches_(NodeVector::allocator_type(zone)), | 22 branches_(NodeVector::allocator_type(zone)), |
22 calls_(NodeVector::allocator_type(zone)), | 23 calls_(NodeVector::allocator_type(zone)), |
23 deopts_(NodeVector::allocator_type(zone)), | 24 deopts_(NodeVector::allocator_type(zone)), |
24 returns_(NodeVector::allocator_type(zone)), | 25 returns_(NodeVector::allocator_type(zone)), |
25 loops_and_merges_(NodeVector::allocator_type(zone)), | 26 loops_and_merges_(NodeVector::allocator_type(zone)), |
26 node_block_placement_(BasicBlockVector::allocator_type(zone)), | 27 node_block_placement_(BasicBlockVector::allocator_type(zone)), |
27 unscheduled_uses_(IntVector::allocator_type(zone)), | 28 unscheduled_uses_(IntVector::allocator_type(zone)), |
28 scheduled_nodes_(NodeVectorVector::allocator_type(zone)), | 29 scheduled_nodes_(NodeVectorVector::allocator_type(zone)), |
29 schedule_root_nodes_(NodeVector::allocator_type(zone)), | 30 schedule_root_nodes_(NodeVector::allocator_type(zone)), |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 PrintF("------------------- SCHEDULE LATE -----------------\n"); | 618 PrintF("------------------- SCHEDULE LATE -----------------\n"); |
618 } | 619 } |
619 | 620 |
620 // Schedule: Places nodes in dominator block of all their uses. | 621 // Schedule: Places nodes in dominator block of all their uses. |
621 ScheduleLateNodeVisitor schedule_late_visitor(this); | 622 ScheduleLateNodeVisitor schedule_late_visitor(this); |
622 | 623 |
623 for (NodeVectorIter i = schedule_root_nodes_.begin(); | 624 for (NodeVectorIter i = schedule_root_nodes_.begin(); |
624 i != schedule_root_nodes_.end(); ++i) { | 625 i != schedule_root_nodes_.end(); ++i) { |
625 GenericGraphVisit::Visit<ScheduleLateNodeVisitor, | 626 GenericGraphVisit::Visit<ScheduleLateNodeVisitor, |
626 NodeInputIterationTraits<Node> >( | 627 NodeInputIterationTraits<Node> >( |
627 graph_, *i, &schedule_late_visitor); | 628 graph_, zone_, *i, &schedule_late_visitor); |
628 } | 629 } |
629 | 630 |
630 // Add collected nodes for basic blocks to their blocks in the right order. | 631 // Add collected nodes for basic blocks to their blocks in the right order. |
631 int block_num = 0; | 632 int block_num = 0; |
632 for (NodeVectorVectorIter i = scheduled_nodes_.begin(); | 633 for (NodeVectorVectorIter i = scheduled_nodes_.begin(); |
633 i != scheduled_nodes_.end(); ++i) { | 634 i != scheduled_nodes_.end(); ++i) { |
634 for (NodeVectorRIter j = i->rbegin(); j != i->rend(); ++j) { | 635 for (NodeVectorRIter j = i->rbegin(); j != i->rend(); ++j) { |
635 schedule_->AddNode(schedule_->all_blocks_.at(block_num), *j); | 636 schedule_->AddNode(schedule_->all_blocks_.at(block_num), *j); |
636 } | 637 } |
637 block_num++; | 638 block_num++; |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 | 1040 |
1040 #if DEBUG | 1041 #if DEBUG |
1041 if (FLAG_trace_turbo_scheduler) PrintRPO(num_loops, loops, final_order); | 1042 if (FLAG_trace_turbo_scheduler) PrintRPO(num_loops, loops, final_order); |
1042 VerifySpecialRPO(num_loops, loops, final_order); | 1043 VerifySpecialRPO(num_loops, loops, final_order); |
1043 #endif | 1044 #endif |
1044 return final_order; | 1045 return final_order; |
1045 } | 1046 } |
1046 } | 1047 } |
1047 } | 1048 } |
1048 } // namespace v8::internal::compiler | 1049 } // namespace v8::internal::compiler |
OLD | NEW |