New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 5367 link

Starred by 30 users

Issue metadata

Status: Fixed
Owner:
Closed: Dec 20
Cc:
Components:
HW: ----
NextAction: ----
OS: ----
Priority: 2
Type: FeatureRequest


Sign in to add a comment

New feature: class fields

Project Member Reported by bakkot@google.com, Sep 8 2016

Issue description

There is a stage 2 proposal to allow class fields, like

class Counter {
  count = 0;
  increment(){
   ++this.count;
  }
}


This is a tracking bug for work on adding this feature.
 

Comment 1 by bakkot@google.com, Sep 8 2016

Cc: littledan@chromium.org adamk@chromium.org
Proposal: https://github.com/tc39/proposal-class-public-fields
Project Member

Comment 2 by bugdroid1@chromium.org, Sep 16 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/fe6b76d4911f6934359a5ca368c0a75f74110179

commit fe6b76d4911f6934359a5ca368c0a75f74110179
Author: bakkot <bakkot@google.com>
Date: Fri Sep 16 00:42:30 2016

Class fields, part 1 (parsing and infrastructure)

This is one part of a WIP implementation of the stage-2 proposal to add
fields to classes: https://github.com/tc39/proposal-class-public-fields

See design doc:
https://docs.google.com/document/d/1WRtNm3ZLNJT1WVr8aq4RJuByYgfuAFAhj20LwTW6JVE/

This adds support for parsing fields in classes, including
infrastructure. In particular, it adds:
* Two booleans on function literal AST nodes
* Two compiler hints on SharedFunctionInfos representing said bools
* A new type of ClassLiteralProperty, FIELD
* Parser support for the syntax
* Syntax tests
* A flag to enable it.

Currently the fields are parsed and then droppped. Subsequent
patches will add semantics, mostly by desugaring in the parser and
the remainder in the non-crankshaft backends.

BUG= v8:5367 

