diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-09-29 12:07:07 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-09-30 11:21:38 +0000 |
commit | f693fb3d1bca9e918cd3d0b733c402fadeda7c97 (patch) | |
tree | cc430fb6af87d75d3265f5e7ba4f72aaea14bfd8 /src/qml/compiler/qv4codegen.cpp | |
parent | 30104dabe6cf73d8749537aa4b537b11dad26b40 (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.cpp | 2 |
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); |