From 7e61bc92a3dccbd4c04d0a69da950cfdc32e487b Mon Sep 17 00:00:00 2001 From: Frank Meerkoetter Date: Tue, 14 Jul 2015 22:38:51 +0200 Subject: Store int/bool/double/string and sizef as QV4::Value in a Javascript array This is the first patch in a series of patches removing the QQmlVMEVariant used for the storage of non-var properties. The overall goal is to reduce the memory usage of QML. The QQmlVMEVariant has a size of 8*sizeof(void*) + sizeof(int) which is quite an overhead for types such as int/bool or double. Change-Id: I301661d134724300942911a3d75258fe45356a7a Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlvmemetaobject_p.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/qml/qml/qqmlvmemetaobject_p.h') diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h index a320163f23..a87feec043 100644 --- a/src/qml/qml/qqmlvmemetaobject_p.h +++ b/src/qml/qml/qqmlvmemetaobject_p.h @@ -204,6 +204,26 @@ public: inline void allocateVarPropertiesArray(); inline bool ensureVarPropertiesAllocated(); + // temporary solution so I can experiment with storing + // properties in a JS array. Should be switched over to also + // use the 'varProperties' in the end. + QV4::WeakValue properties; + bool propertiesInitialized; + inline void allocatePropertiesArray(); + inline bool ensurePropertiesAllocated(); + + int readPropertyAsInt(int id); + bool readPropertyAsBool(int id); + double readPropertyAsDouble(int id); + QString readPropertyAsString(int id); + QSizeF readPropertyAsSizeF(int id); + + void writeProperty(int id, int v); + void writeProperty(int id, bool v); + void writeProperty(int id, double v); + void writeProperty(int id, const QString& v); + void writeProperty(int id, const QSizeF& v); + void ensureQObjectWrapper(); void mark(QV4::ExecutionEngine *e); -- cgit v1.2.3