diff options
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 679cd41ce0..2735883603 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -136,6 +136,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) , currentContext(0) , bumperPointerAllocator(new WTF::BumpPointerAllocator) , jsStack(new WTF::PageAllocation) + , gcStack(new WTF::PageAllocation) , globalCode(0) , v8Engine(0) , argumentsAccessors(0) @@ -148,8 +149,6 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) , m_profiler(0) #endif { - writeBarrierActive = true; - memoryManager = new QV4::MemoryManager(this); if (maxCallDepth == -1) { @@ -184,24 +183,28 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) "solutions for your platform."); } #else - factory = new JIT::ISelFactory; + factory = new JIT::ISelFactory<>; #endif } iselFactory.reset(factory); // reserve space for the JS stack - // we allow it to grow to 2 times JSStackLimit, as we can overshoot due to garbage collection - // and ScopedValues allocated outside of JIT'ed methods. - *jsStack = WTF::PageAllocation::allocate(2 * JSStackLimit, WTF::OSAllocator::JSVMStackPages, + // we allow it to grow to a bit more than JSStackLimit, as we can overshoot due to ScopedValues + // allocated outside of JIT'ed methods. + *jsStack = WTF::PageAllocation::allocate(JSStackLimit + 256*1024, WTF::OSAllocator::JSVMStackPages, /* writable */ true, /* executable */ false, /* includesGuardPages */ true); jsStackBase = (Value *)jsStack->base(); #ifdef V4_USE_VALGRIND - VALGRIND_MAKE_MEM_UNDEFINED(jsStackBase, 2*JSStackLimit); + VALGRIND_MAKE_MEM_UNDEFINED(jsStackBase, JSStackLimit + 256*1024); #endif jsStackTop = jsStackBase; + *gcStack = WTF::PageAllocation::allocate(GCStackLimit, WTF::OSAllocator::JSVMStackPages, + /* writable */ true, /* executable */ false, + /* includesGuardPages */ true); + exceptionValue = jsAlloca(1); globalObject = static_cast<Object *>(jsAlloca(1)); jsObjects = jsAlloca(NJSObjects); @@ -495,6 +498,8 @@ ExecutionEngine::~ExecutionEngine() delete executableAllocator; jsStack->deallocate(); delete jsStack; + gcStack->deallocate(); + delete gcStack; delete [] argumentsAccessors; } @@ -519,7 +524,7 @@ void ExecutionEngine::initRootContext() sizeof(GlobalContext::Data) + sizeof(CallData))); r->d_unchecked()->init(this); r->d()->callData = reinterpret_cast<CallData *>(r->d() + 1); - r->d()->callData->tag = QV4::Value::Integer_Type_Internal; + r->d()->callData->tag = quint32(Value::ValueTypeInternal::Integer); r->d()->callData->argc = 0; r->d()->callData->thisObject = globalObject; r->d()->callData->args[0] = Encode::undefined(); @@ -932,25 +937,23 @@ void ExecutionEngine::requireArgumentsAccessors(int n) } } -void ExecutionEngine::markObjects(bool incremental) +void ExecutionEngine::markObjects(MarkStack *markStack) { - if (!incremental) { - identifierTable->mark(this); + identifierTable->mark(markStack); - for (int i = 0; i < nArgumentsAccessors; ++i) { - const Property &pd = argumentsAccessors[i]; - if (Heap::FunctionObject *getter = pd.getter()) - getter->mark(this); - if (Heap::FunctionObject *setter = pd.setter()) - setter->mark(this); - } + for (int i = 0; i < nArgumentsAccessors; ++i) { + const Property &pd = argumentsAccessors[i]; + if (Heap::FunctionObject *getter = pd.getter()) + getter->mark(markStack); + if (Heap::FunctionObject *setter = pd.setter()) + setter->mark(markStack); + } - classPool->markObjects(this); + classPool->markObjects(markStack); - for (QSet<CompiledData::CompilationUnit*>::ConstIterator it = compilationUnits.constBegin(), end = compilationUnits.constEnd(); - it != end; ++it) - (*it)->markObjects(this); - } + for (QSet<CompiledData::CompilationUnit*>::ConstIterator it = compilationUnits.constBegin(), end = compilationUnits.constEnd(); + it != end; ++it) + (*it)->markObjects(markStack); } ReturnedValue ExecutionEngine::throwError(const Value &value) @@ -1568,12 +1571,6 @@ QV4::ReturnedValue ExecutionEngine::metaTypeToJS(int type, const void *data) return 0; } -void ExecutionEngine::assertObjectBelongsToEngine(const Heap::Base &baseObject) -{ - Q_ASSERT(!baseObject.vtable()->isObject || static_cast<const Heap::Object&>(baseObject).internalClass->engine == this); - Q_UNUSED(baseObject); -} - void ExecutionEngine::failStackLimitCheck(Scope &scope) { scope.result = throwRangeError(QStringLiteral("Maximum call stack size exceeded.")); |