aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/memory
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-01-08 12:00:00 +0100
committerLars Knoll <lars.knoll@qt.io>2018-04-12 13:58:58 +0000
commit30850d1ebc28bfe68b329229b537a7d6a7791b29 (patch)
tree1c94b8a81bd1755adf42c077c8912acb25f121e1 /src/qml/memory
parentb6bb3fe4238c93d865e255c4681f07b9d4175529 (diff)
Remove dependency from qv4heap_p.h onto qv4internalclass_p.h
This is required to be able to turn the internal class into something that lives on the GC heap. Change-Id: Ie4318588d420743b1e1ab1cd596a1c9d153eb793 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/memory')
-rw-r--r--src/qml/memory/qv4heap_p.h12
-rw-r--r--src/qml/memory/qv4mm.cpp10
2 files changed, 5 insertions, 17 deletions
diff --git a/src/qml/memory/qv4heap_p.h b/src/qml/memory/qv4heap_p.h
index 403f400bee..1ca37fe95f 100644
--- a/src/qml/memory/qv4heap_p.h
+++ b/src/qml/memory/qv4heap_p.h
@@ -54,7 +54,6 @@
#include <private/qv4global_p.h>
#include <private/qv4mmdefs_p.h>
#include <private/qv4writebarrier_p.h>
-#include <private/qv4internalclass_p.h>
#include <QSharedPointer>
// To check if Heap::Base::init is called (meaning, all subclasses did their init and called their
@@ -121,7 +120,6 @@ struct Q_QML_EXPORT Base {
inline ReturnedValue asReturnedValue() const;
inline void mark(QV4::MarkStack *markStack);
- inline const VTable *vtable() const;
inline bool isMarked() const {
const HeapItem *h = reinterpret_cast<const HeapItem *>(this);
Chunk *c = h->chunk();
@@ -148,10 +146,6 @@ struct Q_QML_EXPORT Base {
return Chunk::testBit(c->objectBitmap, h - c->realBase());
}
- inline void markChildren(MarkStack *markStack) {
- vtable()->markObjects(this, markStack);
- }
-
void *operator new(size_t, Managed *m) { return m; }
void *operator new(size_t, Base *m) { return m; }
void operator delete(void *, Base *) {}
@@ -218,12 +212,6 @@ void Base::mark(QV4::MarkStack *markStack)
}
}
-inline
-const VTable *Base::vtable() const
-{
- return internalClass->vtable;
-}
-
template<typename T, size_t o>
Base *Pointer<T, o>::base() {
Base *base = reinterpret_cast<Base *>(this) - (offset/sizeof(Base *));
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 4e83abebdf..6e38081c9d 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -335,7 +335,7 @@ bool Chunk::sweep(ExecutionEngine *engine)
HeapItem *itemToFree = o + index;
Heap::Base *b = *itemToFree;
- const VTable *v = b->vtable();
+ const VTable *v = b->internalClass->vtable;
// if (Q_UNLIKELY(classCountPtr))
// classCountPtr(v->className);
if (v->destroy) {
@@ -389,8 +389,8 @@ void Chunk::freeAll(ExecutionEngine *engine)
HeapItem *itemToFree = o + index;
Heap::Base *b = *itemToFree;
- if (b->vtable()->destroy) {
- b->vtable()->destroy(b);
+ if (b->internalClass->vtable->destroy) {
+ b->internalClass->vtable->destroy(b);
b->_checkIsDestroyed();
}
#ifdef V4_USE_HEAPTRACK
@@ -691,7 +691,7 @@ static void freeHugeChunk(ChunkAllocator *chunkAllocator, const HugeItemAllocato
{
HeapItem *itemToFree = c.chunk->first();
Heap::Base *b = *itemToFree;
- const VTable *v = b->vtable();
+ const VTable *v = b->internalClass->vtable;
if (Q_UNLIKELY(classCountPtr))
classCountPtr(v->className);
@@ -911,7 +911,7 @@ void MarkStack::drain()
Heap::Base *h = pop();
++markStackSize;
Q_ASSERT(h); // at this point we should only have Heap::Base objects in this area on the stack. If not, weird things might happen.
- h->markChildren(this);
+ h->internalClass->vtable->markObjects(h, this);
}
}