Review-Url: https://codereview.chromium.org/2315733003
Cr-Commit-Position: refs/heads/master@{#39459}

[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/ast/ast.h
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/ast/prettyprinter.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/ast/scopes.h
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/bootstrapper.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/compiler/ast-graph-builder.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/flag-definitions.h
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/full-codegen/arm/full-codegen-arm.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/full-codegen/arm64/full-codegen-arm64.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/full-codegen/ia32/full-codegen-ia32.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/full-codegen/mips/full-codegen-mips.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/full-codegen/mips64/full-codegen-mips64.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/full-codegen/ppc/full-codegen-ppc.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/full-codegen/s390/full-codegen-s390.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/full-codegen/x64/full-codegen-x64.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/full-codegen/x87/full-codegen-x87.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/objects-inl.h
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/objects.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/objects.h
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/parsing/parse-info.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/parsing/parse-info.h
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/parsing/parser-base.h
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/parsing/parser.cc
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/parsing/parser.h
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/src/parsing/preparser.h
[modify] https://crrev.com/fe6b76d4911f6934359a5ca368c0a75f74110179/test/cctest/test-parsing.cc

Comment 4 by adamk@chromium.org, Oct 8 2016

Owner: ----
Status: Available (was: Assigned)
Project Member

Comment 5 by bugdroid1@chromium.org, Dec 16 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/61833f5b9adfc3a19653c37cf27135a373474458

commit 61833f5b9adfc3a19653c37cf27135a373474458
Author: littledan <littledan@chromium.org>
Date: Fri Dec 16 19:52:27 2016

Remove class fields desugaring

This patch removes parser code implementing desugaring for ESnext
public and private fields on classes. The desugaring should probably
be implemented in the interpreter instead, and more work needs to go
into optimization and debugger support. The actual parsing of class
fields is left in, as the syntax is relatively stable, and there are
strong cctests for the grammar.

R=marja
BUG= v8:5367 

Review-Url: https://codereview.chromium.org/2578893005
Cr-Commit-Position: refs/heads/master@{#41776}

[modify] https://crrev.com/61833f5b9adfc3a19653c37cf27135a373474458/src/ast/ast-value-factory.h
[modify] https://crrev.com/61833f5b9adfc3a19653c37cf27135a373474458/src/ast/ast.h
[modify] https://crrev.com/61833f5b9adfc3a19653c37cf27135a373474458/src/objects.cc
[modify] https://crrev.com/61833f5b9adfc3a19653c37cf27135a373474458/src/parsing/parser-base.h
[modify] https://crrev.com/61833f5b9adfc3a19653c37cf27135a373474458/src/parsing/parser.cc
[modify] https://crrev.com/61833f5b9adfc3a19653c37cf27135a373474458/src/parsing/parser.h
[modify] https://crrev.com/61833f5b9adfc3a19653c37cf27135a373474458/src/parsing/preparser.h
[modify] https://crrev.com/61833f5b9adfc3a19653c37cf27135a373474458/src/runtime/runtime-object.cc
[modify] https://crrev.com/61833f5b9adfc3a19653c37cf27135a373474458/src/runtime/runtime.h

Labels: Priority-2
Owner: gsat...@chromium.org
Status: Assigned (was: Available)
Project Member

Comment 9 by bugdroid1@chromium.org, Oct 23 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/049844a1c29b43d24f91c7e8d4e2e5a773b831a7

commit 049844a1c29b43d24f91c7e8d4e2e5a773b831a7
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Mon Oct 23 14:41:32 2017

[class] Implement static public class fields

This patch implements the runtime semantics of static public
class fields.

Adds a new InitializeClassFieldsStatement AST node that contains
all the static class fields and their initializers. 

ClassLiteral is now desugared to be included in a do-exp that calls 
an initializer function which contains this new AST node.

Bug:  v8:5367 
Change-Id: I3574e4c685f1c039de42521c122e24f8d28e5d6c
Reviewed-on: https://chromium-review.googlesource.com/714817
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48835}
[modify] https://crrev.com/049844a1c29b43d24f91c7e8d4e2e5a773b831a7/src/ast/ast-expression-rewriter.cc
[modify] https://crrev.com/049844a1c29b43d24f91c7e8d4e2e5a773b831a7/src/ast/ast-numbering.cc
[modify] https://crrev.com/049844a1c29b43d24f91c7e8d4e2e5a773b831a7/src/ast/ast-traversal-visitor.h
[modify] https://crrev.com/049844a1c29b43d24f91c7e8d4e2e5a773b831a7/src/ast/ast.h
[modify] https://crrev.com/049844a1c29b43d24f91c7e8d4e2e5a773b831a7/src/ast/prettyprinter.cc
[modify] https://crrev.com/049844a1c29b43d24f91c7e8d4e2e5a773b831a7/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/049844a1c29b43d24f91c7e8d4e2e5a773b831a7/src/parsing/parser-base.h
[modify] https://crrev.com/049844a1c29b43d24f91c7e8d4e2e5a773b831a7/src/parsing/parser.cc
[modify] https://crrev.com/049844a1c29b43d24f91c7e8d4e2e5a773b831a7/src/parsing/pattern-rewriter.cc
[modify] https://crrev.com/049844a1c29b43d24f91c7e8d4e2e5a773b831a7/src/parsing/rewriter.cc
[add] https://crrev.com/049844a1c29b43d24f91c7e8d4e2e5a773b831a7/test/mjsunit/harmony/public-class-fields.js

Project Member

Comment 10 by bugdroid1@chromium.org, Oct 27 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/753edc417c948942c8502fc1f79a47d78dd8b506

commit 753edc417c948942c8502fc1f79a47d78dd8b506
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Fri Oct 27 17:25:04 2017

[Class] Remove initializer function call desugaring

Instead of creating a runtime call for the static class field
initializer in the AST, we do it in the bytecode generator.

This adds the initializer function to the ClassLiteral AST node.

Bug:  v8:5367 
Change-Id: Iffaa6531511023812011ee19fc96cea9e5c9d3f3
Reviewed-on: https://chromium-review.googlesource.com/736315
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49008}
[modify] https://crrev.com/753edc417c948942c8502fc1f79a47d78dd8b506/src/ast/ast-expression-rewriter.cc
[modify] https://crrev.com/753edc417c948942c8502fc1f79a47d78dd8b506/src/ast/ast-numbering.cc
[modify] https://crrev.com/753edc417c948942c8502fc1f79a47d78dd8b506/src/ast/ast-traversal-visitor.h
[modify] https://crrev.com/753edc417c948942c8502fc1f79a47d78dd8b506/src/ast/ast.h
[modify] https://crrev.com/753edc417c948942c8502fc1f79a47d78dd8b506/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/753edc417c948942c8502fc1f79a47d78dd8b506/src/parsing/expression-scope-reparenter.cc
[modify] https://crrev.com/753edc417c948942c8502fc1f79a47d78dd8b506/src/parsing/parser-base.h
[modify] https://crrev.com/753edc417c948942c8502fc1f79a47d78dd8b506/src/parsing/parser.cc
[modify] https://crrev.com/753edc417c948942c8502fc1f79a47d78dd8b506/src/parsing/preparser.h
[modify] https://crrev.com/753edc417c948942c8502fc1f79a47d78dd8b506/test/mjsunit/harmony/public-class-fields.js

Project Member

Comment 11 by bugdroid1@chromium.org, Nov 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/4f781ecabf8ac7c4a0b879c369c2d4cdd0fee9d7

commit 4f781ecabf8ac7c4a0b879c369c2d4cdd0fee9d7
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Fri Nov 03 18:51:00 2017

[class] Evaluate static computed props during class definition

This patch evaluates computed properties in the order of declaration
during class definition time.

This patch creates a synthetic variable to store the result of
evaluating a computed property and then looks this up in the
initializer function.

Bug:  v8:5367 
Change-Id: I4182c6a01196d2538991818142890f6afb0e532b
Reviewed-on: https://chromium-review.googlesource.com/752567
Reviewed-by: Mythri Alle <mythria@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49115}
[modify] https://crrev.com/4f781ecabf8ac7c4a0b879c369c2d4cdd0fee9d7/src/ast/ast.cc
[modify] https://crrev.com/4f781ecabf8ac7c4a0b879c369c2d4cdd0fee9d7/src/ast/ast.h
[modify] https://crrev.com/4f781ecabf8ac7c4a0b879c369c2d4cdd0fee9d7/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/4f781ecabf8ac7c4a0b879c369c2d4cdd0fee9d7/src/parsing/parser.cc
[modify] https://crrev.com/4f781ecabf8ac7c4a0b879c369c2d4cdd0fee9d7/test/mjsunit/harmony/public-class-fields.js

Project Member

Comment 12 by bugdroid1@chromium.org, Nov 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/7621d487d9b4a7b88ad22fe7e83ebb7d04241f93

commit 7621d487d9b4a7b88ad22fe7e83ebb7d04241f93
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Mon Nov 06 17:48:46 2017

