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

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

Issue 2159303002: [turbofan] Improve the store-store elimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@p1-base
Patch Set: Fix merge conflict Created 4 years, 4 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 | « no previous file | src/compiler/store-store-elimination.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 <memory> 8 #include <memory>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 // Post-pass for wiring the control/effects 1051 // Post-pass for wiring the control/effects
1052 // - connect allocating representation changes into the control&effect 1052 // - connect allocating representation changes into the control&effect
1053 // chains and lower them, 1053 // chains and lower them,
1054 // - get rid of the region markers, 1054 // - get rid of the region markers,
1055 // - introduce effect phis and rewire effects to get SSA again. 1055 // - introduce effect phis and rewire effects to get SSA again.
1056 EffectControlLinearizer linearizer(data->jsgraph(), schedule, temp_zone); 1056 EffectControlLinearizer linearizer(data->jsgraph(), schedule, temp_zone);
1057 linearizer.Run(); 1057 linearizer.Run();
1058 } 1058 }
1059 }; 1059 };
1060 1060
1061 // The store-store elimination greatly benefits from doing a common operator
1062 // reducer just before it, to eliminate conditional deopts with a constant
1063 // condition.
1064
1065 struct DeadCodeEliminationPhase {
1066 static const char* phase_name() { return "common operator reducer"; }
1067
1068 void Run(PipelineData* data, Zone* temp_zone) {
1069 // Run the common operator reducer.
1070 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
1071 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
1072 data->common());
1073 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
1074 data->common(), data->machine());
1075 AddReducer(data, &graph_reducer, &dead_code_elimination);
1076 AddReducer(data, &graph_reducer, &common_reducer);
1077 graph_reducer.ReduceGraph();
1078 }
1079 };
1080
1061 struct StoreStoreEliminationPhase { 1081 struct StoreStoreEliminationPhase {
1062 static const char* phase_name() { return "Store-store elimination"; } 1082 static const char* phase_name() { return "store-store elimination"; }
1063 1083
1064 void Run(PipelineData* data, Zone* temp_zone) { 1084 void Run(PipelineData* data, Zone* temp_zone) {
1065 StoreStoreElimination store_store_elimination(data->jsgraph(), temp_zone); 1085 GraphTrimmer trimmer(temp_zone, data->graph());
1066 store_store_elimination.Run(); 1086 NodeVector roots(temp_zone);
1087 data->jsgraph()->GetCachedNodes(&roots);
1088 trimmer.TrimGraph(roots.begin(), roots.end());
1089
1090 StoreStoreElimination::Run(data->jsgraph(), temp_zone);
1067 } 1091 }
1068 }; 1092 };
1069 1093
1070 struct LoadEliminationPhase { 1094 struct LoadEliminationPhase {
1071 static const char* phase_name() { return "load elimination"; } 1095 static const char* phase_name() { return "load elimination"; }
1072 1096
1073 void Run(PipelineData* data, Zone* temp_zone) { 1097 void Run(PipelineData* data, Zone* temp_zone) {
1074 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 1098 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
1075 BranchElimination branch_condition_elimination(&graph_reducer, 1099 BranchElimination branch_condition_elimination(&graph_reducer,
1076 data->jsgraph(), temp_zone); 1100 data->jsgraph(), temp_zone);
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 1571
1548 data->BeginPhaseKind("block building"); 1572 data->BeginPhaseKind("block building");
1549 1573
1550 // Run early optimization pass. 1574 // Run early optimization pass.
1551 Run<EarlyOptimizationPhase>(); 1575 Run<EarlyOptimizationPhase>();
1552 RunPrintAndVerify("Early optimized", true); 1576 RunPrintAndVerify("Early optimized", true);
1553 1577
1554 Run<EffectControlLinearizationPhase>(); 1578 Run<EffectControlLinearizationPhase>();
1555 RunPrintAndVerify("Effect and control linearized", true); 1579 RunPrintAndVerify("Effect and control linearized", true);
1556 1580
1581 Run<DeadCodeEliminationPhase>();
1582 RunPrintAndVerify("Common operator reducer", true);
1583
1557 if (FLAG_turbo_store_elimination) { 1584 if (FLAG_turbo_store_elimination) {
1558 Run<StoreStoreEliminationPhase>(); 1585 Run<StoreStoreEliminationPhase>();
1559 RunPrintAndVerify("Store-store elimination", true); 1586 RunPrintAndVerify("Store-store elimination", true);
1560 } 1587 }
1561 1588
1562 // Optimize control flow. 1589 // Optimize control flow.
1563 if (FLAG_turbo_cf_optimization) { 1590 if (FLAG_turbo_cf_optimization) {
1564 Run<ControlFlowOptimizationPhase>(); 1591 Run<ControlFlowOptimizationPhase>();
1565 RunPrintAndVerify("Control flow optimized", true); 1592 RunPrintAndVerify("Control flow optimized", true);
1566 } 1593 }
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 data->DeleteRegisterAllocationZone(); 1924 data->DeleteRegisterAllocationZone();
1898 } 1925 }
1899 1926
1900 CompilationInfo* PipelineImpl::info() const { return data_->info(); } 1927 CompilationInfo* PipelineImpl::info() const { return data_->info(); }
1901 1928
1902 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } 1929 Isolate* PipelineImpl::isolate() const { return info()->isolate(); }
1903 1930
1904 } // namespace compiler 1931 } // namespace compiler
1905 } // namespace internal 1932 } // namespace internal
1906 } // namespace v8 1933 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/store-store-elimination.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698