Bug 143799 - Number.parseInt is not === global parseInt in nightly r182673
Summary: Number.parseInt is not === global parseInt in nightly r182673
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jordan Harband
URL:
Keywords:
Depends on: 143657
Blocks:
  Show dependency treegraph
 
Reported: 2015-04-15 15:09 PDT by Jordan Harband
Modified: 2015-04-16 18:37 PDT (History)
4 users (show)

See Also:


Attachments
Patch (9.79 KB, patch)
2015-04-15 23:23 PDT, Jordan Harband
no flags Details | Formatted Diff | Diff
Patch (10.19 KB, patch)
2015-04-16 13:23 PDT, Jordan Harband
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.