Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / src / declarative / qml / qdeclarativevme.cpp
index 313d7f1..ee1f8bc 100644 (file)
@@ -1,8 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -35,6 +34,7 @@
 **
 **
 **
+**
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -52,6 +52,7 @@
 #include "qdeclarativeengine.h"
 #include "qdeclarativecontext.h"
 #include "qdeclarativecomponent.h"
+#include "qdeclarativecomponentattached_p.h"
 #include "qdeclarativebinding_p.h"
 #include "qdeclarativeengine_p.h"
 #include "qdeclarativecomponent_p.h"
@@ -64,6 +65,7 @@
 #include <private/qfinitestack_p.h>
 #include "qdeclarativescriptstring.h"
 #include "qdeclarativescriptstring_p.h"
+#include "qdeclarativepropertyvalueinterceptor_p.h"
 
 #include <QStack>
 #include <QColor>
@@ -119,6 +121,11 @@ void QDeclarativeVME::init(QDeclarativeContextData *ctxt, QDeclarativeCompiledDa
     bindValues.allocate(i->init.bindingsSize);
     parserStatus.allocate(i->init.parserStatusSize);
 
+#ifdef QML_ENABLE_TRACE
+    parserStatusData.allocate(i->init.parserStatusSize);
+    rootComponent = comp;
+#endif
+
     rootContext = 0;
     engine = ctxt->engine;
 }
@@ -153,6 +160,11 @@ bool QDeclarativeVME::initDeferred(QObject *object)
 
     objects.push(object);
 
+#ifdef QML_ENABLE_TRACE
+    parserStatusData.allocate(i->deferInit.parserStatusSize);
+    rootComponent = comp;
+#endif
+
     rootContext = 0;
     engine = ctxt->engine;
 
@@ -175,6 +187,11 @@ QObject *QDeclarativeVME::execute(QList<QDeclarativeError> *errors, const Interr
 {
     Q_ASSERT(states.count() >= 1);
 
+#ifdef QML_ENABLE_TRACE
+    QDeclarativeTrace trace("VME Execute");
+    trace.addDetail("URL", rootComponent->url);
+#endif
+
     QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(states.at(0).context->engine);
 
     ActiveVMERestorer restore(this, ep);
@@ -198,6 +215,11 @@ static void removeBindingOnProperty(QObject *o, int index)
     if (binding) binding->destroy();
 }
 
+static QVariant variantFromString(const QString &string)
+{
+    return QDeclarativeStringConverters::variantFromString(string);
+}
+
 // XXX we probably need some form of "work count" here to prevent us checking this 
 // for every instruction.
 #define QML_BEGIN_INSTR_COMMON(I) { \
@@ -236,7 +258,46 @@ static void removeBindingOnProperty(QObject *o, int index)
     } break;
 #endif
 
-#define CLEAN_PROPERTY(o, index) if (fastHasBinding(o, index)) removeBindingOnProperty(o, index)
+#define QML_STORE_VALUE(name, cpptype, value) \
+    QML_BEGIN_INSTR(name) \
+        cpptype v = value; \
+        void *a[] = { (void *)&v, 0, &status, &flags }; \
+        QObject *target = objects.top(); \
+        CLEAN_PROPERTY(target, instr.propertyIndex); \
+        QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); \
+    QML_END_INSTR(name)
+
+#define QML_STORE_LIST(name, cpptype, value) \
+    QML_BEGIN_INSTR(name) \
+        cpptype v; \
+        v.append(value); \
+        void *a[] = { (void *)&v, 0, &status, &flags }; \
+        QObject *target = objects.top(); \
+        CLEAN_PROPERTY(target, instr.propertyIndex); \
+        QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); \
+    QML_END_INSTR(name)
+
+#define QML_STORE_VAR(name, value) \
+    QML_BEGIN_INSTR(name) \
+        v8::Handle<v8::Value> v8value = value; \
+        QObject *target = objects.top(); \
+        CLEAN_PROPERTY(target, instr.propertyIndex); \
+        QMetaObject *mo = const_cast<QMetaObject *>(target->metaObject()); \
+        QDeclarativeVMEMetaObject *vmemo = static_cast<QDeclarativeVMEMetaObject *>(mo); \
+        vmemo->setVMEProperty(instr.propertyIndex, v8value); \
+    QML_END_INSTR(name)
+
+#define QML_STORE_POINTER(name, value) \
+    QML_BEGIN_INSTR(name) \
+        void *a[] = { (void *)value, 0, &status, &flags }; \
+        QObject *target = objects.top(); \
+        CLEAN_PROPERTY(target, instr.propertyIndex); \
+        QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); \
+    QML_END_INSTR(name)
+
+#define CLEAN_PROPERTY(o, index) \
+    if (fastHasBinding(o, index)) \
+        removeBindingOnProperty(o, index)
 
 QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
                               const Interrupt &interrupt
