Bug 170650 - test262: test262/test/annexB/language/expressions/object/__proto__-fn-name.js
Summary: test262: test262/test/annexB/language/expressions/object/__proto__-fn-name.js
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-08 19:47 PDT by Joseph Pecoraro
Modified: 2017-04-10 11:10 PDT (History)
7 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (11.86 KB, patch)
2017-04-08 19:52 PDT, Joseph Pecoraro
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews113 for mac-elcapitan (379.00 KB, application/zip)
2017-04-08 20:46 PDT, Build Bot
no flags Details
[PATCH] Proposed Fix (11.87 KB, patch)
2017-04-08 23:39 PDT, Joseph Pecoraro
saam: review+
saam: commit-queue-
Details | Formatted Diff | Diff
[PATCH] For Landing (11.88 KB, patch)
2017-04-09 12:41 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2017-04-08 19:47:11 PDT
Summary:
There is special handling of __proto__ in object initializers.

Spec:
https://tc39.github.io/ecma262/#sec-__proto__-property-names-in-object-initializers

Test:
test262/test/annexB/language/expressions/object/__proto__-fn-name.js

// Unlike other properties, the function assigned to __proto__ doesn't infer the name __proto__.
assert( { foo: function(){} }.foo.name === "foo" )
assert( { __proto__: function(){} }.__proto__.name === "" )
Comment 1 Joseph Pecoraro 2017-04-08 19:52:24 PDT
Created attachment 306597 [details]
[PATCH] Proposed Fix
Comment 2 Joseph Pecoraro 2017-04-08 19:55:38 PDT
Comment on attachment 306597 [details]
[PATCH] Proposed Fix

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

> Source/JavaScriptCore/parser/Parser.h:110
> +enum class InferName {
> +    Allowed,
> +    Disallowed,
> +};

I really couldn't come up with a good name for this, but since its static at almost every call site (except one) I do think an enum is better than a bool. Naming suggestions welcome!
Comment 3 Build Bot 2017-04-08 20:46:54 PDT
Comment on attachment 306597 [details]
[PATCH] Proposed Fix

Attachment 306597 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3503795

Number of test failures exceeded the failure limit.
Comment 4 Build Bot 2017-04-08 20:46:55 PDT
Created attachment 306600 [details]
Archive of layout-test-results from ews113 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 5 Joseph Pecoraro 2017-04-08 23:39:40 PDT
Created attachment 306603 [details]
[PATCH] Proposed Fix
Comment 6 Saam Barati 2017-04-09 08:07:50 PDT
Comment on attachment 306603 [details]
[PATCH] Proposed Fix

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

> JSTests/stress/inferred-names.js:125
> +// __proto__ name is not inferred in Object Literals if not computed.

This disagrees with what your test does below.

> JSTests/stress/inferred-names.js:135
> +assert( ({__proto__(){}}).__proto__.name === "__proto__" );

This isn't computed, but still has name "__proto__". Is that expected?
Comment 7 Joseph Pecoraro 2017-04-09 12:35:34 PDT
(In reply to Saam Barati from comment #6)
> Comment on attachment 306603 [details]
> [PATCH] Proposed Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=306603&action=review
> 
> > JSTests/stress/inferred-names.js:125
> > +// __proto__ name is not inferred in Object Literals if not computed.
> 
> This disagrees with what your test does below.
> 
> > JSTests/stress/inferred-names.js:135
> > +assert( ({__proto__(){}}).__proto__.name === "__proto__" );
> 
> This isn't computed, but still has name "__proto__". Is that expected?

This is a named function, nothing would or is being inferred in this case.
Comment 8 Joseph Pecoraro 2017-04-09 12:36:45 PDT
Comment on attachment 306603 [details]
[PATCH] Proposed Fix

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

>>> JSTests/stress/inferred-names.js:125
>>> +// __proto__ name is not inferred in Object Literals if not computed.
>> 
>> This disagrees with what your test does below.
> 
> This is a named function, nothing would or is being inferred in this case.

I'll drop this part of the comment and just point to the spec.
Comment 9 Joseph Pecoraro 2017-04-09 12:41:09 PDT
Created attachment 306629 [details]
[PATCH] For Landing
Comment 10 WebKit Commit Bot 2017-04-09 14:39:06 PDT
Comment on attachment 306629 [details]
[PATCH] For Landing

Clearing flags on attachment: 306629

Committed r215165: <http://trac.webkit.org/changeset/215165>