diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-11-17 05:10:23 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-28 15:12:01 +0100 |
commit | d72adccd2727d55a8f0adb87cfa9ef22db27ff9e (patch) | |
tree | 3c1d5a94de31b5fc913264b74aa51ce888a39391 /src/qml/compiler | |
parent | f474eede801ed7bec712069e95bbe2f4ab5558ae (diff) |
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 <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qqmlcodegenerator.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp index d80c4d120d..24755ee672 100644 --- a/src/qml/compiler/qqmlcodegenerator.cpp +++ b/src/qml/compiler/qqmlcodegenerator.cpp @@ -45,6 +45,7 @@ #include <private/qqmljsparser_p.h> #include <private/qqmljslexer_p.h> #include <private/qqmlcompiler_p.h> +#include <private/qqmlglobal_p.h> #include <QCoreApplication> #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. |