@@ -293,6 +354,63 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
 
         switch (genericInstr->common.instructionType) {
 #endif
+
+        // Store a created object in a property.  These all pop from the objects stack.
+        QML_STORE_VALUE(StoreObject, QObject *, objects.pop());
+        QML_STORE_VALUE(StoreVariantObject, QVariant, QVariant::fromValue(objects.pop()));
+        QML_STORE_VAR(StoreVarObject, ep->v8engine()->newQObject(objects.pop()));
+
+        // Store a literal value in a corresponding property
+        QML_STORE_VALUE(StoreFloat, float, instr.value);
+        QML_STORE_VALUE(StoreDouble, double, instr.value);
+        QML_STORE_VALUE(StoreBool, bool, instr.value);
+        QML_STORE_VALUE(StoreInteger, int, instr.value);
+        QML_STORE_VALUE(StoreColor, QColor, QColor::fromRgba(instr.value));
+        QML_STORE_VALUE(StoreDate, QDate, QDate::fromJulianDay(instr.value));
+        QML_STORE_VALUE(StoreDateTime, QDateTime,
+                        QDateTime(QDate::fromJulianDay(instr.date), *(QTime *)&instr.time));
+        QML_STORE_POINTER(StoreTime, (QTime *)&instr.time);
+        QML_STORE_POINTER(StorePoint, (QPoint *)&instr.point);
+        QML_STORE_POINTER(StorePointF, (QPointF *)&instr.point);
+        QML_STORE_POINTER(StoreSize, (QSize *)&instr.size);
+        QML_STORE_POINTER(StoreSizeF, (QSizeF *)&instr.size);
+        QML_STORE_POINTER(StoreRect, (QRect *)&instr.rect);
+        QML_STORE_POINTER(StoreRectF, (QRectF *)&instr.rect);
+        QML_STORE_POINTER(StoreVector3D, (QVector3D *)&instr.vector);
+        QML_STORE_POINTER(StoreVector4D, (QVector4D *)&instr.vector);
+        QML_STORE_POINTER(StoreString, &PRIMITIVES.at(instr.value));
+        QML_STORE_POINTER(StoreByteArray, &DATAS.at(instr.value));
+        QML_STORE_POINTER(StoreUrl, &URLS.at(instr.value));
+        QML_STORE_VALUE(StoreTrString, QString,
+                        QCoreApplication::translate(DATAS.at(instr.context).constData(),
+                                                    DATAS.at(instr.text).constData(),
+                                                    DATAS.at(instr.comment).constData(),
+                                                    QCoreApplication::UnicodeUTF8,
+                                                    instr.n));
+        QML_STORE_VALUE(StoreTrIdString, QString, qtTrId(DATAS.at(instr.text).constData(), instr.n));
+
+        // Store a literal value in a QList
+        QML_STORE_LIST(StoreStringList, QStringList, PRIMITIVES.at(instr.value));
+        QML_STORE_LIST(StoreStringQList, QList<QString>, PRIMITIVES.at(instr.value));
+        QML_STORE_LIST(StoreUrlQList, QList<QUrl>, URLS.at(instr.value));
+        QML_STORE_LIST(StoreDoubleQList, QList<double>, instr.value);
+        QML_STORE_LIST(StoreBoolQList, QList<bool>, instr.value);
+        QML_STORE_LIST(StoreIntegerQList, QList<int>, instr.value);
+
+        // Store a literal value in a QVariant property
+        QML_STORE_VALUE(StoreVariant, QVariant, variantFromString(PRIMITIVES.at(instr.value)));
+        QML_STORE_VALUE(StoreVariantInteger, QVariant, QVariant(instr.value));
+        QML_STORE_VALUE(StoreVariantDouble, QVariant, QVariant(instr.value));
+        QML_STORE_VALUE(StoreVariantBool, QVariant, QVariant(instr.value));
+
+        // Store a literal value in a var property.
+        // We deliberately do not use string converters here
+        QML_STORE_VAR(StoreVar, ep->v8engine()->fromVariant(PRIMITIVES.at(instr.value)));
+        QML_STORE_VAR(StoreVarInteger, v8::Integer::New(instr.value));
+        QML_STORE_VAR(StoreVarDouble, v8::Number::New(instr.value));
+        QML_STORE_VAR(StoreVarBool, v8::Boolean::New(instr.value));
+
+
         QML_BEGIN_INSTR(Init)
             // Ensure that the compiled data has been initialized
             if (!COMP->isInitialized()) COMP->initialize(engine);
@@ -539,276 +657,6 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
             }
         QML_END_INSTR(StoreMetaObject)
 
