diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-23 10:13:12 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-23 13:31:03 +0200 |
commit | f263e6ac9321d1f1b0fc4e46371642a2dbe85262 (patch) | |
tree | d336959e4c2f4a085f31df11d0b21750021b4d80 /src/qml/jsruntime/qv4executablecompilationunit.cpp | |
parent | d79e660bd24cf31cfbae14681dc8233d9c1c5762 (diff) |
Fix logic to select AOT compiled function
We only want the function if it's not a nullptr and if it matches the
required index.
Change-Id: I5695bfb950f66e5a7589b042c3313297c51533d2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4executablecompilationunit.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4executablecompilationunit.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp index 01700fd05c..c01a1142e0 100644 --- a/src/qml/jsruntime/qv4executablecompilationunit.cpp +++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp @@ -212,17 +212,23 @@ 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, aotFunction); + + auto advanceAotFunction = [&](int i) -> const QQmlPrivate::AOTCompiledFunction * { if (aotFunction) { if (aotFunction->functionPtr) { if (aotFunction->index == i) - ++aotFunction; + return aotFunction++; } else { aotFunction = nullptr; } } + return nullptr; + }; + + for (int i = 0 ;i < runtimeFunctions.size(); ++i) { + const QV4::CompiledData::Function *compiledFunction = data->functionAt(i); + runtimeFunctions[i] = QV4::Function::create(engine, this, compiledFunction, + advanceAotFunction(i)); } Scope scope(engine); |