Change signature of call/construct() to take a pointer to a CallData
Change-Id: I5467aadba083e4b01fb0a7170946695207033680 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
parent
a23158a412
commit
f9fda643ab
|
@ -148,10 +148,10 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const
|
|||
|
||||
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();
|
||||
|
@ -164,10 +164,10 @@ Value ArgumentsGetterFunction::call(Managed *getter, const CallData &d)
|
|||
|
||||
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();
|
||||
|
@ -175,7 +175,7 @@ Value ArgumentsSetterFunction::call(Managed *setter, const CallData &d)
|
|||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ struct ArgumentsGetterFunction: FunctionObject
|
|||
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;
|
||||
|
@ -68,7 +68,7 @@ struct ArgumentsSetterFunction: FunctionObject
|
|||
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;
|
||||
|
|
|
@ -54,25 +54,25 @@ ArrayCtor::ArrayCtor(ExecutionContext *scope)
|
|||
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);
|
||||
|
@ -80,9 +80,9 @@ Value ArrayCtor::construct(Managed *m, const CallData &d)
|
|||
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)
|
||||
|
|
|
@ -53,8 +53,8 @@ struct ArrayCtor: FunctionObject
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -51,15 +51,15 @@ BooleanCtor::BooleanCtor(ExecutionContext *scope)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ struct BooleanCtor: FunctionObject
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
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
|
||||
|
@ -64,10 +64,10 @@ CallContext *ExecutionContext::newCallContext(void *stackSpace, FunctionObject *
|
|||
|
||||
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;
|
||||
|
@ -90,28 +90,28 @@ CallContext *ExecutionContext::newCallContext(void *stackSpace, FunctionObject *
|
|||
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;
|
||||
|
@ -134,12 +134,12 @@ CallContext *ExecutionContext::newCallContext(FunctionObject *function, const Ca
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -114,8 +114,8 @@ struct Q_QML_EXPORT ExecutionContext
|
|||
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);
|
||||
|
|
|
@ -654,15 +654,15 @@ DateCtor::DateCtor(ExecutionContext *scope)
|
|||
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
|
||||
|
@ -675,13 +675,13 @@ Value DateCtor::construct(Managed *m, const CallData &d)
|
|||
}
|
||||
|
||||
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));
|
||||
|
@ -692,7 +692,7 @@ Value DateCtor::construct(Managed *m, const CallData &d)
|
|||
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));
|
||||
|
|
|
@ -66,8 +66,8 @@ struct DateCtor: FunctionObject
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -240,14 +240,14 @@ ErrorCtor::ErrorCtor(ExecutionContext *scope, String *name)
|
|||
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)
|
||||
|
@ -256,9 +256,9 @@ 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)
|
||||
|
@ -267,9 +267,9 @@ 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)
|
||||
|
@ -278,9 +278,9 @@ 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)
|
||||
|
@ -289,9 +289,9 @@ 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)
|
||||
|
@ -300,9 +300,9 @@ 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)
|
||||
|
@ -311,9 +311,9 @@ 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)
|
||||
|
|
|
@ -114,8 +114,8 @@ struct ErrorCtor: FunctionObject
|
|||
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;
|
||||
|
@ -125,7 +125,7 @@ struct EvalErrorCtor: ErrorCtor
|
|||
{
|
||||
EvalErrorCtor(ExecutionContext *scope);
|
||||
|
||||
static Value construct(Managed *m, const CallData &d);
|
||||
static Value construct(Managed *m, CallData *callData);
|
||||
|
||||
protected:
|
||||
static const ManagedVTable static_vtbl;
|
||||
|
@ -135,7 +135,7 @@ struct RangeErrorCtor: ErrorCtor
|
|||
{
|
||||
RangeErrorCtor(ExecutionContext *scope);
|
||||
|
||||
static Value construct(Managed *m, const CallData &d);
|
||||
static Value construct(Managed *m, CallData *callData);
|
||||
|
||||
protected:
|
||||
static const ManagedVTable static_vtbl;
|
||||
|
@ -145,7 +145,7 @@ struct ReferenceErrorCtor: ErrorCtor
|
|||
{
|
||||
ReferenceErrorCtor(ExecutionContext *scope);
|
||||
|
||||
static Value construct(Managed *m, const CallData &d);
|
||||
static Value construct(Managed *m, CallData *callData);
|
||||
|
||||
protected:
|
||||
static const ManagedVTable static_vtbl;
|
||||
|
@ -155,7 +155,7 @@ struct SyntaxErrorCtor: ErrorCtor
|
|||
{
|
||||
SyntaxErrorCtor(ExecutionContext *scope);
|
||||
|
||||
static Value construct(Managed *m, const CallData &d);
|
||||
static Value construct(Managed *m, CallData *callData);
|
||||
|
||||
protected:
|
||||
static const ManagedVTable static_vtbl;
|
||||
|
@ -165,7 +165,7 @@ struct TypeErrorCtor: ErrorCtor
|
|||
{
|
||||
TypeErrorCtor(ExecutionContext *scope);
|
||||
|
||||
static Value construct(Managed *m, const CallData &d);
|
||||
static Value construct(Managed *m, CallData *callData);
|
||||
|
||||
protected:
|
||||
static const ManagedVTable static_vtbl;
|
||||
|
@ -175,7 +175,7 @@ struct URIErrorCtor: ErrorCtor
|
|||
{
|
||||
URIErrorCtor(ExecutionContext *scope);
|
||||
|
||||
static Value construct(Managed *m, const CallData &d);
|
||||
static Value construct(Managed *m, CallData *callData);
|
||||
|
||||
protected:
|
||||
static const ManagedVTable static_vtbl;
|
||||
|
|
|
@ -152,7 +152,7 @@ bool FunctionObject::hasInstance(Managed *that, const Value &value)
|
|||
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();
|
||||
|
@ -165,7 +165,7 @@ Value FunctionObject::construct(Managed *that, const CallData &)
|
|||
return Value::fromObject(obj);
|
||||
}
|
||||
|
||||
Value FunctionObject::call(Managed *, const CallData &)
|
||||
Value FunctionObject::call(Managed *, CallData *)
|
||||
{
|
||||
return Value::undefinedValue();
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ FunctionCtor::FunctionCtor(ExecutionContext *scope)
|
|||
}
|
||||
|
||||
// 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);
|
||||
|
@ -212,13 +212,13 @@ Value FunctionCtor::construct(Managed *that, const CallData &d)
|
|||
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("}");
|
||||
|
@ -252,9 +252,9 @@ Value FunctionCtor::construct(Managed *that, const CallData &d)
|
|||
}
|
||||
|
||||
// 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)
|
||||
|
@ -400,7 +400,7 @@ ScriptFunction::ScriptFunction(ExecutionContext *scope, Function *function)
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -413,8 +413,8 @@ Value ScriptFunction::construct(Managed *that, const CallData &d)
|
|||
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 {
|
||||
|
@ -431,19 +431,19 @@ Value ScriptFunction::construct(Managed *that, const CallData &d)
|
|||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -494,7 +494,7 @@ SimpleScriptFunction::SimpleScriptFunction(ExecutionContext *scope, Function *fu
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -508,8 +508,8 @@ Value SimpleScriptFunction::construct(Managed *that, const CallData &d)
|
|||
|
||||
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 {
|
||||
|
@ -526,19 +526,19 @@ Value SimpleScriptFunction::construct(Managed *that, const CallData &d)
|
|||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -567,13 +567,13 @@ BuiltinFunctionOld::BuiltinFunctionOld(ExecutionContext *scope, String *name, Va
|
|||
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();
|
||||
|
@ -582,10 +582,10 @@ Value BuiltinFunctionOld::call(Managed *that, const CallData &d)
|
|||
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;
|
||||
|
@ -600,7 +600,7 @@ Value BuiltinFunctionOld::call(Managed *that, const CallData &d)
|
|||
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();
|
||||
|
@ -609,10 +609,10 @@ Value IndexedBuiltinFunction::call(Managed *that, const CallData &d)
|
|||
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;
|
||||
|
@ -655,23 +655,23 @@ void BoundFunction::destroy(Managed *that)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -117,13 +117,13 @@ struct Q_QML_EXPORT FunctionObject: Object {
|
|||
|
||||
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);
|
||||
|
@ -142,8 +142,8 @@ struct FunctionCtor: FunctionObject
|
|||
{
|
||||
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;
|
||||
|
@ -165,8 +165,8 @@ struct BuiltinFunctionOld: FunctionObject {
|
|||
|
||||
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;
|
||||
|
@ -188,21 +188,21 @@ struct IndexedBuiltinFunction: FunctionObject
|
|||
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;
|
||||
|
@ -211,8 +211,8 @@ protected:
|
|||
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;
|
||||
|
@ -227,8 +227,8 @@ struct BoundFunction: FunctionObject {
|
|||
~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 *);
|
||||
|
|
|
@ -439,11 +439,11 @@ Value EvalFunction::evalCall(Value /*thisObject*/, Value *args, int argc, bool d
|
|||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ struct Q_QML_EXPORT EvalFunction : FunctionObject
|
|||
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;
|
||||
|
|
|
@ -176,12 +176,12 @@ bool Managed::hasInstance(Managed *m, const Value &)
|
|||
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();
|
||||
}
|
||||
|
|
|
@ -91,8 +91,8 @@ struct CallData
|
|||
|
||||
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);
|
||||
|
@ -252,8 +252,8 @@ public:
|
|||
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)
|
||||
|
@ -281,8 +281,8 @@ public:
|
|||
|
||||
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);
|
||||
|
|
|
@ -56,15 +56,15 @@ NumberCtor::NumberCtor(ExecutionContext *scope)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ struct NumberCtor: FunctionObject
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -79,25 +79,25 @@ ObjectCtor::ObjectCtor(ExecutionContext *scope)
|
|||
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)
|
||||
|
|
|
@ -53,8 +53,8 @@ struct ObjectCtor: FunctionObject
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -1687,17 +1687,17 @@ QV4::Value QObjectMethod::method_destroy(QV4::ExecutionContext *ctx, const Value
|
|||
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);
|
||||
|
||||
|
@ -1732,7 +1732,7 @@ Value QObjectMethod::callInternal(const CallData &d)
|
|||
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;
|
||||
|
@ -1743,7 +1743,7 @@ Value QObjectMethod::callInternal(const CallData &d)
|
|||
return rv;
|
||||
}
|
||||
|
||||
CallArgs callArgs(d.argc, d.args);
|
||||
CallArgs callArgs(callData->argc, callData->args);
|
||||
if (!method.isOverload()) {
|
||||
return CallPrecise(object, method, v8Engine, callArgs);
|
||||
} else {
|
||||
|
|
|
@ -141,9 +141,9 @@ private:
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -229,10 +229,10 @@ RegExpCtor::RegExpCtor(ExecutionContext *scope)
|
|||
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())
|
||||
|
@ -273,14 +273,14 @@ Value RegExpCtor::construct(Managed *m, const CallData &d)
|
|||
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)
|
||||
|
|
|
@ -105,8 +105,8 @@ struct RegExpCtor: FunctionObject
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -738,7 +738,7 @@ void __qmljs_call_global_lookup(ExecutionContext *context, Value *result, uint i
|
|||
return;
|
||||
}
|
||||
|
||||
Value res = o->call(*callData);
|
||||
Value res = o->call(callData);
|
||||
if (result)
|
||||
*result = res;
|
||||
}
|
||||
|
@ -769,7 +769,7 @@ void __qmljs_call_activation_property(ExecutionContext *context, Value *result,
|
|||
return;
|
||||
}
|
||||
|
||||
Value res = o->call(*callData);
|
||||
Value res = o->call(callData);
|
||||
if (result)
|
||||
*result = res;
|
||||
}
|
||||
|
@ -793,7 +793,7 @@ void __qmljs_call_property(ExecutionContext *context, Value *result, String *nam
|
|||
context->throwTypeError(error);
|
||||
}
|
||||
|
||||
Value res = o->call(*callData);
|
||||
Value res = o->call(callData);
|
||||
if (result)
|
||||
*result = res;
|
||||
}
|
||||
|
@ -809,7 +809,7 @@ void __qmljs_call_property_lookup(ExecutionContext *context, Value *result, uint
|
|||
if (!o)
|
||||
context->throwTypeError();
|
||||
|
||||
Value res = o->call(*callData);
|
||||
Value res = o->call(callData);
|
||||
if (result)
|
||||
*result = res;
|
||||
}
|
||||
|
@ -823,7 +823,7 @@ void __qmljs_call_element(ExecutionContext *context, Value *result, const Value
|
|||
if (!o)
|
||||
context->throwTypeError();
|
||||
|
||||
Value res = o->call(*callData);
|
||||
Value res = o->call(callData);
|
||||
if (result)
|
||||
*result = res;
|
||||
}
|
||||
|
@ -834,7 +834,7 @@ void __qmljs_call_value(ExecutionContext *context, Value *result, const Value &f
|
|||
if (!o)
|
||||
context->throwTypeError();
|
||||
|
||||
Value res = o->call(*callData);
|
||||
Value res = o->call(callData);
|
||||
if (result)
|
||||
*result = res;
|
||||
}
|
||||
|
@ -853,7 +853,7 @@ void __qmljs_construct_global_lookup(ExecutionContext *context, Value *result, u
|
|||
if (!f)
|
||||
context->throwTypeError();
|
||||
|
||||
Value res = f->construct(*callData);
|
||||
Value res = f->construct(callData);
|
||||
if (result)
|
||||
*result = res;
|
||||
}
|
||||
|
@ -866,7 +866,7 @@ void __qmljs_construct_activation_property(ExecutionContext *context, Value *res
|
|||
if (!f)
|
||||
context->throwTypeError();
|
||||
|
||||
Value res = f->construct(*callData);
|
||||
Value res = f->construct(callData);
|
||||
if (result)
|
||||
*result = res;
|
||||
}
|
||||
|
@ -877,7 +877,7 @@ void __qmljs_construct_value(ExecutionContext *context, Value *result, const Val
|
|||
if (!f)
|
||||
context->throwTypeError();
|
||||
|
||||
Value res = f->construct(*callData);
|
||||
Value res = f->construct(callData);
|
||||
if (result)
|
||||
*result = res;
|
||||
}
|
||||
|
@ -891,7 +891,7 @@ void __qmljs_construct_property(ExecutionContext *context, Value *result, const
|
|||
if (!f)
|
||||
context->throwTypeError();
|
||||
|
||||
Value res = f->construct(*callData);
|
||||
Value res = f->construct(callData);
|
||||
if (result)
|
||||
*result = res;
|
||||
}
|
||||
|
|
|
@ -161,8 +161,8 @@ struct ScopedCallData {
|
|||
return ptr;
|
||||
}
|
||||
|
||||
operator const CallData &() const {
|
||||
return *ptr;
|
||||
operator CallData *() const {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ struct QmlBindingWrapper : FunctionObject
|
|||
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);
|
||||
|
@ -122,7 +122,7 @@ struct CompilationUnitHolder : public QV4::Object
|
|||
|
||||
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);
|
||||
|
|
|
@ -160,21 +160,21 @@ StringCtor::StringCtor(ExecutionContext *scope)
|
|||
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;
|
||||
|
|
|
@ -70,8 +70,8 @@ struct StringCtor: FunctionObject
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -320,10 +320,10 @@ inline ErrorObject *Value::asErrorObject() const
|
|||
}
|
||||
|
||||
// ###
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1564,7 +1564,7 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject
|
|||
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)
|
||||
|
@ -1577,7 +1577,7 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject
|
|||
return Value::fromObject(w);
|
||||
}
|
||||
|
||||
static Value call(Managed *, const QV4::CallData &) {
|
||||
static Value call(Managed *, QV4::CallData *) {
|
||||
return Value::undefinedValue();
|
||||
}
|
||||
|
||||
|
|
|
@ -1184,10 +1184,10 @@ struct BindingFunction : public QV4::FunctionObject
|
|||
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)
|
||||
|
|
|
@ -75,20 +75,20 @@ struct DelegateModelGroupFunction: QV4::FunctionObject
|
|||
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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -77,10 +77,10 @@ struct Print: FunctionObject
|
|||
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);
|
||||
|
@ -102,7 +102,7 @@ struct GC: public FunctionObject
|
|||
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();
|
||||
|
|
Loading…
Reference in New Issue