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/qv4functionobject_p.h | |
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/qv4functionobject_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject_p.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 8465142616..71691ba1c4 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -108,6 +108,7 @@ struct Q_QML_EXPORT FunctionObject: Object { Function *function; FunctionObject(ExecutionContext *scope, String *name = 0); + ~FunctionObject(); Value newInstance(); @@ -124,6 +125,8 @@ protected: static const ManagedVTable static_vtbl; static void markObjects(Managed *that); static bool hasInstance(Managed *that, const Value &value); + static void destroy(Managed *that) + { static_cast<FunctionObject*>(that)->~FunctionObject(); } }; struct FunctionCtor: FunctionObject |