Closed Bug 1827918 Opened 1 year ago Closed 1 year ago

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


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




114 Branch
Tracking Status
firefox114 --- fixed


(Reporter: jonco, Assigned: jonco)



(Whiteboard: [sp3])


(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
Part 1: Don't call TenuredCell consturctor but rely on derived constructor r=sfink
Part 2: Move dynamic slot allocation out of GC allocation path r=jandem
Part 3: Common up object construction and call the derived constructor r=sfink
Part 4: Refactor BigInt allocation along the same lines as the other kinds r=sfink
Part 5: Rename AllocateString's type parameter in line with the other methods r=sfink
Part 6: Forward declare CellAllocator in Cell.h since derived types already need to include this r=sfink
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.