diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-20 15:41:29 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-31 07:28:47 +0000 |
commit | 2ee5331d8ae73c0abde129eb26df4ca000470007 (patch) | |
tree | 748ef5bdf37fce8c5d8acdc448ddb7ac430f11dd /src/qml/compiler/qqmlirbuilder.cpp | |
parent | fcf9b7efa5b2a0d8f49e59b2a977b8122632aff6 (diff) |
Shrink CompiledData::Binding by 8 bytes
Move the translation data out into a separately indexed table, which
allows to shrunk the value union down to 4 bytes, together with the
previous commit.
Saves ~4k with examples/quickcontrols/extras/flat/Content.qml and ~37K
RAM with the gallery.
Task-number: QTBUG-69588
Change-Id: Ia5016b072320ebb6b8fcfbb4dad128d53c901c74
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qqmlirbuilder.cpp')
-rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 1f6a702e4a..d5d7d6d6b0 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -1120,6 +1120,7 @@ void IRBuilder::tryGeneratingTranslationBinding(const QStringRef &base, AST::Arg } else { return; // first argument is not a string, stop } + translationData.stringIndex = jsGenerator->registerString(translation.toString()); args = args->next; @@ -1144,8 +1145,7 @@ void IRBuilder::tryGeneratingTranslationBinding(const QStringRef &base, AST::Arg return; // too many arguments, stop binding->type = QV4::CompiledData::Binding::Type_Translation; - binding->stringIndex = jsGenerator->registerString(translation.toString()); - binding->value.translationData = translationData; + binding->value.translationDataIndex = jsGenerator->registerTranslation(translationData); } else if (base == QLatin1String("qsTrId")) { QV4::CompiledData::TranslationData translationData; translationData.number = -1; @@ -1160,6 +1160,7 @@ void IRBuilder::tryGeneratingTranslationBinding(const QStringRef &base, AST::Arg } else { return; // first argument is not a string, stop } + translationData.stringIndex = jsGenerator->registerString(id.toString()); args = args->next; @@ -1176,8 +1177,7 @@ void IRBuilder::tryGeneratingTranslationBinding(const QStringRef &base, AST::Arg return; // too many arguments, stop binding->type = QV4::CompiledData::Binding::Type_TranslationById; - binding->stringIndex = jsGenerator->registerString(id.toString()); - binding->value.translationData = translationData; + binding->value.translationDataIndex = jsGenerator->registerTranslation(translationData); } else if (base == QLatin1String("QT_TR_NOOP") || base == QLatin1String("QT_TRID_NOOP")) { if (!args || !args->expression) return; // no arguments, stop |