diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-11-02 16:02:10 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-11-14 21:45:42 +0000 |
commit | 002fdc48d43e4fd67921e0cd46c28d28aee06848 (patch) | |
tree | 08fdc81dc91153649d8b6c6514ed3b49ad970064 /src/qml/memory/qv4heap_p.h | |
parent | 010197a42150ee73a17cb53fbe397a6c55b2d342 (diff) |
Bring back markObjects(), this time generated
Doing the marking of objects in a function instead of
using the table seems to be somewhat faster.
Change-Id: I9ec00cc0264f9a15c69b285db493bee31d99bf96
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/memory/qv4heap_p.h')
-rw-r--r-- | src/qml/memory/qv4heap_p.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/qml/memory/qv4heap_p.h b/src/qml/memory/qv4heap_p.h index f00ce4283c..363e891d5c 100644 --- a/src/qml/memory/qv4heap_p.h +++ b/src/qml/memory/qv4heap_p.h @@ -75,7 +75,6 @@ struct InternalClass; struct VTable { const VTable * const parent; - const quint64 markTable; uint inlinePropertyOffset : 16; uint nInlineProperties : 16; uint isExecutionContext : 1; @@ -97,7 +96,7 @@ namespace Heap { struct Q_QML_EXPORT Base { void *operator new(size_t) = delete; - static Q_CONSTEXPR quint64 markTable = 0; + static void markObjects(Heap::Base *, MarkStack *) {} InternalClass *internalClass; @@ -131,7 +130,9 @@ struct Q_QML_EXPORT Base { return Chunk::testBit(c->objectBitmap, h - c->realBase()); } - inline void markChildren(MarkStack *markStack); + inline void markChildren(MarkStack *markStack) { + vtable()->markObjects(this, markStack); + } void *operator new(size_t, Managed *m) { return m; } void *operator new(size_t, Heap::Base *m) { return m; } @@ -184,6 +185,22 @@ Q_STATIC_ASSERT(sizeof(Base) == QT_POINTER_SIZE); } +inline +void Heap::Base::mark(QV4::MarkStack *markStack) +{ + Q_ASSERT(inUse()); + const HeapItem *h = reinterpret_cast<const HeapItem *>(this); + Chunk *c = h->chunk(); + size_t index = h - c->realBase(); + Q_ASSERT(!Chunk::testBit(c->extendsBitmap, index)); + quintptr *bitmap = c->blackBitmap + Chunk::bitmapIndex(index); + quintptr bit = Chunk::bitForIndex(index); + if (!(*bitmap & bit)) { + *bitmap |= bit; + markStack->push(this); + } +} + #ifdef QT_NO_QOBJECT template <class T> struct QQmlQPointer { |