diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-05-25 14:55:44 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-05-26 19:57:55 +0000 |
commit | e850416fcffe48cc19cdbf6a01f759964815681c (patch) | |
tree | 87afa793953710a74c530900ab7cbf93fd6cb3cb /src/qml/compiler/qqmlirbuilder_p.h | |
parent | 6f84a09dfbd15aac023580cf06e7b8c24f3b524c (diff) |
Optimize named object handling
By storing the object indices of named objects in the CompiledData::Object of a component,
we can achieve two things:
(1) We can eliminate the hash of vectors in QQmlCompiledData for the object-to-id mapping
(2) We can store the mapping from object name to integer object id in the CompilationUnit and
share it across different QQmlContextData instances (as long as it is not modified).
Also added a new test that verifies the functionality of a .qml file starting
with Component{} itself with object names, something that was previously only
implicitly tested through some of the examples (corkboards.qml for example).
Change-Id: I28c70217222dc0e5252bf5247b7e3fc4def47446
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/qml/compiler/qqmlirbuilder_p.h')
-rw-r--r-- | src/qml/compiler/qqmlirbuilder_p.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h index 38fe23b150..16dcd70554 100644 --- a/src/qml/compiler/qqmlirbuilder_p.h +++ b/src/qml/compiler/qqmlirbuilder_p.h @@ -321,6 +321,8 @@ public: PoolList<CompiledFunctionOrExpression> *functionsAndExpressions; FixedPoolArray<int> runtimeFunctionIndices; + FixedPoolArray<quint32> namedObjectsInComponent; + private: friend struct IRLoader; @@ -474,7 +476,7 @@ struct Q_QML_PRIVATE_EXPORT QmlUnitGenerator private: typedef bool (Binding::*BindingFilter)() const; - char *writeBindings(char *bindingPtr, Object *o, BindingFilter filter) const; + char *writeBindings(char *bindingPtr, const Object *o, BindingFilter filter) const; }; #ifndef V4_BOOTSTRAP |