|
Class fields, part 3 (backends)
This is the final 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/
The feature is available behind --harmony-class-fields.
This patch adds support for the feature to all backends except
Crankshaft, which does not implement classes. The backend changes
required are fairly small and identical across backends. It also adds
tests, since with this patch the feature is functional.
There are three things backends do in this patch:
- assign the class being constructed to a hidden variable, so that
static field initializers can have the correct home object and receiver
(which is necessary if the static field initializers are called while
the class is being created, instead of immediately after)
- evaluate the (potentially computed) names of non-static fields and
store those names in variables, to be referenced when instantiating the
class
- evaluate the initializers of static fields and define the corresponding
property on the class to hold the resulting value.
BUG= v8:5367
Total comments: 6
Total comments: 3
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+1644 lines, -29 lines) |
Patch |
|
M |
src/compiler/ast-graph-builder.cc
|
View
|
1
2
3
|
3 chunks |
+49 lines, -1 line |
0 comments
|
Download
|
|
M |
src/full-codegen/arm/full-codegen-arm.cc
|
View
|
1
2
3
|
2 chunks |
+29 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/full-codegen/arm64/full-codegen-arm64.cc
|
View
|
1
2
3
|
2 chunks |
+29 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/full-codegen/full-codegen.cc
|
View
|
1
2
3
|
1 chunk |
+14 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/full-codegen/ia32/full-codegen-ia32.cc
|
View
|
1
2
3
|
2 chunks |
+28 lines, -1 line |
0 comments
|
Download
|
|
M |
src/full-codegen/mips/full-codegen-mips.cc
|
View
|
1
2
3
|
2 chunks |
+29 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/full-codegen/mips64/full-codegen-mips64.cc
|
View
|
1
2
3
|
2 chunks |
+29 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/full-codegen/ppc/full-codegen-ppc.cc
|
View
|
1
2
3
|
2 chunks |
+29 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/full-codegen/s390/full-codegen-s390.cc
|
View
|
1
2
3
|
2 chunks |
+29 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/full-codegen/x64/full-codegen-x64.cc
|
View
|
1
2
3
|
2 chunks |
+29 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/full-codegen/x87/full-codegen-x87.cc
|
View
|
1
2
3
|
2 chunks |
+28 lines, -1 line |
0 comments
|
Download
|
|
M |
src/interpreter/bytecode-generator.cc
|
View
|
1
2
3
|
3 chunks |
+44 lines, -1 line |
0 comments
|
Download
|
|
M |
src/parsing/parser-base.h
|
View
|
1
2
3
4
5
6
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
A |
test/cctest/interpreter/bytecode_expectations/ClassFields.golden
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+239 lines, -0 lines |
0 comments
|
Download
|
|
M |
test/cctest/interpreter/generate-bytecode-expectations.cc
|
View
|
1
2
3
4
5
6
7
|
9 chunks |
+11 lines, -0 lines |
0 comments
|
Download
|
|
M |
test/cctest/interpreter/test-bytecode-generator.cc
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+27 lines, -0 lines |
0 comments
|
Download
|
|
A + |
test/mjsunit/harmony/class-fields-arguments.js
|
View
|
|
1 chunk |
+7 lines, -9 lines |
0 comments
|
Download
|
|
A |
test/mjsunit/harmony/class-fields-async-syntax.js
|
View
|
|
1 chunk |
+89 lines, -0 lines |
0 comments
|
Download
|
|
A |
test/mjsunit/harmony/class-fields-attributes.js
|
View
|
|
1 chunk |
+26 lines, -0 lines |
0 comments
|
Download
|
|
A |
test/mjsunit/harmony/class-fields-evaluation-order.js
|
View
|
|
1 chunk |
+104 lines, -0 lines |
0 comments
|
Download
|
|
A + |
test/mjsunit/harmony/class-fields-function-name-inference.js
|
View
|
|
1 chunk |
+4 lines, -2 lines |
0 comments
|
Download
|
|
A |
test/mjsunit/harmony/class-fields-proxy.js
|
View
|
1
2
3
4
|
1 chunk |
+54 lines, -0 lines |
0 comments
|
Download
|
|
A |
test/mjsunit/harmony/class-fields-scoping.js
|
View
|
1
2
|
1 chunk |
+314 lines, -0 lines |
0 comments
|
Download
|
|
A |
test/mjsunit/harmony/class-fields-super.js
|
View
|
|
1 chunk |
+147 lines, -0 lines |
0 comments
|
Download
|
|
A |
test/mjsunit/harmony/class-fields-syntax.js
|
View
|
|
1 chunk |
+163 lines, -0 lines |
0 comments
|
Download
|
|
A |
test/mjsunit/harmony/class-fields-to-name.js
|
View
|
|
1 chunk |
+41 lines, -0 lines |
0 comments
|
Download
|
|
A |
test/mjsunit/harmony/class-fields-visibility.js
|
View
|
|
1 chunk |
+51 lines, -0 lines |
0 comments
|
Download
|
Depends on Patchset:
Dependent Patchsets:
Total messages: 49 (37 generated)
|