aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4internalclass_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-04-06 16:24:59 +0200
committerLars Knoll <lars.knoll@qt.io>2018-05-02 14:18:32 +0000
commita6da23bb5f6004e13d22838c7db1246169874930 (patch)
tree27455bc82cb7705f9f0b8816fee02b7b22927d08 /src/qml/jsruntime/qv4internalclass_p.h
parentd1af494793961a31747b689cf307b65d99367486 (diff)
Garbage collect identifiers
Implemented by storing a backpointer to the Heap object in the identifier. Since identifiers now point back to their originating String or Symbol, we can now easily mark all identifiers that are still in use and collect those that aren't. Since Identifiers are 64bit also add support for holding an array index in there. With that an identifier can describe any kind of property that can be accessed in an object. This helps speed up and simplify some code paths. To make this possible, we need to register all IdentifierHash instances with the identifier table, so that we can properly mark those identifiers. Change-Id: Icadbaf5712ab9d252d4e71aa4a520e86b14cd2a0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4internalclass_p.h')
-rw-r--r--src/qml/jsruntime/qv4internalclass_p.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4internalclass_p.h b/src/qml/jsruntime/qv4internalclass_p.h
index a2c7620910..290251f4ba 100644
--- a/src/qml/jsruntime/qv4internalclass_p.h
+++ b/src/qml/jsruntime/qv4internalclass_p.h
@@ -134,7 +134,7 @@ inline uint PropertyHash::lookup(Identifier identifier) const
while (1) {
if (d->entries[idx].identifier == identifier)
return d->entries[idx].index;
- if (!d->entries[idx].identifier)
+ if (!d->entries[idx].identifier.isValid())
return UINT_MAX;
++idx;
idx %= d->alloc;
@@ -258,8 +258,6 @@ struct InternalClassTransition
{ return id < other.id || (id == other.id && flags < other.flags); }
};
-static_assert(sizeof(Identifier) == sizeof(VTable *), "Identifier needs to be one pointer large to map into the union above");
-
namespace Heap {
struct InternalClass : Base {