aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlproperty.cpp
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-06-04 14:43:38 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-09 01:36:23 +0200
commit49a3883e86b61d8facfeea9c43037d484cb50b92 (patch)
treeba1afdf6ddc3740f26c5e3c95cb2fffeb953abb4 /src/qml/qml/qqmlproperty.cpp
parent3095493a4ce4bec11b9381a3d1d23f17b313332c (diff)
Use V4 binding for non-final properties where possible
When a property referenced in a binding is not marked as final, do not automatically abort optimization. Instead generate both V4 and V8 binidngs, and only fall back to the V8 binding if necessary at run time. Change-Id: I1bcc7e2b495935c5d519a9a223f640c1972cdb4e Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r--src/qml/qml/qqmlproperty.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index d0c2761373..132664ddb5 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -56,6 +56,7 @@
#include "qqmlvmemetaobject_p.h"
#include "qqmlexpression_p.h"
#include "qqmlvaluetypeproxybinding_p.h"
+#include <private/qv8bindings_p.h>
#include <QStringList>
#include <private/qmetaobject_p.h>
@@ -961,6 +962,31 @@ QQmlPropertyPrivate::setBindingNoEnable(QObject *object, int coreIndex, int valu
}
/*!
+ Activates a shared binding which was previously created but not added to the
+ object. This is needed when an optimized binding is invalidated.
+*/
+QQmlAbstractBinding *QQmlPropertyPrivate::activateSharedBinding(QQmlContextData *context,
+ int sharedIdx, WriteFlags flags)
+{
+ QQmlAbstractBinding *newBinding = 0;
+ newBinding = context->v8bindings->binding(sharedIdx);
+
+ if (!newBinding)
+ return newBinding;
+
+ // This binding now references the bindings object
+ context->v8bindings->addref();
+
+ QObject *object = newBinding->object();
+ int pi = newBinding->propertyIndex();
+
+ int core = pi & 0xFFFFFF;
+ int vt = (pi & 0xFF000000)?(pi >> 24):-1;
+
+ return setBinding(object, core, vt, newBinding, flags);
+}
+
+/*!
Returns the expression associated with this signal property, or 0 if no
signal expression exists.
*/