Bug 183523 - ClassExprNode evaluation of computed property names differs observably from spec and other implementations
Summary: ClassExprNode evaluation of computed property names differs observably from s...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Caitlin Potter (:caitp)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-03-09 13:09 PST by Caitlin Potter (:caitp)
Modified: 2018-03-14 13:01 PDT (History)
11 users (show)

See Also:


Attachments
Patch (44.86 KB, patch)
2018-03-12 11:25 PDT, Caitlin Potter (:caitp)
no flags Details | Formatted Diff | Diff
Patch (46.39 KB, patch)
2018-03-12 15:58 PDT, Caitlin Potter (:caitp)
no flags Details | Formatted Diff | Diff
Patch (46.35 KB, patch)
2018-03-13 12:55 PDT, Caitlin Potter (:caitp)
no flags Details | Formatted Diff | Diff
Patch for landing (46.34 KB, patch)
2018-03-14 12:40 PDT, Caitlin Potter (:caitp)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Caitlin Potter (:caitp) 2018-03-09 13:09:01 PST
https://jsfiddle.net/kposmd21/ is an example reproduction.

WebKit produces:

```
name(2)
name(1)
name(3)
name1 called
name2 called
name3 called
```

while Chrome and FireFox produce:

```
name(1)
name(2)
name(3)
name1 called
name2 called
name3 called
```

----

The spec indicates that Chrome and FF's behaviour is correct here.

This becomes even more potentially weird with the introduction of class fields, in https://bugs.webkit.org/show_bug.cgi?id=174212 --- class elements should be evaluated in order, regardless of whether or not they are methods or class fields, and regardless of whether or not they are static or belong on the instance.
Comment 1 Caitlin Potter (:caitp) 2018-03-12 11:25:32 PDT
Created attachment 335609 [details]
Patch
Comment 2 Keith Miller 2018-03-12 11:49:44 PDT
Comment on attachment 335609 [details]
Patch

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

r=me with some nits. 

Also, does this fix any test262 tests? I'm cool with doing some gardening after this patch lands too.

> Source/JavaScriptCore/parser/Nodes.h:728
> +        unsigned m_classElementTag: 2;

Can you add:

static_assert(1 << 2 > ClassElementTag::LastTag, "ClassElementTag shouldn't use more than two bits"); 

You'll also need to add a LastTag value to the ClassElementTag enum too.

> Source/JavaScriptCore/parser/Nodes.h:742
> +        RegisterID* emitBytecode(BytecodeGenerator& generator, RegisterID* dst = 0) override

Nit: This should be: RegisterID* dst = nullptr
Comment 3 EWS Watchlist 2018-03-12 12:39:01 PDT
Comment on attachment 335609 [details]
Patch

Attachment 335609 [details] did not pass jsc-ews (mac):
Output: http://webkit-queues.webkit.org/results/6918355

