Remove the context argument from Managed::call
authorLars Knoll <lars.knoll@digia.com>
Sat, 22 Jun 2013 08:02:06 +0000 (10:02 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Sat, 22 Jun 2013 20:28:33 +0000 (22:28 +0200)
Change-Id: I0895f9a94af47c8aab1dc93579921737e9516f7d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
42 files changed:
src/qml/qml/qqmlcomponent.cpp
src/qml/qml/qqmljavascriptexpression.cpp
src/qml/qml/qqmlxmlhttprequest.cpp
src/qml/qml/v4/qv4argumentsobject.cpp
src/qml/qml/v4/qv4argumentsobject_p.h
src/qml/qml/v4/qv4arrayobject.cpp
src/qml/qml/v4/qv4arrayobject_p.h
src/qml/qml/v4/qv4booleanobject.cpp
src/qml/qml/v4/qv4booleanobject_p.h
src/qml/qml/v4/qv4dateobject.cpp
src/qml/qml/v4/qv4dateobject_p.h
src/qml/qml/v4/qv4errorobject.cpp
src/qml/qml/v4/qv4errorobject_p.h
src/qml/qml/v4/qv4functionobject.cpp
src/qml/qml/v4/qv4functionobject_p.h
src/qml/qml/v4/qv4globalobject.cpp
src/qml/qml/v4/qv4globalobject_p.h
src/qml/qml/v4/qv4jsonobject.cpp
src/qml/qml/v4/qv4lookup.cpp
src/qml/qml/v4/qv4managed.cpp
src/qml/qml/v4/qv4managed_p.h
src/qml/qml/v4/qv4numberobject.cpp
src/qml/qml/v4/qv4numberobject_p.h
src/qml/qml/v4/qv4object.cpp
src/qml/qml/v4/qv4objectproto.cpp
src/qml/qml/v4/qv4objectproto_p.h
src/qml/qml/v4/qv4qobjectwrapper.cpp
src/qml/qml/v4/qv4qobjectwrapper_p.h
src/qml/qml/v4/qv4regexpobject.cpp
src/qml/qml/v4/qv4regexpobject_p.h
src/qml/qml/v4/qv4runtime.cpp
src/qml/qml/v4/qv4script.cpp
src/qml/qml/v4/qv4sequenceobject.cpp
src/qml/qml/v4/qv4stringobject.cpp
src/qml/qml/v4/qv4stringobject_p.h
src/qml/qml/v4/qv4value_p.h
src/qml/qml/v8/qjsvalue.cpp
src/qml/qml/v8/qqmlbuiltinfunctions.cpp
src/qml/qml/v8/qv8engine.cpp
src/qml/types/qqmldelegatemodel.cpp
src/qml/types/qquickworkerscript.cpp
tools/v4/main.cpp

index bfdce45..06f99ab 100644 (file)
@@ -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);
     }
 }
     
index 85f2f2a..2be4c57 100644 (file)
@@ -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();
index e1de67c..adb2a95 100644 (file)
@@ -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();
     }
 
index 914f219..b9e4733 100644 (file)
@@ -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();
index b1d5a53..24bc719 100644 (file)
@@ -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;
index 6f3f36a..4d59f0f 100644 (file)
@@ -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;
     }
index a1c9eb4..7736ccc 100644 (file)
@@ -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;
index 049f577..aaad175 100644 (file)
@@ -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);
index cffdf8a..0a52baa 100644 (file)
@@ -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;
index ab1c91a..8953148 100644 (file)
@@ -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()
index d58d5bd..b8688df 100644 (file)
@@ -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;
index bee8f5c..eb34ed6 100644 (file)
@@ -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);
 }
index 774e9e8..21c3c63 100644 (file)
@@ -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;
index 96ea4ee..74118a9 100644 (file)
@@ -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)
index 9616052..958803d 100644 (file)
@@ -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 *);
index 0d4da29..6c72db0 100644 (file)
@@ -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);
 }
 
 
index b1abc21..7af4030 100644 (file)
@@ -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;
index b4ecbb9..4aa515c 100644 (file)
@@ -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()) {
index 305d1ea..45bdd81 100644 (file)
@@ -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;
             }
         }
index 545f88b..b55fe00 100644 (file)
@@ -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 *)
index 39b7f0c..627f0bb 100644 (file)
@@ -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);
index 2e5ed49..410377d 100644 (file)
@@ -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);
index 2cc3c0b..57853a9 100644 (file)
@@ -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;
index 967dcb2..5ba1873 100644 (file)
@@ -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;
     }
 
index b1d1a9e..c7af265 100644 (file)
@@ -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)
index e16f554..123bbb4 100644 (file)
@@ -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;
index 2cb6a36..42b057c 100644 (file)
@@ -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)
index 708c2a7..73f19ac 100644 (file)
@@ -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)
     {
index a346f9e..009fa5c 100644 (file)
@@ -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())
index 7fb520c..a06b222 100644 (file)
@@ -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;
index 22e43ca..70137ad 100644 (file)
@@ -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;
 }
index 1a0e392..2d47ae6 100644 (file)
@@ -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);
index f4758c6..4cebe96 100644 (file)
@@ -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;
             }
 
index 8845e63..28012a8 100644 (file)
@@ -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;
index 1a7a466..856b97d 100644 (file)
@@ -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;
index 2441a9a..193796a 100644 (file)
@@ -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
index a21a1cc..ffbc469 100644 (file)
@@ -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();
index c8f7a64..7c7ac12 100644 (file)
@@ -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)
index 0336a16..51605ce 100644 (file)
@@ -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()
index bbac92a..aa665e4 100644 (file)
@@ -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);
index 35d504a..e1ab6e6 100644 (file)
@@ -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;
index bc95178..c4af264 100644 (file)
@@ -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();
     }