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 EscapeObjectAnalysis escape_analysis(data->graph(), |
| 633 data->jsgraph()->common(), temp_zone); |
| 634 escape_analysis.Run(); |
| 635 EscapeStatusAnalysis escape_status(&escape_analysis, data->graph(), |
| 636 temp_zone); |
| 637 escape_status.Run(); |
| 638 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); |
| 639 EscapeAnalysisReducer escape_reducer(&graph_reducer, data->jsgraph(), |
| 640 &escape_status, &escape_analysis, |
| 641 temp_zone); |
| 642 AddReducer(data, &graph_reducer, &escape_reducer); |
| 643 graph_reducer.ReduceGraph(); |
| 644 } |
| 645 }; |
| 646 |
| 647 |
626 struct SimplifiedLoweringPhase { | 648 struct SimplifiedLoweringPhase { |
627 static const char* phase_name() { return "simplified lowering"; } | 649 static const char* phase_name() { return "simplified lowering"; } |
628 | 650 |
629 void Run(PipelineData* data, Zone* temp_zone) { | 651 void Run(PipelineData* data, Zone* temp_zone) { |
630 SimplifiedLowering lowering(data->jsgraph(), temp_zone, | 652 SimplifiedLowering lowering(data->jsgraph(), temp_zone, |
631 data->source_positions()); | 653 data->source_positions()); |
632 lowering.LowerAllNodes(); | 654 lowering.LowerAllNodes(); |
633 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); | 655 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); |
634 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), | 656 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), |
635 data->common()); | 657 data->common()); |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 if (info()->is_typing_enabled()) { | 1136 if (info()->is_typing_enabled()) { |
1115 // Lower JSOperators where we can determine types. | 1137 // Lower JSOperators where we can determine types. |
1116 Run<TypedLoweringPhase>(); | 1138 Run<TypedLoweringPhase>(); |
1117 RunPrintAndVerify("Lowered typed"); | 1139 RunPrintAndVerify("Lowered typed"); |
1118 | 1140 |
1119 if (FLAG_turbo_stress_loop_peeling) { | 1141 if (FLAG_turbo_stress_loop_peeling) { |
1120 Run<StressLoopPeelingPhase>(); | 1142 Run<StressLoopPeelingPhase>(); |
1121 RunPrintAndVerify("Loop peeled"); | 1143 RunPrintAndVerify("Loop peeled"); |
1122 } | 1144 } |
1123 | 1145 |
| 1146 if (FLAG_turbo_escape) { |
| 1147 Run<EscapeAnalysisPhase>(); |
| 1148 RunPrintAndVerify("Escape Analysed"); |
| 1149 } |
| 1150 |
1124 // Lower simplified operators and insert changes. | 1151 // Lower simplified operators and insert changes. |
1125 Run<SimplifiedLoweringPhase>(); | 1152 Run<SimplifiedLoweringPhase>(); |
1126 RunPrintAndVerify("Lowered simplified"); | 1153 RunPrintAndVerify("Lowered simplified"); |
1127 | 1154 |
1128 Run<BranchEliminationPhase>(); | 1155 Run<BranchEliminationPhase>(); |
1129 RunPrintAndVerify("Branch conditions eliminated"); | 1156 RunPrintAndVerify("Branch conditions eliminated"); |
1130 | 1157 |
1131 // Optimize control flow. | 1158 // Optimize control flow. |
1132 if (FLAG_turbo_cf_optimization) { | 1159 if (FLAG_turbo_cf_optimization) { |
1133 Run<ControlFlowOptimizationPhase>(); | 1160 Run<ControlFlowOptimizationPhase>(); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 tcf << AsC1VRegisterAllocationData("CodeGen", | 1451 tcf << AsC1VRegisterAllocationData("CodeGen", |
1425 data->register_allocation_data()); | 1452 data->register_allocation_data()); |
1426 } | 1453 } |
1427 | 1454 |
1428 data->DeleteRegisterAllocationZone(); | 1455 data->DeleteRegisterAllocationZone(); |
1429 } | 1456 } |
1430 | 1457 |
1431 } // namespace compiler | 1458 } // namespace compiler |
1432 } // namespace internal | 1459 } // namespace internal |
1433 } // namespace v8 | 1460 } // namespace v8 |
OLD | NEW |