Declare type information for some internal qml types.
authorJędrzej Nowacki <jedrzej.nowacki@digia.com>
Fri, 2 Nov 2012 16:21:38 +0000 (17:21 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 27 Nov 2012 22:14:57 +0000 (23:14 +0100)
QQmlVME::State and QBitField are movable and used in QStack. Declaring
them as movable may improve potential reallocation time, although it is
hard to prove.

Change-Id: Ia42b8104e2f24ca7574370c76084df44b9f9298e
Reviewed-by: Alan Alpert <aalpert@rim.com>
src/qml/qml/ftw/qbitfield_p.h
src/qml/qml/qqmlvme_p.h

index 95ca372..f225c27 100644 (file)
@@ -54,6 +54,7 @@
 //
 
 #include <QtCore/qglobal.h>
+#include <QtCore/qtypeinfo.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -160,6 +161,8 @@ bool QBitField::testBit(int b) const
     }
 }
 
+Q_DECLARE_TYPEINFO(QBitField, Q_MOVABLE_TYPE);
+
 QT_END_NAMESPACE
 
 #endif // QBITFIELD_P_H
index d2df630..e710943 100644 (file)
@@ -62,6 +62,7 @@
 #include <QtCore/QString>
 #include <QtCore/qelapsedtimer.h>
 #include <QtCore/qcoreapplication.h>
+#include <QtCore/qtypeinfo.h>
 
 #include <private/qv8_p.h>
 #include <private/qqmlengine_p.h>
@@ -87,8 +88,20 @@ namespace QQmlVMETypes {
         int type;
         QQmlListProperty<void> qListProperty;
     };
+    struct State {
+        enum Flag { Deferred = 0x00000001 };
+
+        State() : flags(0), context(0), compiledData(0), instructionStream(0) {}
+        quint32 flags;
+        QQmlContextData *context;
+        QQmlCompiledData *compiledData;
+        const char *instructionStream;
+        QBitField bindingSkipList;
+    };
 }
 Q_DECLARE_TYPEINFO(QQmlVMETypes::List, Q_PRIMITIVE_TYPE  | Q_MOVABLE_TYPE);
+template<>
+class QTypeInfo<QQmlVMETypes::State> : public QTypeInfoMerger<QQmlVMETypes::State, QBitField> {}; //Q_DECLARE_TYPEINFO
 
 class Q_QML_PRIVATE_EXPORT QQmlVME
 {
@@ -161,17 +174,7 @@ private:
     QQmlGuardedContextData rootContext;
     QQmlGuardedContextData creationContext;
 
-    struct State {
-        enum Flag { Deferred = 0x00000001 };
-
-        State() : flags(0), context(0), compiledData(0), instructionStream(0) {}
-        quint32 flags;
-        QQmlContextData *context;
-        QQmlCompiledData *compiledData;
-        const char *instructionStream;
-        QBitField bindingSkipList;
-    };
-
+    typedef QQmlVMETypes::State State;
     QStack<State> states;
 
     static void blank(QFiniteStack<QQmlParserStatus *> &);