diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-08-24 09:07:10 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-09-15 07:37:11 +0000 |
commit | cedd73279403244bbf4b74da4c3ec60111e60399 (patch) | |
tree | fc3a03ecdc4faefd9ed010ee4723d2a2333fd74c /src/qml/jsruntime/qv4functionobject.cpp | |
parent | 7dab89a65ef859ef1982d5b882cb74a0a34e53a9 (diff) |
Explicitly push/pop ExecutionContexts
Avoid the implicit push inside the execution context constructor
and rather make this explicit in the code.
Change-Id: I1bb0fb523fddbb273fc666370d619f55f49cd40a
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 325f4c5c55..9192cd9f8a 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -442,10 +442,10 @@ ReturnedValue ScriptFunction::construct(const Managed *that, CallData *callData) 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)); + v4->pushContext(ctx); ScopedValue result(scope, Q_V4_PROFILE(v4, f->function())); @@ -473,6 +473,7 @@ ReturnedValue ScriptFunction::call(const Managed *that, CallData *callData) Scoped<ScriptFunction> f(scope, static_cast<const ScriptFunction *>(that)); ScopedContext context(scope, v4->currentContext()); Scoped<CallContext> ctx(scope, context->newCallContext(f, callData)); + v4->pushContext(ctx); ScopedValue result(scope, Q_V4_PROFILE(v4, f->function())); @@ -546,6 +547,7 @@ ReturnedValue SimpleScriptFunction::construct(const Managed *that, CallData *cal ctx.locals = scope.alloc(f->varCount()); for (int i = callData->argc; i < (int)f->formalParameterCount(); ++i) callData->args[i] = Encode::undefined(); + v4->pushContext(&ctx); Q_ASSERT(v4->currentContext() == &ctx); ScopedObject result(scope, Q_V4_PROFILE(v4, f->function())); @@ -584,6 +586,7 @@ ReturnedValue SimpleScriptFunction::call(const Managed *that, CallData *callData ctx.locals = scope.alloc(f->varCount()); for (int i = callData->argc; i < (int)f->formalParameterCount(); ++i) callData->args[i] = Encode::undefined(); + v4->pushContext(&ctx); Q_ASSERT(v4->currentContext() == &ctx); ScopedValue result(scope, Q_V4_PROFILE(v4, f->function())); @@ -636,6 +639,7 @@ ReturnedValue BuiltinFunction::call(const Managed *that, CallData *callData) ctx.setVtable(CallContext::staticVTable()); ctx.strictMode = f->scope()->strictMode; // ### needed? scope or parent context? ctx.callData = callData; + v4->pushContext(&ctx); Q_ASSERT(v4->currentContext() == &ctx); Scoped<CallContext> sctx(scope, &ctx); @@ -660,6 +664,7 @@ ReturnedValue IndexedBuiltinFunction::call(const Managed *that, CallData *callDa ctx.setVtable(CallContext::staticVTable()); ctx.strictMode = f->scope()->strictMode; // ### needed? scope or parent context? ctx.callData = callData; + v4->pushContext(&ctx); Q_ASSERT(v4->currentContext() == &ctx); Scoped<CallContext> sctx(scope, &ctx); |