diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-03-04 11:46:58 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-03-05 07:19:33 +0100 |
commit | 6fb63032966cc27cc11ce3686e97b185fdb3cb6b (patch) | |
tree | 3c5c292e336f87c407fddeaeabd6cf6e858bcdea /src/qml/jsruntime/qv4engine_p.h | |
parent | a90d624f0eb96921141f421555b4f7dde4026afd (diff) |
ExecutionEngine: Move initialization of statics into separate method
... and do it only for the first engine (ie engineId == 1). The engineId
is determined using atomic operations, so this is safe now.
Pick-to: 6.3
Task-number: QTBUG-73271
Change-Id: Ife38213fe04e26f35425a29230a2e3b586572dd2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 7f376d2dad..b9f2633d91 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -170,8 +170,6 @@ class ReactionHandler; struct Q_QML_EXPORT ExecutionEngine : public EngineBase { private: - static qint32 maxCallDepth; - friend struct ExecutionContextSaver; friend struct ExecutionContext; friend struct Heap::ExecutionContext; @@ -696,7 +694,7 @@ public: return false; if (f) { return !f->aotFunction && !f->isGenerator() - && f->interpreterCallCount >= jitCallCountThreshold; + && f->interpreterCallCount >= s_jitCallCountThreshold; } return true; #else @@ -773,13 +771,18 @@ public: private: QV4::ReturnedValue fromData(QMetaType type, const void *ptr, const QVariant *variant = nullptr); + static void initializeStaticMembers(); + + static int s_maxCallDepth; + static int s_jitCallCountThreshold; + static int s_maxJSStackSize; + static int s_maxGCStackSize; #if QT_CONFIG(qml_debug) QScopedPointer<QV4::Debugging::Debugger> m_debugger; QScopedPointer<QV4::Profiling::Profiler> m_profiler; #endif QSet<QString> m_illegalNames; - int jitCallCountThreshold; // used by generated Promise objects to handle 'then' events QScopedPointer<QV4::Promise::ReactionHandler> m_reactionHandler; @@ -798,9 +801,6 @@ private: QHash<QString, quint32> m_consoleCount; QVector<Deletable *> m_extensionData; - - int m_maxJSStackSize = 4 * 1024 * 1024; - int m_maxGCStackSize = 2 * 1024 * 1024; }; #define CHECK_STACK_LIMITS(v4) if ((v4)->checkStackLimits()) return Encode::undefined(); \ @@ -816,7 +816,7 @@ struct ExecutionEngineCallDepthRecorder inline bool ExecutionEngine::checkStackLimits() { - if (Q_UNLIKELY((jsStackTop > jsStackLimit) || (callDepth >= maxCallDepth))) { + if (Q_UNLIKELY((jsStackTop > jsStackLimit) || (callDepth >= s_maxCallDepth))) { throwRangeError(QStringLiteral("Maximum call stack size exceeded.")); return true; } |