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

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: Determined -> visited. 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
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 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 // Post-pass for wiring the control/effects 1025 // Post-pass for wiring the control/effects
1026 // - connect allocating representation changes into the control&effect 1026 // - connect allocating representation changes into the control&effect
1027 // chains and lower them, 1027 // chains and lower them,
1028 // - get rid of the region markers, 1028 // - get rid of the region markers,
1029 // - introduce effect phis and rewire effects to get SSA again. 1029 // - introduce effect phis and rewire effects to get SSA again.
1030 EffectControlLinearizer linearizer(data->jsgraph(), schedule, temp_zone); 1030 EffectControlLinearizer linearizer(data->jsgraph(), schedule, temp_zone);
1031 linearizer.Run(); 1031 linearizer.Run();
1032 } 1032 }
1033 }; 1033 };
1034 1034
1035 // The store-store elimination greatly benefits from doing a common operator
1036 // reducer just before it, to eliminate conditional deopts with a constant
1037 // condition.
1038
1039 struct DeadCodeEliminationPhase {
1040 static const char* phase_name() { return "common operator reducer"; }
1041
1042 void Run(PipelineData* data, Zone* temp_zone) {
1043 // Run the common operator reducer.
1044 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
1045 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
1046 data->common());
1047 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
1048 data->common(), data->machine());
1049 AddReducer(data, &graph_reducer, &dead_code_elimination);
1050 AddReducer(data, &graph_reducer, &common_reducer);
1051 graph_reducer.ReduceGraph();
1052 }
1053 };
1054
1035 struct StoreStoreEliminationPhase { 1055 struct StoreStoreEliminationPhase {
1036 static const char* phase_name() { return "Store-store elimination"; } 1056 static const char* phase_name() { return "store-store elimination"; }
1037 1057
1038 void Run(PipelineData* data, Zone* temp_zone) { 1058 void Run(PipelineData* data, Zone* temp_zone) {
1039 StoreStoreElimination store_store_elimination(data->jsgraph(), temp_zone); 1059 GraphTrimmer trimmer(temp_zone, data->graph());
1040 store_store_elimination.Run(); 1060 NodeVector roots(temp_zone);
1061 data->jsgraph()->GetCachedNodes(&roots);
1062 trimmer.TrimGraph(roots.begin(), roots.end());
1063
1064 StoreStoreElimination::Run(data->jsgraph(), temp_zone);
1041 } 1065 }
1042 }; 1066 };
1043 1067
1044 struct LoadEliminationPhase { 1068 struct LoadEliminationPhase {
1045 static const char* phase_name() { return "load elimination"; } 1069 static const char* phase_name() { return "load elimination"; }
1046 1070
1047 void Run(PipelineData* data, Zone* temp_zone) { 1071 void Run(PipelineData* data, Zone* temp_zone) {
1048 // The memory optimizer requires the graphs to be trimmed, so trim now. 1072 // The memory optimizer requires the graphs to be trimmed, so trim now.
1049 GraphTrimmer trimmer(temp_zone, data->graph()); 1073 GraphTrimmer trimmer(temp_zone, data->graph());
1050 NodeVector roots(temp_zone); 1074 NodeVector roots(temp_zone);
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 } 1535 }
1512 1536
1513 bool PipelineImpl::OptimizeGraph(Linkage* linkage) { 1537 bool PipelineImpl::OptimizeGraph(Linkage* linkage) {
1514 PipelineData* data = this->data_; 1538 PipelineData* data = this->data_;
1515 1539
1516 data->BeginPhaseKind("block building"); 1540 data->BeginPhaseKind("block building");
1517 1541
1518 Run<EffectControlLinearizationPhase>(); 1542 Run<EffectControlLinearizationPhase>();
1519 RunPrintAndVerify("Effect and control linearized", true); 1543 RunPrintAndVerify("Effect and control linearized", true);
1520 1544
1545 Run<DeadCodeEliminationPhase>();
1546 RunPrintAndVerify("Common operator reducer", true);
1547
1521 if (FLAG_turbo_store_elimination) { 1548 if (FLAG_turbo_store_elimination) {
1522 Run<StoreStoreEliminationPhase>(); 1549 Run<StoreStoreEliminationPhase>();
1523 RunPrintAndVerify("Store-store elimination", true); 1550 RunPrintAndVerify("Store-store elimination", true);
1524 } 1551 }
1525 1552
1526 // Optimize control flow. 1553 // Optimize control flow.
1527 if (FLAG_turbo_cf_optimization) { 1554 if (FLAG_turbo_cf_optimization) {
1528 Run<ControlFlowOptimizationPhase>(); 1555 Run<ControlFlowOptimizationPhase>();
1529 RunPrintAndVerify("Control flow optimized", true); 1556 RunPrintAndVerify("Control flow optimized", true);
1530 } 1557 }
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 data->DeleteRegisterAllocationZone(); 1887 data->DeleteRegisterAllocationZone();
1861 } 1888 }
1862 1889
1863 CompilationInfo* PipelineImpl::info() const { return data_->info(); } 1890 CompilationInfo* PipelineImpl::info() const { return data_->info(); }
1864 1891
1865 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } 1892 Isolate* PipelineImpl::isolate() const { return info()->isolate(); }
1866 1893
1867 } // namespace compiler 1894 } // namespace compiler
1868 } // namespace internal 1895 } // namespace internal
1869 } // namespace v8 1896 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/store-store-elimination.h » ('j') | src/compiler/store-store-elimination.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698