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 <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/base/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
11 #include "src/compiler/ast-graph-builder.h" | 11 #include "src/compiler/ast-graph-builder.h" |
12 #include "src/compiler/basic-block-instrumentor.h" | 12 #include "src/compiler/basic-block-instrumentor.h" |
13 #include "src/compiler/change-lowering.h" | 13 #include "src/compiler/change-lowering.h" |
14 #include "src/compiler/code-generator.h" | 14 #include "src/compiler/code-generator.h" |
15 #include "src/compiler/control-reducer.h" | 15 #include "src/compiler/control-reducer.h" |
16 #include "src/compiler/graph-replay.h" | 16 #include "src/compiler/graph-replay.h" |
17 #include "src/compiler/graph-visualizer.h" | 17 #include "src/compiler/graph-visualizer.h" |
18 #include "src/compiler/instruction.h" | 18 #include "src/compiler/instruction.h" |
19 #include "src/compiler/instruction-selector.h" | 19 #include "src/compiler/instruction-selector.h" |
20 #include "src/compiler/js-context-specialization.h" | 20 #include "src/compiler/js-context-specialization.h" |
21 #include "src/compiler/js-generic-lowering.h" | 21 #include "src/compiler/js-generic-lowering.h" |
22 #include "src/compiler/js-inlining.h" | 22 #include "src/compiler/js-inlining.h" |
23 #include "src/compiler/js-typed-lowering.h" | 23 #include "src/compiler/js-typed-lowering.h" |
24 #include "src/compiler/machine-operator-reducer.h" | 24 #include "src/compiler/machine-operator-reducer.h" |
25 #include "src/compiler/phi-reducer.h" | |
26 #include "src/compiler/pipeline-statistics.h" | 25 #include "src/compiler/pipeline-statistics.h" |
27 #include "src/compiler/register-allocator.h" | 26 #include "src/compiler/register-allocator.h" |
28 #include "src/compiler/schedule.h" | 27 #include "src/compiler/schedule.h" |
29 #include "src/compiler/scheduler.h" | 28 #include "src/compiler/scheduler.h" |
30 #include "src/compiler/simplified-lowering.h" | 29 #include "src/compiler/simplified-lowering.h" |
31 #include "src/compiler/simplified-operator-reducer.h" | 30 #include "src/compiler/simplified-operator-reducer.h" |
32 #include "src/compiler/typer.h" | 31 #include "src/compiler/typer.h" |
33 #include "src/compiler/value-numbering-reducer.h" | 32 #include "src/compiler/value-numbering-reducer.h" |
34 #include "src/compiler/verifier.h" | 33 #include "src/compiler/verifier.h" |
35 #include "src/compiler/zone-pool.h" | 34 #include "src/compiler/zone-pool.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 298 |
300 Node* context_node; | 299 Node* context_node; |
301 { | 300 { |
302 PhaseScope phase_scope(pipeline_statistics.get(), "graph builder"); | 301 PhaseScope phase_scope(pipeline_statistics.get(), "graph builder"); |
303 ZonePool::Scope zone_scope(data.zone_pool()); | 302 ZonePool::Scope zone_scope(data.zone_pool()); |
304 AstGraphBuilderWithPositions graph_builder( | 303 AstGraphBuilderWithPositions graph_builder( |
305 zone_scope.zone(), info(), data.jsgraph(), data.source_positions()); | 304 zone_scope.zone(), info(), data.jsgraph(), data.source_positions()); |
306 graph_builder.CreateGraph(); | 305 graph_builder.CreateGraph(); |
307 context_node = graph_builder.GetFunctionContext(); | 306 context_node = graph_builder.GetFunctionContext(); |
308 } | 307 } |
309 { | |
310 PhaseScope phase_scope(pipeline_statistics.get(), "phi reduction"); | |
311 PhiReducer phi_reducer; | |
312 GraphReducer graph_reducer(data.graph()); | |
313 graph_reducer.AddReducer(&phi_reducer); | |
314 graph_reducer.ReduceGraph(); | |
315 // TODO(mstarzinger): Running reducer once ought to be enough for everyone. | |
316 graph_reducer.ReduceGraph(); | |
317 graph_reducer.ReduceGraph(); | |
318 } | |
319 | 308 |
320 VerifyAndPrintGraph(data.graph(), "Initial untyped", true); | 309 VerifyAndPrintGraph(data.graph(), "Initial untyped", true); |
321 | 310 |
| 311 { |
| 312 PhaseScope phase_scope(pipeline_statistics.get(), |
| 313 "early control reduction"); |
| 314 SourcePositionTable::Scope pos(data.source_positions(), |
| 315 SourcePosition::Unknown()); |
| 316 ZonePool::Scope zone_scope(data.zone_pool()); |
| 317 ControlReducer::ReduceGraph(zone_scope.zone(), data.jsgraph(), |
| 318 data.common()); |
| 319 |
| 320 VerifyAndPrintGraph(data.graph(), "Early Control reduced", true); |
| 321 } |
| 322 |
322 if (info()->is_context_specializing()) { | 323 if (info()->is_context_specializing()) { |
323 SourcePositionTable::Scope pos(data.source_positions(), | 324 SourcePositionTable::Scope pos(data.source_positions(), |
324 SourcePosition::Unknown()); | 325 SourcePosition::Unknown()); |
325 // Specialize the code to the context as aggressively as possible. | 326 // Specialize the code to the context as aggressively as possible. |
326 JSContextSpecializer spec(info(), data.jsgraph(), context_node); | 327 JSContextSpecializer spec(info(), data.jsgraph(), context_node); |
327 spec.SpecializeToContext(); | 328 spec.SpecializeToContext(); |
328 VerifyAndPrintGraph(data.graph(), "Context specialized", true); | 329 VerifyAndPrintGraph(data.graph(), "Context specialized", true); |
329 } | 330 } |
330 | 331 |
331 if (info()->is_inlining_enabled()) { | 332 if (info()->is_inlining_enabled()) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 graph_reducer.AddReducer(&simple_reducer); | 409 graph_reducer.AddReducer(&simple_reducer); |
409 graph_reducer.AddReducer(&lowering); | 410 graph_reducer.AddReducer(&lowering); |
410 graph_reducer.AddReducer(&mach_reducer); | 411 graph_reducer.AddReducer(&mach_reducer); |
411 graph_reducer.ReduceGraph(); | 412 graph_reducer.ReduceGraph(); |
412 | 413 |
413 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. | 414 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. |
414 VerifyAndPrintGraph(data.graph(), "Lowered changes", true); | 415 VerifyAndPrintGraph(data.graph(), "Lowered changes", true); |
415 } | 416 } |
416 | 417 |
417 { | 418 { |
418 PhaseScope phase_scope(pipeline_statistics.get(), "control reduction"); | 419 PhaseScope phase_scope(pipeline_statistics.get(), |
| 420 "late control reduction"); |
419 SourcePositionTable::Scope pos(data.source_positions(), | 421 SourcePositionTable::Scope pos(data.source_positions(), |
420 SourcePosition::Unknown()); | 422 SourcePosition::Unknown()); |
421 ZonePool::Scope zone_scope(data.zone_pool()); | 423 ZonePool::Scope zone_scope(data.zone_pool()); |
422 ControlReducer::ReduceGraph(zone_scope.zone(), data.jsgraph(), | 424 ControlReducer::ReduceGraph(zone_scope.zone(), data.jsgraph(), |
423 data.common()); | 425 data.common()); |
424 | 426 |
425 VerifyAndPrintGraph(data.graph(), "Control reduced"); | 427 VerifyAndPrintGraph(data.graph(), "Late Control reduced"); |
426 } | 428 } |
427 } | 429 } |
428 | 430 |
429 { | 431 { |
430 // Lower any remaining generic JSOperators. | 432 // Lower any remaining generic JSOperators. |
431 PhaseScope phase_scope(pipeline_statistics.get(), "generic lowering"); | 433 PhaseScope phase_scope(pipeline_statistics.get(), "generic lowering"); |
432 SourcePositionTable::Scope pos(data.source_positions(), | 434 SourcePositionTable::Scope pos(data.source_positions(), |
433 SourcePosition::Unknown()); | 435 SourcePosition::Unknown()); |
434 JSGenericLowering lowering(info(), data.jsgraph()); | 436 JSGenericLowering lowering(info(), data.jsgraph()); |
435 GraphReducer graph_reducer(data.graph()); | 437 GraphReducer graph_reducer(data.graph()); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 } | 602 } |
601 | 603 |
602 | 604 |
603 void Pipeline::TearDown() { | 605 void Pipeline::TearDown() { |
604 InstructionOperand::TearDownCaches(); | 606 InstructionOperand::TearDownCaches(); |
605 } | 607 } |
606 | 608 |
607 } // namespace compiler | 609 } // namespace compiler |
608 } // namespace internal | 610 } // namespace internal |
609 } // namespace v8 | 611 } // namespace v8 |
OLD | NEW |