Fix performance regression for bindings from QtQuick state changes
authorSimon Hausmann <simon.hausmann@digia.com>
Mon, 31 Mar 2014 13:43:33 +0000 (15:43 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 2 Apr 2014 12:04:01 +0000 (14:04 +0200)
This is a regression from the compiler change. We can and should try to
use the binding as it was compiled in the loader thread for things like

    PropertyChanges {
        target: foo
        width: someExpresion + to + calculate * width;
    }

It is already ensured that these expressions are compiled without type
optimizations.

Change-Id: Ib855d8a848fcab2524df008727eab436ac98514e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/qml/qqmlbinding.cpp
src/quick/util/qquickpropertychanges.cpp

index e9c48baa867e4216a73377cf62cac2773d87b8d8..e958b97f4630df7dcd4b329a21e7b447291e842a 100644 (file)
@@ -147,7 +147,7 @@ QQmlBinding::QQmlBinding(const QQmlScriptString &script, QObject *obj, QQmlConte
     setScopeObject(obj ? obj : scriptPrivate->scope);
 
     if (runtimeFunction) {
-        v4function = QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxtdata, scopeObject(), runtimeFunction);
+        v4function = QV4::QmlBindingWrapper::createQmlCallableForFunction(engine->v4engine(), ctxtdata, scopeObject(), runtimeFunction);
     } else {
         QString code = scriptPrivate->script;
         v4function = qmlBinding(context(), scopeObject(), code, url, scriptPrivate->lineNumber);
index ec42a714c92dec1e922193bd093673cd655b6ad0..f73210a7a81166dbfc8f226946aa8ea8ee3008b8 100644 (file)
@@ -275,7 +275,9 @@ QByteArray QQuickPropertyChangesParser::compile(const QV4::CompiledData::QmlUnit
         QQmlBinding::Identifier id = QQmlBinding::Invalid;
         switch (binding->type) {
         case QV4::CompiledData::Binding::Type_Script:
-            // ### pre-compile binding
+            id = bindingIdentifier(binding);
+            // Fall through as we also need the expression string.
+            // Signal handlers still need to be constructed by string ;(
         case QV4::CompiledData::Binding::Type_String:
             var = binding->valueAsString(&qmlUnit->header);
             break;