summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-29 09:27:40 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-29 11:31:17 +0200
commitf10dc46c0a0763df4e136bd4664b68e1a1388ad6 (patch)
tree909cbb4944fed9a3914c55cf56c66245d66fe7a7 /src/script
parentd2459611fd3650d8c80a3ccafd9ec3d58457a888 (diff)
QScript: fix the way the js stack is advanced.
It is possible to call QScriptEngine::pushContext before we start any evaluation. We need to change JSC so it doesn't always start at the beginning of the stack. Also fix QScriptContext::pushContext not to waste space between callframes. Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptengine.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index b27d1be33c..ee2523991e 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -2360,11 +2360,9 @@ JSC::CallFrame *QScriptEnginePrivate::pushContext(JSC::CallFrame *exec, JSC::JSV
JSC::Register *oldEnd = interp->registerFile().end();
int argc = args.size() + 1; //add "this"
JSC::Register *newEnd = oldEnd + argc + JSC::RegisterFile::CallFrameHeaderSize;
- //Without + argc + JSC::RegisterFile::CallFrameHeaderSize, it crashes.
- //It seems that JSC is not consistant with the way the callframe is crated
- if (!interp->registerFile().grow(newEnd + argc + JSC::RegisterFile::CallFrameHeaderSize))
+ if (!interp->registerFile().grow(newEnd))
return 0; //### Stack overflow
- newCallFrame = JSC::CallFrame::create(newEnd);
+ newCallFrame = JSC::CallFrame::create(oldEnd);
newCallFrame[0] = thisObject;
int dst = 0;
JSC::ArgList::const_iterator it;