Bug 944278 - OdinMonkey: Fix stack alignment. r=luke, a=lsblakk
--- a/js/src/jit/AsmJS.cpp
+++ b/js/src/jit/AsmJS.cpp
@@ -5918,17 +5918,16 @@ GenerateOOLConvert(ModuleCompiler &m, Re
MIRType_Pointer }; // argv
MIRTypeVector callArgTypes(m.cx());
callArgTypes.infallibleAppend(typeArray, ArrayLength(typeArray));
// Reserve space for a call to InvokeFromAsmJS_* and an array of values
// passed to this FFI call.
unsigned arraySize = sizeof(Value);
unsigned stackDec = StackDecrementForCall(masm, callArgTypes, arraySize);
- masm.setFramePushed(0);
masm.reserveStack(stackDec);
// Store value
unsigned offsetToArgv = StackArgBytes(callArgTypes);
masm.storeValue(JSReturnOperand, Address(StackPointer, offsetToArgv));
// Store real arguments
ABIArgMIRTypeIter i(callArgTypes);
@@ -5952,16 +5951,17 @@ GenerateOOLConvert(ModuleCompiler &m, Re
} else {
masm.computeEffectiveAddress(argv, scratch);
masm.storePtr(scratch, Address(StackPointer, i->offsetFromArgBase()));
}
i++;
JS_ASSERT(i.done());
// Call
+ AssertStackAlignment(masm);
switch (retType.which()) {
case RetType::Signed:
masm.call(AsmJSImm_CoerceInPlace_ToInt32);
masm.branchTest32(Assembler::Zero, ReturnReg, ReturnReg, throwLabel);
masm.unboxInt32(Address(StackPointer, offsetToArgv), ReturnReg);
break;
case RetType::Double:
masm.call(AsmJSImm_CoerceInPlace_ToNumber);
@@ -6094,16 +6094,17 @@ GenerateFFIIonExit(ModuleCompiler &m, co
#ifdef DEBUG
masm.branchTestMagicValue(Assembler::Equal, JSReturnOperand, JS_ION_ERROR, throwLabel);
masm.branchTestMagic(Assembler::Equal, JSReturnOperand, &ionFailed);
#else
masm.branchTestMagic(Assembler::Equal, JSReturnOperand, throwLabel);
#endif
+ uint32_t oolConvertFramePushed = masm.framePushed();
switch (exit.sig().retType().which()) {
case RetType::Void:
break;
case RetType::Signed:
masm.convertValueToInt32(JSReturnOperand, ReturnFloatReg, ReturnReg, &oolConvert,
/* -0 check */ false);
break;
case RetType::Double:
@@ -6116,17 +6117,19 @@ GenerateFFIIonExit(ModuleCompiler &m, co
masm.bind(&done);
masm.PopRegsInMask(restoreSet);
masm.ret();
// oolConvert
if (oolConvert.used()) {
masm.bind(&oolConvert);
+ masm.setFramePushed(oolConvertFramePushed);
GenerateOOLConvert(m, exit.sig().retType(), throwLabel);
+ masm.setFramePushed(0);
masm.jump(&done);
}
#ifdef DEBUG
masm.bind(&ionFailed);
masm.breakpoint();
#endif
}