aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlproperty.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-10 14:22:58 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-16 13:40:22 +0000
commit379342c64db71745edb2bf9a9a100fd1798dbf69 (patch)
tree70e319f5d341be5cb3e21c0b5f32cf339b5af858 /src/qml/qml/qqmlproperty.cpp
parentb220a20552838fbafbbf126b9e50d148ae76518d (diff)
Speed up copying of value types in bindings
When a binding results in a value type reference and the destination property is of the same time, then we can avoid a heap allocation and just allocate the value type memory on the stack, construct, copy and destruct. Change-Id: If71ef82b0ced85c1b962c5e44147d6c07edd1440 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r--src/qml/qml/qqmlproperty.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 931adb9a13..ae452b727e 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -53,6 +53,7 @@
#include <QStringList>
#include <private/qmetaobject_p.h>
+#include <private/qqmlvaluetypewrapper_p.h>
#include <QtCore/qdebug.h>
Q_DECLARE_METATYPE(QList<int>)
@@ -1519,6 +1520,11 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
QUICK_STORE(QString, result.toQStringNoThrow())
break;
default:
+ if (const QV4::QQmlValueTypeWrapper *vtw = result.as<const QV4::QQmlValueTypeWrapper>()) {
+ if (vtw->d()->valueType->typeId == core.propType) {
+ return vtw->write(object, core.coreIndex);
+ }
+ }
break;
}
}