diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-03-30 14:53:03 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2016-04-05 13:52:47 +0000 |
commit | aac611fdb8aacc494956a080bf38cb9b7eb4c2e8 (patch) | |
tree | ff88f41bdd35871b5cfbb84dbdad8b61f5efa1c3 /src/qml/qml | |
parent | eb9fa2d407a712ae72f7fdf80c4833bd301f1de5 (diff) |
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 <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmldata_p.h | 11 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 19 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine_p.h | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression_p.h | 7 | ||||
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 21 | ||||
-rw-r--r-- | 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) { @@ -1904,16 +1895,6 @@ void QQmlEnginePrivate::warning(QQmlEnginePrivate *engine, const QList<QQmlError } /* - This function should be called prior to evaluation of any js expression, - so that scarce resources are not freed prematurely (eg, if there is a - nested javascript expression). - */ -void QQmlEnginePrivate::referenceScarceResources() -{ - scarceResourcesRefCount += 1; -} - -/* This function should be called after evaluation of the js expression is complete, and so the scarce resources may be freed safely. */ diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index 4014d20a9e..df73118b36 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -269,6 +269,16 @@ private: void doDeleteInEngineThread(); }; +/* + This function should be called prior to evaluation of any js expression, + so that scarce resources are not freed prematurely (eg, if there is a + nested javascript expression). + */ +inline void QQmlEnginePrivate::referenceScarceResources() +{ + scarceResourcesRefCount += 1; +} + /*! Returns true if the calling thread is the QQmlEngine thread. */ diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 15d0a571a5..31b1b8fba5 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -336,14 +336,6 @@ void QQmlPropertyCapture::registerQmlDependencies(QV4::ExecutionEngine *engine, } - -void QQmlJavaScriptExpression::clearError() -{ - if (m_error) - delete m_error; - m_error = 0; -} - QQmlError QQmlJavaScriptExpression::error(QQmlEngine *engine) const { Q_UNUSED(engine); diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h index e8ca498ff4..64cb1bb242 100644 --- a/src/qml/qml/qqmljavascriptexpression_p.h +++ b/src/qml/qml/qqmljavascriptexpression_p.h @@ -243,6 +243,13 @@ bool QQmlJavaScriptExpression::hasDelayedError() const return m_error; } +inline void QQmlJavaScriptExpression::clearError() +{ + if (m_error) + delete m_error; + m_error = 0; +} + QQmlJavaScriptExpressionGuard::QQmlJavaScriptExpressionGuard(QQmlJavaScriptExpression *e) : QQmlNotifierEndpoint(QQmlNotifierEndpoint::QQmlJavaScriptExpressionGuard), expression(e), next(0) diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 3be52cf461..0522aa93ee 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -704,14 +704,6 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, } } -QQmlPropertyData *QQmlPropertyCache::ensureResolved(QQmlPropertyData *p) const -{ - if (p && p->notFullyResolved()) - resolve(p); - - return p; -} - void QQmlPropertyCache::resolve(QQmlPropertyData *data) const { Q_ASSERT(data->notFullyResolved()); @@ -840,19 +832,6 @@ int QQmlPropertyCache::methodIndexToSignalIndex(int index) const } 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<QQmlPropertyData *>(&propertyIndexCache.at(index - propertyIndexCacheStart)); - return ensureResolved(rv); -} - -QQmlPropertyData * QQmlPropertyCache::method(int index) const { if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.count())) 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<QQmlPropertyData *>(&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() { } |