Bug 1478902 Part 1 - Improve types in nursery allocation r=nbp

--HG--
extra : rebase_source : 9d50285d4f28483a2089f7b2e760faceb37aa33c
extra : source : 2278d3706d90e92511c4bd6942afa8987e9ad54f
This commit is contained in:
Paul Bone 2018-07-30 14:35:51 +10:00
parent e0dbe1b052
commit bf12405840

View File

@ -969,13 +969,15 @@ MacroAssembler::nurseryAllocateString(Register result, Register temp, gc::AllocK
// The nursery position (allocation pointer) and the nursery end are stored
// very close to each other -- specifically, easily within a 32 bit offset.
// Use relative offsets between them, to avoid 64-bit immediate loads.
auto nurseryPosAddr = intptr_t(zone->addressOfStringNurseryPosition());
auto nurseryEndAddr = intptr_t(zone->addressOfStringNurseryCurrentEnd());
void* nurseryPosAddr = zone->addressOfStringNurseryPosition();
const void* nurseryEndAddr = zone->addressOfStringNurseryCurrentEnd();
movePtr(ImmPtr(zone->addressOfNurseryPosition()), temp);
loadPtr(Address(temp, 0), result);
addPtr(Imm32(totalSize), result);
branchPtr(Assembler::Below, Address(temp, nurseryEndAddr - nurseryPosAddr), result, fail);
const ptrdiff_t endOffset =
uintptr_t(nurseryEndAddr) - uintptr_t(nurseryPosAddr);
branchPtr(Assembler::Below, Address(temp, endOffset), result, fail);
storePtr(result, Address(temp, 0));
subPtr(Imm32(thingSize), result);
storePtr(ImmPtr(zone), Address(result, -js::Nursery::stringHeaderSize()));