aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4identifier.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-04-06 12:49:09 +0200
committerLars Knoll <lars.knoll@qt.io>2018-05-02 14:18:02 +0000
commit238b1cb1cb8915995b6dfe4e404f1771c62b3169 (patch)
treeb752ada237d71b5d3cd6fea5f7424b7c92adaa2f /src/qml/jsruntime/qv4identifier.cpp
parent5cd9d88c2683c5d226ab1dc0384868408c036fe9 (diff)
Turn Identifier into a simple integer
Add a reverse mapping table to the IdentifierHash to avoid having to store a hash value inside the identifier. This makes it possible to then use the identifiers value based and not new them on the heap anymore. Change-Id: If1f177588ea104565c6e3add49c70534a6c7dcb8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4identifier.cpp')
-rw-r--r--src/qml/jsruntime/qv4identifier.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4identifier.cpp b/src/qml/jsruntime/qv4identifier.cpp
index 77510d95f6..69d44f89c4 100644
--- a/src/qml/jsruntime/qv4identifier.cpp
+++ b/src/qml/jsruntime/qv4identifier.cpp
@@ -107,7 +107,7 @@ IdentifierHashEntry *IdentifierHash::addEntry(const Identifier *identifier)
const IdentifierHashEntry &e = d->entries[i];
if (!e.identifier)
continue;
- uint idx = e.identifier->hashValue % newAlloc;
+ uint idx = e.identifier->id % newAlloc;
while (newEntries[idx].identifier) {
++idx;
idx %= newAlloc;
@@ -119,7 +119,7 @@ IdentifierHashEntry *IdentifierHash::addEntry(const Identifier *identifier)
d->alloc = newAlloc;
}
- uint idx = identifier->hashValue % d->alloc;
+ uint idx = identifier->id % d->alloc;
while (d->entries[idx].identifier) {
Q_ASSERT(d->entries[idx].identifier != identifier);
++idx;
@@ -136,7 +136,7 @@ const IdentifierHashEntry *IdentifierHash::lookup(const Identifier *identifier)
return nullptr;
Q_ASSERT(d->entries);
- uint idx = identifier->hashValue % d->alloc;
+ uint idx = identifier->id % d->alloc;
while (1) {
if (!d->entries[idx].identifier)
return nullptr;