Index: src/compiler/mips64/instruction-selector-mips64.cc |
diff --git a/src/compiler/mips64/instruction-selector-mips64.cc b/src/compiler/mips64/instruction-selector-mips64.cc |
index 3e1f98e5e27abbf1f824b1e922360affa89a6c9a..dca98f745df5a898d0b766f6d86e252280f18fe2 100644 |
--- a/src/compiler/mips64/instruction-selector-mips64.cc |
+++ b/src/compiler/mips64/instruction-selector-mips64.cc |
@@ -109,7 +109,14 @@ static 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()); |
} |