VM::Value *FunctionState::argument(unsigned idx)
{
- if (idx < _context->argumentCount)
- return _context->arguments + idx;
- else
+ VM::CallContext *c = _context->asCallContext();
+ if (!c || idx >= c->argumentCount)
return 0;
+ return c->arguments + idx;
}
VM::Value *FunctionState::local(unsigned idx)
uint scope = param.scope;
while (scope--)
c = c->outer;
+ VM::CallContext *cc = static_cast<VM::CallContext *>(c);
const unsigned arg = param.index;
Q_ASSERT(arg >= 0);
- Q_ASSERT((unsigned) arg < c->argumentCount);
- Q_ASSERT(c->arguments);
- return c->arguments + arg;
+ Q_ASSERT((unsigned) arg < cc->argumentCount);
+ Q_ASSERT(cc->arguments);
+ return cc->arguments + arg;
} else if (param.isLocal()) {
VMSTATS(paramIsLocal);
const unsigned index = param.index;
namespace VM {
-static Value throwTypeError(ExecutionContext *ctx)
+static Value throwTypeError(CallContext *ctx)
{
ctx->throwTypeError();
return Value::undefinedValue();
struct ArgumentsObject: Object {
- ExecutionContext *context;
+ CallContext *context;
QVector<Value> mappedArguments;
ArgumentsObject(CallContext *context, int formalParameterCount, int actualParameterCount);
~ArgumentsObject() {}
return o->get(ctx, ctx->engine->id_length).toUInt32(ctx);
}
-Value ArrayPrototype::method_isArray(ExecutionContext *ctx)
+Value ArrayPrototype::method_isArray(CallContext *ctx)
{
Value arg = ctx->argument(0);
bool isArray = arg.asArrayObject();
return Value::fromBoolean(isArray);
}
-Value ArrayPrototype::method_toString(ExecutionContext *ctx)
+Value ArrayPrototype::method_toString(CallContext *ctx)
{
return method_join(ctx);
}
-Value ArrayPrototype::method_toLocaleString(ExecutionContext *ctx)
+Value ArrayPrototype::method_toLocaleString(CallContext *ctx)
{
return method_toString(ctx);
}
-Value ArrayPrototype::method_concat(ExecutionContext *ctx)
+Value ArrayPrototype::method_concat(CallContext *ctx)
{
ArrayObject *result = ctx->engine->newArrayObject(ctx);
return Value::fromObject(result);
}
-Value ArrayPrototype::method_join(ExecutionContext *ctx)
+Value ArrayPrototype::method_join(CallContext *ctx)
{
Value arg = ctx->argument(0);
return Value::fromString(ctx, R);
}
-Value ArrayPrototype::method_pop(ExecutionContext *ctx)
+Value ArrayPrototype::method_pop(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
return result;
}
-Value ArrayPrototype::method_push(ExecutionContext *ctx)
+Value ArrayPrototype::method_push(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
}
-Value ArrayPrototype::method_reverse(ExecutionContext *ctx)
+Value ArrayPrototype::method_reverse(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint length = getLength(ctx, instance);
return Value::fromObject(instance);
}
-Value ArrayPrototype::method_shift(ExecutionContext *ctx)
+Value ArrayPrototype::method_shift(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
return result;
}
-Value ArrayPrototype::method_slice(ExecutionContext *ctx)
+Value ArrayPrototype::method_slice(CallContext *ctx)
{
Object *o = ctx->thisObject.toObject(ctx);
return Value::fromObject(result);
}
-Value ArrayPrototype::method_sort(ExecutionContext *ctx)
+Value ArrayPrototype::method_sort(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
return ctx->thisObject;
}
-Value ArrayPrototype::method_splice(ExecutionContext *ctx)
+Value ArrayPrototype::method_splice(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
return Value::fromObject(newArray);
}
-Value ArrayPrototype::method_unshift(ExecutionContext *ctx)
+Value ArrayPrototype::method_unshift(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
return Value::fromDouble((double)newLen);
}
-Value ArrayPrototype::method_indexOf(ExecutionContext *ctx)
+Value ArrayPrototype::method_indexOf(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
return instance->arrayIndexOf(searchValue, fromIndex, len, ctx, instance);
}
-Value ArrayPrototype::method_lastIndexOf(ExecutionContext *ctx)
+Value ArrayPrototype::method_lastIndexOf(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
return Value::fromInt32(-1);
}
-Value ArrayPrototype::method_every(ExecutionContext *ctx)
+Value ArrayPrototype::method_every(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
return Value::fromBoolean(ok);
}
-Value ArrayPrototype::method_some(ExecutionContext *ctx)
+Value ArrayPrototype::method_some(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
return Value::fromBoolean(false);
}
-Value ArrayPrototype::method_forEach(ExecutionContext *ctx)
+Value ArrayPrototype::method_forEach(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
return Value::undefinedValue();
}
-Value ArrayPrototype::method_map(ExecutionContext *ctx)
+Value ArrayPrototype::method_map(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
return Value::fromObject(a);
}
-Value ArrayPrototype::method_filter(ExecutionContext *ctx)
+Value ArrayPrototype::method_filter(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
return Value::fromObject(a);
}
-Value ArrayPrototype::method_reduce(ExecutionContext *ctx)
+Value ArrayPrototype::method_reduce(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
return acc;
}
-Value ArrayPrototype::method_reduceRight(ExecutionContext *ctx)
+Value ArrayPrototype::method_reduceRight(CallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
static uint getLength(ExecutionContext *ctx, Object *o);
- static Value method_isArray(ExecutionContext *ctx);
- static Value method_toString(ExecutionContext *ctx);
- static Value method_toLocaleString(ExecutionContext *ctx);
- static Value method_concat(ExecutionContext *ctx);
- static Value method_join(ExecutionContext *ctx);
- static Value method_pop(ExecutionContext *ctx);
- static Value method_push(ExecutionContext *ctx);
- static Value method_reverse(ExecutionContext *ctx);
- static Value method_shift(ExecutionContext *ctx);
- static Value method_slice(ExecutionContext *ctx);
- static Value method_sort(ExecutionContext *ctx);
- static Value method_splice(ExecutionContext *ctx);
- static Value method_unshift(ExecutionContext *ctx);
- static Value method_indexOf(ExecutionContext *ctx);
- static Value method_lastIndexOf(ExecutionContext *ctx);
- static Value method_every(ExecutionContext *ctx);
- static Value method_some(ExecutionContext *ctx);
- static Value method_forEach(ExecutionContext *ctx);
- static Value method_map(ExecutionContext *ctx);
- static Value method_filter(ExecutionContext *ctx);
- static Value method_reduce(ExecutionContext *ctx);
- static Value method_reduceRight(ExecutionContext *ctx);
+ static Value method_isArray(CallContext *ctx);
+ static Value method_toString(CallContext *ctx);
+ static Value method_toLocaleString(CallContext *ctx);
+ static Value method_concat(CallContext *ctx);
+ static Value method_join(CallContext *ctx);
+ static Value method_pop(CallContext *ctx);
+ static Value method_push(CallContext *ctx);
+ static Value method_reverse(CallContext *ctx);
+ static Value method_shift(CallContext *ctx);
+ static Value method_slice(CallContext *ctx);
+ static Value method_sort(CallContext *ctx);
+ static Value method_splice(CallContext *ctx);
+ static Value method_unshift(CallContext *ctx);
+ static Value method_indexOf(CallContext *ctx);
+ static Value method_lastIndexOf(CallContext *ctx);
+ static Value method_every(CallContext *ctx);
+ static Value method_some(CallContext *ctx);
+ static Value method_forEach(CallContext *ctx);
+ static Value method_map(CallContext *ctx);
+ static Value method_filter(CallContext *ctx);
+ static Value method_reduce(CallContext *ctx);
+ static Value method_reduceRight(CallContext *ctx);
};
defineDefaultProperty(ctx, QStringLiteral("valueOf"), method_valueOf);
}
-Value BooleanPrototype::method_toString(ExecutionContext *ctx)
+Value BooleanPrototype::method_toString(CallContext *ctx)
{
bool result;
if (ctx->thisObject.isBoolean()) {
return Value::fromString(ctx, QLatin1String(result ? "true" : "false"));
}
-Value BooleanPrototype::method_valueOf(ExecutionContext *ctx)
+Value BooleanPrototype::method_valueOf(CallContext *ctx)
{
BooleanObject *thisObject = ctx->thisObject.asBooleanObject();
if (!thisObject)
BooleanPrototype(ExecutionEngine *engine): BooleanObject(engine, Value::fromBoolean(false)) {}
void init(ExecutionContext *ctx, const Value &ctor);
- static Value method_toString(ExecutionContext *ctx);
- static Value method_valueOf(ExecutionContext *ctx);
+ static Value method_toString(CallContext *ctx);
+ static Value method_valueOf(CallContext *ctx);
};
outer = 0;
lookups = 0;
global = 0;
-
- // ### remove
- arguments = 0;
- argumentCount = 0;
}
void WithContext::init(ExecutionContext *p, Object *with)
lookups = p->lookups;
withObject = with;
-
- // ### remove
- arguments = 0;
- argumentCount = 0;
}
void CatchContext::init(ExecutionContext *p, String *exceptionVarName, const Value &exceptionValue)
this->exceptionVarName = exceptionVarName;
this->exceptionValue = exceptionValue;
-
- // ### remove
- arguments = 0;
- argumentCount = 0;
}
void CallContext::initCallContext(ExecutionEngine *engine)
outer->mark();
thisObject.mark();
- for (unsigned arg = 0, lastArg = argumentCount; arg < lastArg; ++arg)
- arguments[arg].mark();
if (type == Type_CallContext || type == Type_QmlContext) {
VM::CallContext *c = static_cast<CallContext *>(this);
+ for (unsigned arg = 0, lastArg = c->argumentCount; arg < lastArg; ++arg)
+ c->arguments[arg].mark();
for (unsigned local = 0, lastLocal = c->variableCount(); local < lastLocal; ++local)
c->locals[local].mark();
c->function->mark();
Lookup *lookups;
ExecutionContext *next; // used in the GC
- // ### move to CallContext
- Value *arguments;
- unsigned int argumentCount;
-
String * const *formals() const;
unsigned int formalCount() const;
String * const *variables() const;
FunctionObject *function;
Value *locals;
+ Value *arguments;
+ unsigned int argumentCount;
Object *activation;
};
}
}
-Value DatePrototype::method_parse(ExecutionContext *ctx)
+Value DatePrototype::method_parse(CallContext *ctx)
{
return Value::fromDouble(ParseString(ctx->argument(0).toString(ctx)->toQString()));
}
-Value DatePrototype::method_UTC(ExecutionContext *ctx)
+Value DatePrototype::method_UTC(CallContext *ctx)
{
const int numArgs = ctx->argumentCount;
if (numArgs >= 2) {
return Value::undefinedValue();
}
-Value DatePrototype::method_now(ExecutionContext *ctx)
+Value DatePrototype::method_now(CallContext *ctx)
{
Q_UNUSED(ctx);
double t = currentTime();
return Value::fromDouble(t);
}
-Value DatePrototype::method_toString(ExecutionContext *ctx)
+Value DatePrototype::method_toString(CallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromString(ctx, ToString(t));
}
-Value DatePrototype::method_toDateString(ExecutionContext *ctx)
+Value DatePrototype::method_toDateString(CallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromString(ctx, ToDateString(t));
}
-Value DatePrototype::method_toTimeString(ExecutionContext *ctx)
+Value DatePrototype::method_toTimeString(CallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromString(ctx, ToTimeString(t));
}
-Value DatePrototype::method_toLocaleString(ExecutionContext *ctx)
+Value DatePrototype::method_toLocaleString(CallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromString(ctx, ToLocaleString(t));
}
-Value DatePrototype::method_toLocaleDateString(ExecutionContext *ctx)
+Value DatePrototype::method_toLocaleDateString(CallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromString(ctx, ToLocaleDateString(t));
}
-Value DatePrototype::method_toLocaleTimeString(ExecutionContext *ctx)
+Value DatePrototype::method_toLocaleTimeString(CallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromString(ctx, ToLocaleTimeString(t));
}
-Value DatePrototype::method_valueOf(ExecutionContext *ctx)
+Value DatePrototype::method_valueOf(CallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromDouble(t);
}
-Value DatePrototype::method_getTime(ExecutionContext *ctx)
+Value DatePrototype::method_getTime(CallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromDouble(t);
}
-Value DatePrototype::method_getYear(ExecutionContext *ctx)
+Value DatePrototype::method_getYear(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getFullYear(ExecutionContext *ctx)
+Value DatePrototype::method_getFullYear(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCFullYear(ExecutionContext *ctx)
+Value DatePrototype::method_getUTCFullYear(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getMonth(ExecutionContext *ctx)
+Value DatePrototype::method_getMonth(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCMonth(ExecutionContext *ctx)
+Value DatePrototype::method_getUTCMonth(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getDate(ExecutionContext *ctx)
+Value DatePrototype::method_getDate(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCDate(ExecutionContext *ctx)
+Value DatePrototype::method_getUTCDate(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getDay(ExecutionContext *ctx)
+Value DatePrototype::method_getDay(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCDay(ExecutionContext *ctx)
+Value DatePrototype::method_getUTCDay(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getHours(ExecutionContext *ctx)
+Value DatePrototype::method_getHours(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCHours(ExecutionContext *ctx)
+Value DatePrototype::method_getUTCHours(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getMinutes(ExecutionContext *ctx)
+Value DatePrototype::method_getMinutes(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCMinutes(ExecutionContext *ctx)
+Value DatePrototype::method_getUTCMinutes(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getSeconds(ExecutionContext *ctx)
+Value DatePrototype::method_getSeconds(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCSeconds(ExecutionContext *ctx)
+Value DatePrototype::method_getUTCSeconds(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getMilliseconds(ExecutionContext *ctx)
+Value DatePrototype::method_getMilliseconds(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCMilliseconds(ExecutionContext *ctx)
+Value DatePrototype::method_getUTCMilliseconds(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_getTimezoneOffset(ExecutionContext *ctx)
+Value DatePrototype::method_getTimezoneOffset(CallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
return Value::fromDouble(t);
}
-Value DatePrototype::method_setTime(ExecutionContext *ctx)
+Value DatePrototype::method_setTime(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setMilliseconds(ExecutionContext *ctx)
+Value DatePrototype::method_setMilliseconds(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setUTCMilliseconds(ExecutionContext *ctx)
+Value DatePrototype::method_setUTCMilliseconds(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setSeconds(ExecutionContext *ctx)
+Value DatePrototype::method_setSeconds(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setUTCSeconds(ExecutionContext *ctx)
+Value DatePrototype::method_setUTCSeconds(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setMinutes(ExecutionContext *ctx)
+Value DatePrototype::method_setMinutes(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setUTCMinutes(ExecutionContext *ctx)
+Value DatePrototype::method_setUTCMinutes(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setHours(ExecutionContext *ctx)
+Value DatePrototype::method_setHours(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setUTCHours(ExecutionContext *ctx)
+Value DatePrototype::method_setUTCHours(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setDate(ExecutionContext *ctx)
+Value DatePrototype::method_setDate(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setUTCDate(ExecutionContext *ctx)
+Value DatePrototype::method_setUTCDate(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setMonth(ExecutionContext *ctx)
+Value DatePrototype::method_setMonth(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setUTCMonth(ExecutionContext *ctx)
+Value DatePrototype::method_setUTCMonth(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setYear(ExecutionContext *ctx)
+Value DatePrototype::method_setYear(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setUTCFullYear(ExecutionContext *ctx)
+Value DatePrototype::method_setUTCFullYear(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_setFullYear(ExecutionContext *ctx)
+Value DatePrototype::method_setFullYear(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return self->value;
}
-Value DatePrototype::method_toUTCString(ExecutionContext *ctx)
+Value DatePrototype::method_toUTCString(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
}
}
-Value DatePrototype::method_toISOString(ExecutionContext *ctx)
+Value DatePrototype::method_toISOString(CallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
return Value::fromString(ctx, result);
}
-Value DatePrototype::method_toJSON(ExecutionContext *ctx)
+Value DatePrototype::method_toJSON(CallContext *ctx)
{
Value O = __qmljs_to_object(ctx, ctx->thisObject);
Value tv = __qmljs_to_primitive(O, ctx, NUMBER_HINT);
static double getThisDate(ExecutionContext *ctx);
- static Value method_parse(ExecutionContext *ctx);
- static Value method_UTC(ExecutionContext *ctx);
- static Value method_now(ExecutionContext *ctx);
+ static Value method_parse(CallContext *ctx);
+ static Value method_UTC(CallContext *ctx);
+ static Value method_now(CallContext *ctx);
- static Value method_toString(ExecutionContext *ctx);
- static Value method_toDateString(ExecutionContext *ctx);
- static Value method_toTimeString(ExecutionContext *ctx);
- static Value method_toLocaleString(ExecutionContext *ctx);
- static Value method_toLocaleDateString(ExecutionContext *ctx);
- static Value method_toLocaleTimeString(ExecutionContext *ctx);
- static Value method_valueOf(ExecutionContext *ctx);
- static Value method_getTime(ExecutionContext *ctx);
- static Value method_getYear(ExecutionContext *ctx);
- static Value method_getFullYear(ExecutionContext *ctx);
- static Value method_getUTCFullYear(ExecutionContext *ctx);
- static Value method_getMonth(ExecutionContext *ctx);
- static Value method_getUTCMonth(ExecutionContext *ctx);
- static Value method_getDate(ExecutionContext *ctx);
- static Value method_getUTCDate(ExecutionContext *ctx);
- static Value method_getDay(ExecutionContext *ctx);
- static Value method_getUTCDay(ExecutionContext *ctx);
- static Value method_getHours(ExecutionContext *ctx);
- static Value method_getUTCHours(ExecutionContext *ctx);
- static Value method_getMinutes(ExecutionContext *ctx);
- static Value method_getUTCMinutes(ExecutionContext *ctx);
- static Value method_getSeconds(ExecutionContext *ctx);
- static Value method_getUTCSeconds(ExecutionContext *ctx);
- static Value method_getMilliseconds(ExecutionContext *ctx);
- static Value method_getUTCMilliseconds(ExecutionContext *ctx);
- static Value method_getTimezoneOffset(ExecutionContext *ctx);
- static Value method_setTime(ExecutionContext *ctx);
- static Value method_setMilliseconds(ExecutionContext *ctx);
- static Value method_setUTCMilliseconds(ExecutionContext *ctx);
- static Value method_setSeconds(ExecutionContext *ctx);
- static Value method_setUTCSeconds(ExecutionContext *ctx);
- static Value method_setMinutes(ExecutionContext *ctx);
- static Value method_setUTCMinutes(ExecutionContext *ctx);
- static Value method_setHours(ExecutionContext *ctx);
- static Value method_setUTCHours(ExecutionContext *ctx);
- static Value method_setDate(ExecutionContext *ctx);
- static Value method_setUTCDate(ExecutionContext *ctx);
- static Value method_setMonth(ExecutionContext *ctx);
- static Value method_setUTCMonth(ExecutionContext *ctx);
- static Value method_setYear(ExecutionContext *ctx);
- static Value method_setFullYear(ExecutionContext *ctx);
- static Value method_setUTCFullYear(ExecutionContext *ctx);
- static Value method_toUTCString(ExecutionContext *ctx);
- static Value method_toISOString(ExecutionContext *ctx);
- static Value method_toJSON(ExecutionContext *ctx);
+ static Value method_toString(CallContext *ctx);
+ static Value method_toDateString(CallContext *ctx);
+ static Value method_toTimeString(CallContext *ctx);
+ static Value method_toLocaleString(CallContext *ctx);
+ static Value method_toLocaleDateString(CallContext *ctx);
+ static Value method_toLocaleTimeString(CallContext *ctx);
+ static Value method_valueOf(CallContext *ctx);
+ static Value method_getTime(CallContext *ctx);
+ static Value method_getYear(CallContext *ctx);
+ static Value method_getFullYear(CallContext *ctx);
+ static Value method_getUTCFullYear(CallContext *ctx);
+ static Value method_getMonth(CallContext *ctx);
+ static Value method_getUTCMonth(CallContext *ctx);
+ static Value method_getDate(CallContext *ctx);
+ static Value method_getUTCDate(CallContext *ctx);
+ static Value method_getDay(CallContext *ctx);
+ static Value method_getUTCDay(CallContext *ctx);
+ static Value method_getHours(CallContext *ctx);
+ static Value method_getUTCHours(CallContext *ctx);
+ static Value method_getMinutes(CallContext *ctx);
+ static Value method_getUTCMinutes(CallContext *ctx);
+ static Value method_getSeconds(CallContext *ctx);
+ static Value method_getUTCSeconds(CallContext *ctx);
+ static Value method_getMilliseconds(CallContext *ctx);
+ static Value method_getUTCMilliseconds(CallContext *ctx);
+ static Value method_getTimezoneOffset(CallContext *ctx);
+ static Value method_setTime(CallContext *ctx);
+ static Value method_setMilliseconds(CallContext *ctx);
+ static Value method_setUTCMilliseconds(CallContext *ctx);
+ static Value method_setSeconds(CallContext *ctx);
+ static Value method_setUTCSeconds(CallContext *ctx);
+ static Value method_setMinutes(CallContext *ctx);
+ static Value method_setUTCMinutes(CallContext *ctx);
+ static Value method_setHours(CallContext *ctx);
+ static Value method_setUTCHours(CallContext *ctx);
+ static Value method_setDate(CallContext *ctx);
+ static Value method_setUTCDate(CallContext *ctx);
+ static Value method_setMonth(CallContext *ctx);
+ static Value method_setUTCMonth(CallContext *ctx);
+ static Value method_setYear(CallContext *ctx);
+ static Value method_setFullYear(CallContext *ctx);
+ static Value method_setUTCFullYear(CallContext *ctx);
+ static Value method_toUTCString(CallContext *ctx);
+ static Value method_toISOString(CallContext *ctx);
+ static Value method_toJSON(CallContext *ctx);
};
} // end of namespace VM
return f;
}
-FunctionObject *ExecutionEngine::newBuiltinFunction(ExecutionContext *scope, String *name, Value (*code)(ExecutionContext *))
+FunctionObject *ExecutionEngine::newBuiltinFunction(ExecutionContext *scope, String *name, Value (*code)(CallContext *))
{
BuiltinFunctionOld *f = new (memoryManager) BuiltinFunctionOld(scope, name, code);
return f;
VM::Function *newFunction(const QString &name);
- FunctionObject *newBuiltinFunction(ExecutionContext *scope, String *name, Value (*code)(ExecutionContext *));
+ FunctionObject *newBuiltinFunction(ExecutionContext *scope, String *name, Value (*code)(CallContext *));
FunctionObject *newBuiltinFunction(ExecutionContext *scope, String *name, Value (*code)(ExecutionContext *, Value, Value *, int));
FunctionObject *newScriptFunction(ExecutionContext *scope, VM::Function *function);
BoundFunction *newBoundFunction(ExecutionContext *scope, FunctionObject *target, Value boundThis, const QVector<Value> &boundArgs);
obj->defineDefaultProperty(ctx, QStringLiteral("name"), Value::fromString(ctx, QStringLiteral("Error")));
}
-Value ErrorPrototype::method_toString(ExecutionContext *ctx)
+Value ErrorPrototype::method_toString(CallContext *ctx)
{
Object *o = ctx->thisObject.asObject();
if (!o)
void init(ExecutionContext *ctx, const Value &ctor) { init(ctx, ctor, this); }
static void init(ExecutionContext *ctx, const Value &ctor, Object *obj);
- static Value method_toString(ExecutionContext *ctx);
+ static Value method_toString(CallContext *ctx);
};
struct EvalErrorPrototype: EvalErrorObject
}
-Value FunctionPrototype::method_toString(ExecutionContext *ctx)
+Value FunctionPrototype::method_toString(CallContext *ctx)
{
FunctionObject *fun = ctx->thisObject.asFunctionObject();
if (!fun)
return Value::fromString(ctx, QStringLiteral("function() { [code] }"));
}
-Value FunctionPrototype::method_apply(ExecutionContext *ctx)
+Value FunctionPrototype::method_apply(CallContext *ctx)
{
Value thisArg = ctx->argument(0);
return o->call(ctx, thisArg, args.data(), args.size());
}
-Value FunctionPrototype::method_call(ExecutionContext *ctx)
+Value FunctionPrototype::method_call(CallContext *ctx)
{
Value thisArg = ctx->argument(0);
return o->call(ctx, thisArg, args.data(), args.size());
}
-Value FunctionPrototype::method_bind(ExecutionContext *ctx)
+Value FunctionPrototype::method_bind(CallContext *ctx)
{
FunctionObject *target = ctx->thisObject.asFunctionObject();
if (!target)
}
-static Value throwTypeError(ExecutionContext *ctx)
+static Value throwTypeError(CallContext *ctx)
{
ctx->throwTypeError();
return Value::undefinedValue();
DEFINE_MANAGED_VTABLE(BuiltinFunctionOld);
-BuiltinFunctionOld::BuiltinFunctionOld(ExecutionContext *scope, String *name, Value (*code)(ExecutionContext *))
+BuiltinFunctionOld::BuiltinFunctionOld(ExecutionContext *scope, String *name, Value (*code)(CallContext *))
: FunctionObject(scope)
, code(code)
{
Value BuiltinFunctionOld::call(Managed *that, ExecutionContext *context, const Value &thisObject, Value *args, int argc)
{
BuiltinFunctionOld *f = static_cast<BuiltinFunctionOld *>(that);
- ExecutionContext *ctx = context->engine->newCallContext(f, thisObject, args, argc);
+ CallContext *ctx = context->engine->newCallContext(f, thisObject, args, argc);
ctx->thisObject = thisObject;
if (!f->strictMode && !thisObject.isObject()) {
FunctionPrototype(ExecutionContext *ctx): FunctionObject(ctx) {}
void init(ExecutionContext *ctx, const Value &ctor);
- static Value method_toString(ExecutionContext *ctx);
- static Value method_apply(ExecutionContext *ctx);
- static Value method_call(ExecutionContext *ctx);
- static Value method_bind(ExecutionContext *ctx);
+ static Value method_toString(CallContext *ctx);
+ static Value method_apply(CallContext *ctx);
+ static Value method_call(CallContext *ctx);
+ static Value method_bind(CallContext *ctx);
};
struct BuiltinFunctionOld: FunctionObject {
- Value (*code)(ExecutionContext *);
+ Value (*code)(CallContext *);
- BuiltinFunctionOld(ExecutionContext *scope, String *name, Value (*code)(ExecutionContext *));
+ BuiltinFunctionOld(ExecutionContext *scope, String *name, Value (*code)(CallContext *));
static Value construct(Managed *, ExecutionContext *context, Value *args, int argc);
static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int);
}
// parseInt [15.1.2.2]
-Value GlobalFunctions::method_parseInt(ExecutionContext *context)
+Value GlobalFunctions::method_parseInt(CallContext *context)
{
Value string = context->argument(0);
Value radix = context->argument(1);
}
// parseFloat [15.1.2.3]
-Value GlobalFunctions::method_parseFloat(ExecutionContext *context)
+Value GlobalFunctions::method_parseFloat(CallContext *context)
{
Value string = context->argument(0);
}
/// isNaN [15.1.2.4]
-Value GlobalFunctions::method_isNaN(ExecutionContext *context)
+Value GlobalFunctions::method_isNaN(CallContext *context)
{
const Value &v = context->argument(0);
if (v.integerCompatible())
}
/// isFinite [15.1.2.5]
-Value GlobalFunctions::method_isFinite(ExecutionContext *context)
+Value GlobalFunctions::method_isFinite(CallContext *context)
{
const Value &v = context->argument(0);
if (v.integerCompatible())
return Value::fromString(parentCtx, out);
}
-Value GlobalFunctions::method_escape(ExecutionContext *context)
+Value GlobalFunctions::method_escape(CallContext *context)
{
if (!context->argumentCount)
return Value::fromString(context, QStringLiteral("undefined"));
return Value::fromString(context, escape(str));
}
-Value GlobalFunctions::method_unescape(ExecutionContext *context)
+Value GlobalFunctions::method_unescape(CallContext *context)
{
if (!context->argumentCount)
return Value::fromString(context, QStringLiteral("undefined"));
struct GlobalFunctions
{
- static Value method_parseInt(ExecutionContext *context);
- static Value method_parseFloat(ExecutionContext *context);
- static Value method_isNaN(ExecutionContext *context);
- static Value method_isFinite(ExecutionContext *context);
+ static Value method_parseInt(CallContext *context);
+ static Value method_parseFloat(CallContext *context);
+ static Value method_isNaN(CallContext *context);
+ static Value method_isFinite(CallContext *context);
static Value method_decodeURI(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
static Value method_decodeURIComponent(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
static Value method_encodeURI(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
static Value method_encodeURIComponent(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
- static Value method_escape(ExecutionContext *context);
- static Value method_unescape(ExecutionContext *context);
+ static Value method_escape(CallContext *context);
+ static Value method_unescape(CallContext *context);
};
} // namespace VM
}
if (t->index < 0) {
const int arg = -t->index - 1;
- loadPtr(Address(context, offsetof(ExecutionContext, arguments)), reg);
+ loadPtr(Address(context, offsetof(CallContext, arguments)), reg);
offset = arg * sizeof(Value);
} else if (t->index < f->locals.size()) {
loadPtr(Address(context, offsetof(CallContext, locals)), reg);
}
-Value JsonObject::method_parse(ExecutionContext *ctx)
+Value JsonObject::method_parse(CallContext *ctx)
{
QString jtext = ctx->argument(0).toString(ctx)->toQString();
return result;
}
-Value JsonObject::method_stringify(ExecutionContext *ctx)
+Value JsonObject::method_stringify(CallContext *ctx)
{
Stringify stringify(ctx);
struct JsonObject : Object {
JsonObject(ExecutionContext *context);
- static Value method_parse(ExecutionContext *ctx);
- static Value method_stringify(ExecutionContext *ctx);
+ static Value method_parse(CallContext *ctx);
+ static Value method_stringify(CallContext *ctx);
};
defineDefaultProperty(ctx, QStringLiteral("toPrecision"), method_toPrecision);
}
-Value NumberPrototype::method_toString(ExecutionContext *ctx)
+Value NumberPrototype::method_toString(CallContext *ctx)
{
double num;
if (ctx->thisObject.isNumber()) {
return Value::fromString(str);
}
-Value NumberPrototype::method_toLocaleString(ExecutionContext *ctx)
+Value NumberPrototype::method_toLocaleString(CallContext *ctx)
{
NumberObject *thisObject = ctx->thisObject.asNumberObject();
if (!thisObject)
return Value::fromString(str);
}
-Value NumberPrototype::method_valueOf(ExecutionContext *ctx)
+Value NumberPrototype::method_valueOf(CallContext *ctx)
{
NumberObject *thisObject = ctx->thisObject.asNumberObject();
if (!thisObject)
return thisObject->value;
}
-Value NumberPrototype::method_toFixed(ExecutionContext *ctx)
+Value NumberPrototype::method_toFixed(CallContext *ctx)
{
NumberObject *thisObject = ctx->thisObject.asNumberObject();
if (!thisObject)
return Value::fromString(ctx, str);
}
-Value NumberPrototype::method_toExponential(ExecutionContext *ctx)
+Value NumberPrototype::method_toExponential(CallContext *ctx)
{
NumberObject *thisObject = ctx->thisObject.asNumberObject();
if (!thisObject)
return Value::fromString(ctx, z);
}
-Value NumberPrototype::method_toPrecision(ExecutionContext *ctx)
+Value NumberPrototype::method_toPrecision(CallContext *ctx)
{
NumberObject *thisObject = ctx->thisObject.asNumberObject();
if (!thisObject)
NumberPrototype(ExecutionEngine *engine): NumberObject(engine, Value::fromDouble(0)) {}
void init(ExecutionContext *ctx, const Value &ctor);
- static Value method_toString(ExecutionContext *ctx);
- static Value method_toLocaleString(ExecutionContext *ctx);
- static Value method_valueOf(ExecutionContext *ctx);
- static Value method_toFixed(ExecutionContext *ctx);
- static Value method_toExponential(ExecutionContext *ctx);
- static Value method_toPrecision(ExecutionContext *ctx);
+ static Value method_toString(CallContext *ctx);
+ static Value method_toLocaleString(CallContext *ctx);
+ static Value method_valueOf(CallContext *ctx);
+ static Value method_toFixed(CallContext *ctx);
+ static Value method_toExponential(CallContext *ctx);
+ static Value method_toPrecision(CallContext *ctx);
};
defineDefaultProperty(context->engine->newIdentifier(name), value);
}
-void Object::defineDefaultProperty(ExecutionContext *context, const QString &name, Value (*code)(ExecutionContext *), int argumentCount)
+void Object::defineDefaultProperty(ExecutionContext *context, const QString &name, Value (*code)(CallContext *), int argumentCount)
{
Q_UNUSED(argumentCount);
String *s = context->engine->newIdentifier(name);
struct ErrorObject;
struct ArgumentsObject;
struct ExecutionContext;
+struct CallContext;
struct ExecutionEngine;
class MemoryManager;
/* The spec default: Writable: true, Enumerable: false, Configurable: true */
void defineDefaultProperty(String *name, Value value);
void defineDefaultProperty(ExecutionContext *context, const QString &name, Value value);
- void defineDefaultProperty(ExecutionContext *context, const QString &name, Value (*code)(ExecutionContext *), int count = 0);
+ void defineDefaultProperty(ExecutionContext *context, const QString &name, Value (*code)(CallContext *), int count = 0);
void defineDefaultProperty(ExecutionContext *context, const QString &name, Value (*code)(ExecutionContext *, Value, Value *, int), int argumentCount = 0);
/* Fixed: Writable: false, Enumerable: false, Configurable: false */
void defineReadonlyProperty(ExecutionEngine *engine, const QString &name, Value value);
defineDefaultProperty(ctx, QStringLiteral("__defineSetter__"), method_defineSetter, 0);
}
-Value ObjectPrototype::method_getPrototypeOf(ExecutionContext *ctx)
+Value ObjectPrototype::method_getPrototypeOf(CallContext *ctx)
{
Value o = ctx->argument(0);
if (! o.isObject())
return p ? Value::fromObject(p) : Value::nullValue();
}
-Value ObjectPrototype::method_getOwnPropertyDescriptor(ExecutionContext *ctx)
+Value ObjectPrototype::method_getOwnPropertyDescriptor(CallContext *ctx)
{
Value O = ctx->argument(0);
if (!O.isObject())
return Value::fromObject(array);
}
-Value ObjectPrototype::method_create(ExecutionContext *ctx)
+Value ObjectPrototype::method_create(CallContext *ctx)
{
Value O = ctx->argument(0);
if (!O.isObject() && !O.isNull())
return objValue;
}
-Value ObjectPrototype::method_defineProperty(ExecutionContext *ctx)
+Value ObjectPrototype::method_defineProperty(CallContext *ctx)
{
Value O = ctx->argument(0);
if (!O.isObject())
return O;
}
-Value ObjectPrototype::method_defineProperties(ExecutionContext *ctx)
+Value ObjectPrototype::method_defineProperties(CallContext *ctx)
{
Value O = ctx->argument(0);
if (!O.isObject())
return O;
}
-Value ObjectPrototype::method_seal(ExecutionContext *ctx)
+Value ObjectPrototype::method_seal(CallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
return ctx->argument(0);
}
-Value ObjectPrototype::method_freeze(ExecutionContext *ctx)
+Value ObjectPrototype::method_freeze(CallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
return ctx->argument(0);
}
-Value ObjectPrototype::method_preventExtensions(ExecutionContext *ctx)
+Value ObjectPrototype::method_preventExtensions(CallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
return ctx->argument(0);
}
-Value ObjectPrototype::method_isSealed(ExecutionContext *ctx)
+Value ObjectPrototype::method_isSealed(CallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
return Value::fromBoolean(true);
}
-Value ObjectPrototype::method_isFrozen(ExecutionContext *ctx)
+Value ObjectPrototype::method_isFrozen(CallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
return Value::fromBoolean(true);
}
-Value ObjectPrototype::method_isExtensible(ExecutionContext *ctx)
+Value ObjectPrototype::method_isExtensible(CallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
return Value::fromBoolean(o->extensible);
}
-Value ObjectPrototype::method_keys(ExecutionContext *ctx)
+Value ObjectPrototype::method_keys(CallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
return Value::fromObject(a);
}
-Value ObjectPrototype::method_toString(ExecutionContext *ctx)
+Value ObjectPrototype::method_toString(CallContext *ctx)
{
if (ctx->thisObject.isUndefined()) {
return Value::fromString(ctx, QStringLiteral("[object Undefined]"));
}
}
-Value ObjectPrototype::method_toLocaleString(ExecutionContext *ctx)
+Value ObjectPrototype::method_toLocaleString(CallContext *ctx)
{
Object *o = ctx->thisObject.toObject(ctx);
Value ts = o->get(ctx, ctx->engine->newString(QStringLiteral("toString")));
return f->call(ctx, Value::fromObject(o), 0, 0);
}
-Value ObjectPrototype::method_valueOf(ExecutionContext *ctx)
+Value ObjectPrototype::method_valueOf(CallContext *ctx)
{
return Value::fromObject(ctx->thisObject.toObject(ctx));
}
-Value ObjectPrototype::method_hasOwnProperty(ExecutionContext *ctx)
+Value ObjectPrototype::method_hasOwnProperty(CallContext *ctx)
{
String *P = ctx->argument(0).toString(ctx);
Object *O = ctx->thisObject.toObject(ctx);
return Value::fromBoolean(r);
}
-Value ObjectPrototype::method_isPrototypeOf(ExecutionContext *ctx)
+Value ObjectPrototype::method_isPrototypeOf(CallContext *ctx)
{
Value V = ctx->argument(0);
if (! V.isObject())
return Value::fromBoolean(false);
}
-Value ObjectPrototype::method_propertyIsEnumerable(ExecutionContext *ctx)
+Value ObjectPrototype::method_propertyIsEnumerable(CallContext *ctx)
{
String *p = ctx->argument(0).toString(ctx);
return Value::fromBoolean(pd && pd->isEnumerable());
}
-Value ObjectPrototype::method_defineGetter(ExecutionContext *ctx)
+Value ObjectPrototype::method_defineGetter(CallContext *ctx)
{
if (ctx->argumentCount < 2)
ctx->throwTypeError();
return Value::undefinedValue();
}
-Value ObjectPrototype::method_defineSetter(ExecutionContext *ctx)
+Value ObjectPrototype::method_defineSetter(CallContext *ctx)
{
if (ctx->argumentCount < 2)
ctx->throwTypeError();
void init(ExecutionContext *ctx, const Value &ctor);
- static Value method_getPrototypeOf(ExecutionContext *ctx);
- static Value method_getOwnPropertyDescriptor(ExecutionContext *ctx);
+ static Value method_getPrototypeOf(CallContext *ctx);
+ static Value method_getOwnPropertyDescriptor(CallContext *ctx);
static Value method_getOwnPropertyNames(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
- static Value method_create(ExecutionContext *ctx);
- static Value method_defineProperty(ExecutionContext *ctx);
- static Value method_defineProperties(ExecutionContext *ctx);
- static Value method_seal(ExecutionContext *ctx);
- static Value method_freeze(ExecutionContext *ctx);
- static Value method_preventExtensions(ExecutionContext *ctx);
- static Value method_isSealed(ExecutionContext *ctx);
- static Value method_isFrozen(ExecutionContext *ctx);
- static Value method_isExtensible(ExecutionContext *ctx);
- static Value method_keys(ExecutionContext *ctx);
-
- static Value method_toString(ExecutionContext *ctx);
- static Value method_toLocaleString(ExecutionContext *ctx);
- static Value method_valueOf(ExecutionContext *ctx);
- static Value method_hasOwnProperty(ExecutionContext *ctx);
- static Value method_isPrototypeOf(ExecutionContext *ctx);
- static Value method_propertyIsEnumerable(ExecutionContext *ctx);
-
- static Value method_defineGetter(ExecutionContext *ctx);
- static Value method_defineSetter(ExecutionContext *ctx);
+ static Value method_create(CallContext *ctx);
+ static Value method_defineProperty(CallContext *ctx);
+ static Value method_defineProperties(CallContext *ctx);
+ static Value method_seal(CallContext *ctx);
+ static Value method_freeze(CallContext *ctx);
+ static Value method_preventExtensions(CallContext *ctx);
+ static Value method_isSealed(CallContext *ctx);
+ static Value method_isFrozen(CallContext *ctx);
+ static Value method_isExtensible(CallContext *ctx);
+ static Value method_keys(CallContext *ctx);
+
+ static Value method_toString(CallContext *ctx);
+ static Value method_toLocaleString(CallContext *ctx);
+ static Value method_valueOf(CallContext *ctx);
+ static Value method_hasOwnProperty(CallContext *ctx);
+ static Value method_isPrototypeOf(CallContext *ctx);
+ static Value method_propertyIsEnumerable(CallContext *ctx);
+
+ static Value method_defineGetter(CallContext *ctx);
+ static Value method_defineSetter(CallContext *ctx);
static void toPropertyDescriptor(ExecutionContext *ctx, Value v, PropertyDescriptor *desc);
static Value fromPropertyDescriptor(ExecutionContext *ctx, const PropertyDescriptor *desc);
defineDefaultProperty(ctx, QStringLiteral("compile"), method_compile, 2);
}
-Value RegExpPrototype::method_exec(ExecutionContext *ctx)
+Value RegExpPrototype::method_exec(CallContext *ctx)
{
RegExpObject *r = ctx->thisObject.asRegExpObject();
if (!r)
return Value::fromObject(array);
}
-Value RegExpPrototype::method_test(ExecutionContext *ctx)
+Value RegExpPrototype::method_test(CallContext *ctx)
{
Value r = method_exec(ctx);
return Value::fromBoolean(!r.isNull());
}
-Value RegExpPrototype::method_toString(ExecutionContext *ctx)
+Value RegExpPrototype::method_toString(CallContext *ctx)
{
RegExpObject *r = ctx->thisObject.asRegExpObject();
if (!r)
return Value::fromString(ctx, result);
}
-Value RegExpPrototype::method_compile(ExecutionContext *ctx)
+Value RegExpPrototype::method_compile(CallContext *ctx)
{
RegExpObject *r = ctx->thisObject.asRegExpObject();
if (!r)
RegExpPrototype(ExecutionEngine* engine): RegExpObject(engine, RegExp::create(engine, QString()), false) {}
void init(ExecutionContext *ctx, const Value &ctor);
- static Value method_exec(ExecutionContext *ctx);
- static Value method_test(ExecutionContext *ctx);
- static Value method_toString(ExecutionContext *ctx);
- static Value method_compile(ExecutionContext *ctx);
+ static Value method_exec(CallContext *ctx);
+ static Value method_test(CallContext *ctx);
+ static Value method_toString(CallContext *ctx);
+ static Value method_compile(CallContext *ctx);
};
} // namespace VM
return result;
}
-Value StringPrototype::method_replace(ExecutionContext *ctx)
+Value StringPrototype::method_replace(CallContext *ctx)
{
QString string;
if (StringObject *thisString = ctx->thisObject.asStringObject())
return Value::fromString(ctx, result);
}
-Value StringPrototype::method_search(ExecutionContext *ctx)
+Value StringPrototype::method_search(CallContext *ctx)
{
QString string;
if (StringObject *thisString = ctx->thisObject.asStringObject())
return Value::fromUInt32(result);
}
-Value StringPrototype::method_slice(ExecutionContext *ctx)
+Value StringPrototype::method_slice(CallContext *ctx)
{
const QString text = getThisString(ctx);
const double length = text.length();
return Value::fromString(ctx, text.mid(intStart, count));
}
-Value StringPrototype::method_split(ExecutionContext *ctx)
+Value StringPrototype::method_split(CallContext *ctx)
{
QString text;
if (StringObject *thisObject = ctx->thisObject.asStringObject())
return Value::fromString(parentCtx, value.mid(x, y));
}
-Value StringPrototype::method_toLowerCase(ExecutionContext *ctx)
+Value StringPrototype::method_toLowerCase(CallContext *ctx)
{
QString value = getThisString(ctx);
return Value::fromString(ctx, value.toLower());
}
-Value StringPrototype::method_toLocaleLowerCase(ExecutionContext *ctx)
+Value StringPrototype::method_toLocaleLowerCase(CallContext *ctx)
{
return method_toLowerCase(ctx);
}
-Value StringPrototype::method_toUpperCase(ExecutionContext *ctx)
+Value StringPrototype::method_toUpperCase(CallContext *ctx)
{
QString value = getThisString(ctx);
return Value::fromString(ctx, value.toUpper());
}
-Value StringPrototype::method_toLocaleUpperCase(ExecutionContext *ctx)
+Value StringPrototype::method_toLocaleUpperCase(CallContext *ctx)
{
return method_toUpperCase(ctx);
}
return Value::fromString(parentCtx, str);
}
-Value StringPrototype::method_trim(ExecutionContext *ctx)
+Value StringPrototype::method_trim(CallContext *ctx)
{
if (ctx->thisObject.isNull() || ctx->thisObject.isUndefined())
ctx->throwTypeError();
static Value method_lastIndexOf(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
static Value method_localeCompare(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
static Value method_match(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
- static Value method_replace(ExecutionContext *ctx);
- static Value method_search(ExecutionContext *ctx);
- static Value method_slice(ExecutionContext *ctx);
- static Value method_split(ExecutionContext *ctx);
+ static Value method_replace(CallContext *ctx);
+ static Value method_search(CallContext *ctx);
+ static Value method_slice(CallContext *ctx);
+ static Value method_split(CallContext *ctx);
static Value method_substr(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
static Value method_substring(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
- static Value method_toLowerCase(ExecutionContext *ctx);
- static Value method_toLocaleLowerCase(ExecutionContext *ctx);
- static Value method_toUpperCase(ExecutionContext *ctx);
- static Value method_toLocaleUpperCase(ExecutionContext *ctx);
+ static Value method_toLowerCase(CallContext *ctx);
+ static Value method_toLocaleLowerCase(CallContext *ctx);
+ static Value method_toUpperCase(CallContext *ctx);
+ static Value method_toLocaleUpperCase(CallContext *ctx);
static Value method_fromCharCode(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
- static Value method_trim(ExecutionContext *ctx);
+ static Value method_trim(CallContext *ctx);
};
} // end of namespace VM