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

Unified Diff: src/compiler/graph-reducer.h

Issue 1168693002: [turbofan] Allow ReplaceWithValue to kill control. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 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
« no previous file with comments | « src/compiler/control-reducer.cc ('k') | src/compiler/graph-reducer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/graph-reducer.h
diff --git a/src/compiler/graph-reducer.h b/src/compiler/graph-reducer.h
index bd732d5808938b4cc0c3bcd0589615b867ea6a89..21e0a84b99c86021556848e316a66f7c0e6d15c9 100644
--- a/src/compiler/graph-reducer.h
+++ b/src/compiler/graph-reducer.h
@@ -77,9 +77,8 @@ class AdvancedReducer : public Reducer {
// Replace value uses of {node} with {value} and effect uses of {node} with
// {effect}. If {effect == NULL}, then use the effect input to {node}. All
// control uses will be relaxed assuming {node} cannot throw.
- virtual void ReplaceWithValue(Node* node, Node* value,
- Node* effect = nullptr,
- Node* control = nullptr) = 0;
+ virtual void ReplaceWithValue(Node* node, Node* value, Node* effect,
+ Node* control) = 0;
};
explicit AdvancedReducer(Editor* editor) : editor_(editor) {}
@@ -107,15 +106,13 @@ class AdvancedReducer : public Reducer {
// uses of {node} with the effect and control input to {node}.
// TODO(turbofan): replace the effect input to {node} with {graph->start()}.
void RelaxEffectsAndControls(Node* node) {
- DCHECK_NOT_NULL(editor_);
- editor_->ReplaceWithValue(node, node, nullptr, nullptr);
+ ReplaceWithValue(node, node, nullptr, nullptr);
}
// Relax the control uses of {node} by immediately replacing them with the
// control input to {node}.
void RelaxControls(Node* node) {
- DCHECK_NOT_NULL(editor_);
- editor_->ReplaceWithValue(node, node, node, nullptr);
+ ReplaceWithValue(node, node, node, nullptr);
}
private:
@@ -124,10 +121,11 @@ class AdvancedReducer : public Reducer {
// Performs an iterative reduction of a node graph.
-class GraphReducer final : public AdvancedReducer::Editor {
+class GraphReducer : public AdvancedReducer::Editor {
public:
- GraphReducer(Graph* graph, Zone* zone);
- ~GraphReducer() final;
+ GraphReducer(Zone* zone, Graph* graph, Node* dead_value = nullptr,
+ Node* dead_control = nullptr);
+ ~GraphReducer();
Graph* graph() const { return graph_; }
@@ -156,8 +154,8 @@ class GraphReducer final : public AdvancedReducer::Editor {
// Replace value uses of {node} with {value} and effect uses of {node} with
// {effect}. If {effect == NULL}, then use the effect input to {node}. All
// control uses will be relaxed assuming {node} cannot throw.
- void ReplaceWithValue(Node* node, Node* value, Node* effect = nullptr,
- Node* control = nullptr) final;
+ void ReplaceWithValue(Node* node, Node* value, Node* effect,
+ Node* control) final;
// Replace all uses of {node} with {replacement} if the id of {replacement} is
// less than or equal to {max_id}. Otherwise, replace all uses of {node} whose
@@ -173,6 +171,8 @@ class GraphReducer final : public AdvancedReducer::Editor {
void Revisit(Node* node) final;
Graph* const graph_;
+ Node* dead_value_;
+ Node* dead_control_;
NodeMarker<State> state_;
ZoneVector<Reducer*> reducers_;
ZoneStack<Node*> revisit_;
« no previous file with comments | « src/compiler/control-reducer.cc ('k') | src/compiler/graph-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698