Closed Bug 1827918 Opened 6 months ago Closed 5 months ago

Tidy GC allocation paths in preparation for adding a nursery fast path

Categories

(Core :: JavaScript: GC, task, P3)

task

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

(Whiteboard: [sp3])

Attachments

(6 files)

The GC allocation code is quite complicated. I wrote some patches to tidy it up and make it more consistent between the different allocation kinds.

Currently we call both the TenuredCell consturctor and the derived constructor
for tenured allocations. While this is not illegal, it's strange and we should
rely on the derived constructor.

The patch changes the tenured allocation paths to use void* pointers to
unconstructed memory.

I don't know why the change to cell header initialization was necessary. It
seems the TenuredCell constructor initialized the header to zero for some
reason, but I don't see why it should have.

This moves the dynamic slot allocation code that is currently duplicated
between nursery and tenured allocation paths into NativeObject instead.

Depends on D175372

Previously we didn't call any constructor for nursery-allocated objects, and we
always called the JSObject constructor for tenured objects. This makes object
constructor more like the other paths and calls the constructor in one place at
the end.

Depends on D175373

This is just so you don't have to include both Cell.h and Allocator.h to
declare a derived cell type.

Depends on D175378

Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e8cfac05da4a
Part 1: Don't call TenuredCell consturctor but rely on derived constructor r=sfink
https://hg.mozilla.org/integration/autoland/rev/cd8376894002
Part 2: Move dynamic slot allocation out of GC allocation path r=jandem
https://hg.mozilla.org/integration/autoland/rev/684d845a4a42
Part 3: Common up object construction and call the derived constructor r=sfink
https://hg.mozilla.org/integration/autoland/rev/00cf9f71c60e
Part 4: Refactor BigInt allocation along the same lines as the other kinds r=sfink
https://hg.mozilla.org/integration/autoland/rev/e8e565d555fa
Part 5: Rename AllocateString's type parameter in line with the other methods r=sfink
https://hg.mozilla.org/integration/autoland/rev/34ed400b7bb1
Part 6: Forward declare CellAllocator in Cell.h since derived types already need to include this r=sfink
https://hg.mozilla.org/integration/autoland/rev/179b8c4df1ad
apply code formatting via Lando
Whiteboard: [sp3]
Regressions: 1828396
You need to log in before you can comment on or make changes to this bug.