aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4identifiertable.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-06-23 22:25:53 +0200
committerLars Knoll <lars.knoll@qt.io>2018-07-02 19:29:40 +0000
commit86f88521fbea59e8ec53e50cc1e3e68a61f53c40 (patch)
tree25f72eaf70639409d3c8a8469a05b7be0a0da03b /src/qml/jsruntime/qv4identifiertable.cpp
parent8728a2b494eb384b65bd4e7c6ec785435a37de9d (diff)
Replace Identifier by PropertyKey
Change all uses of Identifier to use the new PropertyKey class and get rid of Identifier. Change-Id: Ib7e83b06a3c923235e145b6e083fe980dc240452 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4identifiertable.cpp')
-rw-r--r--src/qml/jsruntime/qv4identifiertable.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4identifiertable.cpp b/src/qml/jsruntime/qv4identifiertable.cpp
index b4e12cab17..f6e0ef330a 100644
--- a/src/qml/jsruntime/qv4identifiertable.cpp
+++ b/src/qml/jsruntime/qv4identifiertable.cpp
@@ -81,7 +81,7 @@ void IdentifierTable::addEntry(Heap::StringOrSymbol *str)
if (str->subtype == Heap::String::StringType_ArrayIndex)
return;
- str->identifier = Identifier::fromStringOrSymbol(str);
+ str->identifier = PropertyKey::fromStringOrSymbol(str);
bool grow = (alloc <= size*2);
@@ -110,7 +110,7 @@ void IdentifierTable::addEntry(Heap::StringOrSymbol *str)
Heap::StringOrSymbol *e = entriesById[i];
if (!e)
continue;
- uint idx = e->identifier.id % newAlloc;
+ uint idx = e->identifier.id() % newAlloc;
while (newEntries[idx]) {
++idx;
idx %= newAlloc;
@@ -130,7 +130,7 @@ void IdentifierTable::addEntry(Heap::StringOrSymbol *str)
}
entriesByHash[idx] = str;
- idx = str->identifier.id % alloc;
+ idx = str->identifier.id() % alloc;
while (entriesById[idx]) {
++idx;
idx %= alloc;
@@ -190,13 +190,13 @@ Heap::Symbol *IdentifierTable::insertSymbol(const QString &s)
}
-Identifier IdentifierTable::identifierImpl(const Heap::String *str)
+PropertyKey IdentifierTable::identifierImpl(const Heap::String *str)
{
if (str->identifier.isValid())
return str->identifier;
uint hash = str->hashValue();
if (str->subtype == Heap::String::StringType_ArrayIndex) {
- str->identifier = Identifier::fromArrayIndex(hash);
+ str->identifier = PropertyKey::fromArrayIndex(hash);
return str->identifier;
}
@@ -214,7 +214,7 @@ Identifier IdentifierTable::identifierImpl(const Heap::String *str)
return str->identifier;
}
-Heap::StringOrSymbol *IdentifierTable::resolveId(Identifier i) const
+Heap::StringOrSymbol *IdentifierTable::resolveId(PropertyKey i) const
{
uint arrayIdx = i.asArrayIndex();
if (arrayIdx < UINT_MAX)
@@ -222,7 +222,7 @@ Heap::StringOrSymbol *IdentifierTable::resolveId(Identifier i) const
if (!i.isValid())
return nullptr;
- uint idx = i.id % alloc;
+ uint idx = i.id() % alloc;
while (1) {
Heap::StringOrSymbol *e = entriesById[idx];
if (!e || e->identifier == i)
@@ -232,14 +232,14 @@ Heap::StringOrSymbol *IdentifierTable::resolveId(Identifier i) const
}
}
-Heap::String *IdentifierTable::stringForId(Identifier i) const
+Heap::String *IdentifierTable::stringForId(PropertyKey i) const
{
Heap::StringOrSymbol *s = resolveId(i);
Q_ASSERT(s && s->internalClass->vtable->isString);
return static_cast<Heap::String *>(s);
}
-Heap::Symbol *IdentifierTable::symbolForId(Identifier i) const
+Heap::Symbol *IdentifierTable::symbolForId(PropertyKey i) const
{
Heap::StringOrSymbol *s = resolveId(i);
Q_ASSERT(!s || !s->internalClass->vtable->isString);
@@ -300,18 +300,18 @@ int sweepTable(Heap::StringOrSymbol **table, int alloc, std::function<Key(Heap::
void IdentifierTable::sweep()
{
int f = sweepTable<int>(entriesByHash, alloc, [](Heap::StringOrSymbol *entry) {return entry->hashValue(); });
- int freed = sweepTable<quint64>(entriesById, alloc, [](Heap::StringOrSymbol *entry) {return entry->identifier.id; });
+ int freed = sweepTable<quint64>(entriesById, alloc, [](Heap::StringOrSymbol *entry) {return entry->identifier.id(); });
Q_UNUSED(f);
Q_ASSERT(f == freed);
size -= freed;
}
-Identifier IdentifierTable::identifier(const QString &s)
+PropertyKey IdentifierTable::identifier(const QString &s)
{
return insertString(s)->identifier;
}
-Identifier IdentifierTable::identifier(const char *s, int len)
+PropertyKey IdentifierTable::identifier(const char *s, int len)
{
uint subtype;
uint hash = String::createHashValue(s, len, &subtype);