| 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 <sstream> |
| 8 |
| 7 #include "src/base/platform/elapsed-timer.h" | 9 #include "src/base/platform/elapsed-timer.h" |
| 8 #include "src/compiler/ast-graph-builder.h" | 10 #include "src/compiler/ast-graph-builder.h" |
| 9 #include "src/compiler/basic-block-instrumentor.h" | 11 #include "src/compiler/basic-block-instrumentor.h" |
| 10 #include "src/compiler/change-lowering.h" | 12 #include "src/compiler/change-lowering.h" |
| 11 #include "src/compiler/code-generator.h" | 13 #include "src/compiler/code-generator.h" |
| 12 #include "src/compiler/graph-replay.h" | 14 #include "src/compiler/graph-replay.h" |
| 13 #include "src/compiler/graph-visualizer.h" | 15 #include "src/compiler/graph-visualizer.h" |
| 14 #include "src/compiler/instruction.h" | 16 #include "src/compiler/instruction.h" |
| 15 #include "src/compiler/instruction-selector.h" | 17 #include "src/compiler/instruction-selector.h" |
| 16 #include "src/compiler/js-context-specialization.h" | 18 #include "src/compiler/js-context-specialization.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 return Handle<Code>::null(); | 177 return Handle<Code>::null(); |
| 176 } | 178 } |
| 177 | 179 |
| 178 if (FLAG_turbo_stats) isolate()->GetTStatistics()->Initialize(info_); | 180 if (FLAG_turbo_stats) isolate()->GetTStatistics()->Initialize(info_); |
| 179 | 181 |
| 180 if (FLAG_trace_turbo) { | 182 if (FLAG_trace_turbo) { |
| 181 OFStream os(stdout); | 183 OFStream os(stdout); |
| 182 os << "---------------------------------------------------\n" | 184 os << "---------------------------------------------------\n" |
| 183 << "Begin compiling method " | 185 << "Begin compiling method " |
| 184 << info()->function()->debug_name()->ToCString().get() | 186 << info()->function()->debug_name()->ToCString().get() |
| 185 << " using Turbofan" << endl; | 187 << " using Turbofan" << std::endl; |
| 186 } | 188 } |
| 187 | 189 |
| 188 // Build the graph. | 190 // Build the graph. |
| 189 Graph graph(zone()); | 191 Graph graph(zone()); |
| 190 SourcePositionTable source_positions(&graph); | 192 SourcePositionTable source_positions(&graph); |
| 191 source_positions.AddDecorator(); | 193 source_positions.AddDecorator(); |
| 192 // TODO(turbofan): there is no need to type anything during initial graph | 194 // TODO(turbofan): there is no need to type anything during initial graph |
| 193 // construction. This is currently only needed for the node cache, which the | 195 // construction. This is currently only needed for the node cache, which the |
| 194 // typer could sweep over later. | 196 // typer could sweep over later. |
| 195 Typer typer(zone()); | 197 Typer typer(zone()); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 } | 332 } |
| 331 | 333 |
| 332 // Print optimized code. | 334 // Print optimized code. |
| 333 v8::internal::CodeGenerator::PrintCode(code, info()); | 335 v8::internal::CodeGenerator::PrintCode(code, info()); |
| 334 | 336 |
| 335 if (FLAG_trace_turbo) { | 337 if (FLAG_trace_turbo) { |
| 336 OFStream os(stdout); | 338 OFStream os(stdout); |
| 337 os << "--------------------------------------------------\n" | 339 os << "--------------------------------------------------\n" |
| 338 << "Finished compiling method " | 340 << "Finished compiling method " |
| 339 << info()->function()->debug_name()->ToCString().get() | 341 << info()->function()->debug_name()->ToCString().get() |
| 340 << " using Turbofan" << endl; | 342 << " using Turbofan" << std::endl; |
| 341 } | 343 } |
| 342 | 344 |
| 343 return code; | 345 return code; |
| 344 } | 346 } |
| 345 | 347 |
| 346 | 348 |
| 347 Schedule* Pipeline::ComputeSchedule(Graph* graph) { | 349 Schedule* Pipeline::ComputeSchedule(Graph* graph) { |
| 348 PhaseStats schedule_stats(info(), PhaseStats::CODEGEN, "scheduling"); | 350 PhaseStats schedule_stats(info(), PhaseStats::CODEGEN, "scheduling"); |
| 349 Schedule* schedule = Scheduler::ComputeSchedule(graph); | 351 Schedule* schedule = Scheduler::ComputeSchedule(graph); |
| 350 TraceSchedule(schedule); | 352 TraceSchedule(schedule); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 OFStream os(stdout); | 423 OFStream os(stdout); |
| 422 os << "----- Instruction sequence after register allocation -----\n" | 424 os << "----- Instruction sequence after register allocation -----\n" |
| 423 << sequence; | 425 << sequence; |
| 424 } | 426 } |
| 425 | 427 |
| 426 // Generate native sequence. | 428 // Generate native sequence. |
| 427 CodeGenerator generator(&sequence); | 429 CodeGenerator generator(&sequence); |
| 428 Handle<Code> code = generator.GenerateCode(); | 430 Handle<Code> code = generator.GenerateCode(); |
| 429 if (profiler_data != NULL) { | 431 if (profiler_data != NULL) { |
| 430 #if ENABLE_DISASSEMBLER | 432 #if ENABLE_DISASSEMBLER |
| 431 OStringStream os; | 433 std::ostringstream os; |
| 432 code->Disassemble(NULL, os); | 434 code->Disassemble(NULL, os); |
| 433 profiler_data->SetCode(&os); | 435 profiler_data->SetCode(&os); |
| 434 #endif | 436 #endif |
| 435 } | 437 } |
| 436 return code; | 438 return code; |
| 437 } | 439 } |
| 438 | 440 |
| 439 | 441 |
| 440 void Pipeline::SetUp() { | 442 void Pipeline::SetUp() { |
| 441 InstructionOperand::SetUpCaches(); | 443 InstructionOperand::SetUpCaches(); |
| 442 } | 444 } |
| 443 | 445 |
| 444 | 446 |
| 445 void Pipeline::TearDown() { | 447 void Pipeline::TearDown() { |
| 446 InstructionOperand::TearDownCaches(); | 448 InstructionOperand::TearDownCaches(); |
| 447 } | 449 } |
| 448 | 450 |
| 449 } // namespace compiler | 451 } // namespace compiler |
| 450 } // namespace internal | 452 } // namespace internal |
| 451 } // namespace v8 | 453 } // namespace v8 |
| OLD | NEW |