From 43f1cc98bf1899ae29e3fb0b3bf5054d5a23d4b2 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sat, 2 Nov 2013 22:46:25 +0100 Subject: Initial support for accelerated property access to QML singletons and enums With this patch we determine the meta-object of singletons, propagate it into the IR and load them separately using a dedicated run-time function. In addition enums in singletons and QML types are resolved at compile time. Change-Id: I01ce1288391b476d1c9af669cb2987a44c885703 Reviewed-by: Lars Knoll --- src/qml/qml/qqmlmetatype.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/qml/qml/qqmlmetatype.cpp') diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 342d1dc69c..ed0c0afd6f 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -225,17 +225,21 @@ public: void QQmlType::SingletonInstanceInfo::init(QQmlEngine *e) { QV4::ExecutionEngine *v4 = QV8Engine::getV4(e->handle()); - v4->pushGlobalContext(); if (scriptCallback && scriptApi(e).isUndefined()) { + v4->pushGlobalContext(); setScriptApi(e, scriptCallback(e, e)); + v4->popContext(); } else if (qobjectCallback && !qobjectApi(e)) { + v4->pushGlobalContext(); setQObjectApi(e, qobjectCallback(e, e)); + v4->popContext(); } else if (!url.isEmpty() && !qobjectApi(e)) { + v4->pushGlobalContext(); QQmlComponent component(e, url, QQmlComponent::PreferSynchronous); QObject *o = component.create(); setQObjectApi(e, o); + v4->popContext(); } - v4->popContext(); } void QQmlType::SingletonInstanceInfo::destroy(QQmlEngine *e) -- cgit v1.2.3