Closed Bug 1659133 Opened 5 years ago Closed 5 years ago

Improve code generated for property additions

Categories

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

task

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: evilpies, Assigned: evilpies)

References

Details

Attachments

(3 files)

The main idea here is to improve the case where we we are adding multiple properties with AddAndStoreSlot instructions. We can use the dependency / alias analysis to figure out which instruction dominating the guard instruction modified the shape.

For some simple examples like below we can basically eliminate all shape guards. (Right now we don't yet handle allocating new slots)

Attachment #9170055 - Attachment description: Bug 1659133 - WIP: Improve GuardShape folding in Ion. → Bug 1659133 - Improve GuardShape folding in Ion. r?jandem
Severity: -- → N/A
Priority: -- → P2
Keywords: leave-open
Summary: Improve GuardShape folding → Improve code generated for property additions
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/1f9187fefcb6 Improve GuardShape folding in Ion. r=jandem

With the previous patch we usually still have the following code:

18:guardobjectgroup (6:newobject (5:constant object 1fa0a9888160 (Object)))
19:objectstaticproto (18:guardobjectgroup (6:newobject))
20:guardshape (19:objectstaticproto (18:guardobjectgroup))
21:postwritebarrier (18:guardobjectgroup (6:newobject)) (17:constant 0x4)
22:box (17:constant 0x4)
23:allocateandstoreslot (18:guardobjectgroup (6:newobject)) (22:box (17:constant 0x4))

First we are guarding on the group of the object. Then we load the object's proto and shape check it. We can't move those instructions across allocateandstoreslot instructions because they all use the ObjectFields alias set. We could split the alias set into group/shape/proto, which would be potentially error prone.
So instead we manually tell MGuardObjectGroup, MObjectStaticProto etc. that M(Add|Allocate)AndStoreSlot don't modify the group or proto using the mightAlias method.

Finally we just have the 20:guardshape for the proto left. This is kind of hard to eliminate, because we would have to make sure the addandstoreslot instructions are definitely not changing the shape of the proto.

At least for objects with a null proto we don't have any extra instructions besides the postbarrier and addslot :)

Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/30646ad76476 Improve the alias information for instructions that don't actually alias AddAndStoreSlot. r=jandem
Keywords: leave-open
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/8ed2913e5bbc Add AssertShape after folding in MGuardShape. r=jandem
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: