Closed Bug 1642476 Opened 4 years ago Closed 4 years ago

Basic Private Fields Support

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: mgaudet, Assigned: mgaudet)

References

Details

Attachments

(17 files, 1 obsolete file)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

This bug will be used to land patches implementing basic private field support:

This means basic private field test cases will work, however, we won't pass everything on test262, nor will it include enabling all the JIT compilers. That will be left for another bug.

Matthew Gaudet- Added illegal-in-class-context to ensure that field syntax
only works inside of classes if fields are enabled.

Assignee: nobody → mgaudet
Status: NEW → ASSIGNED

Matthew Gaudet: Add test for double declaration of private name

Matthew Gaudet: Use NoteUsedName inside of fieldInitializerOpt rather than allocating a new PrivateName node.

This code was previously unexercised, and so recent changes revealed this bug.

Depends on D77922

This patch allows access to private fields. Adds three new opcodes,
InitPrivateElem, GetPrivateElem, SetPrivateElem, specialized to the
requirements of private names (all three throw in some circumstances where
their non-private bretheren would proceed apace.)

This supports -no- compilers, which means that the test must be run with
--no-blinterp to avoid crashes. The partial support inserted in
BaselineCodeGen is purely for making this compile, but is the shape we need for
later.

Inline cache support for blinterp and baseline comes later.

Depends on D77923

Since modulo exception behaviour, the PrivateElem ops act the same as their
non-private cousins, we can recycle their IC implementations so long as we
ensure that these stubs don't attach before a throw occurs.

PrivateElements are explictly excluded from IonCompilation in this patch,
but it's worth noting that there is an approaching footgun when Ion
is enabled, caused by hoisting of idempotent caches.

The check added in IsCacheableNoProperty is insufficient to prevent
an idempotent cache from getting attached for a GetPrivateElem that is
hoisted -- as pc is nullptr in that case.

I have added a test case here that is aimed at preventing this from
becoming an issue.

Depends on D77925

This is implemented by reusing our pre-existing lexical name tracker, the UsedNameTracker.

This particular version of the patch issues positionless errors. It is a followup
item to provide positions for errors.

Ted is a reviewer for this patch due to the interaction between the Parse world
and VM world when checking for possibly lexically-defined private names on the
scope chain.

Depends on D77933

Attachment #9153617 - Attachment description: Bug 1642476 - Part 21: References to PrivateIdentifiers which are not lexically present cause an early error. r?jorendorff!,tcampbell! → Bug 1642476 - References to PrivateIdentifiers which are not lexically present cause an early error. r?jorendorff!,tcampbell!

This patch only covers the non-eval case.

Depends on D77934

Severity: -- → N/A
Priority: -- → P2
Blocks: 1647437
Attachment #9153605 - Attachment description: Bug 1642476 - Add Basic version getRuntimeConfiguration r?sfink → Bug 1642476 - Add Basic version of getRealmConfiguration r?sfink
Attachment #9153966 - Attachment is obsolete: true
Blocks: 1647786
Blocks: 1647789
Attachment #9153610 - Attachment description: Bug 1642476 - Inline Cache support for PrivateElem ops. r?tcampbell → Bug 1642476 - Inline Cache support for PrivateElem ops. r?iain
Blocks: 1650188
Blocks: 1651178
Pushed by mgaudet@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/eb7361d2c45e
Private fields in non-derived classes. r=jorendorff,anba
https://hg.mozilla.org/integration/autoland/rev/84c891f10d90
Add a separate scope for class body bindings. r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/022d942943c1
Install bindings for private names. r=jorendorff,anba
https://hg.mozilla.org/integration/autoland/rev/5d046b313708
Install private name symbols in the class body scope. r=jorendorff,anba
https://hg.mozilla.org/integration/autoland/rev/3b9f08b0ba80
Install private fields using the private name symbols. r=jorendorff,anba
https://hg.mozilla.org/integration/autoland/rev/9a4f3aa0719c
Add Basic version of getRealmConfiguration r=sfink
https://hg.mozilla.org/integration/autoland/rev/510b8fa45789
Correct error in parsing of unicode private names r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/937d4dcd8867
Allow referencing private fields r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/0f884e42cf48
Inline Cache support for PrivateElem ops. r=iain
https://hg.mozilla.org/integration/autoland/rev/75c34fed9983
Support optional property access r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/8e545f2246fa
Allow adding private fields to non-extensible objects r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/7e30b11a3624
Correctly name anonymous private functions bound to private fields. r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/6cc4a63ec7f0
Make deleting a private field an error r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/0072a71143dc
Allow dynamic access for evals r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/c1e5dd3607ac
Allow a parse context to determine if it's in a class or not. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/d2498e0b9cf6
References to PrivateIdentifiers which are not lexically present cause an early error. r=jorendorff,tcampbell
Blocks: 1651208
Regressions: 1651448
Regressions: 1651512
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: