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

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

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/graph-reducer.h ('k') | src/compiler/js-inlining.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/graph-reducer.cc
diff --git a/src/compiler/graph-reducer.cc b/src/compiler/graph-reducer.cc
index 8718815e1f22b7f4deef542094b6bcd4b2b06610..0f347adbe1e0ec56d61d4b31b59e4d44e5b1dae8 100644
--- a/src/compiler/graph-reducer.cc
+++ b/src/compiler/graph-reducer.cc
@@ -25,8 +25,11 @@ enum class GraphReducer::State : uint8_t {
};
-GraphReducer::GraphReducer(Graph* graph, Zone* zone)
+GraphReducer::GraphReducer(Zone* zone, Graph* graph, Node* dead_value,
+ Node* dead_control)
: graph_(graph),
+ dead_value_(dead_value),
+ dead_control_(dead_control),
state_(graph, 4),
reducers_(zone),
revisit_(zone),
@@ -212,7 +215,7 @@ void GraphReducer::Replace(Node* node, Node* replacement, NodeId max_id) {
void GraphReducer::ReplaceWithValue(Node* node, Node* value, Node* effect,
Node* control) {
- if (!effect && node->op()->EffectInputCount() > 0) {
+ if (effect == nullptr && node->op()->EffectInputCount() > 0) {
effect = NodeProperties::GetEffectInput(node);
}
if (control == nullptr && node->op()->ControlInputCount() > 0) {
@@ -226,9 +229,11 @@ void GraphReducer::ReplaceWithValue(Node* node, Node* value, Node* effect,
if (user->opcode() == IrOpcode::kIfSuccess) {
Replace(user, control);
} else if (user->opcode() == IrOpcode::kIfException) {
- // TODO(titzer): replace with dead control from JSGraph, and
- // require the control reducer to propagate it.
- UNREACHABLE();
+ for (Edge e : user->use_edges()) {
+ if (NodeProperties::IsValueEdge(e)) e.UpdateTo(dead_value_);
+ if (NodeProperties::IsControlEdge(e)) e.UpdateTo(dead_control_);
+ }
+ user->Kill();
} else {
UNREACHABLE();
}
« no previous file with comments | « src/compiler/graph-reducer.h ('k') | src/compiler/js-inlining.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698