diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-13 13:46:40 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-21 06:37:00 +0000 |
commit | 9bf52362545ca3f2eab2f307c4523cf9195365b2 (patch) | |
tree | 6f28ea22d548fb6849ca1dd469f789a5c862f966 /src/qml/qml/qqmlobjectcreator.cpp | |
parent | 50bd7d4720eb7d17545734e79a3cef0f42986a06 (diff) |
Eliminate remaining property cache string lookups upon object instantiation
Even for the id property binding we can use the property data cache and
therefore avoid string hashing.
Change-Id: Id9a4ca3159cdfe5ba93060f1bc8626e70140daa1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 3d8a6437b8..3c2f3690b9 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -642,9 +642,12 @@ void QQmlObjectCreator::setupBindings(const QBitArray &bindingsToSkip) QQmlListProperty<void> savedList; qSwap(_currentList, savedList); + const QV4::CompiledData::BindingPropertyData &propertyData = compiledData->compilationUnit->bindingPropertyDataPerObject.at(_compiledObjectIndex); + if (_compiledObject->idIndex) { - QQmlPropertyData *idProperty = _propertyCache->property(QStringLiteral("id"), _qobject, context); - if (idProperty && idProperty->isWritable() && idProperty->propType == QMetaType::QString) { + const QQmlPropertyData *idProperty = propertyData.last(); + Q_ASSERT(!idProperty || !idProperty->isValid() || idProperty->name(_qobject) == QStringLiteral("id")); + if (idProperty && idProperty->isValid() && idProperty->isWritable() && idProperty->propType == QMetaType::QString) { QV4::CompiledData::Binding idBinding; idBinding.propertyNameIndex = 0; // Not used idBinding.flags = 0; @@ -684,8 +687,6 @@ void QQmlObjectCreator::setupBindings(const QBitArray &bindingsToSkip) } } - const QV4::CompiledData::BindingPropertyData &propertyData = compiledData->compilationUnit->bindingPropertyDataPerObject.at(_compiledObjectIndex); - int currentListPropertyIndex = -1; const QV4::CompiledData::Binding *binding = _compiledObject->bindingTable(); |