Synthesize all missing class constructors in the JS Parser
Categories
(Core :: JavaScript Engine, task, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox87 | --- | fixed |
People
(Reporter: tcampbell, Assigned: tcampbell)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
Currently, we use the JSOP::ClassConstructor
opcode for missing constructors of classes with no fields, but synthesize one with the parser if there are fields. The ClassConstructor
opcode relies on some ugly self-hosted bytecode cloning hacks which we'd like to remove. Instead, we can always synthesize the missing constructors.
In order for this to be useful, we must also support syntax parsing these constructors. Using script-flags we can handle this case in a straightforward way.
The ClassConstructor
opcode would synthesize a private copy of a BaseScript with roughly the same bytecode, so there isn't new overhead here.
Assignee | ||
Comment 1•4 years ago
|
||
Introduce ParseNodeKind::DefaultConstructor to represent synthesized class
constructors in the parse AST. Use this for synthesized constructors and then
hide them from Reflect.parse. This brings consistency with the default class
constructors used for classes without fields. In future, all missing
constructors will be synthesized by Parser instead of special opcodes.
Assignee | ||
Comment 2•4 years ago
|
||
The Parser currently synthesizes missing constructors for classes that have
fields and this extends that to missing constructors of any class. We also
need to add lazy parsing support here to make this practical.
Depends on D104137
Assignee | ||
Comment 3•4 years ago
|
||
These are no longer needed now that we synthesize missing constructors in the
parser.
Depends on D104138
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Comment 5•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/60ba53c75cfb
https://hg.mozilla.org/mozilla-central/rev/d81dbae6505c
https://hg.mozilla.org/mozilla-central/rev/ed71dfbcad90
Description
•