[class] Remove needs_home_object from InitializeClassFieldsStatement

Initialize the home object when we create the initializer function
keeping this in line with other functions that initialize home object.

Bug:  v8:5367 
Change-Id: I1c5e32ae0cb496740341e6c99c9359f6c5e00875
Reviewed-on: https://chromium-review.googlesource.com/754163
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49153}
[modify] https://crrev.com/7621d487d9b4a7b88ad22fe7e83ebb7d04241f93/src/ast/ast.h
[modify] https://crrev.com/7621d487d9b4a7b88ad22fe7e83ebb7d04241f93/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/7621d487d9b4a7b88ad22fe7e83ebb7d04241f93/src/parsing/parser.cc

Project Member

Comment 13 by bugdroid1@chromium.org, Nov 8 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/f9a3a040b905d005364631ccbd55efcc0b012c8f

commit f9a3a040b905d005364631ccbd55efcc0b012c8f
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Wed Nov 08 00:40:42 2017

[class] Implement runtime semantics for instance fields in base class

Creates a new initializer function to instantiate instance class
fields in a base class.

An initializer function (similar to the one created for static fields)
is created during class declaration and assigned to a synthetic
context allocated variable.

This function is loaded from the variable during instantiation (when
the constructor is run) and run.

Bug:  v8:5367 
Change-Id: Ie11c2183b3001234ae41d7bcc2cb9b02c0764ab5
Reviewed-on: https://chromium-review.googlesource.com/754445
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49207}
[modify] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/src/ast/ast-expression-rewriter.cc
[modify] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/src/ast/ast-numbering.cc
[modify] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/src/ast/ast-traversal-visitor.h
[modify] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/src/ast/ast-value-factory.h
[modify] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/src/ast/ast.h
[modify] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/src/heap-symbols.h
[modify] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/src/interpreter/bytecode-generator.h
[modify] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/src/parsing/parser-base.h
[modify] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/src/parsing/parser.cc
[modify] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/src/parsing/parser.h
[modify] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/src/parsing/preparser.h
[add] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/test/mjsunit/harmony/public-instance-class-fields.js
[rename] https://crrev.com/f9a3a040b905d005364631ccbd55efcc0b012c8f/test/mjsunit/harmony/public-static-class-fields.js

Project Member

Comment 14 by bugdroid1@chromium.org, Nov 8 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/24b26a0cfc7773c11fa11904cedd85b97e49e81d

commit 24b26a0cfc7773c11fa11904cedd85b97e49e81d
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Wed Nov 08 20:27:00 2017

[class] Use CreateDataProperty runtime call

StoreDataPropertyInLiteral doesn't throw (because the previous uses of
this didn't throw), but class fields can throw on defining the
property which means we can't use this. Changing to CreateDataProperty
runtime call instead.

Bug:  v8:5367 
Change-Id: I1ab45413b121972dd18fe2b35a0cedd8efe0e0bf
Reviewed-on: https://chromium-review.googlesource.com/757824
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49239}
[modify] https://crrev.com/24b26a0cfc7773c11fa11904cedd85b97e49e81d/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/24b26a0cfc7773c11fa11904cedd85b97e49e81d/test/mjsunit/harmony/public-instance-class-fields.js
[modify] https://crrev.com/24b26a0cfc7773c11fa11904cedd85b97e49e81d/test/mjsunit/harmony/public-static-class-fields.js

Project Member

Comment 15 by bugdroid1@chromium.org, Nov 16 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/3cf32599734a9d74401d66fc60e35b1926dac323

commit 3cf32599734a9d74401d66fc60e35b1926dac323
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Thu Nov 16 11:18:04 2017

[class] Lazy parse class constructor with class fields

Previously, we had lazy parsing of class constructor disabled when a
class literal had class fields because we were using a reference to
the initializer function variable to load the function and call it.

Instead, in this patch, we use the scope analysis to lookup this
initializer function variable.

Bug:  v8:5367 
Change-Id: Ib73d7e6abed33c04d1f574e7976bea4869d54757
Reviewed-on: https://chromium-review.googlesource.com/768384
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49406}
[modify] https://crrev.com/3cf32599734a9d74401d66fc60e35b1926dac323/src/ast/ast.h
[modify] https://crrev.com/3cf32599734a9d74401d66fc60e35b1926dac323/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/3cf32599734a9d74401d66fc60e35b1926dac323/src/interpreter/bytecode-generator.h
[modify] https://crrev.com/3cf32599734a9d74401d66fc60e35b1926dac323/src/objects.cc
[modify] https://crrev.com/3cf32599734a9d74401d66fc60e35b1926dac323/src/objects/shared-function-info-inl.h
[modify] https://crrev.com/3cf32599734a9d74401d66fc60e35b1926dac323/src/objects/shared-function-info.h
[modify] https://crrev.com/3cf32599734a9d74401d66fc60e35b1926dac323/src/parsing/parse-info.cc
[modify] https://crrev.com/3cf32599734a9d74401d66fc60e35b1926dac323/src/parsing/parse-info.h
[modify] https://crrev.com/3cf32599734a9d74401d66fc60e35b1926dac323/src/parsing/parser.cc
[modify] https://crrev.com/3cf32599734a9d74401d66fc60e35b1926dac323/src/parsing/preparser.h
[modify] https://crrev.com/3cf32599734a9d74401d66fc60e35b1926dac323/test/mjsunit/harmony/public-instance-class-fields.js

Project Member

Comment 16 by bugdroid1@chromium.org, Nov 16 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/68668834ac29c13d7fdb877aef66ac1f9cbeb2e0

commit 68668834ac29c13d7fdb877aef66ac1f9cbeb2e0
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Thu Nov 16 11:21:58 2017

[ast] Print class fields initializers in AstPrinter

Bug:  v8:5367 
Change-Id: I0c86d7204301665412ef0ef370eb1f0c61123031
Reviewed-on: https://chromium-review.googlesource.com/774264
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49407}
[modify] https://crrev.com/68668834ac29c13d7fdb877aef66ac1f9cbeb2e0/src/ast/prettyprinter.cc

Project Member

Comment 17 by bugdroid1@chromium.org, Nov 27 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/4ca9d843f88d6b3456d506c605b0748c446a6e59

commit 4ca9d843f88d6b3456d506c605b0748c446a6e59
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Mon Nov 27 10:35:11 2017

[class] Store class fields initializer on the constructor

Previously, the class fields initializer function was stored on a
synthetic context allocated variable. This approach had sevaral
problems:

- We didn't know that class literal had fields until after we had
completely parsed the class literal. This meant that we had to go back
and fix up the scope of the constructor to have this synthetic
variable. This resulted in mismatch between parser and preparsed scope
data.

- This synthetic variable could potentially resolve to an initializer
of an outer class.

For ex:
class X extends Object {
  c = 1;
  constructor() {
    var t = () => {
      class P extends Object {
        constructor() {
          var t = () => { super(); };
          t();
        }
      }
      super();
    }
    t();
  }
}

In this the inner class P could access the outer class X's initiliazer
function. We would have to maintain extra metadata to make sure this
doesn't happen.

Instead this new approach uses a private symbol to store the
initializer function on the class constructor itself.

For the base constructor case, we can simply check for a bit on the
constructor function literal to see if we need to emit code that loads
and calls this initializer function. Therefore, we don't pay the cost
of loading this function in case there are no class fields.

For the derived constructor case, there are two possiblities:
(a) We are in a super() call directly in the derived constructor:

In this case we can do a check similar to the base constructor check,
we can check for a bit on the derived constructor and emit code for
loading and calling the initializer function.

This is usually the common case and we don't pay any cost for not using
class fields.

(b) We are in a super() call inside an arrow function in the derived
constructor:

In this case, we /always/ emit code to load and call the initializer
function. If the function doesn't exist then we have undefined and we
don't call anything. Otherwise we call the function.

super() can't be called twice so even if we emit code to load and call
the initializer function multiple times, it doesn't matter because it
would have already been an error.

Bug:  v8:5367 
Change-Id: I7f77cd6493ff84cf0e430a8c1039bc9ac6941a88
Reviewed-on: https://chromium-review.googlesource.com/781660
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49628}
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/src/ast/ast-value-factory.h
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/src/ast/ast.h
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/src/ast/prettyprinter.cc
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/src/heap-symbols.h
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/src/interpreter/bytecode-array-builder.cc
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/src/interpreter/bytecode-array-builder.h
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/src/interpreter/bytecode-generator.h
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/src/interpreter/constant-array-builder.h
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/src/objects.cc
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/src/parsing/parser.cc
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden
[add] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/test/cctest/interpreter/bytecode_expectations/ClassFields.golden
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/test/cctest/interpreter/generate-bytecode-expectations.cc
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/test/cctest/interpreter/test-bytecode-generator.cc
[modify] https://crrev.com/4ca9d843f88d6b3456d506c605b0748c446a6e59/test/mjsunit/harmony/public-instance-class-fields.js

Project Member

Comment 18 by bugdroid1@chromium.org, Nov 27 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/5c59fe02e336785a180874e9f1c46989328815db

commit 5c59fe02e336785a180874e9f1c46989328815db
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Mon Nov 27 14:18:04 2017

[class] Fix preparsed scope data mismatch for computed class fields

Previously we only created synthetic variables in the parser and not
in the preparser, causing mismatch in the preparsed scope data.

This patch creates the variables in both parsers.

Bug:  v8:5367 
Change-Id: I9c511d0b9212bd36816956b06dc204b0b5920e1c
Reviewed-on: https://chromium-review.googlesource.com/789848
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49637}
[modify] https://crrev.com/5c59fe02e336785a180874e9f1c46989328815db/src/parsing/parser-base.h
[modify] https://crrev.com/5c59fe02e336785a180874e9f1c46989328815db/src/parsing/parser.cc
[modify] https://crrev.com/5c59fe02e336785a180874e9f1c46989328815db/src/parsing/parser.h
[modify] https://crrev.com/5c59fe02e336785a180874e9f1c46989328815db/src/parsing/preparser.h
[modify] https://crrev.com/5c59fe02e336785a180874e9f1c46989328815db/test/mjsunit/harmony/public-instance-class-fields.js
[modify] https://crrev.com/5c59fe02e336785a180874e9f1c46989328815db/test/mjsunit/harmony/public-static-class-fields.js

Project Member

Comment 19 by bugdroid1@chromium.org, Nov 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/34657ab30beb437a35b1b352d0c38a1325ed3d83

commit 34657ab30beb437a35b1b352d0c38a1325ed3d83
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Tue Nov 28 10:14:19 2017

[class] Implement super property access in instance fields

