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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 Schedule* Pipeline::ComputeSchedule(Graph* graph) { | 224 Schedule* Pipeline::ComputeSchedule(Graph* graph) { |
225 Scheduler scheduler(zone()); | 225 Scheduler scheduler(zone()); |
226 PhaseStats schedule_stats(info(), PhaseStats::CODEGEN, "scheduling"); | 226 PhaseStats schedule_stats(info(), PhaseStats::CODEGEN, "scheduling"); |
227 return scheduler.NewSchedule(graph); | 227 return scheduler.NewSchedule(graph); |
228 } | 228 } |
229 | 229 |
230 | 230 |
231 Handle<Code> Pipeline::GenerateCodeForMachineGraph(Linkage* linkage, | 231 Handle<Code> Pipeline::GenerateCodeForMachineGraph(Linkage* linkage, |
232 Graph* graph, | 232 Graph* graph, |
233 Schedule* schedule) { | 233 Schedule* schedule) { |
234 CHECK(SupportedTarget()); | 234 CHECK(SupportedBackend()); |
235 if (schedule == NULL) { | 235 if (schedule == NULL) { |
236 VerifyAndPrintGraph(graph, "Machine"); | 236 VerifyAndPrintGraph(graph, "Machine"); |
237 schedule = ComputeSchedule(graph); | 237 schedule = ComputeSchedule(graph); |
238 } | 238 } |
239 TraceSchedule(schedule); | 239 TraceSchedule(schedule); |
240 | 240 |
241 SourcePositionTable source_positions(graph); | 241 SourcePositionTable source_positions(graph); |
242 Handle<Code> code = GenerateCode(linkage, graph, schedule, &source_positions); | 242 Handle<Code> code = GenerateCode(linkage, graph, schedule, &source_positions); |
243 #if ENABLE_DISASSEMBLER | 243 #if ENABLE_DISASSEMBLER |
244 if (!code.is_null() && FLAG_print_opt_code) { | 244 if (!code.is_null() && FLAG_print_opt_code) { |
245 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); | 245 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); |
246 OFStream os(tracing_scope.file()); | 246 OFStream os(tracing_scope.file()); |
247 code->Disassemble("test code", os); | 247 code->Disassemble("test code", os); |
248 } | 248 } |
249 #endif | 249 #endif |
250 return code; | 250 return code; |
251 } | 251 } |
252 | 252 |
253 | 253 |
254 Handle<Code> Pipeline::GenerateCode(Linkage* linkage, Graph* graph, | 254 Handle<Code> Pipeline::GenerateCode(Linkage* linkage, Graph* graph, |
255 Schedule* schedule, | 255 Schedule* schedule, |
256 SourcePositionTable* source_positions) { | 256 SourcePositionTable* source_positions) { |
257 DCHECK_NOT_NULL(graph); | 257 DCHECK_NOT_NULL(graph); |
258 DCHECK_NOT_NULL(linkage); | 258 DCHECK_NOT_NULL(linkage); |
259 DCHECK_NOT_NULL(schedule); | 259 DCHECK_NOT_NULL(schedule); |
260 DCHECK(SupportedTarget()); | 260 CHECK(SupportedBackend()); |
261 | 261 |
262 InstructionSequence sequence(linkage, graph, schedule); | 262 InstructionSequence sequence(linkage, graph, schedule); |
263 | 263 |
264 // Select and schedule instructions covering the scheduled graph. | 264 // Select and schedule instructions covering the scheduled graph. |
265 { | 265 { |
266 InstructionSelector selector(&sequence, source_positions); | 266 InstructionSelector selector(&sequence, source_positions); |
267 selector.SelectInstructions(); | 267 selector.SelectInstructions(); |
268 } | 268 } |
269 | 269 |
270 if (FLAG_trace_turbo) { | 270 if (FLAG_trace_turbo) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 } | 304 } |
305 | 305 |
306 | 306 |
307 void Pipeline::TearDown() { | 307 void Pipeline::TearDown() { |
308 InstructionOperand::TearDownCaches(); | 308 InstructionOperand::TearDownCaches(); |
309 } | 309 } |
310 | 310 |
311 } // namespace compiler | 311 } // namespace compiler |
312 } // namespace internal | 312 } // namespace internal |
313 } // namespace v8 | 313 } // namespace v8 |
OLD | NEW |