Commit 91f63b2e authored by Miran.Karic's avatar Miran.Karic Committed by Commit bot

MIPS: [turbofan] Make sure binop results do not overwrite deoptimization inputs on arm.

Port e60c4053

        this fix applies to mips as well.

BUG=
TEST=mjsunit/regress/regress-int32-truncation

Review-Url: https://codereview.chromium.org/2133503004
Cr-Commit-Position: refs/heads/master@{#37610}
parent 3660505e
...@@ -104,7 +104,14 @@ static void VisitBinop(InstructionSelector* selector, Node* node, ...@@ -104,7 +104,14 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
inputs[input_count++] = g.Label(cont->false_block()); 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()) { if (cont->IsSet()) {
outputs[output_count++] = g.DefineAsRegister(cont->result()); outputs[output_count++] = g.DefineAsRegister(cont->result());
} }
......
...@@ -109,7 +109,14 @@ static void VisitBinop(InstructionSelector* selector, Node* node, ...@@ -109,7 +109,14 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
inputs[input_count++] = g.Label(cont->false_block()); 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()) { if (cont->IsSet()) {
outputs[output_count++] = g.DefineAsRegister(cont->result()); outputs[output_count++] = g.DefineAsRegister(cont->result());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment