Revision: 21829
Author:   [email protected]
Date:     Fri Jun 13 07:03:11 2014 UTC
Log:      X87: Fixed flooring division by a power of 2, once again...

port r21769

original 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=v8:3259
    LOG=y
[email protected]

Review URL: https://codereview.chromium.org/330133004
http://code.google.com/p/v8/source/detail?r=21829

Modified:
 /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc

=======================================
--- /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Wed Jun 11 09:09:15 2014 UTC +++ /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Fri Jun 13 07:03:11 2014 UTC
@@ -1546,14 +1546,17 @@
     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.

Reply via email to