Bug:  v8:5367 
Change-Id: Ic725c5ef22ab05891764d3ebf9a99c0d383e6d90
Reviewed-on: https://chromium-review.googlesource.com/789939
Reviewed-by: Mythri Alle <mythria@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49660}
[modify] https://crrev.com/34657ab30beb437a35b1b352d0c38a1325ed3d83/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/34657ab30beb437a35b1b352d0c38a1325ed3d83/src/runtime/runtime-classes.cc
[modify] https://crrev.com/34657ab30beb437a35b1b352d0c38a1325ed3d83/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden
[modify] https://crrev.com/34657ab30beb437a35b1b352d0c38a1325ed3d83/test/cctest/interpreter/bytecode_expectations/ClassFields.golden
[modify] https://crrev.com/34657ab30beb437a35b1b352d0c38a1325ed3d83/test/cctest/interpreter/bytecode_expectations/Modules.golden
[modify] https://crrev.com/34657ab30beb437a35b1b352d0c38a1325ed3d83/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden
[modify] https://crrev.com/34657ab30beb437a35b1b352d0c38a1325ed3d83/test/mjsunit/harmony/public-instance-class-fields.js

Project Member

Comment 20 by bugdroid1@chromium.org, Nov 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/94dfb8a1f486487592f7e9f913a89db5954efa94

commit 94dfb8a1f486487592f7e9f913a89db5954efa94
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Tue Nov 28 10:19:29 2017

[class] Add harmony-public-fields flag

Change the existing uses of the harmony-class-fields flag to
harmony-public-fields so that we can stage this separately
from the upcoming harmony-private-fields to get some
clusterfuzz coverage.

Bug:  v8:5367 
Change-Id: I76cdefa4faf34eae73d3a5f6d6089cf75677732a
Reviewed-on: https://chromium-review.googlesource.com/792940
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49661}
[modify] https://crrev.com/94dfb8a1f486487592f7e9f913a89db5954efa94/src/bootstrapper.cc
[modify] https://crrev.com/94dfb8a1f486487592f7e9f913a89db5954efa94/src/flag-definitions.h
[modify] https://crrev.com/94dfb8a1f486487592f7e9f913a89db5954efa94/src/parsing/parser-base.h
[modify] https://crrev.com/94dfb8a1f486487592f7e9f913a89db5954efa94/src/parsing/parser.cc
[modify] https://crrev.com/94dfb8a1f486487592f7e9f913a89db5954efa94/src/parsing/parser.h
[modify] https://crrev.com/94dfb8a1f486487592f7e9f913a89db5954efa94/test/cctest/interpreter/bytecode_expectations/ClassFields.golden
[modify] https://crrev.com/94dfb8a1f486487592f7e9f913a89db5954efa94/test/cctest/interpreter/generate-bytecode-expectations.cc
[modify] https://crrev.com/94dfb8a1f486487592f7e9f913a89db5954efa94/test/cctest/interpreter/test-bytecode-generator.cc
[modify] https://crrev.com/94dfb8a1f486487592f7e9f913a89db5954efa94/test/cctest/test-parsing.cc
[modify] https://crrev.com/94dfb8a1f486487592f7e9f913a89db5954efa94/test/mjsunit/harmony/public-instance-class-fields.js
[modify] https://crrev.com/94dfb8a1f486487592f7e9f913a89db5954efa94/test/mjsunit/harmony/public-static-class-fields.js

Project Member

Comment 21 by bugdroid1@chromium.org, Nov 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/42bc9e8c64a30485a4c05f5d878833f75afbb98a

commit 42bc9e8c64a30485a4c05f5d878833f75afbb98a
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Tue Nov 28 13:21:36 2017

[class] Expand bytecode expectations coverage for class fields

Bug:  v8:5367 
Change-Id: Ib24190f6cfc0765794a1a5d9ac33cf1c1e2b6fba
Reviewed-on: https://chromium-review.googlesource.com/793150
Reviewed-by: Mythri Alle <mythria@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49665}
[modify] https://crrev.com/42bc9e8c64a30485a4c05f5d878833f75afbb98a/test/cctest/interpreter/bytecode_expectations/ClassFields.golden
[modify] https://crrev.com/42bc9e8c64a30485a4c05f5d878833f75afbb98a/test/cctest/interpreter/generate-bytecode-expectations.cc
[modify] https://crrev.com/42bc9e8c64a30485a4c05f5d878833f75afbb98a/test/cctest/interpreter/test-bytecode-generator.cc

Project Member

Comment 22 by bugdroid1@chromium.org, Nov 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7

commit ffda54fbd4051c4f015fc7b9988b9ebf118a25a7
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Tue Nov 28 15:00:18 2017

[class] Throw early errors for fields with constructor and prototype name

See https://tc39.github.io/proposal-class-fields/#sec-static-semantics-early-errors

Bug:  v8:5367 
Change-Id: I0329d1b41c4658b733df47397fbcc2c16bad117e
Reviewed-on: https://chromium-review.googlesource.com/792946
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49672}
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/src/messages.h
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/src/parsing/parser-base.h
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/cctest/interpreter/bytecode_expectations/ForOf.golden
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/cctest/interpreter/bytecode_expectations/Generators.golden
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/cctest/test-parsing.cc
[add] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/message/fail/class-field-constructor.js
[add] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/message/fail/class-field-constructor.out
[add] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/message/fail/class-field-static-constructor.js
[add] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/message/fail/class-field-static-constructor.out
[add] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/message/fail/class-field-static-prototype.js
[add] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/message/fail/class-field-static-prototype.out
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/webkit/class-syntax-declaration-expected.txt
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/webkit/class-syntax-declaration.js
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/webkit/class-syntax-expression-expected.txt
[modify] https://crrev.com/ffda54fbd4051c4f015fc7b9988b9ebf118a25a7/test/webkit/class-syntax-expression.js

