OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
6 | 6 |
7 #include "src/base/platform/elapsed-timer.h" | 7 #include "src/base/platform/elapsed-timer.h" |
8 #include "src/compiler/ast-graph-builder.h" | 8 #include "src/compiler/ast-graph-builder.h" |
9 #include "src/compiler/code-generator.h" | 9 #include "src/compiler/code-generator.h" |
10 #include "src/compiler/graph-replay.h" | 10 #include "src/compiler/graph-replay.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 SourcePosition::Unknown()); | 241 SourcePosition::Unknown()); |
242 MachineOperatorBuilder machine(zone()); | 242 MachineOperatorBuilder machine(zone()); |
243 JSGenericLowering lowering(info(), &jsgraph, &machine); | 243 JSGenericLowering lowering(info(), &jsgraph, &machine); |
244 GraphReducer graph_reducer(&graph); | 244 GraphReducer graph_reducer(&graph); |
245 graph_reducer.AddReducer(&lowering); | 245 graph_reducer.AddReducer(&lowering); |
246 graph_reducer.ReduceGraph(); | 246 graph_reducer.ReduceGraph(); |
247 | 247 |
248 VerifyAndPrintGraph(&graph, "Lowered generic"); | 248 VerifyAndPrintGraph(&graph, "Lowered generic"); |
249 } | 249 } |
250 | 250 |
251 // Compute a schedule. | |
252 Schedule* schedule = ComputeSchedule(&graph); | |
253 TraceSchedule(schedule); | |
254 | |
255 { | 251 { |
| 252 // Compute a schedule. |
| 253 Schedule* schedule = ComputeSchedule(&graph); |
256 // Generate optimized code. | 254 // Generate optimized code. |
257 PhaseStats codegen_stats(info(), PhaseStats::CODEGEN, "codegen"); | 255 PhaseStats codegen_stats(info(), PhaseStats::CODEGEN, "codegen"); |
258 Linkage linkage(info()); | 256 Linkage linkage(info()); |
259 code = GenerateCode(&linkage, &graph, schedule, &source_positions); | 257 code = GenerateCode(&linkage, &graph, schedule, &source_positions); |
260 info()->SetCode(code); | 258 info()->SetCode(code); |
261 } | 259 } |
262 | 260 |
263 // Print optimized code. | 261 // Print optimized code. |
264 v8::internal::CodeGenerator::PrintCode(code, info()); | 262 v8::internal::CodeGenerator::PrintCode(code, info()); |
265 } | 263 } |
266 | 264 |
267 if (FLAG_trace_turbo) { | 265 if (FLAG_trace_turbo) { |
268 OFStream os(stdout); | 266 OFStream os(stdout); |
269 os << "--------------------------------------------------\n" | 267 os << "--------------------------------------------------\n" |
270 << "Finished compiling method " | 268 << "Finished compiling method " |
271 << info()->function()->debug_name()->ToCString().get() | 269 << info()->function()->debug_name()->ToCString().get() |
272 << " using Turbofan" << endl; | 270 << " using Turbofan" << endl; |
273 } | 271 } |
274 | 272 |
275 return code; | 273 return code; |
276 } | 274 } |
277 | 275 |
278 | 276 |
279 Schedule* Pipeline::ComputeSchedule(Graph* graph) { | 277 Schedule* Pipeline::ComputeSchedule(Graph* graph) { |
280 PhaseStats schedule_stats(info(), PhaseStats::CODEGEN, "scheduling"); | 278 PhaseStats schedule_stats(info(), PhaseStats::CODEGEN, "scheduling"); |
281 return Scheduler::ComputeSchedule(graph); | 279 Schedule* schedule = Scheduler::ComputeSchedule(graph); |
| 280 TraceSchedule(schedule); |
| 281 if (VerifyGraphs()) ScheduleVerifier::Run(schedule); |
| 282 return schedule; |
282 } | 283 } |
283 | 284 |
284 | 285 |
285 Handle<Code> Pipeline::GenerateCodeForMachineGraph(Linkage* linkage, | 286 Handle<Code> Pipeline::GenerateCodeForMachineGraph(Linkage* linkage, |
286 Graph* graph, | 287 Graph* graph, |
287 Schedule* schedule) { | 288 Schedule* schedule) { |
288 CHECK(SupportedBackend()); | 289 CHECK(SupportedBackend()); |
289 if (schedule == NULL) { | 290 if (schedule == NULL) { |
290 VerifyAndPrintGraph(graph, "Machine"); | 291 VerifyAndPrintGraph(graph, "Machine"); |
291 schedule = ComputeSchedule(graph); | 292 schedule = ComputeSchedule(graph); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 } | 359 } |
359 | 360 |
360 | 361 |
361 void Pipeline::TearDown() { | 362 void Pipeline::TearDown() { |
362 InstructionOperand::TearDownCaches(); | 363 InstructionOperand::TearDownCaches(); |
363 } | 364 } |
364 | 365 |
365 } // namespace compiler | 366 } // namespace compiler |
366 } // namespace internal | 367 } // namespace internal |
367 } // namespace v8 | 368 } // namespace v8 |
OLD | NEW |