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

Unified Diff: src/compiler/pipeline.cc

Issue 2087483003: [compiler] Introduce a simple store-store elimination, disabled by default. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@p1
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index ff442dda9ec88a42c4bb7acdf19e6f9c40a0f88c..0457a5795870ad29188f04ced6efe8b058b7d32d 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -9,6 +9,7 @@
#include "src/base/adapters.h"
#include "src/base/platform/elapsed-timer.h"
+#include "src/compiler/all-nodes.h"
#include "src/compiler/ast-graph-builder.h"
#include "src/compiler/ast-loop-assignment-analyzer.h"
#include "src/compiler/basic-block-instrumentor.h"
@@ -57,6 +58,7 @@
#include "src/compiler/simplified-lowering.h"
#include "src/compiler/simplified-operator-reducer.h"
#include "src/compiler/simplified-operator.h"
+#include "src/compiler/store-store-elimination.h"
#include "src/compiler/tail-call-optimization.h"
#include "src/compiler/type-hint-analyzer.h"
#include "src/compiler/typer.h"
@@ -1028,6 +1030,37 @@ struct EffectControlLinearizationPhase {
}
};
+struct StoreStoreEliminationPhase {
+ static const char* phase_name() { return "Store-store elimination"; }
+
+ void Run(PipelineData* data, Zone* temp_zone) {
+ StoreStoreElimination store_store_elimination(data->jsgraph(), temp_zone);
+
+ // The store-store elimination does work on chains of certain types of
+ // nodes. The elimination must be invoked on the lowest node in such a
+ // chain; we have a helper function IsEligibleNode that returns true
+ // precisely on the lowest node in such a chain.
+ //
+ // Because the elimination removes nodes from the graph, even remove nodes
+ // that the elimination was not invoked on, we cannot use a normal
+ // AdvancedReducer but we manually find which nodes to invoke the
+ // elimination on. Then in a next step, we invoke the elimination for each
+ // node that was eligible.
+
+ NodeVector eligible(temp_zone);
Jarin 2016/06/21 13:28:32 Could we move this code into the StoreStoreElimina
bgeron 2016/06/21 17:48:58 Done.
+
+ for (Node* node : MarkingPreDFS(data->jsgraph()->graph())) {
+ if (StoreStoreElimination::IsEligibleNode(node)) {
+ eligible.push_back(node);
+ }
+ }
+
+ for (Node* node : eligible) {
+ store_store_elimination.ReduceEligibleNode(node);
+ }
+ }
+};
+
struct MemoryOptimizationPhase {
static const char* phase_name() { return "memory optimization"; }
@@ -1464,6 +1497,9 @@ bool PipelineImpl::OptimizeGraph(Linkage* linkage) {
Run<EffectControlLinearizationPhase>();
RunPrintAndVerify("Effect and control linearized", true);
+ Run<StoreStoreEliminationPhase>();
+ RunPrintAndVerify("Store-store elimination", true);
+
Run<BranchEliminationPhase>();
RunPrintAndVerify("Branch conditions eliminated", true);

Powered by Google App Engine
This is Rietveld 408576698