Bug 903519 - allocate JSStrings and string data in the Nursery

903519 part 2: Reparent JSString from TenuredCell to Cell.

903519 Part 3: Make js::Allocate cast strings to requested type.

903519 Part 4: Force non-atom strings to have their low flag bit set in order to distinguish them from JSObjects in the nursery.

903519 Part 5: Strings in the nursery: allocation.

Mixed reset later.
This commit is contained in:
win7-7 2024-01-29 20:07:33 +02:00 committed by wuggy
commit b9a2a715cd
18 changed files with 274 additions and 65 deletions

View file

@ -1591,13 +1591,13 @@ CreateDependentString::generate(MacroAssembler& masm, const JSAtomState& names,
static void*
AllocateString(JSContext* cx)
{
return js::Allocate<JSString, NoGC>(cx);
return js::Allocate<JSString, NoGC>(cx, js::gc::TenuredHeap);
}
static void*
AllocateFatInlineString(JSContext* cx)
{
return js::Allocate<JSFatInlineString, NoGC>(cx);
return js::Allocate<JSFatInlineString, NoGC>(cx, js::gc::TenuredHeap);
}
void
@ -7700,10 +7700,13 @@ JitCompartment::generateStringConcatStub(JSContext* cx)
masm.newGCString(output, temp3, &failure, stringsCanBeInNursery);
// Store rope length and flags. temp1 still holds the result of AND'ing the
// lhs and rhs flags, so we just have to clear the other flags to get our
// rope flags (Latin1 if both lhs and rhs are Latin1).
static_assert(JSString::ROPE_FLAGS == 0, "Rope flags must be 0");
// lhs and rhs flags, so we just have to clear the other flags and set
// NON_ATOM_BIT to get our rope flags (Latin1 if both lhs and rhs are
// Latin1).
static_assert(JSString::INIT_ROPE_FLAGS == JSString::NON_ATOM_BIT,
"Rope type flags must be NON_ATOM_BIT only");
masm.and32(Imm32(JSString::LATIN1_CHARS_BIT), temp1);
masm.or32(Imm32(JSString::NON_ATOM_BIT), temp1);
masm.store32(temp1, Address(output, JSString::offsetOfFlags()));
masm.store32(temp2, Address(output, JSString::offsetOfLength()));