Bug 65325

Summary: Performance tweak to parseInt
Product: WebKit Reporter: Gavin Barraclough <barraclough>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, oliver, shinyak
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 65366    
Bug Blocks:    
Attachments:
Description Flags
Patch none

Gavin Barraclough
Reported 2011-07-28 10:30:26 PDT
parseInt applied to small positive numbers = floor.
Attachments
Patch (20.21 KB, text/plain)
2011-07-30 06:18 PDT, Shinya Kawanaka
no flags
Gavin Barraclough
Comment 1 2011-07-28 10:32:50 PDT
Fixed in r91938.
Darin Adler
Comment 2 2011-07-28 10:34:41 PDT
Shouldn’t it be <= INT_MAX rather than < INT_MAX? Should we be using a constant instead of INT_MAX? Could we use unsigned instead of int to cover a slightly larger range?
Gavin Barraclough
Comment 3 2011-07-28 16:21:56 PDT
> Shouldn’t it be <= INT_MAX rather than < INT_MAX? > Should we be using a constant instead of INT_MAX? This should probably be < (INT_MAX + 1), will fix this & use a constant. > Could we use unsigned instead of int to cover a slightly larger range? Unsigned doesn't buy us much coverage, and makes the jsNumber conversion slightly more expensive (we'll have to check we're in the int32 range & potentially generate a boxed double), so I probably won't do this. I'd go to int64_t if this bought us the whole 10^21 range, but sadly not.
Shinya Kawanaka
Comment 4 2011-07-30 06:18:14 PDT
Shinya Kawanaka
Comment 5 2011-07-30 06:19:47 PDT
Oops! I have mistaken to upload the patch to the wrong place...!! Please ignore it and remove the patch.
Note You need to log in before you can comment on or make changes to this bug.