Bug 170650

Summary: test262: test262/test/annexB/language/expressions/object/__proto__-fn-name.js
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: JavaScriptCoreAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, commit-queue, joepeck, keith_miller, mark.lam, msaboff, saam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
[PATCH] Proposed Fix
buildbot: commit-queue-
Archive of layout-test-results from ews113 for mac-elcapitan
none
[PATCH] Proposed Fix
saam: review+, saam: commit-queue-
[PATCH] For Landing none

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>