summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcompiler.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-12-02 05:02:05 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-12-02 05:02:05 (GMT)
commit9b31dbebb002da3eecd2d2fc2385098fb983c0c2 (patch)
tree72b4cbdc4cf4667dee9d8c6055d002e1d3d305ef /src/declarative/qml/qmlcompiler.cpp
parent17035bd496d35364ff7f49ef9cc86b0a8c48fe1e (diff)
parent14827a4ae7fd531adc802219473d9822e696b982 (diff)
downloadQt-9b31dbebb002da3eecd2d2fc2385098fb983c0c2.zip
Qt-9b31dbebb002da3eecd2d2fc2385098fb983c0c2.tar.gz
Qt-9b31dbebb002da3eecd2d2fc2385098fb983c0c2.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
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 a4e14b2..aac2e02 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)) +