| 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/adapters.h" | 10 #include "src/base/adapters.h" |
| 11 #include "src/base/platform/elapsed-timer.h" | 11 #include "src/base/platform/elapsed-timer.h" |
| 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/branch-elimination.h" | 15 #include "src/compiler/branch-elimination.h" |
| 16 #include "src/compiler/bytecode-graph-builder.h" | 16 #include "src/compiler/bytecode-graph-builder.h" |
| 17 #include "src/compiler/change-lowering.h" | 17 #include "src/compiler/change-lowering.h" |
| 18 #include "src/compiler/code-generator.h" | 18 #include "src/compiler/code-generator.h" |
| 19 #include "src/compiler/common-operator-reducer.h" | 19 #include "src/compiler/common-operator-reducer.h" |
| 20 #include "src/compiler/control-flow-optimizer.h" | 20 #include "src/compiler/control-flow-optimizer.h" |
| 21 #include "src/compiler/dead-code-elimination.h" | 21 #include "src/compiler/dead-code-elimination.h" |
| 22 #include "src/compiler/escape-analysis.h" |
| 23 #include "src/compiler/escape-analysis-reducer.h" |
| 22 #include "src/compiler/frame-elider.h" | 24 #include "src/compiler/frame-elider.h" |
| 23 #include "src/compiler/graph-replay.h" | 25 #include "src/compiler/graph-replay.h" |
| 24 #include "src/compiler/graph-trimmer.h" | 26 #include "src/compiler/graph-trimmer.h" |
| 25 #include "src/compiler/graph-visualizer.h" | 27 #include "src/compiler/graph-visualizer.h" |
| 26 #include "src/compiler/greedy-allocator.h" | 28 #include "src/compiler/greedy-allocator.h" |
| 27 #include "src/compiler/instruction.h" | 29 #include "src/compiler/instruction.h" |
| 28 #include "src/compiler/instruction-selector.h" | 30 #include "src/compiler/instruction-selector.h" |
| 29 #include "src/compiler/js-builtin-reducer.h" | 31 #include "src/compiler/js-builtin-reducer.h" |
| 30 #include "src/compiler/js-call-reducer.h" | 32 #include "src/compiler/js-call-reducer.h" |
| 31 #include "src/compiler/js-context-relaxation.h" | 33 #include "src/compiler/js-context-relaxation.h" |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 data->jsgraph(), temp_zone); | 618 data->jsgraph(), temp_zone); |
| 617 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), | 619 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), |
| 618 data->common()); | 620 data->common()); |
| 619 AddReducer(data, &graph_reducer, &branch_condition_elimination); | 621 AddReducer(data, &graph_reducer, &branch_condition_elimination); |
| 620 AddReducer(data, &graph_reducer, &dead_code_elimination); | 622 AddReducer(data, &graph_reducer, &dead_code_elimination); |
| 621 graph_reducer.ReduceGraph(); | 623 graph_reducer.ReduceGraph(); |
| 622 } | 624 } |
| 623 }; | 625 }; |
| 624 | 626 |
| 625 | 627 |
| 628 struct EscapeAnalysisPhase { |
| 629 static const char* phase_name() { return "escape analysis"; } |
| 630 |
| 631 void Run(PipelineData* data, Zone* temp_zone) { |
| 632 EscapeStatusAnalysis escape_status(data->graph(), temp_zone); |
| 633 escape_status.Run(); |
| 634 EscapeObjectAnalysis escape_analysis(data->graph(), |
| 635 data->jsgraph()->common(), temp_zone); |
| 636 escape_analysis.Run(); |
| 637 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); |
| 638 EscapeAnalysisReducer escape_reducer(&graph_reducer, data->jsgraph(), |
| 639 &escape_status, &escape_analysis, |
| 640 temp_zone); |
| 641 AddReducer(data, &graph_reducer, &escape_reducer); |
| 642 graph_reducer.ReduceGraph(); |
| 643 } |
| 644 }; |
| 645 |
| 646 |
| 626 struct SimplifiedLoweringPhase { | 647 struct SimplifiedLoweringPhase { |
| 627 static const char* phase_name() { return "simplified lowering"; } | 648 static const char* phase_name() { return "simplified lowering"; } |
| 628 | 649 |
| 629 void Run(PipelineData* data, Zone* temp_zone) { | 650 void Run(PipelineData* data, Zone* temp_zone) { |
| 630 SimplifiedLowering lowering(data->jsgraph(), temp_zone, | 651 SimplifiedLowering lowering(data->jsgraph(), temp_zone, |
| 631 data->source_positions()); | 652 data->source_positions()); |
| 632 lowering.LowerAllNodes(); | 653 lowering.LowerAllNodes(); |
| 633 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); | 654 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); |
| 634 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), | 655 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), |
| 635 data->common()); | 656 data->common()); |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 if (info()->is_typing_enabled()) { | 1135 if (info()->is_typing_enabled()) { |
| 1115 // Lower JSOperators where we can determine types. | 1136 // Lower JSOperators where we can determine types. |
| 1116 Run<TypedLoweringPhase>(); | 1137 Run<TypedLoweringPhase>(); |
| 1117 RunPrintAndVerify("Lowered typed"); | 1138 RunPrintAndVerify("Lowered typed"); |
| 1118 | 1139 |
| 1119 if (FLAG_turbo_stress_loop_peeling) { | 1140 if (FLAG_turbo_stress_loop_peeling) { |
| 1120 Run<StressLoopPeelingPhase>(); | 1141 Run<StressLoopPeelingPhase>(); |
| 1121 RunPrintAndVerify("Loop peeled"); | 1142 RunPrintAndVerify("Loop peeled"); |
| 1122 } | 1143 } |
| 1123 | 1144 |
| 1145 if (FLAG_turbo_escape) { |
| 1146 Run<EscapeAnalysisPhase>(); |
| 1147 RunPrintAndVerify("Escape Analysed"); |
| 1148 } |
| 1149 |
| 1124 // Lower simplified operators and insert changes. | 1150 // Lower simplified operators and insert changes. |
| 1125 Run<SimplifiedLoweringPhase>(); | 1151 Run<SimplifiedLoweringPhase>(); |
| 1126 RunPrintAndVerify("Lowered simplified"); | 1152 RunPrintAndVerify("Lowered simplified"); |
| 1127 | 1153 |
| 1128 Run<BranchEliminationPhase>(); | 1154 Run<BranchEliminationPhase>(); |
| 1129 RunPrintAndVerify("Branch conditions eliminated"); | 1155 RunPrintAndVerify("Branch conditions eliminated"); |
| 1130 | 1156 |
| 1131 // Optimize control flow. | 1157 // Optimize control flow. |
| 1132 if (FLAG_turbo_cf_optimization) { | 1158 if (FLAG_turbo_cf_optimization) { |
| 1133 Run<ControlFlowOptimizationPhase>(); | 1159 Run<ControlFlowOptimizationPhase>(); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 tcf << AsC1VRegisterAllocationData("CodeGen", | 1450 tcf << AsC1VRegisterAllocationData("CodeGen", |
| 1425 data->register_allocation_data()); | 1451 data->register_allocation_data()); |
| 1426 } | 1452 } |
| 1427 | 1453 |
| 1428 data->DeleteRegisterAllocationZone(); | 1454 data->DeleteRegisterAllocationZone(); |
| 1429 } | 1455 } |
| 1430 | 1456 |
| 1431 } // namespace compiler | 1457 } // namespace compiler |
| 1432 } // namespace internal | 1458 } // namespace internal |
| 1433 } // namespace v8 | 1459 } // namespace v8 |
| OLD | NEW |