New failing tests:
stress/non-constructors.js.dfg-maximal-flush-validate-no-cjit
stress/non-constructors.js.ftl-no-cjit-small-pool
stress/non-constructors.js.dfg-eager
stress/non-constructors.js.ftl-eager-no-cjit-b3o1
stress/non-constructors.js.default
stress/non-constructors.js.ftl-eager
stress/non-constructors.js.no-cjit-validate-phases
stress/non-constructors.js.no-ftl
stress/non-constructors.js.no-cjit-collect-continuously
stress/non-constructors.js.ftl-no-cjit-no-inline-validate
stress/non-constructors.js.dfg-eager-no-cjit-validate
stress/non-constructors.js.ftl-no-cjit-b3o1
stress/non-constructors.js.no-llint
stress/non-constructors.js.ftl-no-cjit-validate-sampling-profiler
stress/non-constructors.js.ftl-eager-no-cjit
stress/non-constructors.js.ftl-no-cjit-no-put-stack-validate
Comment 4 Caitlin Potter (:caitp) 2018-03-12 15:54:57 PDT
(In reply to Keith Miller from comment #2)
> Comment on attachment 335609 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=335609&action=review
> 
> r=me with some nits. 
> 
> Also, does this fix any test262 tests? I'm cool with doing some gardening
> after this patch lands too.

After fixing the regression in JSTests/stress/non-constructors.js, I'm seeing the following test262 failures. I've also run the command on r229534 with the same failures. No test262 coverage affected by the change (but I intend to submit a new test to get some coverage for it).

```
run-jsc-stress-tests JSTests/test262.yaml 
Using the following jsc path: /Users/caitp/git/WebKit/WebKitBuild/Release/jsc


test262.yaml/test262/test/intl402/Collator/ignore-invalid-unicode-ext-values.js.default-strict: Exception: Test262Error: Locale en is affected by key co; value standard. Expected SameValue(«en», «en-CA») to be true
test262.yaml/test262/test/intl402/Collator/ignore-invalid-unicode-ext-values.js.default: Exception: Test262Error: Locale en is affected by key co; value standard. Expected SameValue(«en», «en-CA») to be true
test262.yaml/test262/test/intl402/Collator/ignore-invalid-unicode-ext-values.js.default-strict: ERROR: Unexpected exit code: 3
test262.yaml/test262/test/intl402/Collator/ignore-invalid-unicode-ext-values.js.default: ERROR: Unexpected exit code: 3
test262.yaml/test262/test/language/statements/for-await-of/async-func-decl-dstr-obj-id-put-unresolvable-no-strict.js.default: Error: ReferenceError: Can't find variable: iterCount
test262.yaml/test262/test/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-unresolvable-no-strict.js.default: Error: ReferenceError: Can't find variable: iterCount
test262.yaml/test262/test/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-rtrn-close-null.js.default: Error: Promise incorrectly fulfilled.
test262.yaml/test262/test/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-rtrn-close-null.js.default-strict: Error: Promise incorrectly fulfilled.
test262.yaml/test262/test/language/statements/for-await-of/async-gen-decl-dstr-obj-id-put-unresolvable-no-strict.js.default: Error: ReferenceError: Can't find variable: iterCount
test262.yaml/test262/test/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-unresolvable-no-strict.js.default: Error: ReferenceError: Can't find variable: iterCount
56378/56378 (failed 2)
```
Comment 5 Caitlin Potter (:caitp) 2018-03-12 15:58:38 PDT
Created attachment 335656 [details]
Patch

fix JSTests/stress/non-constructors.js regression
Comment 6 Caitlin Potter (:caitp) 2018-03-13 12:55:36 PDT
Created attachment 335717 [details]
Patch

rebased for landing
Comment 7 EWS Watchlist 2018-03-13 17:23:29 PDT
Comment on attachment 335717 [details]
Patch

Rejecting attachment 335717 [details] from review queue.

caitp@igalia.com does not have reviewer permissions according to https://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/contributors.json.

- If you do not have reviewer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have reviewer rights please correct the error in Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your reviewer rights.
Comment 8 Caitlin Potter (:caitp) 2018-03-14 12:15:16 PDT
(In reply to Build Bot from comment #7)
> Comment on attachment 335717 [details]
> Patch
> 
> Rejecting attachment 335717 [details] from review queue.
> 
> caitp@igalia.com does not have reviewer permissions according to
> https://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/
> contributors.json.
> 
> - If you do not have reviewer rights please read
> http://webkit.org/coding/contributing.html for instructions on how to use
> bugzilla flags.
> 
> - If you have reviewer rights please correct the error in
> Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to
> the file (no review needed).  The commit-queue restarts itself every 2
> hours.  After restart the commit-queue will correctly respect your reviewer
> rights.

It seems like very time I get back to work on a WebKit patch, I forget the bugzilla workflow entirely D': Shouldn't flipping the CQ+ bit have done the job here, or do I need to manually update the changelog OOPS or something?
Comment 9 Caitlin Potter (:caitp) 2018-03-14 12:40:20 PDT
Created attachment 335788 [details]
Patch for landing
Comment 10 WebKit Commit Bot 2018-03-14 13:00:25 PDT
Comment on attachment 335788 [details]
Patch for landing

Clearing flags on attachment: 335788

Committed r229608: <https://trac.webkit.org/changeset/229608>
Comment 11 WebKit Commit Bot 2018-03-14 13:00:27 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Radar WebKit Bug Importer 2018-03-14 13:01:26 PDT
<rdar://problem/38470271>