summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-08-28 10:04:01 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-08-28 10:05:11 (GMT)
commit089f2bed9ba92f688709d89e65273309a07cfef9 (patch)
treec65648c731fe61ff8ee11f2f5253420fb2dc540f /src/script
parent2d5a70e25c1ea140cb2c6faca4758af4f1d2a663 (diff)
downloadQt-089f2bed9ba92f688709d89e65273309a07cfef9.zip
Qt-089f2bed9ba92f688709d89e65273309a07cfef9.tar.gz
Qt-089f2bed9ba92f688709d89e65273309a07cfef9.tar.bz2
QScriptContextInfo: fix the line numbers with JIT
It even works better than with the interpreter
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptcontextinfo.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp
index e59b773..890ed9d 100644
--- a/src/script/api/qscriptcontextinfo.cpp
+++ b/src/script/api/qscriptcontextinfo.cpp
@@ -50,6 +50,9 @@
#include <QtCore/qmetaobject.h>
#include "CodeBlock.h"
#include "JSFunction.h"
+#if ENABLE(JIT)
+#include "MacroAssemblerCodeRef.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -154,7 +157,7 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte
lineNumber = -1;
columnNumber = -1;
- const JSC::ExecState *frame = QScriptEnginePrivate::frameForContext(context);
+ JSC::CallFrame *frame = const_cast<JSC::CallFrame *>(QScriptEnginePrivate::frameForContext(context));
// Get the line number:
@@ -171,8 +174,13 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte
JSC::Instruction *returnPC = aboveFrame->returnPC();
JSC::CodeBlock *codeBlock = frame->codeBlock();
if (returnPC && codeBlock) {
- lineNumber = codeBlock->lineNumberForBytecodeOffset(const_cast<JSC::ExecState *>(frame),
- returnPC - codeBlock->instructions().begin() -1);
+#if ENABLE(JIT)
+ unsigned bytecodeOffset = codeBlock->getBytecodeIndex(frame, JSC::ReturnAddressPtr(returnPC));
+#else
+ unsigned bytecodeOffset = returnPC - codeBlock->instructions().begin();
+#endif
+ bytecodeOffset--; //because returnPC is on the next instruction. We want the current one
+ lineNumber = codeBlock->lineNumberForBytecodeOffset(const_cast<JSC::ExecState *>(frame), bytecodeOffset);
}
}
} else {