aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/data
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2023-02-14 12:10:43 +0100
committerOlivier De Cannière <olivier.decanniere@qt.io>2023-02-15 09:02:08 +0100
commite5c2b236a04050bf20aaf96068e9b9b911bc70ad (patch)
treee876af7f0367849700e029d0ea4646e8c6b08981 /tests/auto/qml/qqmllanguage/data
parent8721df3dae5c78e5406a01308c033baf9b9d6844 (diff)
JIT: Fix isNullOrUndefined bad logic
A logic error was left over in isNullOrUndefined that didn't actually check for null of undefined after a change of encoding. tst_qqmllanguage::isNullOrUndefined() was added to check the bug doesn't happen anymore. Two cases are tested. The first is intended to run on the interpreter. It was fine before this change and should be fine afterwards. The second one calls the same function many times for JIT optimizations to kick in and compile the function. This should ensure the broken '??' and '?.' operators are fixed when running on the JIT. Amends c7722d4ed61d6a887e9f6c403ffa10b2048de2a4. Fixes: QTBUG-111088 Pick-to: 6.5 Change-Id: I0e6d77363770e801aa586588e242220dec9d5e0a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/data')
-rw-r--r--tests/auto/qml/qqmllanguage/data/isNullOrUndefined_interpreter.qml22
-rw-r--r--tests/auto/qml/qqmllanguage/data/isNullOrUndefined_jit.qml22
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/isNullOrUndefined_interpreter.qml b/tests/auto/qml/qqmllanguage/data/isNullOrUndefined_interpreter.qml
new file mode 100644
index 0000000000..ee280f9e8e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/isNullOrUndefined_interpreter.qml
@@ -0,0 +1,22 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQml
+
+QtObject {
+ id: self
+ property int a: 3
+ property var result
+ Component.onCompleted: {
+ var sum = 0
+ let f = function() {
+ return self.notthere ?? self.a
+ }
+
+ // Not enough times for the jit to kick in (should run on the interpreter)
+ for (let i = 0; i < 1; i++) {
+ sum = sum + f()
+ }
+ result = sum
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/isNullOrUndefined_jit.qml b/tests/auto/qml/qqmllanguage/data/isNullOrUndefined_jit.qml
new file mode 100644
index 0000000000..6bd4f62b8d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/isNullOrUndefined_jit.qml
@@ -0,0 +1,22 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQml
+
+QtObject {
+ id: self
+ property int a: 3
+ property int result
+ Component.onCompleted: {
+ var sum = 0
+ let f = function() {
+ return self.notthere ?? self.a
+ }
+
+ // Enough times for the jit to kick in (should run on the jit)
+ for (let i = 0; i < 50; i++) {
+ sum = sum + f()
+ }
+ result = sum
+ }
+}