diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-06-01 12:21:08 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-06-21 12:27:21 +0000 |
commit | 267513e6d955cb93abb879c495dd079c254d3493 (patch) | |
tree | 8cd3bd26756142b80b9e12f77e8b3e7e868be35b /src/qml/compiler/qv4instr_moth_p.h | |
parent | 93a70a051b21ae253331f922027bd9bb7a3e457a (diff) |
Rework unwind handling
The old code was rather convoluted and expanded to quite
a bit of bytecode. It was also very hard to fix some
of the remaining issues with unwinding in there.
The new code handles unwinding a bit differently. Basically,
we now have three instructions to do what the spec requires.
SetUnwindHandler is the same as the old SetExceptionHandler
instruction. It basically tells the runtime where to jump to
to handle any abrupt completion (ie. throw/break/continue/return)
that requires unwinding.
UnwindToLabel is a new instruction that is used for unwinding
break/continue/return statements. It takes two arguments, one
telling the runtime how many levels to unwind and the second
a target label to jump to when unwinding is done.
UnwindDispatch is the third instruction and is invoked at
the end of each unwind block to dispatch the the parent
unwind handler if required and thus implement the support
for the levelled unwinding.
Change-Id: I079a39d0d897b3ecc2f0dc631ca29b25eae05250
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4instr_moth_p.h')
-rw-r--r-- | src/qml/compiler/qv4instr_moth_p.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h index ea72be12fe..3adb9c2e0f 100644 --- a/src/qml/compiler/qv4instr_moth_p.h +++ b/src/qml/compiler/qv4instr_moth_p.h @@ -112,6 +112,8 @@ QT_BEGIN_NAMESPACE #define INSTR_CallScopeObjectProperty(op) INSTRUCTION(op, CallScopeObjectProperty, 4, name, base, argc, argv) #define INSTR_CallContextObjectProperty(op) INSTRUCTION(op, CallContextObjectProperty, 4, name, base, argc, argv) #define INSTR_SetUnwindHandler(op) INSTRUCTION(op, SetUnwindHandler, 1, offset) +#define INSTR_UnwindDispatch(op) INSTRUCTION(op, UnwindDispatch, 0) +#define INSTR_UnwindToLabel(op) INSTRUCTION(op, UnwindToLabel, 2, level, offset) #define INSTR_ThrowException(op) INSTRUCTION(op, ThrowException, 0) #define INSTR_GetException(op) INSTRUCTION(op, GetException, 0) #define INSTR_SetException(op) INSTRUCTION(op, SetException, 0) @@ -145,6 +147,7 @@ QT_BEGIN_NAMESPACE #define INSTR_JumpTrue(op) INSTRUCTION(op, JumpTrue, 1, offset) #define INSTR_JumpFalse(op) INSTRUCTION(op, JumpFalse, 1, offset) #define INSTR_JumpNotUndefined(op) INSTRUCTION(op, JumpNotUndefined, 1, offset) +#define INSTR_JumpNoException(op) INSTRUCTION(op, JumpNoException, 1, offset) #define INSTR_JumpEmpty(op) INSTRUCTION(op, JumpEmpty, 1, offset) #define INSTR_CmpEqNull(op) INSTRUCTION(op, CmpEqNull, 0) #define INSTR_CmpNeNull(op) INSTRUCTION(op, CmpNeNull, 0) @@ -160,8 +163,6 @@ QT_BEGIN_NAMESPACE #define INSTR_CmpStrictNotEqual(op) INSTRUCTION(op, CmpStrictNotEqual, 1, lhs) #define INSTR_CmpIn(op) INSTRUCTION(op, CmpIn, 1, lhs) #define INSTR_CmpInstanceOf(op) INSTRUCTION(op, CmpInstanceOf, 1, lhs) -#define INSTR_JumpStrictEqualStackSlotInt(op) INSTRUCTION(op, JumpStrictEqualStackSlotInt, 3, lhs, rhs, offset) -#define INSTR_JumpStrictNotEqualStackSlotInt(op) INSTRUCTION(op, JumpStrictNotEqualStackSlotInt, 3, lhs, rhs, offset) #define INSTR_UNot(op) INSTRUCTION(op, UNot, 0) #define INSTR_UPlus(op) INSTRUCTION(op, UPlus, 0) #define INSTR_UMinus(op) INSTRUCTION(op, UMinus, 0) @@ -241,6 +242,8 @@ QT_BEGIN_NAMESPACE F(CallScopeObjectProperty) \ F(CallContextObjectProperty) \ F(SetUnwindHandler) \ + F(UnwindDispatch) \ + F(UnwindToLabel) \ F(ThrowException) \ F(GetException) \ F(SetException) \ @@ -273,6 +276,7 @@ QT_BEGIN_NAMESPACE F(Jump) \ F(JumpTrue) \ F(JumpFalse) \ + F(JumpNoException) \ F(JumpNotUndefined) \ F(JumpEmpty) \ F(CmpEqNull) \ @@ -289,8 +293,6 @@ QT_BEGIN_NAMESPACE F(CmpStrictNotEqual) \ F(CmpIn) \ F(CmpInstanceOf) \ - F(JumpStrictEqualStackSlotInt) \ - F(JumpStrictNotEqualStackSlotInt) \ F(UNot) \ F(UPlus) \ F(UMinus) \ |