diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-12-02 05:47:29 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-12-02 05:47:29 (GMT) |
commit | d9735849834a5efc638dd026d6fe51d15dc528ee (patch) | |
tree | 3313bf43000feffb4cffe4e1f119fda45c60877f /src/declarative/qml/qmlcompiler.cpp | |
parent | 289645d2bf46c1d6eace7a0d60389a9c10dd0c34 (diff) | |
parent | dd0959ed872bf0cda7ad88382abce0c4b20bbdea (diff) | |
download | Qt-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.cpp | 18 |
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)) + |