diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-08-09 16:45:02 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-12 13:29:27 +0200 |
commit | 7c2adbbb6cccefd202164049dc9144b4d13aec0a (patch) | |
tree | 7410500f53aac1b8fe2a46729db48732744ebf4b /src/qml/jsruntime/qv4function.cpp | |
parent | 42dc821dd68cc63aa8300f2678639dbaacda1057 (diff) |
Add reference counting to the VM functions
This reduces memory pressure, keep engine->functions small and thus makes back
trace lookup faster. It became visible for example in the QtQuickControls
auto-tests that use plenty of loaders and we ended up with 30k+ functions.
Change-Id: Iaa5981f44e1e49ad9417a50c1e6a74946090dd28
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4function.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4function.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp index bf633a9b41..8c303a21ab 100644 --- a/src/qml/jsruntime/qv4function.cpp +++ b/src/qml/jsruntime/qv4function.cpp @@ -43,6 +43,9 @@ #include "qv4managed_p.h" #include "qv4string_p.h" #include "qv4value_p.h" +#include "qv4engine_p.h" +#include "qv4lookup_p.h" +#include "qv4unwindhelper_p.h" QT_BEGIN_NAMESPACE @@ -50,7 +53,14 @@ using namespace QV4; Function::~Function() { + engine->functions.remove(engine->functions.indexOf(this)); + UnwindHelper::deregisterFunction(this); + + Q_ASSERT(!refCount); delete[] codeData; + delete[] lookups; + foreach (Function *f, nestedFunctions) + f->deref(); } void Function::mark() |