summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-12-02 02:49:24 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-12-02 02:49:24 (GMT)
commitf25f00210cf528f017c64d2fe6505ef15f9447f7 (patch)
tree9e7c35d2d4d8bd17fcc22a2a7d99c4988e743e23 /src/declarative/qml
parentcb70f2096cbc66e6e8b5324e0e9508c788144e7e (diff)
downloadQt-f25f00210cf528f017c64d2fe6505ef15f9447f7.zip
Qt-f25f00210cf528f017c64d2fe6505ef15f9447f7.tar.gz
Qt-f25f00210cf528f017c64d2fe6505ef15f9447f7.tar.bz2
Cleanup cached binding closures
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qmlcompileddata.cpp4
-rw-r--r--src/declarative/qml/qmlcompiler.cpp13
-rw-r--r--src/declarative/qml/qmlcompiler_p.h4
-rw-r--r--src/declarative/qml/qmlexpression.cpp12
4 files changed, 19 insertions, 14 deletions
diff --git a/src/declarative/qml/qmlcompileddata.cpp b/src/declarative/qml/qmlcompileddata.cpp
index 3428574..9b931c5 100644
--- a/src/declarative/qml/qmlcompileddata.cpp
+++ b/src/declarative/qml/qmlcompileddata.cpp
@@ -167,8 +167,8 @@ QmlCompiledData::~QmlCompiledData()
if (importCache)
importCache->release();
- qDeleteAll(programs);
- qDeleteAll(cachedValues);
+ qDeleteAll(cachedPrograms);
+ qDeleteAll(cachedClosures);
}
QObject *QmlCompiledData::TypeReference::createInstance(QmlContext *ctxt, const QBitField &bindings) const
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index a0e9418..aac2e02 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -2538,12 +2538,17 @@ bool QmlCompiler::completeComponentBuild()
expression = rewriteBinding(expression);
quint32 length = expression.length();
- quint32 pc = output->programs.length();
- if (isSharable)
+ quint32 pc;
+
+ if (isSharable) {
+ pc = output->cachedClosures.count();
pc |= 0x80000000;
+ output->cachedClosures.append(0);
+ } else {
+ pc = output->cachedPrograms.length();
+ output->cachedPrograms.append(0);
+ }
- output->programs.append(0);
- output->cachedValues.append(0);
binding.compiledData =
QByteArray((const char *)&pc, sizeof(quint32)) +
QByteArray((const char *)&length, sizeof(quint32)) +
diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h
index ca26062..542fb48 100644
--- a/src/declarative/qml/qmlcompiler_p.h
+++ b/src/declarative/qml/qmlcompiler_p.h
@@ -113,8 +113,8 @@ public:
QList<QByteArray> datas;
QList<QmlParser::Location> locations;
QList<QmlInstruction> bytecode;
- QList<QScriptProgram *> programs;
- QList<QScriptValue *> cachedValues;
+ QList<QScriptProgram *> cachedPrograms;
+ QList<QScriptValue *> cachedClosures;
QList<QmlPropertyCache *> propertyCaches;
QList<QmlIntegerCache *> contextCaches;
QList<QmlParser::Object::ScriptBlock> scripts;
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index 703fcf5..2239d77 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -117,22 +117,22 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc,
if (isShared) {
- if (!dd->cachedValues.at(progIdx)) {
+ if (!dd->cachedClosures.at(progIdx)) {
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
scriptContext->pushScope(ep->contextClass->newSharedContext());
- dd->cachedValues[progIdx] = new QScriptValue(scriptEngine->evaluate(data->expression, data->url.toString(), data->line));
+ dd->cachedClosures[progIdx] = new QScriptValue(scriptEngine->evaluate(data->expression, data->url.toString(), data->line));
scriptEngine->popContext();
}
- data->expressionFunction = *dd->cachedValues.at(progIdx);
+ data->expressionFunction = *dd->cachedClosures.at(progIdx);
data->isShared = true;
data->expressionFunctionValid = true;
} else {
#if !defined(Q_OS_SYMBIAN) //XXX Why doesn't this work?
- if (!dd->programs.at(progIdx)) {
- dd->programs[progIdx] =
+ if (!dd->cachedPrograms.at(progIdx)) {
+ dd->cachedPrograms[progIdx] =
new QScriptProgram(data->expression, data->url.toString(), data->line);
}
#endif
@@ -141,7 +141,7 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc,
scriptContext->pushScope(ep->contextClass->newContext(ctxt, me));
#if !defined(Q_OS_SYMBIAN)
- data->expressionFunction = scriptEngine->evaluate(*dd->programs[progIdx]);
+ data->expressionFunction = scriptEngine->evaluate(*dd->cachedPrograms.at(progIdx));
#else
data->expressionFunction = scriptEngine->evaluate(data->expression);
#endif