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

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

Issue 2135123002: [turbofan] Eliminate a few redundant bounds checks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix BranchElimination to play well with the other reducers. Created 4 years, 5 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
« no previous file with comments | « src/compiler/branch-elimination.cc ('k') | src/compiler/simplified-lowering.cc » ('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"
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 AddReducer(data, &graph_reducer, &intrinsic_lowering); 912 AddReducer(data, &graph_reducer, &intrinsic_lowering);
913 AddReducer(data, &graph_reducer, &value_numbering); 913 AddReducer(data, &graph_reducer, &value_numbering);
914 AddReducer(data, &graph_reducer, &simple_reducer); 914 AddReducer(data, &graph_reducer, &simple_reducer);
915 AddReducer(data, &graph_reducer, &checkpoint_elimination); 915 AddReducer(data, &graph_reducer, &checkpoint_elimination);
916 AddReducer(data, &graph_reducer, &common_reducer); 916 AddReducer(data, &graph_reducer, &common_reducer);
917 graph_reducer.ReduceGraph(); 917 graph_reducer.ReduceGraph();
918 } 918 }
919 }; 919 };
920 920
921 921
922 struct BranchEliminationPhase {
923 static const char* phase_name() { return "branch condition elimination"; }
924
925 void Run(PipelineData* data, Zone* temp_zone) {
926 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
927 BranchElimination branch_condition_elimination(&graph_reducer,
928 data->jsgraph(), temp_zone);
929 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
930 data->common());
931 AddReducer(data, &graph_reducer, &branch_condition_elimination);
932 AddReducer(data, &graph_reducer, &dead_code_elimination);
933 graph_reducer.ReduceGraph();
934 }
935 };
936
937
938 struct EscapeAnalysisPhase { 922 struct EscapeAnalysisPhase {
939 static const char* phase_name() { return "escape analysis"; } 923 static const char* phase_name() { return "escape analysis"; }
940 924
941 void Run(PipelineData* data, Zone* temp_zone) { 925 void Run(PipelineData* data, Zone* temp_zone) {
942 EscapeAnalysis escape_analysis(data->graph(), data->jsgraph()->common(), 926 EscapeAnalysis escape_analysis(data->graph(), data->jsgraph()->common(),
943 temp_zone); 927 temp_zone);
944 escape_analysis.Run(); 928 escape_analysis.Run();
945 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 929 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
946 EscapeAnalysisReducer escape_reducer(&graph_reducer, data->jsgraph(), 930 EscapeAnalysisReducer escape_reducer(&graph_reducer, data->jsgraph(),
947 &escape_analysis, temp_zone); 931 &escape_analysis, temp_zone);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 MemoryOptimizer optimizer(data->jsgraph(), temp_zone); 1054 MemoryOptimizer optimizer(data->jsgraph(), temp_zone);
1071 optimizer.Optimize(); 1055 optimizer.Optimize();
1072 } 1056 }
1073 }; 1057 };
1074 1058
1075 struct LateOptimizationPhase { 1059 struct LateOptimizationPhase {
1076 static const char* phase_name() { return "late optimization"; } 1060 static const char* phase_name() { return "late optimization"; }
1077 1061
1078 void Run(PipelineData* data, Zone* temp_zone) { 1062 void Run(PipelineData* data, Zone* temp_zone) {
1079 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 1063 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
1064 BranchElimination branch_condition_elimination(&graph_reducer,
1065 data->jsgraph(), temp_zone);
1080 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), 1066 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
1081 data->common()); 1067 data->common());
1082 ValueNumberingReducer value_numbering(temp_zone); 1068 ValueNumberingReducer value_numbering(temp_zone);
1083 MachineOperatorReducer machine_reducer(data->jsgraph()); 1069 MachineOperatorReducer machine_reducer(data->jsgraph());
1084 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), 1070 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
1085 data->common(), data->machine()); 1071 data->common(), data->machine());
1086 SelectLowering select_lowering(data->jsgraph()->graph(), 1072 SelectLowering select_lowering(data->jsgraph()->graph(),
1087 data->jsgraph()->common()); 1073 data->jsgraph()->common());
1088 TailCallOptimization tco(data->common(), data->graph()); 1074 TailCallOptimization tco(data->common(), data->graph());
1075 AddReducer(data, &graph_reducer, &branch_condition_elimination);
1089 AddReducer(data, &graph_reducer, &dead_code_elimination); 1076 AddReducer(data, &graph_reducer, &dead_code_elimination);
1090 AddReducer(data, &graph_reducer, &value_numbering); 1077 AddReducer(data, &graph_reducer, &value_numbering);
1091 AddReducer(data, &graph_reducer, &machine_reducer); 1078 AddReducer(data, &graph_reducer, &machine_reducer);
1092 AddReducer(data, &graph_reducer, &common_reducer); 1079 AddReducer(data, &graph_reducer, &common_reducer);
1093 AddReducer(data, &graph_reducer, &select_lowering); 1080 AddReducer(data, &graph_reducer, &select_lowering);
1094 AddReducer(data, &graph_reducer, &tco); 1081 AddReducer(data, &graph_reducer, &tco);
1095 graph_reducer.ReduceGraph(); 1082 graph_reducer.ReduceGraph();
1096 } 1083 }
1097 }; 1084 };
1098 1085
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 data->BeginPhaseKind("block building"); 1491 data->BeginPhaseKind("block building");
1505 1492
1506 Run<EffectControlLinearizationPhase>(); 1493 Run<EffectControlLinearizationPhase>();
1507 RunPrintAndVerify("Effect and control linearized", true); 1494 RunPrintAndVerify("Effect and control linearized", true);
1508 1495
1509 if (FLAG_turbo_store_elimination) { 1496 if (FLAG_turbo_store_elimination) {
1510 Run<StoreStoreEliminationPhase>(); 1497 Run<StoreStoreEliminationPhase>();
1511 RunPrintAndVerify("Store-store elimination", true); 1498 RunPrintAndVerify("Store-store elimination", true);
1512 } 1499 }
1513 1500
1514 Run<BranchEliminationPhase>();
1515 RunPrintAndVerify("Branch conditions eliminated", true);
1516
1517 // Optimize control flow. 1501 // Optimize control flow.
1518 if (FLAG_turbo_cf_optimization) { 1502 if (FLAG_turbo_cf_optimization) {
1519 Run<ControlFlowOptimizationPhase>(); 1503 Run<ControlFlowOptimizationPhase>();
1520 RunPrintAndVerify("Control flow optimized", true); 1504 RunPrintAndVerify("Control flow optimized", true);
1521 } 1505 }
1522 1506
1523 // Optimize memory access and allocation operations. 1507 // Optimize memory access and allocation operations.
1524 Run<MemoryOptimizationPhase>(); 1508 Run<MemoryOptimizationPhase>();
1525 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. 1509 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
1526 RunPrintAndVerify("Memory optimized", true); 1510 RunPrintAndVerify("Memory optimized", true);
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 data->DeleteRegisterAllocationZone(); 1835 data->DeleteRegisterAllocationZone();
1852 } 1836 }
1853 1837
1854 CompilationInfo* PipelineImpl::info() const { return data_->info(); } 1838 CompilationInfo* PipelineImpl::info() const { return data_->info(); }
1855 1839
1856 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } 1840 Isolate* PipelineImpl::isolate() const { return info()->isolate(); }
1857 1841
1858 } // namespace compiler 1842 } // namespace compiler
1859 } // namespace internal 1843 } // namespace internal
1860 } // namespace v8 1844 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/branch-elimination.cc ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698