aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-01-10 09:22:19 +0100
committerUlf Hermann <ulf.hermann@qt.io>2024-01-20 23:59:24 +0100
commit930c8f186ac07f3462de41bcba6cf9d881e79fc2 (patch)
tree555a8cc6d26691dac2f4f4d2dfd3a1e7b7dab9fb /src/qml/jsruntime/qv4engine_p.h
parentaf212e5e4edb73978298cd030b15deb8d8c28183 (diff)
QtQml: Use CompiledData::CompilationUnit in more places
We rarely actually need the executable CU, and where we need it, we can dynamically create or retrieve it from the engine. To that end, store all the CUs in the same container in the engine. Change-Id: I0b786048c578ac4f41ae4aee601da850fa400f2e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> 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.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index fc4940d006..28242d35c8 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -496,11 +496,6 @@ public:
Symbol *symbol_unscopables() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_unscopables); }
Symbol *symbol_revokableProxy() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_revokableProxy); }
- using CompilationUnitList = QIntrusiveList<
- ExecutableCompilationUnit, &ExecutableCompilationUnit::nextCompilationUnit>;
- CompilationUnitList &compilationUnits() { return m_compilationUnits; }
- const CompilationUnitList &compilationUnits() const { return m_compilationUnits; }
-
quint32 m_engineId;
RegExpCache *regExpCache;
@@ -758,10 +753,16 @@ public:
QQmlRefPointer<ExecutableCompilationUnit> compileModule(
const QUrl &url, const QString &sourceCode, const QDateTime &sourceTimeStamp);
+ QQmlRefPointer<ExecutableCompilationUnit> compilationUnitForUrl(const QUrl &url) const;
QQmlRefPointer<ExecutableCompilationUnit> executableCompilationUnit(
QQmlRefPointer<QV4::CompiledData::CompilationUnit> &&unit);
+ QHash<QUrl, QQmlRefPointer<ExecutableCompilationUnit>> compilationUnits() const
+ {
+ return m_compilationUnits;
+ }
+ void clearCompilationUnits() { m_compilationUnits.clear(); }
+ void trimCompilationUnits();
- void injectCompiledModule(const QQmlRefPointer<ExecutableCompilationUnit> &moduleUnit);
QV4::Value *registerNativeModule(const QUrl &url, const QV4::Value &module);
struct Module {
@@ -877,15 +878,13 @@ private:
QVector<Deletable *> m_extensionData;
- QHash<QUrl, QQmlRefPointer<ExecutableCompilationUnit>> modules;
+ QHash<QUrl, QQmlRefPointer<ExecutableCompilationUnit>> m_compilationUnits;
// QV4::PersistentValue would be preferred, but using QHash will create copies,
// and QV4::PersistentValue doesn't like creating copies.
// Instead, we allocate a raw pointer using the same manual memory management
// technique in QV4::PersistentValue.
QHash<QUrl, Value *> nativeModules;
-
- CompilationUnitList m_compilationUnits;
};
#define CHECK_STACK_LIMITS(v4) \