Index: src/compiler/arm/instruction-selector-arm.cc |
diff --git a/src/compiler/arm/instruction-selector-arm.cc b/src/compiler/arm/instruction-selector-arm.cc |
index 1fdc12b9032862a0663f0930a3f5bfbe3e9beb10..9327b124de71b038679b7052b1f8c61f91bc3e5f 100644 |
--- a/src/compiler/arm/instruction-selector-arm.cc |
+++ b/src/compiler/arm/instruction-selector-arm.cc |
@@ -252,7 +252,14 @@ void VisitBinop(InstructionSelector* selector, Node* node, |
inputs[input_count++] = g.Label(cont->false_block()); |
} |
- outputs[output_count++] = g.DefineAsRegister(node); |
+ if (cont->IsDeoptimize()) { |
+ // If we can deoptimize as a result of the binop, we need to make sure that |
+ // the deopt inputs are not overwritten by the binop result. One way |
+ // to achieve that is to declare the output register as same-as-first. |
+ outputs[output_count++] = g.DefineSameAsFirst(node); |
+ } else { |
+ outputs[output_count++] = g.DefineAsRegister(node); |
+ } |
if (cont->IsSet()) { |
outputs[output_count++] = g.DefineAsRegister(cont->result()); |
} |