aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlengine.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2016-10-14 12:06:23 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2016-10-18 13:31:48 +0000
commit06e3cfb0c49ca94d4456d7abc8b332ef9582ae62 (patch)
treea97f0931750cf78d16ad3b1c62517d294e65bfbe /src/qml/qml/qqmlengine.cpp
parent2c2c92d999ae8584840e44785fbece9bf2cfac62 (diff)
QML: Split two QQmlData methods into fast/slow paths
The common case is that the property cache and the QQmlData itself are already created. By splitting the creation off into a slow-path method, these simple methods are cheap to inline. Change-Id: I73c702b5e66f35379647946a0c431561fd87499b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r--src/qml/qml/qqmlengine.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index c10aa0129c..7877ee7e21 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -1861,15 +1861,19 @@ void QQmlData::setPendingBindingBit(QObject *obj, int coreIndex)
QQmlData_setBit(this, obj, coreIndex * 2 + 1);
}
-QQmlPropertyCache *QQmlData::ensurePropertyCache(QJSEngine *engine, QObject *object)
+QQmlData *QQmlData::createQQmlData(QObjectPrivate *priv)
+{
+ Q_ASSERT(priv);
+ priv->declarativeData = new QQmlData;
+ return static_cast<QQmlData *>(priv->declarativeData);
+}
+
+QQmlPropertyCache *QQmlData::createPropertyCache(QJSEngine *engine, QObject *object)
{
- Q_ASSERT(engine);
QQmlData *ddata = QQmlData::get(object, /*create*/true);
- if (!ddata->propertyCache) {
- ddata->propertyCache = QJSEnginePrivate::get(engine)->cache(object);
- if (ddata->propertyCache)
- ddata->propertyCache->addref();
- }
+ ddata->propertyCache = QJSEnginePrivate::get(engine)->cache(object);
+ if (ddata->propertyCache)
+ ddata->propertyCache->addref();
return ddata->propertyCache;
}