diff options
author | Lars Knoll <[email protected]> | 2013-10-21 17:07:45 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-10-29 10:38:48 +0100 |
commit | 34bf0139c75de861c948391737af3c8c2a42703c (patch) | |
tree | 3eeeb615078c27b30e15a77adcda7d6537baef17 /src/qml/compiler/qv4isel_masm_p.h | |
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 <[email protected]>
Diffstat (limited to 'src/qml/compiler/qv4isel_masm_p.h')
-rw-r--r-- | src/qml/compiler/qv4isel_masm_p.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4isel_masm_p.h b/src/qml/compiler/qv4isel_masm_p.h index 3d1b271cdc..40d1aa5275 100644 --- a/src/qml/compiler/qv4isel_masm_p.h +++ b/src/qml/compiler/qv4isel_masm_p.h @@ -95,7 +95,15 @@ template <typename T> struct ExceptionCheck { enum { NeedsCheck = 1 }; }; - +// push_catch and pop context methods shouldn't check for exceptions +template <> +struct ExceptionCheck<QV4::ExecutionContext *(*)(QV4::ExecutionContext *)> { + enum { NeedsCheck = 0 }; +}; +template <typename A> +struct ExceptionCheck<QV4::ExecutionContext *(*)(QV4::ExecutionContext *, A)> { + enum { NeedsCheck = 0 }; +}; class Assembler : public JSC::MacroAssembler { @@ -1444,6 +1452,7 @@ protected: virtual void callBuiltinDeleteValue(V4IR::Temp *result); virtual void callBuiltinThrow(V4IR::Expr *arg); virtual void callBuiltinReThrow(); + virtual void callBuiltinUnwindException(V4IR::Temp *); virtual void callBuiltinPushCatchScope(const QString &exceptionName); virtual void callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4IR::Temp *result); virtual void callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V4IR::Temp *result); |