diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-04-29 11:32:19 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-22 13:49:05 +0200 |
commit | 541da479754e6da07463cd6f0dd0e24bc6746494 (patch) | |
tree | e4d949f1e1d8a71f8f868e02d01e0742fb8b55c2 /src/qml/jsruntime/qv4identifiertable.cpp | |
parent | 233b339c480e313bc49d16f9b85bc4318f4c3f48 (diff) |
Convert String to the new storage layout
Change-Id: Ifa9aac63fdb270fb449f11832a1792caeb6c6724
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4identifiertable.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4identifiertable.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/qml/jsruntime/qv4identifiertable.cpp b/src/qml/jsruntime/qv4identifiertable.cpp index 2d127af0e6..8627438fe1 100644 --- a/src/qml/jsruntime/qv4identifiertable.cpp +++ b/src/qml/jsruntime/qv4identifiertable.cpp @@ -69,7 +69,7 @@ IdentifierTable::~IdentifierTable() { for (int i = 0; i < alloc; ++i) if (entries[i]) - delete entries[i]->stringData()->identifier; + delete entries[i]->d()->identifier; free(entries); } @@ -80,9 +80,9 @@ void IdentifierTable::addEntry(String *str) if (str->subtype() == String::StringType_ArrayIndex) return; - str->stringData()->identifier = new Identifier; - str->stringData()->identifier->string = str->toQString(); - str->stringData()->identifier->hashValue = hash; + str->d()->identifier = new Identifier; + str->d()->identifier->string = str->toQString(); + str->d()->identifier->hashValue = hash; bool grow = (alloc <= size*2); @@ -95,7 +95,7 @@ void IdentifierTable::addEntry(String *str) String *e = entries[i]; if (!e) continue; - uint idx = e->stringData()->stringHash % newAlloc; + uint idx = e->d()->stringHash % newAlloc; while (newEntries[idx]) { ++idx; idx %= newAlloc; @@ -123,7 +123,7 @@ String *IdentifierTable::insertString(const QString &s) uint hash = String::createHashValue(s.constData(), s.length()); uint idx = hash % alloc; while (String *e = entries[idx]) { - if (e->stringData()->stringHash == hash && e->toQString() == s) + if (e->d()->stringHash == hash && e->toQString() == s) return e; ++idx; idx %= alloc; @@ -137,29 +137,29 @@ String *IdentifierTable::insertString(const QString &s) Identifier *IdentifierTable::identifierImpl(const String *str) { - if (str->stringData()->identifier) - return str->stringData()->identifier; + if (str->d()->identifier) + return str->d()->identifier; uint hash = str->hashValue(); if (str->subtype() == String::StringType_ArrayIndex) return 0; uint idx = hash % alloc; while (String *e = entries[idx]) { - if (e->stringData()->stringHash == hash && e->isEqualTo(str)) { - str->stringData()->identifier = e->stringData()->identifier; - return e->stringData()->identifier; + if (e->d()->stringHash == hash && e->isEqualTo(str)) { + str->d()->identifier = e->d()->identifier; + return e->d()->identifier; } ++idx; idx %= alloc; } addEntry(const_cast<QV4::String *>(str)); - return str->stringData()->identifier; + return str->d()->identifier; } Identifier *IdentifierTable::identifier(const QString &s) { - return insertString(s)->stringData()->identifier; + return insertString(s)->d()->identifier; } Identifier *IdentifierTable::identifier(const char *s, int len) @@ -171,15 +171,15 @@ Identifier *IdentifierTable::identifier(const char *s, int len) QLatin1String latin(s, len); uint idx = hash % alloc; while (String *e = entries[idx]) { - if (e->stringData()->stringHash == hash && e->toQString() == latin) - return e->stringData()->identifier; + if (e->d()->stringHash == hash && e->toQString() == latin) + return e->d()->identifier; ++idx; idx %= alloc; } String *str = engine->newString(QString::fromLatin1(s, len))->getPointer(); addEntry(str); - return str->stringData()->identifier; + return str->d()->identifier; } } |