summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-04-14 22:01:20 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-04-15 10:36:52 +0200
commit58c5fde3f67e2e3d790c2d07ab9b8c5edab61bbc (patch)
treecf51a078f34657adbe576da329f20984ea79bca1
parent3e6fc20a2ac4da117aa5f6da278c8dd784741f5e (diff)
Remove the ExecutionContext parameter from some methods
We can avoid passing the context into many methods now. Change-Id: I3cfedd679441117c5ea3aa735d5342788d7dfac5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/v4/qv4arrayobject.cpp24
-rw-r--r--src/v4/qv4dateobject.cpp104
-rw-r--r--src/v4/qv4functionobject.cpp4
-rw-r--r--src/v4/qv4globalobject.cpp6
-rw-r--r--src/v4/qv4jsonobject.cpp4
-rw-r--r--src/v4/qv4mathobject.cpp38
-rw-r--r--src/v4/qv4numberobject.cpp12
-rw-r--r--src/v4/qv4object.cpp10
-rw-r--r--src/v4/qv4regexpobject.cpp2
-rw-r--r--src/v4/qv4runtime.cpp85
-rw-r--r--src/v4/qv4runtime.h224
-rw-r--r--src/v4/qv4sparsearray.cpp2
-rw-r--r--src/v4/qv4stringobject.cpp28
-rw-r--r--src/v4/qv4v8.cpp20
-rw-r--r--src/v4/qv4value.cpp12
-rw-r--r--src/v4/qv4value.h31
16 files changed, 300 insertions, 306 deletions
diff --git a/src/v4/qv4arrayobject.cpp b/src/v4/qv4arrayobject.cpp
index 39492ef0..90746d00 100644
--- a/src/v4/qv4arrayobject.cpp
+++ b/src/v4/qv4arrayobject.cpp
@@ -58,7 +58,7 @@ Value ArrayCtor::construct(Managed *, ExecutionContext *ctx, Value *argv, int ar
uint len;
if (argc == 1 && argv[0].isNumber()) {
bool ok;
- len = argv[0].asArrayLength(ctx, &ok);
+ len = argv[0].asArrayLength(&ok);
if (!ok)
ctx->throwRangeError(argv[0]);
@@ -115,7 +115,7 @@ uint ArrayPrototype::getLength(ExecutionContext *ctx, Object *o)
{
if (o->isArrayObject())
return o->arrayLength();
- return o->get(ctx, ctx->engine->id_length).toUInt32(ctx);
+ return o->get(ctx, ctx->engine->id_length).toUInt32();
}
Value ArrayPrototype::method_isArray(SimpleCallContext *ctx)
@@ -171,7 +171,7 @@ Value ArrayPrototype::method_join(SimpleCallContext *ctx)
Value self = ctx->thisObject;
const Value length = self.property(ctx, ctx->engine->id_length);
- const quint32 r2 = Value::toUInt32(length.isUndefined() ? 0 : length.toNumber(ctx));
+ const quint32 r2 = Value::toUInt32(length.isUndefined() ? 0 : length.toNumber());
static QSet<Object *> visitedArrayElements;
@@ -382,8 +382,8 @@ Value ArrayPrototype::method_slice(SimpleCallContext *ctx)
Object *o = ctx->thisObject.toObject(ctx);
ArrayObject *result = ctx->engine->newArrayObject(ctx);
- uint len = o->get(ctx, ctx->engine->id_length).toUInt32(ctx);
- double s = ctx->argument(0).toInteger(ctx);
+ uint len = o->get(ctx, ctx->engine->id_length).toUInt32();
+ double s = ctx->argument(0).toInteger();
uint start;
if (s < 0)
start = (uint)qMax(len + s, 0.);
@@ -393,7 +393,7 @@ Value ArrayPrototype::method_slice(SimpleCallContext *ctx)
start = (uint) s;
uint end = len;
if (!ctx->argument(1).isUndefined()) {
- double e = ctx->argument(1).toInteger(ctx);
+ double e = ctx->argument(1).toInteger();
if (e < 0)
end = (uint)qMax(len + e, 0.);
else if (e > len)
@@ -432,14 +432,14 @@ Value ArrayPrototype::method_splice(SimpleCallContext *ctx)
ArrayObject *newArray = ctx->engine->newArrayObject(ctx);
- double rs = ctx->argument(0).toInteger(ctx);
+ double rs = ctx->argument(0).toInteger();
uint start;
if (rs < 0)
start = (uint) qMax(0., len + rs);
else
start = (uint) qMin(rs, (double)len);
- uint deleteCount = (uint)qMin(qMax(ctx->argument(1).toInteger(ctx), 0.), (double)(len - start));
+ uint deleteCount = (uint)qMin(qMax(ctx->argument(1).toInteger(), 0.), (double)(len - start));
newArray->arrayReserve(deleteCount);
Property *pd = newArray->arrayData;
@@ -557,7 +557,7 @@ Value ArrayPrototype::method_indexOf(SimpleCallContext *ctx)
searchValue = Value::undefinedValue();
if (ctx->argumentCount >= 2) {
- double f = ctx->argument(1).toInteger(ctx);
+ double f = ctx->argument(1).toInteger();
if (f >= len)
return Value::fromInt32(-1);
if (f < 0)
@@ -569,7 +569,7 @@ Value ArrayPrototype::method_indexOf(SimpleCallContext *ctx)
for (uint k = fromIndex; k < len; ++k) {
bool exists;
Value v = instance->getIndexed(ctx, k, &exists);
- if (exists && __qmljs_strict_equal(v, searchValue, ctx))
+ if (exists && __qmljs_strict_equal(v, searchValue))
return Value::fromDouble(k);
}
return Value::fromInt32(-1);
@@ -594,7 +594,7 @@ Value ArrayPrototype::method_lastIndexOf(SimpleCallContext *ctx)
searchValue = Value::undefinedValue();
if (ctx->argumentCount >= 2) {
- double f = ctx->argument(1).toInteger(ctx);
+ double f = ctx->argument(1).toInteger();
if (f > 0)
f = qMin(f, (double)(len - 1));
else if (f < 0) {
@@ -609,7 +609,7 @@ Value ArrayPrototype::method_lastIndexOf(SimpleCallContext *ctx)
--k;
bool exists;
Value v = instance->getIndexed(ctx, k, &exists);
- if (exists && __qmljs_strict_equal(v, searchValue, ctx))
+ if (exists && __qmljs_strict_equal(v, searchValue))
return Value::fromDouble(k);
}
return Value::fromInt32(-1);
diff --git a/src/v4/qv4dateobject.cpp b/src/v4/qv4dateobject.cpp
index ed74c722..adeb11f8 100644
--- a/src/v4/qv4dateobject.cpp
+++ b/src/v4/qv4dateobject.cpp
@@ -677,22 +677,22 @@ Value DateCtor::construct(Managed *, ExecutionContext *ctx, Value *args, int arg
if (DateObject *d = arg.asDateObject())
arg = d->value;
else
- arg = __qmljs_to_primitive(arg, ctx, PREFERREDTYPE_HINT);
+ arg = __qmljs_to_primitive(arg, PREFERREDTYPE_HINT);
if (arg.isString())
t = ParseString(arg.stringValue()->toQString());
else
- t = TimeClip(arg.toNumber(ctx));
+ t = TimeClip(arg.toNumber());
}
else { // argc > 1
- double year = args[0].toNumber(ctx);
- double month = args[1].toNumber(ctx);
- double day = argc >= 3 ? args[2].toNumber(ctx) : 1;
- double hours = argc >= 4 ? args[3].toNumber(ctx) : 0;
- double mins = argc >= 5 ? args[4].toNumber(ctx) : 0;
- double secs = argc >= 6 ? args[5].toNumber(ctx) : 0;
- double ms = argc >= 7 ? args[6].toNumber(ctx) : 0;
+ double year = args[0].toNumber();
+ double month = args[1].toNumber();
+ double day = argc >= 3 ? args[2].toNumber() : 1;
+ double hours = argc >= 4 ? args[3].toNumber() : 0;
+ double mins = argc >= 5 ? args[4].toNumber() : 0;
+ double secs = argc >= 6 ? args[5].toNumber() : 0;
+ double ms = argc >= 7 ? args[6].toNumber() : 0;
if (year >= 0 && year <= 99)
year += 1900;
t = MakeDate(MakeDay(year, month, day), MakeTime(hours, mins, secs, ms));
@@ -787,13 +787,13 @@ Value DatePrototype::method_UTC(SimpleCallContext *ctx)
{
const int numArgs = ctx->argumentCount;
if (numArgs >= 2) {
- double year = ctx->argument(0).toNumber(ctx);
- double month = ctx->argument(1).toNumber(ctx);
- double day = numArgs >= 3 ? ctx->argument(2).toNumber(ctx) : 1;
- double hours = numArgs >= 4 ? ctx->argument(3).toNumber(ctx) : 0;
- double mins = numArgs >= 5 ? ctx->argument(4).toNumber(ctx) : 0;
- double secs = numArgs >= 6 ? ctx->argument(5).toNumber(ctx) : 0;
- double ms = numArgs >= 7 ? ctx->argument(6).toNumber(ctx) : 0;
+ double year = ctx->argument(0).toNumber();
+ double month = ctx->argument(1).toNumber();
+ double day = numArgs >= 3 ? ctx->argument(2).toNumber() : 1;
+ double hours = numArgs >= 4 ? ctx->argument(3).toNumber() : 0;
+ double mins = numArgs >= 5 ? ctx->argument(4).toNumber() : 0;
+ double secs = numArgs >= 6 ? ctx->argument(5).toNumber() : 0;
+ double ms = numArgs >= 7 ? ctx->argument(6).toNumber() : 0;
if (year >= 0 && year <= 99)
year += 1900;
double t = MakeDate(MakeDay(year, month, day),
@@ -1008,7 +1008,7 @@ Value DatePrototype::method_setTime(SimpleCallContext *ctx)
if (!self)
ctx->throwTypeError();
- self->value.setDouble(TimeClip(ctx->argument(0).toNumber(ctx)));
+ self->value.setDouble(TimeClip(ctx->argument(0).toNumber()));
return self->value;
}
@@ -1019,7 +1019,7 @@ Value DatePrototype::method_setMilliseconds(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = LocalTime(self->value.asDouble());
- double ms = ctx->argument(0).toNumber(ctx);
+ double ms = ctx->argument(0).toNumber();
self->value.setDouble(TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms)))));
return self->value;
}
@@ -1031,7 +1031,7 @@ Value DatePrototype::method_setUTCMilliseconds(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = self->value.asDouble();
- double ms = ctx->argument(0).toNumber(ctx);
+ double ms = ctx->argument(0).toNumber();
self->value.setDouble(TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms)))));
return self->value;
}
@@ -1043,8 +1043,8 @@ Value DatePrototype::method_setSeconds(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = LocalTime(self->value.asDouble());
- double sec = ctx->argument(0).toNumber(ctx);
- double ms = (ctx->argumentCount < 2) ? msFromTime(t) : ctx->argument(1).toNumber(ctx);
+ double sec = ctx->argument(0).toNumber();
+ double ms = (ctx->argumentCount < 2) ? msFromTime(t) : ctx->argument(1).toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), sec, ms))));
self->value.setDouble(t);
return self->value;
@@ -1057,8 +1057,8 @@ Value DatePrototype::method_setUTCSeconds(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = self->value.asDouble();
- double sec = ctx->argument(0).toNumber(ctx);
- double ms = (ctx->argumentCount < 2) ? msFromTime(t) : ctx->argument(1).toNumber(ctx);
+ double sec = ctx->argument(0).toNumber();
+ double ms = (ctx->argumentCount < 2) ? msFromTime(t) : ctx->argument(1).toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), sec, ms))));
self->value.setDouble(t);
return self->value;
@@ -1071,9 +1071,9 @@ Value DatePrototype::method_setMinutes(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = LocalTime(self->value.asDouble());
- double min = ctx->argument(0).toNumber(ctx);
- double sec = (ctx->argumentCount < 2) ? SecFromTime(t) : ctx->argument(1).toNumber(ctx);
- double ms = (ctx->argumentCount < 3) ? msFromTime(t) : ctx->argument(2).toNumber(ctx);
+ double min = ctx->argument(0).toNumber();
+ double sec = (ctx->argumentCount < 2) ? SecFromTime(t) : ctx->argument(1).toNumber();
+ double ms = (ctx->argumentCount < 3) ? msFromTime(t) : ctx->argument(2).toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), min, sec, ms))));
self->value.setDouble(t);
return self->value;
@@ -1086,9 +1086,9 @@ Value DatePrototype::method_setUTCMinutes(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = self->value.asDouble();
- double min = ctx->argument(0).toNumber(ctx);
- double sec = (ctx->argumentCount < 2) ? SecFromTime(t) : ctx->argument(1).toNumber(ctx);
- double ms = (ctx->argumentCount < 3) ? msFromTime(t) : ctx->argument(2).toNumber(ctx);
+ double min = ctx->argument(0).toNumber();
+ double sec = (ctx->argumentCount < 2) ? SecFromTime(t) : ctx->argument(1).toNumber();
+ double ms = (ctx->argumentCount < 3) ? msFromTime(t) : ctx->argument(2).toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), min, sec, ms))));
self->value.setDouble(t);
return self->value;
@@ -1101,10 +1101,10 @@ Value DatePrototype::method_setHours(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = LocalTime(self->value.asDouble());
- double hour = ctx->argument(0).toNumber(ctx);
- double min = (ctx->argumentCount < 2) ? MinFromTime(t) : ctx->argument(1).toNumber(ctx);
- double sec = (ctx->argumentCount < 3) ? SecFromTime(t) : ctx->argument(2).toNumber(ctx);
- double ms = (ctx->argumentCount < 4) ? msFromTime(t) : ctx->argument(3).toNumber(ctx);
+ double hour = ctx->argument(0).toNumber();
+ double min = (ctx->argumentCount < 2) ? MinFromTime(t) : ctx->argument(1).toNumber();
+ double sec = (ctx->argumentCount < 3) ? SecFromTime(t) : ctx->argument(2).toNumber();
+ double ms = (ctx->argumentCount < 4) ? msFromTime(t) : ctx->argument(3).toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(hour, min, sec, ms))));
self->value.setDouble(t);
return self->value;
@@ -1117,10 +1117,10 @@ Value DatePrototype::method_setUTCHours(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = self->value.asDouble();
- double hour = ctx->argument(0).toNumber(ctx);
- double min = (ctx->argumentCount < 2) ? MinFromTime(t) : ctx->argument(1).toNumber(ctx);
- double sec = (ctx->argumentCount < 3) ? SecFromTime(t) : ctx->argument(2).toNumber(ctx);
- double ms = (ctx->argumentCount < 4) ? msFromTime(t) : ctx->argument(3).toNumber(ctx);
+ double hour = ctx->argument(0).toNumber();
+ double min = (ctx->argumentCount < 2) ? MinFromTime(t) : ctx->argument(1).toNumber();
+ double sec = (ctx->argumentCount < 3) ? SecFromTime(t) : ctx->argument(2).toNumber();
+ double ms = (ctx->argumentCount < 4) ? msFromTime(t) : ctx->argument(3).toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(hour, min, sec, ms))));
self->value.setDouble(t);
return self->value;
@@ -1133,7 +1133,7 @@ Value DatePrototype::method_setDate(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = LocalTime(self->value.asDouble());
- double date = ctx->argument(0).toNumber(ctx);
+ double date = ctx->argument(0).toNumber();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), date), TimeWithinDay(t))));
self->value.setDouble(t);
return self->value;
@@ -1146,7 +1146,7 @@ Value DatePrototype::method_setUTCDate(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = self->value.asDouble();
- double date = ctx->argument(0).toNumber(ctx);
+ double date = ctx->argument(0).toNumber();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), date), TimeWithinDay(t))));
self->value.setDouble(t);
return self->value;
@@ -1159,8 +1159,8 @@ Value DatePrototype::method_setMonth(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = LocalTime(self->value.asDouble());
- double month = ctx->argument(0).toNumber(ctx);
- double date = (ctx->argumentCount < 2) ? DateFromTime(t) : ctx->argument(1).toNumber(ctx);
+ double month = ctx->argument(0).toNumber();
+ double date = (ctx->argumentCount < 2) ? DateFromTime(t) : ctx->argument(1).toNumber();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), month, date), TimeWithinDay(t))));
self->value.setDouble(t);
return self->value;
@@ -1173,8 +1173,8 @@ Value DatePrototype::method_setUTCMonth(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = self->value.asDouble();
- double month = ctx->argument(0).toNumber(ctx);
- double date = (ctx->argumentCount < 2) ? DateFromTime(t) : ctx->argument(1).toNumber(ctx);
+ double month = ctx->argument(0).toNumber();
+ double date = (ctx->argumentCount < 2) ? DateFromTime(t) : ctx->argument(1).toNumber();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), month, date), TimeWithinDay(t))));
self->value.setDouble(t);
return self->value;
@@ -1191,7 +1191,7 @@ Value DatePrototype::method_setYear(SimpleCallContext *ctx)
t = 0;
else
t = LocalTime(t);
- double year = ctx->argument(0).toNumber(ctx);
+ double year = ctx->argument(0).toNumber();
double r;
if (isnan(year)) {
r = qSNaN();
@@ -1213,9 +1213,9 @@ Value DatePrototype::method_setUTCFullYear(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = self->value.asDouble();
- double year = ctx->argument(0).toNumber(ctx);
- double month = (ctx->argumentCount < 2) ? MonthFromTime(t) : ctx->argument(1).toNumber(ctx);
- double date = (ctx->argumentCount < 3) ? DateFromTime(t) : ctx->argument(2).toNumber(ctx);
+ double year = ctx->argument(0).toNumber();
+ double month = (ctx->argumentCount < 2) ? MonthFromTime(t) : ctx->argument(1).toNumber();
+ double date = (ctx->argumentCount < 3) ? DateFromTime(t) : ctx->argument(2).toNumber();
t = TimeClip(UTC(MakeDate(MakeDay(year, month, date), TimeWithinDay(t))));
self->value.setDouble(t);
return self->value;
@@ -1230,9 +1230,9 @@ Value DatePrototype::method_setFullYear(SimpleCallContext *ctx)
double t = LocalTime(self->value.asDouble());
if (isnan(t))
t = 0;
- double year = ctx->argument(0).toNumber(ctx);
- double month = (ctx->argumentCount < 2) ? MonthFromTime(t) : ctx->argument(1).toNumber(ctx);
- double date = (ctx->argumentCount < 3) ? DateFromTime(t) : ctx->argument(2).toNumber(ctx);
+ double year = ctx->argument(0).toNumber();
+ double month = (ctx->argumentCount < 2) ? MonthFromTime(t) : ctx->argument(1).toNumber();
+ double date = (ctx->argumentCount < 3) ? DateFromTime(t) : ctx->argument(2).toNumber();
t = TimeClip(UTC(MakeDate(MakeDay(year, month, date), TimeWithinDay(t))));
self->value.setDouble(t);
return self->value;
@@ -1302,9 +1302,9 @@ Value DatePrototype::method_toISOString(SimpleCallContext *ctx)
Value DatePrototype::method_toJSON(SimpleCallContext *ctx)
{
Value O = __qmljs_to_object(ctx, ctx->thisObject);
- Value tv = __qmljs_to_primitive(O, ctx, NUMBER_HINT);
+ Value tv = __qmljs_to_primitive(O, NUMBER_HINT);
- if (tv.isNumber() && !std::isfinite(tv.toNumber(ctx)))
+ if (tv.isNumber() && !std::isfinite(tv.toNumber()))
return Value::nullValue();
FunctionObject *toIso = O.objectValue()->get(ctx, ctx->engine->newString(QStringLiteral("toISOString"))).asFunctionObject();
diff --git a/src/v4/qv4functionobject.cpp b/src/v4/qv4functionobject.cpp
index cff0b59f..a1088652 100644
--- a/src/v4/qv4functionobject.cpp
+++ b/src/v4/qv4functionobject.cpp
@@ -256,7 +256,7 @@ Value FunctionPrototype::method_apply(SimpleCallContext *ctx)
QVector<Value> args;
if (Object *arr = arg.asObject()) {
- quint32 len = arr->get(ctx, ctx->engine->id_length).toUInt32(ctx);
+ quint32 len = arr->get(ctx, ctx->engine->id_length).toUInt32();
for (quint32 i = 0; i < len; ++i) {
Value a = arr->getIndexed(ctx, i);
args.append(a);
@@ -466,7 +466,7 @@ BoundFunction::BoundFunction(ExecutionContext *scope, FunctionObject *target, Va
, boundArgs(boundArgs)
{
vtbl = &static_vtbl;
- int len = target->get(scope, scope->engine->id_length).toUInt32(scope);
+ int len = target->get(scope, scope->engine->id_length).toUInt32();
len -= boundArgs.size();
if (len < 0)
len = 0;
diff --git a/src/v4/qv4globalobject.cpp b/src/v4/qv4globalobject.cpp
index 3396ec3b..75da51a9 100644
--- a/src/v4/qv4globalobject.cpp
+++ b/src/v4/qv4globalobject.cpp
@@ -530,7 +530,7 @@ Value GlobalFunctions::method_parseInt(SimpleCallContext *context)
{
Value string = context->argument(0);
Value radix = context->argument(1);
- int R = radix.isUndefined() ? 0 : radix.toInt32(context);
+ int R = radix.isUndefined() ? 0 : radix.toInt32();
// [15.1.2.2] step by step:
String *inputString = string.toString(context); // 1
@@ -637,7 +637,7 @@ Value GlobalFunctions::method_isNaN(SimpleCallContext *context)
if (v.integerCompatible())
return Value::fromBoolean(false);
- double d = v.toNumber(context);
+ double d = v.toNumber();
return Value::fromBoolean(isnan(d));
}
@@ -648,7 +648,7 @@ Value GlobalFunctions::method_isFinite(SimpleCallContext *context)
if (v.integerCompatible())
return Value::fromBoolean(true);
- double d = v.toNumber(context);
+ double d = v.toNumber();
return Value::fromBoolean(std::isfinite(d));
}
diff --git a/src/v4/qv4jsonobject.cpp b/src/v4/qv4jsonobject.cpp
index fd7eacab..cb4df709 100644
--- a/src/v4/qv4jsonobject.cpp
+++ b/src/v4/qv4jsonobject.cpp
@@ -735,7 +735,7 @@ QString Stringify::Str(const QString &key, Value value)
return quote(value.stringValue()->toQString());
if (value.isNumber()) {
- double d = value.toNumber(ctx);
+ double d = value.toNumber();
return std::isfinite(d) ? value.toString(ctx)->toQString() : QStringLiteral("null");
}
@@ -918,7 +918,7 @@ Value JsonObject::method_stringify(SimpleCallContext *ctx)
s = so->value;
if (s.isNumber()) {
- stringify.gap = QString(qMin(10, (int)s.toInteger(ctx)), ' ');
+ stringify.gap = QString(qMin(10, (int)s.toInteger()), ' ');
} else if (s.isString()) {
stringify.gap = s.stringValue()->toQString().left(10);
}
diff --git a/src/v4/qv4mathobject.cpp b/src/v4/qv4mathobject.cpp
index ed27f3df..d1017eba 100644
--- a/src/v4/qv4mathobject.cpp
+++ b/src/v4/qv4mathobject.cpp
@@ -107,7 +107,7 @@ Value MathObject::method_abs(SimpleCallContext *context)
return Value::fromInt32(i < 0 ? - i : i);
}
- double v = context->arguments[0].toNumber(context);
+ double v = context->arguments[0].toNumber();
if (v == 0) // 0 | -0
return Value::fromDouble(0);
@@ -116,7 +116,7 @@ Value MathObject::method_abs(SimpleCallContext *context)
Value MathObject::method_acos(SimpleCallContext *context)
{
- double v = context->argumentCount ? context->arguments[0].toNumber(context) : 2;
+ double v = context->argumentCount ? context->arguments[0].toNumber() : 2;
if (v > 1)
return Value::fromDouble(qSNaN());
@@ -125,7 +125,7 @@ Value MathObject::method_acos(SimpleCallContext *context)
Value MathObject::method_asin(SimpleCallContext *context)
{
- double v = context->argumentCount ? context->arguments[0].toNumber(context) : 2;
+ double v = context->argumentCount ? context->arguments[0].toNumber() : 2;
if (v > 1)
return Value::fromDouble(qSNaN());
else
@@ -134,7 +134,7 @@ Value MathObject::method_asin(SimpleCallContext *context)
Value MathObject::method_atan(SimpleCallContext *context)
{
- double v = context->argumentCount ? context->arguments[0].toNumber(context) : qSNaN();
+ double v = context->argumentCount ? context->arguments[0].toNumber() : qSNaN();
if (v == 0.0)
return Value::fromDouble(v);
else
@@ -143,8 +143,8 @@ Value MathObject::method_atan(SimpleCallContext *context)
Value MathObject::method_atan2(SimpleCallContext *context)
{
- double v1 = context->argumentCount ? context->arguments[0].toNumber(context) : qSNaN();
- double v2 = context->argumentCount > 1 ? context->arguments[1].toNumber(context) : qSNaN();
+ double v1 = context->argumentCount ? context->arguments[0].toNumber() : qSNaN();
+ double v2 = context->argumentCount > 1 ? context->arguments[1].toNumber() : qSNaN();
if ((v1 < 0) && qIsFinite(v1) && qIsInf(v2) && (copySign(1.0, v2) == 1.0))
return Value::fromDouble(copySign(0, -1.0));
@@ -161,7 +161,7 @@ Value MathObject::method_atan2(SimpleCallContext *context)
Value MathObject::method_ceil(SimpleCallContext *context)
{
- double v = context->argumentCount ? context->arguments[0].toNumber(context) : qSNaN();
+ double v = context->argumentCount ? context->arguments[0].toNumber() : qSNaN();
if (v < 0.0 && v > -1.0)
return Value::fromDouble(copySign(0, -1.0));
else
@@ -170,13 +170,13 @@ Value MathObject::method_ceil(SimpleCallContext *context)
Value MathObject::method_cos(SimpleCallContext *context)
{
- double v = context->argumentCount ? context->arguments[0].toNumber(context) : qSNaN();
+ double v = context->argumentCount ? context->arguments[0].toNumber() : qSNaN();
return Value::fromDouble(::cos(v));
}
Value MathObject::method_exp(SimpleCallContext *context)
{
- double v = context->argumentCount ? context->arguments[0].toNumber(context) : qSNaN();
+ double v = context->argumentCount ? context->arguments[0].toNumber() : qSNaN();
if (qIsInf(v)) {
if (copySign(1.0, v) == -1.0)
return Value::fromDouble(0);
@@ -189,13 +189,13 @@ Value MathObject::method_exp(SimpleCallContext *context)
Value MathObject::method_floor(SimpleCallContext *context)
{
- double v = context->argumentCount ? context->arguments[0].toNumber(context) : qSNaN();
+ double v = context->argumentCount ? context->arguments[0].toNumber() : qSNaN();
return Value::fromDouble(::floor(v));
}
Value MathObject::method_log(SimpleCallContext *context)
{
- double v = context->argumentCount ? context->arguments[0].toNumber(context) : qSNaN();
+ double v = context->argumentCount ? context->arguments[0].toNumber() : qSNaN();
if (v < 0)
return Value::fromDouble(qSNaN());
else
@@ -206,7 +206,7 @@ Value MathObject::method_max(SimpleCallContext *context)
{
double mx = -qInf();
for (unsigned i = 0; i < context->argumentCount; ++i) {
- double x = context->arguments[i].toNumber(context);
+ double x = context->arguments[i].toNumber();
if (x > mx || isnan(x))
mx = x;
}
@@ -217,7 +217,7 @@ Value MathObject::method_min(SimpleCallContext *context)
{
double mx = qInf();
for (unsigned i = 0; i < context->argumentCount; ++i) {
- double x = context->arguments[i].toNumber(context);
+ double x = context->arguments[i].toNumber();
if ((x == 0 && mx == x && copySign(1.0, x) == -1.0)
|| (x < mx) || isnan(x)) {
mx = x;
@@ -228,8 +228,8 @@ Value MathObject::method_min(SimpleCallContext *context)
Value MathObject::method_pow(SimpleCallContext *context)
{
- double x = context->argumentCount > 0 ? context->arguments[0].toNumber(context) : qSNaN();
- double y = context->argumentCount > 1 ? context->arguments[1].toNumber(context) : qSNaN();
+ double x = context->argumentCount > 0 ? context->arguments[0].toNumber() : qSNaN();
+ double y = context->argumentCount > 1 ? context->arguments[1].toNumber() : qSNaN();
if (isnan(y))
return Value::fromDouble(qSNaN());
@@ -283,26 +283,26 @@ Value MathObject::method_random(SimpleCallContext *)
Value MathObject::method_round(SimpleCallContext *context)
{
- double v = context->argumentCount ? context->arguments[0].toNumber(context) : qSNaN();
+ double v = context->argumentCount ? context->arguments[0].toNumber() : qSNaN();
v = copySign(::floor(v + 0.5), v);
return Value::fromDouble(v);
}
Value MathObject::method_sin(SimpleCallContext *context)
{
- double v = context->argumentCount ? context->arguments[0].toNumber(context) : qSNaN();
+ double v = context->argumentCount ? context->arguments[0].toNumber() : qSNaN();
return Value::fromDouble(::sin(v));
}
Value MathObject::method_sqrt(SimpleCallContext *context)
{
- double v = context->argumentCount ? context->arguments[0].toNumber(context) : qSNaN();
+ double v = context->argumentCount ? context->arguments[0].toNumber() : qSNaN();
return Value::fromDouble(::sqrt(v));
}
Value MathObject::method_tan(SimpleCallContext *context)
{
- double v = context->argumentCount ? context->arguments[0].toNumber(context) : qSNaN();
+ double v = context->argumentCount ? context->arguments[0].toNumber() : qSNaN();
if (v == 0.0)
return Value::fromDouble(v);
else
diff --git a/src/v4/qv4numberobject.cpp b/src/v4/qv4numberobject.cpp
index 4ec69f7e..f32c8b4f 100644
--- a/src/v4/qv4numberobject.cpp
+++ b/src/v4/qv4numberobject.cpp
@@ -58,13 +58,13 @@ NumberCtor::NumberCtor(ExecutionContext *scope)
Value NumberCtor::construct(Managed *, ExecutionContext *ctx, Value *args, int argc)
{
- double d = argc ? args[0].toNumber(ctx) : 0.;
+ double d = argc ? args[0].toNumber() : 0.;
return Value::fromObject(ctx->engine->newNumberObject(Value::fromDouble(d)));
}
Value NumberCtor::call(Managed *m, ExecutionContext *parentCtx, const Value &thisObject, Value *argv, int argc)
{
- double d = argc ? argv[0].toNumber(parentCtx) : 0.;
+ double d = argc ? argv[0].toNumber() : 0.;
return Value::fromDouble(d);
}
@@ -110,7 +110,7 @@ Value NumberPrototype::method_toString(SimpleCallContext *ctx)
Value arg = ctx->argument(0);
if (!arg.isUndefined()) {
- int radix = arg.toInt32(ctx);
+ int radix = arg.toInt32();
if (radix < 2 || radix > 36) {
ctx->throwError(QString::fromLatin1("Number.prototype.toString: %0 is not a valid radix")
.arg(radix));
@@ -186,7 +186,7 @@ Value NumberPrototype::method_toFixed(SimpleCallContext *ctx)
double fdigits = 0;
if (ctx->argumentCount > 0)
- fdigits = ctx->argument(0).toInteger(ctx);
+ fdigits = ctx->argument(0).toInteger();
if (isnan(fdigits))
fdigits = 0;
@@ -216,7 +216,7 @@ Value NumberPrototype::method_toExponential(SimpleCallContext *ctx)
double fdigits = 0;
if (ctx->argumentCount > 0)
- fdigits = ctx->argument(0).toInteger(ctx);
+ fdigits = ctx->argument(0).toInteger();
QString z = QString::number(thisObject->value.asDouble(), 'e', int (fdigits));
return Value::fromString(ctx, z);
@@ -231,7 +231,7 @@ Value NumberPrototype::method_toPrecision(SimpleCallContext *ctx)
double fdigits = 0;
if (ctx->argumentCount > 0)
- fdigits = ctx->argument(0).toInteger(ctx);
+ fdigits = ctx->argument(0).toInteger();
return Value::fromString(ctx, QString::number(thisObject->value.asDouble(), 'g', int (fdigits)));
}
diff --git a/src/v4/qv4object.cpp b/src/v4/qv4object.cpp
index 04eb74b4..f82b8bfa 100644
--- a/src/v4/qv4object.cpp
+++ b/src/v4/qv4object.cpp
@@ -496,7 +496,7 @@ void Object::internalPut(ExecutionContext *ctx, String *name, const Value &value
goto reject;
else if (isArrayObject() && name->isEqualTo(ctx->engine->id_length)) {
bool ok;
- uint l = value.asArrayLength(ctx, &ok);
+ uint l = value.asArrayLength(&ok);
if (!ok)
ctx->throwRangeError(value);
ok = setArrayLength(l);
@@ -688,7 +688,7 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, String *name, const Pr
bool succeeded = true;
if (attrs.type() == PropertyAttributes::Data) {
bool ok;
- uint l = p.value.asArrayLength(ctx, &ok);
+ uint l = p.value.asArrayLength(&ok);
if (!ok)
ctx->throwRangeError(p.value);
succeeded = setArrayLength(l);
@@ -876,13 +876,13 @@ Value Object::arrayIndexOf(Value v, uint fromIndex, uint endIndex, ExecutionCont
for (uint i = fromIndex; i < endIndex; ++i) {
bool exists;
Value value = o->getIndexed(ctx, i, &exists);
- if (exists && __qmljs_strict_equal(value, v, ctx))
+ if (exists && __qmljs_strict_equal(value, v))
return Value::fromDouble(i);
}
} else if (sparseArray) {
for (SparseArrayNode *n = sparseArray->lowerBound(fromIndex); n != sparseArray->end() && n->key() < endIndex; n = n->nextNode()) {
Value value = o->getValue(ctx, arrayData + n->value, arrayAttributes ? arrayAttributes[n->value] : Attr_Data);
- if (__qmljs_strict_equal(value, v, ctx))
+ if (__qmljs_strict_equal(value, v))
return Value::fromDouble(n->key());
}
} else {
@@ -894,7 +894,7 @@ Value Object::arrayIndexOf(Value v, uint fromIndex, uint endIndex, ExecutionCont
while (pd < end) {
if (!arrayAttributes || !arrayAttributes[pd - arrayData].isGeneric()) {
Value value = o->getValue(ctx, pd, arrayAttributes ? arrayAttributes[pd - arrayData] : Attr_Data);
- if (__qmljs_strict_equal(value, v, ctx))
+ if (__qmljs_strict_equal(value, v))
return Value::fromDouble(pd - arrayData);
}
++pd;
diff --git a/src/v4/qv4regexpobject.cpp b/src/v4/qv4regexpobject.cpp
index cc1d8474..3119382e 100644
--- a/src/v4/qv4regexpobject.cpp
+++ b/src/v4/qv4regexpobject.cpp
@@ -186,7 +186,7 @@ Value RegExpPrototype::method_exec(SimpleCallContext *ctx)
arg = __qmljs_to_string(arg, ctx);
QString s = arg.stringValue()->toQString();
- int offset = r->global ? r->lastIndexProperty(ctx)->value.toInt32(ctx) : 0;
+ int offset = r->global ? r->lastIndexProperty(ctx)->value.toInt32() : 0;
if (offset < 0 || offset > s.length()) {
r->lastIndexProperty(ctx)->value = Value::fromInt32(0);
return Value::nullValue();
diff --git a/src/v4/qv4runtime.cpp b/src/v4/qv4runtime.cpp
index 8aac271f..90fd44db 100644
--- a/src/v4/qv4runtime.cpp
+++ b/src/v4/qv4runtime.cpp
@@ -216,8 +216,8 @@ void __qmljs_delete_name(ExecutionContext *ctx, Value *result, String *name)
void __qmljs_add_helper(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
{
- Value pleft = __qmljs_to_primitive(left, ctx, PREFERREDTYPE_HINT);
- Value pright = __qmljs_to_primitive(right, ctx, PREFERREDTYPE_HINT);
+ Value pleft = __qmljs_to_primitive(left, PREFERREDTYPE_HINT);
+ Value pright = __qmljs_to_primitive(right, PREFERREDTYPE_HINT);
if (pleft.isString() || pright.isString()) {
if (!pleft.isString())
pleft = __qmljs_to_string(pleft, ctx);
@@ -227,8 +227,8 @@ void __qmljs_add_helper(ExecutionContext *ctx, Value *result, const Value &left,
*result = Value::fromString(string);
return;
}
- double x = __qmljs_to_number(pleft, ctx);
- double y = __qmljs_to_number(pright, ctx);
+ double x = __qmljs_to_number(pleft);
+ double y = __qmljs_to_number(pright);
*result = Value::fromDouble(x + y);
}
@@ -471,7 +471,7 @@ Value __qmljs_string_from_number(ExecutionContext *ctx, double number)
return Value::fromString(string);
}
-Bool __qmljs_string_compare(ExecutionContext *, String *left, String *right)
+Bool __qmljs_string_compare(String *left, String *right)
{
return left->toQString() < right->toQString();
}
@@ -494,34 +494,34 @@ String *__qmljs_string_concat(ExecutionContext *ctx, String *first, String *seco
return ctx->engine->newString(newStr);
}
-Value __qmljs_object_default_value(ExecutionContext *ctx, Value object, int typeHint)
+Value __qmljs_object_default_value(Object *object, int typeHint)
{
if (typeHint == PREFERREDTYPE_HINT) {
- if (object.asDateObject())
+ if (object->asDateObject())
typeHint = STRING_HINT;
else
typeHint = NUMBER_HINT;
}
- String *meth1 = ctx->engine->newString("toString");
- String *meth2 = ctx->engine->newString("valueOf");
+ ExecutionEngine *engine = object->internalClass->engine;
+ String *meth1 = engine->newString("toString");
+ String *meth2 = engine->newString("valueOf");
if (typeHint == NUMBER_HINT)
qSwap(meth1, meth2);
- assert(object.isObject());
- Object *oo = object.objectValue();
+ ExecutionContext *ctx = engine->current;
- Value conv = oo->get(ctx, meth1);
+ Value conv = object->get(ctx, meth1);
if (FunctionObject *o = conv.asFunctionObject()) {
- Value r = o->call(ctx, object, 0, 0);
+ Value r = o->call(ctx, Value::fromObject(object), 0, 0);
if (r.isPrimitive())
return r;
}
- conv = oo->get(ctx, meth2);
+ conv = object->get(ctx, meth2);
if (FunctionObject *o = conv.asFunctionObject()) {
- Value r = o->call(ctx, object, 0, 0);
+ Value r = o->call(ctx, Value::fromObject(object), 0, 0);
if (r.isPrimitive())
return r;
}
@@ -571,7 +571,7 @@ String *__qmljs_convert_to_string(ExecutionContext *ctx, const Value &value)
case Value::String_Type:
return value.stringValue();
case Value::Object_Type: {
- Value prim = __qmljs_to_primitive(value, ctx, STRING_HINT);
+ Value prim = __qmljs_to_primitive(value, STRING_HINT);
if (prim.isPrimitive())
return __qmljs_convert_to_string(ctx, prim);
else
@@ -754,7 +754,7 @@ void __qmljs_get_thisObject(ExecutionContext *ctx, Value *result)
*result = ctx->thisObject;
}
-uint __qmljs_equal(const Value &x, const Value &y, ExecutionContext *ctx)
+uint __qmljs_equal(const Value &x, const Value &y)
{
if (x.type() == y.type()) {
switch (x.type()) {
@@ -771,7 +771,8 @@ uint __qmljs_equal(const Value &x, const Value &y, ExecutionContext *ctx)
return x.stringValue()->isEqualTo(y.stringValue());
case Value::Object_Type:
if (x.objectValue()->externalComparison || y.objectValue()->externalComparison)
- return x.objectValue()->externalComparison && y.objectValue()->externalComparison && ctx->engine->externalResourceComparison(x, y);
+ return x.objectValue()->externalComparison && y.objectValue()->externalComparison
+ && x.objectValue()->internalClass->engine->externalResourceComparison(x, y);
return x.objectValue() == y.objectValue();
default: // double
return x.doubleValue() == y.doubleValue();
@@ -785,30 +786,30 @@ uint __qmljs_equal(const Value &x, const Value &y, ExecutionContext *ctx)
} else if (x.isUndefined() && y.isNull()) {
return true;
} else if (x.isNumber() && y.isString()) {
- Value ny = Value::fromDouble(__qmljs_to_number(y, ctx));
- return __qmljs_equal(x, ny, ctx);
+ Value ny = Value::fromDouble(__qmljs_to_number(y));
+ return __qmljs_equal(x, ny);
} else if (x.isString() && y.isNumber()) {
- Value nx = Value::fromDouble(__qmljs_to_number(x, ctx));
- return __qmljs_equal(nx, y, ctx);
+ Value nx = Value::fromDouble(__qmljs_to_number(x));
+ return __qmljs_equal(nx, y);
} else if (x.isBoolean()) {
Value nx = Value::fromDouble((double) x.booleanValue());
- return __qmljs_equal(nx, y, ctx);
+ return __qmljs_equal(nx, y);
} else if (y.isBoolean()) {
Value ny = Value::fromDouble((double) y.booleanValue());
- return __qmljs_equal(x, ny, ctx);
+ return __qmljs_equal(x, ny);
} else if ((x.isNumber() || x.isString()) && y.isObject()) {
- Value py = __qmljs_to_primitive(y, ctx, PREFERREDTYPE_HINT);
- return __qmljs_equal(x, py, ctx);
+ Value py = __qmljs_to_primitive(y, PREFERREDTYPE_HINT);
+ return __qmljs_equal(x, py);
} else if (x.isObject() && (y.isNumber() || y.isString())) {
- Value px = __qmljs_to_primitive(x, ctx, PREFERREDTYPE_HINT);
- return __qmljs_equal(px, y, ctx);
+ Value px = __qmljs_to_primitive(x, PREFERREDTYPE_HINT);
+ return __qmljs_equal(px, y);
}
}
return false;
}
-Bool __qmljs_strict_equal(const Value &x, const Value &y, ExecutionContext *ctx)
+Bool __qmljs_strict_equal(const Value &x, const Value &y)
{
TRACE2(x, y);
@@ -821,7 +822,7 @@ Bool __qmljs_strict_equal(const Value &x, const Value &y, ExecutionContext *ctx)
if (x.isString())
return __qmljs_string_equal(x.stringValue(), y.stringValue());
if (x.isObject() && x.objectValue()->externalComparison && y.objectValue()->externalComparison)
- return ctx->engine->externalResourceComparison(x, y);
+ return x.objectValue()->internalClass->engine->externalResourceComparison(x, y);
return false;
}
@@ -1070,7 +1071,7 @@ void __qmljs_builtin_post_increment(ExecutionContext *ctx, Value *result, Value
return;
}
- double d = __qmljs_to_number(*val, ctx);
+ double d = __qmljs_to_number(*val);
*val = Value::fromDouble(d + 1);
if (result)
*result = Value::fromDouble(d);
@@ -1085,7 +1086,7 @@ void __qmljs_builtin_post_increment_name(ExecutionContext *context, Value *resul
*result = v;
v.int_32 += 1;
} else {
- double d = __qmljs_to_number(v, context);
+ double d = __qmljs_to_number(v);
if (result)
*result = Value::fromDouble(d);
v = Value::fromDouble(d + 1);
@@ -1105,7 +1106,7 @@ void __qmljs_builtin_post_increment_member(ExecutionContext *context, Value *res
*result = v;
v.int_32 += 1;
} else {
- double d = __qmljs_to_number(v, context);
+ double d = __qmljs_to_number(v);
if (result)
*result = Value::fromDouble(d);
v = Value::fromDouble(d + 1);
@@ -1132,7 +1133,7 @@ void __qmljs_builtin_post_increment_element(ExecutionContext *context, Value *re
*result = v;
v.int_32 += 1;
} else {
- double d = __qmljs_to_number(v, context);
+ double d = __qmljs_to_number(v);
if (result)
*result = Value::fromDouble(d);
v = Value::fromDouble(d + 1);
@@ -1150,7 +1151,7 @@ void __qmljs_builtin_post_decrement(ExecutionContext *ctx, Value *result, Value
return;
}
- double d = __qmljs_to_number(*val, ctx);
+ double d = __qmljs_to_number(*val);
*val = Value::fromDouble(d - 1);
if (result)
*result = Value::fromDouble(d);
@@ -1165,7 +1166,7 @@ void __qmljs_builtin_post_decrement_name(ExecutionContext *context, Value *resul
*result = v;
v.int_32 -= 1;
} else {
- double d = __qmljs_to_number(v, context);
+ double d = __qmljs_to_number(v);
if (result)
*result = Value::fromDouble(d);
v = Value::fromDouble(d - 1);
@@ -1185,7 +1186,7 @@ void __qmljs_builtin_post_decrement_member(ExecutionContext *context, Value *res
*result = v;
v.int_32 -= 1;
} else {
- double d = __qmljs_to_number(v, context);
+ double d = __qmljs_to_number(v);
if (result)
*result = Value::fromDouble(d);
v = Value::fromDouble(d - 1);
@@ -1212,7 +1213,7 @@ void __qmljs_builtin_post_decrement_element(ExecutionContext *context, Value *re
*result = v;
v.int_32 -= 1;
} else {
- double d = __qmljs_to_number(v, context);
+ double d = __qmljs_to_number(v);
if (result)
*result = Value::fromDouble(d);
v = Value::fromDouble(d - 1);
@@ -1293,26 +1294,26 @@ void __qmljs_builtin_define_getter_setter(ExecutionContext *ctx, const Value &ob
pd->setSetter(setter ? setter->asFunctionObject() : 0);
}
-void __qmljs_increment(ExecutionContext *ctx, Value *result, const Value &value)
+void __qmljs_increment(ExecutionContext *, Value *result, const Value &value)
{
TRACE1(value);
if (value.isInteger())
*result = Value::fromInt32(value.integerValue() + 1);
else {
- double d = __qmljs_to_number(value, ctx);
+ double d = __qmljs_to_number(value);
*result = Value::fromDouble(d + 1);
}
}
-void __qmljs_decrement(ExecutionContext *ctx, Value *result, const Value &value)
+void __qmljs_decrement(ExecutionContext *, Value *result, const Value &value)
{
TRACE1(value);
if (value.isInteger())
*result = Value::fromInt32(value.integerValue() - 1);
else {
- double d = __qmljs_to_number(value, ctx);
+ double d = __qmljs_to_number(value);
*result = Value::fromDouble(d - 1);
}
}
diff --git a/src/v4/qv4runtime.h b/src/v4/qv4runtime.h
index 8487244a..3207ab4b 100644
--- a/src/v4/qv4runtime.h
+++ b/src/v4/qv4runtime.h
@@ -155,12 +155,12 @@ VM::Function *__qmljs_register_function(ExecutionContext *ctx, String *name,
// strings
double __qmljs_string_to_number(const String *string);
Value __qmljs_string_from_number(ExecutionContext *ctx, double number);
-Bool __qmljs_string_compare(ExecutionContext *ctx, String *left, String *right);
+Bool __qmljs_string_compare(String *left, String *right);
Bool __qmljs_string_equal(String *left, String *right);
String *__qmljs_string_concat(ExecutionContext *ctx, String *first, String *second);
// objects
-Value __qmljs_object_default_value(ExecutionContext *ctx, Value object, int typeHint);
+Value __qmljs_object_default_value(Object *object, int typeHint);
void __qmljs_set_activation_property(ExecutionContext *ctx, String *name, const Value& value);
void __qmljs_set_property(ExecutionContext *ctx, const Value &object, String *name, const Value &value);
void __qmljs_get_property(ExecutionContext *ctx, Value *result, const Value &object, String *name);
@@ -183,26 +183,25 @@ void __qmljs_foreach_next_property_name(Value *result, const Value &foreach_iter
void __qmljs_get_thisObject(ExecutionContext *ctx, Value *result);
// type conversion and testing
-Value __qmljs_to_primitive(const Value &value, ExecutionContext *ctx, int typeHint);
+Value __qmljs_to_primitive(const Value &value, int typeHint);
Bool __qmljs_to_boolean(const Value &value);
-double __qmljs_to_number(const Value &value, ExecutionContext *ctx);
+double __qmljs_to_number(const Value &value);
Value __qmljs_to_string(const Value &value, ExecutionContext *ctx);
Q_V4_EXPORT String *__qmljs_convert_to_string(ExecutionContext *ctx, const Value &value);
Value __qmljs_to_object(ExecutionContext *ctx, const Value &value);
Object *__qmljs_convert_to_object(ExecutionContext *ctx, const Value &value);
-Value __qmljs_default_value(const Value &value, ExecutionContext *ctx, int typeHint);
-Bool __qmljs_equal(const Value &x, const Value &y, ExecutionContext *ctx);
-Bool __qmljs_strict_equal(const Value &x, const Value &y, QQmlJS::VM::ExecutionContext *ctx);
+Bool __qmljs_equal(const Value &x, const Value &y);
+Bool __qmljs_strict_equal(const Value &x, const Value &y);
// unary operators
typedef void (*UnaryOpName)(ExecutionContext *, Value *, const Value &);
-void __qmljs_uplus(ExecutionContext *ctx, Value *result, const Value &value);
-void __qmljs_uminus(ExecutionContext *ctx, Value *result, const Value &value);
-void __qmljs_compl(ExecutionContext *ctx, Value *result, const Value &value);
-void __qmljs_not(ExecutionContext *ctx, Value *result, const Value &value);
-void __qmljs_increment(ExecutionContext *ctx, Value *result, const Value &value);
-void __qmljs_decrement(ExecutionContext *ctx, Value *result, const Value &value);
+void __qmljs_uplus(ExecutionContext *, Value *result, const Value &value);
+void __qmljs_uminus(ExecutionContext *, Value *result, const Value &value);
+void __qmljs_compl(ExecutionContext *, Value *result, const Value &value);
+void __qmljs_not(ExecutionContext *, Value *result, const Value &value);
+void __qmljs_increment(ExecutionContext *, Value *result, const Value &value);
+void __qmljs_decrement(ExecutionContext *, Value *result, const Value &value);
void __qmljs_delete_subscript(ExecutionContext *ctx, Value *result, const Value &base, const Value &index);
void __qmljs_delete_member(ExecutionContext *ctx, Value *result, const Value &base, String *name);
@@ -215,25 +214,25 @@ typedef void (*BinOp)(ExecutionContext *ctx, Value *result, const Value &left, c
void __qmljs_instanceof(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
void __qmljs_in(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
-void __qmljs_bit_or(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
-void __qmljs_bit_xor(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
-void __qmljs_bit_and(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
+void __qmljs_bit_or(ExecutionContext *, Value *result, const Value &left, const Value &right);
+void __qmljs_bit_xor(ExecutionContext *, Value *result, const Value &left, const Value &right);
+void __qmljs_bit_and(ExecutionContext *, Value *result, const Value &left, const Value &right);
void __qmljs_add(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
-void __qmljs_sub(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
-void __qmljs_mul(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
-void __qmljs_div(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
-void __qmljs_mod(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
-void __qmljs_shl(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
-void __qmljs_shr(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
-void __qmljs_ushr(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
+void __qmljs_sub(ExecutionContext *, Value *result, const Value &left, const Value &right);
+void __qmljs_mul(ExecutionContext *, Value *result, const Value &left, const Value &right);
+void __qmljs_div(ExecutionContext *, Value *result, const Value &left, const Value &right);
+void __qmljs_mod(ExecutionContext *, Value *result, const Value &left, const Value &right);
+void __qmljs_shl(ExecutionContext *, Value *result, const Value &left, const Value &right);
+void __qmljs_shr(ExecutionContext *, Value *result, const Value &left, const Value &right);
+void __qmljs_ushr(ExecutionContext *, Value *result, const Value &left, const Value &right);
void __qmljs_gt(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
void __qmljs_lt(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
void __qmljs_ge(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
void __qmljs_le(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
void __qmljs_eq(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
void __qmljs_ne(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
-void __qmljs_se(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
-void __qmljs_sne(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
+void __qmljs_se(ExecutionContext *, Value *result, const Value &left, const Value &right);
+void __qmljs_sne(ExecutionContext *, Value *result, const Value &left, const Value &right);
void __qmljs_add_helper(ExecutionContext *ctx, Value *result, const Value &left, const Value &right);
@@ -278,26 +277,27 @@ void __qmljs_inplace_shr_member(ExecutionContext *ctx, const Value &base, String
void __qmljs_inplace_ushr_member(ExecutionContext *ctx, const Value &base, String *name, const Value &rhs);
typedef Bool (*CmpOp)(ExecutionContext *ctx, const Value &left, const Value &right);
-Bool __qmljs_cmp_gt(ExecutionContext *ctx, const Value &left, const Value &right);
-Bool __qmljs_cmp_lt(ExecutionContext *ctx, const Value &left, const Value &right);
-Bool __qmljs_cmp_ge(ExecutionContext *ctx, const Value &left, const Value &right);
-Bool __qmljs_cmp_le(ExecutionContext *ctx, const Value &left, const Value &right);
-Bool __qmljs_cmp_eq(ExecutionContext *ctx, const Value &left, const Value &right);
+Bool __qmljs_cmp_gt(ExecutionContext *, const Value &left, const Value &right);
+Bool __qmljs_cmp_lt(ExecutionContext *, const Value &left, const Value &right);
+Bool __qmljs_cmp_ge(ExecutionContext *, const Value &left, const Value &right);
+Bool __qmljs_cmp_le(ExecutionContext *, const Value &left, const Value &right);
+Bool __qmljs_cmp_eq(ExecutionContext *, const Value &left, const Value &right);
Bool __qmljs_cmp_ne(ExecutionContext *ctx, const Value &left, const Value &right);
-Bool __qmljs_cmp_se(ExecutionContext *ctx, const Value &left, const Value &right);
-Bool __qmljs_cmp_sne(ExecutionContext *ctx, const Value &left, const Value &right);
+Bool __qmljs_cmp_se(ExecutionContext *, const Value &left, const Value &right);
+Bool __qmljs_cmp_sne(ExecutionContext *, const Value &left, const Value &right);
Bool __qmljs_cmp_instanceof(ExecutionContext *ctx, const Value &left, const Value &right);
Bool __qmljs_cmp_in(ExecutionContext *ctx, const Value &left, const Value &right);
// type conversion and testing
-inline Value __qmljs_to_primitive(const Value &value, ExecutionContext *ctx, int typeHint)
+inline Value __qmljs_to_primitive(const Value &value, int typeHint)
{
- if (!value.isObject())
+ Object *o = value.asObject();
+ if (!o)
return value;
- return __qmljs_default_value(value, ctx, typeHint);
+ return __qmljs_object_default_value(o, typeHint);
}
-inline double __qmljs_to_number(const Value &value, ExecutionContext *ctx)
+inline double __qmljs_to_number(const Value &value)
{
switch (value.type()) {
case Value::Undefined_Type:
@@ -311,8 +311,8 @@ inline double __qmljs_to_number(const Value &value, ExecutionContext *ctx)
case Value::String_Type:
return __qmljs_string_to_number(value.stringValue());
case Value::Object_Type: {
- Value prim = __qmljs_to_primitive(value, ctx, NUMBER_HINT);
- return __qmljs_to_number(prim, ctx);
+ Value prim = __qmljs_to_primitive(value, NUMBER_HINT);
+ return __qmljs_to_number(prim);
}
default: // double
return value.doubleValue();
@@ -334,15 +334,7 @@ inline Value __qmljs_to_object(ExecutionContext *ctx, const Value &value)
}
-inline Value __qmljs_default_value(const Value &value, ExecutionContext *ctx, int typeHint)
-{
- if (value.isObject())
- return __qmljs_object_default_value(ctx, value, typeHint);
- return Value::undefinedValue();
-}
-
-
-inline void __qmljs_uplus(ExecutionContext *ctx, Value *result, const Value &value)
+inline void __qmljs_uplus(ExecutionContext *, Value *result, const Value &value)
{
TRACE1(value);
@@ -350,11 +342,11 @@ inline void __qmljs_uplus(ExecutionContext *ctx, Value *result, const Value &val
if (result->tryIntegerConversion())
return;
- double n = __qmljs_to_number(value, ctx);
+ double n = __qmljs_to_number(value);
*result = Value::fromDouble(n);
}
-inline void __qmljs_uminus(ExecutionContext *ctx, Value *result, const Value &value)
+inline void __qmljs_uminus(ExecutionContext *, Value *result, const Value &value)
{
TRACE1(value);
@@ -362,12 +354,12 @@ inline void __qmljs_uminus(ExecutionContext *ctx, Value *result, const Value &va
if (value.isInteger() && value.integerValue())
*result = Value::fromInt32(-value.integerValue());
else {
- double n = __qmljs_to_number(value, ctx);
+ double n = __qmljs_to_number(value);
*result = Value::fromDouble(-n);
}
}
-inline void __qmljs_compl(ExecutionContext *ctx, Value *result, const Value &value)
+inline void __qmljs_compl(ExecutionContext *, Value *result, const Value &value)
{
TRACE1(value);
@@ -375,7 +367,7 @@ inline void __qmljs_compl(ExecutionContext *ctx, Value *result, const Value &val
if (value.isConvertibleToInt())
n = value.int_32;
else
- n = Value::toInt32(__qmljs_to_number(value, ctx));
+ n = Value::toInt32(__qmljs_to_number(value));
*result = Value::fromInt32(~n);
}
@@ -389,7 +381,7 @@ inline void __qmljs_not(ExecutionContext *, Value *result, const Value &value)
}
// binary operators
-inline void __qmljs_bit_or(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
+inline void __qmljs_bit_or(ExecutionContext *, Value *result, const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -398,12 +390,12 @@ inline void __qmljs_bit_or(ExecutionContext *ctx, Value *result, const Value &le
return;
}
- int lval = Value::toInt32(__qmljs_to_number(left, ctx));
- int rval = Value::toInt32(__qmljs_to_number(right, ctx));
+ int lval = Value::toInt32(__qmljs_to_number(left));
+ int rval = Value::toInt32(__qmljs_to_number(right));
*result = Value::fromInt32(lval | rval);
}
-inline void __qmljs_bit_xor(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
+inline void __qmljs_bit_xor(ExecutionContext *, Value *result, const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -412,12 +404,12 @@ inline void __qmljs_bit_xor(ExecutionContext *ctx, Value *result, const Value &l
return;
}
- int lval = Value::toInt32(__qmljs_to_number(left, ctx));
- int rval = Value::toInt32(__qmljs_to_number(right, ctx));
+ int lval = Value::toInt32(__qmljs_to_number(left));
+ int rval = Value::toInt32(__qmljs_to_number(right));
*result = Value::fromInt32(lval ^ rval);
}
-inline void __qmljs_bit_and(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
+inline void __qmljs_bit_and(ExecutionContext *, Value *result, const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -426,8 +418,8 @@ inline void __qmljs_bit_and(ExecutionContext *ctx, Value *result, const Value &l
return;
}
- int lval = Value::toInt32(__qmljs_to_number(left, ctx));
- int rval = Value::toInt32(__qmljs_to_number(right, ctx));
+ int lval = Value::toInt32(__qmljs_to_number(left));
+ int rval = Value::toInt32(__qmljs_to_number(right));
*result = Value::fromInt32(lval & rval);
}
@@ -450,7 +442,7 @@ inline void __qmljs_add(ExecutionContext *ctx, Value *result, const Value &left,
__qmljs_add_helper(ctx, result, left, right);
}
-inline void __qmljs_sub(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
+inline void __qmljs_sub(ExecutionContext *, Value *result, const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -461,12 +453,12 @@ inline void __qmljs_sub(ExecutionContext *ctx, Value *result, const Value &left,
}
#endif
- double lval = __qmljs_to_number(left, ctx);
- double rval = __qmljs_to_number(right, ctx);
+ double lval = __qmljs_to_number(left);
+ double rval = __qmljs_to_number(right);
*result = Value::fromDouble(lval - rval);
}
-inline void __qmljs_mul(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
+inline void __qmljs_mul(ExecutionContext *, Value *result, const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -477,21 +469,21 @@ inline void __qmljs_mul(ExecutionContext *ctx, Value *result, const Value &left,
}
#endif
- double lval = __qmljs_to_number(left, ctx);
- double rval = __qmljs_to_number(right, ctx);
+ double lval = __qmljs_to_number(left);
+ double rval = __qmljs_to_number(right);
*result = Value::fromDouble(lval * rval);
}
-inline void __qmljs_div(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
+inline void __qmljs_div(ExecutionContext *, Value *result, const Value &left, const Value &right)
{
TRACE2(left, right);
- double lval = __qmljs_to_number(left, ctx);
- double rval = __qmljs_to_number(right, ctx);
+ double lval = __qmljs_to_number(left);
+ double rval = __qmljs_to_number(right);
*result = Value::fromDouble(lval / rval);
}
-inline void __qmljs_mod(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
+inline void __qmljs_mod(ExecutionContext *, Value *result, const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -503,12 +495,12 @@ inline void __qmljs_mod(ExecutionContext *ctx, Value *result, const Value &left,
}
}
- double lval = __qmljs_to_number(left, ctx);
- double rval = __qmljs_to_number(right, ctx);
+ double lval = __qmljs_to_number(left);
+ double rval = __qmljs_to_number(right);
*result = Value::fromDouble(fmod(lval, rval));
}
-inline void __qmljs_shl(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
+inline void __qmljs_shl(ExecutionContext *, Value *result, const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -517,12 +509,12 @@ inline void __qmljs_shl(ExecutionContext *ctx, Value *result, const Value &left,
return;
}
- int lval = Value::toInt32(__qmljs_to_number(left, ctx));
- unsigned rval = Value::toUInt32(__qmljs_to_number(right, ctx)) & 0x1f;
+ int lval = Value::toInt32(__qmljs_to_number(left));
+ unsigned rval = Value::toUInt32(__qmljs_to_number(right)) & 0x1f;
*result = Value::fromInt32(lval << rval);
}
-inline void __qmljs_shr(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
+inline void __qmljs_shr(ExecutionContext *, Value *result, const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -531,12 +523,12 @@ inline void __qmljs_shr(ExecutionContext *ctx, Value *result, const Value &left,
return;
}
- int lval = Value::toInt32(__qmljs_to_number(left, ctx));
- unsigned rval = Value::toUInt32(__qmljs_to_number(right, ctx)) & 0x1f;
+ int lval = Value::toInt32(__qmljs_to_number(left));
+ unsigned rval = Value::toUInt32(__qmljs_to_number(right)) & 0x1f;
*result = Value::fromInt32(lval >> rval);
}
-inline void __qmljs_ushr(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
+inline void __qmljs_ushr(ExecutionContext *, Value *result, const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -544,8 +536,8 @@ inline void __qmljs_ushr(ExecutionContext *ctx, Value *result, const Value &left
if (Value::integerCompatible(left, right)) {
res = uint(left.integerValue()) >> (uint(right.integerValue()) & 0x1f);
} else {
- unsigned lval = Value::toUInt32(__qmljs_to_number(left, ctx));
- unsigned rval = Value::toUInt32(__qmljs_to_number(right, ctx)) & 0x1f;
+ unsigned lval = Value::toUInt32(__qmljs_to_number(left));
+ unsigned rval = Value::toUInt32(__qmljs_to_number(right)) & 0x1f;
res = lval >> rval;
}
@@ -597,103 +589,103 @@ inline void __qmljs_ne(ExecutionContext *ctx, Value *result, const Value &left,
*result = Value::fromBoolean(!__qmljs_cmp_eq(ctx, left, right));
}
-inline void __qmljs_se(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
+inline void __qmljs_se(ExecutionContext *, Value *result, const Value &left, const Value &right)
{
TRACE2(left, right);
- bool r = __qmljs_strict_equal(left, right, ctx);
+ bool r = __qmljs_strict_equal(left, right);
*result = Value::fromBoolean(r);
}
-inline void __qmljs_sne(ExecutionContext *ctx, Value *result, const Value &left, const Value &right)
+inline void __qmljs_sne(ExecutionContext *, Value *result, const Value &left, const Value &right)
{
TRACE2(left, right);
- bool r = ! __qmljs_strict_equal(left, right, ctx);
+ bool r = ! __qmljs_strict_equal(left, right);
*result = Value::fromBoolean(r);
}
-inline Bool __qmljs_cmp_gt(ExecutionContext *ctx, const Value &left, const Value &right)
+inline Bool __qmljs_cmp_gt(ExecutionContext *, const Value &left, const Value &right)
{
TRACE2(left, right);
if (Value::integerCompatible(left, right))
return left.integerValue() > right.integerValue();
- Value l = __qmljs_to_primitive(left, ctx, NUMBER_HINT);
- Value r = __qmljs_to_primitive(right, ctx, NUMBER_HINT);
+ Value l = __qmljs_to_primitive(left, NUMBER_HINT);
+ Value r = __qmljs_to_primitive(right, NUMBER_HINT);
if (Value::bothDouble(l, r)) {
return l.doubleValue() > r.doubleValue();
} else if (l.isString() && r.isString()) {
- return __qmljs_string_compare(ctx, r.stringValue(), l.stringValue());
+ return __qmljs_string_compare(r.stringValue(), l.stringValue());
} else {
- double dl = __qmljs_to_number(l, ctx);
- double dr = __qmljs_to_number(r, ctx);
+ double dl = __qmljs_to_number(l);
+ double dr = __qmljs_to_number(r);
return dl > dr;
}
}
-inline Bool __qmljs_cmp_lt(ExecutionContext *ctx, const Value &left, const Value &right)
+inline Bool __qmljs_cmp_lt(ExecutionContext *, const Value &left, const Value &right)
{
TRACE2(left, right);
if (Value::integerCompatible(left, right))
return left.integerValue() < right.integerValue();
- Value l = __qmljs_to_primitive(left, ctx, NUMBER_HINT);
- Value r = __qmljs_to_primitive(right, ctx, NUMBER_HINT);
+ Value l = __qmljs_to_primitive(left, NUMBER_HINT);
+ Value r = __qmljs_to_primitive(right, NUMBER_HINT);
if (Value::bothDouble(l, r)) {
return l.doubleValue() < r.doubleValue();
} else if (l.isString() && r.isString()) {
- return __qmljs_string_compare(ctx, l.stringValue(), r.stringValue());
+ return __qmljs_string_compare(l.stringValue(), r.stringValue());
} else {
- double dl = __qmljs_to_number(l, ctx);
- double dr = __qmljs_to_number(r, ctx);
+ double dl = __qmljs_to_number(l);
+ double dr = __qmljs_to_number(r);
return dl < dr;
}
}
-inline Bool __qmljs_cmp_ge(ExecutionContext *ctx, const Value &left, const Value &right)
+inline Bool __qmljs_cmp_ge(ExecutionContext *, const Value &left, const Value &right)
{
TRACE2(left, right);
if (Value::integerCompatible(left, right))
return left.integerValue() >= right.integerValue();
- Value l = __qmljs_to_primitive(left, ctx, NUMBER_HINT);
- Value r = __qmljs_to_primitive(right, ctx, NUMBER_HINT);
+ Value l = __qmljs_to_primitive(left, NUMBER_HINT);
+ Value r = __qmljs_to_primitive(right, NUMBER_HINT);
if (Value::bothDouble(l, r)) {
return l.doubleValue() >= r.doubleValue();
} else if (l.isString() && r.isString()) {
- return !__qmljs_string_compare(ctx, l.stringValue(), r.stringValue());
+ return !__qmljs_string_compare(l.stringValue(), r.stringValue());
} else {
- double dl = __qmljs_to_number(l, ctx);
- double dr = __qmljs_to_number(r, ctx);
+ double dl = __qmljs_to_number(l);
+ double dr = __qmljs_to_number(r);
return dl >= dr;
}
}
-inline Bool __qmljs_cmp_le(ExecutionContext *ctx, const Value &left, const Value &right)
+inline Bool __qmljs_cmp_le(ExecutionContext *, const Value &left, const Value &right)
{
TRACE2(left, right);
if (Value::integerCompatible(left, right))
return left.integerValue() <= right.integerValue();
- Value l = __qmljs_to_primitive(left, ctx, NUMBER_HINT);
- Value r = __qmljs_to_primitive(right, ctx, NUMBER_HINT);
+ Value l = __qmljs_to_primitive(left, NUMBER_HINT);
+ Value r = __qmljs_to_primitive(right, NUMBER_HINT);
if (Value::bothDouble(l, r)) {
return l.doubleValue() <= r.doubleValue();
} else if (l.isString() && r.isString()) {
- return !__qmljs_string_compare(ctx, r.stringValue(), l.stringValue());
+ return !__qmljs_string_compare(r.stringValue(), l.stringValue());
} else {
- double dl = __qmljs_to_number(l, ctx);
- double dr = __qmljs_to_number(r, ctx);
+ double dl = __qmljs_to_number(l);
+ double dr = __qmljs_to_number(r);
return dl <= dr;
}
}
-inline Bool __qmljs_cmp_eq(ExecutionContext *ctx, const Value &left, const Value &right)
+inline Bool __qmljs_cmp_eq(ExecutionContext *, const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -705,7 +697,7 @@ inline Bool __qmljs_cmp_eq(ExecutionContext *ctx, const Value &left, const Value
if (left.isString() && right.isString())
return __qmljs_string_equal(left.stringValue(), right.stringValue());
- return __qmljs_equal(left, right, ctx);
+ return __qmljs_equal(left, right);
}
inline Bool __qmljs_cmp_ne(ExecutionContext *ctx, const Value &left, const Value &right)
@@ -715,18 +707,18 @@ inline Bool __qmljs_cmp_ne(ExecutionContext *ctx, const Value &left, const Value
return !__qmljs_cmp_eq(ctx, left, right);
}
-inline Bool __qmljs_cmp_se(ExecutionContext *ctx, const Value &left, const Value &right)
+inline Bool __qmljs_cmp_se(ExecutionContext *, const Value &left, const Value &right)
{
TRACE2(left, right);
- return __qmljs_strict_equal(left, right, ctx);
+ return __qmljs_strict_equal(left, right);
}
-inline Bool __qmljs_cmp_sne(ExecutionContext *ctx, const Value &left, const Value &right)
+inline Bool __qmljs_cmp_sne(ExecutionContext *, const Value &left, const Value &right)
{
TRACE2(left, right);
- return ! __qmljs_strict_equal(left, right, ctx);
+ return ! __qmljs_strict_equal(left, right);
}
inline Bool __qmljs_cmp_instanceof(ExecutionContext *ctx, const Value &left, const Value &right)
diff --git a/src/v4/qv4sparsearray.cpp b/src/v4/qv4sparsearray.cpp
index b1ac8300..2c9075ba 100644
--- a/src/v4/qv4sparsearray.cpp
+++ b/src/v4/qv4sparsearray.cpp
@@ -66,7 +66,7 @@ bool ArrayElementLessThan::operator()(const Property &p1, const Property &p2) co
Value args[] = { v1, v2 };
Value result = Value::undefinedValue();
__qmljs_call_value(m_context, &result, /*thisObject*/0, m_comparefn, args, 2);
- return result.toNumber(m_context) <= 0;
+ return result.toNumber() <= 0;
}
return v1.toString(m_context)->toQString() < v2.toString(m_context)->toQString();
}
diff --git a/src/v4/qv4stringobject.cpp b/src/v4/qv4stringobject.cpp
index cd3e1568..42b9b422 100644
--- a/src/v4/qv4stringobject.cpp
+++ b/src/v4/qv4stringobject.cpp
@@ -208,7 +208,7 @@ Value StringPrototype::method_charAt(SimpleCallContext *context)
int pos = 0;
if (context->argumentCount > 0)
- pos = (int) context->arguments[0].toInteger(context);
+ pos = (int) context->arguments[0].toInteger();
QString result;
if (pos >= 0 && pos < str.length())
@@ -223,7 +223,7 @@ Value StringPrototype::method_charCodeAt(SimpleCallContext *context)
int pos = 0;
if (context->argumentCount > 0)
- pos = (int) context->arguments[0].toInteger(context);
+ pos = (int) context->arguments[0].toInteger();
if (pos >= 0 && pos < str.length())
@@ -255,7 +255,7 @@ Value StringPrototype::method_indexOf(SimpleCallContext *context)
int pos = 0;
if (context->argumentCount > 1)
- pos = (int) context->arguments[1].toInteger(context);
+ pos = (int) context->arguments[1].toInteger();
int index = -1;
if (! value.isEmpty())
@@ -275,7 +275,7 @@ Value StringPrototype::method_lastIndexOf(SimpleCallContext *context)
}
Value posArg = context->argumentCount > 1 ? context->arguments[1] : Value::undefinedValue();
- double position = __qmljs_to_number(posArg, context);
+ double position = __qmljs_to_number(posArg);
if (isnan(position))
position = +qInf();
else
@@ -333,7 +333,7 @@ Value StringPrototype::method_match(SimpleCallContext *context)
if (result.isNull())
break;
assert(result.isObject());
- double thisIndex = rx->get(context, lastIndex, 0).toInteger(context);
+ double thisIndex = rx->get(context, lastIndex, 0).toInteger();
if (previousLastIndex == thisIndex) {
previousLastIndex = thisIndex + 1;
rx->put(context, lastIndex, Value::fromDouble(previousLastIndex));
@@ -510,9 +510,9 @@ Value StringPrototype::method_slice(SimpleCallContext *ctx)
const QString text = getThisString(ctx);
const double length = text.length();
- double start = ctx->argument(0).toInteger(ctx);
+ double start = ctx->argument(0).toInteger();
double end = ctx->argument(1).isUndefined()
- ? length : ctx->argument(1).toInteger(ctx);
+ ? length : ctx->argument(1).toInteger();
if (start < 0)
start = qMax(length + start, 0.);
@@ -550,10 +550,10 @@ Value StringPrototype::method_split(SimpleCallContext *ctx)
array->push_back(Value::fromString(ctx, text));
return result;
}
- return Value::fromString(ctx, text.left(limitValue.toInteger(ctx)));
+ return Value::fromString(ctx, text.left(limitValue.toInteger()));
}
- uint limit = limitValue.isUndefined() ? UINT_MAX : limitValue.toUInt32(ctx);
+ uint limit = limitValue.isUndefined() ? UINT_MAX : limitValue.toUInt32();
if (limit == 0)
return result;
@@ -617,11 +617,11 @@ Value StringPrototype::method_substr(SimpleCallContext *context)
double start = 0;
if (context->argumentCount > 0)
- start = context->arguments[0].toInteger(context);
+ start = context->arguments[0].toInteger();
double length = +qInf();
if (context->argumentCount > 1)
- length = context->arguments[1].toInteger(context);
+ length = context->arguments[1].toInteger();
double count = value.length();
if (start < 0)
@@ -643,11 +643,11 @@ Value StringPrototype::method_substring(SimpleCallContext *context)
double end = length;
if (context->argumentCount > 0)
- start = context->arguments[0].toInteger(context);
+ start = context->arguments[0].toInteger();
Value endValue = context->argumentCount > 1 ? context->arguments[1] : Value::undefinedValue();
if (!endValue.isUndefined())
- end = endValue.toInteger(context);
+ end = endValue.toInteger();
if (isnan(start) || start < 0)
start = 0;
@@ -699,7 +699,7 @@ Value StringPrototype::method_fromCharCode(SimpleCallContext *context)
QString str(context->argumentCount, Qt::Uninitialized);
QChar *ch = str.data();
for (int i = 0; i < context->argumentCount; ++i) {
- *ch = QChar(context->arguments[i].toUInt16(context));
+ *ch = QChar(context->arguments[i].toUInt16());
++ch;
}
return Value::fromString(context, str);
diff --git a/src/v4/qv4v8.cpp b/src/v4/qv4v8.cpp
index 7630423f..d81f23f3 100644
--- a/src/v4/qv4v8.cpp
+++ b/src/v4/qv4v8.cpp
@@ -487,7 +487,7 @@ Local<Boolean> Value::ToBoolean() const
Local<Number> Value::ToNumber() const
{
- return Local<Number>::New(Value::fromVmValue(VM::Value::fromDouble(ConstValuePtr(this)->toNumber(currentEngine()->current))));
+ return Local<Number>::New(Value::fromVmValue(VM::Value::fromDouble(ConstValuePtr(this)->toNumber())));
}
Local<String> Value::ToString() const
@@ -502,17 +502,17 @@ Local<Object> Value::ToObject() const
Local<Integer> Value::ToInteger() const
{
- return Local<Integer>::New(Value::fromVmValue(QQmlJS::VM::Value::fromDouble(ConstValuePtr(this)->toInteger(currentEngine()->current))));
+ return Local<Integer>::New(Value::fromVmValue(QQmlJS::VM::Value::fromDouble(ConstValuePtr(this)->toInteger())));
}
Local<Uint32> Value::ToUint32() const
{
- return Local<Uint32>::New(Value::fromVmValue(QQmlJS::VM::Value::fromUInt32(ConstValuePtr(this)->toUInt32(currentEngine()->current))));
+ return Local<Uint32>::New(Value::fromVmValue(QQmlJS::VM::Value::fromUInt32(ConstValuePtr(this)->toUInt32())));
}
Local<Int32> Value::ToInt32() const
{
- return Local<Int32>::New(Value::fromVmValue(QQmlJS::VM::Value::fromInt32(ConstValuePtr(this)->toInt32(currentEngine()->current))));
+ return Local<Int32>::New(Value::fromVmValue(QQmlJS::VM::Value::fromInt32(ConstValuePtr(this)->toInt32())));
}
Local<Uint32> Value::ToArrayIndex() const
@@ -532,27 +532,27 @@ double Value::NumberValue() const
int64_t Value::IntegerValue() const
{
- return (int64_t)ConstValuePtr(this)->toInteger(currentEngine()->current);
+ return (int64_t)ConstValuePtr(this)->toInteger();
}
uint32_t Value::Uint32Value() const
{
- return ConstValuePtr(this)->toUInt32(currentEngine()->current);
+ return ConstValuePtr(this)->toUInt32();
}
int32_t Value::Int32Value() const
{
- return ConstValuePtr(this)->toInt32(currentEngine()->current);
+ return ConstValuePtr(this)->toInt32();
}
bool Value::Equals(Handle<Value> that) const
{
- return __qmljs_equal(*ConstValuePtr(this), *ConstValuePtr(&that), currentEngine()->current);
+ return __qmljs_equal(*ConstValuePtr(this), *ConstValuePtr(&that));
}
bool Value::StrictEquals(Handle<Value> that) const
{
- return __qmljs_strict_equal(*ConstValuePtr(this), *ConstValuePtr(&that), currentEngine()->current);
+ return __qmljs_strict_equal(*ConstValuePtr(this), *ConstValuePtr(&that));
}
VM::Value Value::vmValue() const
@@ -776,7 +776,7 @@ uint32_t Uint32::Value() const
{
const VM::Value *v = ConstValuePtr(this);
assert(v->isNumber());
- return v->toUInt32(currentEngine()->current);
+ return v->toUInt32();
}
diff --git a/src/v4/qv4value.cpp b/src/v4/qv4value.cpp
index 78769bd4..73efe7d2 100644
--- a/src/v4/qv4value.cpp
+++ b/src/v4/qv4value.cpp
@@ -49,12 +49,12 @@ namespace QQmlJS {
namespace VM {
-int Value::toUInt16(ExecutionContext *ctx) const
+int Value::toUInt16() const
{
if (isConvertibleToInt())
return (ushort)(uint)integerValue();
- double number = __qmljs_to_number(*this, ctx);
+ double number = __qmljs_to_number(*this);
double D16 = 65536.0;
if ((number >= 0 && number < D16))
@@ -75,17 +75,17 @@ int Value::toUInt16(ExecutionContext *ctx) const
return (unsigned short)number;
}
-double Value::toInteger(ExecutionContext *ctx) const
+double Value::toInteger() const
{
if (isConvertibleToInt())
return int_32;
- return Value::toInteger(__qmljs_to_number(*this, ctx));
+ return Value::toInteger(__qmljs_to_number(*this));
}
-double Value::toNumber(ExecutionContext *ctx) const
+double Value::toNumber() const
{
- return __qmljs_to_number(*this, ctx);
+ return __qmljs_to_number(*this);
}
bool Value::sameValue(Value other) const {
diff --git a/src/v4/qv4value.h b/src/v4/qv4value.h
index 929e4561..bbfba842 100644
--- a/src/v4/qv4value.h
+++ b/src/v4/qv4value.h
@@ -61,7 +61,7 @@ struct ExecutionEngine;
struct Value;
extern "C" {
-double __qmljs_to_number(const Value &value, ExecutionContext *ctx);
+double __qmljs_to_number(const Value &value);
Q_V4_EXPORT String *__qmljs_convert_to_string(ExecutionContext *ctx, const Value &value);
Object *__qmljs_convert_to_object(ExecutionContext *ctx, const Value &value);
}
@@ -209,13 +209,13 @@ struct Q_V4_EXPORT Value
static int toInt32(double value);
static unsigned int toUInt32(double value);
- int toUInt16(ExecutionContext *ctx) const;
- int toInt32(ExecutionContext *ctx) const;
- unsigned int toUInt32(ExecutionContext *ctx) const;
+ int toUInt16() const;
+ int toInt32() const;
+ unsigned int toUInt32() const;
Bool toBoolean() const;
- double toInteger(ExecutionContext *ctx) const;
- double toNumber(ExecutionContext *ctx) const;
+ double toInteger() const;
+ double toNumber() const;
String *toString(ExecutionContext *ctx) const;
Object *toObject(ExecutionContext *ctx) const;
@@ -263,7 +263,7 @@ struct Q_V4_EXPORT Value
ArrayObject *asArrayObject() const;
ErrorObject *asErrorObject() const;
uint asArrayIndex() const;
- uint asArrayLength(ExecutionContext *ctx, bool *ok) const;
+ uint asArrayLength(bool *ok) const;
Value property(ExecutionContext *ctx, String *name) const;
@@ -405,7 +405,7 @@ inline Object *Value::toObject(ExecutionContext *ctx) const
return __qmljs_convert_to_object(ctx, *this);
}
-inline int Value::toInt32(ExecutionContext *ctx) const
+inline int Value::toInt32() const
{
if (isConvertibleToInt())
return int_32;
@@ -413,7 +413,7 @@ inline int Value::toInt32(ExecutionContext *ctx) const
if (isDouble())
d = dbl;
else
- d = __qmljs_to_number(*this, ctx);
+ d = __qmljs_to_number(*this);
const double D32 = 4294967296.0;
const double D31 = D32 / 2.0;
@@ -421,17 +421,18 @@ inline int Value::toInt32(ExecutionContext *ctx) const
if ((d >= -D31 && d < D31))
return static_cast<int>(d);
- return Value::toInt32(__qmljs_to_number(*this, ctx));
+ return Value::toInt32(__qmljs_to_number(*this));
}
-inline unsigned int Value::toUInt32(ExecutionContext *ctx) const {
+inline unsigned int Value::toUInt32() const
+{
if (isConvertibleToInt())
return (unsigned) int_32;
double d;
if (isDouble())
d = dbl;
else
- d = __qmljs_to_number(*this, ctx);
+ d = __qmljs_to_number(*this);
const double D32 = 4294967296.0;
if (dbl >= 0 && dbl < D32)
@@ -451,7 +452,7 @@ inline uint Value::asArrayIndex() const
return idx;
}
-inline uint Value::asArrayLength(ExecutionContext *ctx, bool *ok) const
+inline uint Value::asArrayLength(bool *ok) const
{
*ok = true;
if (isConvertibleToInt() && int_32 >= 0)
@@ -467,8 +468,8 @@ inline uint Value::asArrayLength(ExecutionContext *ctx, bool *ok) const
if (isString())
return stringValue()->toUInt(ok);
- uint idx = toUInt32(ctx);
- double d = toNumber(ctx);
+ uint idx = toUInt32();
+ double d = toNumber();
if (d != idx) {
*ok = false;
return UINT_MAX;