aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp12
-rw-r--r--src/qml/compiler/qv4compileddata.cpp4
-rw-r--r--src/qml/compiler/qv4compileddata_p.h257
-rw-r--r--src/qml/compiler/qv4compiler.cpp22
-rw-r--r--src/qml/compiler/qv4compiler_p.h4
-rw-r--r--src/qml/jsruntime/qv4function.cpp6
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp6
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp2
8 files changed, 153 insertions, 160 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index e80b9d8ac4..df615e6804 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -1425,7 +1425,7 @@ QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output, const QV4:
}
// write objects
- QV4::CompiledData::LEUInt32 *objectTable = reinterpret_cast<QV4::CompiledData::LEUInt32*>(data + qmlUnit->offsetToObjects);
+ quint32_le *objectTable = reinterpret_cast<quint32_le*>(data + qmlUnit->offsetToObjects);
char *objectPtr = data + qmlUnit->offsetToObjects + objectOffsetTableSize;
for (int i = 0; i < output.objects.count(); ++i) {
const Object *o = output.objects.at(i);
@@ -1467,7 +1467,7 @@ QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output, const QV4:
objectToWrite->offsetToNamedObjectsInComponent = nextOffset;
nextOffset += objectToWrite->nNamedObjectsInComponent * sizeof(quint32);
- QV4::CompiledData::LEUInt32 *functionsTable = reinterpret_cast<QV4::CompiledData::LEUInt32*>(objectPtr + objectToWrite->offsetToFunctions);
+ quint32_le *functionsTable = reinterpret_cast<quint32_le *>(objectPtr + objectToWrite->offsetToFunctions);
for (const Function *f = o->firstFunction(); f; f = f->next)
*functionsTable++ = o->runtimeFunctionIndices.at(f->index);
@@ -1493,7 +1493,7 @@ QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output, const QV4:
bindingPtr = writeBindings(bindingPtr, o, &QV4::CompiledData::Binding::isValueBindingToAlias);
Q_ASSERT((bindingPtr - objectToWrite->offsetToBindings - objectPtr) / sizeof(QV4::CompiledData::Binding) == unsigned(o->bindingCount()));
- QV4::CompiledData::LEUInt32 *signalOffsetTable = reinterpret_cast<QV4::CompiledData::LEUInt32*>(objectPtr + objectToWrite->offsetToSignals);
+ quint32_le *signalOffsetTable = reinterpret_cast<quint32_le *>(objectPtr + objectToWrite->offsetToSignals);
quint32 signalTableSize = 0;
char *signalPtr = objectPtr + nextOffset;
for (const Signal *s = o->firstSignal(); s; s = s->next) {
@@ -1513,7 +1513,7 @@ QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output, const QV4:
signalPtr += size;
}
- QV4::CompiledData::LEUInt32 *namedObjectInComponentPtr = reinterpret_cast<QV4::CompiledData::LEUInt32*>(objectPtr + objectToWrite->offsetToNamedObjectsInComponent);
+ quint32_le *namedObjectInComponentPtr = reinterpret_cast<quint32_le *>(objectPtr + objectToWrite->offsetToNamedObjectsInComponent);
for (int i = 0; i < o->namedObjectsInComponent.count; ++i) {
*namedObjectInComponentPtr++ = o->namedObjectsInComponent.at(i);
}
@@ -2225,7 +2225,7 @@ QmlIR::Object *IRLoader::loadObject(const QV4::CompiledData::Object *serializedO
QQmlJS::Engine *jsParserEngine = &output->jsParserEngine;
- const QV4::CompiledData::LEUInt32 *functionIdx = serializedObject->functionOffsetTable();
+ const quint32_le *functionIdx = serializedObject->functionOffsetTable();
for (uint i = 0; i < serializedObject->nFunctions; ++i, ++functionIdx) {
QmlIR::Function *f = pool->New<QmlIR::Function>();
const QV4::CompiledData::Function *compiledFunction = unit->functionAt(*functionIdx);
@@ -2236,7 +2236,7 @@ QmlIR::Object *IRLoader::loadObject(const QV4::CompiledData::Object *serializedO
f->nameIndex = compiledFunction->nameIndex;
QQmlJS::AST::FormalParameterList *paramList = 0;
- const QV4::CompiledData::LEUInt32 *formalNameIdx = compiledFunction->formalsTable();
+ const quint32_le *formalNameIdx = compiledFunction->formalsTable();
for (uint i = 0; i < compiledFunction->nFormals; ++i, ++formalNameIdx) {
const QString formal = unit->stringAt(*formalNameIdx);
QStringRef paramNameRef = jsParserEngine->newStringRef(formal);
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index 94abf416a1..be7429df41 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -187,7 +187,7 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
Value *bigEndianConstants = new Value[data->constantTableSize];
- const LEUInt64 *littleEndianConstants = data->constants();
+ const quint64_le *littleEndianConstants = data->constants();
for (uint i = 0; i < data->constantTableSize; ++i)
bigEndianConstants[i] = Value::fromReturnedValue(littleEndianConstants[i]);
constants = bigEndianConstants;
@@ -271,7 +271,7 @@ IdentifierHash<int> CompilationUnit::namedObjectsPerComponent(int componentObjec
if (it == namedObjectsPerComponentCache.end()) {
IdentifierHash<int> namedObjectCache(engine);
const CompiledData::Object *component = data->objectAt(componentObjectIndex);
- const LEUInt32 *namedObjectIndexPtr = component->namedObjectsInComponentTable();
+ const quint32_le *namedObjectIndexPtr = component->namedObjectsInComponentTable();
for (quint32 i = 0; i < component->nNamedObjectsInComponent; ++i, ++namedObjectIndexPtr) {
const CompiledData::Object *namedObject = data->objectAt(*namedObjectIndexPtr);
namedObjectCache.add(runtimeStrings[namedObject->idNameIndex], namedObject->id);
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index ff0d597b92..876244437e 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -62,7 +62,7 @@
#include <private/qqmlnullablevalue_p.h>
#include <private/qv4identifier_p.h>
#include <private/qflagpointer_p.h>
-#include <private/qjson_p.h>
+#include <private/qendian_p.h>
#ifndef V4_BOOTSTRAP
#include <private/qqmltypenamecache_p.h>
#include <private/qqmlpropertycache_p.h>
@@ -96,13 +96,6 @@ class CompilationUnitMapper;
namespace CompiledData {
-typedef QJsonPrivate::q_littleendian<qint16> LEInt16;
-typedef QJsonPrivate::q_littleendian<quint16> LEUInt16;
-typedef QJsonPrivate::q_littleendian<quint32> LEUInt32;
-typedef QJsonPrivate::q_littleendian<qint32> LEInt32;
-typedef QJsonPrivate::q_littleendian<quint64> LEUInt64;
-typedef QJsonPrivate::q_littleendian<qint64> LEInt64;
-
struct String;
struct Function;
struct Lookup;
@@ -130,8 +123,8 @@ struct Location
{
union {
quint32 _dummy;
- QJsonPrivate::qle_bitfield<0, 20> line;
- QJsonPrivate::qle_bitfield<20, 12> column;
+ quint32_le_bitfield<0, 20> line;
+ quint32_le_bitfield<20, 12> column;
};
Location() : _dummy(0) { }
@@ -151,8 +144,8 @@ struct RegExp
};
union {
quint32 _dummy;
- QJsonPrivate::qle_bitfield<0, 4> flags;
- QJsonPrivate::qle_bitfield<4, 28> stringIndex;
+ quint32_le_bitfield<0, 4> flags;
+ quint32_le_bitfield<4, 28> stringIndex;
};
RegExp() : _dummy(0) { }
@@ -170,8 +163,8 @@ struct Lookup
union {
quint32 _dummy;
- QJsonPrivate::qle_bitfield<0, 4> type_and_flags;
- QJsonPrivate::qle_bitfield<4, 28> nameIndex;
+ quint32_le_bitfield<0, 4> type_and_flags;
+ quint32_le_bitfield<4, 28> nameIndex;
};
Lookup() : _dummy(0) { }
@@ -181,8 +174,8 @@ struct JSClassMember
{
union {
quint32 _dummy;
- QJsonPrivate::qle_bitfield<0, 31> nameOffset;
- QJsonPrivate::qle_bitfield<31, 1> isAccessor;
+ quint32_le_bitfield<0, 31> nameOffset;
+ quint32_le_bitfield<31, 1> isAccessor;
};
JSClassMember() : _dummy(0) { }
@@ -190,7 +183,7 @@ struct JSClassMember
struct JSClass
{
- LEUInt32 nMembers;
+ quint32_le nMembers;
// JSClassMember[nMembers]
static int calculateSize(int nMembers) { return (sizeof(JSClass) + nMembers * sizeof(JSClassMember) + 7) & ~7; }
@@ -198,7 +191,7 @@ struct JSClass
struct String
{
- LEInt32 size;
+ qint32_le size;
// uint16 strdata[]
static int calculateSize(const QString &str) {
@@ -221,24 +214,24 @@ struct Function
// Absolute offset into file where the code for this function is located. Only used when the function
// is serialized.
- LEUInt64 codeOffset;
- LEUInt64 codeSize;
-
- LEUInt32 nameIndex;
- LEUInt32 nFormals;
- LEUInt32 formalsOffset;
- LEUInt32 nLocals;
- LEUInt32 localsOffset;
- LEUInt32 nInnerFunctions;
+ quint64_le codeOffset;
+ quint64_le codeSize;
+
+ quint32_le nameIndex;
+ quint32_le nFormals;
+ quint32_le formalsOffset;
+ quint32_le nLocals;
+ quint32_le localsOffset;
+ quint32_le nInnerFunctions;
Location location;
// Qml Extensions Begin
- LEUInt32 nDependingIdObjects;
- LEUInt32 dependingIdObjectsOffset; // Array of resolved ID objects
- LEUInt32 nDependingContextProperties;
- LEUInt32 dependingContextPropertiesOffset; // Array of int pairs (property index and notify index)
- LEUInt32 nDependingScopeProperties;
- LEUInt32 dependingScopePropertiesOffset; // Array of int pairs (property index and notify index)
+ quint32_le nDependingIdObjects;
+ quint32_le dependingIdObjectsOffset; // Array of resolved ID objects
+ quint32_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)
// Qml Extensions End
// quint32 formalsIndex[nFormals]
@@ -249,15 +242,15 @@ struct Function
// Keep all unaligned data at the end
quint8 flags;
- const LEUInt32 *formalsTable() const { return reinterpret_cast<const LEUInt32 *>(reinterpret_cast<const char *>(this) + formalsOffset); }
- const LEUInt32 *localsTable() const { return reinterpret_cast<const LEUInt32 *>(reinterpret_cast<const char *>(this) + localsOffset); }
- const LEUInt32 *qmlIdObjectDependencyTable() const { return reinterpret_cast<const LEUInt32 *>(reinterpret_cast<const char *>(this) + dependingIdObjectsOffset); }
- const LEUInt32 *qmlContextPropertiesDependencyTable() const { return reinterpret_cast<const LEUInt32 *>(reinterpret_cast<const char *>(this) + dependingContextPropertiesOffset); }
- const LEUInt32 *qmlScopePropertiesDependencyTable() const { return reinterpret_cast<const LEUInt32 *>(reinterpret_cast<const char *>(this) + dependingScopePropertiesOffset); }
+ 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 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 LEUInt32 *formalsBegin() const { return formalsTable(); }
- const LEUInt32 *formalsEnd() const { return formalsTable() + nFormals; }
+ const quint32_le *formalsBegin() const { return formalsTable(); }
+ const quint32_le *formalsEnd() const { return formalsTable() + nFormals; }
// ---
inline bool hasQmlDependencies() const { return nDependingIdObjects > 0 || nDependingContextProperties > 0 || nDependingScopeProperties > 0; }
@@ -270,13 +263,13 @@ struct Function
// Qml data structures
struct Q_QML_EXPORT TranslationData {
- LEUInt32 commentIndex;
- LEInt32 number;
+ quint32_le commentIndex;
+ qint32_le number;
};
struct Q_QML_PRIVATE_EXPORT Binding
{
- LEUInt32 propertyNameIndex;
+ quint32_le propertyNameIndex;
enum ValueType : unsigned int {
Type_Invalid,
@@ -304,17 +297,17 @@ struct Q_QML_PRIVATE_EXPORT Binding
};
union {
- QJsonPrivate::qle_bitfield<0, 16> flags;
- QJsonPrivate::qle_bitfield<16, 16> type;
+ quint32_le_bitfield<0, 16> flags;
+ quint32_le_bitfield<16, 16> type;
};
union {
bool b;
quint64 doubleValue; // do not access directly, needs endian protected access
- LEUInt32 compiledScriptIndex; // used when Type_Script
- LEUInt32 objectIndex;
+ quint32_le compiledScriptIndex; // used when Type_Script
+ quint32_le objectIndex;
TranslationData translationData; // used when Type_Translation
} value;
- LEUInt32 stringIndex; // Set for Type_String, Type_Translation and Type_Script (the latter because of script strings)
+ quint32_le stringIndex; // Set for Type_String, Type_Translation and Type_Script (the latter because of script strings)
Location location;
Location valueLocation;
@@ -399,16 +392,16 @@ struct Q_QML_PRIVATE_EXPORT Binding
struct Parameter
{
- LEUInt32 nameIndex;
- LEUInt32 type;
- LEUInt32 customTypeNameIndex;
+ quint32_le nameIndex;
+ quint32_le type;
+ quint32_le customTypeNameIndex;
Location location;
};
struct Signal
{
- LEUInt32 nameIndex;
- LEUInt32 nParameters;
+ quint32_le nameIndex;
+ quint32_le nParameters;
Location location;
// Parameter parameters[1];
@@ -440,12 +433,12 @@ struct Property
IsReadOnly = 0x1
};
- LEUInt32 nameIndex;
+ quint32_le nameIndex;
union {
- QJsonPrivate::qle_bitfield<0, 31> type;
- QJsonPrivate::qle_bitfield<31, 1> flags; // readonly
+ quint32_le_bitfield<0, 31> type;
+ quint32_le_bitfield<31, 1> flags; // readonly
};
- LEUInt32 customTypeNameIndex; // If type >= Custom
+ quint32_le customTypeNameIndex; // If type >= Custom
Location location;
};
@@ -456,18 +449,18 @@ struct Alias {
AliasPointsToPointerObject = 0x4
};
union {
- QJsonPrivate::qle_bitfield<0, 29> nameIndex;
- QJsonPrivate::qle_bitfield<29, 3> flags;
+ quint32_le_bitfield<0, 29> nameIndex;
+ quint32_le_bitfield<29, 3> flags;
};
union {
- LEUInt32 idIndex; // string index
- QJsonPrivate::qle_bitfield<0, 31> targetObjectId; // object id index (in QQmlContextData::idValues)
- QJsonPrivate::qle_bitfield<31, 1> aliasToLocalAlias;
+ quint32_le idIndex; // string index
+ quint32_le_bitfield<0, 31> targetObjectId; // object id index (in QQmlContextData::idValues)
+ quint32_le_bitfield<31, 1> aliasToLocalAlias;
};
union {
- LEUInt32 propertyNameIndex; // string index
- LEInt32 encodedMetaPropertyIndex;
- LEUInt32 localAliasIndex; // index in list of aliases local to the object (if targetObjectId == objectId)
+ quint32_le propertyNameIndex; // string index
+ qint32_le encodedMetaPropertyIndex;
+ quint32_le localAliasIndex; // index in list of aliases local to the object (if targetObjectId == objectId)
};
Location location;
Location referenceLocation;
@@ -490,26 +483,26 @@ struct Object
// Depending on the use, this may be the type name to instantiate before instantiating this
// object. For grouped properties the type name will be empty and for attached properties
// it will be the name of the attached type.
- LEUInt32 inheritedTypeNameIndex;
- LEUInt32 idNameIndex;
+ quint32_le inheritedTypeNameIndex;
+ quint32_le idNameIndex;
union {
- QJsonPrivate::qle_bitfield<0, 15> flags;
- QJsonPrivate::qle_bitfield<15, 1> defaultPropertyIsAlias;
- QJsonPrivate::qle_signedbitfield<16, 16> id;
+ quint32_le_bitfield<0, 15> flags;
+ quint32_le_bitfield<15, 1> defaultPropertyIsAlias;
+ qint32_le_bitfield<16, 16> id;
};
- LEInt32 indexOfDefaultPropertyOrAlias; // -1 means no default property declared in this object
- LEUInt32 nFunctions;
- LEUInt32 offsetToFunctions;
- LEUInt32 nProperties;
- LEUInt32 offsetToProperties;
- LEUInt32 nAliases;
- LEUInt32 offsetToAliases;
- LEUInt32 nSignals;
- LEUInt32 offsetToSignals; // which in turn will be a table with offsets to variable-sized Signal objects
- LEUInt32 nBindings;
- LEUInt32 offsetToBindings;
- LEUInt32 nNamedObjectsInComponent;
- LEUInt32 offsetToNamedObjectsInComponent;
+ qint32_le indexOfDefaultPropertyOrAlias; // -1 means no default property declared in this object
+ quint32_le nFunctions;
+ quint32_le offsetToFunctions;
+ quint32_le nProperties;
+ quint32_le offsetToProperties;
+ quint32_le nAliases;
+ quint32_le offsetToAliases;
+ quint32_le nSignals;
+ quint32_le offsetToSignals; // which in turn will be a table with offsets to variable-sized Signal objects
+ quint32_le nBindings;
+ quint32_le offsetToBindings;
+ quint32_le nNamedObjectsInComponent;
+ quint32_le offsetToNamedObjectsInComponent;
Location location;
Location locationOfIdProperty;
// Function[]
@@ -530,9 +523,9 @@ struct Object
) & ~0x7;
}
- const LEUInt32 *functionOffsetTable() const
+ const quint32_le *functionOffsetTable() const
{
- return reinterpret_cast<const LEUInt32*>(reinterpret_cast<const char *>(this) + offsetToFunctions);
+ return reinterpret_cast<const quint32_le*>(reinterpret_cast<const char *>(this) + offsetToFunctions);
}
const Property *propertyTable() const
@@ -552,14 +545,14 @@ struct Object
const Signal *signalAt(int idx) const
{
- const LEUInt32 *offsetTable = reinterpret_cast<const LEUInt32*>((reinterpret_cast<const char *>(this)) + offsetToSignals);
- const LEUInt32 offset = offsetTable[idx];
+ const quint32_le *offsetTable = reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToSignals);
+ const quint32_le offset = offsetTable[idx];
return reinterpret_cast<const Signal*>(reinterpret_cast<const char*>(this) + offset);
}
- const LEUInt32 *namedObjectsInComponentTable() const
+ const quint32_le *namedObjectsInComponentTable() const
{
- return reinterpret_cast<const LEUInt32*>(reinterpret_cast<const char *>(this) + offsetToNamedObjectsInComponent);
+ return reinterpret_cast<const quint32_le*>(reinterpret_cast<const char *>(this) + offsetToNamedObjectsInComponent);
}
// --- QQmlPropertyCacheCreator interface
@@ -592,13 +585,13 @@ struct Import
ImportFile = 0x2,
ImportScript = 0x3
};
- LEUInt32 type;
+ quint32_le type;
- LEUInt32 uriIndex;
- LEUInt32 qualifierIndex;
+ quint32_le uriIndex;
+ quint32_le qualifierIndex;
- LEInt32 majorVersion;
- LEInt32 minorVersion;
+ qint32_le majorVersion;
+ qint32_le minorVersion;
Location location;
@@ -611,17 +604,17 @@ struct Unit
{
// DO NOT CHANGE THESE FIELDS EVER
char magic[8];
- LEUInt32 version;
- LEUInt32 qtVersion;
- LEInt64 sourceTimeStamp;
- LEUInt32 unitSize; // Size of the Unit and any depending data.
+ quint32_le version;
+ quint32_le qtVersion;
+ qint64_le sourceTimeStamp;
+ quint32_le unitSize; // Size of the Unit and any depending data.
// END DO NOT CHANGE THESE FIELDS EVER
char md5Checksum[16]; // checksum of all bytes following this field.
void generateChecksum();
- LEUInt32 architectureIndex; // string index to QSysInfo::buildAbi()
- LEUInt32 codeGeneratorIndex;
+ quint32_le architectureIndex; // string index to QSysInfo::buildAbi()
+ quint32_le codeGeneratorIndex;
char dependencyMD5Checksum[16];
enum : unsigned int {
@@ -633,36 +626,36 @@ struct Unit
ContainsMachineCode = 0x20, // used to determine if we need to mmap with execute permissions
PendingTypeCompilation = 0x40 // the QML data structures present are incomplete and require type compilation
};
- LEUInt32 flags;
- LEUInt32 stringTableSize;
- LEUInt32 offsetToStringTable;
- LEUInt32 functionTableSize;
- LEUInt32 offsetToFunctionTable;
- LEUInt32 lookupTableSize;
- LEUInt32 offsetToLookupTable;
- LEUInt32 regexpTableSize;
- LEUInt32 offsetToRegexpTable;
- LEUInt32 constantTableSize;
- LEUInt32 offsetToConstantTable;
- LEUInt32 jsClassTableSize;
- LEUInt32 offsetToJSClassTable;
- LEInt32 indexOfRootFunction;
- LEUInt32 sourceFileIndex;
+ quint32_le flags;
+ quint32_le stringTableSize;
+ quint32_le offsetToStringTable;
+ quint32_le functionTableSize;
+ quint32_le offsetToFunctionTable;
+ quint32_le lookupTableSize;
+ quint32_le offsetToLookupTable;
+ quint32_le regexpTableSize;
+ quint32_le offsetToRegexpTable;
+ quint32_le constantTableSize;
+ quint32_le offsetToConstantTable;
+ quint32_le jsClassTableSize;
+ quint32_le offsetToJSClassTable;
+ qint32_le indexOfRootFunction;
+ quint32_le sourceFileIndex;
/* QML specific fields */
- LEUInt32 nImports;
- LEUInt32 offsetToImports;
- LEUInt32 nObjects;
- LEUInt32 offsetToObjects;
- LEUInt32 indexOfRootObject;
+ quint32_le nImports;
+ quint32_le offsetToImports;
+ quint32_le nObjects;
+ quint32_le offsetToObjects;
+ quint32_le indexOfRootObject;
const Import *importAt(int idx) const {
return reinterpret_cast<const Import*>((reinterpret_cast<const char *>(this)) + offsetToImports + idx * sizeof(Import));
}
const Object *objectAt(int idx) const {
- const LEUInt32 *offsetTable = reinterpret_cast<const LEUInt32*>((reinterpret_cast<const char *>(this)) + offsetToObjects);
- const LEUInt32 offset = offsetTable[idx];
+ const quint32_le *offsetTable = reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToObjects);
+ const quint32_le offset = offsetTable[idx];
return reinterpret_cast<const Object*>(reinterpret_cast<const char*>(this) + offset);
}
@@ -672,8 +665,8 @@ struct Unit
/* end QML specific fields*/
QString stringAt(int idx) const {
- const LEUInt32 *offsetTable = reinterpret_cast<const LEUInt32*>((reinterpret_cast<const char *>(this)) + offsetToStringTable);
- const LEUInt32 offset = offsetTable[idx];
+ const quint32_le *offsetTable = reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToStringTable);
+ const quint32_le offset = offsetTable[idx];
const String *str = reinterpret_cast<const String*>(reinterpret_cast<const char *>(this) + offset);
if (str->size == 0)
return QString();
@@ -685,7 +678,7 @@ struct Unit
// return QString::fromRawData(characters, str->size);
return QString(characters, str->size);
#else
- const LEUInt16 *characters = reinterpret_cast<const LEUInt16 *>(str + 1);
+ const quint16_le *characters = reinterpret_cast<const quint16_le *>(str + 1);
QString qstr(str->size, Qt::Uninitialized);
QChar *ch = qstr.data();
for (int i = 0; i < str->size; ++i)
@@ -694,11 +687,11 @@ struct Unit
#endif
}
- const LEUInt32 *functionOffsetTable() const { return reinterpret_cast<const LEUInt32*>((reinterpret_cast<const char *>(this)) + offsetToFunctionTable); }
+ const quint32_le *functionOffsetTable() const { return reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToFunctionTable); }
const Function *functionAt(int idx) const {
- const LEUInt32 *offsetTable = functionOffsetTable();
- const LEUInt32 offset = offsetTable[idx];
+ const quint32_le *offsetTable = functionOffsetTable();
+ const quint32_le offset = offsetTable[idx];
return reinterpret_cast<const Function*>(reinterpret_cast<const char *>(this) + offset);
}
@@ -706,13 +699,13 @@ struct Unit
const RegExp *regexpAt(int index) const {
return reinterpret_cast<const RegExp*>(reinterpret_cast<const char *>(this) + offsetToRegexpTable + index * sizeof(RegExp));
}
- const LEUInt64 *constants() const {
- return reinterpret_cast<const LEUInt64*>(reinterpret_cast<const char *>(this) + offsetToConstantTable);
+ const quint64_le *constants() const {
+ return reinterpret_cast<const quint64_le*>(reinterpret_cast<const char *>(this) + offsetToConstantTable);
}
const JSClassMember *jsClassAt(int idx, int *nMembers) const {
- const LEUInt32 *offsetTable = reinterpret_cast<const LEUInt32 *>(reinterpret_cast<const char *>(this) + offsetToJSClassTable);
- const LEUInt32 offset = offsetTable[idx];
+ const quint32_le *offsetTable = reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + offsetToJSClassTable);
+ const quint32_le offset = offsetTable[idx];
const char *ptr = reinterpret_cast<const char *>(this) + offset;
const JSClass *klass = reinterpret_cast<const JSClass *>(ptr);
*nMembers = klass->nMembers;
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index a49388846d..35825587b1 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -78,7 +78,7 @@ void QV4::Compiler::StringTableGenerator::clear()
void QV4::Compiler::StringTableGenerator::serialize(CompiledData::Unit *unit)
{
char *dataStart = reinterpret_cast<char *>(unit);
- CompiledData::LEUInt32 *stringTable = reinterpret_cast<CompiledData::LEUInt32 *>(dataStart + unit->offsetToStringTable);
+ quint32_le *stringTable = reinterpret_cast<quint32_le *>(dataStart + unit->offsetToStringTable);
char *stringData = dataStart + unit->offsetToStringTable + unit->stringTableSize * sizeof(uint);
for (int i = 0; i < strings.size(); ++i) {
stringTable[i] = stringData - dataStart;
@@ -220,7 +220,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(GeneratorO
registerString(*f->locals.at(i));
}
- Q_ALLOCA_VAR(CompiledData::LEUInt32, functionOffsets, irModule->functions.size() * sizeof(CompiledData::LEUInt32));
+ Q_ALLOCA_VAR(quint32_le, functionOffsets, irModule->functions.size() * sizeof(quint32_le));
uint jsClassDataOffset = 0;
char *dataPtr;
@@ -233,7 +233,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(GeneratorO
memcpy(unit, &tempHeader, sizeof(tempHeader));
}
- memcpy(dataPtr + unit->offsetToFunctionTable, functionOffsets, unit->functionTableSize * sizeof(CompiledData::LEUInt32));
+ memcpy(dataPtr + unit->offsetToFunctionTable, functionOffsets, unit->functionTableSize * sizeof(quint32_le));
for (int i = 0; i < irModule->functions.size(); ++i) {
QV4::IR::Function *function = irModule->functions.at(i);
@@ -254,7 +254,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(GeneratorO
ReturnedValue *constantTable = reinterpret_cast<ReturnedValue *>(dataPtr + unit->offsetToConstantTable);
memcpy(constantTable, constants.constData(), constants.size() * sizeof(ReturnedValue));
#else
- CompiledData::LEUInt64 *constantTable = reinterpret_cast<CompiledData::LEUInt64 *>(dataPtr + unit->offsetToConstantTable);
+ quint64_le *constantTable = reinterpret_cast<quint64_le *>(dataPtr + unit->offsetToConstantTable);
for (int i = 0; i < constants.count(); ++i)
constantTable[i] = constants.at(i);
#endif
@@ -263,7 +263,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(GeneratorO
memcpy(dataPtr + jsClassDataOffset, jsClassData.constData(), jsClassData.size());
// write js classes and js class lookup table
- CompiledData::LEUInt32 *jsClassOffsetTable = reinterpret_cast<CompiledData::LEUInt32 *>(dataPtr + unit->offsetToJSClassTable);
+ quint32_le *jsClassOffsetTable = reinterpret_cast<quint32_le *>(dataPtr + unit->offsetToJSClassTable);
for (int i = 0; i < jsClassOffsets.count(); ++i)
jsClassOffsetTable[i] = jsClassDataOffset + jsClassOffsets.at(i);
}
@@ -337,36 +337,36 @@ void QV4::Compiler::JSUnitGenerator::writeFunction(char *f, QV4::IR::Function *i
function->codeSize = 0;
// write formals
- CompiledData::LEUInt32 *formals = (CompiledData::LEUInt32 *)(f + function->formalsOffset);
+ quint32_le *formals = (quint32_le *)(f + function->formalsOffset);
for (int i = 0; i < irFunction->formals.size(); ++i)
formals[i] = getStringId(*irFunction->formals.at(i));
// write locals
- CompiledData::LEUInt32 *locals = (CompiledData::LEUInt32 *)(f + function->localsOffset);
+ quint32_le *locals = (quint32_le *)(f + function->localsOffset);
for (int i = 0; i < irFunction->locals.size(); ++i)
locals[i] = getStringId(*irFunction->locals.at(i));
// write QML dependencies
- CompiledData::LEUInt32 *writtenDeps = (CompiledData::LEUInt32 *)(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 = (CompiledData::LEUInt32 *)(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 = (CompiledData::LEUInt32 *)(f + function->dependingScopePropertiesOffset);
+ writtenDeps = (quint32_le *)(f + function->dependingScopePropertiesOffset);
for (auto property : irFunction->scopeObjectPropertyDependencies) {
*writtenDeps++ = property.key(); // property index
*writtenDeps++ = property.value(); // notify index
}
}
-QV4::CompiledData::Unit QV4::Compiler::JSUnitGenerator::generateHeader(QV4::Compiler::JSUnitGenerator::GeneratorOption option, QJsonPrivate::q_littleendian<quint32> *functionOffsets, uint *jsClassDataOffset)
+QV4::CompiledData::Unit QV4::Compiler::JSUnitGenerator::generateHeader(QV4::Compiler::JSUnitGenerator::GeneratorOption option, quint32_le *functionOffsets, uint *jsClassDataOffset)
{
CompiledData::Unit unit;
memset(&unit, 0, sizeof(unit));
diff --git a/src/qml/compiler/qv4compiler_p.h b/src/qml/compiler/qv4compiler_p.h
index 49b8664513..9c51a44bad 100644
--- a/src/qml/compiler/qv4compiler_p.h
+++ b/src/qml/compiler/qv4compiler_p.h
@@ -52,7 +52,7 @@
#include <QtCore/qstring.h>
#include "qv4jsir_p.h"
-#include <private/qjson_p.h>
+#include <private/qendian_p.h>
QT_BEGIN_NAMESPACE
@@ -120,7 +120,7 @@ struct Q_QML_PRIVATE_EXPORT JSUnitGenerator {
StringTableGenerator stringTable;
QString codeGeneratorName;
private:
- CompiledData::Unit generateHeader(GeneratorOption option, QJsonPrivate::q_littleendian<quint32> *functionOffsets, uint *jsClassDataOffset);
+ CompiledData::Unit generateHeader(GeneratorOption option, quint32_le *functionOffsets, uint *jsClassDataOffset);
IR::Module *irModule;
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp
index 4c8117527c..d1bdab1b3c 100644
--- a/src/qml/jsruntime/qv4function.cpp
+++ b/src/qml/jsruntime/qv4function.cpp
@@ -60,7 +60,7 @@ Function::Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit,
Q_UNUSED(engine);
internalClass = engine->internalClasses[EngineBase::Class_Empty];
- const CompiledData::LEUInt32 *formalsIndices = compiledFunction->formalsTable();
+ const quint32_le *formalsIndices = compiledFunction->formalsTable();
// iterate backwards, so we get the right ordering for duplicate names
Scope scope(engine);
ScopedString arg(scope);
@@ -79,7 +79,7 @@ Function::Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit,
}
nFormals = compiledFunction->nFormals;
- const CompiledData::LEUInt32 *localsIndices = compiledFunction->localsTable();
+ const quint32_le *localsIndices = compiledFunction->localsTable();
for (quint32 i = 0; i < compiledFunction->nLocals; ++i)
internalClass = internalClass->addMember(compilationUnit->runtimeStrings[localsIndices[i]]->identifier, Attr_NotConfigurable);
@@ -111,7 +111,7 @@ void Function::updateInternalClass(ExecutionEngine *engine, const QList<QByteArr
}
nFormals = parameters.size();
- const CompiledData::LEUInt32 *localsIndices = compiledFunction->localsTable();
+ const quint32_le *localsIndices = compiledFunction->localsTable();
for (quint32 i = 0; i < compiledFunction->nLocals; ++i)
internalClass = internalClass->addMember(compilationUnit->runtimeStrings[localsIndices[i]]->identifier, Attr_NotConfigurable);
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index 9d4e46e254..9587b3961f 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -350,7 +350,7 @@ void QQmlPropertyCapture::registerQmlDependencies(const QV4::CompiledData::Funct
QV4::Scoped<QV4::QmlContext> context(scope, engine->qmlContext());
QQmlContextData *qmlContext = context->qmlContext();
- const QV4::CompiledData::LEUInt32 *idObjectDependency = compiledFunction->qmlIdObjectDependencyTable();
+ const quint32_le *idObjectDependency = compiledFunction->qmlIdObjectDependencyTable();
const int idObjectDependencyCount = compiledFunction->nDependingIdObjects;
for (int i = 0; i < idObjectDependencyCount; ++i, ++idObjectDependency) {
Q_ASSERT(int(*idObjectDependency) < qmlContext->idValueCount);
@@ -359,7 +359,7 @@ void QQmlPropertyCapture::registerQmlDependencies(const QV4::CompiledData::Funct
}
Q_ASSERT(qmlContext->contextObject);
- const QV4::CompiledData::LEUInt32 *contextPropertyDependency = compiledFunction->qmlContextPropertiesDependencyTable();
+ const quint32_le *contextPropertyDependency = compiledFunction->qmlContextPropertiesDependencyTable();
const int contextPropertyDependencyCount = compiledFunction->nDependingContextProperties;
for (int i = 0; i < contextPropertyDependencyCount; ++i) {
const int propertyIndex = *contextPropertyDependency++;
@@ -369,7 +369,7 @@ void QQmlPropertyCapture::registerQmlDependencies(const QV4::CompiledData::Funct
}
QObject *scopeObject = context->qmlScope();
- const QV4::CompiledData::LEUInt32 *scopePropertyDependency = compiledFunction->qmlScopePropertiesDependencyTable();
+ const quint32_le *scopePropertyDependency = compiledFunction->qmlScopePropertiesDependencyTable();
const int scopePropertyDependencyCount = compiledFunction->nDependingScopeProperties;
for (int i = 0; i < scopePropertyDependencyCount; ++i) {
const int propertyIndex = *scopePropertyDependency++;
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 2cbcfbbfb6..b73cbaa563 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -996,7 +996,7 @@ void QQmlObjectCreator::setupFunctions()
QV4::ScopedValue function(scope);
QV4::ScopedContext qmlContext(scope, currentQmlContext());
- const QV4::CompiledData::LEUInt32 *functionIdx = _compiledObject->functionOffsetTable();
+ const quint32_le *functionIdx = _compiledObject->functionOffsetTable();
for (quint32 i = 0; i < _compiledObject->nFunctions; ++i, ++functionIdx) {
QV4::Function *runtimeFunction = compilationUnit->runtimeFunctions[*functionIdx];
const QString name = runtimeFunction->name()->toQString();