Closed Bug 1811310 Opened 2 years ago Closed 2 years ago

Try caching `isFixedSlot` in the megamorphic cache

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: alexical, Assigned: jandem)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Attachments

(2 files)

From Jan's comment:

I'm wondering if it makes sense to have an isFixedSlot flag in the megamorphic cache entries if we have the space for it.. Then we could also pre-subtract numFixed for dynamic slots and store an offset rather than slot index, when storing the entry in the table... Not sure how much it matters.

It probably won't move the needle a ton, but it's simple and seems like a strict improvement over what we have.

Priority: -- → P3

NI myself to do a quick experiment this week to see if it matters.

Flags: needinfo?(jdemooij)

I'm looking into this at the moment. I think we can get rid of some instructions and have more compact code, but I haven't measured perf impact yet.

This makes our JIT code for the megamorphic cache lookup a bit more compact by
caching the slot's offset + isFixedSlot flag in a single 32-bit value.

This improves some local micro-benchmarks a bit, but it's hard to see an improvement
on Speedometer. Maybe it improves some of the subtests a tiny bit and combined with
the shorter and simpler JIT code that might be good enough.

It's possible to go further and combine the load instruction for fixed vs dynamic,
and to replace the isFixedSlot branch with a CMOV instruction, but that seemed to
be a bit harder on the CPU (the branch is probably quite predictable in practice)
so this is the more conservative approach.

Assignee: nobody → jdemooij
Status: NEW → ASSIGNED
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/535b8e8d4e77 Cache isFixedSlot in MegamorphicCacheEntry. r=dthayer

Leaving this open to do the same for the setprop cache.

Keywords: leave-open
Whiteboard: [sp3]

Probably either neutral on Speedometer or a tiny improvement on some subtests.

Flags: needinfo?(jdemooij)
Keywords: leave-open
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b8361daa68ad part 2 - Use TaggedSlotOffset for megamorphic setprop cache too. r=dthayer
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: