summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcompiler.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-12-02 05:47:29 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-12-02 05:47:29 (GMT)
commitd9735849834a5efc638dd026d6fe51d15dc528ee (patch)
tree3313bf43000feffb4cffe4e1f119fda45c60877f /src/declarative/qml/qmlcompiler.cpp
parent289645d2bf46c1d6eace7a0d60389a9c10dd0c34 (diff)
parentdd0959ed872bf0cda7ad88382abce0c4b20bbdea (diff)
downloadQt-d9735849834a5efc638dd026d6fe51d15dc528ee.zip
Qt-d9735849834a5efc638dd026d6fe51d15dc528ee.tar.gz
Qt-d9735849834a5efc638dd026d6fe51d15dc528ee.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts: src/declarative/qml/qmlmetatype.cpp
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index ee0c484..8edf023 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -2529,12 +2529,26 @@ 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();
- output->programs.append(0);
+ quint32 pc;
+
+ if (isSharable) {
+ pc = output->cachedClosures.count();
+ pc |= 0x80000000;
+ output->cachedClosures.append(0);
+ } else {
+ pc = output->cachedPrograms.length();
+ output->cachedPrograms.append(0);
+ }
+
binding.compiledData =
QByteArray((const char *)&pc, sizeof(quint32)) +
QByteArray((const char *)&length, sizeof(quint32)) +