Improve code generated for property additions
Categories
(Core :: JavaScript Engine: JIT, task, P2)
Tracking
()
| 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)
| Assignee | ||
Comment 1•5 years ago
|
||
Updated•5 years ago
|
Updated•5 years ago
|
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Comment 3•5 years ago
•
|
||
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 :)
| Assignee | ||
Comment 4•5 years ago
|
||
Comment 5•5 years ago
|
||
| bugherder | ||
Comment 7•5 years ago
|
||
| bugherder | ||
| Assignee | ||
Comment 8•5 years ago
|
||
| Assignee | ||
Updated•5 years ago
|
Comment 10•5 years ago
|
||
| bugherder | ||
Description
•