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 20 matching lines...) Expand all Loading... |
31 Scheduler::Scheduler(Zone* zone, Graph* graph, Schedule* schedule) | 31 Scheduler::Scheduler(Zone* zone, Graph* graph, Schedule* schedule) |
32 : zone_(zone), | 32 : zone_(zone), |
33 graph_(graph), | 33 graph_(graph), |
34 schedule_(schedule), | 34 schedule_(schedule), |
35 scheduled_nodes_(zone), | 35 scheduled_nodes_(zone), |
36 schedule_root_nodes_(zone), | 36 schedule_root_nodes_(zone), |
37 schedule_queue_(zone), | 37 schedule_queue_(zone), |
38 node_data_(graph_->NodeCount(), DefaultSchedulerData(), zone) {} | 38 node_data_(graph_->NodeCount(), DefaultSchedulerData(), zone) {} |
39 | 39 |
40 | 40 |
41 Schedule* Scheduler::ComputeSchedule(ZonePool* zone_pool, Graph* graph) { | 41 Schedule* Scheduler::ComputeSchedule(Zone* zone, Graph* graph) { |
42 ZonePool::Scope zone_scope(zone_pool); | |
43 Schedule* schedule = new (graph->zone()) | 42 Schedule* schedule = new (graph->zone()) |
44 Schedule(graph->zone(), static_cast<size_t>(graph->NodeCount())); | 43 Schedule(graph->zone(), static_cast<size_t>(graph->NodeCount())); |
45 Scheduler scheduler(zone_scope.zone(), graph, schedule); | 44 Scheduler scheduler(zone, graph, schedule); |
46 | 45 |
47 scheduler.BuildCFG(); | 46 scheduler.BuildCFG(); |
48 scheduler.ComputeSpecialRPONumbering(); | 47 scheduler.ComputeSpecialRPONumbering(); |
49 scheduler.GenerateImmediateDominatorTree(); | 48 scheduler.GenerateImmediateDominatorTree(); |
50 | 49 |
51 scheduler.PrepareUses(); | 50 scheduler.PrepareUses(); |
52 scheduler.ScheduleEarly(); | 51 scheduler.ScheduleEarly(); |
53 scheduler.ScheduleLate(); | 52 scheduler.ScheduleLate(); |
54 | 53 |
55 scheduler.SealFinalSchedule(); | 54 scheduler.SealFinalSchedule(); |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 Schedule* schedule_; | 1017 Schedule* schedule_; |
1019 BlockList* order_; | 1018 BlockList* order_; |
1020 ZoneVector<LoopInfo> loops_; | 1019 ZoneVector<LoopInfo> loops_; |
1021 BasicBlock* beyond_end_; | 1020 BasicBlock* beyond_end_; |
1022 ZoneList<Backedge> backedges_; | 1021 ZoneList<Backedge> backedges_; |
1023 ZoneVector<SpecialRPOStackFrame> stack_; | 1022 ZoneVector<SpecialRPOStackFrame> stack_; |
1024 size_t previous_block_count_; | 1023 size_t previous_block_count_; |
1025 }; | 1024 }; |
1026 | 1025 |
1027 | 1026 |
1028 BasicBlockVector* Scheduler::ComputeSpecialRPO(ZonePool* zone_pool, | 1027 BasicBlockVector* Scheduler::ComputeSpecialRPO(Zone* zone, Schedule* schedule) { |
1029 Schedule* schedule) { | |
1030 ZonePool::Scope zone_scope(zone_pool); | |
1031 Zone* zone = zone_scope.zone(); | |
1032 | |
1033 SpecialRPONumberer numberer(zone, schedule); | 1028 SpecialRPONumberer numberer(zone, schedule); |
1034 numberer.ComputeSpecialRPO(); | 1029 numberer.ComputeSpecialRPO(); |
1035 numberer.SerializeAOIntoSchedule(); | 1030 numberer.SerializeAOIntoSchedule(); |
1036 numberer.SerializeRPOIntoSchedule(); | 1031 numberer.SerializeRPOIntoSchedule(); |
1037 numberer.PrintAndVerifySpecialRPO(); | 1032 numberer.PrintAndVerifySpecialRPO(); |
1038 return schedule->rpo_order(); | 1033 return schedule->rpo_order(); |
1039 } | 1034 } |
1040 | 1035 |
1041 | 1036 |
1042 void Scheduler::ComputeSpecialRPONumbering() { | 1037 void Scheduler::ComputeSpecialRPONumbering() { |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 for (NodeVectorIter i = nodes->begin(); i != nodes->end(); ++i) { | 1469 for (NodeVectorIter i = nodes->begin(); i != nodes->end(); ++i) { |
1475 schedule_->SetBlockForNode(to, *i); | 1470 schedule_->SetBlockForNode(to, *i); |
1476 scheduled_nodes_[to->id().ToSize()].push_back(*i); | 1471 scheduled_nodes_[to->id().ToSize()].push_back(*i); |
1477 } | 1472 } |
1478 nodes->clear(); | 1473 nodes->clear(); |
1479 } | 1474 } |
1480 | 1475 |
1481 } // namespace compiler | 1476 } // namespace compiler |
1482 } // namespace internal | 1477 } // namespace internal |
1483 } // namespace v8 | 1478 } // namespace v8 |
OLD | NEW |