aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/compiler/qv4compileddata_p.h19
-rw-r--r--src/qml/compiler/qv4compiler.cpp12
2 files changed, 17 insertions, 14 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index 6a1014399b..a556ccb0c0 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -271,12 +271,15 @@ struct Function
Location location;
// Qml Extensions Begin
- quint32_le dependingIdObjectsOffset; // Array of resolved ID objects
+ // Array of resolved ID objects
+ size_t dependingIdObjectsOffset() const { return lineNumberOffset + nLineNumbers * sizeof(CodeOffsetToLine); }
quint16_le nDependingIdObjects;
quint16_le nDependingContextProperties;
- quint32_le dependingContextPropertiesOffset; // Array of int pairs (property index and notify index)
- quint32_le nDependingScopeProperties;
- quint32_le dependingScopePropertiesOffset; // Array of int pairs (property index and notify index)
+ // Array of int pairs (property index and notify index)
+ size_t dependingContextPropertiesOffset() const { return dependingIdObjectsOffset() + nDependingIdObjects * sizeof(quint32); }
+ quint16_le nDependingScopeProperties;
+ // Array of int pairs (property index and notify index)
+ size_t dependingScopePropertiesOffset() const { return dependingContextPropertiesOffset() + nDependingContextProperties * sizeof(quint32); }
// Qml Extensions End
// Keep all unaligned data at the end
@@ -290,9 +293,9 @@ struct Function
const quint32_le *formalsTable() const { return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + formalsOffset); }
const quint32_le *localsTable() const { return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + localsOffset); }
const CodeOffsetToLine *lineNumberTable() const { return reinterpret_cast<const CodeOffsetToLine *>(reinterpret_cast<const char *>(this) + lineNumberOffset); }
- const quint32_le *qmlIdObjectDependencyTable() const { return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + dependingIdObjectsOffset); }
- const quint32_le *qmlContextPropertiesDependencyTable() const { return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + dependingContextPropertiesOffset); }
- const quint32_le *qmlScopePropertiesDependencyTable() const { return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + dependingScopePropertiesOffset); }
+ const quint32_le *qmlIdObjectDependencyTable() const { return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + dependingIdObjectsOffset()); }
+ const quint32_le *qmlContextPropertiesDependencyTable() const { return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + dependingContextPropertiesOffset()); }
+ const quint32_le *qmlScopePropertiesDependencyTable() const { return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + dependingScopePropertiesOffset()); }
// --- QQmlPropertyCacheCreator interface
const quint32_le *formalsBegin() const { return formalsTable(); }
@@ -315,7 +318,7 @@ struct Function
return (a + 7) & ~size_t(7);
}
};
-static_assert(sizeof(Function) == 68, "Function structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
+static_assert(sizeof(Function) == 56, "Function structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct Method {
enum Type {
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