From aac611fdb8aacc494956a080bf38cb9b7eb4c2e8 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 30 Mar 2016 14:53:03 +0200 Subject: QML: allow more methods to get inlined. Most of these methods are small, and all of them lie in the 'hot path' for simple bindings like 'width: parent.width'. Change-Id: I0071cec92b49437a352160b0283ed6c89a278a07 Reviewed-by: Lars Knoll --- src/qml/qml/qqmldata_p.h | 11 ++++++++++- src/qml/qml/qqmlengine.cpp | 19 ------------------- src/qml/qml/qqmlengine_p.h | 10 ++++++++++ src/qml/qml/qqmljavascriptexpression.cpp | 8 -------- src/qml/qml/qqmljavascriptexpression_p.h | 7 +++++++ src/qml/qml/qqmlpropertycache.cpp | 21 --------------------- src/qml/qml/qqmlpropertycache_p.h | 20 ++++++++++++++++++++ 7 files changed, 47 insertions(+), 49 deletions(-) diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h index 1a8cd0ce09..ad2456a68d 100644 --- a/src/qml/qml/qqmldata_p.h +++ b/src/qml/qml/qqmldata_p.h @@ -149,7 +149,7 @@ public: inline QQmlNotifierEndpoint *notify(int index); void addNotify(int index, QQmlNotifierEndpoint *); int endpointCount(int index); - bool signalHasEndpoint(int index); + bool signalHasEndpoint(int index) const; void disconnectNotifiers(); // The context that created the C++ object @@ -264,6 +264,15 @@ QQmlNotifierEndpoint *QQmlData::notify(int index) } } +/* + The index MUST be in the range returned by QObjectPrivate::signalIndex() + This is different than the index returned by QMetaMethod::methodIndex() +*/ +inline bool QQmlData::signalHasEndpoint(int index) const +{ + return notifyList && (notifyList->connectionMask & (1ULL << quint64(index % 64))); +} + bool QQmlData::hasBindingBit(int coreIndex) const { int bit = coreIndex * 2; diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 1348151b0d..0978af78a9 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -1600,15 +1600,6 @@ void QQmlData::addNotify(int index, QQmlNotifierEndpoint *endpoint) } } -/* - index MUST in the range returned by QObjectPrivate::signalIndex() - This is different than the index returned by QMetaMethod::methodIndex() -*/ -bool QQmlData::signalHasEndpoint(int index) -{ - return notifyList && (notifyList->connectionMask & (1ULL << quint64(index % 64))); -} - void QQmlData::disconnectNotifiers() { if (notifyList) { @@ -1903,16 +1894,6 @@ void QQmlEnginePrivate::warning(QQmlEnginePrivate *engine, const QListnotFullyResolved()) - resolve(p); - - return p; -} - void QQmlPropertyCache::resolve(QQmlPropertyData *data) const { Q_ASSERT(data->notFullyResolved()); @@ -839,19 +831,6 @@ int QQmlPropertyCache::methodIndexToSignalIndex(int index) const return index - methodIndexCacheStart + signalHandlerIndexCacheStart; } -QQmlPropertyData * -QQmlPropertyCache::property(int index) const -{ - if (index < 0 || index >= (propertyIndexCacheStart + propertyIndexCache.count())) - return 0; - - if (index < propertyIndexCacheStart) - return _parent->property(index); - - QQmlPropertyData *rv = const_cast(&propertyIndexCache.at(index - propertyIndexCacheStart)); - return ensureResolved(rv); -} - QQmlPropertyData * QQmlPropertyCache::method(int index) const { diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index 4ff5ee89f9..bb39a5e371 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -494,6 +494,18 @@ int QQmlPropertyRawData::encodedIndex() const return isValueTypeVirtual()?QQmlPropertyData::encodeValueTypePropertyIndex(coreIndex, valueTypeCoreIndex):coreIndex; } +inline QQmlPropertyData *QQmlPropertyCache::property(int index) const +{ + if (index < 0 || index >= (propertyIndexCacheStart + propertyIndexCache.count())) + return 0; + + if (index < propertyIndexCacheStart) + return _parent->property(index); + + QQmlPropertyData *rv = const_cast(&propertyIndexCache.at(index - propertyIndexCacheStart)); + return ensureResolved(rv); +} + QQmlPropertyData * QQmlPropertyCache::overrideData(QQmlPropertyData *data) const { @@ -542,6 +554,14 @@ int QQmlPropertyCache::signalOffset() const return signalHandlerIndexCacheStart; } +inline QQmlPropertyData *QQmlPropertyCache::ensureResolved(QQmlPropertyData *p) const +{ + if (p && p->notFullyResolved()) + resolve(p); + + return p; +} + QQmlMetaObject::QQmlMetaObject() { } -- cgit v1.2.3