aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-01-25 15:24:27 +0100
committerLars Knoll <lars.knoll@qt.io>2017-03-09 08:58:09 +0000
commit4de7e48ab160dacc7a09360e80264eac4945a8f4 (patch)
treea77cd8e6386a01a978f8ee0ebfdacf350b793198 /src/qml/jsruntime/qv4context_p.h
parent6b4b2f5f1bbd706742cbab8764a1d07cbd912600 (diff)
Move most of the ExecutionContext's over to the new mark handling
CallContext still requires further work, as the handling of locals is different between a CallContext and a SimpleCallContext. Change-Id: I74945ef701f60907aab0fb1a9939da1331235f6e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4context_p.h')
-rw-r--r--src/qml/jsruntime/qv4context_p.h46
1 files changed, 31 insertions, 15 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index bcfee2e1f8..cbf1ac9f7d 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -95,7 +95,11 @@ namespace Heap {
struct QmlContext;
-struct ExecutionContext : Base {
+#define ExecutionContextMembers(class, Member) \
+ Member(class, Pointer<ExecutionContext>, outer)
+
+DECLARE_HEAP_OBJECT(ExecutionContext, Base) {
+ DECLARE_MARK_TABLE(ExecutionContext);
enum ContextType {
Type_GlobalContext = 0x1,
Type_CatchContext = 0x2,
@@ -117,7 +121,6 @@ struct ExecutionContext : Base {
CallData *callData;
ExecutionEngine *engine;
- Pointer<ExecutionContext> outer;
Lookup *lookups;
const QV4::Value *constantTable;
CompiledData::CompilationUnit *compilationUnit;
@@ -128,7 +131,12 @@ struct ExecutionContext : Base {
};
V4_ASSERT_IS_TRIVIAL(ExecutionContext)
-struct CallContext : ExecutionContext {
+#define CallContextMembers(class, Member) \
+ Member(class, Pointer<FunctionObject>, function) \
+ Member(class, Pointer<Object>, activation)
+
+DECLARE_HEAP_OBJECT(CallContext, ExecutionContext) {
+ DECLARE_MARK_TABLE(CallContext);
static CallContext *createSimpleContext(ExecutionEngine *v4);
void freeSimpleCallContext();
@@ -139,27 +147,38 @@ struct CallContext : ExecutionContext {
inline unsigned int formalParameterCount() const;
- Pointer<FunctionObject> function;
QV4::Function *v4Function;
Value *locals;
- Pointer<Object> activation;
};
V4_ASSERT_IS_TRIVIAL(CallContext)
-struct GlobalContext : ExecutionContext {
+#define GlobalContextMembers(class, Member) \
+ Member(class, Pointer<Object>, global)
+
+DECLARE_HEAP_OBJECT(GlobalContext, ExecutionContext) {
+ DECLARE_MARK_TABLE(GlobalContext);
+
void init(ExecutionEngine *engine);
- Pointer<Object> global;
};
V4_ASSERT_IS_TRIVIAL(GlobalContext)
-struct CatchContext : ExecutionContext {
+#define CatchContextMembers(class, Member) \
+ Member(class, Pointer<String>, exceptionVarName) \
+ Member(class, Value, exceptionValue)
+
+DECLARE_HEAP_OBJECT(CatchContext, ExecutionContext) {
+ DECLARE_MARK_TABLE(CatchContext);
+
void init(ExecutionContext *outerContext, String *exceptionVarName, const Value &exceptionValue);
- Pointer<String> exceptionVarName;
- Value exceptionValue;
};
V4_ASSERT_IS_TRIVIAL(CatchContext)
-struct WithContext : ExecutionContext {
+#define WithContextMembers(class, Member) \
+ Member(class, Pointer<Object>, withObject)
+
+DECLARE_HEAP_OBJECT(WithContext, ExecutionContext) {
+ DECLARE_MARK_TABLE(WithContext);
+
void init(ExecutionContext *outerContext, Object *with)
{
Heap::ExecutionContext::init(outerContext->engine, Heap::ExecutionContext::Type_WithContext);
@@ -171,8 +190,6 @@ struct WithContext : ExecutionContext {
withObject = with;
}
-
- Pointer<Object> withObject;
};
V4_ASSERT_IS_TRIVIAL(WithContext)
@@ -207,8 +224,6 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
Function *getFunction() const;
- static void markObjects(Heap::Base *m, ExecutionEngine *e);
-
Value &thisObject() const {
return d()->callData->thisObject;
}
@@ -239,6 +254,7 @@ struct Q_QML_EXPORT CallContext : public ExecutionContext
inline ReturnedValue argument(int i) const;
bool needsOwnArguments() const;
+ static void markObjects(Heap::Base *m, ExecutionEngine *e);
};
inline ReturnedValue CallContext::argument(int i) const {