-        QML_BEGIN_INSTR(StoreVariant)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            // XXX - can be more efficient
-            QVariant v = QDeclarativeStringConverters::variantFromString(PRIMITIVES.at(instr.value));
-            void *a[] = { &v, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreVariant)
-
-        QML_BEGIN_INSTR(StoreVariantInteger)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QVariant v(instr.value);
-            void *a[] = { &v, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreVariantInteger)
-
-        QML_BEGIN_INSTR(StoreVariantDouble)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QVariant v(instr.value);
-            void *a[] = { &v, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreVariantDouble)
-
-        QML_BEGIN_INSTR(StoreVariantBool)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QVariant v(instr.value);
-            void *a[] = { &v, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreVariantBool)
-
-        QML_BEGIN_INSTR(StoreVar)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            // Note that we don't use QDeclarativeStringConverters::variantFromString() here, which
-            // means that automatic generation of value types from strings doesn't occur.
-            // This is a deliberate behaviour difference to variant properties.
-            v8::Handle<v8::Value> v8Value = ep->v8engine()->fromVariant(PRIMITIVES.at(instr.value));
-            static_cast<QDeclarativeVMEMetaObject *>(const_cast<QMetaObject *>(target->metaObject()))->setVMEProperty(instr.propertyIndex, v8Value);
-        QML_END_INSTR(StoreVar)
-
-        QML_BEGIN_INSTR(StoreVarInteger)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            v8::Handle<v8::Value> v8Value = v8::Integer::New(instr.value);
-            static_cast<QDeclarativeVMEMetaObject *>(const_cast<QMetaObject *>(target->metaObject()))->setVMEProperty(instr.propertyIndex, v8Value);
-        QML_END_INSTR(StoreVarInteger)
-
-        QML_BEGIN_INSTR(StoreVarDouble)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            v8::Handle<v8::Value> v8Value = v8::Number::New(instr.value);
-            static_cast<QDeclarativeVMEMetaObject *>(const_cast<QMetaObject *>(target->metaObject()))->setVMEProperty(instr.propertyIndex, v8Value);
-        QML_END_INSTR(StoreVarDouble)
-
-        QML_BEGIN_INSTR(StoreVarBool)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            v8::Handle<v8::Value> v8Value = v8::Boolean::New(instr.value);
-            static_cast<QDeclarativeVMEMetaObject *>(const_cast<QMetaObject *>(target->metaObject()))->setVMEProperty(instr.propertyIndex, v8Value);
-        QML_END_INSTR(StoreVarBool)
-
-        QML_BEGIN_INSTR(StoreString)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            void *a[] = { (void *)&PRIMITIVES.at(instr.value), 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreString)
-
-        QML_BEGIN_INSTR(StoreByteArray)
-            QObject *target = objects.top();
-            void *a[] = { (void *)&DATAS.at(instr.value), 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty,
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreByteArray)
-
-        QML_BEGIN_INSTR(StoreUrl)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            void *a[] = { (void *)&URLS.at(instr.value), 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreUrl)
-
-        QML_BEGIN_INSTR(StoreFloat)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            float f = instr.value;
-            void *a[] = { &f, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty,
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreFloat)
-
-        QML_BEGIN_INSTR(StoreDouble)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            double d = instr.value;
-            void *a[] = { &d, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty,
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreDouble)
-
-        QML_BEGIN_INSTR(StoreBool)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            void *a[] = { (void *)&instr.value, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreBool)
-
-        QML_BEGIN_INSTR(StoreInteger)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            void *a[] = { (void *)&instr.value, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreInteger)
-
-        QML_BEGIN_INSTR(StoreColor)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QColor c = QColor::fromRgba(instr.value);
-            void *a[] = { &c, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreColor)
-
-        QML_BEGIN_INSTR(StoreDate)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QDate d = QDate::fromJulianDay(instr.value);
-            void *a[] = { &d, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreDate)
-
-        QML_BEGIN_INSTR(StoreTime)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QTime *t = (QTime *)&instr.time;
-            void *a[] = { t, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreTime)
-
-        QML_BEGIN_INSTR(StoreDateTime)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QTime *t = (QTime *)&instr.time;
-            QDateTime dt(QDate::fromJulianDay(instr.date), *t);
-            void *a[] = { &dt, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty,
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreDateTime)
-
-        QML_BEGIN_INSTR(StorePoint)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QPoint *p = (QPoint *)&instr.point;
-            void *a[] = { p, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StorePoint)
-
-        QML_BEGIN_INSTR(StorePointF)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QPointF *p = (QPointF *)&instr.point;
-            void *a[] = { p, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StorePointF)
-
-        QML_BEGIN_INSTR(StoreSize)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QSize *s = (QSize *)&instr.size;
-            void *a[] = { s, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreSize)
-
-        QML_BEGIN_INSTR(StoreSizeF)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QSizeF *s = (QSizeF *)&instr.size;
-            void *a[] = { s, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreSizeF)
-
-        QML_BEGIN_INSTR(StoreRect)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QRect *r = (QRect *)&instr.rect;
-            void *a[] = { r, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreRect)
-
-        QML_BEGIN_INSTR(StoreRectF)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QRectF *r = (QRectF *)&instr.rect;
-            void *a[] = { r, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreRectF)
-
-        QML_BEGIN_INSTR(StoreVector3D)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QVector3D *v = (QVector3D *)&instr.vector;
-            void *a[] = { v, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreVector3D)
-
-        QML_BEGIN_INSTR(StoreVector4D)
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QVector4D *v = (QVector4D *)&instr.vector;
-            void *a[] = { v, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty,
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreVector4D)
-
-        QML_BEGIN_INSTR(StoreObject)
-            QObject *assignObj = objects.pop();
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            void *a[] = { (void *)&assignObj, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreObject)
-
         QML_BEGIN_INSTR(AssignCustomType)
             QObject *target = objects.top();
             CLEAN_PROPERTY(target, instr.propertyIndex);
