DEFINE_MANAGED_VTABLE(ArgumentsGetterFunction);
-Value ArgumentsGetterFunction::call(Managed *getter, const CallData &d)
+Value ArgumentsGetterFunction::call(Managed *getter, CallData *callData)
{
ArgumentsGetterFunction *g = static_cast<ArgumentsGetterFunction *>(getter);
- Object *that = d.thisObject.asObject();
+ Object *that = callData->thisObject.asObject();
if (!that)
getter->engine()->current->throwTypeError();
ArgumentsObject *o = that->asArgumentsObject();
DEFINE_MANAGED_VTABLE(ArgumentsSetterFunction);
-Value ArgumentsSetterFunction::call(Managed *setter, const CallData &d)
+Value ArgumentsSetterFunction::call(Managed *setter, CallData *callData)
{
ArgumentsSetterFunction *s = static_cast<ArgumentsSetterFunction *>(setter);
- Object *that = d.thisObject.asObject();
+ Object *that = callData->thisObject.asObject();
if (!that)
setter->engine()->current->throwTypeError();
ArgumentsObject *o = that->asArgumentsObject();
setter->engine()->current->throwTypeError();
assert(s->index < o->context->argumentCount);
- o->context->arguments[s->index] = d.argc ? d.args[0] : Value::undefinedValue();
+ o->context->arguments[s->index] = callData->argc ? callData->args[0] : Value::undefinedValue();
return Value::undefinedValue();
}
ArgumentsGetterFunction(ExecutionContext *scope, uint index)
: FunctionObject(scope), index(index) { vtbl = &static_vtbl; }
- static Value call(Managed *that, const CallData &d);
+ static Value call(Managed *that, CallData *d);
protected:
static const ManagedVTable static_vtbl;
ArgumentsSetterFunction(ExecutionContext *scope, uint index)
: FunctionObject(scope), index(index) { vtbl = &static_vtbl; }
- static Value call(Managed *that, const CallData &d);
+ static Value call(Managed *that, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
vtbl = &static_vtbl;
}
-Value ArrayCtor::construct(Managed *m, const CallData &d)
+Value ArrayCtor::construct(Managed *m, CallData *callData)
{
ExecutionEngine *v4 = m->engine();
ArrayObject *a = v4->newArrayObject();
uint len;
- if (d.argc == 1 && d.args[0].isNumber()) {
+ if (callData->argc == 1 && callData->args[0].isNumber()) {
bool ok;
- len = d.args[0].asArrayLength(&ok);
+ len = callData->args[0].asArrayLength(&ok);
if (!ok)
- v4->current->throwRangeError(d.args[0]);
+ v4->current->throwRangeError(callData->args[0]);
if (len < 0x1000)
a->arrayReserve(len);
} else {
- len = d.argc;
+ len = callData->argc;
a->arrayReserve(len);
for (unsigned int i = 0; i < len; ++i)
- a->arrayData[i].value = d.args[i];
+ a->arrayData[i].value = callData->args[i];
a->arrayDataLen = len;
}
a->setArrayLengthUnchecked(len);
return Value::fromObject(a);
}
-Value ArrayCtor::call(Managed *that, const CallData &d)
+Value ArrayCtor::call(Managed *that, CallData *callData)
{
- return construct(that, d);
+ return construct(that, callData);
}
ArrayPrototype::ArrayPrototype(InternalClass *ic)
{
ArrayCtor(ExecutionContext *scope);
- static Value construct(Managed *m, const CallData &d);
- static Value call(Managed *that, const CallData &d);
+ static Value construct(Managed *m, CallData *callData);
+ static Value call(Managed *that, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
vtbl = &static_vtbl;
}
-Value BooleanCtor::construct(Managed *m, const CallData &d)
+Value BooleanCtor::construct(Managed *m, CallData *callData)
{
- bool n = d.argc ? d.args[0].toBoolean() : false;
+ bool n = callData->argc ? callData->args[0].toBoolean() : false;
return Value::fromObject(m->engine()->newBooleanObject(Value::fromBoolean(n)));
}
-Value BooleanCtor::call(Managed *, const CallData &d)
+Value BooleanCtor::call(Managed *, CallData *callData)
{
- bool value = d.argc ? d.args[0].toBoolean() : 0;
+ bool value = callData->argc ? callData->args[0].toBoolean() : 0;
return Value::fromBoolean(value);
}
{
BooleanCtor(ExecutionContext *scope);
- static Value construct(Managed *, const CallData &d);
- static Value call(Managed *that, const CallData &d);
+ static Value construct(Managed *, CallData *callData);
+ static Value call(Managed *that, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
using namespace QV4;
-CallContext *ExecutionContext::newCallContext(void *stackSpace, FunctionObject *function, const CallData &d)
+CallContext *ExecutionContext::newCallContext(void *stackSpace, FunctionObject *function, CallData *callData)
{
CallContext *c = (CallContext *)stackSpace;
#ifndef QT_NO_DEBUG
c->function = function;
// ###
- c->arguments = const_cast<Value *>(d.args);
- c->realArgumentCount = d.argc;
- c->argumentCount = d.argc;
- c->thisObject = d.thisObject;
+ c->arguments = const_cast<Value *>(callData->args);
+ c->realArgumentCount = callData->argc;
+ c->argumentCount = callData->argc;
+ c->thisObject = callData->thisObject;
c->strictMode = function->strictMode;
c->marked = false;
if (function->varCount)
std::fill(c->locals, c->locals + function->varCount, Value::undefinedValue());
- if (d.argc < function->formalParameterCount) {
+ if (callData->argc < function->formalParameterCount) {
#ifndef QT_NO_DEBUG
Q_ASSERT(function->formalParameterCount <= QV4::Global::ReservedArgumentCount);
#endif
- std::fill(c->arguments + d.argc, c->arguments + function->formalParameterCount, Value::undefinedValue());
+ std::fill(c->arguments + callData->argc, c->arguments + function->formalParameterCount, Value::undefinedValue());
c->argumentCount = function->formalParameterCount;
}
return c;
}
-CallContext *ExecutionContext::newCallContext(FunctionObject *function, const CallData &d)
+CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData)
{
- CallContext *c = static_cast<CallContext *>(engine->memoryManager->allocContext(requiredMemoryForExecutionContect(function, d.argc)));
+ CallContext *c = static_cast<CallContext *>(engine->memoryManager->allocContext(requiredMemoryForExecutionContect(function, callData->argc)));
engine->current = c;
c->initBaseContext(Type_CallContext, engine, this);
c->function = function;
- c->realArgumentCount = d.argc;
- c->thisObject = d.thisObject;
+ c->realArgumentCount = callData->argc;
+ c->thisObject = callData->thisObject;
c->strictMode = function->strictMode;
c->marked = false;
if (function->varCount)
std::fill(c->locals, c->locals + function->varCount, Value::undefinedValue());
- c->argumentCount = qMax((uint)d.argc, function->formalParameterCount);
+ c->argumentCount = qMax((uint)callData->argc, function->formalParameterCount);
c->arguments = c->locals + function->varCount;
- if (d.argc)
- ::memcpy(c->arguments, d.args, d.argc * sizeof(Value));
- if (d.argc < function->formalParameterCount)
- std::fill(c->arguments + d.argc, c->arguments + function->formalParameterCount, Value::undefinedValue());
+ if (callData->argc)
+ ::memcpy(c->arguments, callData->args, callData->argc * sizeof(Value));
+ if (callData->argc < function->formalParameterCount)
+ std::fill(c->arguments + callData->argc, c->arguments + function->formalParameterCount, Value::undefinedValue());
return c;
}
interpreterInstructionPointer = 0;
}
- CallContext *newCallContext(void *stackSpace, FunctionObject *f, const CallData &d);
- CallContext *newCallContext(FunctionObject *f, const CallData &d);
+ CallContext *newCallContext(void *stackSpace, FunctionObject *f, CallData *callData);
+ CallContext *newCallContext(FunctionObject *f, CallData *callData);
WithContext *newWithContext(Object *with);
CatchContext *newCatchContext(String* exceptionVarName, const QV4::Value &exceptionValue);
CallContext *newQmlContext(FunctionObject *f, Object *qml);
vtbl = &static_vtbl;
}
-Value DateCtor::construct(Managed *m, const CallData &d)
+Value DateCtor::construct(Managed *m, CallData *callData)
{
double t = 0;
- if (d.argc == 0)
+ if (callData->argc == 0)
t = currentTime();
- else if (d.argc == 1) {
- Value arg = d.args[0];
+ else if (callData->argc == 1) {
+ Value arg = callData->args[0];
if (DateObject *d = arg.asDateObject())
arg = d->value;
else
}
else { // d.argc > 1
- double year = d.args[0].toNumber();
- double month = d.args[1].toNumber();
- double day = d.argc >= 3 ? d.args[2].toNumber() : 1;
- double hours = d.argc >= 4 ? d.args[3].toNumber() : 0;
- double mins = d.argc >= 5 ? d.args[4].toNumber() : 0;
- double secs = d.argc >= 6 ? d.args[5].toNumber() : 0;
- double ms = d.argc >= 7 ? d.args[6].toNumber() : 0;
+ double year = callData->args[0].toNumber();
+ double month = callData->args[1].toNumber();
+ double day = callData->argc >= 3 ? callData->args[2].toNumber() : 1;
+ double hours = callData->argc >= 4 ? callData->args[3].toNumber() : 0;
+ double mins = callData->argc >= 5 ? callData->args[4].toNumber() : 0;
+ double secs = callData->argc >= 6 ? callData->args[5].toNumber() : 0;
+ double ms = callData->argc >= 7 ? callData->args[6].toNumber() : 0;
if (year >= 0 && year <= 99)
year += 1900;
t = MakeDate(MakeDay(year, month, day), MakeTime(hours, mins, secs, ms));
return Value::fromObject(o);
}
-Value DateCtor::call(Managed *m, const CallData &)
+Value DateCtor::call(Managed *m, CallData *)
{
double t = currentTime();
return Value::fromString(m->engine()->current, ToString(t));
{
DateCtor(ExecutionContext *scope);
- static Value construct(Managed *, const CallData &d);
- static Value call(Managed *that, const CallData &);
+ static Value construct(Managed *, CallData *callData);
+ static Value call(Managed *that, CallData *);
protected:
static const ManagedVTable static_vtbl;
vtbl = &static_vtbl;
}
-Value ErrorCtor::construct(Managed *m, const CallData &d)
+Value ErrorCtor::construct(Managed *m, CallData *callData)
{
- return Value::fromObject(m->engine()->newErrorObject(d.argc ? d.args[0] : Value::undefinedValue()));
+ return Value::fromObject(m->engine()->newErrorObject(callData->argc ? callData->args[0] : Value::undefinedValue()));
}
-Value ErrorCtor::call(Managed *that, const CallData &d)
+Value ErrorCtor::call(Managed *that, CallData *callData)
{
- return that->construct(d);
+ return that->construct(callData);
}
EvalErrorCtor::EvalErrorCtor(ExecutionContext *scope)
vtbl = &static_vtbl;
}
-Value EvalErrorCtor::construct(Managed *m, const CallData &d)
+Value EvalErrorCtor::construct(Managed *m, CallData *callData)
{
- return Value::fromObject(new (m->engine()->memoryManager) EvalErrorObject(m->engine(), d.argc ? d.args[0] : Value::undefinedValue()));
+ return Value::fromObject(new (m->engine()->memoryManager) EvalErrorObject(m->engine(), callData->argc ? callData->args[0] : Value::undefinedValue()));
}
RangeErrorCtor::RangeErrorCtor(ExecutionContext *scope)
vtbl = &static_vtbl;
}
-Value RangeErrorCtor::construct(Managed *m, const CallData &d)
+Value RangeErrorCtor::construct(Managed *m, CallData *callData)
{
- return Value::fromObject(new (m->engine()->memoryManager) RangeErrorObject(m->engine(), d.argc ? d.args[0] : Value::undefinedValue()));
+ return Value::fromObject(new (m->engine()->memoryManager) RangeErrorObject(m->engine(), callData->argc ? callData->args[0] : Value::undefinedValue()));
}
ReferenceErrorCtor::ReferenceErrorCtor(ExecutionContext *scope)
vtbl = &static_vtbl;
}
-Value ReferenceErrorCtor::construct(Managed *m, const CallData &d)
+Value ReferenceErrorCtor::construct(Managed *m, CallData *callData)
{
- return Value::fromObject(new (m->engine()->memoryManager) ReferenceErrorObject(m->engine(), d.argc ? d.args[0] : Value::undefinedValue()));
+ return Value::fromObject(new (m->engine()->memoryManager) ReferenceErrorObject(m->engine(), callData->argc ? callData->args[0] : Value::undefinedValue()));
}
SyntaxErrorCtor::SyntaxErrorCtor(ExecutionContext *scope)
vtbl = &static_vtbl;
}
-Value SyntaxErrorCtor::construct(Managed *m, const CallData &d)
+Value SyntaxErrorCtor::construct(Managed *m, CallData *callData)
{
- return Value::fromObject(new (m->engine()->memoryManager) SyntaxErrorObject(m->engine(), d.argc ? d.args[0] : Value::undefinedValue()));
+ return Value::fromObject(new (m->engine()->memoryManager) SyntaxErrorObject(m->engine(), callData->argc ? callData->args[0] : Value::undefinedValue()));
}
TypeErrorCtor::TypeErrorCtor(ExecutionContext *scope)
vtbl = &static_vtbl;
}
-Value TypeErrorCtor::construct(Managed *m, const CallData &d)
+Value TypeErrorCtor::construct(Managed *m, CallData *callData)
{
- return Value::fromObject(new (m->engine()->memoryManager) TypeErrorObject(m->engine(), d.argc ? d.args[0] : Value::undefinedValue()));
+ return Value::fromObject(new (m->engine()->memoryManager) TypeErrorObject(m->engine(), callData->argc ? callData->args[0] : Value::undefinedValue()));
}
URIErrorCtor::URIErrorCtor(ExecutionContext *scope)
vtbl = &static_vtbl;
}
-Value URIErrorCtor::construct(Managed *m, const CallData &d)
+Value URIErrorCtor::construct(Managed *m, CallData *callData)
{
- return Value::fromObject(new (m->engine()->memoryManager) URIErrorObject(m->engine(), d.argc ? d.args[0] : Value::undefinedValue()));
+ return Value::fromObject(new (m->engine()->memoryManager) URIErrorObject(m->engine(), callData->argc ? callData->args[0] : Value::undefinedValue()));
}
void ErrorPrototype::init(ExecutionEngine *engine, const Value &ctor, Object *obj)
ErrorCtor(ExecutionContext *scope);
ErrorCtor(ExecutionContext *scope, String *name);
- static Value construct(Managed *, const CallData &d);
- static Value call(Managed *that, const CallData &d);
+ static Value construct(Managed *, CallData *callData);
+ static Value call(Managed *that, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
{
EvalErrorCtor(ExecutionContext *scope);
- static Value construct(Managed *m, const CallData &d);
+ static Value construct(Managed *m, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
{
RangeErrorCtor(ExecutionContext *scope);
- static Value construct(Managed *m, const CallData &d);
+ static Value construct(Managed *m, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
{
ReferenceErrorCtor(ExecutionContext *scope);
- static Value construct(Managed *m, const CallData &d);
+ static Value construct(Managed *m, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
{
SyntaxErrorCtor(ExecutionContext *scope);
- static Value construct(Managed *m, const CallData &d);
+ static Value construct(Managed *m, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
{
TypeErrorCtor(ExecutionContext *scope);
- static Value construct(Managed *m, const CallData &d);
+ static Value construct(Managed *m, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
{
URIErrorCtor(ExecutionContext *scope);
- static Value construct(Managed *m, const CallData &d);
+ static Value construct(Managed *m, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
return false;
}
-Value FunctionObject::construct(Managed *that, const CallData &)
+Value FunctionObject::construct(Managed *that, CallData *)
{
FunctionObject *f = static_cast<FunctionObject *>(that);
ExecutionEngine *v4 = f->engine();
return Value::fromObject(obj);
}
-Value FunctionObject::call(Managed *, const CallData &)
+Value FunctionObject::call(Managed *, CallData *)
{
return Value::undefinedValue();
}
}
// 15.3.2
-Value FunctionCtor::construct(Managed *that, const CallData &d)
+Value FunctionCtor::construct(Managed *that, CallData *callData)
{
FunctionCtor *f = static_cast<FunctionCtor *>(that);
MemoryManager::GCBlocker gcBlocker(f->engine()->memoryManager);
ExecutionContext *ctx = f->engine()->current;
QString arguments;
QString body;
- if (d.argc > 0) {
- for (uint i = 0; i < d.argc - 1; ++i) {
+ if (callData->argc > 0) {
+ for (uint i = 0; i < callData->argc - 1; ++i) {
if (i)
arguments += QLatin1String(", ");
- arguments += d.args[i].toString(ctx)->toQString();
+ arguments += callData->args[i].toString(ctx)->toQString();
}
- body = d.args[d.argc - 1].toString(ctx)->toQString();
+ body = callData->args[callData->argc - 1].toString(ctx)->toQString();
}
QString function = QLatin1String("function(") + arguments + QLatin1String("){") + body + QLatin1String("}");
}
// 15.3.1: This is equivalent to new Function(...)
-Value FunctionCtor::call(Managed *that, const CallData &d)
+Value FunctionCtor::call(Managed *that, CallData *callData)
{
- return construct(that, d);
+ return construct(that, callData);
}
FunctionPrototype::FunctionPrototype(InternalClass *ic)
}
}
-Value ScriptFunction::construct(Managed *that, const CallData &d)
+Value ScriptFunction::construct(Managed *that, CallData *callData)
{
ScriptFunction *f = static_cast<ScriptFunction *>(that);
SAVE_JS_STACK(f->scope);
Object *obj = v4->newObject(ic);
ExecutionContext *context = v4->current;
- const_cast<CallData &>(d).thisObject = Value::fromObject(obj);
- ExecutionContext *ctx = context->newCallContext(f, d);
+ callData->thisObject = Value::fromObject(obj);
+ ExecutionContext *ctx = context->newCallContext(f, callData);
Value result;
try {
return Value::fromObject(obj);
}
-Value ScriptFunction::call(Managed *that, const CallData &d)
+Value ScriptFunction::call(Managed *that, CallData *callData)
{
ScriptFunction *f = static_cast<ScriptFunction *>(that);
SAVE_JS_STACK(f->scope);
void *stackSpace;
ExecutionContext *context = f->engine()->current;
- CallContext *ctx = context->newCallContext(f, d);
+ CallContext *ctx = context->newCallContext(f, callData);
- if (!f->strictMode && !d.thisObject.isObject()) {
- if (d.thisObject.isNullOrUndefined()) {
+ if (!f->strictMode && !callData->thisObject.isObject()) {
+ if (callData->thisObject.isNullOrUndefined()) {
ctx->thisObject = Value::fromObject(f->engine()->globalObject);
} else {
- ctx->thisObject = Value::fromObject(d.thisObject.toObject(context));
+ ctx->thisObject = Value::fromObject(callData->thisObject.toObject(context));
}
}
}
}
-Value SimpleScriptFunction::construct(Managed *that, const CallData &d)
+Value SimpleScriptFunction::construct(Managed *that, CallData *callData)
{
SimpleScriptFunction *f = static_cast<SimpleScriptFunction *>(that);
SAVE_JS_STACK(f->scope);
ExecutionContext *context = v4->current;
void *stackSpace = alloca(requiredMemoryForExecutionContectSimple(f));
- const_cast<CallData &>(d).thisObject = Value::fromObject(obj);
- ExecutionContext *ctx = context->newCallContext(stackSpace, f, d);
+ callData->thisObject = Value::fromObject(obj);
+ ExecutionContext *ctx = context->newCallContext(stackSpace, f, callData);
Value result;
try {
return Value::fromObject(obj);
}
-Value SimpleScriptFunction::call(Managed *that, const CallData &d)
+Value SimpleScriptFunction::call(Managed *that, CallData *callData)
{
SimpleScriptFunction *f = static_cast<SimpleScriptFunction *>(that);
SAVE_JS_STACK(f->scope);
void *stackSpace = alloca(requiredMemoryForExecutionContectSimple(f));
ExecutionContext *context = f->engine()->current;
- ExecutionContext *ctx = context->newCallContext(stackSpace, f, d);
+ ExecutionContext *ctx = context->newCallContext(stackSpace, f, callData);
- if (!f->strictMode && !d.thisObject.isObject()) {
- if (d.thisObject.isNullOrUndefined()) {
+ if (!f->strictMode && !callData->thisObject.isObject()) {
+ if (callData->thisObject.isNullOrUndefined()) {
ctx->thisObject = Value::fromObject(f->engine()->globalObject);
} else {
- ctx->thisObject = Value::fromObject(d.thisObject.toObject(context));
+ ctx->thisObject = Value::fromObject(callData->thisObject.toObject(context));
}
}
isBuiltinFunction = true;
}
-Value BuiltinFunctionOld::construct(Managed *f, const CallData &d)
+Value BuiltinFunctionOld::construct(Managed *f, CallData *)
{
f->engine()->current->throwTypeError();
return Value::undefinedValue();
}
-Value BuiltinFunctionOld::call(Managed *that, const CallData &d)
+Value BuiltinFunctionOld::call(Managed *that, CallData *callData)
{
BuiltinFunctionOld *f = static_cast<BuiltinFunctionOld *>(that);
ExecutionEngine *v4 = f->engine();
SimpleCallContext ctx;
ctx.initSimpleCallContext(f->scope->engine);
ctx.strictMode = f->scope->strictMode; // ### needed? scope or parent context?
- ctx.thisObject = d.thisObject;
+ ctx.thisObject = callData->thisObject;
// ### const_cast
- ctx.arguments = const_cast<Value *>(d.args);
- ctx.argumentCount = d.argc;
+ ctx.arguments = const_cast<Value *>(callData->args);
+ ctx.argumentCount = callData->argc;
v4->pushContext(&ctx);
Value result;
return result;
}
-Value IndexedBuiltinFunction::call(Managed *that, const CallData &d)
+Value IndexedBuiltinFunction::call(Managed *that, CallData *callData)
{
IndexedBuiltinFunction *f = static_cast<IndexedBuiltinFunction *>(that);
ExecutionEngine *v4 = f->engine();
SimpleCallContext ctx;
ctx.initSimpleCallContext(f->scope->engine);
ctx.strictMode = f->scope->strictMode; // ### needed? scope or parent context?
- ctx.thisObject = d.thisObject;
+ ctx.thisObject = callData->thisObject;
// ### const_cast
- ctx.arguments = const_cast<Value *>(d.args);
- ctx.argumentCount = d.argc;
+ ctx.arguments = const_cast<Value *>(callData->args);
+ ctx.argumentCount = callData->argc;
v4->pushContext(&ctx);
Value result;
static_cast<BoundFunction *>(that)->~BoundFunction();
}
-Value BoundFunction::call(Managed *that, const CallData &dd)
+Value BoundFunction::call(Managed *that, CallData *dd)
{
BoundFunction *f = static_cast<BoundFunction *>(that);
- ScopedCallData callData(f->scope->engine, f->boundArgs.size() + dd.argc);
+ ScopedCallData callData(f->scope->engine, f->boundArgs.size() + dd->argc);
callData->thisObject = f->boundThis;
memcpy(callData->args, f->boundArgs.constData(), f->boundArgs.size()*sizeof(Value));
- memcpy(callData->args + f->boundArgs.size(), dd.args, dd.argc*sizeof(Value));
+ memcpy(callData->args + f->boundArgs.size(), dd->args, dd->argc*sizeof(Value));
return f->target->call(callData);
}
-Value BoundFunction::construct(Managed *that, const CallData &dd)
+Value BoundFunction::construct(Managed *that, CallData *dd)
{
BoundFunction *f = static_cast<BoundFunction *>(that);
- ScopedCallData callData(f->scope->engine, f->boundArgs.size() + dd.argc);
+ ScopedCallData callData(f->scope->engine, f->boundArgs.size() + dd->argc);
memcpy(callData->args, f->boundArgs.constData(), f->boundArgs.size()*sizeof(Value));
- memcpy(callData->args + f->boundArgs.size(), dd.args, dd.argc*sizeof(Value));
+ memcpy(callData->args + f->boundArgs.size(), dd->args, dd->argc*sizeof(Value));
return f->target->construct(callData);
}
Value newInstance();
- static Value construct(Managed *that, const CallData &);
- static Value call(Managed *that, const CallData &d);
- inline Value construct(const CallData &d) {
- return vtbl->construct(this, d);
+ static Value construct(Managed *that, CallData *);
+ static Value call(Managed *that, CallData *d);
+ inline Value construct(CallData *callData) {
+ return vtbl->construct(this, callData);
}
- inline Value call(const CallData &d) {
- return vtbl->call(this, d);
+ inline Value call(CallData *callData) {
+ return vtbl->call(this, callData);
}
static FunctionObject *creatScriptFunction(ExecutionContext *scope, Function *function);
{
FunctionCtor(ExecutionContext *scope);
- static Value construct(Managed *that, const CallData &);
- static Value call(Managed *that, const CallData &d);
+ static Value construct(Managed *that, CallData *callData);
+ static Value call(Managed *that, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
BuiltinFunctionOld(ExecutionContext *scope, String *name, Value (*code)(SimpleCallContext *));
- static Value construct(Managed *, const CallData &d);
- static Value call(Managed *that, const CallData &d);
+ static Value construct(Managed *, CallData *);
+ static Value call(Managed *that, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
isBuiltinFunction = true;
}
- static Value construct(Managed *m, const CallData &)
+ static Value construct(Managed *m, CallData *)
{
m->engine()->current->throwTypeError();
return Value::undefinedValue();
}
- static Value call(Managed *that, const CallData &d);
+ static Value call(Managed *that, CallData *callData);
};
struct ScriptFunction: FunctionObject {
ScriptFunction(ExecutionContext *scope, Function *function);
- static Value construct(Managed *, const CallData &d);
- static Value call(Managed *that, const CallData &d);
+ static Value construct(Managed *, CallData *callData);
+ static Value call(Managed *that, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
struct SimpleScriptFunction: FunctionObject {
SimpleScriptFunction(ExecutionContext *scope, Function *function);
- static Value construct(Managed *, const CallData &d);
- static Value call(Managed *that, const CallData &d);
+ static Value construct(Managed *, CallData *callData);
+ static Value call(Managed *that, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
~BoundFunction() {}
- static Value construct(Managed *, const CallData &d);
- static Value call(Managed *that, const CallData &d);
+ static Value construct(Managed *, CallData *d);
+ static Value call(Managed *that, CallData *dd);
static const ManagedVTable static_vtbl;
static void destroy(Managed *);
}
-Value EvalFunction::call(Managed *that, const CallData &d)
+Value EvalFunction::call(Managed *that, CallData *callData)
{
// indirect call
// ### const_cast
- return static_cast<EvalFunction *>(that)->evalCall(d.thisObject, const_cast<Value *>(d.args), d.argc, false);
+ return static_cast<EvalFunction *>(that)->evalCall(callData->thisObject, const_cast<Value *>(callData->args), callData->argc, false);
}
Value evalCall(Value thisObject, Value *args, int argc, bool directCall);
using Managed::construct;
- static Value call(Managed *that, const CallData &d);
+ static Value call(Managed *that, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
m->engine()->current->throwTypeError();
}
-Value Managed::construct(Managed *m, const CallData &)
+Value Managed::construct(Managed *m, CallData *)
{
m->engine()->current->throwTypeError();
}
-Value Managed::call(Managed *m, const CallData &)
+Value Managed::call(Managed *m, CallData *)
{
m->engine()->current->throwTypeError();
}
struct ManagedVTable
{
- Value (*call)(Managed *, const CallData &data);
- Value (*construct)(Managed *, const CallData &data);
+ Value (*call)(Managed *, CallData *data);
+ Value (*construct)(Managed *, CallData *data);
void (*markObjects)(Managed *);
void (*destroy)(Managed *);
void (*collectDeletables)(Managed *, GCDeletable **deletable);
inline bool hasInstance(const Value &v) {
return vtbl->hasInstance(this, v);
}
- Value construct(const CallData &d);
- Value call(const CallData &d);
+ Value construct(CallData *d);
+ Value call(CallData *d);
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, const CallData &d);
- static Value call(Managed *m, const CallData &);
+ static Value construct(Managed *m, CallData *d);
+ static Value call(Managed *m, CallData *);
static void getLookup(Managed *m, Lookup *, Value *);
static void setLookup(Managed *m, Lookup *l, const Value &v);
static bool isEqualTo(Managed *m, Managed *other);
vtbl = &static_vtbl;
}
-Value NumberCtor::construct(Managed *m, const CallData &d)
+Value NumberCtor::construct(Managed *m, CallData *callData)
{
- double dbl = d.argc ? d.args[0].toNumber() : 0.;
+ double dbl = callData->argc ? callData->args[0].toNumber() : 0.;
return Value::fromObject(m->engine()->newNumberObject(Value::fromDouble(dbl)));
}
-Value NumberCtor::call(Managed *, const CallData &d)
+Value NumberCtor::call(Managed *, CallData *callData)
{
- double dbl = d.argc ? d.args[0].toNumber() : 0.;
+ double dbl = callData->argc ? callData->args[0].toNumber() : 0.;
return Value::fromDouble(dbl);
}
{
NumberCtor(ExecutionContext *scope);
- static Value construct(Managed *that, const CallData &d);
- static Value call(Managed *, const CallData &d);
+ static Value construct(Managed *that, CallData *callData);
+ static Value call(Managed *, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
vtbl = &static_vtbl;
}
-Value ObjectCtor::construct(Managed *that, const CallData &d)
+Value ObjectCtor::construct(Managed *that, CallData *callData)
{
ObjectCtor *ctor = static_cast<ObjectCtor *>(that);
ExecutionEngine *v4 = that->engine();
- if (!d.argc || d.args[0].isUndefined() || d.args[0].isNull()) {
+ if (!callData->argc || callData->args[0].isUndefined() || callData->args[0].isNull()) {
Object *obj = v4->newObject();
Value proto = ctor->get(v4->id_prototype);
if (proto.isObject())
obj->setPrototype(proto.objectValue());
return Value::fromObject(obj);
}
- return __qmljs_to_object(v4->current, d.args[0]);
+ return __qmljs_to_object(v4->current, callData->args[0]);
}
-Value ObjectCtor::call(Managed *m, const CallData &d)
+Value ObjectCtor::call(Managed *m, CallData *callData)
{
- if (!d.argc || d.args[0].isUndefined() || d.args[0].isNull())
+ if (!callData->argc || callData->args[0].isUndefined() || callData->args[0].isNull())
return Value::fromObject(m->engine()->newObject());
- return __qmljs_to_object(m->engine()->current, d.args[0]);
+ return __qmljs_to_object(m->engine()->current, callData->args[0]);
}
void ObjectPrototype::init(ExecutionContext *ctx, const Value &ctor)
{
ObjectCtor(ExecutionContext *scope);
- static Value construct(Managed *that, const CallData &d);
- static Value call(Managed *that, const CallData &d);
+ static Value construct(Managed *that, CallData *callData);
+ static Value call(Managed *that, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
return QV4::Value::undefinedValue();
}
-Value QObjectMethod::call(Managed *m, const CallData &d)
+Value QObjectMethod::call(Managed *m, CallData *callData)
{
QObjectMethod *This = static_cast<QObjectMethod*>(m);
- return This->callInternal(d);
+ return This->callInternal(callData);
}
-Value QObjectMethod::callInternal(const CallData &d)
+Value QObjectMethod::callInternal(CallData *callData)
{
ExecutionContext *context = engine()->current;
if (m_index == DestroyMethod)
- return method_destroy(context, d.args, d.argc);
+ return method_destroy(context, callData->args, callData->argc);
else if (m_index == ToStringMethod)
return method_toString(context);
if (method.isV4Function()) {
QV4::Value rv = QV4::Value::undefinedValue();
- QQmlV4Function func(d.argc, d.args, &rv, m_qmlGlobal.value(),
+ QQmlV4Function func(callData->argc, callData->args, &rv, m_qmlGlobal.value(),
QmlContextWrapper::getContext(m_qmlGlobal.value()),
v8Engine);
QQmlV4Function *funcptr = &func;
return rv;
}
- CallArgs callArgs(d.argc, d.args);
+ CallArgs callArgs(callData->argc, callData->args);
if (!method.isOverload()) {
return CallPrecise(object, method, v8Engine, callArgs);
} else {
int m_index;
QV4::PersistentValue m_qmlGlobal;
- static Value call(Managed *, const CallData &d);
+ static Value call(Managed *, CallData *callData);
- Value callInternal(const CallData &d);
+ Value callInternal(CallData *callData);
static void destroy(Managed *that)
{
vtbl = &static_vtbl;
}
-Value RegExpCtor::construct(Managed *m, const CallData &d)
+Value RegExpCtor::construct(Managed *m, CallData *callData)
{
- Value r = d.argc > 0 ? d.args[0] : Value::undefinedValue();
- Value f = d.argc > 1 ? d.args[1] : Value::undefinedValue();
+ Value r = callData->argc > 0 ? callData->args[0] : Value::undefinedValue();
+ Value f = callData->argc > 1 ? callData->args[1] : Value::undefinedValue();
ExecutionContext *ctx = m->engine()->current;
if (RegExpObject *re = r.as<RegExpObject>()) {
if (!f.isUndefined())
return Value::fromObject(o);
}
-Value RegExpCtor::call(Managed *that, const CallData &d)
+Value RegExpCtor::call(Managed *that, CallData *callData)
{
- if (d.argc > 0 && d.args[0].as<RegExpObject>()) {
- if (d.argc == 1 || d.args[1].isUndefined())
- return d.args[0];
+ if (callData->argc > 0 && callData->args[0].as<RegExpObject>()) {
+ if (callData->argc == 1 || callData->args[1].isUndefined())
+ return callData->args[0];
}
- return construct(that, d);
+ return construct(that, callData);
}
void RegExpPrototype::init(ExecutionContext *ctx, const Value &ctor)
{
RegExpCtor(ExecutionContext *scope);
- static Value construct(Managed *m, const CallData &d);
- static Value call(Managed *that, const CallData &d);
+ static Value construct(Managed *m, CallData *callData);
+ static Value call(Managed *that, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
return;
}
- Value res = o->call(*callData);
+ Value res = o->call(callData);
if (result)
*result = res;
}
return;
}
- Value res = o->call(*callData);
+ Value res = o->call(callData);
if (result)
*result = res;
}
context->throwTypeError(error);
}
- Value res = o->call(*callData);
+ Value res = o->call(callData);
if (result)
*result = res;
}
if (!o)
context->throwTypeError();
- Value res = o->call(*callData);
+ Value res = o->call(callData);
if (result)
*result = res;
}
if (!o)
context->throwTypeError();
- Value res = o->call(*callData);
+ Value res = o->call(callData);
if (result)
*result = res;
}
if (!o)
context->throwTypeError();
- Value res = o->call(*callData);
+ Value res = o->call(callData);
if (result)
*result = res;
}
if (!f)
context->throwTypeError();
- Value res = f->construct(*callData);
+ Value res = f->construct(callData);
if (result)
*result = res;
}
if (!f)
context->throwTypeError();
- Value res = f->construct(*callData);
+ Value res = f->construct(callData);
if (result)
*result = res;
}
if (!f)
context->throwTypeError();
- Value res = f->construct(*callData);
+ Value res = f->construct(callData);
if (result)
*result = res;
}
if (!f)
context->throwTypeError();
- Value res = f->construct(*callData);
+ Value res = f->construct(callData);
if (result)
*result = res;
}
return ptr;
}
- operator const CallData &() const {
- return *ptr;
+ operator CallData *() const {
+ return ptr;
}
scope->engine->popContext();
}
- static Value call(Managed *that, const CallData &);
+ static Value call(Managed *that, CallData *);
static void markObjects(Managed *m)
{
QmlBindingWrapper *wrapper = static_cast<QmlBindingWrapper*>(m);
DEFINE_MANAGED_VTABLE(CompilationUnitHolder);
-Value QmlBindingWrapper::call(Managed *that, const CallData &)
+Value QmlBindingWrapper::call(Managed *that, CallData *)
{
ExecutionEngine *engine = that->engine();
QmlBindingWrapper *This = static_cast<QmlBindingWrapper *>(that);
vtbl = &static_vtbl;
}
-Value StringCtor::construct(Managed *m, const CallData &d)
+Value StringCtor::construct(Managed *m, CallData *callData)
{
Value value;
- if (d.argc)
- value = Value::fromString(d.args[0].toString(m->engine()->current));
+ if (callData->argc)
+ value = Value::fromString(callData->args[0].toString(m->engine()->current));
else
value = Value::fromString(m->engine()->current, QString());
return Value::fromObject(m->engine()->newStringObject(value));
}
-Value StringCtor::call(Managed *m, const CallData &d)
+Value StringCtor::call(Managed *m, CallData *callData)
{
Value value;
- if (d.argc)
- value = Value::fromString(d.args[0].toString(m->engine()->current));
+ if (callData->argc)
+ value = Value::fromString(callData->args[0].toString(m->engine()->current));
else
value = Value::fromString(m->engine()->current, QString());
return value;
{
StringCtor(ExecutionContext *scope);
- static Value construct(Managed *m, const CallData &d);
- static Value call(Managed *that, const CallData &d);
+ static Value construct(Managed *m, CallData *callData);
+ static Value call(Managed *that, CallData *callData);
protected:
static const ManagedVTable static_vtbl;
}
// ###
-inline Value Managed::construct(const CallData &d) {
+inline Value Managed::construct(CallData *d) {
return vtbl->construct(this, d);
}
-inline Value Managed::call(const CallData &d) {
+inline Value Managed::call(CallData *d) {
return vtbl->call(this, d);
}
if (c->proto)
c->proto->mark();
}
- static Value construct(Managed *that, const QV4::CallData &)
+ static Value construct(Managed *that, QV4::CallData *)
{
QQmlXMLHttpRequestCtor *ctor = that->as<QQmlXMLHttpRequestCtor>();
if (!ctor)
return Value::fromObject(w);
}
- static Value call(Managed *, const QV4::CallData &) {
+ static Value call(Managed *, QV4::CallData *) {
return Value::undefinedValue();
}
bindingKeyFlag = true;
}
- static Value call(Managed *that, const CallData &d)
+ static Value call(Managed *that, CallData *callData)
{
BindingFunction *This = static_cast<BindingFunction*>(that);
- return This->originalFunction->call(d);
+ return This->originalFunction->call(callData);
}
static void markObjects(Managed *that)
isBuiltinFunction = true;
}
- static QV4::Value construct(QV4::Managed *m, const QV4::CallData &)
+ static QV4::Value construct(QV4::Managed *m, QV4::CallData *)
{
m->engine()->current->throwTypeError();
return QV4::Value::undefinedValue();
}
- static QV4::Value call(QV4::Managed *that, const QV4::CallData &d)
+ static QV4::Value call(QV4::Managed *that, QV4::CallData *callData)
{
DelegateModelGroupFunction *f = static_cast<DelegateModelGroupFunction *>(that);
- QQmlDelegateModelItemObject *o = d.thisObject.as<QQmlDelegateModelItemObject>();
+ QQmlDelegateModelItemObject *o = callData->thisObject.as<QQmlDelegateModelItemObject>();
if (!o)
that->engine()->current->throwTypeError(QStringLiteral("Not a valid VisualData object"));
- QV4::Value v = d.argc ? d.args[0] : QV4::Value::undefinedValue();
+ QV4::Value v = callData->argc ? callData->args[0] : QV4::Value::undefinedValue();
return f->code(o->item, f->flag, v);
}
};
name = scope->engine->newString("print");
}
- static Value call(Managed *, const CallData &d)
+ static Value call(Managed *, CallData *callData)
{
- for (int i = 0; i < d.argc; ++i) {
- QString s = d.args[i].toQString();
+ for (int i = 0; i < callData->argc; ++i) {
+ QString s = callData->args[i].toQString();
if (i)
std::cout << ' ';
std::cout << qPrintable(s);
vtbl = &static_vtbl;
name = scope->engine->newString("gc");
}
- static Value call(Managed *m, const CallData &)
+ static Value call(Managed *m, CallData *)
{
m->engine()->memoryManager->runGC();
return Value::undefinedValue();