Bug 1472233: Ensure registers are saved at prepareVMCall site r=jandem

Take AutoSaveLiveRegisters as an argument, and use that to ensure the registers were saved

--HG--
extra : rebase_source : bb54592bd009afc67aaa0ca9c705ab28f4a45d44
This commit is contained in:
Matthew Gaudet 2018-07-03 11:00:18 -04:00
parent d1e94adfd7
commit c15c5925f7

View File

@ -31,6 +31,8 @@ using mozilla::Maybe;
namespace js {
namespace jit {
class AutoSaveLiveRegisters;
// IonCacheIRCompiler compiles CacheIR to IonIC native code.
class MOZ_RAII IonCacheIRCompiler : public CacheIRCompiler
{
@ -99,7 +101,7 @@ class MOZ_RAII IonCacheIRCompiler : public CacheIRCompiler
return ptr;
}
void prepareVMCall(MacroAssembler& masm);
void prepareVMCall(MacroAssembler& masm, const AutoSaveLiveRegisters&);
MOZ_MUST_USE bool callVM(MacroAssembler& masm, const VMFunction& fun);
MOZ_MUST_USE bool emitAddAndStoreSlotShared(CacheOp op);
@ -303,8 +305,9 @@ GetReturnAddressToIonCode(JSContext* cx)
return returnAddr;
}
// The AutoSaveLiveRegisters parameter is used to ensure registers were saved
void
IonCacheIRCompiler::prepareVMCall(MacroAssembler& masm)
IonCacheIRCompiler::prepareVMCall(MacroAssembler& masm, const AutoSaveLiveRegisters&)
{
uint32_t descriptor = MakeFrameDescriptor(masm.framePushed(), JitFrame_IonJS,
IonICCallFrameLayout::Size());
@ -1170,7 +1173,7 @@ IonCacheIRCompiler::emitCallProxyGetByValueResult()
allocator.discardStack(masm);
prepareVMCall(masm);
prepareVMCall(masm, save);
masm.Push(idVal);
masm.Push(obj);
@ -1200,7 +1203,7 @@ IonCacheIRCompiler::emitCallProxyHasPropResult()
allocator.discardStack(masm);
prepareVMCall(masm);
prepareVMCall(masm, save);
masm.Push(idVal);
masm.Push(obj);
@ -1320,7 +1323,7 @@ IonCacheIRCompiler::emitCallStringSplitResult()
allocator.discardStack(masm);
prepareVMCall(masm);
prepareVMCall(masm, save);
masm.Push(str);
masm.Push(sep);
@ -1354,7 +1357,7 @@ IonCacheIRCompiler::emitCompareStringResult()
masm.jump(&done);
masm.bind(&slow);
prepareVMCall(masm);
prepareVMCall(masm, save);
masm.Push(right);
masm.Push(left);
@ -2184,7 +2187,7 @@ IonCacheIRCompiler::emitCallSetArrayLength()
ConstantOrRegister val = allocator.useConstantOrRegister(masm, reader.valOperandId());
allocator.discardStack(masm);
prepareVMCall(masm);
prepareVMCall(masm, save);
masm.Push(Imm32(strict));
masm.Push(val);
@ -2210,7 +2213,7 @@ IonCacheIRCompiler::emitCallProxySet()
AutoScratchRegister scratch(allocator, masm);
allocator.discardStack(masm);
prepareVMCall(masm);
prepareVMCall(masm, save);
masm.Push(Imm32(strict));
masm.Push(val);
@ -2235,7 +2238,7 @@ IonCacheIRCompiler::emitCallProxySetByValue()
bool strict = reader.readBool();
allocator.discardStack(masm);
prepareVMCall(masm);
prepareVMCall(masm, save);
masm.Push(Imm32(strict));
masm.Push(val);
@ -2256,7 +2259,7 @@ IonCacheIRCompiler::emitMegamorphicSetElement()
bool strict = reader.readBool();
allocator.discardStack(masm);
prepareVMCall(masm);
prepareVMCall(masm, save);
masm.Push(Imm32(strict));
masm.Push(TypedOrValueRegister(MIRType::Object, AnyRegister(obj)));