Project Member

Comment 23 by bugdroid1@chromium.org, Nov 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/a667abbf8a6bc7d9f2605625324088c8fefdfdf2

commit a667abbf8a6bc7d9f2605625324088c8fefdfdf2
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Tue Nov 28 19:29:26 2017

[class] Add preparsed scope data test for computed class fields

Bug:  v8:5367 
Change-Id: I53fa815175bd0890756373cdcb3793201e4d4acb
Reviewed-on: https://chromium-review.googlesource.com/793193
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49688}
[modify] https://crrev.com/a667abbf8a6bc7d9f2605625324088c8fefdfdf2/test/cctest/parsing/test-preparser.cc

Project Member

Comment 24 by bugdroid1@chromium.org, Nov 29 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/278981d73bb6f45e5527a4f54af1962feda40fa9

commit 278981d73bb6f45e5527a4f54af1962feda40fa9
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Wed Nov 29 12:17:28 2017

[class] Test that fields are initialized before calling the base constructor

Bug:  v8:5367 
Change-Id: If10539597c07a497d0e9c89af9529ae90f92ddf3
Reviewed-on: https://chromium-review.googlesource.com/794470
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49711}
[modify] https://crrev.com/278981d73bb6f45e5527a4f54af1962feda40fa9/test/mjsunit/harmony/public-instance-class-fields.js

Project Member

Comment 25 by bugdroid1@chromium.org, Dec 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/bd839c551baa9cd1711369615e7e5a666ec1aab8

commit bd839c551baa9cd1711369615e7e5a666ec1aab8
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Fri Dec 01 12:47:47 2017

[class] Fix typo in test

Reported by @ziyunfei here:
https://twitter.com/ziyunfei/status/936524009528811520

Bug:  v8:5367 
Change-Id: I2b1bb43dff86f35dec824e275740fce4f0c97b2e
Reviewed-on: https://chromium-review.googlesource.com/802877
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49788}
[modify] https://crrev.com/bd839c551baa9cd1711369615e7e5a666ec1aab8/test/mjsunit/harmony/public-instance-class-fields.js
[modify] https://crrev.com/bd839c551baa9cd1711369615e7e5a666ec1aab8/test/mjsunit/harmony/public-static-class-fields.js

Blockedon: 7183
Project Member

Comment 27 by bugdroid1@chromium.org, Dec 22 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/94d53d87422cc54c9581c45b6fb4871ab4accd2d

commit 94d53d87422cc54c9581c45b6fb4871ab4accd2d
Author: Daniel Ehrenberg <littledan@chromium.org>
Date: Fri Dec 22 13:04:51 2017

[class] Split out static fields into a separate flag

This patch implements https://github.com/tc39/proposal-class-fields/pull/65
and https://github.com/tc39/proposal-static-class-features/ by
splitting out instance and static field declarations into separate
flags for the separate proposals. Instance class fields is currently
at Stage 3 whereas static class fields is currently at Stage 2.

Bug:  v8:5367 
Change-Id: I133c945fd0b22dc5718c7bb61b10f22348087acd
Reviewed-on: https://chromium-review.googlesource.com/839778
Commit-Queue: Daniel Ehrenberg <littledan@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50293}
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/src/bootstrapper.cc
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/src/flag-definitions.h
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/src/parsing/parser-base.h
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/src/parsing/parser.cc
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/src/parsing/parser.h
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/test/cctest/interpreter/bytecode_expectations/ClassFields.golden
[add] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/test/cctest/interpreter/generate-bytecode-expectations.cc
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/test/cctest/interpreter/test-bytecode-generator.cc
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/test/cctest/parsing/test-preparser.cc
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/test/cctest/test-parsing.cc
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/test/message/fail/class-field-static-constructor.js
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/test/message/fail/class-field-static-prototype.js
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/test/mjsunit/harmony/public-instance-class-fields.js
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/test/mjsunit/harmony/public-static-class-fields.js
[modify] https://crrev.com/94d53d87422cc54c9581c45b6fb4871ab4accd2d/test/test262/testcfg.py

Project Member

Comment 28 by bugdroid1@chromium.org, Jan 4 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/3828ce0cae0f531e99260f7011a9ffe52c91cf69

commit 3828ce0cae0f531e99260f7011a9ffe52c91cf69
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Thu Jan 04 23:11:25 2018

[class] Ban arguments in class field initializers

Create a new function kind for initializer functions and ban arguments
if used in such a function.

