summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-04-05 21:15:58 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-04-06 23:34:21 +0200
commitf2971f053f2a24677fc2bcaf907435f4e949a54b (patch)
tree0d02f198aa6af9a64aec599b74996d651086f878 /src
parent13650a052f910dd42e9b7936f055e15588bdc3a9 (diff)
Introduce a SimpleCallContext for simple functions
Use it for most builtin methods. Gives ~10% speed improvement on the V8 benchmark. Change-Id: I0039f102e561c0adbe1a9b070150ad32142a33e8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/v4/qv4argumentsobject.cpp2
-rw-r--r--src/v4/qv4arrayobject.cpp44
-rw-r--r--src/v4/qv4arrayobject.h44
-rw-r--r--src/v4/qv4booleanobject.cpp4
-rw-r--r--src/v4/qv4booleanobject.h4
-rw-r--r--src/v4/qv4context.cpp36
-rw-r--r--src/v4/qv4context.h24
-rw-r--r--src/v4/qv4dateobject.cpp96
-rw-r--r--src/v4/qv4dateobject.h96
-rw-r--r--src/v4/qv4engine.cpp2
-rw-r--r--src/v4/qv4engine.h13
-rw-r--r--src/v4/qv4errorobject.cpp2
-rw-r--r--src/v4/qv4errorobject.h2
-rw-r--r--src/v4/qv4functionobject.cpp29
-rw-r--r--src/v4/qv4functionobject.h12
-rw-r--r--src/v4/qv4globalobject.cpp12
-rw-r--r--src/v4/qv4globalobject.h12
-rw-r--r--src/v4/qv4jsonobject.cpp4
-rw-r--r--src/v4/qv4jsonobject.h4
-rw-r--r--src/v4/qv4numberobject.cpp12
-rw-r--r--src/v4/qv4numberobject.h12
-rw-r--r--src/v4/qv4object.cpp2
-rw-r--r--src/v4/qv4object.h2
-rw-r--r--src/v4/qv4objectproto.cpp40
-rw-r--r--src/v4/qv4objectproto.h44
-rw-r--r--src/v4/qv4regexpobject.cpp8
-rw-r--r--src/v4/qv4regexpobject.h8
-rw-r--r--src/v4/qv4stringobject.cpp18
-rw-r--r--src/v4/qv4stringobject.h18
29 files changed, 315 insertions, 291 deletions
diff --git a/src/v4/qv4argumentsobject.cpp b/src/v4/qv4argumentsobject.cpp
index 06ce3e8f..ac67c36b 100644
--- a/src/v4/qv4argumentsobject.cpp
+++ b/src/v4/qv4argumentsobject.cpp
@@ -44,7 +44,7 @@ namespace QQmlJS {
namespace VM {
-static Value throwTypeError(CallContext *ctx)
+static Value throwTypeError(SimpleCallContext *ctx)
{
ctx->throwTypeError();
return Value::undefinedValue();
diff --git a/src/v4/qv4arrayobject.cpp b/src/v4/qv4arrayobject.cpp
index 4b6f8ea1..9b5f2d46 100644
--- a/src/v4/qv4arrayobject.cpp
+++ b/src/v4/qv4arrayobject.cpp
@@ -118,24 +118,24 @@ uint ArrayPrototype::getLength(ExecutionContext *ctx, Object *o)
return o->get(ctx, ctx->engine->id_length).toUInt32(ctx);
}
-Value ArrayPrototype::method_isArray(CallContext *ctx)
+Value ArrayPrototype::method_isArray(SimpleCallContext *ctx)
{
Value arg = ctx->argument(0);
bool isArray = arg.asArrayObject();
return Value::fromBoolean(isArray);
}
-Value ArrayPrototype::method_toString(CallContext *ctx)
+Value ArrayPrototype::method_toString(SimpleCallContext *ctx)
{
return method_join(ctx);
}
-Value ArrayPrototype::method_toLocaleString(CallContext *ctx)
+Value ArrayPrototype::method_toLocaleString(SimpleCallContext *ctx)
{
return method_toString(ctx);
}
-Value ArrayPrototype::method_concat(CallContext *ctx)
+Value ArrayPrototype::method_concat(SimpleCallContext *ctx)
{
ArrayObject *result = ctx->engine->newArrayObject(ctx);
@@ -159,7 +159,7 @@ Value ArrayPrototype::method_concat(CallContext *ctx)
return Value::fromObject(result);
}
-Value ArrayPrototype::method_join(CallContext *ctx)
+Value ArrayPrototype::method_join(SimpleCallContext *ctx)
{
Value arg = ctx->argument(0);
@@ -216,7 +216,7 @@ Value ArrayPrototype::method_join(CallContext *ctx)
return Value::fromString(ctx, R);
}
-Value ArrayPrototype::method_pop(CallContext *ctx)
+Value ArrayPrototype::method_pop(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
@@ -237,7 +237,7 @@ Value ArrayPrototype::method_pop(CallContext *ctx)
return result;
}
-Value ArrayPrototype::method_push(CallContext *ctx)
+Value ArrayPrototype::method_push(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
@@ -294,7 +294,7 @@ Value ArrayPrototype::method_push(CallContext *ctx)
}
-Value ArrayPrototype::method_reverse(CallContext *ctx)
+Value ArrayPrototype::method_reverse(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint length = getLength(ctx, instance);
@@ -317,7 +317,7 @@ Value ArrayPrototype::method_reverse(CallContext *ctx)
return Value::fromObject(instance);
}
-Value ArrayPrototype::method_shift(CallContext *ctx)
+Value ArrayPrototype::method_shift(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
@@ -380,7 +380,7 @@ Value ArrayPrototype::method_shift(CallContext *ctx)
return result;
}
-Value ArrayPrototype::method_slice(CallContext *ctx)
+Value ArrayPrototype::method_slice(SimpleCallContext *ctx)
{
Object *o = ctx->thisObject.toObject(ctx);
@@ -417,7 +417,7 @@ Value ArrayPrototype::method_slice(CallContext *ctx)
return Value::fromObject(result);
}
-Value ArrayPrototype::method_sort(CallContext *ctx)
+Value ArrayPrototype::method_sort(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
@@ -428,7 +428,7 @@ Value ArrayPrototype::method_sort(CallContext *ctx)
return ctx->thisObject;
}
-Value ArrayPrototype::method_splice(CallContext *ctx)
+Value ArrayPrototype::method_splice(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
@@ -492,7 +492,7 @@ Value ArrayPrototype::method_splice(CallContext *ctx)
return Value::fromObject(newArray);
}
-Value ArrayPrototype::method_unshift(CallContext *ctx)
+Value ArrayPrototype::method_unshift(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
@@ -544,7 +544,7 @@ Value ArrayPrototype::method_unshift(CallContext *ctx)
return Value::fromDouble((double)newLen);
}
-Value ArrayPrototype::method_indexOf(CallContext *ctx)
+Value ArrayPrototype::method_indexOf(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
@@ -581,7 +581,7 @@ Value ArrayPrototype::method_indexOf(CallContext *ctx)
return instance->arrayIndexOf(searchValue, fromIndex, len, ctx, instance);
}
-Value ArrayPrototype::method_lastIndexOf(CallContext *ctx)
+Value ArrayPrototype::method_lastIndexOf(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
uint len = getLength(ctx, instance);
@@ -618,7 +618,7 @@ Value ArrayPrototype::method_lastIndexOf(CallContext *ctx)
return Value::fromInt32(-1);
}
-Value ArrayPrototype::method_every(CallContext *ctx)
+Value ArrayPrototype::method_every(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
@@ -647,7 +647,7 @@ Value ArrayPrototype::method_every(CallContext *ctx)
return Value::fromBoolean(ok);
}
-Value ArrayPrototype::method_some(CallContext *ctx)
+Value ArrayPrototype::method_some(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
@@ -676,7 +676,7 @@ Value ArrayPrototype::method_some(CallContext *ctx)
return Value::fromBoolean(false);
}
-Value ArrayPrototype::method_forEach(CallContext *ctx)
+Value ArrayPrototype::method_forEach(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
@@ -703,7 +703,7 @@ Value ArrayPrototype::method_forEach(CallContext *ctx)
return Value::undefinedValue();
}
-Value ArrayPrototype::method_map(CallContext *ctx)
+Value ArrayPrototype::method_map(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
@@ -735,7 +735,7 @@ Value ArrayPrototype::method_map(CallContext *ctx)
return Value::fromObject(a);
}
-Value ArrayPrototype::method_filter(CallContext *ctx)
+Value ArrayPrototype::method_filter(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
@@ -770,7 +770,7 @@ Value ArrayPrototype::method_filter(CallContext *ctx)
return Value::fromObject(a);
}
-Value ArrayPrototype::method_reduce(CallContext *ctx)
+Value ArrayPrototype::method_reduce(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
@@ -812,7 +812,7 @@ Value ArrayPrototype::method_reduce(CallContext *ctx)
return acc;
}
-Value ArrayPrototype::method_reduceRight(CallContext *ctx)
+Value ArrayPrototype::method_reduceRight(SimpleCallContext *ctx)
{
Object *instance = ctx->thisObject.toObject(ctx);
diff --git a/src/v4/qv4arrayobject.h b/src/v4/qv4arrayobject.h
index a4ab90c0..86d14eb5 100644
--- a/src/v4/qv4arrayobject.h
+++ b/src/v4/qv4arrayobject.h
@@ -70,28 +70,28 @@ struct ArrayPrototype: ArrayObject
static uint getLength(ExecutionContext *ctx, Object *o);
- 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);
+ static Value method_isArray(SimpleCallContext *ctx);
+ static Value method_toString(SimpleCallContext *ctx);
+ static Value method_toLocaleString(SimpleCallContext *ctx);
+ static Value method_concat(SimpleCallContext *ctx);
+ static Value method_join(SimpleCallContext *ctx);
+ static Value method_pop(SimpleCallContext *ctx);
+ static Value method_push(SimpleCallContext *ctx);
+ static Value method_reverse(SimpleCallContext *ctx);
+ static Value method_shift(SimpleCallContext *ctx);
+ static Value method_slice(SimpleCallContext *ctx);
+ static Value method_sort(SimpleCallContext *ctx);
+ static Value method_splice(SimpleCallContext *ctx);
+ static Value method_unshift(SimpleCallContext *ctx);
+ static Value method_indexOf(SimpleCallContext *ctx);
+ static Value method_lastIndexOf(SimpleCallContext *ctx);
+ static Value method_every(SimpleCallContext *ctx);
+ static Value method_some(SimpleCallContext *ctx);
+ static Value method_forEach(SimpleCallContext *ctx);
+ static Value method_map(SimpleCallContext *ctx);
+ static Value method_filter(SimpleCallContext *ctx);
+ static Value method_reduce(SimpleCallContext *ctx);
+ static Value method_reduceRight(SimpleCallContext *ctx);
};
diff --git a/src/v4/qv4booleanobject.cpp b/src/v4/qv4booleanobject.cpp
index 1f55e926..e449e5c7 100644
--- a/src/v4/qv4booleanobject.cpp
+++ b/src/v4/qv4booleanobject.cpp
@@ -72,7 +72,7 @@ void BooleanPrototype::init(ExecutionContext *ctx, const Value &ctor)
defineDefaultProperty(ctx, QStringLiteral("valueOf"), method_valueOf);
}
-Value BooleanPrototype::method_toString(CallContext *ctx)
+Value BooleanPrototype::method_toString(SimpleCallContext *ctx)
{
bool result;
if (ctx->thisObject.isBoolean()) {
@@ -87,7 +87,7 @@ Value BooleanPrototype::method_toString(CallContext *ctx)
return Value::fromString(ctx, QLatin1String(result ? "true" : "false"));
}
-Value BooleanPrototype::method_valueOf(CallContext *ctx)
+Value BooleanPrototype::method_valueOf(SimpleCallContext *ctx)
{
BooleanObject *thisObject = ctx->thisObject.asBooleanObject();
if (!thisObject)
diff --git a/src/v4/qv4booleanobject.h b/src/v4/qv4booleanobject.h
index c3e13978..05b54259 100644
--- a/src/v4/qv4booleanobject.h
+++ b/src/v4/qv4booleanobject.h
@@ -66,8 +66,8 @@ struct BooleanPrototype: BooleanObject
BooleanPrototype(ExecutionEngine *engine): BooleanObject(engine, Value::fromBoolean(false)) {}
void init(ExecutionContext *ctx, const Value &ctor);
- static Value method_toString(CallContext *ctx);
- static Value method_valueOf(CallContext *ctx);
+ static Value method_toString(SimpleCallContext *ctx);
+ static Value method_valueOf(SimpleCallContext *ctx);
};
diff --git a/src/v4/qv4context.cpp b/src/v4/qv4context.cpp
index 21a5763c..c2ecec82 100644
--- a/src/v4/qv4context.cpp
+++ b/src/v4/qv4context.cpp
@@ -86,7 +86,7 @@ void ExecutionContext::createMutableBinding(String *name, bool deletable)
Object *activation = engine->globalObject.objectValue();
ExecutionContext *ctx = this;
while (ctx) {
- if (ctx->type == Type_CallContext || ctx->type == Type_QmlContext) {
+ if (ctx->type >= Type_CallContext) {
CallContext *c = static_cast<CallContext *>(ctx);
if (!c->activation)
c->activation = engine->newObject();
@@ -109,22 +109,22 @@ void ExecutionContext::createMutableBinding(String *name, bool deletable)
String * const *ExecutionContext::formals() const
{
- return type == Type_CallContext ? static_cast<const CallContext *>(this)->function->formalParameterList : 0;
+ return type >= Type_CallContext ? static_cast<const CallContext *>(this)->function->formalParameterList : 0;
}
unsigned int ExecutionContext::formalCount() const
{
- return type == Type_CallContext ? static_cast<const CallContext *>(this)->function->formalParameterCount : 0;
+ return type >= Type_CallContext ? static_cast<const CallContext *>(this)->function->formalParameterCount : 0;
}
String * const *ExecutionContext::variables() const
{
- return type == Type_CallContext ? static_cast<const CallContext *>(this)->function->varList : 0;
+ return type >= Type_CallContext ? static_cast<const CallContext *>(this)->function->varList : 0;
}
unsigned int ExecutionContext::variableCount() const
{
- return type == Type_CallContext ? static_cast<const CallContext *>(this)->function->varCount : 0;
+ return type >= Type_CallContext ? static_cast<const CallContext *>(this)->function->varCount : 0;
}
@@ -232,7 +232,7 @@ bool ExecutionContext::deleteProperty(String *name)
CatchContext *c = static_cast<CatchContext *>(ctx);
if (c->exceptionVarName->isEqualTo(name))
return false;
- } else if (ctx->type == Type_CallContext || ctx->type == Type_QmlContext) {
+ } else if (ctx->type >= Type_CallContext) {
CallContext *c = static_cast<CallContext *>(ctx);
FunctionObject *f = c->function;
if (f->needsActivation || hasWith) {
@@ -268,20 +268,22 @@ void ExecutionContext::mark()
return;
marked = true;
- if (outer)
+ if (type != Type_SimpleCallContext && outer)
outer->mark();
thisObject.mark();
- if (type == Type_CallContext || type == Type_QmlContext) {
+ if (type >= Type_SimpleCallContext) {
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();
- if (c->activation)
- c->activation->mark();
+ if (type >= Type_CallContext) {
+ for (unsigned local = 0, lastLocal = c->variableCount(); local < lastLocal; ++local)
+ c->locals[local].mark();
+ if (c->activation)
+ c->activation->mark();
+ c->function->mark();
+ }
} else if (type == Type_WithContext) {
WithContext *w = static_cast<WithContext *>(this);
w->withObject->mark();
@@ -310,7 +312,7 @@ void ExecutionContext::setProperty(String *name, const Value& value)
return;
} else {
Object *activation = 0;
- if (ctx->type == Type_CallContext || ctx->type == Type_QmlContext) {
+ if (ctx->type >= Type_CallContext) {
CallContext *c = static_cast<CallContext *>(ctx);
for (unsigned int i = 0; i < c->function->varCount; ++i)
if (c->function->varList[i]->isEqualTo(name)) {
@@ -366,7 +368,7 @@ Value ExecutionContext::getProperty(String *name)
return c->exceptionValue;
}
- else if (ctx->type == Type_CallContext || ctx->type == Type_QmlContext) {
+ else if (ctx->type >= Type_CallContext) {
VM::CallContext *c = static_cast<CallContext *>(ctx);
FunctionObject *f = c->function;
if (f->needsActivation || hasWith || hasCatchScope) {
@@ -428,7 +430,7 @@ Value ExecutionContext::getPropertyNoThrow(String *name)
return c->exceptionValue;
}
- else if (ctx->type == Type_CallContext || ctx->type == Type_QmlContext) {
+ else if (ctx->type >= Type_CallContext) {
VM::CallContext *c = static_cast<CallContext *>(ctx);
FunctionObject *f = c->function;
if (f->needsActivation || hasWith || hasCatchScope) {
@@ -491,7 +493,7 @@ Value ExecutionContext::getPropertyAndBase(String *name, Object **base)
return c->exceptionValue;
}
- else if (ctx->type == Type_CallContext || ctx->type == Type_QmlContext) {
+ else if (ctx->type >= Type_CallContext) {
VM::CallContext *c = static_cast<CallContext *>(ctx);
FunctionObject *f = c->function;
if (f->needsActivation || hasWith || hasCatchScope) {
diff --git a/src/v4/qv4context.h b/src/v4/qv4context.h
index 5d43bf63..e70ca8b5 100644
--- a/src/v4/qv4context.h
+++ b/src/v4/qv4context.h
@@ -79,10 +79,10 @@ struct ExecutionContext
{
enum Type {
Type_GlobalContext = 0x1,
- Type_SimpleCallContext = 0x2,
- Type_CallContext = 0x3,
- Type_CatchContext = 0x4,
- Type_WithContext = 0x5,
+ Type_CatchContext = 0x2,
+ Type_WithContext = 0x3,
+ Type_SimpleCallContext = 0x4,
+ Type_CallContext = 0x5,
Type_QmlContext = 0x6
};
@@ -127,15 +127,19 @@ struct ExecutionContext
inline CallContext *asCallContext();
};
-struct CallContext : public ExecutionContext
+struct SimpleCallContext : public ExecutionContext
+{
+ FunctionObject *function;
+ Value *arguments;
+ unsigned int argumentCount;
+};
+
+struct CallContext : public SimpleCallContext
{
void initCallContext(QQmlJS::VM::ExecutionEngine *engine);
bool needsOwnArguments() const;
- FunctionObject *function;
Value *locals;
- Value *arguments;
- unsigned int argumentCount;
Object *activation;
};
@@ -163,7 +167,7 @@ struct WithContext : public ExecutionContext
inline Value ExecutionContext::argument(unsigned int index)
{
- if (type == Type_CallContext) {
+ if (type >= Type_SimpleCallContext) {
CallContext *ctx = static_cast<CallContext *>(this);
if (index < ctx->argumentCount)
return ctx->arguments[index];
@@ -173,7 +177,7 @@ inline Value ExecutionContext::argument(unsigned int index)
inline CallContext *ExecutionContext::asCallContext()
{
- return type == Type_CallContext ? static_cast<CallContext *>(this) : 0;
+ return type >= Type_CallContext ? static_cast<CallContext *>(this) : 0;
}
/* Function *f, int argc */
diff --git a/src/v4/qv4dateobject.cpp b/src/v4/qv4dateobject.cpp
index fab70ded..a8e7e8c2 100644
--- a/src/v4/qv4dateobject.cpp
+++ b/src/v4/qv4dateobject.cpp
@@ -778,12 +778,12 @@ double DatePrototype::getThisDate(ExecutionContext *ctx)
}
}
-Value DatePrototype::method_parse(CallContext *ctx)
+Value DatePrototype::method_parse(SimpleCallContext *ctx)
{
return Value::fromDouble(ParseString(ctx->argument(0).toString(ctx)->toQString()));
}
-Value DatePrototype::method_UTC(CallContext *ctx)
+Value DatePrototype::method_UTC(SimpleCallContext *ctx)
{
const int numArgs = ctx->argumentCount;
if (numArgs >= 2) {
@@ -803,62 +803,62 @@ Value DatePrototype::method_UTC(CallContext *ctx)
return Value::undefinedValue();
}
-Value DatePrototype::method_now(CallContext *ctx)
+Value DatePrototype::method_now(SimpleCallContext *ctx)
{
Q_UNUSED(ctx);
double t = currentTime();
return Value::fromDouble(t);
}
-Value DatePrototype::method_toString(CallContext *ctx)
+Value DatePrototype::method_toString(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromString(ctx, ToString(t));
}
-Value DatePrototype::method_toDateString(CallContext *ctx)
+Value DatePrototype::method_toDateString(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromString(ctx, ToDateString(t));
}
-Value DatePrototype::method_toTimeString(CallContext *ctx)
+Value DatePrototype::method_toTimeString(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromString(ctx, ToTimeString(t));
}
-Value DatePrototype::method_toLocaleString(CallContext *ctx)
+Value DatePrototype::method_toLocaleString(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromString(ctx, ToLocaleString(t));
}
-Value DatePrototype::method_toLocaleDateString(CallContext *ctx)
+Value DatePrototype::method_toLocaleDateString(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromString(ctx, ToLocaleDateString(t));
}
-Value DatePrototype::method_toLocaleTimeString(CallContext *ctx)
+Value DatePrototype::method_toLocaleTimeString(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromString(ctx, ToLocaleTimeString(t));
}
-Value DatePrototype::method_valueOf(CallContext *ctx)
+Value DatePrototype::method_valueOf(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromDouble(t);
}
-Value DatePrototype::method_getTime(CallContext *ctx)
+Value DatePrototype::method_getTime(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
return Value::fromDouble(t);
}
-Value DatePrototype::method_getYear(CallContext *ctx)
+Value DatePrototype::method_getYear(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -866,7 +866,7 @@ Value DatePrototype::method_getYear(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getFullYear(CallContext *ctx)
+Value DatePrototype::method_getFullYear(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -874,7 +874,7 @@ Value DatePrototype::method_getFullYear(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCFullYear(CallContext *ctx)
+Value DatePrototype::method_getUTCFullYear(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -882,7 +882,7 @@ Value DatePrototype::method_getUTCFullYear(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getMonth(CallContext *ctx)
+Value DatePrototype::method_getMonth(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -890,7 +890,7 @@ Value DatePrototype::method_getMonth(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCMonth(CallContext *ctx)
+Value DatePrototype::method_getUTCMonth(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -898,7 +898,7 @@ Value DatePrototype::method_getUTCMonth(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getDate(CallContext *ctx)
+Value DatePrototype::method_getDate(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -906,7 +906,7 @@ Value DatePrototype::method_getDate(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCDate(CallContext *ctx)
+Value DatePrototype::method_getUTCDate(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -914,7 +914,7 @@ Value DatePrototype::method_getUTCDate(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getDay(CallContext *ctx)
+Value DatePrototype::method_getDay(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -922,7 +922,7 @@ Value DatePrototype::method_getDay(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCDay(CallContext *ctx)
+Value DatePrototype::method_getUTCDay(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -930,7 +930,7 @@ Value DatePrototype::method_getUTCDay(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getHours(CallContext *ctx)
+Value DatePrototype::method_getHours(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -938,7 +938,7 @@ Value DatePrototype::method_getHours(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCHours(CallContext *ctx)
+Value DatePrototype::method_getUTCHours(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -946,7 +946,7 @@ Value DatePrototype::method_getUTCHours(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getMinutes(CallContext *ctx)
+Value DatePrototype::method_getMinutes(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -954,7 +954,7 @@ Value DatePrototype::method_getMinutes(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCMinutes(CallContext *ctx)
+Value DatePrototype::method_getUTCMinutes(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -962,7 +962,7 @@ Value DatePrototype::method_getUTCMinutes(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getSeconds(CallContext *ctx)
+Value DatePrototype::method_getSeconds(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -970,7 +970,7 @@ Value DatePrototype::method_getSeconds(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCSeconds(CallContext *ctx)
+Value DatePrototype::method_getUTCSeconds(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -978,7 +978,7 @@ Value DatePrototype::method_getUTCSeconds(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getMilliseconds(CallContext *ctx)
+Value DatePrototype::method_getMilliseconds(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -986,7 +986,7 @@ Value DatePrototype::method_getMilliseconds(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getUTCMilliseconds(CallContext *ctx)
+Value DatePrototype::method_getUTCMilliseconds(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -994,7 +994,7 @@ Value DatePrototype::method_getUTCMilliseconds(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_getTimezoneOffset(CallContext *ctx)
+Value DatePrototype::method_getTimezoneOffset(SimpleCallContext *ctx)
{
double t = getThisDate(ctx);
if (! isnan(t))
@@ -1002,7 +1002,7 @@ Value DatePrototype::method_getTimezoneOffset(CallContext *ctx)
return Value::fromDouble(t);
}
-Value DatePrototype::method_setTime(CallContext *ctx)
+Value DatePrototype::method_setTime(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1012,7 +1012,7 @@ Value DatePrototype::method_setTime(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setMilliseconds(CallContext *ctx)
+Value DatePrototype::method_setMilliseconds(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1024,7 +1024,7 @@ Value DatePrototype::method_setMilliseconds(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setUTCMilliseconds(CallContext *ctx)
+Value DatePrototype::method_setUTCMilliseconds(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1036,7 +1036,7 @@ Value DatePrototype::method_setUTCMilliseconds(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setSeconds(CallContext *ctx)
+Value DatePrototype::method_setSeconds(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1050,7 +1050,7 @@ Value DatePrototype::method_setSeconds(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setUTCSeconds(CallContext *ctx)
+Value DatePrototype::method_setUTCSeconds(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1064,7 +1064,7 @@ Value DatePrototype::method_setUTCSeconds(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setMinutes(CallContext *ctx)
+Value DatePrototype::method_setMinutes(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1079,7 +1079,7 @@ Value DatePrototype::method_setMinutes(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setUTCMinutes(CallContext *ctx)
+Value DatePrototype::method_setUTCMinutes(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1094,7 +1094,7 @@ Value DatePrototype::method_setUTCMinutes(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setHours(CallContext *ctx)
+Value DatePrototype::method_setHours(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1110,7 +1110,7 @@ Value DatePrototype::method_setHours(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setUTCHours(CallContext *ctx)
+Value DatePrototype::method_setUTCHours(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1126,7 +1126,7 @@ Value DatePrototype::method_setUTCHours(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setDate(CallContext *ctx)
+Value DatePrototype::method_setDate(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1139,7 +1139,7 @@ Value DatePrototype::method_setDate(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setUTCDate(CallContext *ctx)
+Value DatePrototype::method_setUTCDate(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1152,7 +1152,7 @@ Value DatePrototype::method_setUTCDate(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setMonth(CallContext *ctx)
+Value DatePrototype::method_setMonth(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1166,7 +1166,7 @@ Value DatePrototype::method_setMonth(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setUTCMonth(CallContext *ctx)
+Value DatePrototype::method_setUTCMonth(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1180,7 +1180,7 @@ Value DatePrototype::method_setUTCMonth(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setYear(CallContext *ctx)
+Value DatePrototype::method_setYear(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1206,7 +1206,7 @@ Value DatePrototype::method_setYear(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setUTCFullYear(CallContext *ctx)
+Value DatePrototype::method_setUTCFullYear(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1221,7 +1221,7 @@ Value DatePrototype::method_setUTCFullYear(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_setFullYear(CallContext *ctx)
+Value DatePrototype::method_setFullYear(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1238,7 +1238,7 @@ Value DatePrototype::method_setFullYear(CallContext *ctx)
return self->value;
}
-Value DatePrototype::method_toUTCString(CallContext *ctx)
+Value DatePrototype::method_toUTCString(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1261,7 +1261,7 @@ static void addZeroPrefixedInt(QString &str, int num, int nDigits)
}
}
-Value DatePrototype::method_toISOString(CallContext *ctx)
+Value DatePrototype::method_toISOString(SimpleCallContext *ctx)
{
DateObject *self = ctx->thisObject.asDateObject();
if (!self)
@@ -1299,7 +1299,7 @@ Value DatePrototype::method_toISOString(CallContext *ctx)
return Value::fromString(ctx, result);
}
-Value DatePrototype::method_toJSON(CallContext *ctx)
+Value DatePrototype::method_toJSON(SimpleCallContext *ctx)
{
Value O = __qmljs_to_object(ctx, ctx->thisObject);
Value tv = __qmljs_to_primitive(O, ctx, NUMBER_HINT);
diff --git a/src/v4/qv4dateobject.h b/src/v4/qv4dateobject.h
index d91b68bd..49a879e8 100644
--- a/src/v4/qv4dateobject.h
+++ b/src/v4/qv4dateobject.h
@@ -73,55 +73,55 @@ struct DatePrototype: DateObject
static double getThisDate(ExecutionContext *ctx);
- static Value method_parse(CallContext *ctx);
- static Value method_UTC(CallContext *ctx);
- static Value method_now(CallContext *ctx);
+ static Value method_parse(SimpleCallContext *ctx);
+ static Value method_UTC(SimpleCallContext *ctx);
+ static Value method_now(SimpleCallContext *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);
+ static Value method_toString(SimpleCallContext *ctx);
+ static Value method_toDateString(SimpleCallContext *ctx);
+ static Value method_toTimeString(SimpleCallContext *ctx);
+ static Value method_toLocaleString(SimpleCallContext *ctx);
+ static Value method_toLocaleDateString(SimpleCallContext *ctx);
+ static Value method_toLocaleTimeString(SimpleCallContext *ctx);
+ static Value method_valueOf(SimpleCallContext *ctx);
+ static Value method_getTime(SimpleCallContext *ctx);
+ static Value method_getYear(SimpleCallContext *ctx);
+ static Value method_getFullYear(SimpleCallContext *ctx);
+ static Value method_getUTCFullYear(SimpleCallContext *ctx);
+ static Value method_getMonth(SimpleCallContext *ctx);
+ static Value method_getUTCMonth(SimpleCallContext *ctx);
+ static Value method_getDate(SimpleCallContext *ctx);
+ static Value method_getUTCDate(SimpleCallContext *ctx);
+ static Value method_getDay(SimpleCallContext *ctx);
+ static Value method_getUTCDay(SimpleCallContext *ctx);
+ static Value method_getHours(SimpleCallContext *ctx);
+ static Value method_getUTCHours(SimpleCallContext *ctx);
+ static Value method_getMinutes(SimpleCallContext *ctx);
+ static Value method_getUTCMinutes(SimpleCallContext *ctx);
+ static Value method_getSeconds(SimpleCallContext *ctx);
+ static Value method_getUTCSeconds(SimpleCallContext *ctx);
+ static Value method_getMilliseconds(SimpleCallContext *ctx);
+ static Value method_getUTCMilliseconds(SimpleCallContext *ctx);
+ static Value method_getTimezoneOffset(SimpleCallContext *ctx);
+ static Value method_setTime(SimpleCallContext *ctx);
+ static Value method_setMilliseconds(SimpleCallContext *ctx);
+ static Value method_setUTCMilliseconds(SimpleCallContext *ctx);
+ static Value method_setSeconds(SimpleCallContext *ctx);
+ static Value method_setUTCSeconds(SimpleCallContext *ctx);
+ static Value method_setMinutes(SimpleCallContext *ctx);
+ static Value method_setUTCMinutes(SimpleCallContext *ctx);
+ static Value method_setHours(SimpleCallContext *ctx);
+ static Value method_setUTCHours(SimpleCallContext *ctx);
+ static Value method_setDate(SimpleCallContext *ctx);
+ static Value method_setUTCDate(SimpleCallContext *ctx);
+ static Value method_setMonth(SimpleCallContext *ctx);
+ static Value method_setUTCMonth(SimpleCallContext *ctx);
+ static Value method_setYear(SimpleCallContext *ctx);
+ static Value method_setFullYear(SimpleCallContext *ctx);
+ static Value method_setUTCFullYear(SimpleCallContext *ctx);
+ static Value method_toUTCString(SimpleCallContext *ctx);
+ static Value method_toISOString(SimpleCallContext *ctx);
+ static Value method_toJSON(SimpleCallContext *ctx);
};
} // end of namespace VM
diff --git a/src/v4/qv4engine.cpp b/src/v4/qv4engine.cpp
index fb78d679..d1226ba2 100644
--- a/src/v4/qv4engine.cpp
+++ b/src/v4/qv4engine.cpp
@@ -385,7 +385,7 @@ Function *ExecutionEngine::newFunction(const QString &name)
return f;
}
-FunctionObject *ExecutionEngine::newBuiltinFunction(ExecutionContext *scope, String *name, Value (*code)(CallContext *))
+FunctionObject *ExecutionEngine::newBuiltinFunction(ExecutionContext *scope, String *name, Value (*code)(SimpleCallContext *))
{
BuiltinFunctionOld *f = new (memoryManager) BuiltinFunctionOld(scope, name, code);
return f;
diff --git a/src/v4/qv4engine.h b/src/v4/qv4engine.h
index dad9db37..051c51f2 100644
--- a/src/v4/qv4engine.h
+++ b/src/v4/qv4engine.h
@@ -203,11 +203,12 @@ struct Q_V4_EXPORT ExecutionEngine
CallContext *newCallContext(FunctionObject *f, const QQmlJS::VM::Value &thisObject, QQmlJS::VM::Value *args, int argc);
CallContext *newCallContext(void *stackSpace, FunctionObject *f, const QQmlJS::VM::Value &thisObject, QQmlJS::VM::Value *args, int argc);
ExecutionContext *pushGlobalContext();
+ void pushContext(SimpleCallContext *context);
ExecutionContext *popContext();
VM::Function *newFunction(const QString &name);
- FunctionObject *newBuiltinFunction(ExecutionContext *scope, String *name, Value (*code)(CallContext *));
+ FunctionObject *newBuiltinFunction(ExecutionContext *scope, String *name, Value (*code)(SimpleCallContext *));
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);
@@ -248,6 +249,16 @@ struct Q_V4_EXPORT ExecutionEngine
void ensureContextStackSize();
};
+inline void ExecutionEngine::pushContext(SimpleCallContext *context)
+{
+ ensureContextStackSize();
+ assert(contextStack[contextStackPosition + 1] == 0);
+
+ current = context;
+
+ contextStack[++contextStackPosition] = current;
+}
+
} // namespace VM
} // namespace QQmlJS
diff --git a/src/v4/qv4errorobject.cpp b/src/v4/qv4errorobject.cpp
index f576b732..51a09305 100644
--- a/src/v4/qv4errorobject.cpp
+++ b/src/v4/qv4errorobject.cpp
@@ -230,7 +230,7 @@ void ErrorPrototype::init(ExecutionContext *ctx, const Value &ctor, Object *obj)
obj->defineDefaultProperty(ctx, QStringLiteral("name"), Value::fromString(ctx, QStringLiteral("Error")));
}
-Value ErrorPrototype::method_toString(CallContext *ctx)
+Value ErrorPrototype::method_toString(SimpleCallContext *ctx)
{
Object *o = ctx->thisObject.asObject();
if (!o)
diff --git a/src/v4/qv4errorobject.h b/src/v4/qv4errorobject.h
index 98ccf6d4..2db88488 100644
--- a/src/v4/qv4errorobject.h
+++ b/src/v4/qv4errorobject.h
@@ -185,7 +185,7 @@ struct ErrorPrototype: ErrorObject
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(CallContext *ctx);
+ static Value method_toString(SimpleCallContext *ctx);
};
struct EvalErrorPrototype: EvalErrorObject
diff --git a/src/v4/qv4functionobject.cpp b/src/v4/qv4functionobject.cpp
index 17b98246..a1685045 100644
--- a/src/v4/qv4functionobject.cpp
+++ b/src/v4/qv4functionobject.cpp
@@ -239,7 +239,7 @@ void FunctionPrototype::init(ExecutionContext *ctx, const Value &ctor)
}
-Value FunctionPrototype::method_toString(CallContext *ctx)
+Value FunctionPrototype::method_toString(SimpleCallContext *ctx)
{
FunctionObject *fun = ctx->thisObject.asFunctionObject();
if (!fun)
@@ -248,7 +248,7 @@ Value FunctionPrototype::method_toString(CallContext *ctx)
return Value::fromString(ctx, QStringLiteral("function() { [code] }"));
}
-Value FunctionPrototype::method_apply(CallContext *ctx)
+Value FunctionPrototype::method_apply(SimpleCallContext *ctx)
{
Value thisArg = ctx->argument(0);
@@ -273,7 +273,7 @@ Value FunctionPrototype::method_apply(CallContext *ctx)
return o->call(ctx, thisArg, args.data(), args.size());
}
-Value FunctionPrototype::method_call(CallContext *ctx)
+Value FunctionPrototype::method_call(SimpleCallContext *ctx)
{
Value thisArg = ctx->argument(0);
@@ -289,7 +289,7 @@ Value FunctionPrototype::method_call(CallContext *ctx)
return o->call(ctx, thisArg, args.data(), args.size());
}
-Value FunctionPrototype::method_bind(CallContext *ctx)
+Value FunctionPrototype::method_bind(SimpleCallContext *ctx)
{
FunctionObject *target = ctx->thisObject.asFunctionObject();
if (!target)
@@ -306,7 +306,7 @@ Value FunctionPrototype::method_bind(CallContext *ctx)
}
-static Value throwTypeError(CallContext *ctx)
+static Value throwTypeError(SimpleCallContext *ctx)
{
ctx->throwTypeError();
return Value::undefinedValue();
@@ -414,7 +414,7 @@ Value ScriptFunction::call(Managed *that, ExecutionContext *context, const Value
DEFINE_MANAGED_VTABLE(BuiltinFunctionOld);
-BuiltinFunctionOld::BuiltinFunctionOld(ExecutionContext *scope, String *name, Value (*code)(CallContext *))
+BuiltinFunctionOld::BuiltinFunctionOld(ExecutionContext *scope, String *name, Value (*code)(SimpleCallContext *))
: FunctionObject(scope)
, code(code)
{
@@ -432,26 +432,33 @@ Value BuiltinFunctionOld::construct(Managed *, ExecutionContext *ctx, Value *, i
Value BuiltinFunctionOld::call(Managed *that, ExecutionContext *context, const Value &thisObject, Value *args, int argc)
{
BuiltinFunctionOld *f = static_cast<BuiltinFunctionOld *>(that);
- CallContext *ctx = context->engine->newCallContext(f, thisObject, args, argc);
+ SimpleCallContext ctx;
+ ctx.type = ExecutionContext::Type_SimpleCallContext;
+ ctx.strictMode = f->scope->strictMode; // ### needed? scope or parent context?
+ ctx.marked = false;
+ ctx.thisObject = thisObject;
+ ctx.engine = f->scope->engine;
+ ctx.arguments = args;
+ ctx.argumentCount = argc;
+ context->engine->pushContext(&ctx);
- ctx->thisObject = thisObject;
if (!f->strictMode && !thisObject.isObject()) {
// Built-in functions allow for the this object to be null or undefined. This overrides
// the behaviour of changing thisObject to the global object if null/undefined and allows
// the built-in functions for example to throw a type error if null is passed.
if (!thisObject.isUndefined() && !thisObject.isNull())
- ctx->thisObject = Value::fromObject(thisObject.toObject(context));
+ ctx.thisObject = Value::fromObject(thisObject.toObject(context));
}
Value result = Value::undefinedValue();
try {
- result = f->code(ctx);
+ result = f->code(&ctx);
} catch (Exception &ex) {
ex.partiallyUnwindContext(context);
throw;
}
- ctx->engine->popContext();
+ context->engine->popContext();
return result;
}
diff --git a/src/v4/qv4functionobject.h b/src/v4/qv4functionobject.h
index d145fb26..e3533d67 100644
--- a/src/v4/qv4functionobject.h
+++ b/src/v4/qv4functionobject.h
@@ -243,16 +243,16 @@ struct FunctionPrototype: FunctionObject
FunctionPrototype(ExecutionContext *ctx): FunctionObject(ctx) {}
void init(ExecutionContext *ctx, const Value &ctor);
- static Value method_toString(CallContext *ctx);
- static Value method_apply(CallContext *ctx);
- static Value method_call(CallContext *ctx);
- static Value method_bind(CallContext *ctx);
+ static Value method_toString(SimpleCallContext *ctx);
+ static Value method_apply(SimpleCallContext *ctx);
+ static Value method_call(SimpleCallContext *ctx);
+ static Value method_bind(SimpleCallContext *ctx);
};
struct BuiltinFunctionOld: FunctionObject {
- Value (*code)(CallContext *);
+ Value (*code)(SimpleCallContext *);
- BuiltinFunctionOld(ExecutionContext *scope, String *name, Value (*code)(CallContext *));
+ BuiltinFunctionOld(ExecutionContext *scope, String *name, Value (*code)(SimpleCallContext *));
static Value construct(Managed *, ExecutionContext *context, Value *args, int argc);
static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int);
diff --git a/src/v4/qv4globalobject.cpp b/src/v4/qv4globalobject.cpp
index 3abcd230..44b50f9b 100644
--- a/src/v4/qv4globalobject.cpp
+++ b/src/v4/qv4globalobject.cpp
@@ -526,7 +526,7 @@ static inline int toInt(const QChar &qc, int R)
}
// parseInt [15.1.2.2]
-Value GlobalFunctions::method_parseInt(CallContext *context)
+Value GlobalFunctions::method_parseInt(SimpleCallContext *context)
{
Value string = context->argument(0);
Value radix = context->argument(1);
@@ -605,7 +605,7 @@ Value GlobalFunctions::method_parseInt(CallContext *context)
}
// parseFloat [15.1.2.3]
-Value GlobalFunctions::method_parseFloat(CallContext *context)
+Value GlobalFunctions::method_parseFloat(SimpleCallContext *context)
{
Value string = context->argument(0);
@@ -631,7 +631,7 @@ Value GlobalFunctions::method_parseFloat(CallContext *context)
}
/// isNaN [15.1.2.4]
-Value GlobalFunctions::method_isNaN(CallContext *context)
+Value GlobalFunctions::method_isNaN(SimpleCallContext *context)
{
const Value &v = context->argument(0);
if (v.integerCompatible())
@@ -642,7 +642,7 @@ Value GlobalFunctions::method_isNaN(CallContext *context)
}
/// isFinite [15.1.2.5]
-Value GlobalFunctions::method_isFinite(CallContext *context)
+Value GlobalFunctions::method_isFinite(SimpleCallContext *context)
{
const Value &v = context->argument(0);
if (v.integerCompatible())
@@ -712,7 +712,7 @@ Value GlobalFunctions::method_encodeURIComponent(ExecutionContext *parentCtx, Va
return Value::fromString(parentCtx, out);
}
-Value GlobalFunctions::method_escape(CallContext *context)
+Value GlobalFunctions::method_escape(SimpleCallContext *context)
{
if (!context->argumentCount)
return Value::fromString(context, QStringLiteral("undefined"));
@@ -721,7 +721,7 @@ Value GlobalFunctions::method_escape(CallContext *context)
return Value::fromString(context, escape(str));
}
-Value GlobalFunctions::method_unescape(CallContext *context)
+Value GlobalFunctions::method_unescape(SimpleCallContext *context)
{
if (!context->argumentCount)
return Value::fromString(context, QStringLiteral("undefined"));
diff --git a/src/v4/qv4globalobject.h b/src/v4/qv4globalobject.h
index d67f6d63..ac96ac78 100644
--- a/src/v4/qv4globalobject.h
+++ b/src/v4/qv4globalobject.h
@@ -73,16 +73,16 @@ protected:
struct GlobalFunctions
{
- 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_parseInt(SimpleCallContext *context);
+ static Value method_parseFloat(SimpleCallContext *context);
+ static Value method_isNaN(SimpleCallContext *context);
+ static Value method_isFinite(SimpleCallContext *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(CallContext *context);
- static Value method_unescape(CallContext *context);
+ static Value method_escape(SimpleCallContext *context);
+ static Value method_unescape(SimpleCallContext *context);
};
} // namespace VM
diff --git a/src/v4/qv4jsonobject.cpp b/src/v4/qv4jsonobject.cpp
index f37a432e..015557f8 100644
--- a/src/v4/qv4jsonobject.cpp
+++ b/src/v4/qv4jsonobject.cpp
@@ -876,7 +876,7 @@ JsonObject::JsonObject(ExecutionContext *context)
}
-Value JsonObject::method_parse(CallContext *ctx)
+Value JsonObject::method_parse(SimpleCallContext *ctx)
{
QString jtext = ctx->argument(0).toString(ctx)->toQString();
@@ -892,7 +892,7 @@ Value JsonObject::method_parse(CallContext *ctx)
return result;
}
-Value JsonObject::method_stringify(CallContext *ctx)
+Value JsonObject::method_stringify(SimpleCallContext *ctx)
{
Stringify stringify(ctx);
diff --git a/src/v4/qv4jsonobject.h b/src/v4/qv4jsonobject.h
index 8e4e4ae7..dba4786c 100644
--- a/src/v4/qv4jsonobject.h
+++ b/src/v4/qv4jsonobject.h
@@ -51,8 +51,8 @@ namespace VM {
struct JsonObject : Object {
JsonObject(ExecutionContext *context);
- static Value method_parse(CallContext *ctx);
- static Value method_stringify(CallContext *ctx);
+ static Value method_parse(SimpleCallContext *ctx);
+ static Value method_stringify(SimpleCallContext *ctx);
};
diff --git a/src/v4/qv4numberobject.cpp b/src/v4/qv4numberobject.cpp
index 22f2e40f..4ec69f7e 100644
--- a/src/v4/qv4numberobject.cpp
+++ b/src/v4/qv4numberobject.cpp
@@ -96,7 +96,7 @@ void NumberPrototype::init(ExecutionContext *ctx, const Value &ctor)
defineDefaultProperty(ctx, QStringLiteral("toPrecision"), method_toPrecision);
}
-Value NumberPrototype::method_toString(CallContext *ctx)
+Value NumberPrototype::method_toString(SimpleCallContext *ctx)
{
double num;
if (ctx->thisObject.isNumber()) {
@@ -158,7 +158,7 @@ Value NumberPrototype::method_toString(CallContext *ctx)
return Value::fromString(str);
}
-Value NumberPrototype::method_toLocaleString(CallContext *ctx)
+Value NumberPrototype::method_toLocaleString(SimpleCallContext *ctx)
{
NumberObject *thisObject = ctx->thisObject.asNumberObject();
if (!thisObject)
@@ -168,7 +168,7 @@ Value NumberPrototype::method_toLocaleString(CallContext *ctx)
return Value::fromString(str);
}
-Value NumberPrototype::method_valueOf(CallContext *ctx)
+Value NumberPrototype::method_valueOf(SimpleCallContext *ctx)
{
NumberObject *thisObject = ctx->thisObject.asNumberObject();
if (!thisObject)
@@ -177,7 +177,7 @@ Value NumberPrototype::method_valueOf(CallContext *ctx)
return thisObject->value;
}
-Value NumberPrototype::method_toFixed(CallContext *ctx)
+Value NumberPrototype::method_toFixed(SimpleCallContext *ctx)
{
NumberObject *thisObject = ctx->thisObject.asNumberObject();
if (!thisObject)
@@ -207,7 +207,7 @@ Value NumberPrototype::method_toFixed(CallContext *ctx)
return Value::fromString(ctx, str);
}
-Value NumberPrototype::method_toExponential(CallContext *ctx)
+Value NumberPrototype::method_toExponential(SimpleCallContext *ctx)
{
NumberObject *thisObject = ctx->thisObject.asNumberObject();
if (!thisObject)
@@ -222,7 +222,7 @@ Value NumberPrototype::method_toExponential(CallContext *ctx)
return Value::fromString(ctx, z);
}
-Value NumberPrototype::method_toPrecision(CallContext *ctx)
+Value NumberPrototype::method_toPrecision(SimpleCallContext *ctx)
{
NumberObject *thisObject = ctx->thisObject.asNumberObject();
if (!thisObject)
diff --git a/src/v4/qv4numberobject.h b/src/v4/qv4numberobject.h
index f273e000..d8be4790 100644
--- a/src/v4/qv4numberobject.h
+++ b/src/v4/qv4numberobject.h
@@ -66,12 +66,12 @@ struct NumberPrototype: NumberObject
NumberPrototype(ExecutionEngine *engine): NumberObject(engine, Value::fromDouble(0)) {}
void init(ExecutionContext *ctx, const Value &ctor);
- 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);
+ static Value method_toString(SimpleCallContext *ctx);
+ static Value method_toLocaleString(SimpleCallContext *ctx);
+ static Value method_valueOf(SimpleCallContext *ctx);
+ static Value method_toFixed(SimpleCallContext *ctx);
+ static Value method_toExponential(SimpleCallContext *ctx);
+ static Value method_toPrecision(SimpleCallContext *ctx);
};
diff --git a/src/v4/qv4object.cpp b/src/v4/qv4object.cpp
index 07d66ed5..b75b6722 100644
--- a/src/v4/qv4object.cpp
+++ b/src/v4/qv4object.cpp
@@ -205,7 +205,7 @@ void Object::defineDefaultProperty(ExecutionContext *context, const QString &nam
defineDefaultProperty(context->engine->newIdentifier(name), value);
}
-void Object::defineDefaultProperty(ExecutionContext *context, const QString &name, Value (*code)(CallContext *), int argumentCount)
+void Object::defineDefaultProperty(ExecutionContext *context, const QString &name, Value (*code)(SimpleCallContext *), int argumentCount)
{
Q_UNUSED(argumentCount);
String *s = context->engine->newIdentifier(name);
diff --git a/src/v4/qv4object.h b/src/v4/qv4object.h
index 2f2d7579..b24e270a 100644
--- a/src/v4/qv4object.h
+++ b/src/v4/qv4object.h
@@ -178,7 +178,7 @@ struct Q_V4_EXPORT Object: Managed {
/* 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)(CallContext *), int count = 0);
+ void defineDefaultProperty(ExecutionContext *context, const QString &name, Value (*code)(SimpleCallContext *), 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);
diff --git a/src/v4/qv4objectproto.cpp b/src/v4/qv4objectproto.cpp
index 43ada02f..9d63ea05 100644
--- a/src/v4/qv4objectproto.cpp
+++ b/src/v4/qv4objectproto.cpp
@@ -128,7 +128,7 @@ void ObjectPrototype::init(ExecutionContext *ctx, const Value &ctor)
defineDefaultProperty(ctx, QStringLiteral("__defineSetter__"), method_defineSetter, 0);
}
-Value ObjectPrototype::method_getPrototypeOf(CallContext *ctx)
+Value ObjectPrototype::method_getPrototypeOf(SimpleCallContext *ctx)
{
Value o = ctx->argument(0);
if (! o.isObject())
@@ -138,7 +138,7 @@ Value ObjectPrototype::method_getPrototypeOf(CallContext *ctx)
return p ? Value::fromObject(p) : Value::nullValue();
}
-Value ObjectPrototype::method_getOwnPropertyDescriptor(CallContext *ctx)
+Value ObjectPrototype::method_getOwnPropertyDescriptor(SimpleCallContext *ctx)
{
Value O = ctx->argument(0);
if (!O.isObject())
@@ -166,7 +166,7 @@ Value ObjectPrototype::method_getOwnPropertyNames(ExecutionContext *parentCtx, V
return Value::fromObject(array);
}
-Value ObjectPrototype::method_create(CallContext *ctx)
+Value ObjectPrototype::method_create(SimpleCallContext *ctx)
{
Value O = ctx->argument(0);
if (!O.isObject() && !O.isNull())
@@ -184,7 +184,7 @@ Value ObjectPrototype::method_create(CallContext *ctx)
return objValue;
}
-Value ObjectPrototype::method_defineProperty(CallContext *ctx)
+Value ObjectPrototype::method_defineProperty(SimpleCallContext *ctx)
{
Value O = ctx->argument(0);
if (!O.isObject())
@@ -202,7 +202,7 @@ Value ObjectPrototype::method_defineProperty(CallContext *ctx)
return O;
}
-Value ObjectPrototype::method_defineProperties(CallContext *ctx)
+Value ObjectPrototype::method_defineProperties(SimpleCallContext *ctx)
{
Value O = ctx->argument(0);
if (!O.isObject())
@@ -231,7 +231,7 @@ Value ObjectPrototype::method_defineProperties(CallContext *ctx)
return O;
}
-Value ObjectPrototype::method_seal(CallContext *ctx)
+Value ObjectPrototype::method_seal(SimpleCallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
@@ -251,7 +251,7 @@ Value ObjectPrototype::method_seal(CallContext *ctx)
return ctx->argument(0);
}
-Value ObjectPrototype::method_freeze(CallContext *ctx)
+Value ObjectPrototype::method_freeze(SimpleCallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
@@ -273,7 +273,7 @@ Value ObjectPrototype::method_freeze(CallContext *ctx)
return ctx->argument(0);
}
-Value ObjectPrototype::method_preventExtensions(CallContext *ctx)
+Value ObjectPrototype::method_preventExtensions(SimpleCallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
@@ -283,7 +283,7 @@ Value ObjectPrototype::method_preventExtensions(CallContext *ctx)
return ctx->argument(0);
}
-Value ObjectPrototype::method_isSealed(CallContext *ctx)
+Value ObjectPrototype::method_isSealed(SimpleCallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
@@ -305,7 +305,7 @@ Value ObjectPrototype::method_isSealed(CallContext *ctx)
return Value::fromBoolean(true);
}
-Value ObjectPrototype::method_isFrozen(CallContext *ctx)
+Value ObjectPrototype::method_isFrozen(SimpleCallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
@@ -327,7 +327,7 @@ Value ObjectPrototype::method_isFrozen(CallContext *ctx)
return Value::fromBoolean(true);
}
-Value ObjectPrototype::method_isExtensible(CallContext *ctx)
+Value ObjectPrototype::method_isExtensible(SimpleCallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
@@ -336,7 +336,7 @@ Value ObjectPrototype::method_isExtensible(CallContext *ctx)
return Value::fromBoolean(o->extensible);
}
-Value ObjectPrototype::method_keys(CallContext *ctx)
+Value ObjectPrototype::method_keys(SimpleCallContext *ctx)
{
if (!ctx->argument(0).isObject())
ctx->throwTypeError();
@@ -365,7 +365,7 @@ Value ObjectPrototype::method_keys(CallContext *ctx)
return Value::fromObject(a);
}
-Value ObjectPrototype::method_toString(CallContext *ctx)
+Value ObjectPrototype::method_toString(SimpleCallContext *ctx)
{
if (ctx->thisObject.isUndefined()) {
return Value::fromString(ctx, QStringLiteral("[object Undefined]"));
@@ -378,7 +378,7 @@ Value ObjectPrototype::method_toString(CallContext *ctx)
}
}
-Value ObjectPrototype::method_toLocaleString(CallContext *ctx)
+Value ObjectPrototype::method_toLocaleString(SimpleCallContext *ctx)
{
Object *o = ctx->thisObject.toObject(ctx);
Value ts = o->get(ctx, ctx->engine->newString(QStringLiteral("toString")));
@@ -388,12 +388,12 @@ Value ObjectPrototype::method_toLocaleString(CallContext *ctx)
return f->call(ctx, Value::fromObject(o), 0, 0);
}
-Value ObjectPrototype::method_valueOf(CallContext *ctx)
+Value ObjectPrototype::method_valueOf(SimpleCallContext *ctx)
{
return Value::fromObject(ctx->thisObject.toObject(ctx));
}
-Value ObjectPrototype::method_hasOwnProperty(CallContext *ctx)
+Value ObjectPrototype::method_hasOwnProperty(SimpleCallContext *ctx)
{
String *P = ctx->argument(0).toString(ctx);
Object *O = ctx->thisObject.toObject(ctx);
@@ -401,7 +401,7 @@ Value ObjectPrototype::method_hasOwnProperty(CallContext *ctx)
return Value::fromBoolean(r);
}
-Value ObjectPrototype::method_isPrototypeOf(CallContext *ctx)
+Value ObjectPrototype::method_isPrototypeOf(SimpleCallContext *ctx)
{
Value V = ctx->argument(0);
if (! V.isObject())
@@ -417,7 +417,7 @@ Value ObjectPrototype::method_isPrototypeOf(CallContext *ctx)
return Value::fromBoolean(false);
}
-Value ObjectPrototype::method_propertyIsEnumerable(CallContext *ctx)
+Value ObjectPrototype::method_propertyIsEnumerable(SimpleCallContext *ctx)
{
String *p = ctx->argument(0).toString(ctx);
@@ -426,7 +426,7 @@ Value ObjectPrototype::method_propertyIsEnumerable(CallContext *ctx)
return Value::fromBoolean(pd && pd->isEnumerable());
}
-Value ObjectPrototype::method_defineGetter(CallContext *ctx)
+Value ObjectPrototype::method_defineGetter(SimpleCallContext *ctx)
{
if (ctx->argumentCount < 2)
ctx->throwTypeError();
@@ -445,7 +445,7 @@ Value ObjectPrototype::method_defineGetter(CallContext *ctx)
return Value::undefinedValue();
}
-Value ObjectPrototype::method_defineSetter(CallContext *ctx)
+Value ObjectPrototype::method_defineSetter(SimpleCallContext *ctx)
{
if (ctx->argumentCount < 2)
ctx->throwTypeError();
diff --git a/src/v4/qv4objectproto.h b/src/v4/qv4objectproto.h
index c9dba659..e4ce916b 100644
--- a/src/v4/qv4objectproto.h
+++ b/src/v4/qv4objectproto.h
@@ -67,29 +67,29 @@ struct ObjectPrototype: Object
void init(ExecutionContext *ctx, const Value &ctor);
- static Value method_getPrototypeOf(CallContext *ctx);
- static Value method_getOwnPropertyDescriptor(CallContext *ctx);
+ static Value method_getPrototypeOf(SimpleCallContext *ctx);
+ static Value method_getOwnPropertyDescriptor(SimpleCallContext *ctx);
static Value method_getOwnPropertyNames(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
- 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 Value method_create(SimpleCallContext *ctx);
+ static Value method_defineProperty(SimpleCallContext *ctx);
+ static Value method_defineProperties(SimpleCallContext *ctx);
+ static Value method_seal(SimpleCallContext *ctx);
+ static Value method_freeze(SimpleCallContext *ctx);
+ static Value method_preventExtensions(SimpleCallContext *ctx);
+ static Value method_isSealed(SimpleCallContext *ctx);
+ static Value method_isFrozen(SimpleCallContext *ctx);
+ static Value method_isExtensible(SimpleCallContext *ctx);
+ static Value method_keys(SimpleCallContext *ctx);
+
+ static Value method_toString(SimpleCallContext *ctx);
+ static Value method_toLocaleString(SimpleCallContext *ctx);
+ static Value method_valueOf(SimpleCallContext *ctx);
+ static Value method_hasOwnProperty(SimpleCallContext *ctx);
+ static Value method_isPrototypeOf(SimpleCallContext *ctx);
+ static Value method_propertyIsEnumerable(SimpleCallContext *ctx);
+
+ static Value method_defineGetter(SimpleCallContext *ctx);
+ static Value method_defineSetter(SimpleCallContext *ctx);
static void toPropertyDescriptor(ExecutionContext *ctx, Value v, PropertyDescriptor *desc);
static Value fromPropertyDescriptor(ExecutionContext *ctx, const PropertyDescriptor *desc);
diff --git a/src/v4/qv4regexpobject.cpp b/src/v4/qv4regexpobject.cpp
index 1800e0eb..94f7f795 100644
--- a/src/v4/qv4regexpobject.cpp
+++ b/src/v4/qv4regexpobject.cpp
@@ -179,7 +179,7 @@ void RegExpPrototype::init(ExecutionContext *ctx, const Value &ctor)
defineDefaultProperty(ctx, QStringLiteral("compile"), method_compile, 2);
}
-Value RegExpPrototype::method_exec(CallContext *ctx)
+Value RegExpPrototype::method_exec(SimpleCallContext *ctx)
{
RegExpObject *r = ctx->thisObject.asRegExpObject();
if (!r)
@@ -222,13 +222,13 @@ Value RegExpPrototype::method_exec(CallContext *ctx)
return Value::fromObject(array);
}
-Value RegExpPrototype::method_test(CallContext *ctx)
+Value RegExpPrototype::method_test(SimpleCallContext *ctx)
{
Value r = method_exec(ctx);
return Value::fromBoolean(!r.isNull());
}
-Value RegExpPrototype::method_toString(CallContext *ctx)
+Value RegExpPrototype::method_toString(SimpleCallContext *ctx)
{
RegExpObject *r = ctx->thisObject.asRegExpObject();
if (!r)
@@ -244,7 +244,7 @@ Value RegExpPrototype::method_toString(CallContext *ctx)
return Value::fromString(ctx, result);
}
-Value RegExpPrototype::method_compile(CallContext *ctx)
+Value RegExpPrototype::method_compile(SimpleCallContext *ctx)
{
RegExpObject *r = ctx->thisObject.asRegExpObject();
if (!r)
diff --git a/src/v4/qv4regexpobject.h b/src/v4/qv4regexpobject.h
index d9dc624f..b9499535 100644
--- a/src/v4/qv4regexpobject.h
+++ b/src/v4/qv4regexpobject.h
@@ -94,10 +94,10 @@ struct RegExpPrototype: RegExpObject
RegExpPrototype(ExecutionEngine* engine): RegExpObject(engine, RegExp::create(engine, QString()), false) {}
void init(ExecutionContext *ctx, const Value &ctor);
- static Value method_exec(CallContext *ctx);
- static Value method_test(CallContext *ctx);
- static Value method_toString(CallContext *ctx);
- static Value method_compile(CallContext *ctx);
+ static Value method_exec(SimpleCallContext *ctx);
+ static Value method_test(SimpleCallContext *ctx);
+ static Value method_toString(SimpleCallContext *ctx);
+ static Value method_compile(SimpleCallContext *ctx);
};
} // namespace VM
diff --git a/src/v4/qv4stringobject.cpp b/src/v4/qv4stringobject.cpp
index 7195d160..ba9e6ac5 100644
--- a/src/v4/qv4stringobject.cpp
+++ b/src/v4/qv4stringobject.cpp
@@ -400,7 +400,7 @@ static QString makeReplacementString(const QString &input, const QString& replac
return result;
}
-Value StringPrototype::method_replace(CallContext *ctx)
+Value StringPrototype::method_replace(SimpleCallContext *ctx)
{
QString string;
if (StringObject *thisString = ctx->thisObject.asStringObject())
@@ -488,7 +488,7 @@ Value StringPrototype::method_replace(CallContext *ctx)
return Value::fromString(ctx, result);
}
-Value StringPrototype::method_search(CallContext *ctx)
+Value StringPrototype::method_search(SimpleCallContext *ctx)
{
QString string;
if (StringObject *thisString = ctx->thisObject.asStringObject())
@@ -509,7 +509,7 @@ Value StringPrototype::method_search(CallContext *ctx)
return Value::fromUInt32(result);
}
-Value StringPrototype::method_slice(CallContext *ctx)
+Value StringPrototype::method_slice(SimpleCallContext *ctx)
{
const QString text = getThisString(ctx);
const double length = text.length();
@@ -535,7 +535,7 @@ Value StringPrototype::method_slice(CallContext *ctx)
return Value::fromString(ctx, text.mid(intStart, count));
}
-Value StringPrototype::method_split(CallContext *ctx)
+Value StringPrototype::method_split(SimpleCallContext *ctx)
{
QString text;
if (StringObject *thisObject = ctx->thisObject.asStringObject())
@@ -676,24 +676,24 @@ Value StringPrototype::method_substring(ExecutionContext *parentCtx, Value thisO
return Value::fromString(parentCtx, value.mid(x, y));
}
-Value StringPrototype::method_toLowerCase(CallContext *ctx)
+Value StringPrototype::method_toLowerCase(SimpleCallContext *ctx)
{
QString value = getThisString(ctx);
return Value::fromString(ctx, value.toLower());
}
-Value StringPrototype::method_toLocaleLowerCase(CallContext *ctx)
+Value StringPrototype::method_toLocaleLowerCase(SimpleCallContext *ctx)
{
return method_toLowerCase(ctx);
}
-Value StringPrototype::method_toUpperCase(CallContext *ctx)
+Value StringPrototype::method_toUpperCase(SimpleCallContext *ctx)
{
QString value = getThisString(ctx);
return Value::fromString(ctx, value.toUpper());
}
-Value StringPrototype::method_toLocaleUpperCase(CallContext *ctx)
+Value StringPrototype::method_toLocaleUpperCase(SimpleCallContext *ctx)
{
return method_toUpperCase(ctx);
}
@@ -709,7 +709,7 @@ Value StringPrototype::method_fromCharCode(ExecutionContext *parentCtx, Value, V
return Value::fromString(parentCtx, str);
}
-Value StringPrototype::method_trim(CallContext *ctx)
+Value StringPrototype::method_trim(SimpleCallContext *ctx)
{
if (ctx->thisObject.isNull() || ctx->thisObject.isUndefined())
ctx->throwTypeError();
diff --git a/src/v4/qv4stringobject.h b/src/v4/qv4stringobject.h
index c879504d..0bbb3cc3 100644
--- a/src/v4/qv4stringobject.h
+++ b/src/v4/qv4stringobject.h
@@ -86,18 +86,18 @@ struct StringPrototype: StringObject
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(CallContext *ctx);
- static Value method_search(CallContext *ctx);
- static Value method_slice(CallContext *ctx);
- static Value method_split(CallContext *ctx);
+ static Value method_replace(SimpleCallContext *ctx);
+ static Value method_search(SimpleCallContext *ctx);
+ static Value method_slice(SimpleCallContext *ctx);
+ static Value method_split(SimpleCallContext *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(CallContext *ctx);
- static Value method_toLocaleLowerCase(CallContext *ctx);
- static Value method_toUpperCase(CallContext *ctx);
- static Value method_toLocaleUpperCase(CallContext *ctx);
+ static Value method_toLowerCase(SimpleCallContext *ctx);
+ static Value method_toLocaleLowerCase(SimpleCallContext *ctx);
+ static Value method_toUpperCase(SimpleCallContext *ctx);
+ static Value method_toLocaleUpperCase(SimpleCallContext *ctx);
static Value method_fromCharCode(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
- static Value method_trim(CallContext *ctx);
+ static Value method_trim(SimpleCallContext *ctx);
};
} // end of namespace VM