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" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 IrOpcode::Mnemonic(node->opcode()), block->id(), succ->id()); | 200 IrOpcode::Mnemonic(node->opcode()), block->id(), succ->id()); |
201 } | 201 } |
202 } | 202 } |
203 }; | 203 }; |
204 | 204 |
205 | 205 |
206 Scheduler::Scheduler(Zone* zone, Graph* graph, Schedule* schedule) | 206 Scheduler::Scheduler(Zone* zone, Graph* graph, Schedule* schedule) |
207 : zone_(zone), | 207 : zone_(zone), |
208 graph_(graph), | 208 graph_(graph), |
209 schedule_(schedule), | 209 schedule_(schedule), |
210 unscheduled_uses_(IntVector::allocator_type(zone)), | 210 unscheduled_uses_(zone), |
211 scheduled_nodes_(NodeVectorVector::allocator_type(zone)), | 211 scheduled_nodes_(zone), |
212 schedule_root_nodes_(NodeVector::allocator_type(zone)), | 212 schedule_root_nodes_(zone), |
213 schedule_early_rpo_index_(IntVector::allocator_type(zone)) {} | 213 schedule_early_rpo_index_(zone) {} |
214 | 214 |
215 | 215 |
216 Schedule* Scheduler::ComputeSchedule(Graph* graph) { | 216 Schedule* Scheduler::ComputeSchedule(Graph* graph) { |
217 Zone tmp_zone(graph->zone()->isolate()); | 217 Zone tmp_zone(graph->zone()->isolate()); |
218 Schedule* schedule = new (graph->zone()) Schedule(graph->zone()); | 218 Schedule* schedule = new (graph->zone()) Schedule(graph->zone()); |
219 | 219 |
220 Scheduler::ComputeCFG(graph, schedule); | 220 Scheduler::ComputeCFG(graph, schedule); |
221 | 221 |
222 Scheduler scheduler(&tmp_zone, graph, schedule); | 222 Scheduler scheduler(&tmp_zone, graph, schedule); |
223 | 223 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 266 |
267 | 267 |
268 void Scheduler::PrepareAuxiliaryNodeData() { | 268 void Scheduler::PrepareAuxiliaryNodeData() { |
269 unscheduled_uses_.resize(graph_->NodeCount(), 0); | 269 unscheduled_uses_.resize(graph_->NodeCount(), 0); |
270 schedule_early_rpo_index_.resize(graph_->NodeCount(), 0); | 270 schedule_early_rpo_index_.resize(graph_->NodeCount(), 0); |
271 } | 271 } |
272 | 272 |
273 | 273 |
274 void Scheduler::PrepareAuxiliaryBlockData() { | 274 void Scheduler::PrepareAuxiliaryBlockData() { |
275 Zone* zone = schedule_->zone(); | 275 Zone* zone = schedule_->zone(); |
276 scheduled_nodes_.resize(schedule_->BasicBlockCount(), | 276 scheduled_nodes_.resize(schedule_->BasicBlockCount(), NodeVector(zone)); |
277 NodeVector(NodeVector::allocator_type(zone))); | |
278 schedule_->immediate_dominator_.resize(schedule_->BasicBlockCount(), NULL); | 277 schedule_->immediate_dominator_.resize(schedule_->BasicBlockCount(), NULL); |
279 } | 278 } |
280 | 279 |
281 | 280 |
282 BasicBlock* Scheduler::GetCommonDominator(BasicBlock* b1, BasicBlock* b2) { | 281 BasicBlock* Scheduler::GetCommonDominator(BasicBlock* b1, BasicBlock* b2) { |
283 while (b1 != b2) { | 282 while (b1 != b2) { |
284 int b1_rpo = GetRPONumber(b1); | 283 int b1_rpo = GetRPONumber(b1); |
285 int b2_rpo = GetRPONumber(b2); | 284 int b2_rpo = GetRPONumber(b2); |
286 DCHECK(b1_rpo != b2_rpo); | 285 DCHECK(b1_rpo != b2_rpo); |
287 if (b1_rpo < b2_rpo) { | 286 if (b1_rpo < b2_rpo) { |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 | 976 |
978 #if DEBUG | 977 #if DEBUG |
979 if (FLAG_trace_turbo_scheduler) PrintRPO(num_loops, loops, final_order); | 978 if (FLAG_trace_turbo_scheduler) PrintRPO(num_loops, loops, final_order); |
980 VerifySpecialRPO(num_loops, loops, final_order); | 979 VerifySpecialRPO(num_loops, loops, final_order); |
981 #endif | 980 #endif |
982 return final_order; | 981 return final_order; |
983 } | 982 } |
984 } | 983 } |
985 } | 984 } |
986 } // namespace v8::internal::compiler | 985 } // namespace v8::internal::compiler |
OLD | NEW |