diff options
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 90965e10ac..80ef6bf39f 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -364,6 +364,9 @@ void ExecutionEngine::initializeStaticMembers() #elif defined(Q_OS_ANDROID) // In experiments, it started crashing at 1059. s_maxCallDepth = 1000; +#elif defined(Q_OS_WIN) + // We've seen crashes around 750. + s_maxCallDepth = 640; #else s_maxCallDepth = 1234; #endif @@ -431,12 +434,15 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) } } + // We allocate guard pages around our stacks. + const size_t guardPages = 2 * WTF::pageSize(); + memoryManager = new QV4::MemoryManager(this); // reserve space for the JS stack // we allow it to grow to a bit more than m_maxJSStackSize, as we can overshoot due to ScopedValues // allocated outside of JIT'ed methods. *jsStack = WTF::PageAllocation::allocate( - s_maxJSStackSize + 256*1024, WTF::OSAllocator::JSVMStackPages, + s_maxJSStackSize + 256*1024 + guardPages, WTF::OSAllocator::JSVMStackPages, /* writable */ true, /* executable */ false, /* includesGuardPages */ true); jsStackBase = (Value *)jsStack->base(); #ifdef V4_USE_VALGRIND @@ -445,9 +451,9 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) jsStackTop = jsStackBase; - *gcStack = WTF::PageAllocation::allocate(s_maxGCStackSize, WTF::OSAllocator::JSVMStackPages, - /* writable */ true, /* executable */ false, - /* includesGuardPages */ true); + *gcStack = WTF::PageAllocation::allocate( + s_maxGCStackSize + guardPages, WTF::OSAllocator::JSVMStackPages, + /* writable */ true, /* executable */ false, /* includesGuardPages */ true); exceptionValue = jsAlloca(1); *exceptionValue = Encode::undefined(); @@ -2228,7 +2234,7 @@ void ExecutionEngine::setQmlEngine(QQmlEngine *engine) static void freeze_recursive(QV4::ExecutionEngine *v4, QV4::Object *object) { - if (object->as<QV4::QObjectWrapper>() || object->internalClass()->isFrozen) + if (object->as<QV4::QObjectWrapper>() || object->internalClass()->isFrozen()) return; QV4::Scope scope(v4); @@ -2337,6 +2343,8 @@ bool ExecutionEngine::metaTypeFromJS(const Value &value, QMetaType metaType, voi case QMetaType::QByteArray: if (const ArrayBuffer *ab = value.as<ArrayBuffer>()) *reinterpret_cast<QByteArray*>(data) = ab->asByteArray(); + else if (const String *string = value.as<String>()) + *reinterpret_cast<QByteArray*>(data) = string->toQString().toUtf8(); else *reinterpret_cast<QByteArray*>(data) = QByteArray(); return true; |