Closed Bug 1830068 Opened 2 years ago Closed 2 years ago

Optimize codegen for loading aliased lexicals

Categories

(Core :: JavaScript Engine: JIT, task, P3)

task

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Attachments

(1 file)

We often have a sequence of MLoadFixedSlot => MLexicalCheck => MUnbox when accessing lexicals in an outer scope. If we add support for MLexicalCheck to FoldLoadsWithUnbox, we can eliminate the lexical check and fold the load and unbox.

A common MIR pattern when loading lexicals from an outer scope is
MLoad{Fixed,Dynamic}Slot => MLexicalCheck => MUnbox(fallible).

This patch makes it possible to eliminate the lexical check in this case and to
fold the load and unbox into MLoad{Fixed,Dynamic}SlotAndUnbox, because this
instruction will bail out if we see the uninitialized-lexical magic value so a
separate check for it is redundant. This is similar to how we don't need a separate
hole check for MLoadElementAndUnbox.

We have test coverage for this case in multiple jit-tests.

Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e8232b1436b9 Optimize MLexicalCheck in FoldLoadsWithUnbox. r=iain
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch
Duplicate of this bug: 1692855
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: