aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-06-11 16:35:11 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-18 16:42:58 +0000
commitf077bf13efee6d57261f76544e89a10acafb5a9c (patch)
tree9a438cd2cee32153586a477c22fea62b703199e5 /src/qml/jsruntime/qv4context_p.h
parentfe9b63780da81fa8e3746e519dda320d57436503 (diff)
Clean up ExecutionContext's for QML
Create a specialized QmlContext instead of re-using a call context with a QQmlContextWrapper as activation object. This saves some memory and opens up the route to getting rid of the context wrapper in a future commit. Change-Id: I1591c73932a08564fddf5137ac05bbc6f31dd4d5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4context_p.h')
-rw-r--r--src/qml/jsruntime/qv4context_p.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index c35263ba7e..1a84097e14 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -75,9 +75,9 @@ struct ExecutionContext : Base {
Type_GlobalContext = 0x1,
Type_CatchContext = 0x2,
Type_WithContext = 0x3,
- Type_SimpleCallContext = 0x4,
- Type_CallContext = 0x5,
- Type_QmlContext = 0x6
+ Type_QmlContext = 0x4,
+ Type_SimpleCallContext = 0x5,
+ Type_CallContext = 0x6
};
inline ExecutionContext(ExecutionEngine *engine, ContextType t);
@@ -103,7 +103,6 @@ struct CallContext : ExecutionContext {
locals = 0;
activation = 0;
}
- CallContext(ExecutionEngine *engine, QV4::Object *qml, QV4::FunctionObject *function);
Pointer<FunctionObject> function;
Value *locals;
@@ -126,6 +125,10 @@ struct WithContext : ExecutionContext {
Pointer<Object> withObject;
};
+struct QmlContext : ExecutionContext {
+ QmlContext(QV4::ExecutionContext *outer, QV4::Object *qml);
+ Pointer<Object> qml;
+};
}
@@ -143,7 +146,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
Heap::CallContext *newCallContext(FunctionObject *f, CallData *callData);
Heap::WithContext *newWithContext(Object *with);
Heap::CatchContext *newCatchContext(String *exceptionVarName, const Value &exceptionValue);
- Heap::CallContext *newQmlContext(FunctionObject *f, Object *qml);
+ Heap::QmlContext *newQmlContext(Object *qml);
void createMutableBinding(String *name, bool deletable);
@@ -209,6 +212,11 @@ struct WithContext : public ExecutionContext
V4_MANAGED(WithContext, ExecutionContext)
};
+struct QmlContext : public ExecutionContext
+{
+ V4_MANAGED(QmlContext, ExecutionContext)
+};
+
inline CallContext *ExecutionContext::asCallContext()
{
return d()->type >= Heap::ExecutionContext::Type_SimpleCallContext ? static_cast<CallContext *>(this) : 0;