aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compiler_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-07-23 14:08:06 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-07-31 17:08:08 +0000
commit8237f645a33199e0a8aded0a3f7e6077990707fd (patch)
tree2011793b9c3775f307cd5e2560143017ddb57719 /src/qml/compiler/qv4compiler_p.h
parent9337b1c339c34cd4fe10d236be2ee61ca76e17ba (diff)
Optimize memory consumption of ahead-of-time compile cache files
When loading a pre-compiled cache file, the strings contained therein will remain available in memory since commit 7dcada48d2435e8ceb0cc8a6771f79b76979e11f. While for aot built cache files we may have to add new strings (for example for signal handler parameters), we can re-use the existing strings by omitting them from the intermediately created string table. This saves ~283K RAM with qtquickcontrols1 gallery. Task-number: QTBUG-69588 Change-Id: I8ea807f6dea4cc35d8b7e5f7329809ed1cd12880 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compiler_p.h')
-rw-r--r--src/qml/compiler/qv4compiler_p.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4compiler_p.h b/src/qml/compiler/qv4compiler_p.h
index 381b6fad21..bb9794358b 100644
--- a/src/qml/compiler/qv4compiler_p.h
+++ b/src/qml/compiler/qv4compiler_p.h
@@ -80,18 +80,21 @@ struct Q_QML_PRIVATE_EXPORT StringTableGenerator {
int registerString(const QString &str);
int getStringId(const QString &string) const;
QString stringForIndex(int index) const { return strings.at(index); }
- uint stringCount() const { return strings.size(); }
+ uint stringCount() const { return strings.size() - backingUnitTableSize; }
- uint sizeOfTableAndData() const { return stringDataSize + strings.count() * sizeof(uint); }
+ uint sizeOfTableAndData() const { return stringDataSize + stringCount() * sizeof(uint); }
void clear();
+ void initializeFromBackingUnit(const CompiledData::Unit *unit);
+
void serialize(CompiledData::Unit *unit);
private:
QHash<QString, int> stringToId;
QStringList strings;
uint stringDataSize;
+ uint backingUnitTableSize = 0;
};
struct Q_QML_PRIVATE_EXPORT JSUnitGenerator {