Revision: 21822
Author: [email protected]
Date: Thu Jun 12 20:25:47 2014 UTC
Log: MIPS: Fix r21780 - "Fixed flooring division by a power of 2, once
again..."
Initialize scratch register for all possible code paths.
TEST=mjsunit/compiler/division-by-constant.js
BUG=
[email protected]
Review URL: https://codereview.chromium.org/333713002
Patch from Balazs Kilvady <[email protected]>.
http://code.google.com/p/v8/source/detail?r=21822
Modified:
/branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed Jun 11
20:06:01 2014 UTC
+++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Thu Jun 12
20:25:47 2014 UTC
@@ -1327,18 +1327,18 @@
}
// If the divisor is negative, we have to negate and handle edge cases.
- if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
- // divident can be the same register as result so save the value of it
- // for checking overflow.
- __ Move(scratch, dividend);
- }
+
+ // dividend can be the same register as result so save the value of it
+ // for checking overflow.
+ __ Move(scratch, dividend);
+
__ Subu(result, zero_reg, dividend);
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
DeoptimizeIf(eq, instr->environment(), result, Operand(zero_reg));
}
// Dividing by -1 is basically negation, unless we overflow.
- __ Xor(at, scratch, result);
+ __ Xor(scratch, scratch, result);
if (divisor == -1) {
if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
DeoptimizeIf(ge, instr->environment(), at, Operand(zero_reg));
@@ -1353,7 +1353,7 @@
}
Label no_overflow, done;
- __ Branch(&no_overflow, lt, at, Operand(zero_reg));
+ __ Branch(&no_overflow, lt, scratch, Operand(zero_reg));
__ li(result, Operand(kMinInt / divisor));
__ Branch(&done);
__ bind(&no_overflow);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.