5#include <private/qv4mm_p.h>
8#include "PageAllocation.h"
16 WTF::PageAllocation alloc;
24static const int kEntriesPerPage = int((WTF::pageSize() -
sizeof(Header)) /
sizeof(
Value));
37 p->header.next =
reinterpret_cast<Page *
>(
storage->firstPage);
38 p->header.prev =
reinterpret_cast<Page **
>(&
storage->firstPage);
40 p->header.next->header.prev = &
p->header.next;
47 *
p->header.prev =
p->header.next;
49 p->header.next->header.prev =
p->header.prev;
54 PageAllocation
page = WTF::PageAllocation::allocate(WTF::pageSize());
60 p->header.alloc =
page;
61 p->header.refCount = 0;
62 p->header.freeList = 0;
64 for (
int i = 0;
i < kEntriesPerPage - 1; ++
i) {
67 p->values[kEntriesPerPage - 1] =
Encode(-1);
81 ++
page->header.refCount;
89 ++
page->header.refCount;
95 if (
page && !--
page->header.refCount)
101 ++
page->header.refCount;
109 if (
page && !--
page->header.refCount)
115 while (
index < kEntriesPerPage - 1) {
126 ++
next->header.refCount;
147 for (
int i = 0;
i < kEntriesPerPage; ++
i) {
148 if (!
p->values[
i].isEmpty())
152 p->header.engine =
nullptr;
153 p->header.prev =
nullptr;
154 p->header.next =
nullptr;
164 if (
p->header.freeList != -1)
169 p = allocatePage(
this);
171 Value *
v =
p->values +
p->header.freeList;
176 insertInFront(
this,
p);
179 ++
p->header.refCount;
186void PersistentValueStorage::freeUnchecked(
Value *
v)
192 p->header.freeList =
v -
p->values;
193 if (!--
p->header.refCount)
201 for (
int i = 0;
i < kEntriesPerPage; ++
i) {
212 return getPage(
v)->header.engine;
215void PersistentValueStorage::freePage(
void *
page)
219 p->header.alloc.deallocate();
227 val =
other.engine()->memoryManager->m_persistentValues->allocate();
259 val =
other.engine()->memoryManager->m_persistentValues->allocate();
275 if (!
other.valueRef())
277 val =
other.engine()->memoryManager->m_persistentValues->allocate();
279 if (!
other.valueRef()) {
297 val =
object->engine()->memoryManager->m_persistentValues->allocate();
328 allocVal(
other.engine());
344 allocVal(
other.engine());
371 val->mark(markStack);
374void WeakValue::free()
384 e->memoryManager->m_pendingFreedObjectWrapperValue.push_back(
val);
PersistentValueStorage * m_persistentValues
PersistentValueStorage * m_weakValues
constexpr PersistentValue() noexcept=default
ExecutionEngine * engine() const
PersistentValue & operator=(const PersistentValue &other)
ReturnedValue value() const
void set(ExecutionEngine *engine, const Value &value)
ExecutionEngine * engine() const
ReturnedValue value() const
WeakValue & operator=(const WeakValue &other)
void markOnce(MarkStack *markStack)
\qmltype Particle \inqmlmodule QtQuick.Particles
static QString header(const QString &name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLsizei GLsizei GLint * values
[15]
GLsizei const GLfloat * v
[13]
#define QML_NEARLY_ALWAYS_INLINE
static constexpr ReturnedValue undefined()
MemoryManager * memoryManager
Iterator & operator=(const Iterator &o)
Iterator(void *p, int idx)
static ExecutionEngine * getEngine(const Value *v)
~PersistentValueStorage()
static void free(Value *v)
void mark(MarkStack *markStack)
PersistentValueStorage(ExecutionEngine *engine)
QV4_NEARLY_ALWAYS_INLINE constexpr int int_32() const