Open Bug 1653027 Opened 5 years ago Updated 3 months ago

Strings to be atomized should be allocated as atoms, not copied

Categories

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

enhancement

Tracking

()

People

(Reporter: sfink, Unassigned)

References

(Blocks 2 open bugs)

Details

When I added the heap argument to all the string allocation APIs, I also made a handful of places pass through TenuredHeap when they were allocating a string that was going to be atomized. My logic was that there's no point in nursery allocating a string only to copy its data over to a (tenured, by construction) atom.

Except that atomization always copies over the data, so the net effect of the above "optimization" is to produce a bunch of short-lived protostrings in the tenured heap. (js::Atomize unconditionally calls AtomizeAndCopyChars; it cannot morph a string in-place.)

We should have APIs that allow allocating atoms directly.

See Also: → 1881995
Severity: S4 → N/A
You need to log in before you can comment on or make changes to this bug.