diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-28 14:28:36 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-28 15:38:55 (GMT) |
commit | ffeb75fe970dadbf2b5e5a96bc63ba0a53fb6be5 (patch) | |
tree | 4b366cc9bac8e8609c71f4671b32c574e0ce4639 /src/3rdparty/javascriptcore | |
parent | 4efaf156223cd12f799164a479929f78a9b5db95 (diff) | |
download | Qt-ffeb75fe970dadbf2b5e5a96bc63ba0a53fb6be5.zip Qt-ffeb75fe970dadbf2b5e5a96bc63ba0a53fb6be5.tar.gz Qt-ffeb75fe970dadbf2b5e5a96bc63ba0a53fb6be5.tar.bz2 |
QScript: Fix strange bugs and crashes.
I was assuming that the default return value register was always set
to 0 for native calls. But this is not the case. So we must ensure this.
Also be consistend in the way the stackframe grow and shrink. This expose
another bug in the way the call frame is created in JSC
Reviewed-by: Kent Hansen
Diffstat (limited to 'src/3rdparty/javascriptcore')
-rw-r--r-- | src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp index c31216b..bfb0307 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp @@ -3071,8 +3071,11 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi if (callType == CallTypeHost) { ScopeChainNode* scopeChain = callFrame->scopeChain(); CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset); +#ifdef QT_BUILD_SCRIPT_LIB //we need the returnValue to be 0 as it is used as flags + newCallFrame->init(0, vPC + 5, scopeChain, callFrame, 0, argCount, asObject(v)); +#else newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, asObject(v)); - +#endif Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount; ArgList args(thisRegister + 1, argCount - 1); @@ -3225,7 +3228,12 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi if (callType == CallTypeHost) { ScopeChainNode* scopeChain = callFrame->scopeChain(); CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset); +#ifdef QT_BUILD_SCRIPT_LIB //we need the returnValue to be 0 as it is used as flags + newCallFrame->init(0, vPC + 5, scopeChain, callFrame, 0, argCount, asObject(v)); +#else newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, asObject(v)); +#endif + Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount; ArgList args(thisRegister + 1, argCount - 1); @@ -3501,7 +3509,11 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi ScopeChainNode* scopeChain = callFrame->scopeChain(); CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset); +#ifdef QT_BUILD_SCRIPT_LIB //we need the returnValue to be 0 as it is used as flags + newCallFrame->init(0, vPC + 7, scopeChain, callFrame, 0, argCount, asObject(v)); +#else newCallFrame->init(0, vPC + 7, scopeChain, callFrame, dst, argCount, asObject(v)); +#endif JSValue returnValue; { |