Bug:  v8:5367 ,  v8:7183 
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: Id3089e587b3d6a25f27224045f250e032b831818
Reviewed-on: https://chromium-review.googlesource.com/850547
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50369}
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/src/ast/scopes.cc
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/src/ast/scopes.h
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/src/globals.h
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/src/messages.h
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/src/objects/scope-info.h
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/src/objects/shared-function-info.h
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/src/parsing/parser-base.h
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/src/parsing/parser.cc
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/cctest/interpreter/bytecode_expectations/ForOf.golden
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/cctest/interpreter/bytecode_expectations/Generators.golden
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/cctest/test-parsing.cc
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/mjsunit/harmony/public-instance-class-fields.js
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/mjsunit/harmony/public-static-class-fields.js
[add] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/test262/local-tests/test/language/expressions/class/fields-inner-arrow-err-contains-arguments.js
[add] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/test262/local-tests/test/language/expressions/class/fields-inner-arrow-eval-err-contains-arguments.js
[add] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/test262/local-tests/test/language/expressions/class/fields-inner-eval-arrow-err-contains-arguments.js
[add] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/test262/local-tests/test/language/statements/class/fields-inner-arrow-err-contains-arguments.js
[add] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/test262/local-tests/test/language/statements/class/fields-inner-arrow-eval-err-contains-arguments.js
[add] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/test262/local-tests/test/language/statements/class/fields-inner-eval-arrow-err-contains-arguments.js
[modify] https://crrev.com/3828ce0cae0f531e99260f7011a9ffe52c91cf69/test/test262/test262.status

Project Member

Comment 29 by bugdroid1@chromium.org, Jan 5 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/da72b856e303417f729414213f49564622351f56

commit da72b856e303417f729414213f49564622351f56
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Fri Jan 05 18:55:55 2018

[class] Stage public class fields

Bug:  v8:5367 
Change-Id: Ieb7b04f47bbad575c22a3a16ec7bd7cb9e8ba0c9
Reviewed-on: https://chromium-review.googlesource.com/851425
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50387}
[modify] https://crrev.com/da72b856e303417f729414213f49564622351f56/src/flag-definitions.h

Blockedon: 8122
Blockedon: 8123
Project Member

Comment 32 by bugdroid1@chromium.org, Sep 5

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/b586b64276f94f4fcae9d22d7d0657f1dc6bb7bc

commit b586b64276f94f4fcae9d22d7d0657f1dc6bb7bc
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Wed Sep 05 16:08:21 2018

[class] Stage static public fields

Bug:  v8:5367 
Change-Id: I7c65840b62a461de87dc88f8dd2e31eba47e8adf
Reviewed-on: https://chromium-review.googlesource.com/1205818
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55658}
[modify] https://crrev.com/b586b64276f94f4fcae9d22d7d0657f1dc6bb7bc/src/flag-definitions.h

Project Member

Comment 33 by bugdroid1@chromium.org, Sep 6

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/9d2cfd3917d87580f5b38c264452768cf5c08233

commit 9d2cfd3917d87580f5b38c264452768cf5c08233
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Thu Sep 06 13:26:12 2018

[class] Fix code coverage and add tests for public class fields

Bug:  v8:5367 
Change-Id: Id3c2075e3c0a8f9b81a9c6b5f0578b6ecfa58001
Reviewed-on: https://chromium-review.googlesource.com/1205834
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55687}
[modify] https://crrev.com/9d2cfd3917d87580f5b38c264452768cf5c08233/src/parsing/parser-base.h
[add] https://crrev.com/9d2cfd3917d87580f5b38c264452768cf5c08233/test/mjsunit/code-coverage-class-fields.js

Project Member

Comment 34 by bugdroid1@chromium.org, Sep 6

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/fff26af94a12077faf127878522b42edc064224c

commit fff26af94a12077faf127878522b42edc064224c
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Thu Sep 06 13:45:01 2018

[class] Add stack trace tests for public class fields

Bug:  v8:5367 
Change-Id: I681dbe1bc115f284994d9ecdb0d2061aed1dbb5e
Reviewed-on: https://chromium-review.googlesource.com/1208514
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55688}
[add] https://crrev.com/fff26af94a12077faf127878522b42edc064224c/test/mjsunit/stack-traces-class-fields.js

Project Member

Comment 35 by bugdroid1@chromium.org, Sep 7

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/c830799d68a1b8ade8931845056ccc4d009b7d94

commit c830799d68a1b8ade8931845056ccc4d009b7d94
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Fri Sep 07 19:26:34 2018

[class] Give a name to initializer functions

Makes for a nicer stack trace

Bug:  v8:5367 
Change-Id: I6d77907e08c2c4efc7a1b25016c7e83841c7c574
Reviewed-on: https://chromium-review.googlesource.com/1211444
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Daniel Ehrenberg <littledan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55736}
[modify] https://crrev.com/c830799d68a1b8ade8931845056ccc4d009b7d94/src/messages.cc
[modify] https://crrev.com/c830799d68a1b8ade8931845056ccc4d009b7d94/src/parsing/parser.cc
[modify] https://crrev.com/c830799d68a1b8ade8931845056ccc4d009b7d94/src/parsing/parser.h
[modify] https://crrev.com/c830799d68a1b8ade8931845056ccc4d009b7d94/test/mjsunit/stack-traces-class-fields.js

Project Member

Comment 36 by bugdroid1@chromium.org, Sep 17

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7

commit 1908872dcd9b5588cae3c0d7cda22ef876b0c3e7
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Mon Sep 17 22:25:44 2018

[class] Make class field initializers breakable in the debugger

Add tests.

