diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-06-22 10:02:06 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-22 22:28:33 +0200 |
commit | 1e437db3e241ec7e3c0dc290193397409db0588e (patch) | |
tree | a73c5e6e63fb1f7f7824db11810d1cdb97751f8e | |
parent | 7c7581f1d03668df7b77e0076d128fd6a122d96b (diff) |
Remove the context argument from Managed::call
Change-Id: I0895f9a94af47c8aab1dc93579921737e9516f7d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
42 files changed, 135 insertions, 130 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index bfdce45a35..06f99abc8c 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1218,7 +1218,7 @@ void QQmlComponent::createObject(QQmlV4Function *args) QQmlComponentExtension *e = componentExtension(v8engine); QV4::Value f = QV4::Script::evaluate(QV8Engine::getV4(v8engine), QString::fromLatin1(INITIALPROPERTIES_SOURCE), args->qmlGlobal().asObject()); QV4::Value args[] = { object, valuemap }; - f.asFunctionObject()->call(v4engine->current, QV4::Value::fromObject(v4engine->globalObject), args, 2); + f.asFunctionObject()->call(QV4::Value::fromObject(v4engine->globalObject), args, 2); } d->completeCreate(); @@ -1363,7 +1363,7 @@ void QQmlComponentPrivate::initializeObjectWithInitialProperties(const QV4::Valu QQmlComponentExtension *e = componentExtension(v8engine); QV4::Value f = QV4::Script::evaluate(QV8Engine::getV4(v8engine), QString::fromLatin1(INITIALPROPERTIES_SOURCE), qmlGlobal.asObject()); QV4::Value args[] = { object, valuemap }; - f.asFunctionObject()->call(v4engine->current, QV4::Value::fromObject(v4engine->globalObject), args, 2); + f.asFunctionObject()->call(QV4::Value::fromObject(v4engine->globalObject), args, 2); } } @@ -1459,7 +1459,7 @@ void QmlIncubatorObject::setInitialState(QObject *o) QV4::Value f = QV4::Script::evaluate(v4, QString::fromLatin1(INITIALPROPERTIES_SOURCE), qmlGlobal.asObject()); QV4::Value args[] = { QV4::QObjectWrapper::wrap(v4, o), valuemap }; - f.asFunctionObject()->call(v4->current, QV4::Value::fromObject(v4->globalObject), args, 2); + f.asFunctionObject()->call(QV4::Value::fromObject(v4->globalObject), args, 2); } } diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 85f2f2a001..2be4c57db4 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -167,7 +167,7 @@ QQmlJavaScriptExpression::evaluate(QQmlContextData *context, This = value; } - result = function.asFunctionObject()->call(ctx, This, args, argc); + result = function.asFunctionObject()->call(This, args, argc); if (isUndefined) *isUndefined = result.isUndefined(); diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index e1de67c120..adb2a95f00 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -1477,7 +1477,7 @@ void QQmlXMLHttpRequest::dispatchCallback(const Value &me) QQmlContextData *callingContext = QmlContextWrapper::getContext(activationObject); if (callingContext) - callback->call(v4->current, activationObject, 0, 0); + callback->call(activationObject, 0, 0); // if the callingContext object is no longer valid, then it has been // deleted explicitly (e.g., by a Loader deleting the itemContext when @@ -1569,7 +1569,7 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject return Value::fromObject(w); } - static Value call(Managed *, ExecutionContext *, const Value &, Value *, int) { + static Value call(Managed *, const Value &, Value *, int) { return Value::undefinedValue(); } diff --git a/src/qml/qml/v4/qv4argumentsobject.cpp b/src/qml/qml/v4/qv4argumentsobject.cpp index 914f219012..b9e4733677 100644 --- a/src/qml/qml/v4/qv4argumentsobject.cpp +++ b/src/qml/qml/v4/qv4argumentsobject.cpp @@ -112,7 +112,7 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const if (isMapped && attrs.isData()) { if (!attrs.isGeneric()) { Value arg = desc.value; - map.setter()->call(ctx, Value::fromObject(this), &arg, 1); + map.setter()->call(Value::fromObject(this), &arg, 1); } if (attrs.isWritable()) { *pd = map; @@ -127,15 +127,15 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const DEFINE_MANAGED_VTABLE(ArgumentsGetterFunction); -Value ArgumentsGetterFunction::call(Managed *getter, ExecutionContext *ctx, const Value &thisObject, Value *, int) +Value ArgumentsGetterFunction::call(Managed *getter, const Value &thisObject, Value *, int) { ArgumentsGetterFunction *g = static_cast<ArgumentsGetterFunction *>(getter); Object *that = thisObject.asObject(); if (!that) - ctx->throwTypeError(); + getter->engine()->current->throwTypeError(); ArgumentsObject *o = that->asArgumentsObject(); if (!o) - ctx->throwTypeError(); + getter->engine()->current->throwTypeError(); assert(g->index < o->context->argumentCount); return o->context->argument(g->index); @@ -143,15 +143,15 @@ Value ArgumentsGetterFunction::call(Managed *getter, ExecutionContext *ctx, cons DEFINE_MANAGED_VTABLE(ArgumentsSetterFunction); -Value ArgumentsSetterFunction::call(Managed *setter, ExecutionContext *ctx, const Value &thisObject, Value *args, int argc) +Value ArgumentsSetterFunction::call(Managed *setter, const Value &thisObject, Value *args, int argc) { ArgumentsSetterFunction *s = static_cast<ArgumentsSetterFunction *>(setter); Object *that = thisObject.asObject(); if (!that) - ctx->throwTypeError(); + setter->engine()->current->throwTypeError(); ArgumentsObject *o = that->asArgumentsObject(); if (!o) - ctx->throwTypeError(); + setter->engine()->current->throwTypeError(); assert(s->index < o->context->argumentCount); o->context->arguments[s->index] = argc ? args[0] : Value::undefinedValue(); diff --git a/src/qml/qml/v4/qv4argumentsobject_p.h b/src/qml/qml/v4/qv4argumentsobject_p.h index b1d5a53bd4..24bc7197a1 100644 --- a/src/qml/qml/v4/qv4argumentsobject_p.h +++ b/src/qml/qml/v4/qv4argumentsobject_p.h @@ -55,7 +55,7 @@ struct ArgumentsGetterFunction: FunctionObject ArgumentsGetterFunction(ExecutionContext *scope, uint index) : FunctionObject(scope), index(index) { vtbl = &static_vtbl; } - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; @@ -68,7 +68,7 @@ struct ArgumentsSetterFunction: FunctionObject ArgumentsSetterFunction(ExecutionContext *scope, uint index) : FunctionObject(scope), index(index) { vtbl = &static_vtbl; } - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; diff --git a/src/qml/qml/v4/qv4arrayobject.cpp b/src/qml/qml/v4/qv4arrayobject.cpp index 6f3f36a093..4d59f0f2d7 100644 --- a/src/qml/qml/v4/qv4arrayobject.cpp +++ b/src/qml/qml/v4/qv4arrayobject.cpp @@ -78,7 +78,7 @@ Value ArrayCtor::construct(Managed *m, Value *argv, int argc) return Value::fromObject(a); } -Value ArrayCtor::call(Managed *that, ExecutionContext *, const Value &, Value *argv, int argc) +Value ArrayCtor::call(Managed *that, const Value &, Value *argv, int argc) { return construct(that, argv, argc); } @@ -644,7 +644,7 @@ Value ArrayPrototype::method_every(SimpleCallContext *ctx) args[0] = v; args[1] = Value::fromDouble(k); args[2] = ctx->thisObject; - Value r = callback->call(ctx, thisArg, args, 3); + Value r = callback->call(thisArg, args, 3); ok = r.toBoolean(); } return Value::fromBoolean(ok); @@ -672,7 +672,7 @@ Value ArrayPrototype::method_some(SimpleCallContext *ctx) args[0] = v; args[1] = Value::fromDouble(k); args[2] = ctx->thisObject; - Value r = callback->call(ctx, thisArg, args, 3); + Value r = callback->call(thisArg, args, 3); if (r.toBoolean()) return Value::fromBoolean(true); } @@ -701,7 +701,7 @@ Value ArrayPrototype::method_forEach(SimpleCallContext *ctx) args[0] = v; args[1] = Value::fromDouble(k); args[2] = ctx->thisObject; - callback->call(ctx, thisArg, args, 3); + callback->call(thisArg, args, 3); } return Value::undefinedValue(); } @@ -732,7 +732,7 @@ Value ArrayPrototype::method_map(SimpleCallContext *ctx) args[0] = v; args[1] = Value::fromDouble(k); args[2] = ctx->thisObject; - Value mapped = callback->call(ctx, thisArg, args, 3); + Value mapped = callback->call(thisArg, args, 3); a->arraySet(k, mapped); } return Value::fromObject(a); @@ -764,7 +764,7 @@ Value ArrayPrototype::method_filter(SimpleCallContext *ctx) args[0] = v; args[1] = Value::fromDouble(k); args[2] = ctx->thisObject; - Value selected = callback->call(ctx, thisArg, args, 3); + Value selected = callback->call(thisArg, args, 3); if (selected.toBoolean()) { a->arraySet(to, v); ++to; @@ -808,7 +808,7 @@ Value ArrayPrototype::method_reduce(SimpleCallContext *ctx) args[1] = v; args[2] = Value::fromDouble(k); args[3] = ctx->thisObject; - acc = callback->call(ctx, Value::undefinedValue(), args, 4); + acc = callback->call(Value::undefinedValue(), args, 4); } ++k; } @@ -856,7 +856,7 @@ Value ArrayPrototype::method_reduceRight(SimpleCallContext *ctx) args[1] = v; args[2] = Value::fromDouble(k - 1); args[3] = ctx->thisObject; - acc = callback->call(ctx, Value::undefinedValue(), args, 4); + acc = callback->call(Value::undefinedValue(), args, 4); } --k; } diff --git a/src/qml/qml/v4/qv4arrayobject_p.h b/src/qml/qml/v4/qv4arrayobject_p.h index a1c9eb46bd..7736cccf1e 100644 --- a/src/qml/qml/v4/qv4arrayobject_p.h +++ b/src/qml/qml/v4/qv4arrayobject_p.h @@ -54,7 +54,7 @@ struct ArrayCtor: FunctionObject ArrayCtor(ExecutionContext *scope); static Value construct(Managed *m, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; diff --git a/src/qml/qml/v4/qv4booleanobject.cpp b/src/qml/qml/v4/qv4booleanobject.cpp index 049f577b1c..aaad175404 100644 --- a/src/qml/qml/v4/qv4booleanobject.cpp +++ b/src/qml/qml/v4/qv4booleanobject.cpp @@ -57,7 +57,7 @@ Value BooleanCtor::construct(Managed *m, Value *args, int argc) return Value::fromObject(m->engine()->newBooleanObject(Value::fromBoolean(n))); } -Value BooleanCtor::call(Managed *, ExecutionContext *parentCtx, const Value &thisObject, Value *argv, int argc) +Value BooleanCtor::call(Managed *, const Value &, Value *argv, int argc) { bool value = argc ? argv[0].toBoolean() : 0; return Value::fromBoolean(value); diff --git a/src/qml/qml/v4/qv4booleanobject_p.h b/src/qml/qml/v4/qv4booleanobject_p.h index cffdf8a888..0a52baab3f 100644 --- a/src/qml/qml/v4/qv4booleanobject_p.h +++ b/src/qml/qml/v4/qv4booleanobject_p.h @@ -54,7 +54,7 @@ struct BooleanCtor: FunctionObject BooleanCtor(ExecutionContext *scope); static Value construct(Managed *, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; diff --git a/src/qml/qml/v4/qv4dateobject.cpp b/src/qml/qml/v4/qv4dateobject.cpp index ab1c91a25e..8953148fbd 100644 --- a/src/qml/qml/v4/qv4dateobject.cpp +++ b/src/qml/qml/v4/qv4dateobject.cpp @@ -697,10 +697,10 @@ Value DateCtor::construct(Managed *m, Value *args, int argc) return Value::fromObject(d); } -Value DateCtor::call(Managed *, ExecutionContext *ctx, const Value &, Value *, int) +Value DateCtor::call(Managed *m, const Value &, Value *, int) { double t = currentTime(); - return Value::fromString(ctx, ToString(t)); + return Value::fromString(m->engine()->current, ToString(t)); } void DatePrototype::init(ExecutionContext *ctx, const Value &ctor) @@ -1306,7 +1306,7 @@ Value DatePrototype::method_toJSON(SimpleCallContext *ctx) if (!toIso) ctx->throwTypeError(); - return toIso->call(ctx, ctx->thisObject, 0, 0); + return toIso->call(ctx->thisObject, 0, 0); } void DatePrototype::timezoneUpdated() diff --git a/src/qml/qml/v4/qv4dateobject_p.h b/src/qml/qml/v4/qv4dateobject_p.h index d58d5bd15f..b8688dfade 100644 --- a/src/qml/qml/v4/qv4dateobject_p.h +++ b/src/qml/qml/v4/qv4dateobject_p.h @@ -64,7 +64,7 @@ struct DateCtor: FunctionObject DateCtor(ExecutionContext *scope); static Value construct(Managed *, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; diff --git a/src/qml/qml/v4/qv4errorobject.cpp b/src/qml/qml/v4/qv4errorobject.cpp index bee8f5c9ba..eb34ed6d53 100644 --- a/src/qml/qml/v4/qv4errorobject.cpp +++ b/src/qml/qml/v4/qv4errorobject.cpp @@ -240,7 +240,7 @@ Value ErrorCtor::construct(Managed *m, Value *args, int argc) return Value::fromObject(m->engine()->newErrorObject(argc ? args[0] : Value::undefinedValue())); } -Value ErrorCtor::call(Managed *that, ExecutionContext *ctx, const Value &, Value *args, int argc) +Value ErrorCtor::call(Managed *that, const Value &, Value *args, int argc) { return that->construct(args, argc); } diff --git a/src/qml/qml/v4/qv4errorobject_p.h b/src/qml/qml/v4/qv4errorobject_p.h index 774e9e8981..21c3c63537 100644 --- a/src/qml/qml/v4/qv4errorobject_p.h +++ b/src/qml/qml/v4/qv4errorobject_p.h @@ -120,7 +120,7 @@ struct ErrorCtor: FunctionObject ErrorCtor(ExecutionContext *scope, String *name); static Value construct(Managed *, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; diff --git a/src/qml/qml/v4/qv4functionobject.cpp b/src/qml/qml/v4/qv4functionobject.cpp index 96ea4eebe7..74118a9f3c 100644 --- a/src/qml/qml/v4/qv4functionobject.cpp +++ b/src/qml/qml/v4/qv4functionobject.cpp @@ -134,7 +134,7 @@ Value FunctionObject::construct(Managed *that, Value *, int) return Value::fromObject(obj); } -Value FunctionObject::call(Managed *, ExecutionContext *, const Value &, Value *, int) +Value FunctionObject::call(Managed *, const Value &, Value *, int) { return Value::undefinedValue(); } @@ -213,7 +213,7 @@ Value FunctionCtor::construct(Managed *that, Value *args, int argc) } // 15.3.1: This is equivalent to new Function(...) -Value FunctionCtor::call(Managed *that, ExecutionContext *context, const Value &thisObject, Value *args, int argc) +Value FunctionCtor::call(Managed *that, const Value &, Value *args, int argc) { return construct(that, args, argc); } @@ -268,7 +268,7 @@ Value FunctionPrototype::method_apply(SimpleCallContext *ctx) if (!o) ctx->throwTypeError(); - return o->call(ctx, thisArg, args.data(), args.size()); + return o->call(thisArg, args.data(), args.size()); } Value FunctionPrototype::method_call(SimpleCallContext *ctx) @@ -284,7 +284,7 @@ Value FunctionPrototype::method_call(SimpleCallContext *ctx) if (!o) ctx->throwTypeError(); - return o->call(ctx, thisArg, args.data(), args.size()); + return o->call(thisArg, args.data(), args.size()); } Value FunctionPrototype::method_bind(SimpleCallContext *ctx) @@ -377,16 +377,17 @@ Value ScriptFunction::construct(Managed *that, Value *args, int argc) return Value::fromObject(obj); } -Value ScriptFunction::call(Managed *that, ExecutionContext *context, const Value &thisObject, Value *args, int argc) +Value ScriptFunction::call(Managed *that, const Value &thisObject, Value *args, int argc) { ScriptFunction *f = static_cast<ScriptFunction *>(that); assert(f->function->code); quintptr stackSpace[stackContextSize/sizeof(quintptr)]; - ExecutionContext *ctx = context->engine->newCallContext(stackSpace, f, thisObject, args, argc); + ExecutionContext *context = f->engine()->current; + ExecutionContext *ctx = f->engine()->newCallContext(stackSpace, f, thisObject, args, argc); if (!f->strictMode && !thisObject.isObject()) { if (thisObject.isUndefined() || thisObject.isNull()) { - ctx->thisObject = Value::fromObject(context->engine->globalObject); + ctx->thisObject = Value::fromObject(f->engine()->globalObject); } else { ctx->thisObject = Value::fromObject(thisObject.toObject(context)); } @@ -421,16 +422,19 @@ Value BuiltinFunctionOld::construct(Managed *f, Value *, int) return Value::undefinedValue(); } -Value BuiltinFunctionOld::call(Managed *that, ExecutionContext *context, const Value &thisObject, Value *args, int argc) +Value BuiltinFunctionOld::call(Managed *that, const Value &thisObject, Value *args, int argc) { BuiltinFunctionOld *f = static_cast<BuiltinFunctionOld *>(that); + ExecutionEngine *v4 = f->engine(); + ExecutionContext *context = v4->current; + SimpleCallContext ctx; ctx.initSimpleCallContext(f->scope->engine); ctx.strictMode = f->scope->strictMode; // ### needed? scope or parent context? ctx.thisObject = thisObject; ctx.arguments = args; ctx.argumentCount = argc; - context->engine->pushContext(&ctx); + v4->pushContext(&ctx); if (!f->strictMode && !thisObject.isObject()) { // Built-in functions allow for the this object to be null or undefined. This overrides @@ -452,9 +456,11 @@ Value BuiltinFunctionOld::call(Managed *that, ExecutionContext *context, const V return result; } -Value IndexedBuiltinFunction::call(Managed *that, ExecutionContext *context, const Value &thisObject, Value *args, int argc) +Value IndexedBuiltinFunction::call(Managed *that, const Value &thisObject, Value *args, int argc) { IndexedBuiltinFunction *f = static_cast<IndexedBuiltinFunction *>(that); + ExecutionEngine *v4 = f->engine(); + ExecutionContext *context = v4->current; SimpleCallContext ctx; ctx.initSimpleCallContext(f->scope->engine); @@ -462,7 +468,7 @@ Value IndexedBuiltinFunction::call(Managed *that, ExecutionContext *context, con ctx.thisObject = thisObject; ctx.arguments = args; ctx.argumentCount = argc; - context->engine->pushContext(&ctx); + v4->pushContext(&ctx); if (!f->strictMode && !thisObject.isObject()) { // Built-in functions allow for the this object to be null or undefined. This overrides @@ -512,14 +518,14 @@ void BoundFunction::destroy(Managed *that) static_cast<BoundFunction *>(that)->~BoundFunction(); } -Value BoundFunction::call(Managed *that, ExecutionContext *context, const Value &, Value *args, int argc) +Value BoundFunction::call(Managed *that, const Value &, Value *args, int argc) { BoundFunction *f = static_cast<BoundFunction *>(that); Value *newArgs = static_cast<Value *>(alloca(sizeof(Value)*(f->boundArgs.size() + argc))); memcpy(newArgs, f->boundArgs.constData(), f->boundArgs.size()*sizeof(Value)); memcpy(newArgs + f->boundArgs.size(), args, argc*sizeof(Value)); - return f->target->call(context, f->boundThis, newArgs, f->boundArgs.size() + argc); + return f->target->call(f->boundThis, newArgs, f->boundArgs.size() + argc); } Value BoundFunction::construct(Managed *that, Value *args, int argc) diff --git a/src/qml/qml/v4/qv4functionobject_p.h b/src/qml/qml/v4/qv4functionobject_p.h index 9616052422..958803dc70 100644 --- a/src/qml/qml/v4/qv4functionobject_p.h +++ b/src/qml/qml/v4/qv4functionobject_p.h @@ -115,15 +115,12 @@ struct Q_QML_EXPORT FunctionObject: Object { Value newInstance(); static Value construct(Managed *that, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); inline Value construct(Value *args, int argc) { return vtbl->construct(this, args, argc); } - inline Value call(ExecutionContext *context, const Value &thisObject, Value *args, int argc) { - return vtbl->call(this, context, thisObject, args, argc); - } inline Value call(const Value &thisObject, Value *args, int argc) { - return vtbl->call(this, engine()->current, thisObject, args, argc); + return vtbl->call(this, thisObject, args, argc); } protected: @@ -137,7 +134,7 @@ struct FunctionCtor: FunctionObject FunctionCtor(ExecutionContext *scope); static Value construct(Managed *that, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; @@ -160,7 +157,7 @@ struct BuiltinFunctionOld: FunctionObject { BuiltinFunctionOld(ExecutionContext *scope, String *name, Value (*code)(SimpleCallContext *)); static Value construct(Managed *, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; @@ -188,7 +185,7 @@ struct IndexedBuiltinFunction: FunctionObject return Value::undefinedValue(); } - static Value call(Managed *that, ExecutionContext *ctx, const Value &thisObject, Value *args, int argc); + static Value call(Managed *that, const Value &thisObject, Value *args, int argc); }; @@ -196,7 +193,7 @@ struct ScriptFunction: FunctionObject { ScriptFunction(ExecutionContext *scope, Function *function); static Value construct(Managed *, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; @@ -212,7 +209,7 @@ struct BoundFunction: FunctionObject { static Value construct(Managed *, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); static const ManagedVTable static_vtbl; static void destroy(Managed *); diff --git a/src/qml/qml/v4/qv4globalobject.cpp b/src/qml/qml/v4/qv4globalobject.cpp index 0d4da29e2a..6c72db018c 100644 --- a/src/qml/qml/v4/qv4globalobject.cpp +++ b/src/qml/qml/v4/qv4globalobject.cpp @@ -352,11 +352,12 @@ EvalFunction::EvalFunction(ExecutionContext *scope) defineReadonlyProperty(scope->engine->id_length, Value::fromInt32(1)); } -Value EvalFunction::evalCall(ExecutionContext *parentContext, Value /*thisObject*/, Value *args, int argc, bool directCall) +Value EvalFunction::evalCall(Value /*thisObject*/, Value *args, int argc, bool directCall) { if (argc < 1) return Value::undefinedValue(); + ExecutionContext *parentContext = engine()->current; ExecutionEngine *engine = parentContext->engine; ExecutionContext *ctx = parentContext; @@ -421,10 +422,10 @@ Value EvalFunction::evalCall(ExecutionContext *parentContext, Value /*thisObject } -Value EvalFunction::call(Managed *that, ExecutionContext *context, const Value &thisObject, Value *args, int argc) +Value EvalFunction::call(Managed *that, const Value &thisObject, Value *args, int argc) { // indirect call - return static_cast<EvalFunction *>(that)->evalCall(context, thisObject, args, argc, false); + return static_cast<EvalFunction *>(that)->evalCall(thisObject, args, argc, false); } diff --git a/src/qml/qml/v4/qv4globalobject_p.h b/src/qml/qml/v4/qv4globalobject_p.h index b1abc212e6..7af403070a 100644 --- a/src/qml/qml/v4/qv4globalobject_p.h +++ b/src/qml/qml/v4/qv4globalobject_p.h @@ -52,10 +52,10 @@ struct Q_QML_EXPORT EvalFunction : FunctionObject { EvalFunction(ExecutionContext *scope); - Value evalCall(ExecutionContext *context, Value thisObject, Value *args, int argc, bool directCall); + Value evalCall(Value thisObject, Value *args, int argc, bool directCall); using Managed::construct; - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; diff --git a/src/qml/qml/v4/qv4jsonobject.cpp b/src/qml/qml/v4/qv4jsonobject.cpp index b4ecbb9534..4aa515ce46 100644 --- a/src/qml/qml/v4/qv4jsonobject.cpp +++ b/src/qml/qml/v4/qv4jsonobject.cpp @@ -703,7 +703,7 @@ QString Stringify::Str(const QString &key, Value value) FunctionObject *toJSON = o->get(ctx->engine->newString(QStringLiteral("toJSON"))).asFunctionObject(); if (toJSON) { Value arg = Value::fromString(ctx, key); - value = toJSON->call(ctx, value, &arg, 1); + value = toJSON->call(value, &arg, 1); } } @@ -714,7 +714,7 @@ QString Stringify::Str(const QString &key, Value value) Value args[2]; args[0] = Value::fromString(ctx, key); args[1] = value; - value = replacerFunction->call(ctx, holderValue, args, 2); + value = replacerFunction->call(holderValue, args, 2); } if (Object *o = value.asObject()) { diff --git a/src/qml/qml/v4/qv4lookup.cpp b/src/qml/qml/v4/qv4lookup.cpp index 305d1ea44a..45bdd811fa 100644 --- a/src/qml/qml/v4/qv4lookup.cpp +++ b/src/qml/qml/v4/qv4lookup.cpp @@ -160,7 +160,7 @@ void Lookup::getterAccessor0(Lookup *l, Value *result, const Value &object) if (!getter) res = Value::undefinedValue(); else - res = getter->call(getter->engine()->current, object, 0, 0); + res = getter->call(object, 0, 0); if (result) *result = res; return; @@ -180,7 +180,7 @@ void Lookup::getterAccessor1(Lookup *l, Value *result, const Value &object) if (!getter) res = Value::undefinedValue(); else - res = getter->call(getter->engine()->current, object, 0, 0); + res = getter->call(object, 0, 0); if (result) *result = res; return; @@ -203,7 +203,7 @@ void Lookup::getterAccessor2(Lookup *l, Value *result, const Value &object) if (!getter) res = Value::undefinedValue(); else - res = getter->call(getter->engine()->current, object, 0, 0); + res = getter->call(object, 0, 0); if (result) *result = res; return; @@ -295,7 +295,7 @@ void Lookup::globalGetterAccessor0(Lookup *l, ExecutionContext *ctx, Value *resu if (!getter) *result = Value::undefinedValue(); else - *result = getter->call(ctx, Value::undefinedValue(), 0, 0); + *result = getter->call(Value::undefinedValue(), 0, 0); return; } l->globalGetter = globalGetterGeneric; @@ -311,7 +311,7 @@ void Lookup::globalGetterAccessor1(Lookup *l, ExecutionContext *ctx, Value *resu if (!getter) *result = Value::undefinedValue(); else - *result = getter->call(ctx, Value::undefinedValue(), 0, 0); + *result = getter->call(Value::undefinedValue(), 0, 0); return; } l->globalGetter = globalGetterGeneric; @@ -330,7 +330,7 @@ void Lookup::globalGetterAccessor2(Lookup *l, ExecutionContext *ctx, Value *resu if (!getter) *result = Value::undefinedValue(); else - *result = getter->call(ctx, Value::undefinedValue(), 0, 0); + *result = getter->call(Value::undefinedValue(), 0, 0); return; } } diff --git a/src/qml/qml/v4/qv4managed.cpp b/src/qml/qml/v4/qv4managed.cpp index 545f88b112..b55fe004e9 100644 --- a/src/qml/qml/v4/qv4managed.cpp +++ b/src/qml/qml/v4/qv4managed.cpp @@ -181,9 +181,9 @@ Value Managed::construct(Managed *m, Value *, int) m->engine()->current->throwTypeError(); } -Value Managed::call(Managed *, ExecutionContext *context, const Value &, Value *, int) +Value Managed::call(Managed *m, const Value &, Value *, int) { - context->throwTypeError(); + m->engine()->current->throwTypeError(); } void Managed::getLookup(Managed *m, Lookup *, Value *) diff --git a/src/qml/qml/v4/qv4managed_p.h b/src/qml/qml/v4/qv4managed_p.h index 39b7f0c627..627f0bb032 100644 --- a/src/qml/qml/v4/qv4managed_p.h +++ b/src/qml/qml/v4/qv4managed_p.h @@ -99,7 +99,7 @@ struct GCDeletable struct ManagedVTable { - Value (*call)(Managed *, ExecutionContext *context, const Value &thisObject, Value *args, int argc); + Value (*call)(Managed *, const Value &thisObject, Value *args, int argc); Value (*construct)(Managed *, Value *args, int argc); void (*markObjects)(Managed *); void (*destroy)(Managed *); @@ -261,7 +261,7 @@ public: return vtbl->hasInstance(this, v); } Value construct(Value *args, int argc); - Value call(ExecutionContext *context, const Value &thisObject, Value *args, int argc); + Value call(const Value &thisObject, Value *args, int argc); Value get(String *name, bool *hasProperty = 0); Value getIndexed(uint index, bool *hasProperty = 0); void put(String *name, const Value &value) @@ -290,7 +290,7 @@ public: static void destroy(Managed *that) { that->_data = 0; } static bool hasInstance(Managed *that, const Value &value); static Value construct(Managed *m, Value *, int); - static Value call(Managed *, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *m, const Value &, Value *, int); static void getLookup(Managed *m, Lookup *, Value *); static void setLookup(Managed *m, Lookup *l, const Value &v); static bool isEqualTo(Managed *m, Managed *other); diff --git a/src/qml/qml/v4/qv4numberobject.cpp b/src/qml/qml/v4/qv4numberobject.cpp index 2e5ed497a6..410377d736 100644 --- a/src/qml/qml/v4/qv4numberobject.cpp +++ b/src/qml/qml/v4/qv4numberobject.cpp @@ -62,7 +62,7 @@ Value NumberCtor::construct(Managed *m, Value *args, int argc) return Value::fromObject(m->engine()->newNumberObject(Value::fromDouble(d))); } -Value NumberCtor::call(Managed *m, ExecutionContext *parentCtx, const Value &thisObject, Value *argv, int argc) +Value NumberCtor::call(Managed *, const Value &, Value *argv, int argc) { double d = argc ? argv[0].toNumber() : 0.; return Value::fromDouble(d); diff --git a/src/qml/qml/v4/qv4numberobject_p.h b/src/qml/qml/v4/qv4numberobject_p.h index 2cc3c0bc98..57853a9cd0 100644 --- a/src/qml/qml/v4/qv4numberobject_p.h +++ b/src/qml/qml/v4/qv4numberobject_p.h @@ -54,7 +54,7 @@ struct NumberCtor: FunctionObject NumberCtor(ExecutionContext *scope); static Value construct(Managed *that, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; diff --git a/src/qml/qml/v4/qv4object.cpp b/src/qml/qml/v4/qv4object.cpp index 967dcb2afb..5ba1873d37 100644 --- a/src/qml/qml/v4/qv4object.cpp +++ b/src/qml/qml/v4/qv4object.cpp @@ -139,7 +139,7 @@ Value Object::getValue(const Value &thisObject, const Property *p, PropertyAttri if (!getter) return Value::undefinedValue(); - return getter->call(getter->engine()->current, thisObject, 0, 0); + return getter->call(thisObject, 0, 0); } void Object::putValue(Property *pd, PropertyAttributes attrs, const Value &value) @@ -148,7 +148,7 @@ void Object::putValue(Property *pd, PropertyAttributes attrs, const Value &value if (pd->set) { Value args[1]; args[0] = value; - pd->set->call(engine()->current, Value::fromObject(this), args, 1); + pd->set->call(Value::fromObject(this), args, 1); return; } goto reject; @@ -706,7 +706,7 @@ void Object::internalPut(String *name, const Value &value) Value args[1]; args[0] = value; - pd->setter()->call(engine()->current, Value::fromObject(this), args, 1); + pd->setter()->call(Value::fromObject(this), args, 1); return; } @@ -783,7 +783,7 @@ void Object::internalPutIndexed(uint index, const Value &value) Value args[1]; args[0] = value; - pd->setter()->call(engine()->current, Value::fromObject(this), args, 1); + pd->setter()->call(Value::fromObject(this), args, 1); return; } diff --git a/src/qml/qml/v4/qv4objectproto.cpp b/src/qml/qml/v4/qv4objectproto.cpp index b1d1a9e895..c7af2657c2 100644 --- a/src/qml/qml/v4/qv4objectproto.cpp +++ b/src/qml/qml/v4/qv4objectproto.cpp @@ -93,11 +93,11 @@ Value ObjectCtor::construct(Managed *that, Value *args, int argc) return __qmljs_to_object(v4->current, args[0]); } -Value ObjectCtor::call(Managed *, ExecutionContext *ctx, const Value &/*thisObject*/, Value *args, int argc) +Value ObjectCtor::call(Managed *m, const Value &/*thisObject*/, Value *args, int argc) { if (!argc || args[0].isUndefined() || args[0].isNull()) - return Value::fromObject(ctx->engine->newObject()); - return __qmljs_to_object(ctx, args[0]); + return Value::fromObject(m->engine()->newObject()); + return __qmljs_to_object(m->engine()->current, args[0]); } void ObjectPrototype::init(ExecutionContext *ctx, const Value &ctor) @@ -386,7 +386,7 @@ Value ObjectPrototype::method_toLocaleString(SimpleCallContext *ctx) FunctionObject *f = ts.asFunctionObject(); if (!f) ctx->throwTypeError(); - return f->call(ctx, Value::fromObject(o), 0, 0); + return f->call(Value::fromObject(o), 0, 0); } Value ObjectPrototype::method_valueOf(SimpleCallContext *ctx) diff --git a/src/qml/qml/v4/qv4objectproto_p.h b/src/qml/qml/v4/qv4objectproto_p.h index e16f554f35..123bbb4fb4 100644 --- a/src/qml/qml/v4/qv4objectproto_p.h +++ b/src/qml/qml/v4/qv4objectproto_p.h @@ -54,7 +54,7 @@ struct ObjectCtor: FunctionObject ObjectCtor(ExecutionContext *scope); static Value construct(Managed *that, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; diff --git a/src/qml/qml/v4/qv4qobjectwrapper.cpp b/src/qml/qml/v4/qv4qobjectwrapper.cpp index 2cb6a36afd..42b057c48d 100644 --- a/src/qml/qml/v4/qv4qobjectwrapper.cpp +++ b/src/qml/qml/v4/qv4qobjectwrapper.cpp @@ -715,7 +715,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase } try { - f->call(v4->current, This->thisObject.isEmpty() ? Value::fromObject(v4->globalObject) : This->thisObject.value(), args.data(), argCount); + f->call(This->thisObject.isEmpty() ? Value::fromObject(v4->globalObject) : This->thisObject.value(), args.data(), argCount); } catch (QV4::Exception &e) { e.accept(ctx); QQmlError error; @@ -1689,14 +1689,15 @@ QV4::Value QObjectMethod::method_destroy(QV4::ExecutionContext *ctx, Value *args return QV4::Value::undefinedValue(); } -Value QObjectMethod::call(Managed *m, ExecutionContext *context, const Value &thisObject, Value *args, int argc) +Value QObjectMethod::call(Managed *m, const Value &thisObject, Value *args, int argc) { QObjectMethod *This = static_cast<QObjectMethod*>(m); - return This->callInternal(context, thisObject, args, argc); + return This->callInternal(thisObject, args, argc); } -Value QObjectMethod::callInternal(ExecutionContext *context, const Value &thisObject, Value *args, int argc) +Value QObjectMethod::callInternal(const Value &, Value *args, int argc) { + ExecutionContext *context = engine()->current; if (m_index == DestroyMethod) return method_destroy(context, args, argc); else if (m_index == ToStringMethod) diff --git a/src/qml/qml/v4/qv4qobjectwrapper_p.h b/src/qml/qml/v4/qv4qobjectwrapper_p.h index 708c2a784c..73f19acb3f 100644 --- a/src/qml/qml/v4/qv4qobjectwrapper_p.h +++ b/src/qml/qml/v4/qv4qobjectwrapper_p.h @@ -141,9 +141,9 @@ private: int m_index; QV4::PersistentValue m_qmlGlobal; - static Value call(Managed *, ExecutionContext *context, const Value &thisObject, Value *args, int argc); + static Value call(Managed *, const Value &thisObject, Value *args, int argc); - Value callInternal(ExecutionContext *context, const Value &thisObject, Value *args, int argc); + Value callInternal(const Value &, Value *args, int argc); static void destroy(Managed *that) { diff --git a/src/qml/qml/v4/qv4regexpobject.cpp b/src/qml/qml/v4/qv4regexpobject.cpp index a346f9e013..009fa5c781 100644 --- a/src/qml/qml/v4/qv4regexpobject.cpp +++ b/src/qml/qml/v4/qv4regexpobject.cpp @@ -262,7 +262,7 @@ Value RegExpCtor::construct(Managed *m, Value *argv, int argc) return Value::fromObject(o); } -Value RegExpCtor::call(Managed *that, ExecutionContext *ctx, const Value &thisObject, Value *argv, int argc) +Value RegExpCtor::call(Managed *that, const Value &, Value *argv, int argc) { if (argc > 0 && argv[0].as<RegExpObject>()) { if (argc == 1 || argv[1].isUndefined()) diff --git a/src/qml/qml/v4/qv4regexpobject_p.h b/src/qml/qml/v4/qv4regexpobject_p.h index 7fb520cca7..a06b222fd6 100644 --- a/src/qml/qml/v4/qv4regexpobject_p.h +++ b/src/qml/qml/v4/qv4regexpobject_p.h @@ -99,7 +99,7 @@ struct RegExpCtor: FunctionObject RegExpCtor(ExecutionContext *scope); static Value construct(Managed *m, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; diff --git a/src/qml/qml/v4/qv4runtime.cpp b/src/qml/qml/v4/qv4runtime.cpp index 22e43ca55f..70137ad12a 100644 --- a/src/qml/qml/v4/qv4runtime.cpp +++ b/src/qml/qml/v4/qv4runtime.cpp @@ -471,14 +471,14 @@ Value __qmljs_object_default_value(Object *object, int typeHint) Value conv = object->get(meth1); if (FunctionObject *o = conv.asFunctionObject()) { - Value r = o->call(ctx, Value::fromObject(object), 0, 0); + Value r = o->call(Value::fromObject(object), 0, 0); if (r.isPrimitive()) return r; } conv = object->get(meth2); if (FunctionObject *o = conv.asFunctionObject()) { - Value r = o->call(ctx, Value::fromObject(object), 0, 0); + Value r = o->call(Value::fromObject(object), 0, 0); if (r.isPrimitive()) return r; } @@ -627,7 +627,7 @@ void __qmljs_set_element(ExecutionContext *ctx, const Value &object, const Value Value args[1]; args[0] = value; - setter->call(ctx, Value::fromObject(o), args, 1); + setter->call(Value::fromObject(o), args, 1); return; } } @@ -770,13 +770,13 @@ void __qmljs_call_global_lookup(ExecutionContext *context, Value *result, uint i Value thisObject = Value::undefinedValue(); if (o == context->engine->evalFunction && l->name->isEqualTo(context->engine->id_eval)) { - Value res = static_cast<EvalFunction *>(o)->evalCall(context, thisObject, args, argc, true); + Value res = static_cast<EvalFunction *>(o)->evalCall(thisObject, args, argc, true); if (result) *result = res; return; } - Value res = o->call(context, thisObject, args, argc); + Value res = o->call(thisObject, args, argc); if (result) *result = res; } @@ -798,13 +798,13 @@ void __qmljs_call_activation_property(ExecutionContext *context, Value *result, Value thisObject = base ? Value::fromObject(base) : Value::undefinedValue(); if (o == context->engine->evalFunction && name->isEqualTo(context->engine->id_eval)) { - Value res = static_cast<EvalFunction *>(o)->evalCall(context, thisObject, args, argc, true); + Value res = static_cast<EvalFunction *>(o)->evalCall(thisObject, args, argc, true); if (result) *result = res; return; } - Value res = o->call(context, thisObject, args, argc); + Value res = o->call(thisObject, args, argc); if (result) *result = res; } @@ -825,7 +825,7 @@ void __qmljs_call_property(ExecutionContext *context, Value *result, const Value context->throwTypeError(error); } - Value res = o->call(context, thisObject, args, argc); + Value res = o->call(thisObject, args, argc); if (result) *result = res; } @@ -851,7 +851,7 @@ void __qmljs_call_property_lookup(ExecutionContext *context, Value *result, cons if (!o) context->throwTypeError(); - Value res = o->call(context, thisObject, args, argc); + Value res = o->call(thisObject, args, argc); if (result) *result = res; } @@ -866,7 +866,7 @@ void __qmljs_call_element(ExecutionContext *context, Value *result, const Value if (!o) context->throwTypeError(); - Value res = o->call(context, thisObject, args, argc); + Value res = o->call(thisObject, args, argc); if (result) *result = res; } @@ -876,7 +876,7 @@ void __qmljs_call_value(ExecutionContext *context, Value *result, const Value *t Object *o = func.asObject(); if (!o) context->throwTypeError(); - Value res = o->call(context, thisObject ? *thisObject : Value::undefinedValue(), args, argc); + Value res = o->call(thisObject ? *thisObject : Value::undefinedValue(), args, argc); if (result) *result = res; } diff --git a/src/qml/qml/v4/qv4script.cpp b/src/qml/qml/v4/qv4script.cpp index 1a0e392417..2d47ae65a4 100644 --- a/src/qml/qml/v4/qv4script.cpp +++ b/src/qml/qml/v4/qv4script.cpp @@ -71,7 +71,7 @@ struct QmlBindingWrapper : FunctionObject defineReadonlyProperty(scope->engine->id_length, Value::fromInt32(1)); } - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); static void markObjects(Managed *m) { QmlBindingWrapper *wrapper = static_cast<QmlBindingWrapper*>(m); @@ -89,9 +89,9 @@ private: DEFINE_MANAGED_VTABLE(QmlBindingWrapper); -Value QmlBindingWrapper::call(Managed *that, ExecutionContext *ctx, const Value &, Value *, int) +Value QmlBindingWrapper::call(Managed *that, const Value &, Value *, int) { - ExecutionEngine *engine = ctx->engine; + ExecutionEngine *engine = that->engine(); QmlBindingWrapper *This = static_cast<QmlBindingWrapper *>(that); ExecutionContext *qmlScope = engine->newQmlContext(This, This->qml); diff --git a/src/qml/qml/v4/qv4sequenceobject.cpp b/src/qml/qml/v4/qv4sequenceobject.cpp index f4758c6f25..4cebe960e3 100644 --- a/src/qml/qml/v4/qv4sequenceobject.cpp +++ b/src/qml/qml/v4/qv4sequenceobject.cpp @@ -365,7 +365,7 @@ public: convertElementToValue(this->m_ctx->engine, lhs), convertElementToValue(this->m_ctx->engine, rhs) }; - QV4::Value result = fun->call(this->m_ctx, QV4::Value::fromObject(this->m_ctx->engine->globalObject), argv, 2); + QV4::Value result = fun->call(QV4::Value::fromObject(this->m_ctx->engine->globalObject), argv, 2); return result.toNumber() < 0; } diff --git a/src/qml/qml/v4/qv4stringobject.cpp b/src/qml/qml/v4/qv4stringobject.cpp index 8845e63f2b..28012a8918 100644 --- a/src/qml/qml/v4/qv4stringobject.cpp +++ b/src/qml/qml/v4/qv4stringobject.cpp @@ -159,13 +159,13 @@ Value StringCtor::construct(Managed *m, Value *argv, int argc) return Value::fromObject(m->engine()->newStringObject(value)); } -Value StringCtor::call(Managed *, ExecutionContext *parentCtx, const Value &thisObject, Value *argv, int argc) +Value StringCtor::call(Managed *m, const Value &, Value *argv, int argc) { Value value; if (argc) - value = Value::fromString(argv[0].toString(parentCtx)); + value = Value::fromString(argv[0].toString(m->engine()->current)); else - value = Value::fromString(parentCtx, QString()); + value = Value::fromString(m->engine()->current, QString()); return value; } @@ -355,7 +355,7 @@ Value StringPrototype::method_match(SimpleCallContext *context) Value arg = Value::fromString(s); if (!global) - return exec->call(context, Value::fromObject(rx), &arg, 1); + return exec->call(Value::fromObject(rx), &arg, 1); String *lastIndex = context->engine->newString(QStringLiteral("lastIndex")); rx->put(lastIndex, Value::fromInt32(0)); @@ -364,7 +364,7 @@ Value StringPrototype::method_match(SimpleCallContext *context) double previousLastIndex = 0; uint n = 0; while (1) { - Value result = exec->call(context, Value::fromObject(rx), &arg, 1); + Value result = exec->call(Value::fromObject(rx), &arg, 1); if (result.isNull()) break; assert(result.isObject()); @@ -494,7 +494,7 @@ Value StringPrototype::method_replace(SimpleCallContext *ctx) uint matchEnd = matchOffsets[i * numCaptures * 2 + 1]; args[numCaptures] = Value::fromUInt32(matchStart); args[numCaptures + 1] = Value::fromString(ctx, string); - Value replacement = searchCallback->call(ctx, Value::undefinedValue(), args, argc); + Value replacement = searchCallback->call(Value::undefinedValue(), args, argc); QString replacementString = replacement.toString(ctx)->toQString(); result.replace(replacementDelta + matchStart, matchEnd - matchStart, replacementString); replacementDelta += replacementString.length() - matchEnd + matchStart; diff --git a/src/qml/qml/v4/qv4stringobject_p.h b/src/qml/qml/v4/qv4stringobject_p.h index 1a7a466b92..856b97dc83 100644 --- a/src/qml/qml/v4/qv4stringobject_p.h +++ b/src/qml/qml/v4/qv4stringobject_p.h @@ -70,7 +70,7 @@ struct StringCtor: FunctionObject StringCtor(ExecutionContext *scope); static Value construct(Managed *m, Value *args, int argc); - static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int); + static Value call(Managed *that, const Value &, Value *, int); protected: static const ManagedVTable static_vtbl; diff --git a/src/qml/qml/v4/qv4value_p.h b/src/qml/qml/v4/qv4value_p.h index 2441a9a34e..193796af60 100644 --- a/src/qml/qml/v4/qv4value_p.h +++ b/src/qml/qml/v4/qv4value_p.h @@ -556,8 +556,8 @@ inline ErrorObject *Value::asErrorObject() const inline Value Managed::construct(Value *args, int argc) { return vtbl->construct(this, args, argc); } -inline Value Managed::call(ExecutionContext *context, const Value &thisObject, Value *args, int argc) { - return vtbl->call(this, context, thisObject, args, argc); +inline Value Managed::call(const Value &thisObject, Value *args, int argc) { + return vtbl->call(this, thisObject, args, argc); } struct PersistentValuePrivate diff --git a/src/qml/qml/v8/qjsvalue.cpp b/src/qml/qml/v8/qjsvalue.cpp index a21a1cc79a..ffbc469a76 100644 --- a/src/qml/qml/v8/qjsvalue.cpp +++ b/src/qml/qml/v8/qjsvalue.cpp @@ -516,7 +516,7 @@ QJSValue QJSValue::call(const QJSValueList &args) Value result; QV4::ExecutionContext *ctx = engine->current; try { - result = f->call(ctx, Value::fromObject(engine->globalObject), arguments.data(), arguments.size()); + result = f->call(Value::fromObject(engine->globalObject), arguments.data(), arguments.size()); } catch (Exception &e) { e.accept(ctx); result = e.value(); @@ -571,7 +571,7 @@ QJSValue QJSValue::callWithInstance(const QJSValue &instance, const QJSValueList Value result; QV4::ExecutionContext *ctx = engine->current; try { - result = f->call(ctx, instance.d->getValue(engine), arguments.data(), arguments.size()); + result = f->call(instance.d->getValue(engine), arguments.data(), arguments.size()); } catch (Exception &e) { e.accept(ctx); result = e.value(); diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index c8f7a64016..7c7ac124f0 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -1183,10 +1183,10 @@ struct BindingFunction : public QV4::FunctionObject bindingKeyFlag = true; } - static Value call(Managed *that, ExecutionContext *ctx, const Value &thisObject, Value *argv, int argc) + static Value call(Managed *that, const Value &thisObject, Value *argv, int argc) { BindingFunction *This = static_cast<BindingFunction*>(that); - return This->originalFunction->call(ctx, thisObject, argv, argc); + return This->originalFunction->call(thisObject, argv, argc); } static void markObjects(Managed *that) diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 0336a16eea..51605cead7 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -440,7 +440,7 @@ void QV8Engine::initializeGlobal() void QV8Engine::freezeObject(const QV4::Value &value) { QV4::Value args = value; - m_freezeObject.value().asFunctionObject()->call(m_v4Engine->rootContext, QV4::Value::fromObject(m_v4Engine->globalObject), &args, 1); + m_freezeObject.value().asFunctionObject()->call(QV4::Value::fromObject(m_v4Engine->globalObject), &args, 1); } void QV8Engine::gc() diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index bbac92a030..aa665e4283 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -81,12 +81,12 @@ struct DelegateModelGroupFunction: QV4::FunctionObject return QV4::Value::undefinedValue(); } - static QV4::Value call(QV4::Managed *that, QV4::ExecutionContext *ctx, const QV4::Value &thisObject, QV4::Value *args, int argc) + static QV4::Value call(QV4::Managed *that, const QV4::Value &thisObject, QV4::Value *args, int argc) { DelegateModelGroupFunction *f = static_cast<DelegateModelGroupFunction *>(that); QQmlDelegateModelItemObject *o = thisObject.as<QQmlDelegateModelItemObject>(); if (!o) - ctx->throwTypeError(QStringLiteral("Not a valid VisualData object")); + that->engine()->current->throwTypeError(QStringLiteral("Not a valid VisualData object")); QV4::Value v = argc ? args[0] : QV4::Value::undefinedValue(); return f->code(o->item, f->flag, v); diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index 35d504a8a2..e1ab6e64e4 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -246,7 +246,7 @@ QV4::Value QQuickWorkerScriptEnginePrivate::WorkerEngine::sendFunction(int id) QV4::Value v = QV4::Value::undefinedValue(); QV4::ExecutionContext *ctx = f->internalClass->engine->current; try { - v = f->call(ctx, global(), args, 1); + v = f->call(global(), args, 1); } catch (QV4::Exception &e) { e.accept(ctx); v = e.value(); @@ -348,7 +348,7 @@ void QQuickWorkerScriptEnginePrivate::processMessage(int id, const QByteArray &d QV4::FunctionObject *f = workerEngine->onmessage.value().asFunctionObject(); QV4::ExecutionContext *ctx = f->internalClass->engine->current; try { - workerEngine->onmessage.value().asFunctionObject()->call(f->internalClass->engine->current, workerEngine->global(), args, 2); + workerEngine->onmessage.value().asFunctionObject()->call(workerEngine->global(), args, 2); } catch (QV4::Exception &e) { e.accept(ctx); QQmlError error; diff --git a/tools/v4/main.cpp b/tools/v4/main.cpp index bc95178397..c4af264e90 100644 --- a/tools/v4/main.cpp +++ b/tools/v4/main.cpp @@ -82,13 +82,13 @@ struct Print: FunctionObject name = scope->engine->newString("print"); } - static Value call(Managed *, ExecutionContext *ctx, const Value &, Value *args, int argc) + static Value call(Managed *, const Value &, Value *args, int argc) { for (int i = 0; i < argc; ++i) { - String *s = args[i].toString(ctx); + QString s = args[i].toQString(); if (i) std::cout << ' '; - std::cout << qPrintable(s->toQString()); + std::cout << qPrintable(s); } std::cout << std::endl; return Value::undefinedValue(); @@ -107,9 +107,9 @@ struct GC: public FunctionObject vtbl = &static_vtbl; name = scope->engine->newString("gc"); } - static Value call(Managed *, ExecutionContext *ctx, const Value &, Value *, int) + static Value call(Managed *m, const Value &, Value *, int) { - ctx->engine->memoryManager->runGC(); + m->engine()->memoryManager->runGC(); return Value::undefinedValue(); } |