From 5172497e7151faba6ddae090e259b88ced988e2b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 17 Feb 2013 20:42:21 +0100 Subject: [PATCH] [masm] Fix incorrect stack pointer adjustment when leaving function Make sure to calculate the frame size when entering the function the same way as when leaving it, otherwise the stack pointer adjustment is wrong and we get nice crashes. Change-Id: I19f953c3243cf6f1448ad95cad7587fbdca2ae6d Reviewed-by: Erik Verbruggen --- src/v4/qv4isel_masm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v4/qv4isel_masm.cpp b/src/v4/qv4isel_masm.cpp index 6866dc0..7c12096 100644 --- a/src/v4/qv4isel_masm.cpp +++ b/src/v4/qv4isel_masm.cpp @@ -205,7 +205,7 @@ void Assembler::leaveStandardStackFrame(int locals) loadPtr(Address(StackPointerRegister, i * sizeof(void*)), calleeSavedRegisters[i]); // space for the locals and the callee saved registers - int32_t frameSize = locals * sizeof(QQmlJS::VM::Value) + sizeof(void*); + int32_t frameSize = locals * sizeof(QQmlJS::VM::Value) + sizeof(void*) * calleeSavedRegisterCount; #if CPU(X86) || CPU(X86_64) frameSize = (frameSize + 15) & ~15; // align on 16 byte boundaries for MMX #endif -- 2.7.4