V4 JIT: fix JS stack frame size calculation.
authorErik Verbruggen <erik.verbruggen@digia.com>
Tue, 12 Aug 2014 14:56:39 +0000 (16:56 +0200)
committerErik Verbruggen <erik.verbruggen@digia.com>
Wed, 13 Aug 2014 09:01:55 +0000 (11:01 +0200)
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 <simon.hausmann@digia.com>
src/qml/jit/qv4assembler_p.h

index 6fde517..41a1bc4 100644 (file)
@@ -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