diff options
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 9192cd9f8a..5a03c9e201 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -258,7 +258,7 @@ ReturnedValue FunctionCtor::construct(const Managed *that, CallData *callData) { Scope scope(static_cast<const Object *>(that)->engine()); Scoped<FunctionCtor> f(scope, static_cast<const FunctionCtor *>(that)); - ScopedContext ctx(scope, scope.engine->currentContext()); + QString arguments; QString body; if (callData->argc > 0) { @@ -269,7 +269,7 @@ ReturnedValue FunctionCtor::construct(const Managed *that, CallData *callData) } body = callData->args[callData->argc - 1].toQString(); } - if (ctx->d()->engine->hasException) + if (scope.engine->hasException) return Encode::undefined(); QString function = QLatin1String("function(") + arguments + QLatin1String("){") + body + QLatin1String("}"); @@ -442,9 +442,8 @@ 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)); + Scoped<CallContext> ctx(scope, v4->currentExecutionContext->newCallContext(f, callData)); v4->pushContext(ctx); ScopedValue result(scope, Q_V4_PROFILE(v4, f->function())); @@ -471,8 +470,7 @@ ReturnedValue ScriptFunction::call(const Managed *that, CallData *callData) 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)); + Scoped<CallContext> ctx(scope, v4->currentExecutionContext->newCallContext(f, callData)); v4->pushContext(ctx); ScopedValue result(scope, Q_V4_PROFILE(v4, f->function())); @@ -548,7 +546,7 @@ ReturnedValue SimpleScriptFunction::construct(const Managed *that, CallData *cal for (int i = callData->argc; i < (int)f->formalParameterCount(); ++i) callData->args[i] = Encode::undefined(); v4->pushContext(&ctx); - Q_ASSERT(v4->currentContext() == &ctx); + Q_ASSERT(v4->current == &ctx); ScopedObject result(scope, Q_V4_PROFILE(v4, f->function())); @@ -587,7 +585,7 @@ ReturnedValue SimpleScriptFunction::call(const Managed *that, CallData *callData for (int i = callData->argc; i < (int)f->formalParameterCount(); ++i) callData->args[i] = Encode::undefined(); v4->pushContext(&ctx); - Q_ASSERT(v4->currentContext() == &ctx); + Q_ASSERT(v4->current == &ctx); ScopedValue result(scope, Q_V4_PROFILE(v4, f->function())); @@ -640,10 +638,9 @@ ReturnedValue BuiltinFunction::call(const Managed *that, CallData *callData) 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); + Q_ASSERT(v4->current == &ctx); - return f->d()->code(sctx); + return f->d()->code(static_cast<QV4::CallContext *>(v4->currentExecutionContext)); } ReturnedValue IndexedBuiltinFunction::call(const Managed *that, CallData *callData) @@ -665,10 +662,9 @@ ReturnedValue IndexedBuiltinFunction::call(const Managed *that, CallData *callDa 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); + Q_ASSERT(v4->current == &ctx); - return f->d()->code(sctx, f->d()->index); + return f->d()->code(static_cast<QV4::CallContext *>(v4->currentExecutionContext), f->d()->index); } DEFINE_OBJECT_VTABLE(IndexedBuiltinFunction); |
