diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-12-22 07:54:53 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-12-22 07:54:53 (GMT) |
commit | 3309bafa64d95cce5c0f3cc7e7fca9d24d70c9f7 (patch) | |
tree | 41e702f4fd57dabf3438257e10f265da22dafe45 | |
parent | 944a9b41e34e0a8c9b9994a040a6b83aa4e11291 (diff) | |
download | Qt-3309bafa64d95cce5c0f3cc7e7fca9d24d70c9f7.zip Qt-3309bafa64d95cce5c0f3cc7e7fca9d24d70c9f7.tar.gz Qt-3309bafa64d95cce5c0f3cc7e7fca9d24d70c9f7.tar.bz2 |
Remove unused optimization
-rw-r--r-- | src/declarative/qml/qmlbasicscript.cpp | 17 | ||||
-rw-r--r-- | src/declarative/qml/qmlbasicscript_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlbindingoptimizations.cpp | 71 | ||||
-rw-r--r-- | src/declarative/qml/qmlbindingoptimizations_p.h | 26 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 21 | ||||
-rw-r--r-- | src/declarative/qml/qmlinstruction.cpp | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlinstruction_p.h | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlvme.cpp | 19 |
8 files changed, 2 insertions, 158 deletions
diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index b596437..ebdd348 100644 --- a/src/declarative/qml/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -737,23 +737,6 @@ int QmlBasicScript::singleIdFetchIndex() const return d->instructions()[0].fetch.idx; } -bool QmlBasicScript::isSingleContextProperty() const -{ - if (!isValid()) - return false; - - return d->instructionCount == 1 && - d->instructions()[0].type == ScriptInstruction::FetchContextConstant; -} - -int QmlBasicScript::singleContextPropertyIndex() const -{ - if (!isSingleContextProperty()) - return -1; - - return d->instructions()[0].constant.idx; -} - /*! Return a pointer to the script's compile data, or null if there is no data. */ diff --git a/src/declarative/qml/qmlbasicscript_p.h b/src/declarative/qml/qmlbasicscript_p.h index 3af09c2..c4b436d 100644 --- a/src/declarative/qml/qmlbasicscript_p.h +++ b/src/declarative/qml/qmlbasicscript_p.h @@ -104,8 +104,6 @@ public: bool isSingleIdFetch() const; int singleIdFetchIndex() const; - bool isSingleContextProperty() const; - int singleContextPropertyIndex() const; private: int flags; QmlBasicScriptPrivate *d; diff --git a/src/declarative/qml/qmlbindingoptimizations.cpp b/src/declarative/qml/qmlbindingoptimizations.cpp index d8a2de0..d7105b2 100644 --- a/src/declarative/qml/qmlbindingoptimizations.cpp +++ b/src/declarative/qml/qmlbindingoptimizations.cpp @@ -255,75 +255,4 @@ void QmlBinding_Id::reset() m_propertyIdx, a); } -/* - The QmlBinding_ObjectProperty optimization handles expressions of the type: - - property: objectProperty - - where both property and objectProperty are object properties on the target - object. Coercian between the two must be checked outside the - QmlBinding_ObjectProperty - it assumes that they coerce successfully. - - Due to dot properties, property does not have to be on the same object as - objectProperty. For example: - - anchors.fill: parent -*/ -QmlBinding_ObjProperty::QmlBinding_ObjProperty(QObject *object, int propertyIdx, - QObject *context, int contextIdx, - int notifyIdx) -: m_enabled(false), m_object(object), m_propertyIdx(propertyIdx), - m_context(context), m_contextIdx(contextIdx), m_notifyIdx(notifyIdx) -{ -} - -void QmlBinding_ObjProperty::setEnabled(bool e, QmlMetaProperty::WriteFlags flags) -{ - m_enabled = e; - if (e) { - addToObject(m_object); - update(flags); - } else { - removeFromObject(); - } - - QmlAbstractBinding::setEnabled(e, flags); -} - -int QmlBinding_ObjProperty::propertyIndex() -{ - return m_propertyIdx; -} - -void QmlBinding_ObjProperty::update(QmlMetaProperty::WriteFlags flags) -{ - if (!m_enabled) - return; - - QObject *value = 0; - int status = -1; - void *ra[] = { &value, 0, &status }; - - // Read - QMetaObject::metacall(m_context, QMetaObject::ReadProperty, - m_contextIdx, ra); - - void *wa[] = { &value, 0, &status, &flags }; - - // Write - QMetaObject::metacall(m_object, QMetaObject::WriteProperty, - m_propertyIdx, wa); - - // Connect notify if needed. Only need to connect once, so we set - // m_notifyIdx back to -1 afterwards - static int slotIdx = -1; - if (m_notifyIdx != -1) { - if (slotIdx == -1) - slotIdx = QmlBinding_ObjProperty::staticMetaObject.indexOfMethod("update()"); - - QMetaObject::connect(m_context, m_notifyIdx, this, slotIdx); - m_notifyIdx = -1; - } -} - QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlbindingoptimizations_p.h b/src/declarative/qml/qmlbindingoptimizations_p.h index 6289cc0..feb753e 100644 --- a/src/declarative/qml/qmlbindingoptimizations_p.h +++ b/src/declarative/qml/qmlbindingoptimizations_p.h @@ -128,32 +128,6 @@ private: int m_id; }; -class QmlBinding_ObjProperty : public QObject, - public QmlAbstractExpression, - public QmlAbstractBinding -{ - Q_OBJECT -public: - QmlBinding_ObjProperty(QObject *object, int propertyIdx, - QObject *context, int contextIdx, int notifyIdx); - - // Inherited from QmlAbstractBinding - virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags); - virtual int propertyIndex(); - virtual void update(QmlMetaProperty::WriteFlags flags); - -private Q_SLOTS: - void update() { update(QmlMetaProperty::DontRemoveBinding); } - -private: - bool m_enabled; - QObject *m_object; - int m_propertyIdx; - QObject *m_context; - int m_contextIdx; - int m_notifyIdx; -}; - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 3ebefea..7f11a23 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -2545,24 +2545,7 @@ void QmlCompiler::genBindingAssignment(QmlParser::Value *binding, output->bytecode << store; return; } - } else if (bs.isSingleContextProperty()) { - int propIndex = bs.singleContextPropertyIndex(); - - QMetaProperty p = - ref.bindingContext.object->metaObject()->property(propIndex); - if ((p.notifySignalIndex() != -1 || p.isConstant()) && - canCoerce(prop->type, p.userType())) { - - store.type = QmlInstruction::StoreObjPropBinding; - store.assignObjPropBinding.property = prop->index; - store.assignObjPropBinding.contextIdx = propIndex; - store.assignObjPropBinding.context = ref.bindingContext.stack; - store.assignObjPropBinding.notifyIdx = p.notifySignalIndex(); - - output->bytecode << store; - return; - } - } + } store.type = QmlInstruction::StoreBinding; store.assignBinding.value = output->indexForByteArray(ref.compiledData); @@ -2634,7 +2617,7 @@ bool QmlCompiler::completeComponentBuild() bs.compile(expr); - if (qmlExperimental() && (!bs.isValid() || (!bs.isSingleIdFetch() && !bs.isSingleContextProperty()))) { + if (qmlExperimental() && (!bs.isValid() || !bs.isSingleIdFetch())) { int index = bindingCompiler.compile(expr, QmlEnginePrivate::get(engine)); if (index != -1) { qWarning() << "Accepted for optimization:" << qPrintable(expr.expression.asScript()); diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp index c873803..2ddad49 100644 --- a/src/declarative/qml/qmlinstruction.cpp +++ b/src/declarative/qml/qmlinstruction.cpp @@ -164,9 +164,6 @@ void QmlCompiledData::dump(QmlInstruction *instr, int idx) case QmlInstruction::StoreIdOptBinding: qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_ID_OPT_BINDING\t" << instr->assignIdOptBinding.property << "\t" << instr->assignIdOptBinding.id; break; - case QmlInstruction::StoreObjPropBinding: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJ_PROP_BINDING\t" << instr->assignObjPropBinding.property << "\t" << instr->assignObjPropBinding.contextIdx << "\t" << instr->assignObjPropBinding.context << "\t" << instr->assignObjPropBinding.notifyIdx; - break; case QmlInstruction::StoreValueSource: qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue; break; diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index 6e2b452..44fa196 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -130,7 +130,6 @@ public: StoreBinding, /* assignBinding */ StoreCompiledBinding, /* assignBinding */ StoreIdOptBinding, /* assignIdOptBinding */ - StoreObjPropBinding, /* assignObjPropBinding */ StoreValueSource, /* assignValueSource */ StoreValueInterceptor, /* assignValueInterceptor */ diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index f1abd7d..06795a8 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -644,25 +644,6 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt, } break; - case QmlInstruction::StoreObjPropBinding: - { - int coreIndex = instr.assignObjPropBinding.property; - if (stack.count() == 1 && bindingSkipList.testBit(coreIndex)) - break; - - QObject *target = stack.top(); - QObject *context = - stack.at(stack.count() - 1 - instr.assignObjPropBinding.context); - - QmlBinding_ObjProperty *bind = - new QmlBinding_ObjProperty(target, instr.assignObjPropBinding.property, context, instr.assignObjPropBinding.contextIdx, instr.assignObjPropBinding.notifyIdx); - - bindValues.append(bind); - bind->m_mePtr = &bindValues.values[bindValues.count - 1]; - bind->addToObject(target); - } - break; - case QmlInstruction::StoreValueSource: { QObject *obj = stack.pop(); |