@@ -863,7 +711,7 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
 
             QDeclarativeBoundSignal *bs = new QDeclarativeBoundSignal(target, signal, target);
             QDeclarativeExpression *expr = 
-                new QDeclarativeExpression(CTXT, context, PRIMITIVES.at(instr.value), true, COMP->name, instr.line, *new QDeclarativeExpressionPrivate);
+                new QDeclarativeExpression(CTXT, context, PRIMITIVES.at(instr.value), true, COMP->name, instr.line, instr.column, *new QDeclarativeExpressionPrivate);
             bs->setExpression(expr);
         QML_END_INSTR(StoreSignal)
 
@@ -880,6 +728,7 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
             ss.setScript(PRIMITIVES.at(instr.value));
             ss.d.data()->bindingId = instr.bindingId;
             ss.d.data()->lineNumber = instr.line;
+            ss.d.data()->columnNumber = instr.column;
 
             void *a[] = { &ss, 0, &status, &flags };
             QMetaObject::metacall(target, QMetaObject::WriteProperty, 
@@ -890,6 +739,10 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
             QObject *target = objects.top();
             QDeclarativeParserStatus *status = reinterpret_cast<QDeclarativeParserStatus *>(reinterpret_cast<char *>(target) + instr.castValue);
             parserStatus.push(status);
+#ifdef QML_ENABLE_TRACE
+            Q_ASSERT(QObjectPrivate::get(target)->declarativeData);
+            parserStatusData.push(static_cast<QDeclarativeData *>(QObjectPrivate::get(target)->declarativeData));
+#endif
             status->d = &parserStatus.top();
 
             status->classBegin();
@@ -906,21 +759,17 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
             QObject *context = 
                 objects.at(objects.count() - 1 - instr.context);
 
-            QDeclarativeProperty mp = 
-                QDeclarativePropertyPrivate::restore(instr.property, target, CTXT);
-
-            int coreIndex = mp.index();
-
-            if (instr.isRoot && BINDINGSKIPLIST.testBit(coreIndex)) 
+            if (instr.isRoot && BINDINGSKIPLIST.testBit(instr.property.coreIndex))
                 QML_NEXT_INSTR(StoreBinding);
 
             QDeclarativeBinding *bind = new QDeclarativeBinding(PRIMITIVES.at(instr.value), true, 
-                                                                context, CTXT, COMP->name, instr.line);
+                                                                context, CTXT, COMP->name, instr.line,
+                                                                instr.column);
             bindValues.push(bind);
             bind->m_mePtr = &bindValues.top();
