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/bootstrapper.h" // TODO(mstarzinger): Only temporary. | 11 #include "src/bootstrapper.h" // TODO(mstarzinger): Only temporary. |
12 #include "src/compiler/ast-graph-builder.h" | 12 #include "src/compiler/ast-graph-builder.h" |
13 #include "src/compiler/ast-loop-assignment-analyzer.h" | 13 #include "src/compiler/ast-loop-assignment-analyzer.h" |
14 #include "src/compiler/basic-block-instrumentor.h" | 14 #include "src/compiler/basic-block-instrumentor.h" |
15 #include "src/compiler/change-lowering.h" | 15 #include "src/compiler/change-lowering.h" |
16 #include "src/compiler/code-generator.h" | 16 #include "src/compiler/code-generator.h" |
17 #include "src/compiler/common-operator-reducer.h" | 17 #include "src/compiler/common-operator-reducer.h" |
18 #include "src/compiler/control-reducer.h" | 18 #include "src/compiler/control-reducer.h" |
19 #include "src/compiler/graph-replay.h" | 19 #include "src/compiler/graph-replay.h" |
20 #include "src/compiler/graph-visualizer.h" | 20 #include "src/compiler/graph-visualizer.h" |
21 #include "src/compiler/instruction.h" | 21 #include "src/compiler/instruction.h" |
22 #include "src/compiler/instruction-selector.h" | 22 #include "src/compiler/instruction-selector.h" |
23 #include "src/compiler/js-builtin-reducer.h" | 23 #include "src/compiler/js-builtin-reducer.h" |
24 #include "src/compiler/js-context-specialization.h" | 24 #include "src/compiler/js-context-specialization.h" |
25 #include "src/compiler/js-generic-lowering.h" | 25 #include "src/compiler/js-generic-lowering.h" |
26 #include "src/compiler/js-inlining.h" | 26 #include "src/compiler/js-inlining.h" |
27 #include "src/compiler/js-typed-lowering.h" | 27 #include "src/compiler/js-typed-lowering.h" |
28 #include "src/compiler/jump-threading.h" | 28 #include "src/compiler/jump-threading.h" |
29 #include "src/compiler/load-elimination.h" | 29 #include "src/compiler/load-elimination.h" |
| 30 #include "src/compiler/loop-analysis.h" |
| 31 #include "src/compiler/loop-peeling.h" |
30 #include "src/compiler/machine-operator-reducer.h" | 32 #include "src/compiler/machine-operator-reducer.h" |
31 #include "src/compiler/move-optimizer.h" | 33 #include "src/compiler/move-optimizer.h" |
32 #include "src/compiler/osr.h" | 34 #include "src/compiler/osr.h" |
33 #include "src/compiler/pipeline-statistics.h" | 35 #include "src/compiler/pipeline-statistics.h" |
34 #include "src/compiler/register-allocator.h" | 36 #include "src/compiler/register-allocator.h" |
35 #include "src/compiler/register-allocator-verifier.h" | 37 #include "src/compiler/register-allocator-verifier.h" |
36 #include "src/compiler/schedule.h" | 38 #include "src/compiler/schedule.h" |
37 #include "src/compiler/scheduler.h" | 39 #include "src/compiler/scheduler.h" |
38 #include "src/compiler/select-lowering.h" | 40 #include "src/compiler/select-lowering.h" |
39 #include "src/compiler/simplified-lowering.h" | 41 #include "src/compiler/simplified-lowering.h" |
(...skipping 457 matching lines...) Loading... |
497 struct EarlyControlReductionPhase : ControlReductionPhase { | 499 struct EarlyControlReductionPhase : ControlReductionPhase { |
498 static const char* phase_name() { return "early control reduction"; } | 500 static const char* phase_name() { return "early control reduction"; } |
499 }; | 501 }; |
500 | 502 |
501 | 503 |
502 struct LateControlReductionPhase : ControlReductionPhase { | 504 struct LateControlReductionPhase : ControlReductionPhase { |
503 static const char* phase_name() { return "late control reduction"; } | 505 static const char* phase_name() { return "late control reduction"; } |
504 }; | 506 }; |
505 | 507 |
506 | 508 |
| 509 struct StressLoopPeelingPhase { |
| 510 static const char* phase_name() { return "stress loop peeling"; } |
| 511 |
| 512 void Run(PipelineData* data, Zone* temp_zone) { |
| 513 SourcePositionTable::Scope pos(data->source_positions(), |
| 514 SourcePosition::Unknown()); |
| 515 // Peel the first outer loop for testing. |
| 516 // TODO(titzer): peel all loops? the N'th loop? Innermost loops? |
| 517 LoopTree* loop_tree = LoopFinder::BuildLoopTree(data->graph(), temp_zone); |
| 518 if (loop_tree != NULL && loop_tree->outer_loops().size() > 0) { |
| 519 LoopPeeler::Peel(data->graph(), data->common(), loop_tree, |
| 520 loop_tree->outer_loops()[0], temp_zone); |
| 521 } |
| 522 } |
| 523 }; |
| 524 |
| 525 |
507 struct GenericLoweringPhase { | 526 struct GenericLoweringPhase { |
508 static const char* phase_name() { return "generic lowering"; } | 527 static const char* phase_name() { return "generic lowering"; } |
509 | 528 |
510 void Run(PipelineData* data, Zone* temp_zone) { | 529 void Run(PipelineData* data, Zone* temp_zone) { |
511 SourcePositionTable::Scope pos(data->source_positions(), | 530 SourcePositionTable::Scope pos(data->source_positions(), |
512 SourcePosition::Unknown()); | 531 SourcePosition::Unknown()); |
513 JSGenericLowering generic(data->info(), data->jsgraph()); | 532 JSGenericLowering generic(data->info(), data->jsgraph()); |
514 SelectLowering select(data->jsgraph()->graph(), data->jsgraph()->common()); | 533 SelectLowering select(data->jsgraph()->graph(), data->jsgraph()->common()); |
515 GraphReducer graph_reducer(data->graph(), temp_zone); | 534 GraphReducer graph_reducer(data->graph(), temp_zone); |
516 graph_reducer.AddReducer(&generic); | 535 graph_reducer.AddReducer(&generic); |
(...skipping 304 matching lines...) Loading... |
821 RunPrintAndVerify("Typed"); | 840 RunPrintAndVerify("Typed"); |
822 } | 841 } |
823 | 842 |
824 BeginPhaseKind("lowering"); | 843 BeginPhaseKind("lowering"); |
825 | 844 |
826 if (info()->is_typing_enabled()) { | 845 if (info()->is_typing_enabled()) { |
827 // Lower JSOperators where we can determine types. | 846 // Lower JSOperators where we can determine types. |
828 Run<TypedLoweringPhase>(); | 847 Run<TypedLoweringPhase>(); |
829 RunPrintAndVerify("Lowered typed"); | 848 RunPrintAndVerify("Lowered typed"); |
830 | 849 |
| 850 if (FLAG_turbo_stress_loop_peeling) { |
| 851 Run<StressLoopPeelingPhase>(); |
| 852 RunPrintAndVerify("Loop peeled", true); |
| 853 } |
| 854 |
831 if (info()->is_osr()) { | 855 if (info()->is_osr()) { |
832 Run<OsrDeconstructionPhase>(); | 856 Run<OsrDeconstructionPhase>(); |
833 RunPrintAndVerify("OSR deconstruction"); | 857 RunPrintAndVerify("OSR deconstruction"); |
834 } | 858 } |
835 | 859 |
836 // Lower simplified operators and insert changes. | 860 // Lower simplified operators and insert changes. |
837 Run<SimplifiedLoweringPhase>(); | 861 Run<SimplifiedLoweringPhase>(); |
838 RunPrintAndVerify("Lowered simplified"); | 862 RunPrintAndVerify("Lowered simplified"); |
839 | 863 |
840 // Lower changes that have been inserted before. | 864 // Lower changes that have been inserted before. |
(...skipping 239 matching lines...) Loading... |
1080 } | 1104 } |
1081 | 1105 |
1082 | 1106 |
1083 void Pipeline::TearDown() { | 1107 void Pipeline::TearDown() { |
1084 InstructionOperand::TearDownCaches(); | 1108 InstructionOperand::TearDownCaches(); |
1085 } | 1109 } |
1086 | 1110 |
1087 } // namespace compiler | 1111 } // namespace compiler |
1088 } // namespace internal | 1112 } // namespace internal |
1089 } // namespace v8 | 1113 } // namespace v8 |
OLD | NEW |