diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-11-14 15:58:39 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-22 14:54:36 +0100 |
commit | 85fea8a68b90c817c47022ca5157ff80cb497d4d (patch) | |
tree | a35010ed51fb282d4c727631cb9ce42603d26a80 /src/qml/jsruntime | |
parent | bf173fe5da381c88343296ca33ef6b06389c6d20 (diff) |
Saner and simpler way to handle line numbers for JITed code
Instead of storing the current instruction pointer in the
ExecutionContext, we might as well directly store the current
line number there.
Leads to simpler code, works cross platform and should also
be faster.
Change-Id: Ifb7897cf8dbe8a962505fe876aa3ed43283ebb06
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4context_p.h | 8 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 9 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index 9b080dc590..e7f5ee9a9e 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -110,7 +110,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed EvalCode *currentEvalCode; const uchar **interpreterInstructionPointer; - char *jitInstructionPointer; + int lineNumber; void initBaseContext(Type type, ExecutionEngine *engine, ExecutionContext *parentContext) { @@ -123,7 +123,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed compilationUnit = 0; currentEvalCode = 0; interpreterInstructionPointer = 0; - jitInstructionPointer = 0; + lineNumber = -1; } CallContext *newCallContext(FunctionObject *f, CallData *callData); @@ -141,11 +141,11 @@ struct Q_QML_EXPORT ExecutionContext : public Managed ReturnedValue throwError(const QV4::ValueRef value); ReturnedValue throwError(const QString &message); ReturnedValue throwSyntaxError(const QString &message); - ReturnedValue throwSyntaxError(const QString &message, const QString &fileName, int line, int column); + ReturnedValue throwSyntaxError(const QString &message, const QString &fileName, int lineNumber, int column); ReturnedValue throwTypeError(); ReturnedValue throwTypeError(const QString &message); ReturnedValue throwReferenceError(const ValueRef value); - ReturnedValue throwReferenceError(const QString &value, const QString &fileName, int line, int column); + ReturnedValue throwReferenceError(const QString &value, const QString &fileName, int lineNumber, int column); ReturnedValue throwRangeError(const ValueRef value); ReturnedValue throwRangeError(const QString &message); ReturnedValue throwURIError(const ValueRef msg); diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 19aaee104f..90220f0a36 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -621,11 +621,12 @@ namespace { void resolve(StackFrame *frame, ExecutionContext *context, Function *function) { qptrdiff offset; - if (context->interpreterInstructionPointer) + if (context->interpreterInstructionPointer) { offset = *context->interpreterInstructionPointer - 1 - function->codeData; - else - offset = context->jitInstructionPointer - (char*)function->codePtr; - frame->line = function->lineNumberForProgramCounter(offset); + frame->line = function->lineNumberForProgramCounter(offset); + } else { + frame->line = context->lineNumber; + } } }; } |