-            bind->setTarget(mp);
+            bind->setTarget(target, instr.property, CTXT);
 
-            bind->addToObject(target, QDeclarativePropertyPrivate::bindingIndex(mp));
+            bind->addToObject(target, QDeclarativePropertyPrivate::bindingIndex(instr.property));
         QML_END_INSTR(StoreBinding)
 
         QML_BEGIN_INSTR(StoreBindingOnAlias)
@@ -929,21 +778,20 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
             QObject *context = 
                 objects.at(objects.count() - 1 - instr.context);
 
-            QDeclarativeProperty mp = 
-                QDeclarativePropertyPrivate::restore(instr.property, target, CTXT);
-
-            int coreIndex = mp.index();
-
-            if (instr.isRoot && BINDINGSKIPLIST.testBit(coreIndex)) 
+            if (instr.isRoot && BINDINGSKIPLIST.testBit(instr.property.coreIndex))
                 QML_NEXT_INSTR(StoreBindingOnAlias);
 
             QDeclarativeBinding *bind = new QDeclarativeBinding(PRIMITIVES.at(instr.value), true,
-                                                                context, CTXT, COMP->name, instr.line);
+                                                                context, CTXT, COMP->name, instr.line,
+                                                                instr.column);
             bindValues.push(bind);
             bind->m_mePtr = &bindValues.top();
-            bind->setTarget(mp);
+            bind->setTarget(target, instr.property, CTXT);
 
-            QDeclarativeAbstractBinding *old = QDeclarativePropertyPrivate::setBindingNoEnable(target, coreIndex, QDeclarativePropertyPrivate::valueTypeCoreIndex(mp), bind);
+            QDeclarativeAbstractBinding *old =
+                QDeclarativePropertyPrivate::setBindingNoEnable(target, instr.property.coreIndex,
+                                                                instr.property.getValueTypeCoreIndex(),
+                                                                bind);
             if (old) { old->destroy(); }
         QML_END_INSTR(StoreBindingOnAlias)
 
@@ -958,7 +806,8 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
                 QML_NEXT_INSTR(StoreV4Binding);
 
             QDeclarativeAbstractBinding *binding = 
-                CTXT->v4bindings->configBinding(instr.value, target, scope, property, instr.line);
+                CTXT->v4bindings->configBinding(instr.value, target, scope, property,
+                                                instr.line, instr.column);
             bindValues.push(binding);
             binding->m_mePtr = &bindValues.top();
             binding->addToObject(target, property);
@@ -975,7 +824,8 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
 
             QDeclarativeAbstractBinding *binding = 
                 CTXT->v8bindings->configBinding(instr.value, target, scope, 
-                                                instr.property, instr.line);
+                                                instr.property, instr.line,
+                                                instr.column);
             bindValues.push(binding);
             binding->m_mePtr = &bindValues.top();
             binding->addToObject(target, QDeclarativePropertyPrivate::bindingIndex(instr.property));
@@ -986,10 +836,8 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
             QDeclarativePropertyValueSource *vs = reinterpret_cast<QDeclarativePropertyValueSource *>(reinterpret_cast<char *>(obj) + instr.castValue);
             QObject *target = objects.at(objects.count() - 1 - instr.owner);
 
-            QDeclarativeProperty prop = 
-                QDeclarativePropertyPrivate::restore(instr.property, target, CTXT);
             obj->setParent(target);
-            vs->setTarget(prop);
+            vs->setTarget(QDeclarativePropertyPrivate::restore(target, instr.property, CTXT));
         QML_END_INSTR(StoreValueSource)
 
         QML_BEGIN_INSTR(StoreValueInterceptor)
@@ -997,7 +845,7 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
             QDeclarativePropertyValueInterceptor *vi = reinterpret_cast<QDeclarativePropertyValueInterceptor *>(reinterpret_cast<char *>(obj) + instr.castValue);
             QObject *target = objects.at(objects.count() - 1 - instr.owner);
             QDeclarativeProperty prop = 
-                QDeclarativePropertyPrivate::restore(instr.property, target, CTXT);
+                QDeclarativePropertyPrivate::restore(target, instr.property, CTXT);
             obj->setParent(target);
             vi->setTarget(prop);
             QDeclarativeVMEMetaObject *mo = static_cast<QDeclarativeVMEMetaObject *>((QMetaObject*)target->metaObject());
