Bug 143799

Summary: Number.parseInt is not === global parseInt in nightly r182673
Product: WebKit Reporter: Jordan Harband <ljharb>
Component: JavaScriptCoreAssignee: Jordan Harband <ljharb>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, commit-queue, ggaren, ysuzuki
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 143657    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch none

Description Jordan Harband 2015-04-15 15:09:47 PDT
The spec requires that `Number.parseInt === parseInt`, but that's not the case in WebKit nightly.
Comment 1 Jordan Harband 2015-04-15 15:10:09 PDT
Linking to other Number.parseInt bug.
Comment 2 Jordan Harband 2015-04-15 15:14:59 PDT
(fwiw, this was also a bug in Firefox 37, but it's now fixed in their nightly v40)
Comment 3 Jordan Harband 2015-04-15 23:23:23 PDT
Created attachment 250902 [details]
Patch
Comment 4 Jordan Harband 2015-04-16 13:23:31 PDT
Created attachment 250947 [details]
Patch
Comment 5 Darin Adler 2015-04-16 17:40:18 PDT
Comment on attachment 250947 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=250947&action=review

> Source/JavaScriptCore/runtime/NumberConstructor.cpp:76
> +    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "parseInt"), numberPrototype->globalObject()->parseIntFunction(), DontEnum | Function);

Why isn’t this using vm.propertyNames->parseInt?
Comment 6 Jordan Harband 2015-04-16 17:42:06 PDT
(In reply to comment #5)

> Comment on attachment 250947 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=250947&action=review
> 
> > Source/JavaScriptCore/runtime/NumberConstructor.cpp:76
> > +    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "parseInt"), numberPrototype->globalObject()->parseIntFunction(), DontEnum | Function);
> 
> Why isn’t this using vm.propertyNames->parseInt?

I didn't want to couple the `Number` function name with the global name - they're the same string, and the same function, but they're conceptually not linked in the same way. Would you prefer I change it to do so?
Comment 7 WebKit Commit Bot 2015-04-16 18:37:14 PDT
Comment on attachment 250947 [details]
Patch

Clearing flags on attachment: 250947

Committed r182938: <http://trac.webkit.org/changeset/182938>
Comment 8 WebKit Commit Bot 2015-04-16 18:37:18 PDT
All reviewed patches have been landed.  Closing bug.