diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-01-09 09:09:15 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-01-09 09:09:15 (GMT) |
commit | 41f7ccb2dd21dcd4b0f2aa172bb813095cb2ade3 (patch) | |
tree | 60746e15deeb1ca5c2ff6f0f096bc96c6aeef6aa /src/declarative/qml/qmlcompiler.cpp | |
parent | 3ade772efd07fe342c10274b5fc6387965ac0c9d (diff) | |
download | Qt-41f7ccb2dd21dcd4b0f2aa172bb813095cb2ade3.zip Qt-41f7ccb2dd21dcd4b0f2aa172bb813095cb2ade3.tar.gz Qt-41f7ccb2dd21dcd4b0f2aa172bb813095cb2ade3.tar.bz2 |
Optimization: Bypass qt_metacall for synthesized methods
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 7c43305..7f8bc7a 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -90,7 +90,7 @@ using namespace QmlParser; Instantiate a new QmlCompiler. */ QmlCompiler::QmlCompiler() -: output(0), engine(0) +: output(0), engine(0), unitRoot(0), unit(0) { } @@ -611,6 +611,7 @@ bool QmlCompiler::compile(QmlEngine *engine, this->engine = engine; this->unit = unit; + this->unitRoot = root; compileTree(root); if (!isError()) { @@ -626,6 +627,8 @@ bool QmlCompiler::compile(QmlEngine *engine, savedCompileStates.clear(); output = 0; this->engine = 0; + this->unit = 0; + this->unitRoot = 0; return !isError(); } @@ -836,7 +839,19 @@ void QmlCompiler::genObject(QmlParser::Object *obj) meta.storeMeta.aliasData = output->indexForByteArray(obj->synthdata); meta.storeMeta.propertyCache = output->propertyCaches.count(); // ### Surely the creation of this property cache could be more efficient - output->propertyCaches << QmlPropertyCache::create(engine, obj->metaObject()); + QmlPropertyCache *propertyCache = 0; + if (tr.component && QmlComponentPrivate::get(tr.component)->cc->rootPropertyCache) { + propertyCache = QmlComponentPrivate::get(tr.component)->cc->rootPropertyCache->copy(); + } else { + propertyCache = QmlPropertyCache::create(engine, obj->metaObject()->superClass()); + } + propertyCache->append(engine, obj->metaObject(), QmlPropertyCache::Data::NoFlags, + QmlPropertyCache::Data::IsVMEFunction); + if (obj == unitRoot) { + propertyCache->addref(); + output->rootPropertyCache = propertyCache; + } + output->propertyCaches << propertyCache; output->bytecode << meta; } |