Index: src/compiler/ppc/instruction-selector-ppc.cc |
diff --git a/src/compiler/ppc/instruction-selector-ppc.cc b/src/compiler/ppc/instruction-selector-ppc.cc |
index b724001e927ff972f88a06b43ab4f14d134518a1..02a5c2a4a527671f8b4a82a5e5d110073739914f 100644 |
--- a/src/compiler/ppc/instruction-selector-ppc.cc |
+++ b/src/compiler/ppc/instruction-selector-ppc.cc |
@@ -134,7 +134,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()); |
} |