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();
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);
}
}
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);
}
}
This = value;
}
- result = function.asFunctionObject()->call(ctx, This, args, argc);
+ result = function.asFunctionObject()->call(This, args, argc);
if (isUndefined)
*isUndefined = result.isUndefined();
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
return Value::fromObject(w);
}
- static Value call(Managed *, ExecutionContext *, const Value &, Value *, int) {
+ static Value call(Managed *, const Value &, Value *, int) {
return Value::undefinedValue();
}
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;
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);
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();
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;
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;
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);
}
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);
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);
}
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();
}
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);
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;
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;
}
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;
}
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;
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);
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;
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)
if (!toIso)
ctx->throwTypeError();
- return toIso->call(ctx, ctx->thisObject, 0, 0);
+ return toIso->call(ctx->thisObject, 0, 0);
}
void DatePrototype::timezoneUpdated()
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;
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);
}
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;
return Value::fromObject(obj);
}
-Value FunctionObject::call(Managed *, ExecutionContext *, const Value &, Value *, int)
+Value FunctionObject::call(Managed *, const Value &, Value *, int)
{
return Value::undefinedValue();
}
}
// 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);
}
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)
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)
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));
}
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
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);
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
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)
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:
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;
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;
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);
};
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;
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 *);
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;
}
-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);
}
{
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;
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);
}
}
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()) {
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;
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;
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;
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;
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;
if (!getter)
*result = Value::undefinedValue();
else
- *result = getter->call(ctx, Value::undefinedValue(), 0, 0);
+ *result = getter->call(Value::undefinedValue(), 0, 0);
return;
}
}
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 *)
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 *);
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)
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);
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);
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;
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)
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;
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;
}
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;
}
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)
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)
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;
}
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;
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)
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)
{
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())
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;
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;
}
Value args[1];
args[0] = value;
- setter->call(ctx, Value::fromObject(o), args, 1);
+ setter->call(Value::fromObject(o), args, 1);
return;
}
}
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;
}
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;
}
context->throwTypeError(error);
}
- Value res = o->call(context, thisObject, args, argc);
+ Value res = o->call(thisObject, args, argc);
if (result)
*result = res;
}
if (!o)
context->throwTypeError();
- Value res = o->call(context, thisObject, args, argc);
+ Value res = o->call(thisObject, args, argc);
if (result)
*result = res;
}
if (!o)
context->throwTypeError();
- Value res = o->call(context, thisObject, args, argc);
+ Value res = o->call(thisObject, args, argc);
if (result)
*result = res;
}
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;
}
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);
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);
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;
}
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;
}
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));
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());
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;
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;
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
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();
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();
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)
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()
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);
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();
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;
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();
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();
}