Revision: 12273
Author:   [email protected]
Date:     Wed Aug  8 00:44:17 2012
Log:      Fix parseInt's octal parsing behavior (ECMA-262 Annex E 15.1.2.2).

[email protected]
BUG=v8:1645
TEST=test262, parse-int-float.js

Review URL: https://chromiumcodereview.appspot.com/10836151
http://code.google.com/p/v8/source/detail?r=12273

Modified:
 /branches/bleeding_edge/src/conversions-inl.h
 /branches/bleeding_edge/test/mjsunit/parse-int-float.js
 /branches/bleeding_edge/test/test262/test262.status

=======================================
--- /branches/bleeding_edge/src/conversions-inl.h       Mon Jul 30 02:55:26 2012
+++ /branches/bleeding_edge/src/conversions-inl.h       Wed Aug  8 00:44:17 2012
@@ -268,6 +268,7 @@

   if (radix == 0) {
     // Radix detection.
+    radix = 10;
     if (*current == '0') {
       ++current;
       if (current == end) return SignedZero(negative);
@@ -276,11 +277,8 @@
         ++current;
         if (current == end) return JunkStringValue();
       } else {
-        radix = 8;
         leading_zero = true;
       }
-    } else {
-      radix = 10;
     }
   } else if (radix == 16) {
     if (*current == '0') {
=======================================
--- /branches/bleeding_edge/test/mjsunit/parse-int-float.js Fri Sep 2 04:38:40 2011 +++ /branches/bleeding_edge/test/mjsunit/parse-int-float.js Wed Aug 8 00:44:17 2012
@@ -29,10 +29,10 @@
 assertEquals(0, parseInt(' 0'));
 assertEquals(0, parseInt(' 0 '));

-assertEquals(63, parseInt('077'));
-assertEquals(63, parseInt('  077'));
-assertEquals(63, parseInt('  077   '));
-assertEquals(-63, parseInt('  -077'));
+assertEquals(77, parseInt('077'));
+assertEquals(77, parseInt('  077'));
+assertEquals(77, parseInt('  077   '));
+assertEquals(-77, parseInt('  -077'));

 assertEquals(3, parseInt('11', 2));
 assertEquals(4, parseInt('11', 3));
=======================================
--- /branches/bleeding_edge/test/test262/test262.status Wed Jul 11 08:15:04 2012 +++ /branches/bleeding_edge/test/test262/test262.status Wed Aug 8 00:44:17 2012
@@ -41,10 +41,6 @@

 ##################### DELIBERATE INCOMPATIBILITIES #####################

-# We deliberately treat arguments to parseInt() with a leading zero as
-# octal numbers in order to not break the web.
-S15.1.2.2_A5.1_T1: FAIL_OK
-
# This tests precision of Math.tan and Math.sin. The implementation for those # trigonometric functions are platform/compiler dependent. Furthermore, the
 # expectation values by far deviates from the actual result given by an

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

Reply via email to