aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context.cpp
diff options
context:
space:
mode:
authorLars Knoll <[email protected]>2017-01-25 15:24:27 +0100
committerLars Knoll <[email protected]>2017-03-09 08:58:09 +0000
commit4de7e48ab160dacc7a09360e80264eac4945a8f4 (patch)
treea77cd8e6386a01a978f8ee0ebfdacf350b793198 /src/qml/jsruntime/qv4context.cpp
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 <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r--src/qml/jsruntime/qv4context.cpp53
1 files changed, 11 insertions, 42 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 740ebbe359..fe01b9abad 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -264,52 +264,21 @@ bool CallContext::needsOwnArguments() const
return (f && f->needsActivation()) || (argc() < (f ? static_cast<int>(f->nFormals) : 0));
}
-void ExecutionContext::markObjects(Heap::Base *m, ExecutionEngine *engine)
+void CallContext::markObjects(Heap::Base *m, ExecutionEngine *engine)
{
- ExecutionContext::Data *ctx = static_cast<ExecutionContext::Data *>(m);
+ QV4::Heap::CallContext *ctx = static_cast<Heap::CallContext *>(m);
- if (ctx->outer)
- ctx->outer->mark(engine);
-
- switch (ctx->type) {
- case Heap::ExecutionContext::Type_CatchContext: {
- CatchContext::Data *c = static_cast<CatchContext::Data *>(ctx);
- c->exceptionVarName->mark(engine);
- c->exceptionValue.mark(engine);
- break;
- }
- case Heap::ExecutionContext::Type_WithContext: {
- WithContext::Data *w = static_cast<WithContext::Data *>(ctx);
- if (w->withObject)
- w->withObject->mark(engine);
- break;
- }
- case Heap::ExecutionContext::Type_GlobalContext: {
- GlobalContext::Data *g = static_cast<GlobalContext::Data *>(ctx);
- g->global->mark(engine);
- break;
- }
- case Heap::ExecutionContext::Type_SimpleCallContext:
- break;
- case Heap::ExecutionContext::Type_CallContext: {
- QV4::Heap::CallContext *c = static_cast<Heap::CallContext *>(ctx);
- Q_ASSERT(c->v4Function);
+ if (ctx->type == Heap::ExecutionContext::Type_CallContext) {
+ Q_ASSERT(ctx->v4Function);
ctx->callData->thisObject.mark(engine);
- for (int arg = 0; arg < qMax(ctx->callData->argc, (int)c->v4Function->nFormals); ++arg)
+ for (int arg = 0; arg < qMax(ctx->callData->argc, (int)ctx->v4Function->nFormals); ++arg)
ctx->callData->args[arg].mark(engine);
- for (unsigned local = 0, lastLocal = c->v4Function->compiledFunction->nLocals; local < lastLocal; ++local)
- c->locals[local].mark(engine);
- if (c->activation)
- c->activation->mark(engine);
- if (c->function)
- c->function->mark(engine);
- break;
- }
- case Heap::ExecutionContext::Type_QmlContext: {
- QmlContext::Data *g = static_cast<QmlContext::Data *>(ctx);
- g->qml->mark(engine);
- break;
- }
+ for (unsigned local = 0, lastLocal = ctx->v4Function->compiledFunction->nLocals; local < lastLocal; ++local)
+ ctx->locals[local].mark(engine);
+ if (ctx->activation)
+ ctx->activation->mark(engine);
+ if (ctx->function)
+ ctx->function->mark(engine);
}
}