summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlvme.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-14 03:54:55 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-15 07:30:16 (GMT)
commit4f7e21dc04ce93531ef68f7694a5e8969448de8b (patch)
treece7e8170b5be6c974420d012a03f620f86cd6d8d /src/declarative/qml/qmlvme.cpp
parent9eca9e028884fb82d97e284826faa7965af356bd (diff)
downloadQt-4f7e21dc04ce93531ef68f7694a5e8969448de8b.zip
Qt-4f7e21dc04ce93531ef68f7694a5e8969448de8b.tar.gz
Qt-4f7e21dc04ce93531ef68f7694a5e8969448de8b.tar.bz2
Rework compiler to a two phase analyse/generate approach
Diffstat (limited to 'src/declarative/qml/qmlvme.cpp')
-rw-r--r--src/declarative/qml/qmlvme.cpp72
1 files changed, 16 insertions, 56 deletions
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index 2acf1e2..dfb066b 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -152,7 +152,6 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledComp
QStack<ListInstance> qliststack;
QStack<QmlMetaProperty> pushedProperties;
- QObject **savedObjects = 0;
vmeErrors.clear();
@@ -162,12 +161,6 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledComp
switch(instr.type) {
case QmlInstruction::Init:
{
- if (instr.init.dataSize) {
- savedObjects = new QObject*[instr.init.dataSize];
- ::memset(savedObjects, 0,
- sizeof(QObject *)*instr.init.dataSize);
- }
-
if (instr.init.bindingsSize)
bindValues = QmlEnginePrivate::SimpleList<QmlBindableValue>(instr.init.bindingsSize);
if (instr.init.parserStatusSize)
@@ -214,9 +207,6 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledComp
QmlContext *ctxt =
QmlContext::activeContext();
ctxt->setContextProperty(primitives.at(instr.setId.value), target);
-
- if (instr.setId.save != -1)
- savedObjects[instr.setId.save] = target;
}
break;
@@ -239,7 +229,16 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledComp
case QmlInstruction::StoreMetaObject:
{
QObject *target = stack.top();
- new QmlVMEMetaObject(target, synthesizedMetaObjects.at(instr.storeMeta.data), &comp->primitives, instr.storeMeta.slotData, (const QmlVMEMetaData *)datas.at(instr.storeMeta.aliasData).constData(), comp);
+
+ QMetaObject mo;
+ const QByteArray &metadata = datas.at(instr.storeMeta.data);
+ QMetaObjectBuilder::fromRelocatableData(&mo, 0, metadata);
+
+ const QmlVMEMetaData *data = (const QmlVMEMetaData *)datas.at(instr.storeMeta.aliasData).constData();
+
+ (void)new QmlVMEMetaObject(target, &mo, data, comp);
+
+ // new QmlVMEMetaObject(target, synthesizedMetaObjects.at(instr.storeMeta.data), &comp->primitives, instr.storeMeta.slotData, (const QmlVMEMetaData *)datas.at(instr.storeMeta.aliasData).constData(), comp);
}
break;
@@ -545,15 +544,6 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledComp
}
break;
- case QmlInstruction::PushProperty:
- {
- QObject *target = stack.top();
- QmlMetaProperty mp(target, instr.pushProperty.property,
- QmlMetaProperty::Object);
- pushedProperties.push(mp);
- }
- break;
-
case QmlInstruction::StoreCompiledBinding:
{
QObject *target = stack.top();
@@ -745,22 +735,12 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledComp
QObject *target = stack.top();
QObject *obj = 0;
- if (instr.fetch.isObject) {
- // NOTE: This assumes a cast to QObject does not alter the
- // object pointer
- void *a[1];
- a[0] = &obj;
- QMetaObject::metacall(target, QMetaObject::ReadProperty,
- instr.fetch.property, a);
- } else {
- void *a[1];
- QVariant var;
- a[0] = &var;
- QMetaObject::metacall(target, QMetaObject::ReadProperty,
- instr.fetch.property, a);
- obj = QmlMetaType::toQObject(var);
-
- }
+ // NOTE: This assumes a cast to QObject does not alter the
+ // object pointer
+ void *a[1];
+ a[0] = &obj;
+ QMetaObject::metacall(target, QMetaObject::ReadProperty,
+ instr.fetch.property, a);
if (!obj)
VME_EXCEPTION("Cannot set properties on" << target->metaObject()->property(instr.fetch.property).name() << "as it is null");
@@ -795,21 +775,6 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledComp
}
break;
- case QmlInstruction::StoreStackObject:
- {
- const QmlMetaProperty &prop =
- pushedProperties.at(instr.assignStackObject.property);
- QObject *obj = savedObjects[instr.assignStackObject.object];
-
- // NOTE: This assumes a cast to QObject does not alter the
- // object pointer
- void *a[1];
- a[0] = (void *)&obj;
- QMetaObject::metacall(prop.object(), QMetaObject::WriteProperty,
- prop.coreIndex(), a);
- }
- break;
-
default:
qFatal("QmlCompiledComponent: Internal error - unknown instruction %d", instr.type);
break;
@@ -832,11 +797,6 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledComp
if (parserStatus.count)
ep->parserStatus << parserStatus;
- comp->dumpPost();
-
- if (savedObjects)
- delete [] savedObjects;
-
if (stack.isEmpty())
return 0;
else