diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-12-03 06:09:31 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-12-03 06:09:31 (GMT) |
commit | 8e45a7b2b66d998c941c1c66bdabc240decd5474 (patch) | |
tree | b1a13e06f996995ecd2847039344ff43cbdb7144 /src/declarative/qml/qmlcompiler.cpp | |
parent | 4a68ca535074625d8ec20435e21fa658652e7680 (diff) | |
download | Qt-8e45a7b2b66d998c941c1c66bdabc240decd5474.zip Qt-8e45a7b2b66d998c941c1c66bdabc240decd5474.tar.gz Qt-8e45a7b2b66d998c941c1c66bdabc240decd5474.tar.bz2 |
Optimization
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 7a31673..c8e9fa3 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -1577,11 +1577,10 @@ void QmlCompiler::genPropertyAssignment(QmlParser::Property *prop, store.type = QmlInstruction::StoreValueSource; store.line = v->object->location.start.line; if (valueTypeProperty) { - store.assignValueSource.property = QmlMetaPropertyPrivate::saveValueType(valueTypeProperty->index, prop->index); + store.assignValueSource.property = genValueTypeData(prop, valueTypeProperty); store.assignValueSource.owner = 1; } else { - store.assignValueSource.property = - QmlMetaPropertyPrivate::saveProperty(prop->index); + store.assignValueSource.property = genPropertyData(prop); store.assignValueSource.owner = 0; } QmlType *valueType = QmlMetaType::qmlType(v->object->metatype); @@ -1595,11 +1594,10 @@ void QmlCompiler::genPropertyAssignment(QmlParser::Property *prop, store.type = QmlInstruction::StoreValueInterceptor; store.line = v->object->location.start.line; if (valueTypeProperty) { - store.assignValueInterceptor.property = QmlMetaPropertyPrivate::saveValueType(valueTypeProperty->index, prop->index); + store.assignValueInterceptor.property = genValueTypeData(prop, valueTypeProperty); store.assignValueInterceptor.owner = 1; } else { - store.assignValueInterceptor.property = - QmlMetaPropertyPrivate::saveProperty(prop->index); + store.assignValueInterceptor.property = genPropertyData(prop); store.assignValueInterceptor.owner = 0; } QmlType *valueType = QmlMetaType::qmlType(v->object->metatype); @@ -2467,12 +2465,9 @@ void QmlCompiler::genBindingAssignment(QmlParser::Value *binding, Q_ASSERT(ref.bindingContext.owner == 0 || (ref.bindingContext.owner != 0 && valueTypeProperty)); if (ref.bindingContext.owner) { - store.assignBinding.property = - QmlMetaPropertyPrivate::saveValueType(valueTypeProperty->index, - prop->index); + store.assignBinding.property = genValueTypeData(prop, valueTypeProperty); } else { - store.assignBinding.property = - QmlMetaPropertyPrivate::saveProperty(prop->index); + store.assignBinding.property = genPropertyData(prop); } output->bytecode << store; @@ -2494,6 +2489,17 @@ int QmlCompiler::genContextCache() return output->contextCaches.count() - 1; } +int QmlCompiler::genValueTypeData(QmlParser::Property *valueTypeProp, + QmlParser::Property *prop) +{ + return output->indexForByteArray(QmlMetaPropertyPrivate::saveValueType(prop->parent->metaObject(), prop->index, valueTypeProp->index, valueTypeProp->type)); +} + +int QmlCompiler::genPropertyData(QmlParser::Property *prop) +{ + return output->indexForByteArray(QmlMetaPropertyPrivate::saveProperty(prop->parent->metaObject(), prop->index)); +} + bool QmlCompiler::completeComponentBuild() { componentStat.ids = compileState.ids.count(); |