diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-10-21 17:07:45 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-29 10:38:48 +0100 |
commit | 34bf0139c75de861c948391737af3c8c2a42703c (patch) | |
tree | 3eeeb615078c27b30e15a77adcda7d6537baef17 /src/qml/compiler/qv4isel_masm.cpp | |
parent | 5229a8b259286c9ea61036fd6b4bd0039104a206 (diff) |
Rework IR code generation for try/catch/finally
Simplify the generated code. Add a special block to catch
exceptions thrown inside a catch() statement.
store the exception on the stack when entering finally and
rethrow it at the end. This ensure correct behavior for
break/continue/return statements inside finally.
Don't check for exceptions after calling push_catch_scope
and pop_scope in the JIT'ed code. This can lead to infinite
loops when throwing inside an exception handler.
Change-Id: I67e9325794e2fd25b0773b21e02fbaadb43faab0
Change-Id: Ic1ea9c0c43eec1d49177dc1ab4552a1da04e96fe
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4isel_masm.cpp')
-rw-r--r-- | src/qml/compiler/qv4isel_masm.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp index 6fe0f27ec3..2d13b4d8c8 100644 --- a/src/qml/compiler/qv4isel_masm.cpp +++ b/src/qml/compiler/qv4isel_masm.cpp @@ -818,9 +818,8 @@ void InstructionSelection::callBuiltinDeleteValue(V4IR::Temp *result) void InstructionSelection::callBuiltinThrow(V4IR::Expr *arg) { - generateFunctionCall(Assembler::Void, __qmljs_throw, Assembler::ContextRegister, + generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_throw, Assembler::ContextRegister, Assembler::PointerToValue(arg)); - _as->jumpToExceptionHandler(); } void InstructionSelection::callBuiltinReThrow() @@ -828,10 +827,16 @@ void InstructionSelection::callBuiltinReThrow() _as->jumpToExceptionHandler(); } +void InstructionSelection::callBuiltinUnwindException(V4IR::Temp *result) +{ + generateFunctionCall(result, __qmljs_builtin_unwind_exception, Assembler::ContextRegister); + +} + void InstructionSelection::callBuiltinPushCatchScope(const QString &exceptionName) { Assembler::Pointer s = _as->loadStringAddress(Assembler::ScratchRegister, exceptionName); - generateFunctionCall(Assembler::ContextRegister, __qmljs_builtin_push_catch_scope, s, Assembler::ContextRegister); + generateFunctionCall(Assembler::ContextRegister, __qmljs_builtin_push_catch_scope, Assembler::ContextRegister, s); } void InstructionSelection::callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4IR::Temp *result) |