aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-11-28 09:31:10 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-12-19 16:30:19 +0100
commitda2b7576daa58ad2881e41ad6f0f85ec55db4fd2 (patch)
tree1bb0dcfd7011f87aa1c238174205ce79c66273b6 /src/qml/jsruntime/qv4functionobject.cpp
parent45f77a6bfc05b97e6312a379c63840243b5815f3 (diff)
Return Heap::ExecutionContext for currentContext()
Change-Id: I155ab996e24d7f36761d2ea62a04774e16469b34 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 437de33b3f..c3d7a65a32 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -216,7 +216,8 @@ ReturnedValue FunctionCtor::construct(Managed *that, CallData *callData)
{
FunctionCtor *f = static_cast<FunctionCtor *>(that);
ExecutionEngine *v4 = f->internalClass()->engine;
- ExecutionContext *ctx = v4->currentContext();
+ Scope scope(v4);
+ ScopedContext ctx(scope, v4->currentContext());
QString arguments;
QString body;
if (callData->argc > 0) {
@@ -397,7 +398,7 @@ ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData)
ScopedObject proto(scope, f->protoForConstructor());
ScopedObject obj(scope, v4->newObject(ic, proto));
- ExecutionContext *context = v4->currentContext();
+ ScopedContext context(scope, v4->currentContext());
callData->thisObject = obj.asReturnedValue();
Scoped<CallContext> ctx(scope, context->newCallContext(f.getPointer(), callData));
@@ -423,8 +424,8 @@ ReturnedValue ScriptFunction::call(Managed *that, CallData *callData)
return Encode::undefined();
CHECK_STACK_LIMITS(v4);
- ExecutionContext *context = v4->currentContext();
- Scope scope(context);
+ Scope scope(v4);
+ ScopedContext context(scope, v4->currentContext());
Scoped<CallContext> ctx(scope, context->newCallContext(f, callData));
@@ -482,8 +483,7 @@ ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData)
ScopedObject proto(scope, f->protoForConstructor());
callData->thisObject = v4->newObject(ic, proto);
- ExecutionContext *context = v4->currentContext();
- ExecutionContextSaver ctxSaver(scope, context);
+ ExecutionContextSaver ctxSaver(scope, v4->currentContext());
CallContext::Data ctx(v4);
ctx.strictMode = f->strictMode();
@@ -497,7 +497,7 @@ ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData)
callData->args[callData->argc] = Encode::undefined();
++callData->argc;
}
- Q_ASSERT(v4->currentContext()->d() == &ctx);
+ Q_ASSERT(v4->currentContext() == &ctx);
Scoped<Object> result(scope, Q_V4_PROFILE(v4, f->function()));
@@ -519,8 +519,7 @@ ReturnedValue SimpleScriptFunction::call(Managed *that, CallData *callData)
SimpleScriptFunction *f = static_cast<SimpleScriptFunction *>(that);
Scope scope(v4);
- ExecutionContext *context = v4->currentContext();
- ExecutionContextSaver ctxSaver(scope, context);
+ ExecutionContextSaver ctxSaver(scope, v4->currentContext());
CallContext::Data ctx(v4);
ctx.strictMode = f->strictMode();
@@ -534,7 +533,7 @@ ReturnedValue SimpleScriptFunction::call(Managed *that, CallData *callData)
callData->args[callData->argc] = Encode::undefined();
++callData->argc;
}
- Q_ASSERT(v4->currentContext()->d() == &ctx);
+ Q_ASSERT(v4->currentContext() == &ctx);
ScopedValue result(scope, Q_V4_PROFILE(v4, f->function()));
@@ -578,13 +577,12 @@ ReturnedValue BuiltinFunction::call(Managed *that, CallData *callData)
CHECK_STACK_LIMITS(v4);
Scope scope(v4);
- ExecutionContext *context = v4->currentContext();
- ExecutionContextSaver ctxSaver(scope, context);
+ ExecutionContextSaver ctxSaver(scope, v4->currentContext());
CallContext::Data ctx(v4);
ctx.strictMode = f->scope()->strictMode; // ### needed? scope or parent context?
ctx.callData = callData;
- Q_ASSERT(v4->currentContext()->d() == &ctx);
+ Q_ASSERT(v4->currentContext() == &ctx);
return f->d()->code(reinterpret_cast<CallContext *>(&ctx));
}
@@ -598,13 +596,12 @@ ReturnedValue IndexedBuiltinFunction::call(Managed *that, CallData *callData)
CHECK_STACK_LIMITS(v4);
Scope scope(v4);
- ExecutionContext *context = v4->currentContext();
- ExecutionContextSaver ctxSaver(scope, context);
+ ExecutionContextSaver ctxSaver(scope, v4->currentContext());
CallContext::Data ctx(v4);
ctx.strictMode = f->scope()->strictMode; // ### needed? scope or parent context?
ctx.callData = callData;
- Q_ASSERT(v4->currentContext()->d() == &ctx);
+ Q_ASSERT(v4->currentContext() == &ctx);
return f->d()->code(reinterpret_cast<CallContext *>(&ctx), f->d()->index);
}