aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2019-02-06 10:32:31 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-02-25 12:49:10 +0000
commitcdb8eb988e572411030486ad2834ae54e4567bf3 (patch)
tree6f0e303eaad0b8d8cffc6584c19138e6e55b832b /src/qml/compiler
parent3fdc562743cdaddf554785bd83b66b254f560090 (diff)
V4: Rotate loop in ArrayPattern and eliminate "done" label
This prevents jumping over the resetting of the unwind handler when an exception occurs. (cherry-picked from commit 0282b89ec672e25a465a8e51bc74c7fd58a624b1) Fixes: QTBUG-73985 Change-Id: I4a4da815f54c13980d239e0492f9b013991cfbd5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r--src/qml/compiler/qv4codegen.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 010848bdca..256ab6e0be 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -1207,7 +1207,6 @@ bool Codegen::visit(ArrayPattern *ast)
BytecodeGenerator::Label in = bytecodeGenerator->newLabel();
BytecodeGenerator::Label end = bytecodeGenerator->newLabel();
- BytecodeGenerator::Label done = bytecodeGenerator->newLabel();
{
auto cleanup = [this, iterator, iteratorDone]() {
@@ -1217,12 +1216,6 @@ bool Codegen::visit(ArrayPattern *ast)
bytecodeGenerator->addInstruction(close);
};
ControlFlowLoop flow(this, &end, &in, cleanup);
- bytecodeGenerator->jump().link(in);
-
- BytecodeGenerator::Label body = bytecodeGenerator->label();
-
- lhsValue.loadInAccumulator();
- pushAccumulator();
in.link();
iterator.loadInAccumulator();
@@ -1230,13 +1223,14 @@ bool Codegen::visit(ArrayPattern *ast)
next.value = lhsValue.stackSlot();
next.done = iteratorDone.stackSlot();
bytecodeGenerator->addInstruction(next);
- bytecodeGenerator->addJumpInstruction(Instruction::JumpFalse()).link(body);
- bytecodeGenerator->jump().link(done);
+ bytecodeGenerator->addJumpInstruction(Instruction::JumpTrue()).link(end);
+ lhsValue.loadInAccumulator();
+ pushAccumulator();
+
+ bytecodeGenerator->jump().link(in);
end.link();
}
-
- done.link();
} else {
RegisterScope innerScope(this);
Reference expr = expression(it->element->initializer);