| 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/change-lowering.h" | 9 #include "src/compiler/change-lowering.h" |
| 10 #include "src/compiler/code-generator.h" | 10 #include "src/compiler/code-generator.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 JSInliner inliner(info(), &jsgraph); | 222 JSInliner inliner(info(), &jsgraph); |
| 223 inliner.Inline(); | 223 inliner.Inline(); |
| 224 VerifyAndPrintGraph(&graph, "Inlined"); | 224 VerifyAndPrintGraph(&graph, "Inlined"); |
| 225 } | 225 } |
| 226 | 226 |
| 227 // Print a replay of the initial graph. | 227 // Print a replay of the initial graph. |
| 228 if (FLAG_print_turbo_replay) { | 228 if (FLAG_print_turbo_replay) { |
| 229 GraphReplayPrinter::PrintReplay(&graph); | 229 GraphReplayPrinter::PrintReplay(&graph); |
| 230 } | 230 } |
| 231 | 231 |
| 232 // Bailout here in case target architecture is not supported. |
| 233 if (!SupportedTarget()) return Handle<Code>::null(); |
| 234 |
| 232 if (info()->is_typing_enabled()) { | 235 if (info()->is_typing_enabled()) { |
| 233 { | 236 { |
| 234 // Type the graph. | 237 // Type the graph. |
| 235 PhaseStats typer_stats(info(), PhaseStats::CREATE_GRAPH, "typer"); | 238 PhaseStats typer_stats(info(), PhaseStats::CREATE_GRAPH, "typer"); |
| 236 typer.Run(&graph, info()->context()); | 239 typer.Run(&graph, info()->context()); |
| 237 VerifyAndPrintGraph(&graph, "Typed"); | 240 VerifyAndPrintGraph(&graph, "Typed"); |
| 238 } | 241 } |
| 239 // All new nodes must be typed. | 242 // All new nodes must be typed. |
| 240 typer.DecorateGraph(&graph); | 243 typer.DecorateGraph(&graph); |
| 241 { | 244 { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // graph_reducer.AddReducer(&vn_reducer); | 282 // graph_reducer.AddReducer(&vn_reducer); |
| 280 graph_reducer.AddReducer(&simple_reducer); | 283 graph_reducer.AddReducer(&simple_reducer); |
| 281 graph_reducer.AddReducer(&lowering); | 284 graph_reducer.AddReducer(&lowering); |
| 282 graph_reducer.AddReducer(&mach_reducer); | 285 graph_reducer.AddReducer(&mach_reducer); |
| 283 graph_reducer.ReduceGraph(); | 286 graph_reducer.ReduceGraph(); |
| 284 | 287 |
| 285 VerifyAndPrintGraph(&graph, "Lowered changes"); | 288 VerifyAndPrintGraph(&graph, "Lowered changes"); |
| 286 } | 289 } |
| 287 } | 290 } |
| 288 | 291 |
| 292 { |
| 293 // Lower any remaining generic JSOperators. |
| 294 PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH, |
| 295 "generic lowering"); |
| 296 SourcePositionTable::Scope pos(&source_positions, |
| 297 SourcePosition::Unknown()); |
| 298 JSGenericLowering lowering(info(), &jsgraph); |
| 299 GraphReducer graph_reducer(&graph); |
| 300 graph_reducer.AddReducer(&lowering); |
| 301 graph_reducer.ReduceGraph(); |
| 302 |
| 303 VerifyAndPrintGraph(&graph, "Lowered generic"); |
| 304 } |
| 305 |
| 289 Handle<Code> code = Handle<Code>::null(); | 306 Handle<Code> code = Handle<Code>::null(); |
| 290 if (SupportedTarget()) { | 307 { |
| 291 { | 308 // Compute a schedule. |
| 292 // Lower any remaining generic JSOperators. | 309 Schedule* schedule = ComputeSchedule(&graph); |
| 293 PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH, | 310 // Generate optimized code. |
| 294 "generic lowering"); | 311 PhaseStats codegen_stats(info(), PhaseStats::CODEGEN, "codegen"); |
| 295 SourcePositionTable::Scope pos(&source_positions, | 312 Linkage linkage(info()); |
| 296 SourcePosition::Unknown()); | 313 code = GenerateCode(&linkage, &graph, schedule, &source_positions); |
| 297 JSGenericLowering lowering(info(), &jsgraph); | 314 info()->SetCode(code); |
| 298 GraphReducer graph_reducer(&graph); | 315 } |
| 299 graph_reducer.AddReducer(&lowering); | |
| 300 graph_reducer.ReduceGraph(); | |
| 301 | 316 |
| 302 VerifyAndPrintGraph(&graph, "Lowered generic"); | 317 // Print optimized code. |
| 303 } | 318 v8::internal::CodeGenerator::PrintCode(code, info()); |
| 304 | |
| 305 { | |
| 306 // Compute a schedule. | |
| 307 Schedule* schedule = ComputeSchedule(&graph); | |
| 308 // Generate optimized code. | |
| 309 PhaseStats codegen_stats(info(), PhaseStats::CODEGEN, "codegen"); | |
| 310 Linkage linkage(info()); | |
| 311 code = GenerateCode(&linkage, &graph, schedule, &source_positions); | |
| 312 info()->SetCode(code); | |
| 313 } | |
| 314 | |
| 315 // Print optimized code. | |
| 316 v8::internal::CodeGenerator::PrintCode(code, info()); | |
| 317 } | |
| 318 | 319 |
| 319 if (FLAG_trace_turbo) { | 320 if (FLAG_trace_turbo) { |
| 320 OFStream os(stdout); | 321 OFStream os(stdout); |
| 321 os << "--------------------------------------------------\n" | 322 os << "--------------------------------------------------\n" |
| 322 << "Finished compiling method " | 323 << "Finished compiling method " |
| 323 << info()->function()->debug_name()->ToCString().get() | 324 << info()->function()->debug_name()->ToCString().get() |
| 324 << " using Turbofan" << endl; | 325 << " using Turbofan" << endl; |
| 325 } | 326 } |
| 326 | 327 |
| 327 return code; | 328 return code; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 } | 414 } |
| 414 | 415 |
| 415 | 416 |
| 416 void Pipeline::TearDown() { | 417 void Pipeline::TearDown() { |
| 417 InstructionOperand::TearDownCaches(); | 418 InstructionOperand::TearDownCaches(); |
| 418 } | 419 } |
| 419 | 420 |
| 420 } // namespace compiler | 421 } // namespace compiler |
| 421 } // namespace internal | 422 } // namespace internal |
| 422 } // namespace v8 | 423 } // namespace v8 |
| OLD | NEW |