aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2022-09-29 12:07:07 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-09-30 11:21:38 +0000
commitf693fb3d1bca9e918cd3d0b733c402fadeda7c97 (patch)
treecc430fb6af87d75d3265f5e7ba4f72aaea14bfd8 /src/qml/compiler/qv4codegen.cpp
parent30104dabe6cf73d8749537aa4b537b11dad26b40 (diff)
Do not store the accumulator in optional chaining call
There are two cases: - Either the optional value is nullish, then we overwrite the accumulator with undefined, or - the value is not nullish, in which case we do a call. None of the call instructions read the accumulator, and all of them overwrite it. So in both cases we do not need the current value in the accumulator, and can thus skip saving and restoring it. Fixes: QTBUG-107047 Pick-to: 6.4 Change-Id: I620e525d59990a5d7a0af15e2ee48795163c6575 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 9014ad3a98..995038e95c 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -1971,14 +1971,12 @@ bool Codegen::visit(CallExpression *ast)
auto jumpLabel = ast->isOptional ? m_optionalChainLabels.take(ast) : *base.optionalChainJumpLabel.get();
- auto acc = Reference::fromAccumulator(this).storeOnStack();
base.loadInAccumulator();
bytecodeGenerator->addInstruction(Instruction::CmpEqNull());
auto jumpFalse = bytecodeGenerator->jumpFalse();
bytecodeGenerator->addInstruction(Instruction::LoadUndefined());
bytecodeGenerator->jump().link(jumpLabel);
jumpFalse.link();
- acc.loadInAccumulator();
}
auto calldata = pushArgs(ast->arguments);