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

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: Loop test 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-condition-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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 AddReducer(data, &graph_reducer, &typed_lowering); 603 AddReducer(data, &graph_reducer, &typed_lowering);
603 AddReducer(data, &graph_reducer, &intrinsic_lowering); 604 AddReducer(data, &graph_reducer, &intrinsic_lowering);
604 AddReducer(data, &graph_reducer, &type_feedback_lowering); 605 AddReducer(data, &graph_reducer, &type_feedback_lowering);
605 AddReducer(data, &graph_reducer, &load_elimination); 606 AddReducer(data, &graph_reducer, &load_elimination);
606 AddReducer(data, &graph_reducer, &common_reducer); 607 AddReducer(data, &graph_reducer, &common_reducer);
607 graph_reducer.ReduceGraph(); 608 graph_reducer.ReduceGraph();
608 } 609 }
609 }; 610 };
610 611
611 612
613 struct BranchConditionEliminationPhase {
614 static const char* phase_name() { return "branch condition elimination"; }
615
616 void Run(PipelineData* data, Zone* temp_zone) {
617 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
618 BranchConditionElimination branch_condition_elimination(
619 &graph_reducer, data->jsgraph(), temp_zone);
620 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
621 data->common());
622 AddReducer(data, &graph_reducer, &branch_condition_elimination);
623 AddReducer(data, &graph_reducer, &dead_code_elimination);
624 graph_reducer.ReduceGraph();
625 }
626 };
627
628
612 struct SimplifiedLoweringPhase { 629 struct SimplifiedLoweringPhase {
613 static const char* phase_name() { return "simplified lowering"; } 630 static const char* phase_name() { return "simplified lowering"; }
614 631
615 void Run(PipelineData* data, Zone* temp_zone) { 632 void Run(PipelineData* data, Zone* temp_zone) {
616 SimplifiedLowering lowering(data->jsgraph(), temp_zone, 633 SimplifiedLowering lowering(data->jsgraph(), temp_zone,
617 data->source_positions()); 634 data->source_positions());
618 lowering.LowerAllNodes(); 635 lowering.LowerAllNodes();
619 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 636 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
620 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), 637 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
621 data->common()); 638 data->common());
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 1127
1111 if (info()->is_type_feedback_enabled()) { 1128 if (info()->is_type_feedback_enabled()) {
1112 Run<JSTypeFeedbackPhase>(); 1129 Run<JSTypeFeedbackPhase>();
1113 RunPrintAndVerify("JSType feedback"); 1130 RunPrintAndVerify("JSType feedback");
1114 } 1131 }
1115 1132
1116 // Lower simplified operators and insert changes. 1133 // Lower simplified operators and insert changes.
1117 Run<SimplifiedLoweringPhase>(); 1134 Run<SimplifiedLoweringPhase>();
1118 RunPrintAndVerify("Lowered simplified"); 1135 RunPrintAndVerify("Lowered simplified");
1119 1136
1137 Run<BranchConditionEliminationPhase>();
1138 RunPrintAndVerify("Branch conditions eliminated");
1139
1120 // Optimize control flow. 1140 // Optimize control flow.
1121 if (FLAG_turbo_cf_optimization) { 1141 if (FLAG_turbo_cf_optimization) {
1122 Run<ControlFlowOptimizationPhase>(); 1142 Run<ControlFlowOptimizationPhase>();
1123 RunPrintAndVerify("Control flow optimized"); 1143 RunPrintAndVerify("Control flow optimized");
1124 } 1144 }
1125 1145
1126 // Lower changes that have been inserted before. 1146 // Lower changes that have been inserted before.
1127 Run<ChangeLoweringPhase>(); 1147 Run<ChangeLoweringPhase>();
1128 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. 1148 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
1129 RunPrintAndVerify("Lowered changes", true); 1149 RunPrintAndVerify("Lowered changes", true);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 tcf << AsC1VRegisterAllocationData("CodeGen", 1430 tcf << AsC1VRegisterAllocationData("CodeGen",
1411 data->register_allocation_data()); 1431 data->register_allocation_data());
1412 } 1432 }
1413 1433
1414 data->DeleteRegisterAllocationZone(); 1434 data->DeleteRegisterAllocationZone();
1415 } 1435 }
1416 1436
1417 } // namespace compiler 1437 } // namespace compiler
1418 } // namespace internal 1438 } // namespace internal
1419 } // namespace v8 1439 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698