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

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

Issue 1376293005: [turbofan] Redundant branch elimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comments Created 5 years, 2 months 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
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/bytecode-graph-builder.h" 16 #include "src/compiler/bytecode-graph-builder.h"
16 #include "src/compiler/change-lowering.h" 17 #include "src/compiler/change-lowering.h"
17 #include "src/compiler/code-generator.h" 18 #include "src/compiler/code-generator.h"
18 #include "src/compiler/common-operator-reducer.h" 19 #include "src/compiler/common-operator-reducer.h"
19 #include "src/compiler/control-flow-optimizer.h" 20 #include "src/compiler/control-flow-optimizer.h"
20 #include "src/compiler/dead-code-elimination.h" 21 #include "src/compiler/dead-code-elimination.h"
21 #include "src/compiler/frame-elider.h" 22 #include "src/compiler/frame-elider.h"
22 #include "src/compiler/graph-replay.h" 23 #include "src/compiler/graph-replay.h"
23 #include "src/compiler/graph-trimmer.h" 24 #include "src/compiler/graph-trimmer.h"
24 #include "src/compiler/graph-visualizer.h" 25 #include "src/compiler/graph-visualizer.h"
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 AddReducer(data, &graph_reducer, &typed_lowering); 638 AddReducer(data, &graph_reducer, &typed_lowering);
638 AddReducer(data, &graph_reducer, &intrinsic_lowering); 639 AddReducer(data, &graph_reducer, &intrinsic_lowering);
639 AddReducer(data, &graph_reducer, &type_feedback_lowering); 640 AddReducer(data, &graph_reducer, &type_feedback_lowering);
640 AddReducer(data, &graph_reducer, &load_elimination); 641 AddReducer(data, &graph_reducer, &load_elimination);
641 AddReducer(data, &graph_reducer, &common_reducer); 642 AddReducer(data, &graph_reducer, &common_reducer);
642 graph_reducer.ReduceGraph(); 643 graph_reducer.ReduceGraph();
643 } 644 }
644 }; 645 };
645 646
646 647
648 struct BranchEliminationPhase {
649 static const char* phase_name() { return "branch condition elimination"; }
650
651 void Run(PipelineData* data, Zone* temp_zone) {
652 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
653 BranchElimination branch_condition_elimination(&graph_reducer,
654 data->jsgraph(), temp_zone);
655 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
656 data->common());
657 AddReducer(data, &graph_reducer, &branch_condition_elimination);
658 AddReducer(data, &graph_reducer, &dead_code_elimination);
659 graph_reducer.ReduceGraph();
660 }
661 };
662
663
647 struct SimplifiedLoweringPhase { 664 struct SimplifiedLoweringPhase {
648 static const char* phase_name() { return "simplified lowering"; } 665 static const char* phase_name() { return "simplified lowering"; }
649 666
650 void Run(PipelineData* data, Zone* temp_zone) { 667 void Run(PipelineData* data, Zone* temp_zone) {
651 SimplifiedLowering lowering(data->jsgraph(), temp_zone, 668 SimplifiedLowering lowering(data->jsgraph(), temp_zone,
652 data->source_positions()); 669 data->source_positions());
653 lowering.LowerAllNodes(); 670 lowering.LowerAllNodes();
654 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 671 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
655 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), 672 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
656 data->common()); 673 data->common());
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 1168
1152 if (info()->is_type_feedback_enabled()) { 1169 if (info()->is_type_feedback_enabled()) {
1153 Run<JSTypeFeedbackPhase>(); 1170 Run<JSTypeFeedbackPhase>();
1154 RunPrintAndVerify("JSType feedback"); 1171 RunPrintAndVerify("JSType feedback");
1155 } 1172 }
1156 1173
1157 // Lower simplified operators and insert changes. 1174 // Lower simplified operators and insert changes.
1158 Run<SimplifiedLoweringPhase>(); 1175 Run<SimplifiedLoweringPhase>();
1159 RunPrintAndVerify("Lowered simplified"); 1176 RunPrintAndVerify("Lowered simplified");
1160 1177
1178 Run<BranchEliminationPhase>();
1179 RunPrintAndVerify("Branch conditions eliminated");
1180
1161 // Optimize control flow. 1181 // Optimize control flow.
1162 if (FLAG_turbo_cf_optimization) { 1182 if (FLAG_turbo_cf_optimization) {
1163 Run<ControlFlowOptimizationPhase>(); 1183 Run<ControlFlowOptimizationPhase>();
1164 RunPrintAndVerify("Control flow optimized"); 1184 RunPrintAndVerify("Control flow optimized");
1165 } 1185 }
1166 1186
1167 // Lower changes that have been inserted before. 1187 // Lower changes that have been inserted before.
1168 Run<ChangeLoweringPhase>(); 1188 Run<ChangeLoweringPhase>();
1169 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. 1189 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
1170 RunPrintAndVerify("Lowered changes", true); 1190 RunPrintAndVerify("Lowered changes", true);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 tcf << AsC1VRegisterAllocationData("CodeGen", 1471 tcf << AsC1VRegisterAllocationData("CodeGen",
1452 data->register_allocation_data()); 1472 data->register_allocation_data());
1453 } 1473 }
1454 1474
1455 data->DeleteRegisterAllocationZone(); 1475 data->DeleteRegisterAllocationZone();
1456 } 1476 }
1457 1477
1458 } // namespace compiler 1478 } // namespace compiler
1459 } // namespace internal 1479 } // namespace internal
1460 } // namespace v8 1480 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/branch-elimination.cc ('k') | test/unittests/compiler/branch-elimination-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698