Revision: 21317
Author:   [email protected]
Date:     Wed May 14 17:34:09 2014 UTC
Log:      MIPS: Fix FlooringDivByPowerOf2I.

Port r21313 (3b4cb0b)

Original commit message:
Fix for divisor=1, found during code inspection. We can't hit this bug, due to HDiv::Canonicalize() discarding the operation, but it might avoid a future bug
hunt. Patch also includes a small tidying of the ARM64 code.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/277893003

Patch from Balazs Kilvady <[email protected]>.
http://code.google.com/p/v8/source/detail?r=21317

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

=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Mon May 12 13:47:01 2014 UTC +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed May 14 17:34:09 2014 UTC
@@ -1297,10 +1297,15 @@
   int32_t divisor = instr->divisor();
   Register scratch = scratch0();
   ASSERT(!scratch.is(dividend));
+
+  // If the divisor is 1, return the dividend.
+  if (divisor == 1) {
+    __ Move(result, dividend);
+    return;
+  }

// If the divisor is positive, things are easy: There can be no deopts and we
   // can simply do an arithmetic right shift.
-  if (divisor == 1) return;
   uint16_t shift = WhichPowerOf2Abs(divisor);
   if (divisor > 1) {
     __ sra(result, dividend, shift);

--
--
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