Closed Bug 1793962 Opened 3 years ago Closed 2 years ago

Code generation for field decorators

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: dminor, Assigned: dminor)

References

(Blocks 2 open bugs)

Details

Attachments

(3 files, 4 obsolete files)

Code generation for decorators is likely to be complicated, so we'll split it into multiple bugs. This bug covers code generation for field decorators.

Assignee: nobody → dminor
Status: NEW → ASSIGNED

Depends on D164093

Depends on D164094

Blocks: 1817993

This was added to the test when it looked like we needed to add a new
bytecode for decorators, but we didn't end up adding a bytecode,
and so this is not necessary.

This breaks up the large emitApplyDecoratorsToElementDefinition method in
to smaller pieces to improve readability and avoid duplicated code when
we add emitApplyDecoratorsToFieldDefinition in the next patch in the
series.

Depends on D170520

This adds support for calling field decorators. Field decorators can potentially
add additional initializers that will be called when initializing a field. We
can't know the number of initializers that will be added until runtime, so it's
necessary to append these new initializers to the .initializers array when the
decorators are called.

This patch doesn't attempt to unify the existing initializer code with the new
code for calling initializers added by decorators. Instead, the existing
initializers are called, and then any new initializers that have been added
are passed the existing initialized value, and are called in series. We should
unify this code, Bug 1817993 tracks this. I think this is best handled in a
follow up, this patch set is already relatively large, and we'll need to be
careful to not regress the performance of initialization when decorators are
not being used.

Depends on D170521

Attachment #9307105 - Attachment is obsolete: true
Attachment #9307104 - Attachment is obsolete: true
Attachment #9307103 - Attachment is obsolete: true

This adds a new opcode that allows pushing elements to a newly constructed
array. This is useful for decorators, because we don't know in advance
how many new initializers will be added by running decorator code.

Depends on D170521

Attachment #9320536 - Attachment is obsolete: true
Pushed by dminor@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d1adebb389bb Remove --no-jit-backend from method-decorator.js test; r=arai https://hg.mozilla.org/integration/autoland/rev/663e81f5db5c Add helper emitters for common code in DecoratorEmitter; r=arai https://hg.mozilla.org/integration/autoland/rev/86b58aa0124b Add support for field decorators in DecoratorEmitter; r=arai
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: