diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-12-02 05:07:54 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-12-02 05:07:54 (GMT) |
commit | dd0959ed872bf0cda7ad88382abce0c4b20bbdea (patch) | |
tree | cd49820f7f1a796818fb03bd66fc08da6193f3ab /src/declarative/qml/qmlcompiler.cpp | |
parent | f3076897a43c1093ec19d4ea71cf4c923eb7a084 (diff) | |
parent | 14827a4ae7fd531adc802219473d9822e696b982 (diff) | |
download | Qt-dd0959ed872bf0cda7ad88382abce0c4b20bbdea.zip Qt-dd0959ed872bf0cda7ad88382abce0c4b20bbdea.tar.gz Qt-dd0959ed872bf0cda7ad88382abce0c4b20bbdea.tar.bz2 |
Merge branch 'kinetic-declarativeui' of 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.cpp | 18 |
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)) + |