aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compiler.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-07-20 11:57:38 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-07-30 19:46:51 +0000
commit7c1c016ced09c62ce0d857aef5ea734b7c35f394 (patch)
tree756826d7c714e8686d7fe77d54985b0bd762b5d9 /src/qml/compiler/qv4compiler.cpp
parentd08f437e3fb0bc6a2c9c1b63f955c223851ff6d8 (diff)
Shrink the size of CompiledData::Function by 16 bytes
It was previously 68 bytes but rounded up to 72 to be multiple of 8. After removing the rarely used qml offset table properties and calculating them on the fly instead, the data structure shrinks to 56 bytes. Saves 2.8K on examples/quickcontrols/extras/flat/Content.qml and about ~22K RAM on the gallery. Task-number: QTBUG-69588 Change-Id: I13d1efae7fa1dff96674d937ffbad002c2f703c8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compiler.cpp')
-rw-r--r--src/qml/compiler/qv4compiler.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index 8a61333315..a2afc7fefe 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -335,19 +335,19 @@ void QV4::Compiler::JSUnitGenerator::writeFunction(char *f, QV4::Compiler::Conte
if (!irFunction->idObjectDependencies.isEmpty()) {
function->nDependingIdObjects = irFunction->idObjectDependencies.count();
- function->dependingIdObjectsOffset = currentOffset;
+ Q_ASSERT(function->dependingIdObjectsOffset() == currentOffset);
currentOffset += function->nDependingIdObjects * sizeof(quint32);
}
if (!irFunction->contextObjectPropertyDependencies.isEmpty()) {
function->nDependingContextProperties = irFunction->contextObjectPropertyDependencies.count();
- function->dependingContextPropertiesOffset = currentOffset;
+ Q_ASSERT(function->dependingContextPropertiesOffset() == currentOffset);
currentOffset += function->nDependingContextProperties * sizeof(quint32) * 2;
}
if (!irFunction->scopeObjectPropertyDependencies.isEmpty()) {
function->nDependingScopeProperties = irFunction->scopeObjectPropertyDependencies.count();
- function->dependingScopePropertiesOffset = currentOffset;
+ Q_ASSERT(function->dependingScopePropertiesOffset() == currentOffset);
currentOffset += function->nDependingScopeProperties * sizeof(quint32) * 2;
}
@@ -371,19 +371,19 @@ void QV4::Compiler::JSUnitGenerator::writeFunction(char *f, QV4::Compiler::Conte
memcpy(f + function->lineNumberOffset, irFunction->lineNumberMapping.constData(), irFunction->lineNumberMapping.size()*sizeof(CompiledData::CodeOffsetToLine));
// write QML dependencies
- quint32_le *writtenDeps = (quint32_le *)(f + function->dependingIdObjectsOffset);
+ quint32_le *writtenDeps = (quint32_le *)(f + function->dependingIdObjectsOffset());
for (int id : irFunction->idObjectDependencies) {
Q_ASSERT(id >= 0);
*writtenDeps++ = static_cast<quint32>(id);
}
- writtenDeps = (quint32_le *)(f + function->dependingContextPropertiesOffset);
+ writtenDeps = (quint32_le *)(f + function->dependingContextPropertiesOffset());
for (auto property : irFunction->contextObjectPropertyDependencies) {
*writtenDeps++ = property.key(); // property index
*writtenDeps++ = property.value(); // notify index
}
- writtenDeps = (quint32_le *)(f + function->dependingScopePropertiesOffset);
+ writtenDeps = (quint32_le *)(f + function->dependingScopePropertiesOffset());
for (auto property : irFunction->scopeObjectPropertyDependencies) {
*writtenDeps++ = property.key(); // property index
*writtenDeps++ = property.value(); // notify index