Closed Bug 1628828 Opened 4 years ago Closed 4 years ago

Consider handling BaseScript FieldInitializers the same way as enclosing script

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: tcampbell, Assigned: tcampbell)

References

Details

Attachments

(5 files)

Right now the computation of FieldInitializers is complex because fields may appear after functions and lazy scripts are created. In this bug I'd like to explore handling them the same way we handle the enclosingScope where we using FunctionBox::finish to do the updates of parent info into lazy children.

This would result in lazy scripts with lazy parents having no field initializer info yet. We would wait until we actually generate bytecode for the script containing the class definition.

It turns out the existing code already had this behaviour indirectly, although without using FunctionBox::finish. Standardizing this in the finish() method is still probably the right call. By moving Maybe<FieldInitializers> to FunctionBox we can also remove the args from BCE constructor and standardize behaviour.

FieldInitializers for a lazy function are setup when the parent script is
bytecode compiled rather than when a lazy script is allocated.

This new field is then used to update any existing lazy inner function during
FunctionBox::finish. This avoids mutating inactive functions while
delazifying their parents until we get to FunctionBox::finish.

Depends on D70722

This extends the lifetime from BCE to SharedContext which fits in a lot
better with our deferred allocation story. Due to previous patch, we init the
FunctionBox copy of FieldInitializers before the BCE instance runs which
simplifies things here.

Depends on D70723

Pushed by tcampbell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/627464289bcf
Remove unused LazyScriptCreationData::fieldInitializers. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/423826a12ca2
Add fieldInitializers to FunctionBox. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/954dd7ba99a3
Use fieldInitializers from FunctionBox during BCE. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/0ec9abd4944f
Remove now unused BytecodeEmitter::fieldInitializers. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/c289ac40b546
Use ScriptStencil to init fieldInitializers. r=mgaudet
Regressions: 1644536
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: