Reviewers: Sven Panne,
Description:
X87: Fixed flooring division by a power of 2, once again...
Port r21769 (52e191b)
Original commit message:
Avoid right shifts by zero bits: On ARM it actually means shifting by
32 bits (correctness issue) and on other platforms they are useless
(performance issue). This is fix for the fix in r20544.
BUG=
Please review this at https://codereview.chromium.org/337513002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+8, -5 lines):
M src/x87/lithium-codegen-x87.cc
Index: src/x87/lithium-codegen-x87.cc
diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc
index
1e9168d4bb5c7b58c6dc310dc661877f1856b127..dab87688a3f870a8518a29d8b60724d8ab35200c
100644
--- a/src/x87/lithium-codegen-x87.cc
+++ b/src/x87/lithium-codegen-x87.cc
@@ -1546,14 +1546,17 @@ void
LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) {
DeoptimizeIf(zero, instr->environment());
}
- if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
- __ sar(dividend, shift);
+ // Dividing by -1 is basically negation, unless we overflow.
+ if (divisor == -1) {
+ if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
+ DeoptimizeIf(overflow, instr->environment());
+ }
return;
}
- // Dividing by -1 is basically negation, unless we overflow.
- if (divisor == -1) {
- DeoptimizeIf(overflow, instr->environment());
+ // If the negation could not overflow, simply shifting is OK.
+ if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
+ __ sar(dividend, shift);
return;
}
--
--
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.