diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-05-26 11:17:31 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-05-26 19:58:11 +0000 |
commit | 777aac3005feb01aed21df9e135d5470182bc6ce (patch) | |
tree | ec4b36e1fca9ffda5b28292ac3f562729791ef3e /src/qml/compiler/qqmlirbuilder_p.h | |
parent | 18f96551629346599e0b74c3d093697ef494819a (diff) |
Small type compilation data structure cleanup
After the removal of the named object hash tables in the persistent compilation
unit data, we can also eliminate them from the temporary internal type
compilation structures. We have everything we need in the object naming table
in the CompiledData::Object - the only thing missing are the component roots.
Change-Id: Ia2a7b3894310cfdb5cfecf1c2a921fb51e2a883b
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 | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h index 16dcd70554..db17c93222 100644 --- a/src/qml/compiler/qqmlirbuilder_p.h +++ b/src/qml/compiler/qqmlirbuilder_p.h @@ -188,6 +188,16 @@ public: } } + template <typename Container> + void allocate(QQmlJS::MemoryPool *pool, const Container &container) + { + count = container.count(); + data = reinterpret_cast<T*>(pool->allocate(count * sizeof(T))); + typename Container::ConstIterator it = container.constBegin(); + for (int i = 0; i < count; ++i) + new (data + i) T(*it++); + } + const T &at(int index) const { Q_ASSERT(index >= 0 && index < count); return data[index]; |