diff options
| author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2025-12-15 16:14:22 +0200 |
|---|---|---|
| committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2025-12-15 16:14:22 +0200 |
| commit | b58ec3b086518da5aa573f99426235854c23e35f (patch) | |
| tree | 861a9935d8f1cdba2fdca546836a351736dbddbf /src/qml/jsruntime | |
| parent | 4826f86e274f1b29bd769e6790824f9e62a40f62 (diff) | |
| parent | 22032227d16c39211e2ebceef97d21f4d89c7c87 (diff) | |
Merge tag 'v6.5.8-lts-lgpl' into 6.56.5
Qt 6.5.8-lts-lgpl release
Diffstat (limited to 'src/qml/jsruntime')
| -rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 11 | ||||
| -rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 2 | ||||
| -rw-r--r-- | src/qml/jsruntime/qv4objectiterator.cpp | 2 | ||||
| -rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 10 | ||||
| -rw-r--r-- | src/qml/jsruntime/qv4stringobject.cpp | 2 |
5 files changed, 24 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 99fad7e3c3..a807cc42df 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -105,7 +105,8 @@ using namespace QV4; // odd while the statics are being initialized, and stays even afterwards. // Any further engines created while the statics are being initialized busy-wait until engineSerial // is even. -static QBasicAtomicInt engineSerial = Q_BASIC_ATOMIC_INITIALIZER(1); +Q_CONSTINIT static QBasicAtomicInt engineSerial = Q_BASIC_ATOMIC_INITIALIZER(1); +Q_CONSTINIT static QBasicAtomicInt hasPreview = Q_BASIC_ATOMIC_INITIALIZER(0); int ExecutionEngine::s_maxCallDepth = -1; int ExecutionEngine::s_jitCallCountThreshold = 3; int ExecutionEngine::s_maxJSStackSize = 4 * 1024 * 1024; @@ -889,6 +890,12 @@ void ExecutionEngine::setProfiler(Profiling::Profiler *profiler) Q_ASSERT(!m_profiler); m_profiler.reset(profiler); } + +void ExecutionEngine::setPreviewing(bool enabled) +{ + hasPreview.storeRelease(enabled); +} + #endif // QT_CONFIG(qml_debug) void ExecutionEngine::initRootContext() @@ -2212,7 +2219,7 @@ QV4::Value *ExecutionEngine::registerNativeModule(const QUrl &url, const QV4::Va bool ExecutionEngine::diskCacheEnabled() const { - return (!disableDiskCache() && !debugger()) || forceDiskCache(); + return (!disableDiskCache() && !debugger() && !hasPreview.loadAcquire()) || forceDiskCache(); } void ExecutionEngine::callInContext(QV4::Function *function, QObject *self, diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 75c8efd67e..99b9e526f6 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -514,12 +514,14 @@ public: void setDebugger(Debugging::Debugger *) {} void setProfiler(Profiling::Profiler *) {} + static void setPreviewing(bool) {} #else QV4::Debugging::Debugger *debugger() const { return m_debugger.data(); } QV4::Profiling::Profiler *profiler() const { return m_profiler.data(); } void setDebugger(Debugging::Debugger *debugger); void setProfiler(Profiling::Profiler *profiler); + static void setPreviewing(bool enabled); #endif // QT_CONFIG(qml_debug) ExecutionContext *currentContext() const { return currentStackFrame->context(); } diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp index 90eb326d65..eac2aca059 100644 --- a/src/qml/jsruntime/qv4objectiterator.cpp +++ b/src/qml/jsruntime/qv4objectiterator.cpp @@ -94,6 +94,8 @@ void Heap::ForInIteratorObject::markObjects(Heap::Base *that, MarkStack *markSta o->object->mark(markStack); if (o->current) o->current->mark(markStack); + if (o->target) + o->target->mark(markStack); o->workArea[0].mark(markStack); o->workArea[1].mark(markStack); Object::markObjects(that, markStack); diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 50389e06ec..ecd947ccc3 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1021,6 +1021,16 @@ ReturnedValue QObjectWrapper::virtualResolveLookupGetter(const Object *object, E ReturnedValue QObjectWrapper::lookupAttached( Lookup *l, ExecutionEngine *engine, const Value &object) { + if (&QObjectWrapper::lookupAttached == &Lookup::getterGeneric) { + // Certain compilers, e.g. MSVC, will "helpfully" deduplicate methods that are completely + // equal. As a result, the pointers are the same, which wreaks havoc on the logic that + // decides how to retrieve the property. + qFatal("Your C++ compiler is broken."); + } + + // This getter marks the presence of a lookup for an attached object. + // It falls back to the generic lookup when run through the interpreter, but AOT-compiled + // code can get clever with it. return Lookup::getterGeneric(l, engine, object); } diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 98bb6347d3..2613cff99a 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -777,7 +777,7 @@ ReturnedValue StringPrototype::method_replace(const FunctionObject *b, const Val nMatchOffsets += re->captureCount() * 2; if (!regExp->global()) break; - offset = qMax(offset + 1, matchOffsets[oldSize + 1]); + offset = qMax(offset, matchOffsets[oldSize + 1]) + 1; } if (regExp->global()) { regExp->setLastIndex(0); |