Bug:  v8:5367 
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I2a4215a87ba1dae98c4b25547494165f534b4a66
Reviewed-on: https://chromium-review.googlesource.com/1218046
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55974}
[modify] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/src/parsing/parser.cc
[modify] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/src/runtime/runtime-internal.cc
[modify] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/src/runtime/runtime.h
[modify] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden
[modify] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden
[modify] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden
[add] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/debugger/debug/debug-break-class-fields.js
[add] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/inspector/debugger/get-possible-breakpoints-class-fields-expected.txt
[add] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/inspector/debugger/get-possible-breakpoints-class-fields.js
[add] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/inspector/debugger/resources/break-locations-class-fields.js
[add] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/message/fail/class-fields-computed.js
[add] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/message/fail/class-fields-computed.out
[add] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/message/fail/class-fields-static-throw.js
[add] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/message/fail/class-fields-static-throw.out
[add] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/message/fail/class-fields-throw.js
[add] https://crrev.com/1908872dcd9b5588cae3c0d7cda22ef876b0c3e7/test/message/fail/class-fields-throw.out

Blockedon: 8197
Project Member

Comment 38 by bugdroid1@chromium.org, Oct 12

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/230dd86ce6c530b911a0424b8e714ff7616cfa06

commit 230dd86ce6c530b911a0424b8e714ff7616cfa06
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Fri Oct 12 14:01:22 2018

[Class] Fix debug scope iteration for class fields

When trying to print the scope information for the class fields
initializer function, the debugger asks the parser to parse the class
literal as a function literal (to get the scope info) ... which
doesn't quite work.

Instead of adding support for parsing the class literal, we just short
cicruit this parsing step by just returning an empty context.

This works fine because initializer function doesn't have any
variables in it's local scope.

The one caveat is that the objects in the scope above this function
(like the global) are now missing. This trade off is possibly fine
for now, as adding parsing support for class literal to only produce
would be a lot of code for not enough use.

As a follow up to this change, the devtools UI needs to be updated to
handle this empty context cleanly. Currently, it doesn't show the
`this` object if no context exists even if the `this` object is
correctly passed to the UI from the backend.

Bug:  v8:5367 , v8:8122
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I52965f26241bbf6abdc988783aa0fc44bb36901f
Reviewed-on: https://chromium-review.googlesource.com/c/1274268
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56611}
[modify] https://crrev.com/230dd86ce6c530b911a0424b8e714ff7616cfa06/src/debug/debug-scopes.cc
[add] https://crrev.com/230dd86ce6c530b911a0424b8e714ff7616cfa06/test/inspector/debugger/class-fields-scopes-expected.txt
[add] https://crrev.com/230dd86ce6c530b911a0424b8e714ff7616cfa06/test/inspector/debugger/class-fields-scopes.js

Project Member

Comment 39 by bugdroid1@chromium.org, Oct 16

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/bc324dbd9bbb1d24700a9503dc35d7766da63d26

commit bc324dbd9bbb1d24700a9503dc35d7766da63d26
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Tue Oct 16 11:02:21 2018

[class] Fix class field name initialization

Previously when class names were computed and set as part of
StoreDataPropertyInLiteral calls, it was observable to static fields
as these static fields are initialized right after the classes were
constructed but before the class names were installed.
This caused the name property to be undefined for this case.

Instead, this patch always forces the creation of a name property on
the class constructor when static class fields are used. This patch
does kill the class boilerplate optimization, but currently all static
class fields are installed using a runtime call to CreateDataProperty
so this isn't any worse when using static class fields.

In the future, this can be optimized away by storing the name on the
boilerplate.

There is spec discussion here:
https://github.com/tc39/proposal-class-fields/issues/85

There isn't a resolution yet, there's still discussion about whether
to have the name be undefined always for static class field
initializers. But, I don't think that's useful as it would always kill
our boilerplate optimization (like this patch does ..., but without the
future optimization potential).

Bug:  v8:5367 
Change-Id: I14afdf7ece3f2d9fa3c659d2c0bc3806e0b17abb
Reviewed-on: https://chromium-review.googlesource.com/c/1281002
Reviewed-by: Mythri Alle <mythria@chromium.org>
Reviewed-by: Daniel Ehrenberg <littledan@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56686}
[modify] https://crrev.com/bc324dbd9bbb1d24700a9503dc35d7766da63d26/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/bc324dbd9bbb1d24700a9503dc35d7766da63d26/src/interpreter/bytecode-generator.h
[modify] https://crrev.com/bc324dbd9bbb1d24700a9503dc35d7766da63d26/test/mjsunit/harmony/public-static-class-fields.js

Project Member

Comment 40 by bugdroid1@chromium.org, Oct 18

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/1fc8452bdf759b3921c4470b5e1ff80d5dd1b29d

commit 1fc8452bdf759b3921c4470b5e1ff80d5dd1b29d
Author: Sathya Gunasekaran <gsathya@chromium.org>
Date: Thu Oct 18 18:14:52 2018

[class] Ship instance and static public class fields

Bug:  v8:5367 
Change-Id: I92a73692e9714b929316d8971a2258e3241bc8c6
Reviewed-on: https://chromium-review.googlesource.com/c/1288643
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Daniel Ehrenberg <littledan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56790}
[modify] https://crrev.com/1fc8452bdf759b3921c4470b5e1ff80d5dd1b29d/src/flag-definitions.h
[modify] https://crrev.com/1fc8452bdf759b3921c4470b5e1ff80d5dd1b29d/test/webkit/class-syntax-semicolon-expected.txt
[modify] https://crrev.com/1fc8452bdf759b3921c4470b5e1ff80d5dd1b29d/test/webkit/class-syntax-semicolon.js

Status: Fixed (was: Assigned)
This is shipping in V8 7.2 now. I'm going to go ahead and close this out since we have individual bugs for the devtools issues. Future issues can be filed individually as well, there's no need for a tracking bug.

Sign in to add a comment