aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-08-21 14:55:53 +0200
committerLars Knoll <lars.knoll@theqtcompany.com>2015-09-15 07:37:08 +0000
commit7dab89a65ef859ef1982d5b882cb74a0a34e53a9 (patch)
tree496f65fb6c0c6d158facca02bf83944269874a77 /src/qml/jsruntime/qv4functionobject.cpp
parentb5902bd43a3b45a25e3b960b20c3c1ecb41073fe (diff)
Cleanup the ExecutionContextSaver
Always operate on the current context (as that's what we do in practice anyway). Change-Id: I4171207a7a86e69aa685754956c0764ac6e152a7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 1cff952401..325f4c5c55 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -434,17 +434,19 @@ ReturnedValue ScriptFunction::construct(const Managed *that, CallData *callData)
CHECK_STACK_LIMITS(v4);
Scope scope(v4);
+ ExecutionContextSaver ctxSaver(scope);
+
Scoped<ScriptFunction> f(scope, static_cast<const ScriptFunction *>(that));
InternalClass *ic = scope.engine->emptyClass;
ScopedObject proto(scope, f->protoForConstructor());
ScopedObject obj(scope, v4->newObject(ic, proto));
+
ScopedContext context(scope, v4->currentContext());
callData->thisObject = obj.asReturnedValue();
Scoped<CallContext> ctx(scope, context->newCallContext(f, callData));
- ExecutionContextSaver ctxSaver(scope, context);
ScopedValue result(scope, Q_V4_PROFILE(v4, f->function()));
if (f->function()->compiledFunction->hasQmlDependencies())
@@ -466,12 +468,12 @@ ReturnedValue ScriptFunction::call(const Managed *that, CallData *callData)
CHECK_STACK_LIMITS(v4);
Scope scope(v4);
+ ExecutionContextSaver ctxSaver(scope);
+
Scoped<ScriptFunction> f(scope, static_cast<const ScriptFunction *>(that));
ScopedContext context(scope, v4->currentContext());
-
Scoped<CallContext> ctx(scope, context->newCallContext(f, callData));
- ExecutionContextSaver ctxSaver(scope, context);
ScopedValue result(scope, Q_V4_PROFILE(v4, f->function()));
if (f->function()->compiledFunction->hasQmlDependencies())
@@ -522,14 +524,14 @@ ReturnedValue SimpleScriptFunction::construct(const Managed *that, CallData *cal
CHECK_STACK_LIMITS(v4);
Scope scope(v4);
+ ExecutionContextSaver ctxSaver(scope);
+
Scoped<SimpleScriptFunction> f(scope, static_cast<const SimpleScriptFunction *>(that));
InternalClass *ic = scope.engine->emptyClass;
ScopedObject proto(scope, f->protoForConstructor());
callData->thisObject = v4->newObject(ic, proto);
- ExecutionContextSaver ctxSaver(scope, v4->currentContext());
-
CallContext::Data ctx(v4);
#ifndef QT_NO_DEBUG
ctx.mm_data = 0; // make sure we don't run into the assertion in setVTable when allocating a context on the stack
@@ -564,9 +566,9 @@ ReturnedValue SimpleScriptFunction::call(const Managed *that, CallData *callData
CHECK_STACK_LIMITS(v4);
Scope scope(v4);
- Scoped<SimpleScriptFunction> f(scope, static_cast<const SimpleScriptFunction *>(that));
+ ExecutionContextSaver ctxSaver(scope);
- ExecutionContextSaver ctxSaver(scope, v4->currentContext());
+ Scoped<SimpleScriptFunction> f(scope, static_cast<const SimpleScriptFunction *>(that));
CallContext::Data ctx(v4);
#ifndef QT_NO_DEBUG
@@ -625,7 +627,7 @@ ReturnedValue BuiltinFunction::call(const Managed *that, CallData *callData)
CHECK_STACK_LIMITS(v4);
Scope scope(v4);
- ExecutionContextSaver ctxSaver(scope, v4->currentContext());
+ ExecutionContextSaver ctxSaver(scope);
CallContext::Data ctx(v4);
#ifndef QT_NO_DEBUG
@@ -649,7 +651,7 @@ ReturnedValue IndexedBuiltinFunction::call(const Managed *that, CallData *callDa
CHECK_STACK_LIMITS(v4);
Scope scope(v4);
- ExecutionContextSaver ctxSaver(scope, v4->currentContext());
+ ExecutionContextSaver ctxSaver(scope);
CallContext::Data ctx(v4);
#ifndef QT_NO_DEBUG