aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4sequenceobject.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2025-08-27 13:52:41 +0200
committerUlf Hermann <ulf.hermann@qt.io>2025-09-01 19:25:21 +0200
commit476ee7f5a3b1c4ac027f8dbba35e864158c57d17 (patch)
treec8f20dc324be9ec63462a2acf4d15c67cfba64c8 /src/qml/jsruntime/qv4sequenceobject.cpp
parent8953a873fa279a88a0ac45ad722ac229acf7bd24 (diff)
QtQml: Inline Sequence::containerIsEqualTo into its only user
We don't want to expose it from Sequence's interface. Pick-to: 6.10 6.9 6.8 Task-number: QTBUG-129972 Task-number: QTBUG-139025 Change-Id: Iae144bb8a66a24660dd8da490edb0b4bd7cdc81e Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4sequenceobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index eea02926e1..494f1a3196 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -286,22 +286,6 @@ static void removeLastInline(Heap::Sequence *p, qsizetype num)
}
}
-bool Sequence::containerIsEqualTo(Managed *other)
-{
- if (!other)
- return false;
- Sequence *otherSequence = other->as<Sequence>();
- if (!otherSequence)
- return false;
- if (d()->object() && otherSequence->d()->object()) {
- return d()->object() == otherSequence->d()->object()
- && d()->property() == otherSequence->d()->property();
- } else if (!d()->object() && !otherSequence->d()->object()) {
- return this == otherSequence;
- }
- return false;
-}
-
bool Heap::Sequence::loadReference()
{
Q_ASSERT(object());
@@ -433,7 +417,27 @@ bool Sequence::virtualDeleteProperty(Managed *that, PropertyKey id)
bool Sequence::virtualIsEqualTo(Managed *that, Managed *other)
{
- return static_cast<Sequence *>(that)->containerIsEqualTo(other);
+ if (!other)
+ return false;
+
+ const Sequence *otherS = other->as<Sequence>();
+ if (!otherS)
+ return false;
+
+ const Sequence *s = static_cast<Sequence *>(that);
+ const Heap::Sequence *p = s->d();
+ const Heap::Sequence *otherP = otherS->d();
+
+ const Heap::Object *object = p->object();
+ const Heap::Object *otherObject = otherP->object();
+
+ if (object && otherObject)
+ return object == otherObject && p->property() == otherP->property();
+
+ if (!object && !otherObject)
+ return s == otherS;
+
+ return false;
}
OwnPropertyKeyIterator *Sequence::virtualOwnPropertyKeys(const Object *m, Value *target)