diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-09-09 07:53:46 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-09-09 07:53:46 (GMT) |
commit | d71d5ffd356342e55f09b31f5a702926f86994eb (patch) | |
tree | 9905e5ec166f9f26de4ad6633bf41b594a4b7de7 /src/script/api/qscriptcontextinfo.cpp | |
parent | 85881f83c34cbb92e5d2ea61d16daef1f34fcad8 (diff) | |
parent | f7906352b21b0634745094f7bb7966d5f6941192 (diff) | |
download | Qt-d71d5ffd356342e55f09b31f5a702926f86994eb.zip Qt-d71d5ffd356342e55f09b31f5a702926f86994eb.tar.gz Qt-d71d5ffd356342e55f09b31f5a702926f86994eb.tar.bz2 |
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/script/api/qscriptcontextinfo.cpp')
-rw-r--r-- | src/script/api/qscriptcontextinfo.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp index fbf1292..1be76a9 100644 --- a/src/script/api/qscriptcontextinfo.cpp +++ b/src/script/api/qscriptcontextinfo.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtScript module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. @@ -162,16 +162,19 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte // Get the line number: //We need to know the context directly up in the backtrace, in order to get the line number, and adjust the global context - QScriptContext *rewindContext = context->engine()->currentContext(); - if (rewindContext != context) { //ignore top context (native function) + JSC::CallFrame *rewindContext = QScriptEnginePrivate::get(context->engine())->currentFrame; + if (QScriptEnginePrivate::contextForFrame(rewindContext) == context) { //top context + frame = rewindContext; //for retreiving the global context's "fake" frame + // An agent might have provided the line number. + lineNumber = QScript::scriptEngineFromExec(frame)->agentLineNumber; + } else { // rewind the stack from the top in order to find the frame from the caller where the returnPC is stored - while (rewindContext && rewindContext->parentContext() != context) - rewindContext = rewindContext->parentContext(); + while (rewindContext && QScriptEnginePrivate::contextForFrame(rewindContext->callerFrame()->removeHostCallFrameFlag()) != context) + rewindContext = rewindContext->callerFrame()->removeHostCallFrameFlag(); if (rewindContext) { - JSC::ExecState *aboveFrame = QScriptEnginePrivate::frameForContext(rewindContext); - frame = aboveFrame->callerFrame()->removeHostCallFrameFlag(); //it will be different for the global context. + frame = rewindContext->callerFrame()->removeHostCallFrameFlag(); //for retreiving the global context's "fake" frame - JSC::Instruction *returnPC = aboveFrame->returnPC(); + JSC::Instruction *returnPC = rewindContext->returnPC(); JSC::CodeBlock *codeBlock = frame->codeBlock(); if (returnPC && codeBlock) { #if ENABLE(JIT) @@ -183,9 +186,6 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte lineNumber = codeBlock->lineNumberForBytecodeOffset(const_cast<JSC::ExecState *>(frame), bytecodeOffset); } } - } else { - // An agent might have provided the line number. - lineNumber = QScript::scriptEngineFromExec(frame)->agentLineNumber; } // Get the filename and the scriptId: |