Reviewers: Lasse Reichstein, Erik Corry, Message: Sorry, this should have gone to http://codereview.chromium.org/391014 but my gcl was a bit messed up.
Description: Sorry, this should have gone to http://codereview.chromium.org/391014 I added some tests and swapped the lhs and rhs of the && operator in v8natives.js as requested. Please review this at http://codereview.chromium.org/384132 SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M src/runtime.cc M src/v8natives.js M test/mjsunit/parse-int-float.js Index: test/mjsunit/parse-int-float.js =================================================================== --- test/mjsunit/parse-int-float.js (revision 3306) +++ test/mjsunit/parse-int-float.js (working copy) @@ -36,9 +36,12 @@ assertEquals(3, parseInt('11', 2)); assertEquals(4, parseInt('11', 3)); +assertEquals(4, parseInt('11', 3.8)); assertEquals(0x12, parseInt('0x12')); assertEquals(0x12, parseInt('0x12', 16)); +assertEquals(0x12, parseInt('0x12', 16.1)); +assertEquals(0x12, parseInt('0x12', NaN)); assertEquals(12, parseInt('12aaa')); Index: src/v8natives.js =================================================================== --- src/v8natives.js (revision 3306) +++ src/v8natives.js (working copy) @@ -95,8 +95,8 @@ // they make parseInt on a string 1.4% slower (274ns vs 270ns). if (%_IsSmi(string)) return string; if (IS_NUMBER(string) && - ((string < -0.01 && -1e9 < string) || - (0.01 < string && string < 1e9))) { + ((0.01 < string && string < 1e9) || + (-1e9 < string && string < -0.01))) { // Truncate number. return string | 0; } Index: src/runtime.cc =================================================================== --- src/runtime.cc (revision 3306) +++ src/runtime.cc (working copy) @@ -3385,8 +3385,7 @@ NoHandleAllocation ha; CONVERT_CHECKED(String, s, args[0]); - CONVERT_DOUBLE_CHECKED(n, args[1]); - int radix = FastD2I(n); + CONVERT_SMI_CHECKED(radix, args[1]); s->TryFlattenIfNotFlat(); --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
