Bug 1801897 - Part 3: Only save live volatile registers across the ABI call in initTypedArraySlots. r=iain

Instead of saving all volatile registers, only save the live volatile registers
when calling `initTypedArraySlots()`. And additionally don't save more temp
registers in `initTypedArraySlots()` itself.

Depends on D162736

Differential Revision: https://phabricator.services.mozilla.com/D162737
This commit is contained in:
André Bargull 2022-11-23 08:19:16 +00:00
parent 539231b534
commit 152019ba71
2 changed files with 10 additions and 5 deletions

View File

@ -6871,7 +6871,7 @@ void CodeGenerator::visitNewTypedArray(LNewTypedArray* lir) {
Register objReg = ToRegister(lir->output());
Register tempReg = ToRegister(lir->temp0());
Register lengthReg = ToRegister(lir->temp1());
LiveRegisterSet liveRegs = lir->safepoint()->liveRegs();
LiveRegisterSet liveRegs = liveVolatileRegs(lir);
JSObject* templateObject = lir->mir()->templateObject();
gc::InitialHeap initialHeap = lir->mir()->initialHeap();
@ -6901,7 +6901,7 @@ void CodeGenerator::visitNewTypedArrayDynamicLength(
Register lengthReg = ToRegister(lir->length());
Register objReg = ToRegister(lir->output());
Register tempReg = ToRegister(lir->temp0());
LiveRegisterSet liveRegs = lir->safepoint()->liveRegs();
LiveRegisterSet liveRegs = liveVolatileRegs(lir);
JSObject* templateObject = lir->mir()->templateObject();
gc::InitialHeap initialHeap = lir->mir()->initialHeap();
@ -6913,6 +6913,9 @@ void CodeGenerator::visitNewTypedArrayDynamicLength(
lir, ArgList(ImmGCPtr(templateObject), lengthReg),
StoreRegisterTo(objReg));
// Volatile |lengthReg| is saved across the ABI call in |initTypedArraySlots|.
MOZ_ASSERT_IF(lengthReg.volatile_(), liveRegs.has(lengthReg));
TemplateObject templateObj(templateObject);
masm.createGCObject(objReg, tempReg, templateObj, initialHeap, ool->entry());

View File

@ -816,10 +816,12 @@ void MacroAssembler::initTypedArraySlots(Register obj, Register temp,
move32(Imm32(length), lengthReg);
}
// Ensure volatile |obj| is saved across the call.
if (obj.volatile_()) {
liveRegs.addUnchecked(obj);
}
// Allocate a buffer on the heap to store the data elements.
liveRegs.addUnchecked(temp);
liveRegs.addUnchecked(obj);
liveRegs.addUnchecked(lengthReg);
PushRegsInMask(liveRegs);
using Fn = void (*)(JSContext * cx, TypedArrayObject * obj, int32_t count);
setupUnalignedABICall(temp);