diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-04-06 12:49:09 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-02 14:18:02 +0000 |
commit | 238b1cb1cb8915995b6dfe4e404f1771c62b3169 (patch) | |
tree | b752ada237d71b5d3cd6fea5f7424b7c92adaa2f /src/qml/jsruntime/qv4internalclass.cpp | |
parent | 5cd9d88c2683c5d226ab1dc0384868408c036fe9 (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/qv4internalclass.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4internalclass.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp index 4c7eb7b185..532d35962c 100644 --- a/src/qml/jsruntime/qv4internalclass.cpp +++ b/src/qml/jsruntime/qv4internalclass.cpp @@ -77,7 +77,7 @@ void PropertyHash::addEntry(const PropertyHash::Entry &entry, int classSize) if (classSize < d->size || grow) detach(grow, classSize); - uint idx = entry.identifier->hashValue % d->alloc; + uint idx = entry.identifier->id % d->alloc; while (d->entries[idx].identifier) { ++idx; idx %= d->alloc; @@ -98,7 +98,7 @@ int PropertyHash::removeIdentifier(Identifier *identifier, int classSize) val = e.index; continue; } - uint idx = e.identifier->hashValue % dd->alloc; + uint idx = e.identifier->id % dd->alloc; while (dd->entries[idx].identifier) { ++idx; idx %= dd->alloc; @@ -124,7 +124,7 @@ void PropertyHash::detach(bool grow, int classSize) const Entry &e = d->entries[i]; if (!e.identifier || e.index >= static_cast<unsigned>(classSize)) continue; - uint idx = e.identifier->hashValue % dd->alloc; + uint idx = e.identifier->id % dd->alloc; while (dd->entries[idx].identifier) { ++idx; idx %= dd->alloc; |