Index: src/compiler/js-intrinsic-lowering.cc |
diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc |
index 1e3de48799bd2bf80f652bc3c06f1d35ff2a9c1d..f4a886f88ca41b915d5d37a562ebfac045af25be 100644 |
--- a/src/compiler/js-intrinsic-lowering.cc |
+++ b/src/compiler/js-intrinsic-lowering.cc |
@@ -132,31 +132,18 @@ Reduction JSIntrinsicLowering::ReduceDateField(Node* node) { |
Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) { |
if (mode() != kDeoptimizationEnabled) return NoChange(); |
- 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); |
+ Node* const frame_state = NodeProperties::GetFrameStateInput(node, 0); |
+ Node* const effect = NodeProperties::GetEffectInput(node); |
+ Node* const control = NodeProperties::GetControlInput(node); |
- // Connect the deopt to the merge exiting the graph. |
- NodeProperties::MergeControlToEnd(graph(), common(), deopt); |
+ // TODO(bmeurer): Move MergeControlToEnd() to the AdvancedReducer. |
+ Node* deoptimize = |
+ graph()->NewNode(common()->Deoptimize(), frame_state, effect, control); |
+ NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); |
- return Changed(deopt); |
+ node->set_op(common()->Dead()); |
+ node->TrimInputCount(0); |
+ return Changed(node); |
} |