From b227da8a17cd7b0facc3491d645209e277cb64b7 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 26 May 2009 17:18:07 +1000 Subject: Remove ResolveFetchObject instruction --- src/declarative/qml/qmlcompiler.cpp | 18 +++++++++--------- src/declarative/qml/qmlinstruction.cpp | 3 --- src/declarative/qml/qmlinstruction_p.h | 1 - src/declarative/qml/qmlvme.cpp | 26 -------------------------- 4 files changed, 9 insertions(+), 39 deletions(-) diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 0712136..ae915db 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -976,16 +976,16 @@ bool QmlCompiler::compileNestedProperty(QmlParser::Property *prop, if (prop->type != 0) prop->value->metatype = QmlMetaType::metaObjectForType(prop->type); + if (prop->index == -1) + COMPILE_EXCEPTION2(prop, "Cannot access non-existant property" << prop->name); + + if (!QmlMetaType::isObject(prop->value->metatype)) + COMPILE_EXCEPTION2(prop, "Cannot nest non-QObject property" << prop->name); + QmlInstruction fetch; - if (prop->index != -1 && - QmlMetaType::isObject(prop->value->metatype)) { - fetch.type = QmlInstruction::FetchObject; - fetch.fetch.property = prop->index; - fetch.fetch.isObject = true; - } else { - fetch.type = QmlInstruction::ResolveFetchObject; - fetch.fetch.property = output->indexForByteArray(prop->name); - } + fetch.type = QmlInstruction::FetchObject; + fetch.fetch.property = prop->index; + fetch.fetch.isObject = true; fetch.line = prop->location.start.line; output->bytecode << fetch; diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp index 5197b7b..7103d87 100644 --- a/src/declarative/qml/qmlinstruction.cpp +++ b/src/declarative/qml/qmlinstruction.cpp @@ -157,9 +157,6 @@ void QmlCompiledComponent::dump(QmlInstruction *instr, int idx) case QmlInstruction::FetchObject: qWarning() << idx << "\t" << line << "\t" << "FETCH\t\t\t" << instr->fetch.property; break; - case QmlInstruction::ResolveFetchObject: - qWarning() << idx << "\t" << line << "\t" << "RESOLVE_FETCH\t\t" << instr->fetch.property << "\t\t\t" << datas.at(instr->fetch.property); - break; case QmlInstruction::PopFetchedObject: qWarning() << idx << "\t" << line << "\t" << "POP"; break; diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index cd66d66..bc696b1 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -126,7 +126,6 @@ public: FetchQmlList, /* fetchQmlList */ FetchQList, /* fetch */ FetchObject, /* fetch */ - ResolveFetchObject, /* fetch */ // // Stack manipulation diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 6d46422..348a706 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -98,7 +98,6 @@ Q_DECLARE_PERFORMANCE_LOG(QFxCompiler) { Q_DECLARE_PERFORMANCE_METRIC(InstrFetchQmlList); Q_DECLARE_PERFORMANCE_METRIC(InstrFetchQList); Q_DECLARE_PERFORMANCE_METRIC(InstrFetchObject); - Q_DECLARE_PERFORMANCE_METRIC(InstrResolveFetchObject); Q_DECLARE_PERFORMANCE_METRIC(InstrPopFetchedObject); Q_DECLARE_PERFORMANCE_METRIC(InstrPopQList); Q_DECLARE_PERFORMANCE_METRIC(InstrPushProperty); @@ -140,7 +139,6 @@ Q_DEFINE_PERFORMANCE_LOG(QFxCompiler, "QFxCompiler") { Q_DEFINE_PERFORMANCE_METRIC(InstrFetchQmlList, "FetchQmlList"); Q_DEFINE_PERFORMANCE_METRIC(InstrFetchQList, "FetchQList"); Q_DEFINE_PERFORMANCE_METRIC(InstrFetchObject, "FetchObject"); - Q_DEFINE_PERFORMANCE_METRIC(InstrResolveFetchObject, "ResolveFetchObject"); Q_DEFINE_PERFORMANCE_METRIC(InstrPopFetchedObject, "PopFetchedObject"); Q_DEFINE_PERFORMANCE_METRIC(InstrPopQList, "PopQList"); Q_DEFINE_PERFORMANCE_METRIC(InstrPushProperty, "PushProperty"); @@ -897,30 +895,6 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in } break; - case QmlInstruction::ResolveFetchObject: - { -#ifdef Q_ENABLE_PERFORMANCE_LOG - QFxCompilerTimer cc; -#endif - QObject *target = stack.top(); - const QByteArray &pr = datas.at(instr.fetch.property); - int idx = qIndexOfProperty(target, pr); - if (idx == -1) - VME_EXCEPTION("Cannot resolve property" << pr); - QMetaProperty prop = target->metaObject()->property(idx); - instr.type = QmlInstruction::FetchObject; - instr.fetch.property = idx; - if (QmlMetaType::isObject(prop.userType())) { - instr.fetch.isObject = true; - } else if (prop.userType() == -1) { - instr.fetch.isObject = false; - } else { - VME_EXCEPTION("Cannot set properties on" << prop.name() << "as it is of unknown type"); - } - ii--; - } - break; - case QmlInstruction::FetchObject: { #ifdef Q_ENABLE_PERFORMANCE_LOG -- cgit v0.12