diff options
Diffstat (limited to 'src/qml/jsruntime/qv4engine_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index fee06ebc58..4549cda5b9 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -104,17 +104,13 @@ public: WTF::BumpPointerAllocator *bumperPointerAllocator; // Used by Yarr Regex engine. - enum { JSStackLimit = 4*1024*1024 }; + enum { + JSStackLimit = 4*1024*1024, + GCStackLimit = 2*1024*1024 + }; WTF::PageAllocation *jsStack; - void pushForGC(Heap::Base *m) { - *jsStackTop = m; - ++jsStackTop; - } - Heap::Base *popForGC() { - --jsStackTop; - return jsStackTop->heapObject(); - } + WTF::PageAllocation *gcStack; QML_NEARLY_ALWAYS_INLINE Value *jsAlloca(int nValues) { Value *ptr = jsStackTop; @@ -422,7 +418,7 @@ public: void requireArgumentsAccessors(int n); - void markObjects(); + void markObjects(MarkStack *markStack); void initRootContext(); @@ -459,8 +455,6 @@ public: bool metaTypeFromJS(const Value *value, int type, void *data); QV4::ReturnedValue metaTypeToJS(int type, const void *data); - void assertObjectBelongsToEngine(const Heap::Base &baseObject); - bool checkStackLimits(Scope &scope); private: @@ -519,23 +513,32 @@ inline ExecutionContext *ExecutionEngine::parentContext(ExecutionContext *contex } inline -void Heap::Base::mark(QV4::ExecutionEngine *engine) +void Heap::Base::mark(QV4::MarkStack *markStack) { Q_ASSERT(inUse()); - if (isMarked()) - return; -#ifndef QT_NO_DEBUG - engine->assertObjectBelongsToEngine(*this); -#endif - setMarkBit(); - engine->pushForGC(this); + 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); + } } -inline void Value::mark(ExecutionEngine *e) +inline void Value::mark(MarkStack *markStack) { Heap::Base *o = heapObject(); if (o) - o->mark(e); + o->mark(markStack); +} + +inline void Managed::mark(MarkStack *markStack) +{ + Q_ASSERT(m()); + m()->mark(markStack); } #define CHECK_STACK_LIMITS(v4, scope) if ((v4)->checkStackLimits(scope)) return; \ |