diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-03-09 10:36:16 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-04-07 06:06:17 +0000 |
commit | 589f8a90fa8c158ec97f32d4a9539b47ba8486a2 (patch) | |
tree | a379d6cc9d85b6565d712943d0fcf763466403e0 /src/qml/jsruntime/qv4engine_p.h | |
parent | 1e63f7c4833c19f760f4af0b7650311819d0f2b2 (diff) |
Separate the stack used for GC from the regular JS stack
This is required to be able to implement concurrent or
incremental garbage collection.
Change-Id: Ib3c5eee3779ca2ee08a57cd3961dbcb0537bbb54
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index fdfdeada9a..bace8b700b 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -108,18 +108,14 @@ 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; Value *jsStackBase; - void pushForGC(Heap::Base *m) { - *jsStackTop = m; - ++jsStackTop; - } - Heap::Base *popForGC() { - --jsStackTop; - return jsStackTop->m(); - } + WTF::PageAllocation *gcStack; QML_NEARLY_ALWAYS_INLINE Value *jsAlloca(int nValues) { Value *ptr = jsStackTop; @@ -446,7 +442,7 @@ public: void requireArgumentsAccessors(int n); - void markObjects(); + void markObjects(MarkStack *markStack); void initRootContext(); @@ -541,7 +537,7 @@ inline ExecutionContext *ExecutionEngine::parentContext(ExecutionContext *contex } inline -void Heap::Base::mark(QV4::ExecutionEngine *engine) +void Heap::Base::mark(QV4::MarkStack *markStack) { Q_ASSERT(inUse()); const HeapItem *h = reinterpret_cast<const HeapItem *>(this); @@ -552,15 +548,15 @@ void Heap::Base::mark(QV4::ExecutionEngine *engine) quintptr bit = Chunk::bitForIndex(index); if (!(*bitmap & bit)) { *bitmap |= bit; - engine->pushForGC(this); + 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); } #define CHECK_STACK_LIMITS(v4, scope) if ((v4)->checkStackLimits(scope)) return; \ |