Revision: 3319 Author: [email protected] Date: Tue Nov 17 05:54:05 2009 Log: 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. Review URL: http://codereview.chromium.org/384132 http://code.google.com/p/v8/source/detail?r=3319 Modified: /branches/bleeding_edge/src/runtime.cc /branches/bleeding_edge/src/v8natives.js /branches/bleeding_edge/test/mjsunit/parse-int-float.js ======================================= --- /branches/bleeding_edge/src/runtime.cc Tue Nov 17 02:28:04 2009 +++ /branches/bleeding_edge/src/runtime.cc Tue Nov 17 05:54:05 2009 @@ -3387,8 +3387,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(); ======================================= --- /branches/bleeding_edge/src/v8natives.js Wed Nov 11 03:28:37 2009 +++ /branches/bleeding_edge/src/v8natives.js Tue Nov 17 05:54:05 2009 @@ -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; } ======================================= --- /branches/bleeding_edge/test/mjsunit/parse-int-float.js Tue Sep 9 13:08:45 2008 +++ /branches/bleeding_edge/test/mjsunit/parse-int-float.js Tue Nov 17 05:54:05 2009 @@ -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')); --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
