diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2020-04-09 10:47:32 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2020-04-22 06:35:26 +0200 |
commit | 505863e7004c60fa2fc9aafc41516e2ee8a8efaa (patch) | |
tree | 8a4200b35c8add4c2b5873a71982c7487025bbee /src/qml/jsruntime/qv4executablecompilationunit.cpp | |
parent | 5728f48834b9225a36d3e1dae44ced7579cde358 (diff) |
Add a hook that allows for ahead-of-time compiled functions
Use the unused field in the CachedUnit structure provided by qmlcachegen
to allow for providing function pointers for functions and bindings that
are compiled ahead of time.
Provided is the pointer into an array that is terminated with a {index:
0, functionPtr: nullptr} entry. The array index field in each array
entry allows for gaps.
Change-Id: I7457f5eea5f14e5f94431b9cc6da042cb03517a0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4executablecompilationunit.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4executablecompilationunit.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp index 47357bea49..94fa3e0fbf 100644 --- a/src/qml/jsruntime/qv4executablecompilationunit.cpp +++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp @@ -37,6 +37,7 @@ ** ****************************************************************************/ +#include "qml/qqmlprivate.h" #include "qv4executablecompilationunit_p.h" #include <private/qv4engine_p.h> @@ -208,9 +209,20 @@ QV4::Function *ExecutableCompilationUnit::linkToEngine(ExecutionEngine *engine) } runtimeFunctions.resize(data->functionTableSize); + const QQmlPrivate::AOTCompiledFunction *aotFunction = aotCompiledFunctions; for (int i = 0 ;i < runtimeFunctions.size(); ++i) { const QV4::CompiledData::Function *compiledFunction = data->functionAt(i); runtimeFunctions[i] = QV4::Function::create(engine, this, compiledFunction); + if (aotFunction) { + if (aotFunction->functionPtr) { + if (aotFunction->index == i) { + runtimeFunctions[i]->jittedCode = aotFunction->functionPtr; + ++aotFunction; + } + } else { + aotFunction = nullptr; + } + } } Scope scope(engine); |