aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-11-14 14:53:28 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-22 14:54:33 +0100
commitbf173fe5da381c88343296ca33ef6b06389c6d20 (patch)
treeddcf0b304fea1c4ac76ab0762eb263a27fd6f7f0 /src/qml/jsruntime/qv4context_p.h
parent855784e5a72cb1a1309bcc832f84e4d0989bfba6 (diff)
Turn execution contexts into Managed objects
This finally gives proper memory management for ExecutionContexts. So far they had been garbage collected but where still allocated using standard malloc/free(). This allows us to collect the contexts faster and speed up context creation. Change-Id: I02e642391d55eaa59ab3f4c2720a2ac71259caf4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4context_p.h')
-rw-r--r--src/qml/jsruntime/qv4context_p.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index ccb5cf98f8..9b080dc590 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -66,8 +66,21 @@ struct CallContext;
struct CatchContext;
struct WithContext;
-struct Q_QML_EXPORT ExecutionContext
+struct Q_QML_EXPORT ExecutionContext : public Managed
{
+ Q_MANAGED
+ ExecutionContext()
+ : Managed(0) {
+ vtbl = &static_vtbl;
+ }
+ void init() {
+ _data = 0;
+ internalClass = 0;
+ inUse = 1;
+ extensible = 1;
+ vtbl = &static_vtbl;
+ }
+
enum Type {
Type_GlobalContext = 0x1,
Type_CatchContext = 0x2,
@@ -79,7 +92,6 @@ struct Q_QML_EXPORT ExecutionContext
Type type;
bool strictMode;
- bool marked;
CallData *callData;
@@ -104,7 +116,6 @@ struct Q_QML_EXPORT ExecutionContext
{
this->type = type;
strictMode = false;
- marked = false;
this->engine = engine;
parent = parentContext;
outer = 0;
@@ -148,10 +159,10 @@ struct Q_QML_EXPORT ExecutionContext
// Can only be called from within catch(...), rethrows if no JS exception.
ReturnedValue catchException(StackTrace *trace = 0);
- void mark();
-
inline CallContext *asCallContext();
inline const CallContext *asCallContext() const;
+
+ static void markObjects(Managed *m, ExecutionEngine *e);
};
struct CallContext : public ExecutionContext