From d72adccd2727d55a8f0adb87cfa9ef22db27ff9e Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 17 Nov 2013 05:10:23 +0100 Subject: [PATCH] Add a QML debug config option QML_LOOKUP_HINTS to find non-final properties This helps to optimize property access, especially for attached properties. Change-Id: Id47a9c5f184f84ce5ab813d3b01d1a6c6031233e Reviewed-by: Lars Knoll --- src/qml/compiler/qqmlcodegenerator.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp index d80c4d1..24755ee 100644 --- a/src/qml/compiler/qqmlcodegenerator.cpp +++ b/src/qml/compiler/qqmlcodegenerator.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #ifdef CONST @@ -53,6 +54,8 @@ QT_USE_NAMESPACE +DEFINE_BOOL_CONFIG_OPTION(lookupHints, QML_LOOKUP_HINTS); + using namespace QtQml; #define COMPILE_EXCEPTION(location, desc) \ @@ -1450,6 +1453,15 @@ static V4IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, V4IR:: if (QQmlPropertyData *candidate = metaObject->property(*member->name, /*object*/0, /*context*/0)) { const bool isFinalProperty = (candidate->isFinal() || (resolver->flags & AllPropertiesAreFinal)) && !candidate->isFunction(); + + if (lookupHints() + && !(resolver->flags & AllPropertiesAreFinal) + && !candidate->isFinal() + && !candidate->isFunction() + && candidate->isDirect()) { + qWarning() << "Hint: Access to property" << *member->name << "of" << metaObject->className() << "could be accelerated if it was marked as FINAL"; + } + if (isFinalProperty && metaObject->isAllowedInRevision(candidate)) { property = candidate; member->property = candidate; // Cache for next iteration and isel needs it. -- 2.7.4