diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-08-16 18:35:29 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2013-08-16 19:22:24 +0200 |
commit | a44f92d925a1b0f5fa205706a26d81f07de75c33 (patch) | |
tree | 16345975d3058ca04b769b2598f58fa6de1f6f0d /src/qml/compiler/qv4compileddata.cpp | |
parent | 0f0e7443aea0d9a203b380bec708c485a01450e0 (diff) |
Get rid of the functions list in QV4::ExecutionEngine
Change-Id: I97067dbb2819936a1b2029c9f63f0627cb6b8bd2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4compileddata.cpp')
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 59c6a9b7fd..7f02509a80 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -45,11 +45,19 @@ #include <private/qv4function_p.h> #include <private/qv4lookup_p.h> #include <private/qv4regexpobject_p.h> +#include <private/qv4unwindhelper_p.h> namespace QV4 { namespace CompiledData { +namespace { + bool functionSortHelper(QV4::Function *lhs, QV4::Function *rhs) + { + return reinterpret_cast<quintptr>(lhs->code) < reinterpret_cast<quintptr>(rhs->code); + } +} + CompilationUnit::~CompilationUnit() { engine->compilationUnits.erase(engine->compilationUnits.find(this)); @@ -121,7 +129,13 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) } } - return linkBackendToEngine(engine); + QV4::Function *entry = linkBackendToEngine(engine); + + runtimeFunctionsSortedByAddress.resize(runtimeFunctions.size()); + memcpy(runtimeFunctionsSortedByAddress.data(), runtimeFunctions.data(), runtimeFunctions.size() * sizeof(QV4::Function*)); + qSort(runtimeFunctionsSortedByAddress.begin(), runtimeFunctionsSortedByAddress.end(), functionSortHelper); + + return entry; } void CompilationUnit::markObjects() @@ -130,6 +144,8 @@ void CompilationUnit::markObjects() runtimeStrings[i]->mark(); for (int i = 0; i < data->regexpTableSize; ++i) runtimeRegularExpressions[i].mark(); + for (int i = 0; i < runtimeFunctions.count(); ++i) + runtimeFunctions[i]->mark(); } } |