Revision: 10226
Author:   [email protected]
Date:     Fri Dec  9 04:11:56 2011
Log: Fixing bug introduced in r10210 that crashes v8 raytrace benchmark.

BUG=
TEST=

Review URL: http://codereview.chromium.org/8889047
http://code.google.com/p/v8/source/detail?r=10226

Modified:
 /branches/bleeding_edge/src/arm/code-stubs-arm.cc
 /branches/bleeding_edge/test/mjsunit/math-pow.js

=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Fri Dec 9 01:26:14 2011 +++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Fri Dec 9 04:11:56 2011
@@ -3515,14 +3515,14 @@
   }

   if (exponent_type_ != INTEGER) {
+    Label int_exponent_convert;
     // Detect integer exponents stored as double.
     __ vcvt_u32_f64(single_scratch, double_exponent);
// We do not check for NaN or Infinity here because comparing numbers on
     // ARM correctly distinguishes NaNs.  We end up calling the built-in.
     __ vcvt_f64_u32(double_scratch, single_scratch);
     __ VFPCompareAndSetFlags(double_scratch, double_exponent);
-    __ vmov(exponent, single_scratch, eq);
-    __ b(eq, &int_exponent);
+    __ b(eq, &int_exponent_convert);

     if (exponent_type_ == ON_STACK) {
       // Detect square root case.  Crankshaft detects constant +/-0.5 at
@@ -3579,6 +3579,10 @@
     __ pop(lr);
     __ GetCFunctionDoubleResult(double_result);
     __ jmp(&done);
+
+    __ bind(&int_exponent_convert);
+    __ vcvt_u32_f64(single_scratch, double_exponent);
+    __ vmov(exponent, single_scratch);
   }

   // Calculate power with integer exponent.
@@ -3629,7 +3633,7 @@
             FieldMemOperand(heapnumber, HeapNumber::kValueOffset));
     ASSERT(heapnumber.is(r0));
     __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2);
-    __ Ret(2 * kPointerSize);
+    __ Ret(2);
   } else {
     __ push(lr);
     {
=======================================
--- /branches/bleeding_edge/test/mjsunit/math-pow.js Tue Dec 6 05:30:22 2011 +++ /branches/bleeding_edge/test/mjsunit/math-pow.js Fri Dec 9 04:11:56 2011
@@ -141,6 +141,9 @@
   assertEquals(0.25, Math.pow(16, -0.5));
   assertEquals(NaN, Math.pow(-16, -0.5));

+  // Test detecting and converting integer value as double.
+  assertEquals(8, Math.pow(2, Math.sqrt(9)));
+
   // Tests from Mozilla 15.8.2.13.
   assertEquals(2, Math.pow.length);
   assertEquals(NaN, Math.pow());

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to