| 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 struct EarlyControlReductionPhase : ControlReductionPhase { | 507 struct EarlyControlReductionPhase : ControlReductionPhase { |
| 506 static const char* phase_name() { return "early control reduction"; } | 508 static const char* phase_name() { return "early control reduction"; } |
| 507 }; | 509 }; |
| 508 | 510 |
| 509 | 511 |
| 510 struct LateControlReductionPhase : ControlReductionPhase { | 512 struct LateControlReductionPhase : ControlReductionPhase { |
| 511 static const char* phase_name() { return "late control reduction"; } | 513 static const char* phase_name() { return "late control reduction"; } |
| 512 }; | 514 }; |
| 513 | 515 |
| 514 | 516 |
| 517 struct StressLoopPeelingPhase { |
| 518 static const char* phase_name() { return "stress loop peeling"; } |
| 519 |
| 520 void Run(PipelineData* data, Zone* temp_zone) { |
| 521 SourcePositionTable::Scope pos(data->source_positions(), |
| 522 SourcePosition::Unknown()); |
| 523 // Peel the first outer loop for testing. |
| 524 // TODO(titzer): peel all loops? the N'th loop? Innermost loops? |
| 525 LoopTree* loop_tree = LoopFinder::BuildLoopTree(data->graph(), temp_zone); |
| 526 if (loop_tree != NULL && loop_tree->outer_loops().size() > 0) { |
| 527 LoopPeeler::Peel(data->graph(), data->common(), loop_tree, |
| 528 loop_tree->outer_loops()[0], temp_zone); |
| 529 } |
| 530 } |
| 531 }; |
| 532 |
| 533 |
| 515 struct GenericLoweringPhase { | 534 struct GenericLoweringPhase { |
| 516 static const char* phase_name() { return "generic lowering"; } | 535 static const char* phase_name() { return "generic lowering"; } |
| 517 | 536 |
| 518 void Run(PipelineData* data, Zone* temp_zone) { | 537 void Run(PipelineData* data, Zone* temp_zone) { |
| 519 SourcePositionTable::Scope pos(data->source_positions(), | 538 SourcePositionTable::Scope pos(data->source_positions(), |
| 520 SourcePosition::Unknown()); | 539 SourcePosition::Unknown()); |
| 521 JSGenericLowering generic(data->info(), data->jsgraph()); | 540 JSGenericLowering generic(data->info(), data->jsgraph()); |
| 522 SelectLowering select(data->jsgraph()->graph(), data->jsgraph()->common()); | 541 SelectLowering select(data->jsgraph()->graph(), data->jsgraph()->common()); |
| 523 GraphReducer graph_reducer(data->graph(), temp_zone); | 542 GraphReducer graph_reducer(data->graph(), temp_zone); |
| 524 graph_reducer.AddReducer(&generic); | 543 graph_reducer.AddReducer(&generic); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 RunPrintAndVerify("Typed"); | 852 RunPrintAndVerify("Typed"); |
| 834 } | 853 } |
| 835 | 854 |
| 836 BeginPhaseKind("lowering"); | 855 BeginPhaseKind("lowering"); |
| 837 | 856 |
| 838 if (info()->is_typing_enabled()) { | 857 if (info()->is_typing_enabled()) { |
| 839 // Lower JSOperators where we can determine types. | 858 // Lower JSOperators where we can determine types. |
| 840 Run<TypedLoweringPhase>(); | 859 Run<TypedLoweringPhase>(); |
| 841 RunPrintAndVerify("Lowered typed"); | 860 RunPrintAndVerify("Lowered typed"); |
| 842 | 861 |
| 862 if (FLAG_stress_loop_peeling) { |
| 863 Run<StressLoopPeelingPhase>(); |
| 864 RunPrintAndVerify("Loop peeled", true); |
| 865 } |
| 866 |
| 843 if (info()->is_osr()) { | 867 if (info()->is_osr()) { |
| 844 Run<OsrDeconstructionPhase>(); | 868 Run<OsrDeconstructionPhase>(); |
| 845 RunPrintAndVerify("OSR deconstruction"); | 869 RunPrintAndVerify("OSR deconstruction"); |
| 846 } | 870 } |
| 847 | 871 |
| 848 // Lower simplified operators and insert changes. | 872 // Lower simplified operators and insert changes. |
| 849 Run<SimplifiedLoweringPhase>(); | 873 Run<SimplifiedLoweringPhase>(); |
| 850 RunPrintAndVerify("Lowered simplified"); | 874 RunPrintAndVerify("Lowered simplified"); |
| 851 | 875 |
| 852 // Lower changes that have been inserted before. | 876 // Lower changes that have been inserted before. |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 } | 1119 } |
| 1096 | 1120 |
| 1097 | 1121 |
| 1098 void Pipeline::TearDown() { | 1122 void Pipeline::TearDown() { |
| 1099 InstructionOperand::TearDownCaches(); | 1123 InstructionOperand::TearDownCaches(); |
| 1100 } | 1124 } |
| 1101 | 1125 |
| 1102 } // namespace compiler | 1126 } // namespace compiler |
| 1103 } // namespace internal | 1127 } // namespace internal |
| 1104 } // namespace v8 | 1128 } // namespace v8 |
| OLD | NEW |