From 550290250a99f38f6ff0a891d6e75e21deec8cbf Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 29 Nov 2016 12:53:04 +0100 Subject: Fix caching of the current qmlContext in QQmlObjectCreator A context is not a QV4::Object, just a QV4::Managed. Testing for Object here lead to us creating a new QV4::QmlContext every time this method got called instead of sharing it. Reduces memory consumption and improves the performance of some of the creation benchmarks in qmlbench by ~20%. Change-Id: I20c0ad52133aa0cb40c9d2551fd635bef8b7d90a Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlobjectcreator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/qml') diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 2218f277d6..004e18576b 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -1016,7 +1016,7 @@ void QQmlObjectCreator::registerObjectWithContextById(const QV4::CompiledData::O QV4::Heap::QmlContext *QQmlObjectCreator::currentQmlContext() { - if (!_qmlContext->objectValue()) + if (!_qmlContext->isManaged()) _qmlContext->setM(v4->rootContext()->newQmlContext(context, _scopeObject)); return _qmlContext->d(); -- cgit v1.2.3