aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2023-08-29 12:27:46 +0200
committerOlivier De Cannière <olivier.decanniere@qt.io>2023-08-30 10:06:13 +0200
commit041b326fe6f5b98bf4f808976bdfc1a8d5aaeede (patch)
tree943e9f2e4409687e1138700d328d079b16f50e9d /src/qml/compiler/qv4codegen.cpp
parent50a7560b784f16e4d8d697ce62bede8aa56d75f6 (diff)
qv4codegen: Eliminate redundant SetUnwindHandler for try-catch-finally
For try-catch-finally sequences with a catch block, the generator would start by setting the unwind handler to code from the finally block and immediately after that set the handler to code from the catch block, overwriting the last instruction. In cases with catch blocks, do not emit the first instruction setting the unwind handler. Change-Id: I588433c1ad2521b1750f77f2084315a707577a8a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 888d9beaf0..6cedf906c0 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -3927,7 +3927,8 @@ void Codegen::handleTryCatch(TryStatement *ast)
void Codegen::handleTryFinally(TryStatement *ast)
{
RegisterScope scope(this);
- ControlFlowFinally finally(this, ast->finallyExpression);
+ const bool hasCatchBlock = ast->catchExpression;
+ ControlFlowFinally finally(this, ast->finallyExpression, hasCatchBlock);
TailCallBlocker blockTailCalls(this); // IMPORTANT: destruction will unblock tail calls before finally is generated
if (ast->catchExpression) {