Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(925)

Side by Side Diff: src/compiler/pipeline.cc

Issue 1457683003: [turbofan] Initial support for escape analysis. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/escape-analysis-reducer.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 data->jsgraph(), temp_zone); 641 data->jsgraph(), temp_zone);
640 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), 642 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
641 data->common()); 643 data->common());
642 AddReducer(data, &graph_reducer, &branch_condition_elimination); 644 AddReducer(data, &graph_reducer, &branch_condition_elimination);
643 AddReducer(data, &graph_reducer, &dead_code_elimination); 645 AddReducer(data, &graph_reducer, &dead_code_elimination);
644 graph_reducer.ReduceGraph(); 646 graph_reducer.ReduceGraph();
645 } 647 }
646 }; 648 };
647 649
648 650
651 struct EscapeAnalysisPhase {
652 static const char* phase_name() { return "escape analysis"; }
653
654 void Run(PipelineData* data, Zone* temp_zone) {
655 EscapeObjectAnalysis escape_analysis(data->graph(),
656 data->jsgraph()->common(), temp_zone);
657 escape_analysis.Run();
658 EscapeStatusAnalysis escape_status(&escape_analysis, data->graph(),
659 temp_zone);
660 escape_status.Run();
661 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
662 EscapeAnalysisReducer escape_reducer(&graph_reducer, data->jsgraph(),
663 &escape_status, &escape_analysis,
664 temp_zone);
665 AddReducer(data, &graph_reducer, &escape_reducer);
666 graph_reducer.ReduceGraph();
667 }
668 };
669
670
649 struct SimplifiedLoweringPhase { 671 struct SimplifiedLoweringPhase {
650 static const char* phase_name() { return "simplified lowering"; } 672 static const char* phase_name() { return "simplified lowering"; }
651 673
652 void Run(PipelineData* data, Zone* temp_zone) { 674 void Run(PipelineData* data, Zone* temp_zone) {
653 SimplifiedLowering lowering(data->jsgraph(), temp_zone, 675 SimplifiedLowering lowering(data->jsgraph(), temp_zone,
654 data->source_positions()); 676 data->source_positions());
655 lowering.LowerAllNodes(); 677 lowering.LowerAllNodes();
656 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 678 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
657 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), 679 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
658 data->common()); 680 data->common());
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 if (info()->is_typing_enabled()) { 1163 if (info()->is_typing_enabled()) {
1142 // Lower JSOperators where we can determine types. 1164 // Lower JSOperators where we can determine types.
1143 Run<TypedLoweringPhase>(); 1165 Run<TypedLoweringPhase>();
1144 RunPrintAndVerify("Lowered typed"); 1166 RunPrintAndVerify("Lowered typed");
1145 1167
1146 if (FLAG_turbo_stress_loop_peeling) { 1168 if (FLAG_turbo_stress_loop_peeling) {
1147 Run<StressLoopPeelingPhase>(); 1169 Run<StressLoopPeelingPhase>();
1148 RunPrintAndVerify("Loop peeled"); 1170 RunPrintAndVerify("Loop peeled");
1149 } 1171 }
1150 1172
1173 if (FLAG_turbo_escape) {
1174 Run<EscapeAnalysisPhase>();
1175 RunPrintAndVerify("Escape Analysed");
1176 }
1177
1151 // Lower simplified operators and insert changes. 1178 // Lower simplified operators and insert changes.
1152 Run<SimplifiedLoweringPhase>(); 1179 Run<SimplifiedLoweringPhase>();
1153 RunPrintAndVerify("Lowered simplified"); 1180 RunPrintAndVerify("Lowered simplified");
1154 1181
1155 Run<BranchEliminationPhase>(); 1182 Run<BranchEliminationPhase>();
1156 RunPrintAndVerify("Branch conditions eliminated"); 1183 RunPrintAndVerify("Branch conditions eliminated");
1157 1184
1158 // Optimize control flow. 1185 // Optimize control flow.
1159 if (FLAG_turbo_cf_optimization) { 1186 if (FLAG_turbo_cf_optimization) {
1160 Run<ControlFlowOptimizationPhase>(); 1187 Run<ControlFlowOptimizationPhase>();
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 tcf << AsC1VRegisterAllocationData("CodeGen", 1478 tcf << AsC1VRegisterAllocationData("CodeGen",
1452 data->register_allocation_data()); 1479 data->register_allocation_data());
1453 } 1480 }
1454 1481
1455 data->DeleteRegisterAllocationZone(); 1482 data->DeleteRegisterAllocationZone();
1456 } 1483 }
1457 1484
1458 } // namespace compiler 1485 } // namespace compiler
1459 } // namespace internal 1486 } // namespace internal
1460 } // namespace v8 1487 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/escape-analysis-reducer.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698