diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-08-05 15:20:08 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-05 21:19:56 +0200 |
commit | d459eb7e3dda1caffc88673468353c237cd0615c (patch) | |
tree | 8668500b11997afea0a211b380bcac869d9fc3ef /src/qml/qml/v4 | |
parent | a7f0e770f6452d68998114c3d05187b79a879d2c (diff) |
Fix line number resolution with the interpreter and try {} catch {}
When re-entering the interpreter for a try block, we use a different code
pointer and therefore need to set context->interpreterInstructionPointer
accordingly. We do that now at the beginning of run(), before we start
interpreting the instructions. When returning from a try block, we continue
using the old "code" pointer and therefore need to set
context->interpreterInstructionPointer back.
Change-Id: I607aef104d5f74bb0c44c6635619c99a6b397bce
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/v4')
-rw-r--r-- | src/qml/qml/v4/moth/qv4vme_moth.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/qml/qml/v4/moth/qv4vme_moth.cpp b/src/qml/qml/v4/moth/qv4vme_moth.cpp index 4090e7c35f..04cd3e16a4 100644 --- a/src/qml/qml/v4/moth/qv4vme_moth.cpp +++ b/src/qml/qml/v4/moth/qv4vme_moth.cpp @@ -238,6 +238,8 @@ QV4::Value VME::run(QV4::ExecutionContext *context, const uchar *&code, } #endif + context->interpreterInstructionPointer = &code; + #ifdef MOTH_THREADED_INTERPRETER const Instr *genericInstr = reinterpret_cast<const Instr *>(code); goto *genericInstr->common.code; @@ -339,6 +341,7 @@ QV4::Value VME::run(QV4::ExecutionContext *context, const uchar *&code, const uchar *tryCode = ((uchar *)&instr.tryOffset) + instr.tryOffset; run(context, tryCode, stack, stackSize); code = tryCode; + context->interpreterInstructionPointer = &code; } catch (QV4::Exception &ex) { ex.accept(context); VALUE(instr.exceptionVar) = ex.value(); @@ -347,6 +350,7 @@ QV4::Value VME::run(QV4::ExecutionContext *context, const uchar *&code, const uchar *catchCode = ((uchar *)&instr.catchOffset) + instr.catchOffset; run(catchContext, catchCode, stack, stackSize); code = catchCode; + context->interpreterInstructionPointer = &code; context = __qmljs_builtin_pop_scope(catchContext); } catch (QV4::Exception &ex) { ex.accept(context); @@ -354,6 +358,7 @@ QV4::Value VME::run(QV4::ExecutionContext *context, const uchar *&code, const uchar *catchCode = ((uchar *)&instr.catchOffset) + instr.catchOffset; run(context, catchCode, stack, stackSize); code = catchCode; + context->interpreterInstructionPointer = &code; } } MOTH_END_INSTR(EnterTry) @@ -573,6 +578,5 @@ void **VME::instructionJumpTable() QV4::Value VME::exec(QV4::ExecutionContext *ctxt, const uchar *code) { VME vme; - ctxt->interpreterInstructionPointer = &code; return vme.run(ctxt, code); } |