aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compiler.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-07-26 09:49:36 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-07-31 17:08:31 +0000
commitc549d9c4e58ef8b6f9c8d954dc24072ce529f326 (patch)
tree025b81a2ab85b76ff7183703eeb9835db5a03e96 /src/qml/compiler/qv4compiler.cpp
parenta05d1796b88e628655afdba6063a186d3a0803bf (diff)
Simplify loading of ahead-of-time created QML cache files
Consolidate the old "createUnitData" code that used to be a virtual function into the one call site and avoid a malloc that way. By the way of that, the string table gets a guard to prevent accidental registerString() calls at a later point. Change-Id: Ia3f8d3e874b7733822e6942e411c940ec60d95a5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compiler.cpp')
-rw-r--r--src/qml/compiler/qv4compiler.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index bc7265ab0c..44b809899f 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -55,6 +55,7 @@ QV4::Compiler::StringTableGenerator::StringTableGenerator()
int QV4::Compiler::StringTableGenerator::registerString(const QString &str)
{
+ Q_ASSERT(!frozen);
QHash<QString, int>::ConstIterator it = stringToId.constFind(str);
if (it != stringToId.cend())
return *it;
@@ -75,6 +76,7 @@ void QV4::Compiler::StringTableGenerator::clear()
strings.clear();
stringToId.clear();
stringDataSize = 0;
+ frozen = false;
}
void QV4::Compiler::StringTableGenerator::initializeFromBackingUnit(const QV4::CompiledData::Unit *unit)