diff options
-rw-r--r-- | src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp | 8 | ||||
-rw-r--r-- | src/script/api/qscriptengine.cpp | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp index bfb0307..4200023 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp @@ -885,13 +885,21 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObjec } Register* oldEnd = m_registerFile.end(); +#ifdef QT_BUILD_SCRIPT_LIB //with QtScript, we do not necesserly start from scratch + Register* newEnd = oldEnd + globalRegisterOffset + codeBlock->m_numCalleeRegisters; +#else Register* newEnd = m_registerFile.start() + globalRegisterOffset + codeBlock->m_numCalleeRegisters; +#endif if (!m_registerFile.grow(newEnd)) { *exception = createStackOverflowError(callFrame); return jsNull(); } +#ifdef QT_BUILD_SCRIPT_LIB //with QtScript, we do not necesserly start from scratch + CallFrame* newCallFrame = CallFrame::create(oldEnd + globalRegisterOffset); +#else CallFrame* newCallFrame = CallFrame::create(m_registerFile.start() + globalRegisterOffset); +#endif // a 0 codeBlock indicates a built-in caller newCallFrame->r(codeBlock->thisRegister()) = JSValue(thisObj); diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index b27d1be..ee25239 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; |