From a0986e6116e3a98f181cfd77fbcd3cf168dbc565 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 12 Aug 2014 16:56:39 +0200 Subject: [PATCH] V4 JIT: fix JS stack frame size calculation. StackLayout::calculateJSStackFrameSize now returns the size in number of QV4::Value items, instead of bytes. The value is then multiplied in the assembler by sizeof(Value) to get the number of bytes. Previously, the return value was number of bytes, which also got multiplied. A direct effect is that the JS stack size will be ~87% smaller, with the nice effect that the GC will run faster (less roots on the stack). It also won't retain objects whose reference accidentally ended up on the stack below the used portion for the current function, so possibly freeing (more) objects (earlier) than before. Change-Id: Idd5a9c173e641c03e6b8a6fe743e403eda34dfe0 Reviewed-by: Simon Hausmann --- src/qml/jit/qv4assembler_p.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qml/jit/qv4assembler_p.h b/src/qml/jit/qv4assembler_p.h index 6fde517..41a1bc4 100644 --- a/src/qml/jit/qv4assembler_p.h +++ b/src/qml/jit/qv4assembler_p.h @@ -361,11 +361,10 @@ public: return frameSize; } + /// \return the stack frame size in number of Value items. int calculateJSStackFrameSize() const { - const int locals = (localCount + sizeof(QV4::CallData)/sizeof(QV4::Value) - 1 + maxOutgoingArgumentCount) + 1; - int frameSize = locals * sizeof(QV4::Value); - return frameSize; + return (localCount + sizeof(QV4::CallData)/sizeof(QV4::Value) - 1 + maxOutgoingArgumentCount) + 1; } Address stackSlotPointer(int idx) const -- 2.7.4