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

Unified Diff: src/compiler/js-intrinsic-lowering.cc

Issue 1200983004: Revert of [turbofan] Run DeadCodeElimination together with the advanced reducers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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.cc ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-intrinsic-lowering.cc
diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc
index 0562010ed230e0e8cae0e8e1d5fc19650552e492..8e42ca3d63198d3949b25ee87cdf5c9c9e06e0ec 100644
--- a/src/compiler/js-intrinsic-lowering.cc
+++ b/src/compiler/js-intrinsic-lowering.cc
@@ -132,18 +132,31 @@
Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) {
if (mode() != kDeoptimizationEnabled) return NoChange();
- Node* const frame_state = NodeProperties::GetFrameStateInput(node, 0);
- Node* const effect = NodeProperties::GetEffectInput(node);
- Node* const control = NodeProperties::GetControlInput(node);
-
- // TODO(bmeurer): Move MergeControlToEnd() to the AdvancedReducer.
- Node* deoptimize =
- graph()->NewNode(common()->Deoptimize(), frame_state, effect, control);
- NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
-
- node->set_op(common()->Dead());
- node->TrimInputCount(0);
- return Changed(node);
+ Node* frame_state = NodeProperties::GetFrameStateInput(node, 0);
+ DCHECK_EQ(frame_state->opcode(), IrOpcode::kFrameState);
+
+ Node* effect = NodeProperties::GetEffectInput(node);
+ Node* control = NodeProperties::GetControlInput(node);
+
+ // We are making the continuation after the call dead. To
+ // model this, we generate if (true) statement with deopt
+ // in the true branch and continuation in the false branch.
+ Node* branch =
+ graph()->NewNode(common()->Branch(), jsgraph()->TrueConstant(), control);
+
+ // False branch - the original continuation.
+ Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
+ ReplaceWithValue(node, jsgraph()->UndefinedConstant(), effect, if_false);
+
+ // True branch: deopt.
+ Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
+ Node* deopt =
+ graph()->NewNode(common()->Deoptimize(), frame_state, effect, if_true);
+
+ // Connect the deopt to the merge exiting the graph.
+ NodeProperties::MergeControlToEnd(graph(), common(), deopt);
+
+ return Changed(deopt);
}
« no previous file with comments | « src/compiler/graph-reducer.cc ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698