From da6ccb1908b1a2f7670be42267844d9971f59ae7 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 18 Feb 2013 22:30:42 +0100 Subject: [PATCH] Fix crypto.js on arm Due to our large amount of temps we also end up creating large stack frames and thus add large constants to the stack pointer. That affects the encoding of the immediates and MacroAssemblerARMv7 ASSERTs out for values that require encoding. This is unlikely to get fixed upstream and it's infact impossible to create a testcase with JSC JIT due to the fact that it barely uses the stack frame. I'd rather not patch the upstream file as it is a condition hard to find and a patch easy to drop by accident. Instead this patch adds a simple workaround that comes are low cost: Just load the immediate into a register and do the addition. Change-Id: Ia551a15d2f5f6243b295a9bfd19df778467189ec Reviewed-by: Lars Knoll --- src/v4/qv4isel_masm.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/v4/qv4isel_masm.cpp b/src/v4/qv4isel_masm.cpp index 6b687a6..0e29a0f 100644 --- a/src/v4/qv4isel_masm.cpp +++ b/src/v4/qv4isel_masm.cpp @@ -211,7 +211,14 @@ void Assembler::leaveStandardStackFrame(int locals) #if CPU(X86) || CPU(X86_64) frameSize = (frameSize + 15) & ~15; // align on 16 byte boundaries for MMX #endif + // Work around bug in ARMv7Assembler.h where add32(imm, sp, sp) doesn't + // work well for large immediates. +#if CPU(ARM_THUMB2) + move(TrustedImm32(frameSize), Assembler::ScratchRegister); + add32(Assembler::ScratchRegister, StackPointerRegister); +#else addPtr(TrustedImm32(frameSize), StackPointerRegister); +#endif pop(StackFrameRegister); platformLeaveStandardStackFrame(); -- 2.7.4