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