@@ -1030,26 +878,6 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
             list.qListProperty.append((QDeclarativeListProperty<void>*)&list.qListProperty, ptr);
         QML_END_INSTR(AssignObjectList)
 
-        QML_BEGIN_INSTR(StoreVariantObject)
-            QObject *assign = objects.pop();
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            QVariant v = QVariant::fromValue(assign);
-            void *a[] = { &v, 0, &status, &flags };
-            QMetaObject::metacall(target, QMetaObject::WriteProperty, 
-                                  instr.propertyIndex, a);
-        QML_END_INSTR(StoreVariantObject)
-
-        QML_BEGIN_INSTR(StoreVarObject)
-            QObject *assign = objects.pop();
-            QObject *target = objects.top();
-            CLEAN_PROPERTY(target, instr.propertyIndex);
-
-            v8::Handle<v8::Value> v8Value = ep->v8engine()->newQObject(assign);
-            static_cast<QDeclarativeVMEMetaObject *>(const_cast<QMetaObject *>(target->metaObject()))->setVMEProperty(instr.propertyIndex, v8Value);
-        QML_END_INSTR(StoreVarObject)
-
         QML_BEGIN_INSTR(StoreInterface)
             QObject *assign = objects.pop();
             QObject *target = objects.top();
@@ -1223,6 +1051,9 @@ void QDeclarativeVME::reset()
     lists.deallocate();
     bindValues.deallocate();
     parserStatus.deallocate();
+#ifdef QML_ENABLE_TRACE
+    parserStatusData.deallocate();
+#endif
     finalizeCallbacks.clear();
     states.clear();
     rootContext = 0;
@@ -1362,9 +1193,17 @@ QDeclarativeContextData *QDeclarativeVME::complete(const Interrupt &interrupt)
     if (!engine)
         return 0;
 
+    QDeclarativeTrace trace("VME Complete");
+#ifdef QML_ENABLE_TRACE
+    trace.addDetail("URL", rootComponent->url);
+#endif
+
     ActiveVMERestorer restore(this, QDeclarativeEnginePrivate::get(engine));
     QRecursionWatcher<QDeclarativeVME, &QDeclarativeVME::recursion> watcher(this);
 
+    {
+    QDeclarativeTrace trace("VME Binding Enable");
+    trace.event("begin binding eval");
     while (!bindValues.isEmpty()) {
         QDeclarativeAbstractBinding *b = bindValues.pop();
 
@@ -1378,12 +1217,23 @@ QDeclarativeContextData *QDeclarativeVME::complete(const Interrupt &interrupt)
             return 0;
     }
     bindValues.deallocate();
+    }
 
+    {
+    QDeclarativeTrace trace("VME Component Complete");
     while (!parserStatus.isEmpty()) {
         QDeclarativeParserStatus *status = parserStatus.pop();
+#ifdef QML_ENABLE_TRACE
+        QDeclarativeData *data = parserStatusData.pop();
+#endif
 
         if (status && status->d) {
             status->d = 0;
+#ifdef QML_ENABLE_TRACE
+            QDeclarativeTrace trace("Component complete");
+            trace.addDetail("URL", data->outerContext->url);
+            trace.addDetail("Line", data->lineNumber);
+#endif
             status->componentComplete();
         }
         
@@ -1391,7 +1241,10 @@ QDeclarativeContextData *QDeclarativeVME::complete(const Interrupt &interrupt)
             return 0;
     }
     parserStatus.deallocate();
+    }
 
+    {
+    QDeclarativeTrace trace("VME Finalize Callbacks");
     for (int ii = 0; ii < finalizeCallbacks.count(); ++ii) {
         QDeclarativeEnginePrivate::FinalizeCallback callback = finalizeCallbacks.at(ii);
         QObject *obj = callback.first;
@@ -1403,7 +1256,10 @@ QDeclarativeContextData *QDeclarativeVME::complete(const Interrupt &interrupt)
             return 0;
     }
     finalizeCallbacks.clear();
+    }
 
+    {
+    QDeclarativeTrace trace("VME Component.onCompleted Callbacks");
     while (componentAttached) {
         QDeclarativeComponentAttached *a = componentAttached;
         a->rem();
@@ -1416,6 +1272,7 @@ QDeclarativeContextData *QDeclarativeVME::complete(const Interrupt &interrupt)
         if (watcher.hasRecursed() || interrupt.shouldInterrupt())
             return 0;
     }
+    }
 
     QDeclarativeContextData *rv = rootContext;