Revision: 18688
Author:   [email protected]
Date:     Mon Jan 20 11:30:48 2014 UTC
Log: DoubleToIStub can't use ip on armv6, because the ubfx impl will clobber it

This previous change broke DoubleToIStub on armv6:
https://code.google.com/p/v8/source/detail?r=16322

The problem is that DoubleToIStub::Generate assumed that it could safely use the ip register, but on armv6 the ubfx implementation will clobber any previous value stored there. So instead, pick another register.

Test case:
for (var i=0; i<2; i++) {
        v = 4294967295;
        v &= -2;
        print(v)
        }

This should print -2 twice, but on armv6 without this patch, it prints -2 followed by 2046.

This problem causes sunspider's bitops-nsieve-bit, crypto-md5 and crypto-sha1 tests to generate incorrect results (but the results are not checked for validity in sunspider-1.0 as available in chromium, but are checked and reported as incorrect in sunspider-1.0.2).

Thanks to Tomasz Kilarski for helping out with this.

[email protected], [email protected]

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

Patch from Mostyn Bramley-Moore <[email protected]>.
http://code.google.com/p/v8/source/detail?r=18688

Modified:
 /branches/bleeding_edge/src/arm/code-stubs-arm.cc

=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Wed Jan 15 17:00:35 2014 UTC +++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Mon Jan 20 11:30:48 2014 UTC
@@ -665,17 +665,16 @@

   int double_offset = offset();
   // Account for saved regs if input is sp.
-  if (input_reg.is(sp)) double_offset += 2 * kPointerSize;
+  if (input_reg.is(sp)) double_offset += 3 * kPointerSize;

- // Immediate values for this stub fit in instructions, so it's safe to use ip.
-  Register scratch = ip;
+  Register scratch = GetRegisterThatIsNotOneOf(input_reg, result_reg);
   Register scratch_low =
       GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch);
   Register scratch_high =
GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch, scratch_low);
   LowDwVfpRegister double_scratch = kScratchDoubleReg;

-  __ Push(scratch_high, scratch_low);
+  __ Push(scratch_high, scratch_low, scratch);

   if (!skip_fastpath()) {
     // Load double input.
@@ -758,7 +757,7 @@

   __ bind(&done);

-  __ Pop(scratch_high, scratch_low);
+  __ Pop(scratch_high, scratch_low, scratch);
   __ Ret();
 }

--
--
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/groups/opt_out.

Reply via email to