summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcompiler.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-12-02 02:35:38 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-12-02 02:35:38 (GMT)
commitcb70f2096cbc66e6e8b5324e0e9508c788144e7e (patch)
treedd4f6f98e2b27d09f2b7c275e705b5a28e89d541 /src/declarative/qml/qmlcompiler.cpp
parentec42d6843ca0937f338e5e2d7d3353134d143eb6 (diff)
downloadQt-cb70f2096cbc66e6e8b5324e0e9508c788144e7e.zip
Qt-cb70f2096cbc66e6e8b5324e0e9508c788144e7e.tar.gz
Qt-cb70f2096cbc66e6e8b5324e0e9508c788144e7e.tar.bz2
Cache binding closures
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index a4e14b2..a0e9418 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -2529,12 +2529,21 @@ bool QmlCompiler::completeComponentBuild()
// Pre-rewrite the expression
QString expression = binding.expression.asScript();
+
+ // ### Optimize
+ QmlRewrite::SharedBindingTester sharableTest;
+ bool isSharable = sharableTest.isSharable(expression);
+
QmlRewrite::RewriteBinding rewriteBinding;
expression = rewriteBinding(expression);
quint32 length = expression.length();
quint32 pc = output->programs.length();
+ if (isSharable)
+ pc |= 0x80000000;
+
output->programs.append(0);
+ output->cachedValues.append(0);
binding.compiledData =
QByteArray((const char *)&pc, sizeof(quint32)) +
QByteArray((const char *)&length, sizeof(quint32)) +