diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-31 13:27:58 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-03 06:09:37 +0000 |
commit | 0b6461e8187e3c6dfdfe9fbe6373bf615a1d5319 (patch) | |
tree | a2f04f1c624335a5dee97ee275a54b2a3a3c085a /src/qml/compiler | |
parent | 4914b80f611cac866ce84f2f2fb1b8de24358417 (diff) |
Minor cleanup in CompilationUnit::linkToEngine
This is the only call-site for linkBackendToEngine, which used to be a
virtual function. There's no need anymore for an indirection, so we can
inline the code.
Change-Id: I79fe3d5a9c65cc8c05f108065017465270999de1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 45 | ||||
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 2 |
2 files changed, 20 insertions, 27 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 8289d92eb1..00a36cbb46 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -188,7 +188,26 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) } } - linkBackendToEngine(engine); + runtimeFunctions.resize(data->functionTableSize); + for (int i = 0 ;i < runtimeFunctions.size(); ++i) { + const QV4::CompiledData::Function *compiledFunction = data->functionAt(i); + runtimeFunctions[i] = new QV4::Function(engine, this, compiledFunction); + } + + Scope scope(engine); + Scoped<InternalClass> ic(scope); + + runtimeBlocks.resize(data->blockTableSize); + for (int i = 0 ;i < runtimeBlocks.size(); ++i) { + const QV4::CompiledData::Block *compiledBlock = data->blockAt(i); + ic = engine->internalClasses(EngineBase::Class_CallContext); + + // first locals + const quint32_le *localsIndices = compiledBlock->localsTable(); + for (quint32 i = 0; i < compiledBlock->nLocals; ++i) + ic = ic->addMember(engine->identifierTable->asPropertyKey(runtimeStrings[localsIndices[i]]), Attr_NotConfigurable); + runtimeBlocks[i] = ic->d(); + } static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_BYTECODE"); if (showCode) { @@ -388,30 +407,6 @@ bool CompilationUnit::loadFromDisk(const QUrl &url, const QDateTime &sourceTimeS return false; } -void CompilationUnit::linkBackendToEngine(ExecutionEngine *engine) -{ - runtimeFunctions.resize(data->functionTableSize); - for (int i = 0 ;i < runtimeFunctions.size(); ++i) { - const QV4::CompiledData::Function *compiledFunction = data->functionAt(i); - runtimeFunctions[i] = new QV4::Function(engine, this, compiledFunction); - } - - Scope scope(engine); - Scoped<InternalClass> ic(scope); - - runtimeBlocks.resize(data->blockTableSize); - for (int i = 0 ;i < runtimeBlocks.size(); ++i) { - const QV4::CompiledData::Block *compiledBlock = data->blockAt(i); - ic = engine->internalClasses(EngineBase::Class_CallContext); - - // first locals - const quint32_le *localsIndices = compiledBlock->localsTable(); - for (quint32 i = 0; i < compiledBlock->nLocals; ++i) - ic = ic->addMember(engine->identifierTable->asPropertyKey(runtimeStrings[localsIndices[i]]), Attr_NotConfigurable); - runtimeBlocks[i] = ic->d(); - } -} - #endif // V4_BOOTSTRAP #if defined(V4_BOOTSTRAP) diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index c3cc38e193..e7d152c7f8 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -1132,8 +1132,6 @@ public: static QString localCacheFilePath(const QUrl &url); protected: - void linkBackendToEngine(QV4::ExecutionEngine *engine); - quint32 totalStringCount() const { return data->stringTableSize; } |