aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-15 21:54:12 +0100
committerLars Knoll <lars.knoll@digia.com>2015-01-23 12:30:38 +0100
commitef6b4938b9ec309d5faf0c966cb2b58f3de2ca77 (patch)
tree3d946ad66defb1ec5c60a50e16b6e7883ec33862
parent3dbf4e9a6979802fff55e2f5e6aa54a14280e128 (diff)
Cleanups
Simplify some code in BooleanObject Simplify access to call arguments and thisObject Change-Id: I2f8e844019bc587385608beb02f05b15f827535c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/imports/localstorage/plugin.cpp36
-rw-r--r--src/particles/qquickv4particledata.cpp30
-rw-r--r--src/qml/jsruntime/qv4argumentsobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4arraybuffer.cpp10
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp4
-rw-r--r--src/qml/jsruntime/qv4arraydata_p.h6
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp110
-rw-r--r--src/qml/jsruntime/qv4booleanobject.cpp21
-rw-r--r--src/qml/jsruntime/qv4context.cpp6
-rw-r--r--src/qml/jsruntime/qv4context_p.h15
-rw-r--r--src/qml/jsruntime/qv4dataview.cpp56
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp132
-rw-r--r--src/qml/jsruntime/qv4engine.cpp4
-rw-r--r--src/qml/jsruntime/qv4engine_p.h2
-rw-r--r--src/qml/jsruntime/qv4errorobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp24
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp38
-rw-r--r--src/qml/jsruntime/qv4include.cpp8
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp48
-rw-r--r--src/qml/jsruntime/qv4numberobject.cpp32
-rw-r--r--src/qml/jsruntime/qv4object_p.h16
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp42
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp28
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp10
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp2
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp14
-rw-r--r--src/qml/jsruntime/qv4sequenceobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp68
-rw-r--r--src/qml/jsruntime/qv4typedarray.cpp22
-rw-r--r--src/qml/jsruntime/qv4variantobject.cpp10
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp2
-rw-r--r--src/qml/qml/qqmlcomponent.cpp14
-rw-r--r--src/qml/qml/qqmllocale.cpp210
-rw-r--r--src/qml/qml/qqmllocale_p.h2
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp2
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp102
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp348
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp16
-rw-r--r--src/qml/types/qquickworkerscript.cpp4
-rw-r--r--src/qml/util/qqmladaptormodel.cpp22
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp592
41 files changed, 1064 insertions, 1054 deletions
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index 353a7618da..4afc47598a 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -144,7 +144,7 @@ QV4::Heap::QQmlSqlDatabaseWrapper::QQmlSqlDatabaseWrapper(ExecutionEngine *e)
static ReturnedValue qmlsqldatabase_version(CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Database)
V4THROW_REFERENCE("Not a SQLDatabase object");
@@ -154,7 +154,7 @@ static ReturnedValue qmlsqldatabase_version(CallContext *ctx)
static ReturnedValue qmlsqldatabase_rows_length(CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
@@ -173,7 +173,7 @@ static ReturnedValue qmlsqldatabase_rows_length(CallContext *ctx)
static ReturnedValue qmlsqldatabase_rows_forwardOnly(CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
return Encode(r->d()->sqlQuery.isForwardOnly());
@@ -182,13 +182,13 @@ static ReturnedValue qmlsqldatabase_rows_forwardOnly(CallContext *ctx)
static ReturnedValue qmlsqldatabase_rows_setForwardOnly(CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
- if (ctx->d()->callData->argc < 1)
+ if (ctx->argc() < 1)
return ctx->engine()->throwTypeError();
- r->d()->sqlQuery.setForwardOnly(ctx->d()->callData->args[0].toBoolean());
+ r->d()->sqlQuery.setForwardOnly(ctx->args()[0].toBoolean());
return Encode::undefined();
}
@@ -252,17 +252,17 @@ ReturnedValue QQmlSqlDatabaseWrapper::getIndexed(Managed *m, uint index, bool *h
static ReturnedValue qmlsqldatabase_rows_item(CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
- return qmlsqldatabase_rows_index(r, scope.engine, ctx->d()->callData->argc ? ctx->d()->callData->args[0].toUInt32() : 0);
+ return qmlsqldatabase_rows_index(r, scope.engine, ctx->argc() ? ctx->args()[0].toUInt32() : 0);
}
static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Query)
V4THROW_REFERENCE("Not a SQLDatabase::Query object");
@@ -271,7 +271,7 @@ static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
QSqlDatabase db = r->d()->database;
- QString sql = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toQString() : QString();
+ QString sql = ctx->argc() ? ctx->args()[0].toQString() : QString();
if (r->d()->readonly && !sql.startsWith(QLatin1String("SELECT"),Qt::CaseInsensitive)) {
V4THROW_SQL(SQLEXCEPTION_SYNTAX_ERR, QQmlEngine::tr("Read-only Transaction"));
@@ -283,8 +283,8 @@ static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
ScopedValue result(scope, Primitive::undefinedValue());
if (query.prepare(sql)) {
- if (ctx->d()->callData->argc > 1) {
- ScopedValue values(scope, ctx->d()->callData->args[1]);
+ if (ctx->argc() > 1) {
+ ScopedValue values(scope, ctx->args()[1]);
if (values->asArrayObject()) {
ScopedArrayObject array(scope, values);
quint32 size = array->getLength();
@@ -371,18 +371,18 @@ struct TransactionRollback {
static ReturnedValue qmlsqldatabase_changeVersion(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 2)
+ if (ctx->argc() < 2)
return Encode::undefined();
Scope scope(ctx);
- Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject);
+ Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Database)
V4THROW_REFERENCE("Not a SQLDatabase object");
QSqlDatabase db = r->d()->database;
- QString from_version = ctx->d()->callData->args[0].toQString();
- QString to_version = ctx->d()->callData->args[1].toQString();
+ QString from_version = ctx->args()[0].toQString();
+ QString to_version = ctx->args()[1].toQString();
ScopedFunctionObject callback(scope, ctx->argument(2));
if (from_version != r->d()->version)
@@ -429,11 +429,11 @@ static ReturnedValue qmlsqldatabase_changeVersion(CallContext *ctx)
static ReturnedValue qmlsqldatabase_transaction_shared(CallContext *ctx, bool readOnly)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Database)
V4THROW_REFERENCE("Not a SQLDatabase object");
- FunctionObject *callback = ctx->d()->callData->argc ? ctx->d()->callData->args[0].asFunctionObject() : 0;
+ FunctionObject *callback = ctx->argc() ? ctx->args()[0].asFunctionObject() : 0;
if (!callback)
V4THROW_SQL(SQLEXCEPTION_UNKNOWN_ERR, QQmlEngine::tr("transaction: missing callback"));
diff --git a/src/particles/qquickv4particledata.cpp b/src/particles/qquickv4particledata.cpp
index a83c2052fc..c8b262e002 100644
--- a/src/particles/qquickv4particledata.cpp
+++ b/src/particles/qquickv4particledata.cpp
@@ -290,7 +290,7 @@ public:
static QV4::ReturnedValue particleData_discard(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject());
if (!r || !r->d()->datum)
return ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));
@@ -302,7 +302,7 @@ static QV4::ReturnedValue particleData_discard(QV4::CallContext *ctx)
static QV4::ReturnedValue particleData_lifeLeft(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject());
if (!r || !r->d()->datum)
return ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));
@@ -313,7 +313,7 @@ static QV4::ReturnedValue particleData_lifeLeft(QV4::CallContext *ctx)
static QV4::ReturnedValue particleData_curSize(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject());
if (!r || !r->d()->datum)
return ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));
@@ -323,7 +323,7 @@ static QV4::ReturnedValue particleData_curSize(QV4::CallContext *ctx)
#define COLOR_GETTER_AND_SETTER(VAR, NAME) static QV4::ReturnedValue particleData_get_ ## NAME (QV4::CallContext *ctx) \
{ \
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum) \
ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object")); \
\
@@ -333,11 +333,11 @@ static QV4::ReturnedValue particleData_curSize(QV4::CallContext *ctx)
static QV4::ReturnedValue particleData_set_ ## NAME (QV4::CallContext *ctx)\
{\
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum)\
ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));\
\
- double d = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : 0; \
+ double d = ctx->argc() ? ctx->args()[0].toNumber() : 0; \
r->d()->datum->color. VAR = qMin(255, qMax(0, (int)floor(d * 255.0)));\
return QV4::Encode::undefined(); \
}
@@ -346,7 +346,7 @@ static QV4::ReturnedValue particleData_set_ ## NAME (QV4::CallContext *ctx)\
#define SEMIBOOL_GETTER_AND_SETTER(VARIABLE) static QV4::ReturnedValue particleData_get_ ## VARIABLE (QV4::CallContext *ctx) \
{ \
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum) \
ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object")); \
\
@@ -356,18 +356,18 @@ static QV4::ReturnedValue particleData_set_ ## NAME (QV4::CallContext *ctx)\
static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\
{\
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum)\
ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));\
\
- r->d()->datum-> VARIABLE = (ctx->d()->callData->argc && ctx->d()->callData->args[0].toBoolean()) ? 1.0 : 0.0;\
+ r->d()->datum-> VARIABLE = (ctx->argc() && ctx->args()[0].toBoolean()) ? 1.0 : 0.0;\
return QV4::Encode::undefined(); \
}
#define FLOAT_GETTER_AND_SETTER(VARIABLE) static QV4::ReturnedValue particleData_get_ ## VARIABLE (QV4::CallContext *ctx) \
{ \
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum) \
ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object")); \
\
@@ -377,18 +377,18 @@ static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\
static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\
{\
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum)\
ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));\
\
- r->d()->datum-> VARIABLE = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();\
+ r->d()->datum-> VARIABLE = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();\
return QV4::Encode::undefined(); \
}
#define FAKE_FLOAT_GETTER_AND_SETTER(VARIABLE, GETTER, SETTER) static QV4::ReturnedValue particleData_get_ ## VARIABLE (QV4::CallContext *ctx) \
{ \
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum) \
ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object")); \
\
@@ -398,11 +398,11 @@ static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\
static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\
{\
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum)\
ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));\
\
- r->d()->datum-> SETTER (ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN());\
+ r->d()->datum-> SETTER (ctx->argc() ? ctx->args()[0].toNumber() : qSNaN());\
return QV4::Encode::undefined(); \
}
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp
index f48ab9e39d..82a6fd58e2 100644
--- a/src/qml/jsruntime/qv4argumentsobject.cpp
+++ b/src/qml/jsruntime/qv4argumentsobject.cpp
@@ -60,8 +60,8 @@ Heap::ArgumentsObject::ArgumentsObject(QV4::CallContext *context)
args->propertyAt(CallerPropertyIndex)->value = v4->thrower;
args->propertyAt(CallerPropertyIndex)->set = v4->thrower;
- args->arrayReserve(context->d()->callData->argc);
- args->arrayPut(0, context->d()->callData->args, context->d()->callData->argc);
+ args->arrayReserve(context->argc());
+ args->arrayPut(0, context->args(), context->argc());
args->d()->fullyCreated = true;
} else {
Q_ASSERT(CalleePropertyIndex == args->internalClass()->find(context->d()->engine->id_callee));
diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp
index 5d2c95bed4..e288023b80 100644
--- a/src/qml/jsruntime/qv4arraybuffer.cpp
+++ b/src/qml/jsruntime/qv4arraybuffer.cpp
@@ -123,7 +123,7 @@ void ArrayBufferPrototype::init(ExecutionEngine *engine, Object *ctor)
ReturnedValue ArrayBufferPrototype::method_get_byteLength(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<ArrayBuffer> v(scope, ctx->d()->callData->thisObject);
+ Scoped<ArrayBuffer> v(scope, ctx->thisObject());
if (!v)
return scope.engine->throwTypeError();
@@ -133,13 +133,13 @@ ReturnedValue ArrayBufferPrototype::method_get_byteLength(CallContext *ctx)
ReturnedValue ArrayBufferPrototype::method_slice(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<ArrayBuffer> a(scope, ctx->d()->callData->thisObject);
+ Scoped<ArrayBuffer> a(scope, ctx->thisObject());
if (!a)
return scope.engine->throwTypeError();
- double start = ctx->d()->callData->argc > 0 ? ctx->d()->callData->args[0].toInteger() : 0;
- double end = (ctx->d()->callData->argc < 2 || ctx->d()->callData->args[1].isUndefined()) ?
- a->d()->data->size : ctx->d()->callData->args[1].toInteger();
+ double start = ctx->argc() > 0 ? ctx->args()[0].toInteger() : 0;
+ double end = (ctx->argc() < 2 || ctx->args()[1].isUndefined()) ?
+ a->d()->data->size : ctx->args()[1].toInteger();
if (scope.engine->hasException)
return Encode::undefined();
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index 68c289a52d..d3239b6098 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -265,7 +265,7 @@ void SimpleArrayData::setAttribute(Object *o, uint index, PropertyAttributes att
o->arrayData()->attrs[index] = attrs;
}
-void SimpleArrayData::push_front(Object *o, Value *values, uint n)
+void SimpleArrayData::push_front(Object *o, const Value *values, uint n)
{
Heap::SimpleArrayData *dd = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
Q_ASSERT(!dd->attrs);
@@ -484,7 +484,7 @@ void SparseArrayData::setAttribute(Object *o, uint index, PropertyAttributes att
d->attrs[n->value] = attrs;
}
-void SparseArrayData::push_front(Object *o, Value *values, uint n)
+void SparseArrayData::push_front(Object *o, const Value *values, uint n)
{
Heap::SparseArrayData *d = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
Q_ASSERT(!d->attrs);
diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h
index 5ae3883647..7421b7b236 100644
--- a/src/qml/jsruntime/qv4arraydata_p.h
+++ b/src/qml/jsruntime/qv4arraydata_p.h
@@ -65,7 +65,7 @@ struct ArrayVTable
bool (*putArray)(Object *o, uint index, const Value *values, uint n);
bool (*del)(Object *o, uint index);
void (*setAttribute)(Object *o, uint index, PropertyAttributes attrs);
- void (*push_front)(Object *o, Value *values, uint n);
+ void (*push_front)(Object *o, const Value *values, uint n);
ReturnedValue (*pop_front)(Object *o);
uint (*truncate)(Object *o, uint newLen);
uint (*length)(const Heap::ArrayData *d);
@@ -228,7 +228,7 @@ struct Q_QML_EXPORT SimpleArrayData : public ArrayData
static bool putArray(Object *o, uint index, const Value *values, uint n);
static bool del(Object *o, uint index);
static void setAttribute(Object *o, uint index, PropertyAttributes attrs);
- static void push_front(Object *o, Value *values, uint n);
+ static void push_front(Object *o, const Value *values, uint n);
static ReturnedValue pop_front(Object *o);
static uint truncate(Object *o, uint newLen);
static uint length(const Heap::ArrayData *d);
@@ -257,7 +257,7 @@ struct Q_QML_EXPORT SparseArrayData : public ArrayData
static bool putArray(Object *o, uint index, const Value *values, uint n);
static bool del(Object *o, uint index);
static void setAttribute(Object *o, uint index, PropertyAttributes attrs);
- static void push_front(Object *o, Value *values, uint n);
+ static void push_front(Object *o, const Value *values, uint n);
static ReturnedValue pop_front(Object *o);
static uint truncate(Object *o, uint newLen);
static uint length(const Heap::ArrayData *d);
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index 0361d0e628..6b39c4f68e 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -110,21 +110,21 @@ void ArrayPrototype::init(ExecutionEngine *engine, Object *ctor)
ReturnedValue ArrayPrototype::method_isArray(CallContext *ctx)
{
- bool isArray = ctx->d()->callData->argc && ctx->d()->callData->args[0].asArrayObject();
+ bool isArray = ctx->argc() && ctx->args()[0].asArrayObject();
return Encode(isArray);
}
ReturnedValue ArrayPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->d()->callData->thisObject, ScopedObject::Convert);
+ ScopedObject o(scope, ctx->thisObject(), ScopedObject::Convert);
if (ctx->d()->engine->hasException)
return Encode::undefined();
ScopedString s(scope, ctx->d()->engine->newString(QStringLiteral("join")));
ScopedFunctionObject f(scope, o->get(s));
if (!!f) {
ScopedCallData d(scope, 0);
- d->thisObject = ctx->d()->callData->thisObject;
+ d->thisObject = ctx->thisObject();
return f->call(d);
}
return ObjectPrototype::method_toString(ctx);
@@ -140,7 +140,7 @@ ReturnedValue ArrayPrototype::method_concat(CallContext *ctx)
Scope scope(ctx);
ScopedObject result(scope, ctx->d()->engine->newArrayObject());
- ScopedObject thisObject(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject thisObject(scope, ctx->thisObject().toObject(scope.engine));
if (!thisObject)
return Encode::undefined();
if (thisObject->isArrayObject()) {
@@ -152,9 +152,9 @@ ReturnedValue ArrayPrototype::method_concat(CallContext *ctx)
ScopedArrayObject elt(scope);
ScopedObject eltAsObj(scope);
ScopedValue entry(scope);
- for (int i = 0; i < ctx->d()->callData->argc; ++i) {
- eltAsObj = ctx->d()->callData->args[i];
- elt = ctx->d()->callData->args[i];
+ for (int i = 0; i < ctx->argc(); ++i) {
+ eltAsObj = ctx->args()[i];
+ elt = ctx->args()[i];
if (elt) {
uint n = elt->getLength();
uint newLen = ArrayData::append(result, elt, n);
@@ -166,7 +166,7 @@ ReturnedValue ArrayPrototype::method_concat(CallContext *ctx)
result->putIndexed(startIndex + i, entry);
}
} else {
- result->arraySet(result->getLength(), ctx->d()->callData->args[i]);
+ result->arraySet(result->getLength(), ctx->args()[i]);
}
}
@@ -184,7 +184,7 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
else
r4 = arg->toQString();
- ScopedObject self(scope, ctx->d()->callData->thisObject);
+ ScopedObject self(scope, ctx->thisObject());
ScopedValue length(scope, self->get(ctx->d()->engine->id_length));
const quint32 r2 = length->isUndefined() ? 0 : length->toUInt32();
@@ -235,7 +235,7 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
ReturnedValue ArrayPrototype::method_pop(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
@@ -263,7 +263,7 @@ ReturnedValue ArrayPrototype::method_pop(CallContext *ctx)
ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -272,15 +272,15 @@ ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
uint len = instance->getLength();
- if (len + ctx->d()->callData->argc < len) {
+ if (len + ctx->argc() < len) {
// ughh...
double l = len;
ScopedString s(scope);
- for (int i = 0; i < ctx->d()->callData->argc; ++i) {
+ for (int i = 0; i < ctx->argc(); ++i) {
s = Primitive::fromDouble(l + i).toString(scope.engine);
- instance->put(s, ctx->d()->callData->args[i]);
+ instance->put(s, ctx->args()[i]);
}
- double newLen = l + ctx->d()->callData->argc;
+ double newLen = l + ctx->argc();
if (!instance->isArrayObject())
instance->put(ctx->d()->engine->id_length, ScopedValue(scope, Primitive::fromDouble(newLen)));
else {
@@ -290,15 +290,15 @@ ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
return Encode(newLen);
}
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
;
else if (!instance->protoHasArray() && instance->arrayData()->length() <= len && instance->arrayData()->type == Heap::ArrayData::Simple) {
- instance->arrayData()->vtable()->putArray(instance, len, ctx->d()->callData->args, ctx->d()->callData->argc);
+ instance->arrayData()->vtable()->putArray(instance, len, ctx->args(), ctx->argc());
len = instance->arrayData()->length();
} else {
- for (int i = 0; i < ctx->d()->callData->argc; ++i)
- instance->putIndexed(len + i, ctx->d()->callData->args[i]);
- len += ctx->d()->callData->argc;
+ for (int i = 0; i < ctx->argc(); ++i)
+ instance->putIndexed(len + i, ctx->args()[i]);
+ len += ctx->argc();
}
if (instance->isArrayObject())
instance->setArrayLengthUnchecked(len);
@@ -311,7 +311,7 @@ ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
ReturnedValue ArrayPrototype::method_reverse(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint length = instance->getLength();
@@ -343,7 +343,7 @@ ReturnedValue ArrayPrototype::method_reverse(CallContext *ctx)
ReturnedValue ArrayPrototype::method_shift(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -395,7 +395,7 @@ ReturnedValue ArrayPrototype::method_shift(CallContext *ctx)
ReturnedValue ArrayPrototype::method_slice(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject o(scope, ctx->thisObject().toObject(scope.engine));
if (!o)
return Encode::undefined();
@@ -410,8 +410,8 @@ ReturnedValue ArrayPrototype::method_slice(CallContext *ctx)
else
start = (uint) s;
uint end = len;
- if (ctx->d()->callData->argc > 1 && !ctx->d()->callData->args[1].isUndefined()) {
- double e = ctx->d()->callData->args[1].toInteger();
+ if (ctx->argc() > 1 && !ctx->args()[1].isUndefined()) {
+ double e = ctx->args()[1].toInteger();
if (e < 0)
end = (uint)qMax(len + e, 0.);
else if (e > len)
@@ -437,7 +437,7 @@ ReturnedValue ArrayPrototype::method_slice(CallContext *ctx)
ReturnedValue ArrayPrototype::method_sort(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -445,13 +445,13 @@ ReturnedValue ArrayPrototype::method_sort(CallContext *ctx)
ScopedValue comparefn(scope, ctx->argument(0));
ArrayData::sort(scope.engine, instance, comparefn, len);
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
@@ -479,7 +479,7 @@ ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
}
newArray->setArrayLengthUnchecked(deleteCount);
- uint itemCount = ctx->d()->callData->argc < 2 ? 0 : ctx->d()->callData->argc - 2;
+ uint itemCount = ctx->argc() < 2 ? 0 : ctx->argc() - 2;
if (itemCount < deleteCount) {
for (uint k = start; k < len - deleteCount; ++k) {
@@ -517,7 +517,7 @@ ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
}
for (uint i = 0; i < itemCount; ++i) {
- instance->putIndexed(start + i, ctx->d()->callData->args[i + 2]);
+ instance->putIndexed(start + i, ctx->args()[i + 2]);
if (scope.hasException())
return Encode::undefined();
}
@@ -531,7 +531,7 @@ ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
ReturnedValue ArrayPrototype::method_unshift(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -542,22 +542,22 @@ ReturnedValue ArrayPrototype::method_unshift(CallContext *ctx)
if (!instance->protoHasArray() && !instance->arrayData()->attrs && instance->arrayData()->length() <= len &&
instance->arrayData()->type != Heap::ArrayData::Custom) {
- instance->arrayData()->vtable()->push_front(instance, ctx->d()->callData->args, ctx->d()->callData->argc);
+ instance->arrayData()->vtable()->push_front(instance, ctx->args(), ctx->argc());
} else {
ScopedValue v(scope);
for (uint k = len; k > 0; --k) {
bool exists;
v = instance->getIndexed(k - 1, &exists);
if (exists)
- instance->putIndexed(k + ctx->d()->callData->argc - 1, v);
+ instance->putIndexed(k + ctx->argc() - 1, v);
else
- instance->deleteIndexedProperty(k + ctx->d()->callData->argc - 1);
+ instance->deleteIndexedProperty(k + ctx->argc() - 1);
}
- for (int i = 0; i < ctx->d()->callData->argc; ++i)
- instance->putIndexed(i, ctx->d()->callData->args[i]);
+ for (int i = 0; i < ctx->argc(); ++i)
+ instance->putIndexed(i, ctx->args()[i]);
}
- uint newLen = len + ctx->d()->callData->argc;
+ uint newLen = len + ctx->argc();
if (instance->isArrayObject())
instance->setArrayLengthUnchecked(newLen);
else
@@ -570,18 +570,18 @@ ReturnedValue ArrayPrototype::method_indexOf(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
if (!len)
return Encode(-1);
- ScopedValue searchValue(scope, ctx->d()->callData->argument(0));
+ ScopedValue searchValue(scope, ctx->argument(0));
uint fromIndex = 0;
- if (ctx->d()->callData->argc >= 2) {
- double f = ctx->d()->callData->args[1].toInteger();
+ if (ctx->argc() >= 2) {
+ double f = ctx->args()[1].toInteger();
if (scope.hasException())
return Encode::undefined();
if (f >= len)
@@ -639,7 +639,7 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
@@ -649,13 +649,13 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(CallContext *ctx)
ScopedValue searchValue(scope);
uint fromIndex = len;
- if (ctx->d()->callData->argc >= 1)
+ if (ctx->argc() >= 1)
searchValue = ctx->argument(0);
else
searchValue = Primitive::undefinedValue();
- if (ctx->d()->callData->argc >= 2) {
- double f = ctx->d()->callData->args[1].toInteger();
+ if (ctx->argc() >= 2) {
+ double f = ctx->args()[1].toInteger();
if (scope.hasException())
return Encode::undefined();
if (f > 0)
@@ -684,7 +684,7 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(CallContext *ctx)
ReturnedValue ArrayPrototype::method_every(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -718,7 +718,7 @@ ReturnedValue ArrayPrototype::method_every(CallContext *ctx)
ReturnedValue ArrayPrototype::method_some(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -752,7 +752,7 @@ ReturnedValue ArrayPrototype::method_some(CallContext *ctx)
ReturnedValue ArrayPrototype::method_forEach(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -783,7 +783,7 @@ ReturnedValue ArrayPrototype::method_forEach(CallContext *ctx)
ReturnedValue ArrayPrototype::method_map(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -820,7 +820,7 @@ ReturnedValue ArrayPrototype::method_map(CallContext *ctx)
ReturnedValue ArrayPrototype::method_filter(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -861,7 +861,7 @@ ReturnedValue ArrayPrototype::method_filter(CallContext *ctx)
ReturnedValue ArrayPrototype::method_reduce(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -875,7 +875,7 @@ ReturnedValue ArrayPrototype::method_reduce(CallContext *ctx)
ScopedValue acc(scope);
ScopedValue v(scope);
- if (ctx->d()->callData->argc > 1) {
+ if (ctx->argc() > 1) {
acc = ctx->argument(1);
} else {
bool kPresent = false;
@@ -911,7 +911,7 @@ ReturnedValue ArrayPrototype::method_reduce(CallContext *ctx)
ReturnedValue ArrayPrototype::method_reduceRight(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -922,7 +922,7 @@ ReturnedValue ArrayPrototype::method_reduceRight(CallContext *ctx)
return ctx->engine()->throwTypeError();
if (len == 0) {
- if (ctx->d()->callData->argc == 1)
+ if (ctx->argc() == 1)
return ctx->engine()->throwTypeError();
return ctx->argument(1);
}
@@ -930,7 +930,7 @@ ReturnedValue ArrayPrototype::method_reduceRight(CallContext *ctx)
uint k = len;
ScopedValue acc(scope);
ScopedValue v(scope);
- if (ctx->d()->callData->argc > 1) {
+ if (ctx->argc() > 1) {
acc = ctx->argument(1);
} else {
bool kPresent = false;
diff --git a/src/qml/jsruntime/qv4booleanobject.cpp b/src/qml/jsruntime/qv4booleanobject.cpp
index c606e37310..0287945700 100644
--- a/src/qml/jsruntime/qv4booleanobject.cpp
+++ b/src/qml/jsruntime/qv4booleanobject.cpp
@@ -47,8 +47,7 @@ ReturnedValue BooleanCtor::construct(Managed *m, CallData *callData)
{
Scope scope(static_cast<BooleanCtor *>(m)->engine());
bool n = callData->argc ? callData->args[0].toBoolean() : false;
- ScopedValue b(scope, QV4::Primitive::fromBoolean(n));
- return Encode(scope.engine->newBooleanObject(b));
+ return Encode(scope.engine->newBooleanObject(n));
}
ReturnedValue BooleanCtor::call(Managed *, CallData *callData)
@@ -71,14 +70,13 @@ void BooleanPrototype::init(ExecutionEngine *engine, Object *ctor)
ReturnedValue BooleanPrototype::method_toString(CallContext *ctx)
{
bool result;
- if (ctx->d()->callData->thisObject.isBoolean()) {
- result = ctx->d()->callData->thisObject.booleanValue();
+ if (ctx->thisObject().isBoolean()) {
+ result = ctx->thisObject().booleanValue();
} else {
- Scope scope(ctx);
- Scoped<BooleanObject> thisObject(scope, ctx->d()->callData->thisObject);
+ BooleanObject *thisObject = ctx->thisObject().as<BooleanObject>();
if (!thisObject)
return ctx->engine()->throwTypeError();
- result = thisObject->value().booleanValue();
+ result = thisObject->value();
}
return Encode(ctx->d()->engine->newString(QLatin1String(result ? "true" : "false")));
@@ -86,13 +84,12 @@ ReturnedValue BooleanPrototype::method_toString(CallContext *ctx)
ReturnedValue BooleanPrototype::method_valueOf(CallContext *ctx)
{
- if (ctx->d()->callData->thisObject.isBoolean())
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->thisObject().isBoolean())
+ return ctx->thisObject().asReturnedValue();
- Scope scope(ctx);
- Scoped<BooleanObject> thisObject(scope, ctx->d()->callData->thisObject);
+ BooleanObject *thisObject = ctx->thisObject().as<BooleanObject>();
if (!thisObject)
return ctx->engine()->throwTypeError();
- return thisObject->value().asReturnedValue();
+ return Encode(thisObject->value());
}
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 27d32bbcd3..8c637472a7 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -246,7 +246,7 @@ bool ExecutionContext::deleteProperty(String *name)
bool CallContext::needsOwnArguments() const
{
- return d()->function->needsActivation() || d()->callData->argc < static_cast<int>(d()->function->formalParameterCount());
+ return d()->function->needsActivation() || argc() < static_cast<int>(d()->function->formalParameterCount());
}
void ExecutionContext::markObjects(Heap::Base *m, ExecutionEngine *engine)
@@ -346,7 +346,7 @@ ReturnedValue ExecutionContext::getProperty(String *name)
name->makeIdentifier(scope.engine);
if (name->equals(d()->engine->id_this))
- return d()->callData->thisObject.asReturnedValue();
+ return thisObject().asReturnedValue();
bool hasWith = false;
bool hasCatchScope = false;
@@ -413,7 +413,7 @@ ReturnedValue ExecutionContext::getPropertyAndBase(String *name, Heap::Object **
name->makeIdentifier(scope.engine);
if (name->equals(d()->engine->id_this))
- return d()->callData->thisObject.asReturnedValue();
+ return thisObject().asReturnedValue();
bool hasWith = false;
bool hasCatchScope = false;
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 4d27b0456c..1431c5ac82 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -162,6 +162,19 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
Heap::FunctionObject *getFunctionObject() const;
static void markObjects(Heap::Base *m, ExecutionEngine *e);
+
+ const Value &thisObject() const {
+ return d()->callData->thisObject;
+ }
+ int argc() const {
+ return d()->callData->argc;
+ }
+ const Value *args() const {
+ return d()->callData->args;
+ }
+ ReturnedValue argument(int i) const {
+ return d()->callData->argument(i);
+ }
};
struct CallContext : public ExecutionContext
@@ -179,7 +192,7 @@ struct CallContext : public ExecutionContext
};
inline ReturnedValue CallContext::argument(int i) {
- return i < d()->callData->argc ? d()->callData->args[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue();
+ return i < argc() ? args()[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue();
}
struct GlobalContext : public ExecutionContext
diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp
index 55a41a7c6c..09d4db59af 100644
--- a/src/qml/jsruntime/qv4dataview.cpp
+++ b/src/qml/jsruntime/qv4dataview.cpp
@@ -123,7 +123,7 @@ void DataViewPrototype::init(ExecutionEngine *engine, Object *ctor)
ReturnedValue DataViewPrototype::method_get_buffer(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
+ Scoped<DataView> v(scope, ctx->thisObject());
if (!v)
return scope.engine->throwTypeError();
@@ -133,7 +133,7 @@ ReturnedValue DataViewPrototype::method_get_buffer(CallContext *ctx)
ReturnedValue DataViewPrototype::method_get_byteLength(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
+ Scoped<DataView> v(scope, ctx->thisObject());
if (!v)
return scope.engine->throwTypeError();
@@ -143,7 +143,7 @@ ReturnedValue DataViewPrototype::method_get_byteLength(CallContext *ctx)
ReturnedValue DataViewPrototype::method_get_byteOffset(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
+ Scoped<DataView> v(scope, ctx->thisObject());
if (!v)
return scope.engine->throwTypeError();
@@ -154,10 +154,10 @@ template <typename T>
ReturnedValue DataViewPrototype::method_getChar(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
- if (!v || ctx->d()->callData->argc < 1)
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
return scope.engine->throwTypeError();
- double l = ctx->d()->callData->args[0].toNumber();
+ double l = ctx->args()[0].toNumber();
uint idx = (uint)l;
if (l != idx || idx + sizeof(T) > v->d()->byteLength)
return scope.engine->throwTypeError();
@@ -172,16 +172,16 @@ template <typename T>
ReturnedValue DataViewPrototype::method_get(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
- if (!v || ctx->d()->callData->argc < 1)
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
return scope.engine->throwTypeError();
- double l = ctx->d()->callData->args[0].toNumber();
+ double l = ctx->args()[0].toNumber();
uint idx = (uint)l;
if (l != idx || idx + sizeof(T) > v->d()->byteLength)
return scope.engine->throwTypeError();
idx += v->d()->byteOffset;
- bool littleEndian = ctx->d()->callData->argc < 2 ? false : ctx->d()->callData->args[1].toBoolean();
+ bool littleEndian = ctx->argc() < 2 ? false : ctx->args()[1].toBoolean();
T t = littleEndian
? qFromLittleEndian<T>((uchar *)v->d()->buffer->data->data() + idx)
@@ -194,16 +194,16 @@ template <typename T>
ReturnedValue DataViewPrototype::method_getFloat(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
- if (!v || ctx->d()->callData->argc < 1)
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
return scope.engine->throwTypeError();
- double l = ctx->d()->callData->args[0].toNumber();
+ double l = ctx->args()[0].toNumber();
uint idx = (uint)l;
if (l != idx || idx + sizeof(T) > v->d()->byteLength)
return scope.engine->throwTypeError();
idx += v->d()->byteOffset;
- bool littleEndian = ctx->d()->callData->argc < 2 ? false : ctx->d()->callData->args[1].toBoolean();
+ bool littleEndian = ctx->argc() < 2 ? false : ctx->args()[1].toBoolean();
if (sizeof(T) == 4) {
// float
@@ -232,16 +232,16 @@ template <typename T>
ReturnedValue DataViewPrototype::method_setChar(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
- if (!v || ctx->d()->callData->argc < 1)
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
return scope.engine->throwTypeError();
- double l = ctx->d()->callData->args[0].toNumber();
+ double l = ctx->args()[0].toNumber();
uint idx = (uint)l;
if (l != idx || idx + sizeof(T) > v->d()->byteLength)
return scope.engine->throwTypeError();
idx += v->d()->byteOffset;
- int val = ctx->d()->callData->argc >= 2 ? ctx->d()->callData->args[1].toInt32() : 0;
+ int val = ctx->argc() >= 2 ? ctx->args()[1].toInt32() : 0;
v->d()->buffer->data->data()[idx] = (char)val;
return Encode::undefined();
@@ -251,18 +251,18 @@ template <typename T>
ReturnedValue DataViewPrototype::method_set(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
- if (!v || ctx->d()->callData->argc < 1)
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
return scope.engine->throwTypeError();
- double l = ctx->d()->callData->args[0].toNumber();
+ double l = ctx->args()[0].toNumber();
uint idx = (uint)l;
if (l != idx || idx + sizeof(T) > v->d()->byteLength)
return scope.engine->throwTypeError();
idx += v->d()->byteOffset;
- int val = ctx->d()->callData->argc >= 2 ? ctx->d()->callData->args[1].toInt32() : 0;
+ int val = ctx->argc() >= 2 ? ctx->args()[1].toInt32() : 0;
- bool littleEndian = ctx->d()->callData->argc < 3 ? false : ctx->d()->callData->args[2].toBoolean();
+ bool littleEndian = ctx->argc() < 3 ? false : ctx->args()[2].toBoolean();
if (littleEndian)
qToLittleEndian<T>(val, (uchar *)v->d()->buffer->data->data() + idx);
@@ -276,17 +276,17 @@ template <typename T>
ReturnedValue DataViewPrototype::method_setFloat(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
- if (!v || ctx->d()->callData->argc < 1)
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
return scope.engine->throwTypeError();
- double l = ctx->d()->callData->args[0].toNumber();
+ double l = ctx->args()[0].toNumber();
uint idx = (uint)l;
if (l != idx || idx + sizeof(T) > v->d()->byteLength)
return scope.engine->throwTypeError();
idx += v->d()->byteOffset;
- double val = ctx->d()->callData->argc >= 2 ? ctx->d()->callData->args[1].toNumber() : qSNaN();
- bool littleEndian = ctx->d()->callData->argc < 3 ? false : ctx->d()->callData->args[2].toBoolean();
+ double val = ctx->argc() >= 2 ? ctx->args()[1].toNumber() : qSNaN();
+ bool littleEndian = ctx->argc() < 3 ? false : ctx->args()[2].toBoolean();
if (sizeof(T) == 4) {
// float
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index 423c36963f..d11118ee88 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -755,7 +755,7 @@ void DatePrototype::init(ExecutionEngine *engine, Object *ctor)
double DatePrototype::getThisDate(ExecutionContext *ctx)
{
- if (DateObject *thisObject = ctx->d()->callData->thisObject.asDateObject())
+ if (DateObject *thisObject = ctx->thisObject().asDateObject())
return thisObject->date().asDouble();
else {
ctx->engine()->throwTypeError();
@@ -765,22 +765,22 @@ double DatePrototype::getThisDate(ExecutionContext *ctx)
ReturnedValue DatePrototype::method_parse(CallContext *ctx)
{
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
return Encode(qSNaN());
- return Encode(ParseString(ctx->d()->callData->args[0].toQString()));
+ return Encode(ParseString(ctx->args()[0].toQString()));
}
ReturnedValue DatePrototype::method_UTC(CallContext *ctx)
{
- const int numArgs = ctx->d()->callData->argc;
+ const int numArgs = ctx->argc();
if (numArgs >= 2) {
- double year = ctx->d()->callData->args[0].toNumber();
- double month = ctx->d()->callData->args[1].toNumber();
- double day = numArgs >= 3 ? ctx->d()->callData->args[2].toNumber() : 1;
- double hours = numArgs >= 4 ? ctx->d()->callData->args[3].toNumber() : 0;
- double mins = numArgs >= 5 ? ctx->d()->callData->args[4].toNumber() : 0;
- double secs = numArgs >= 6 ? ctx->d()->callData->args[5].toNumber() : 0;
- double ms = numArgs >= 7 ? ctx->d()->callData->args[6].toNumber() : 0;
+ double year = ctx->args()[0].toNumber();
+ double month = ctx->args()[1].toNumber();
+ double day = numArgs >= 3 ? ctx->args()[2].toNumber() : 1;
+ double hours = numArgs >= 4 ? ctx->args()[3].toNumber() : 0;
+ double mins = numArgs >= 5 ? ctx->args()[4].toNumber() : 0;
+ double secs = numArgs >= 6 ? ctx->args()[5].toNumber() : 0;
+ double ms = numArgs >= 7 ? ctx->args()[6].toNumber() : 0;
if (year >= 0 && year <= 99)
year += 1900;
double t = MakeDate(MakeDay(year, month, day),
@@ -992,11 +992,11 @@ ReturnedValue DatePrototype::method_getTimezoneOffset(CallContext *ctx)
ReturnedValue DatePrototype::method_setTime(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DateObject> self(scope, ctx->d()->callData->thisObject);
+ Scoped<DateObject> self(scope, ctx->thisObject());
if (!self)
return ctx->engine()->throwTypeError();
- double t = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double t = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
self->date().setDouble(TimeClip(t));
return self->date().asReturnedValue();
}
@@ -1004,37 +1004,37 @@ ReturnedValue DatePrototype::method_setTime(CallContext *ctx)
ReturnedValue DatePrototype::method_setMilliseconds(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DateObject> self(scope, ctx->d()->callData->thisObject);
+ Scoped<DateObject> self(scope, ctx->thisObject());
if (!self)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double ms = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double ms = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
self->date().setDouble(TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms)))));
return self->date().asReturnedValue();
}
ReturnedValue DatePrototype::method_setUTCMilliseconds(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double ms = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double ms = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
self->date().setDouble(TimeClip(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms))));
return self->date().asReturnedValue();
}
ReturnedValue DatePrototype::method_setSeconds(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double sec = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double ms = (ctx->d()->callData->argc < 2) ? msFromTime(t) : ctx->d()->callData->args[1].toNumber();
+ double sec = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double ms = (ctx->argc() < 2) ? msFromTime(t) : ctx->args()[1].toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), sec, ms))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1042,13 +1042,13 @@ ReturnedValue DatePrototype::method_setSeconds(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCSeconds(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double sec = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double ms = (ctx->d()->callData->argc < 2) ? msFromTime(t) : ctx->d()->callData->args[1].toNumber();
+ double sec = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double ms = (ctx->argc() < 2) ? msFromTime(t) : ctx->args()[1].toNumber();
t = TimeClip(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), sec, ms)));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1056,14 +1056,14 @@ ReturnedValue DatePrototype::method_setUTCSeconds(CallContext *ctx)
ReturnedValue DatePrototype::method_setMinutes(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double min = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double sec = (ctx->d()->callData->argc < 2) ? SecFromTime(t) : ctx->d()->callData->args[1].toNumber();
- double ms = (ctx->d()->callData->argc < 3) ? msFromTime(t) : ctx->d()->callData->args[2].toNumber();
+ double min = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double sec = (ctx->argc() < 2) ? SecFromTime(t) : ctx->args()[1].toNumber();
+ double ms = (ctx->argc() < 3) ? msFromTime(t) : ctx->args()[2].toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), min, sec, ms))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1071,14 +1071,14 @@ ReturnedValue DatePrototype::method_setMinutes(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCMinutes(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double min = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double sec = (ctx->d()->callData->argc < 2) ? SecFromTime(t) : ctx->d()->callData->args[1].toNumber();
- double ms = (ctx->d()->callData->argc < 3) ? msFromTime(t) : ctx->d()->callData->args[2].toNumber();
+ double min = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double sec = (ctx->argc() < 2) ? SecFromTime(t) : ctx->args()[1].toNumber();
+ double ms = (ctx->argc() < 3) ? msFromTime(t) : ctx->args()[2].toNumber();
t = TimeClip(MakeDate(Day(t), MakeTime(HourFromTime(t), min, sec, ms)));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1086,15 +1086,15 @@ ReturnedValue DatePrototype::method_setUTCMinutes(CallContext *ctx)
ReturnedValue DatePrototype::method_setHours(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double hour = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double min = (ctx->d()->callData->argc < 2) ? MinFromTime(t) : ctx->d()->callData->args[1].toNumber();
- double sec = (ctx->d()->callData->argc < 3) ? SecFromTime(t) : ctx->d()->callData->args[2].toNumber();
- double ms = (ctx->d()->callData->argc < 4) ? msFromTime(t) : ctx->d()->callData->args[3].toNumber();
+ double hour = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double min = (ctx->argc() < 2) ? MinFromTime(t) : ctx->args()[1].toNumber();
+ double sec = (ctx->argc() < 3) ? SecFromTime(t) : ctx->args()[2].toNumber();
+ double ms = (ctx->argc() < 4) ? msFromTime(t) : ctx->args()[3].toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(hour, min, sec, ms))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1102,15 +1102,15 @@ ReturnedValue DatePrototype::method_setHours(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCHours(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double hour = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double min = (ctx->d()->callData->argc < 2) ? MinFromTime(t) : ctx->d()->callData->args[1].toNumber();
- double sec = (ctx->d()->callData->argc < 3) ? SecFromTime(t) : ctx->d()->callData->args[2].toNumber();
- double ms = (ctx->d()->callData->argc < 4) ? msFromTime(t) : ctx->d()->callData->args[3].toNumber();
+ double hour = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double min = (ctx->argc() < 2) ? MinFromTime(t) : ctx->args()[1].toNumber();
+ double sec = (ctx->argc() < 3) ? SecFromTime(t) : ctx->args()[2].toNumber();
+ double ms = (ctx->argc() < 4) ? msFromTime(t) : ctx->args()[3].toNumber();
t = TimeClip(MakeDate(Day(t), MakeTime(hour, min, sec, ms)));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1118,12 +1118,12 @@ ReturnedValue DatePrototype::method_setUTCHours(CallContext *ctx)
ReturnedValue DatePrototype::method_setDate(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double date = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double date = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), date), TimeWithinDay(t))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1131,12 +1131,12 @@ ReturnedValue DatePrototype::method_setDate(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCDate(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double date = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double date = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
t = TimeClip(MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), date), TimeWithinDay(t)));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1144,13 +1144,13 @@ ReturnedValue DatePrototype::method_setUTCDate(CallContext *ctx)
ReturnedValue DatePrototype::method_setMonth(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double month = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double date = (ctx->d()->callData->argc < 2) ? DateFromTime(t) : ctx->d()->callData->args[1].toNumber();
+ double month = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double date = (ctx->argc() < 2) ? DateFromTime(t) : ctx->args()[1].toNumber();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), month, date), TimeWithinDay(t))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1158,13 +1158,13 @@ ReturnedValue DatePrototype::method_setMonth(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCMonth(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double month = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double date = (ctx->d()->callData->argc < 2) ? DateFromTime(t) : ctx->d()->callData->args[1].toNumber();
+ double month = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double date = (ctx->argc() < 2) ? DateFromTime(t) : ctx->args()[1].toNumber();
t = TimeClip(MakeDate(MakeDay(YearFromTime(t), month, date), TimeWithinDay(t)));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1172,7 +1172,7 @@ ReturnedValue DatePrototype::method_setUTCMonth(CallContext *ctx)
ReturnedValue DatePrototype::method_setYear(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
@@ -1181,7 +1181,7 @@ ReturnedValue DatePrototype::method_setYear(CallContext *ctx)
t = 0;
else
t = LocalTime(t);
- double year = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double year = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
double r;
if (std::isnan(year)) {
r = qSNaN();
@@ -1198,14 +1198,14 @@ ReturnedValue DatePrototype::method_setYear(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCFullYear(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double year = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double month = (ctx->d()->callData->argc < 2) ? MonthFromTime(t) : ctx->d()->callData->args[1].toNumber();
- double date = (ctx->d()->callData->argc < 3) ? DateFromTime(t) : ctx->d()->callData->args[2].toNumber();
+ double year = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double month = (ctx->argc() < 2) ? MonthFromTime(t) : ctx->args()[1].toNumber();
+ double date = (ctx->argc() < 3) ? DateFromTime(t) : ctx->args()[2].toNumber();
t = TimeClip(MakeDate(MakeDay(year, month, date), TimeWithinDay(t)));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1213,16 +1213,16 @@ ReturnedValue DatePrototype::method_setUTCFullYear(CallContext *ctx)
ReturnedValue DatePrototype::method_setFullYear(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
if (std::isnan(t))
t = 0;
- double year = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double month = (ctx->d()->callData->argc < 2) ? MonthFromTime(t) : ctx->d()->callData->args[1].toNumber();
- double date = (ctx->d()->callData->argc < 3) ? DateFromTime(t) : ctx->d()->callData->args[2].toNumber();
+ double year = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double month = (ctx->argc() < 2) ? MonthFromTime(t) : ctx->args()[1].toNumber();
+ double date = (ctx->argc() < 3) ? DateFromTime(t) : ctx->args()[2].toNumber();
t = TimeClip(UTC(MakeDate(MakeDay(year, month, date), TimeWithinDay(t))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1230,7 +1230,7 @@ ReturnedValue DatePrototype::method_setFullYear(CallContext *ctx)
ReturnedValue DatePrototype::method_toUTCString(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
@@ -1253,13 +1253,13 @@ static void addZeroPrefixedInt(QString &str, int num, int nDigits)
ReturnedValue DatePrototype::method_toISOString(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
if (!std::isfinite(t))
- return ctx->engine()->throwRangeError(ctx->d()->callData->thisObject);
+ return ctx->engine()->throwRangeError(ctx->thisObject());
QString result;
int year = (int)YearFromTime(t);
@@ -1292,7 +1292,7 @@ ReturnedValue DatePrototype::method_toISOString(CallContext *ctx)
ReturnedValue DatePrototype::method_toJSON(CallContext *ctx)
{
Scope scope(ctx);
- ScopedValue O(scope, RuntimeHelpers::toObject(scope.engine, ctx->d()->callData->thisObject));
+ ScopedValue O(scope, RuntimeHelpers::toObject(scope.engine, ctx->thisObject()));
ScopedValue tv(scope, RuntimeHelpers::toPrimitive(O, NUMBER_HINT));
if (tv->isNumber() && !std::isfinite(tv->toNumber()))
@@ -1306,7 +1306,7 @@ ReturnedValue DatePrototype::method_toJSON(CallContext *ctx)
return ctx->engine()->throwTypeError();
ScopedCallData callData(scope);
- callData->thisObject = ctx->d()->callData->thisObject;
+ callData->thisObject = ctx->thisObject();
return toIso->call(callData);
}
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 49d77863df..9579f3ddb1 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -547,10 +547,10 @@ Heap::Object *ExecutionEngine::newNumberObject(const Value &value)
return object->d();
}
-Heap::Object *ExecutionEngine::newBooleanObject(const Value &value)
+Heap::Object *ExecutionEngine::newBooleanObject(bool b)
{
Scope scope(this);
- ScopedObject object(scope, memoryManager->alloc<BooleanObject>(this, value));
+ ScopedObject object(scope, memoryManager->alloc<BooleanObject>(this, b));
return object->d();
}
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index e482aeffa9..124f4e8e24 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -262,7 +262,7 @@ public:
Heap::Object *newStringObject(const Value &value);
Heap::Object *newNumberObject(const Value &value);
- Heap::Object *newBooleanObject(const Value &value);
+ Heap::Object *newBooleanObject(bool b);
Heap::ArrayObject *newArrayObject(int count = 0);
Heap::ArrayObject *newArrayObject(const QStringList &list);
diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp
index bdbec790ca..09aa41db61 100644
--- a/src/qml/jsruntime/qv4errorobject.cpp
+++ b/src/qml/jsruntime/qv4errorobject.cpp
@@ -148,7 +148,7 @@ Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype, const
ReturnedValue ErrorObject::method_get_stack(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<ErrorObject> This(scope, ctx->d()->callData->thisObject);
+ Scoped<ErrorObject> This(scope, ctx->thisObject());
if (!This)
return ctx->engine()->throwTypeError();
if (!This->d()->stack) {
@@ -355,7 +355,7 @@ ReturnedValue ErrorPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- Object *o = ctx->d()->callData->thisObject.asObject();
+ Object *o = ctx->thisObject().asObject();
if (!o)
return ctx->engine()->throwTypeError();
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 1ead3b747f..63efb4f9f6 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -300,7 +300,7 @@ void FunctionPrototype::init(ExecutionEngine *engine, Object *ctor)
ReturnedValue FunctionPrototype::method_toString(CallContext *ctx)
{
- FunctionObject *fun = ctx->d()->callData->thisObject.asFunctionObject();
+ FunctionObject *fun = ctx->thisObject().asFunctionObject();
if (!fun)
return ctx->engine()->throwTypeError();
@@ -310,7 +310,7 @@ ReturnedValue FunctionPrototype::method_toString(CallContext *ctx)
ReturnedValue FunctionPrototype::method_apply(CallContext *ctx)
{
Scope scope(ctx);
- ScopedFunctionObject o(scope, ctx->d()->callData->thisObject.asFunctionObject());
+ ScopedFunctionObject o(scope, ctx->thisObject().asFunctionObject());
if (!o)
return ctx->engine()->throwTypeError();
@@ -352,14 +352,14 @@ ReturnedValue FunctionPrototype::method_call(CallContext *ctx)
{
Scope scope(ctx);
- ScopedFunctionObject o(scope, ctx->d()->callData->thisObject.asFunctionObject());
+ ScopedFunctionObject o(scope, ctx->thisObject().asFunctionObject());
if (!o)
return ctx->engine()->throwTypeError();
- ScopedCallData callData(scope, ctx->d()->callData->argc ? ctx->d()->callData->argc - 1 : 0);
- if (ctx->d()->callData->argc) {
- for (int i = 1; i < ctx->d()->callData->argc; ++i)
- callData->args[i - 1] = ctx->d()->callData->args[i];
+ ScopedCallData callData(scope, ctx->argc() ? ctx->argc() - 1 : 0);
+ if (ctx->argc()) {
+ for (int i = 1; i < ctx->argc(); ++i)
+ callData->args[i - 1] = ctx->args()[i];
}
callData->thisObject = ctx->argument(0);
return o->call(callData);
@@ -368,16 +368,16 @@ ReturnedValue FunctionPrototype::method_call(CallContext *ctx)
ReturnedValue FunctionPrototype::method_bind(CallContext *ctx)
{
Scope scope(ctx);
- ScopedFunctionObject target(scope, ctx->d()->callData->thisObject);
+ ScopedFunctionObject target(scope, ctx->thisObject());
if (!target)
return ctx->engine()->throwTypeError();
ScopedValue boundThis(scope, ctx->argument(0));
Scoped<MemberData> boundArgs(scope, (Heap::MemberData *)0);
- if (ctx->d()->callData->argc > 1) {
- boundArgs = MemberData::reallocate(scope.engine, 0, ctx->d()->callData->argc - 1);
- boundArgs->d()->size = ctx->d()->callData->argc - 1;
- memcpy(boundArgs->data(), ctx->d()->callData->args + 1, (ctx->d()->callData->argc - 1)*sizeof(Value));
+ if (ctx->argc() > 1) {
+ boundArgs = MemberData::reallocate(scope.engine, 0, ctx->argc() - 1);
+ boundArgs->d()->size = ctx->argc() - 1;
+ memcpy(boundArgs->data(), ctx->args() + 1, (ctx->argc() - 1)*sizeof(Value));
}
ScopedContext global(scope, scope.engine->rootContext());
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index 823eeda76d..b5b09afc36 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -385,7 +385,7 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
if (function->isStrict() || (ctx->d()->strictMode)) {
ScopedFunctionObject e(scope, FunctionObject::createScriptFunction(ctx, function));
ScopedCallData callData(scope, 0);
- callData->thisObject = ctx->d()->callData->thisObject;
+ callData->thisObject = ctx->thisObject();
return e->call(callData);
}
@@ -537,38 +537,38 @@ ReturnedValue GlobalFunctions::method_parseFloat(CallContext *ctx)
/// isNaN [15.1.2.4]
ReturnedValue GlobalFunctions::method_isNaN(CallContext *ctx)
{
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
// undefined gets converted to NaN
return Encode(true);
- if (ctx->d()->callData->args[0].integerCompatible())
+ if (ctx->args()[0].integerCompatible())
return Encode(false);
- double d = ctx->d()->callData->args[0].toNumber();
+ double d = ctx->args()[0].toNumber();
return Encode((bool)std::isnan(d));
}
/// isFinite [15.1.2.5]
ReturnedValue GlobalFunctions::method_isFinite(CallContext *ctx)
{
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
// undefined gets converted to NaN
return Encode(false);
- if (ctx->d()->callData->args[0].integerCompatible())
+ if (ctx->args()[0].integerCompatible())
return Encode(true);
- double d = ctx->d()->callData->args[0].toNumber();
+ double d = ctx->args()[0].toNumber();
return Encode((bool)std::isfinite(d));
}
/// decodeURI [15.1.3.1]
ReturnedValue GlobalFunctions::method_decodeURI(CallContext *context)
{
- if (context->d()->callData->argc == 0)
+ if (context->argc() == 0)
return Encode::undefined();
- QString uriString = context->d()->callData->args[0].toQString();
+ QString uriString = context->args()[0].toQString();
bool ok;
QString out = decode(uriString, DecodeNonReserved, &ok);
if (!ok) {
@@ -583,10 +583,10 @@ ReturnedValue GlobalFunctions::method_decodeURI(CallContext *context)
/// decodeURIComponent [15.1.3.2]
ReturnedValue GlobalFunctions::method_decodeURIComponent(CallContext *context)
{
- if (context->d()->callData->argc == 0)
+ if (context->argc() == 0)
return Encode::undefined();
- QString uriString = context->d()->callData->args[0].toQString();
+ QString uriString = context->args()[0].toQString();
bool ok;
QString out = decode(uriString, DecodeAll, &ok);
if (!ok) {
@@ -601,10 +601,10 @@ ReturnedValue GlobalFunctions::method_decodeURIComponent(CallContext *context)
/// encodeURI [15.1.3.3]
ReturnedValue GlobalFunctions::method_encodeURI(CallContext *context)
{
- if (context->d()->callData->argc == 0)
+ if (context->argc() == 0)
return Encode::undefined();
- QString uriString = context->d()->callData->args[0].toQString();
+ QString uriString = context->args()[0].toQString();
bool ok;
QString out = encode(uriString, uriUnescapedReserved, &ok);
if (!ok) {
@@ -619,10 +619,10 @@ ReturnedValue GlobalFunctions::method_encodeURI(CallContext *context)
/// encodeURIComponent [15.1.3.4]
ReturnedValue GlobalFunctions::method_encodeURIComponent(CallContext *context)
{
- if (context->d()->callData->argc == 0)
+ if (context->argc() == 0)
return Encode::undefined();
- QString uriString = context->d()->callData->args[0].toQString();
+ QString uriString = context->args()[0].toQString();
bool ok;
QString out = encode(uriString, uriUnescaped, &ok);
if (!ok) {
@@ -636,18 +636,18 @@ ReturnedValue GlobalFunctions::method_encodeURIComponent(CallContext *context)
ReturnedValue GlobalFunctions::method_escape(CallContext *context)
{
- if (!context->d()->callData->argc)
+ if (!context->argc())
return context->d()->engine->newString(QStringLiteral("undefined"))->asReturnedValue();
- QString str = context->d()->callData->args[0].toQString();
+ QString str = context->args()[0].toQString();
return context->d()->engine->newString(escape(str))->asReturnedValue();
}
ReturnedValue GlobalFunctions::method_unescape(CallContext *context)
{
- if (!context->d()->callData->argc)
+ if (!context->argc())
return context->d()->engine->newString(QStringLiteral("undefined"))->asReturnedValue();
- QString str = context->d()->callData->args[0].toQString();
+ QString str = context->args()[0].toQString();
return context->d()->engine->newString(unescape(str))->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp
index 814e6fbfe8..b74728da20 100644
--- a/src/qml/jsruntime/qv4include.cpp
+++ b/src/qml/jsruntime/qv4include.cpp
@@ -172,7 +172,7 @@ void QV4Include::finished()
*/
QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx)
{
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
return QV4::Encode::undefined();
QV4::Scope scope(ctx->engine());
@@ -181,11 +181,11 @@ QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx)
if (!context || !context->isJSContext)
V4THROW_ERROR("Qt.include(): Can only be called from JavaScript files");
- QUrl url(scope.engine->resolvedUrl(ctx->d()->callData->args[0].toQStringNoThrow()));
+ QUrl url(scope.engine->resolvedUrl(ctx->args()[0].toQStringNoThrow()));
QV4::ScopedValue callbackFunction(scope, QV4::Primitive::undefinedValue());
- if (ctx->d()->callData->argc >= 2 && ctx->d()->callData->args[1].asFunctionObject())
- callbackFunction = ctx->d()->callData->args[1];
+ if (ctx->argc() >= 2 && ctx->args()[1].asFunctionObject())
+ callbackFunction = ctx->args()[1];
QString localFile = QQmlFile::urlToLocalFileOrQrc(url);
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index b0b50499d5..88097b212a 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -96,15 +96,15 @@ static double copySign(double x, double y)
ReturnedValue MathObject::method_abs(CallContext *context)
{
- if (!context->d()->callData->argc)
+ if (!context->argc())
return Encode(qSNaN());
- if (context->d()->callData->args[0].isInteger()) {
- int i = context->d()->callData->args[0].integerValue();
+ if (context->args()[0].isInteger()) {
+ int i = context->args()[0].integerValue();
return Encode(i < 0 ? - i : i);
}
- double v = context->d()->callData->args[0].toNumber();
+ double v = context->args()[0].toNumber();
if (v == 0) // 0 | -0
return Encode(0);
@@ -113,7 +113,7 @@ ReturnedValue MathObject::method_abs(CallContext *context)
ReturnedValue MathObject::method_acos(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : 2;
+ double v = context->argc() ? context->args()[0].toNumber() : 2;
if (v > 1)
return Encode(qSNaN());
@@ -122,7 +122,7 @@ ReturnedValue MathObject::method_acos(CallContext *context)
ReturnedValue MathObject::method_asin(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : 2;
+ double v = context->argc() ? context->args()[0].toNumber() : 2;
if (v > 1)
return Encode(qSNaN());
else
@@ -131,7 +131,7 @@ ReturnedValue MathObject::method_asin(CallContext *context)
ReturnedValue MathObject::method_atan(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
if (v == 0.0)
return Encode(v);
else
@@ -140,8 +140,8 @@ ReturnedValue MathObject::method_atan(CallContext *context)
ReturnedValue MathObject::method_atan2(CallContext *context)
{
- double v1 = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
- double v2 = context->d()->callData->argc > 1 ? context->d()->callData->args[1].toNumber() : qSNaN();
+ double v1 = context->argc() ? context->args()[0].toNumber() : qSNaN();
+ double v2 = context->argc() > 1 ? context->args()[1].toNumber() : qSNaN();
if ((v1 < 0) && qIsFinite(v1) && qIsInf(v2) && (copySign(1.0, v2) == 1.0))
return Encode(copySign(0, -1.0));
@@ -158,7 +158,7 @@ ReturnedValue MathObject::method_atan2(CallContext *context)
ReturnedValue MathObject::method_ceil(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
if (v < 0.0 && v > -1.0)
return Encode(copySign(0, -1.0));
else
@@ -167,13 +167,13 @@ ReturnedValue MathObject::method_ceil(CallContext *context)
ReturnedValue MathObject::method_cos(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
return Encode(::cos(v));
}
ReturnedValue MathObject::method_exp(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
if (qIsInf(v)) {
if (copySign(1.0, v) == -1.0)
return Encode(0);
@@ -186,13 +186,13 @@ ReturnedValue MathObject::method_exp(CallContext *context)
ReturnedValue MathObject::method_floor(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
return Encode(::floor(v));
}
ReturnedValue MathObject::method_log(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
if (v < 0)
return Encode(qSNaN());
else
@@ -202,8 +202,8 @@ ReturnedValue MathObject::method_log(CallContext *context)
ReturnedValue MathObject::method_max(CallContext *context)
{
double mx = -qInf();
- for (int i = 0; i < context->d()->callData->argc; ++i) {
- double x = context->d()->callData->args[i].toNumber();
+ for (int i = 0; i < context->argc(); ++i) {
+ double x = context->args()[i].toNumber();
if (x > mx || std::isnan(x))
mx = x;
}
@@ -213,8 +213,8 @@ ReturnedValue MathObject::method_max(CallContext *context)
ReturnedValue MathObject::method_min(CallContext *context)
{
double mx = qInf();
- for (int i = 0; i < context->d()->callData->argc; ++i) {
- double x = context->d()->callData->args[i].toNumber();
+ for (int i = 0; i < context->argc(); ++i) {
+ double x = context->args()[i].toNumber();
if ((x == 0 && mx == x && copySign(1.0, x) == -1.0)
|| (x < mx) || std::isnan(x)) {
mx = x;
@@ -225,8 +225,8 @@ ReturnedValue MathObject::method_min(CallContext *context)
ReturnedValue MathObject::method_pow(CallContext *context)
{
- double x = context->d()->callData->argc > 0 ? context->d()->callData->args[0].toNumber() : qSNaN();
- double y = context->d()->callData->argc > 1 ? context->d()->callData->args[1].toNumber() : qSNaN();
+ double x = context->argc() > 0 ? context->args()[0].toNumber() : qSNaN();
+ double y = context->argc() > 1 ? context->args()[1].toNumber() : qSNaN();
if (std::isnan(y))
return Encode(qSNaN());
@@ -286,26 +286,26 @@ ReturnedValue MathObject::method_random(CallContext *context)
ReturnedValue MathObject::method_round(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
v = copySign(::floor(v + 0.5), v);
return Encode(v);
}
ReturnedValue MathObject::method_sin(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
return Encode(::sin(v));
}
ReturnedValue MathObject::method_sqrt(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
return Encode(::sqrt(v));
}
ReturnedValue MathObject::method_tan(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
if (v == 0.0)
return Encode(v);
else
diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp
index dcde8f13f3..bbe6bb977c 100644
--- a/src/qml/jsruntime/qv4numberobject.cpp
+++ b/src/qml/jsruntime/qv4numberobject.cpp
@@ -52,7 +52,7 @@ Heap::NumberCtor::NumberCtor(QV4::ExecutionContext *scope)
ReturnedValue NumberCtor::construct(Managed *m, CallData *callData)
{
- Scope scope(static_cast<NumberCtor *>(m)->engine());
+ Scope scope(m->cast<NumberCtor>()->engine());
double dbl = callData->argc ? callData->args[0].toNumber() : 0.;
ScopedValue d(scope, QV4::Primitive::fromDouble(dbl));
return Encode(scope.engine->newNumberObject(d));
@@ -96,9 +96,9 @@ void NumberPrototype::init(ExecutionEngine *engine, Object *ctor)
inline ReturnedValue thisNumberValue(ExecutionContext *ctx)
{
- if (ctx->d()->callData->thisObject.isNumber())
- return ctx->d()->callData->thisObject.asReturnedValue();
- NumberObject *n = ctx->d()->callData->thisObject.asNumberObject();
+ if (ctx->thisObject().isNumber())
+ return ctx->thisObject().asReturnedValue();
+ NumberObject *n = ctx->thisObject().asNumberObject();
if (!n)
return ctx->engine()->throwTypeError();
return n->value().asReturnedValue();
@@ -106,9 +106,9 @@ inline ReturnedValue thisNumberValue(ExecutionContext *ctx)
inline double thisNumber(ExecutionContext *ctx)
{
- if (ctx->d()->callData->thisObject.isNumber())
- return ctx->d()->callData->thisObject.asDouble();
- NumberObject *n = ctx->d()->callData->thisObject.asNumberObject();
+ if (ctx->thisObject().isNumber())
+ return ctx->thisObject().asDouble();
+ NumberObject *n = ctx->thisObject().asNumberObject();
if (!n)
return ctx->engine()->throwTypeError();
return n->value().asDouble();
@@ -121,8 +121,8 @@ ReturnedValue NumberPrototype::method_toString(CallContext *ctx)
if (scope.engine->hasException)
return Encode::undefined();
- if (ctx->d()->callData->argc && !ctx->d()->callData->args[0].isUndefined()) {
- int radix = ctx->d()->callData->args[0].toInt32();
+ if (ctx->argc() && !ctx->args()[0].isUndefined()) {
+ int radix = ctx->args()[0].toInt32();
if (radix < 2 || radix > 36)
return ctx->engine()->throwError(QString::fromLatin1("Number.prototype.toString: %0 is not a valid radix")
.arg(radix));
@@ -191,14 +191,14 @@ ReturnedValue NumberPrototype::method_toFixed(CallContext *ctx)
double fdigits = 0;
- if (ctx->d()->callData->argc > 0)
- fdigits = ctx->d()->callData->args[0].toInteger();
+ if (ctx->argc() > 0)
+ fdigits = ctx->args()[0].toInteger();
if (std::isnan(fdigits))
fdigits = 0;
if (fdigits < 0 || fdigits > 20)
- return ctx->engine()->throwRangeError(ctx->d()->callData->thisObject);
+ return ctx->engine()->throwRangeError(ctx->thisObject());
QString str;
if (std::isnan(v))
@@ -221,8 +221,8 @@ ReturnedValue NumberPrototype::method_toExponential(CallContext *ctx)
int fdigits = -1;
- if (ctx->d()->callData->argc && !ctx->d()->callData->args[0].isUndefined()) {
- fdigits = ctx->d()->callData->args[0].toInt32();
+ if (ctx->argc() && !ctx->args()[0].isUndefined()) {
+ fdigits = ctx->args()[0].toInt32();
if (fdigits < 0 || fdigits > 20) {
ScopedString error(scope, scope.engine->newString(QStringLiteral("Number.prototype.toExponential: fractionDigits out of range")));
return ctx->engine()->throwRangeError(error);
@@ -244,10 +244,10 @@ ReturnedValue NumberPrototype::method_toPrecision(CallContext *ctx)
if (scope.engine->hasException)
return Encode::undefined();
- if (!ctx->d()->callData->argc || ctx->d()->callData->args[0].isUndefined())
+ if (!ctx->argc() || ctx->args()[0].isUndefined())
return RuntimeHelpers::toString(scope.engine, v);
- double precision = ctx->d()->callData->args[0].toInt32();
+ double precision = ctx->args()[0].toInt32();
if (precision < 1 || precision > 21) {
ScopedString error(scope, scope.engine->newString(QStringLiteral("Number.prototype.toPrecision: precision out of range")));
return ctx->engine()->throwRangeError(error);
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index 1c36f179b2..4e88cd785e 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -220,7 +220,7 @@ public:
bool arrayPut(uint index, const Value &value) {
return arrayData()->vtable()->put(this, index, value);
}
- bool arrayPut(uint index, Value *values, uint n) {
+ bool arrayPut(uint index, const Value *values, uint n) {
return arrayData()->vtable()->putArray(this, index, values, n);
}
void setArrayAttributes(uint i, PropertyAttributes a) {
@@ -333,17 +333,17 @@ namespace Heap {
struct BooleanObject : Object {
BooleanObject(InternalClass *ic, QV4::Object *prototype)
- : Object(ic, prototype)
+ : Object(ic, prototype),
+ b(false)
{
- value = Encode((bool)false);
}
- BooleanObject(ExecutionEngine *engine, const Value &val)
- : Object(engine->emptyClass, engine->booleanPrototype.asObject())
+ BooleanObject(ExecutionEngine *engine, bool b)
+ : Object(engine->emptyClass, engine->booleanPrototype.asObject()),
+ b(b)
{
- value = val;
}
- Value value;
+ bool b;
};
struct NumberObject : Object {
@@ -383,7 +383,7 @@ struct BooleanObject: Object {
V4_OBJECT2(BooleanObject, Object)
Q_MANAGED_TYPE(BooleanObject)
- Value value() const { return d()->value; }
+ bool value() const { return d()->b; }
};
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index 289421e867..dce3c8124b 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -153,7 +153,7 @@ ReturnedValue ObjectPrototype::method_getOwnPropertyNames(CallContext *context)
if (!O)
return context->engine()->throwTypeError();
- ScopedArrayObject array(scope, getOwnPropertyNames(context->d()->engine, context->d()->callData->args[0]));
+ ScopedArrayObject array(scope, getOwnPropertyNames(context->d()->engine, context->args()[0]));
return array.asReturnedValue();
}
@@ -167,7 +167,7 @@ ReturnedValue ObjectPrototype::method_create(CallContext *ctx)
ScopedObject newObject(scope, ctx->d()->engine->newObject());
newObject->setPrototype(O->asObject());
- if (ctx->d()->callData->argc > 1 && !ctx->d()->callData->args[1].isUndefined()) {
+ if (ctx->argc() > 1 && !ctx->args()[1].isUndefined()) {
ctx->d()->callData->args[0] = newObject.asReturnedValue();
return method_defineProperties(ctx);
}
@@ -385,12 +385,12 @@ ReturnedValue ObjectPrototype::method_keys(CallContext *ctx)
ReturnedValue ObjectPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- if (ctx->d()->callData->thisObject.isUndefined()) {
+ if (ctx->thisObject().isUndefined()) {
return ctx->d()->engine->newString(QStringLiteral("[object Undefined]"))->asReturnedValue();
- } else if (ctx->d()->callData->thisObject.isNull()) {
+ } else if (ctx->thisObject().isNull()) {
return ctx->d()->engine->newString(QStringLiteral("[object Null]"))->asReturnedValue();
} else {
- ScopedObject obj(scope, RuntimeHelpers::toObject(scope.engine, ctx->d()->callData->thisObject));
+ ScopedObject obj(scope, RuntimeHelpers::toObject(scope.engine, ctx->thisObject()));
QString className = obj->className();
return ctx->d()->engine->newString(QString::fromLatin1("[object %1]").arg(className))->asReturnedValue();
}
@@ -399,7 +399,7 @@ ReturnedValue ObjectPrototype::method_toString(CallContext *ctx)
ReturnedValue ObjectPrototype::method_toLocaleString(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedObject o(scope, ctx->thisObject().toObject(scope.engine));
if (!o)
return Encode::undefined();
ScopedFunctionObject f(scope, o->get(ctx->d()->engine->id_toString));
@@ -413,7 +413,7 @@ ReturnedValue ObjectPrototype::method_toLocaleString(CallContext *ctx)
ReturnedValue ObjectPrototype::method_valueOf(CallContext *ctx)
{
Scope scope(ctx);
- ScopedValue v(scope, ctx->d()->callData->thisObject.toObject(scope.engine));
+ ScopedValue v(scope, ctx->thisObject().toObject(scope.engine));
if (ctx->d()->engine->hasException)
return Encode::undefined();
return v->asReturnedValue();
@@ -425,7 +425,7 @@ ReturnedValue ObjectPrototype::method_hasOwnProperty(CallContext *ctx)
ScopedString P(scope, ctx->argument(0), ScopedString::Convert);
if (scope.engine->hasException)
return Encode::undefined();
- ScopedObject O(scope, ctx->d()->callData->thisObject, ScopedObject::Convert);
+ ScopedObject O(scope, ctx->thisObject(), ScopedObject::Convert);
if (scope.engine->hasException)
return Encode::undefined();
bool r = O->hasOwnProperty(P);
@@ -441,7 +441,7 @@ ReturnedValue ObjectPrototype::method_isPrototypeOf(CallContext *ctx)
if (!V)
return Encode(false);
- ScopedObject O(scope, ctx->d()->callData->thisObject, ScopedObject::Convert);
+ ScopedObject O(scope, ctx->thisObject(), ScopedObject::Convert);
if (scope.engine->hasException)
return Encode::undefined();
ScopedObject proto(scope, V->prototype());
@@ -460,7 +460,7 @@ ReturnedValue ObjectPrototype::method_propertyIsEnumerable(CallContext *ctx)
if (scope.engine->hasException)
return Encode::undefined();
- ScopedObject o(scope, ctx->d()->callData->thisObject, ScopedObject::Convert);
+ ScopedObject o(scope, ctx->thisObject(), ScopedObject::Convert);
if (scope.engine->hasException)
return Encode::undefined();
PropertyAttributes attrs;
@@ -470,7 +470,7 @@ ReturnedValue ObjectPrototype::method_propertyIsEnumerable(CallContext *ctx)
ReturnedValue ObjectPrototype::method_defineGetter(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 2)
+ if (ctx->argc() < 2)
return ctx->engine()->throwTypeError();
Scope scope(ctx);
@@ -482,9 +482,9 @@ ReturnedValue ObjectPrototype::method_defineGetter(CallContext *ctx)
if (scope.engine->hasException)
return Encode::undefined();
- ScopedObject o(scope, ctx->d()->callData->thisObject);
+ ScopedObject o(scope, ctx->thisObject());
if (!o) {
- if (!ctx->d()->callData->thisObject.isUndefined())
+ if (!ctx->thisObject().isUndefined())
return Encode::undefined();
o = ctx->d()->engine->globalObject();
}
@@ -498,7 +498,7 @@ ReturnedValue ObjectPrototype::method_defineGetter(CallContext *ctx)
ReturnedValue ObjectPrototype::method_defineSetter(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 2)
+ if (ctx->argc() < 2)
return ctx->engine()->throwTypeError();
Scope scope(ctx);
@@ -510,9 +510,9 @@ ReturnedValue ObjectPrototype::method_defineSetter(CallContext *ctx)
if (scope.engine->hasException)
return Encode::undefined();
- ScopedObject o(scope, ctx->d()->callData->thisObject);
+ ScopedObject o(scope, ctx->thisObject());
if (!o) {
- if (!ctx->d()->callData->thisObject.isUndefined())
+ if (!ctx->thisObject().isUndefined())
return Encode::undefined();
o = ctx->d()->engine->globalObject();
}
@@ -527,7 +527,7 @@ ReturnedValue ObjectPrototype::method_defineSetter(CallContext *ctx)
ReturnedValue ObjectPrototype::method_get_proto(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->d()->callData->thisObject.asObject());
+ ScopedObject o(scope, ctx->thisObject().asObject());
if (!o)
return ctx->engine()->throwTypeError();
@@ -537,16 +537,16 @@ ReturnedValue ObjectPrototype::method_get_proto(CallContext *ctx)
ReturnedValue ObjectPrototype::method_set_proto(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->d()->callData->thisObject);
- if (!o || !ctx->d()->callData->argc)
+ ScopedObject o(scope, ctx->thisObject());
+ if (!o || !ctx->argc())
return ctx->engine()->throwTypeError();
- if (ctx->d()->callData->args[0].isNull()) {
+ if (ctx->args()[0].isNull()) {
o->setPrototype(0);
return Encode::undefined();
}
- ScopedObject p(scope, ctx->d()->callData->args[0]);
+ ScopedObject p(scope, ctx->args()[0]);
bool ok = false;
if (!!p) {
if (o->prototype() == p->d()) {
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index c65b7b6d55..f0c94d2d0e 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -886,10 +886,10 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
ReturnedValue QObjectWrapper::method_connect(CallContext *ctx)
{
- if (ctx->d()->callData->argc == 0)
+ if (ctx->argc() == 0)
V4THROW_ERROR("Function.prototype.connect: no arguments given");
- QPair<QObject *, int> signalInfo = extractQtSignal(ctx->d()->callData->thisObject);
+ QPair<QObject *, int> signalInfo = extractQtSignal(ctx->thisObject());
QObject *signalObject = signalInfo.first;
int signalIndex = signalInfo.second; // in method range, not signal range!
@@ -906,11 +906,11 @@ ReturnedValue QObjectWrapper::method_connect(CallContext *ctx)
QV4::ScopedFunctionObject f(scope);
QV4::ScopedValue thisObject (scope, QV4::Encode::undefined());
- if (ctx->d()->callData->argc == 1) {
- f = ctx->d()->callData->args[0];
- } else if (ctx->d()->callData->argc >= 2) {
- thisObject = ctx->d()->callData->args[0];
- f = ctx->d()->callData->args[1];
+ if (ctx->argc() == 1) {
+ f = ctx->args()[0];
+ } else if (ctx->argc() >= 2) {
+ thisObject = ctx->args()[0];
+ f = ctx->args()[1];
}
if (!f)
@@ -937,12 +937,12 @@ ReturnedValue QObjectWrapper::method_connect(CallContext *ctx)
ReturnedValue QObjectWrapper::method_disconnect(CallContext *ctx)
{
- if (ctx->d()->callData->argc == 0)
+ if (ctx->argc() == 0)
V4THROW_ERROR("Function.prototype.disconnect: no arguments given");
QV4::Scope scope(ctx);
- QPair<QObject *, int> signalInfo = extractQtSignal(ctx->d()->callData->thisObject);
+ QPair<QObject *, int> signalInfo = extractQtSignal(ctx->thisObject());
QObject *signalObject = signalInfo.first;
int signalIndex = signalInfo.second;
@@ -958,11 +958,11 @@ ReturnedValue QObjectWrapper::method_disconnect(CallContext *ctx)
QV4::ScopedFunctionObject functionValue(scope);
QV4::ScopedValue functionThisValue(scope, QV4::Encode::undefined());
- if (ctx->d()->callData->argc == 1) {
- functionValue = ctx->d()->callData->args[0];
- } else if (ctx->d()->callData->argc >= 2) {
- functionThisValue = ctx->d()->callData->args[0];
- functionValue = ctx->d()->callData->args[1];
+ if (ctx->argc() == 1) {
+ functionValue = ctx->args()[0];
+ } else if (ctx->argc() >= 2) {
+ functionThisValue = ctx->args()[0];
+ functionValue = ctx->args()[1];
}
if (!functionValue)
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 0736056838..c0e4f137ad 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -345,7 +345,7 @@ void RegExpPrototype::init(ExecutionEngine *engine, Object *constructor)
ReturnedValue RegExpPrototype::method_exec(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<RegExpObject> r(scope, ctx->d()->callData->thisObject.as<RegExpObject>());
+ Scoped<RegExpObject> r(scope, ctx->thisObject().as<RegExpObject>());
if (!r)
return ctx->engine()->throwTypeError();
@@ -409,7 +409,7 @@ ReturnedValue RegExpPrototype::method_test(CallContext *ctx)
ReturnedValue RegExpPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<RegExpObject> r(scope, ctx->d()->callData->thisObject.as<RegExpObject>());
+ Scoped<RegExpObject> r(scope, ctx->thisObject().as<RegExpObject>());
if (!r)
return ctx->engine()->throwTypeError();
@@ -419,12 +419,12 @@ ReturnedValue RegExpPrototype::method_toString(CallContext *ctx)
ReturnedValue RegExpPrototype::method_compile(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<RegExpObject> r(scope, ctx->d()->callData->thisObject.as<RegExpObject>());
+ Scoped<RegExpObject> r(scope, ctx->thisObject().as<RegExpObject>());
if (!r)
return ctx->engine()->throwTypeError();
- ScopedCallData callData(scope, ctx->d()->callData->argc);
- memcpy(callData->args, ctx->d()->callData->args, ctx->d()->callData->argc*sizeof(Value));
+ ScopedCallData callData(scope, ctx->argc());
+ memcpy(callData->args, ctx->args(), ctx->argc()*sizeof(Value));
Scoped<RegExpObject> re(scope, ctx->d()->engine->regExpCtor.asFunctionObject()->construct(callData));
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 4bbbb6f401..4167823c6b 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -435,7 +435,7 @@ Heap::Object *RuntimeHelpers::convertToObject(ExecutionEngine *engine, const Val
engine->throwTypeError();
return 0;
case Value::Boolean_Type:
- return engine->newBooleanObject(value);
+ return engine->newBooleanObject(value.booleanValue());
case Value::Managed_Type:
Q_ASSERT(value.isString());
return engine->newStringObject(value);
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index 83fd2efa60..046f7f62b1 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -375,8 +375,8 @@ public:
}
QV4::Scope scope(ctx);
- if (ctx->d()->callData->argc == 1 && ctx->d()->callData->args[0].asFunctionObject()) {
- CompareFunctor cf(ctx, ctx->d()->callData->args[0]);
+ if (ctx->argc() == 1 && ctx->args()[0].asFunctionObject()) {
+ CompareFunctor cf(ctx, ctx->args()[0]);
std::sort(d()->container.begin(), d()->container.end(), cf);
} else {
DefaultCompareFunctor cf;
@@ -390,7 +390,7 @@ public:
static QV4::ReturnedValue method_get_length(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSequence<Container> > This(scope, ctx->d()->callData->thisObject.as<QQmlSequence<Container> >());
+ QV4::Scoped<QQmlSequence<Container> > This(scope, ctx->thisObject().as<QQmlSequence<Container> >());
if (!This)
return ctx->engine()->throwTypeError();
@@ -405,11 +405,11 @@ public:
static QV4::ReturnedValue method_set_length(QV4::CallContext* ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSequence<Container> > This(scope, ctx->d()->callData->thisObject.as<QQmlSequence<Container> >());
+ QV4::Scoped<QQmlSequence<Container> > This(scope, ctx->thisObject().as<QQmlSequence<Container> >());
if (!This)
return ctx->engine()->throwTypeError();
- quint32 newLength = ctx->d()->callData->args[0].toUInt32();
+ quint32 newLength = ctx->args()[0].toUInt32();
/* Qt containers have int (rather than uint) allowable indexes. */
if (newLength > INT_MAX) {
generateWarning(scope.engine, QLatin1String("Index out of range during length set"));
@@ -558,11 +558,11 @@ void SequencePrototype::init()
QV4::ReturnedValue SequencePrototype::method_sort(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::ScopedObject o(scope, ctx->d()->callData->thisObject);
+ QV4::ScopedObject o(scope, ctx->thisObject());
if (!o || !o->isListType())
return ctx->engine()->throwTypeError();
- if (ctx->d()->callData->argc >= 2)
+ if (ctx->argc() >= 2)
return o.asReturnedValue();
#define CALL_SORT(SequenceElementType, SequenceElementTypeName, SequenceType, DefaultValue) \
diff --git a/src/qml/jsruntime/qv4sequenceobject_p.h b/src/qml/jsruntime/qv4sequenceobject_p.h
index 0009fa45fa..3cd56a65d6 100644
--- a/src/qml/jsruntime/qv4sequenceobject_p.h
+++ b/src/qml/jsruntime/qv4sequenceobject_p.h
@@ -62,7 +62,7 @@ struct SequencePrototype : public QV4::Object
static ReturnedValue method_valueOf(QV4::CallContext *ctx)
{
- return ctx->d()->callData->thisObject.toString(ctx->engine())->asReturnedValue();
+ return ctx->thisObject().toString(ctx->engine())->asReturnedValue();
}
static ReturnedValue method_sort(QV4::CallContext *ctx);
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 55bc3c58db..6eb74e3a82 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -220,7 +220,7 @@ void StringPrototype::init(ExecutionEngine *engine, Object *ctor)
static QString getThisString(ExecutionContext *ctx)
{
Scope scope(ctx);
- ScopedValue t(scope, ctx->d()->callData->thisObject);
+ ScopedValue t(scope, ctx->thisObject());
if (t->isString())
return t->stringValue()->toQString();
if (StringObject *thisString = t->asStringObject())
@@ -234,10 +234,10 @@ static QString getThisString(ExecutionContext *ctx)
ReturnedValue StringPrototype::method_toString(CallContext *context)
{
- if (context->d()->callData->thisObject.isString())
- return context->d()->callData->thisObject.asReturnedValue();
+ if (context->thisObject().isString())
+ return context->thisObject().asReturnedValue();
- StringObject *o = context->d()->callData->thisObject.asStringObject();
+ StringObject *o = context->thisObject().asStringObject();
if (!o)
return context->engine()->throwTypeError();
return o->d()->value.asReturnedValue();
@@ -250,8 +250,8 @@ ReturnedValue StringPrototype::method_charAt(CallContext *context)
return Encode::undefined();
int pos = 0;
- if (context->d()->callData->argc > 0)
- pos = (int) context->d()->callData->args[0].toInteger();
+ if (context->argc() > 0)
+ pos = (int) context->args()[0].toInteger();
QString result;
if (pos >= 0 && pos < str.length())
@@ -267,8 +267,8 @@ ReturnedValue StringPrototype::method_charCodeAt(CallContext *context)
return Encode::undefined();
int pos = 0;
- if (context->d()->callData->argc > 0)
- pos = (int) context->d()->callData->args[0].toInteger();
+ if (context->argc() > 0)
+ pos = (int) context->args()[0].toInteger();
if (pos >= 0 && pos < str.length())
@@ -286,8 +286,8 @@ ReturnedValue StringPrototype::method_concat(CallContext *context)
return Encode::undefined();
ScopedValue v(scope);
- for (int i = 0; i < context->d()->callData->argc; ++i) {
- v = RuntimeHelpers::toString(scope.engine, context->d()->callData->args[i]);
+ for (int i = 0; i < context->argc(); ++i) {
+ v = RuntimeHelpers::toString(scope.engine, context->args()[i]);
if (scope.hasException())
return Encode::undefined();
Q_ASSERT(v->isString());
@@ -304,12 +304,12 @@ ReturnedValue StringPrototype::method_indexOf(CallContext *context)
return Encode::undefined();
QString searchString;
- if (context->d()->callData->argc)
- searchString = context->d()->callData->args[0].toQString();
+ if (context->argc())
+ searchString = context->args()[0].toQString();
int pos = 0;
- if (context->d()->callData->argc > 1)
- pos = (int) context->d()->callData->args[1].toInteger();
+ if (context->argc() > 1)
+ pos = (int) context->args()[1].toInteger();
int index = -1;
if (! value.isEmpty())
@@ -327,8 +327,8 @@ ReturnedValue StringPrototype::method_lastIndexOf(CallContext *context)
return Encode::undefined();
QString searchString;
- if (context->d()->callData->argc)
- searchString = context->d()->callData->args[0].toQString();
+ if (context->argc())
+ searchString = context->args()[0].toQString();
ScopedValue posArg(scope, context->argument(1));
double position = RuntimeHelpers::toNumber(posArg);
@@ -353,20 +353,20 @@ ReturnedValue StringPrototype::method_localeCompare(CallContext *context)
if (scope.engine->hasException)
return Encode::undefined();
- ScopedValue v(scope, context->d()->callData->argument(0));
+ ScopedValue v(scope, context->argument(0));
const QString that = v->toQString();
return Encode(QString::localeAwareCompare(value, that));
}
ReturnedValue StringPrototype::method_match(CallContext *context)
{
- if (context->d()->callData->thisObject.isUndefined() || context->d()->callData->thisObject.isNull())
+ if (context->thisObject().isUndefined() || context->thisObject().isNull())
return context->engine()->throwTypeError();
Scope scope(context);
- ScopedString s(scope, context->d()->callData->thisObject.toString(scope.engine));
+ ScopedString s(scope, context->thisObject().toString(scope.engine));
- ScopedValue regexp(scope, context->d()->callData->argument(0));
+ ScopedValue regexp(scope, context->argument(0));
Scoped<RegExpObject> rx(scope, regexp);
if (!rx) {
ScopedCallData callData(scope, 1);
@@ -473,10 +473,10 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx)
{
Scope scope(ctx);
QString string;
- if (StringObject *thisString = ctx->d()->callData->thisObject.asStringObject())
+ if (StringObject *thisString = ctx->thisObject().asStringObject())
string = thisString->d()->value.stringValue()->toQString();
else
- string = ctx->d()->callData->thisObject.toQString();
+ string = ctx->thisObject().toQString();
int numCaptures = 0;
int numStringMatches = 0;
@@ -618,9 +618,9 @@ ReturnedValue StringPrototype::method_slice(CallContext *ctx)
const double length = text.length();
- double start = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toInteger() : 0;
- double end = (ctx->d()->callData->argc < 2 || ctx->d()->callData->args[1].isUndefined())
- ? length : ctx->d()->callData->args[1].toInteger();
+ double start = ctx->argc() ? ctx->args()[0].toInteger() : 0;
+ double end = (ctx->argc() < 2 || ctx->args()[1].isUndefined())
+ ? length : ctx->args()[1].toInteger();
if (start < 0)
start = qMax(length + start, 0.);
@@ -728,12 +728,12 @@ ReturnedValue StringPrototype::method_substr(CallContext *context)
return Encode::undefined();
double start = 0;
- if (context->d()->callData->argc > 0)
- start = context->d()->callData->args[0].toInteger();
+ if (context->argc() > 0)
+ start = context->args()[0].toInteger();
double length = +qInf();
- if (context->d()->callData->argc > 1)
- length = context->d()->callData->args[1].toInteger();
+ if (context->argc() > 1)
+ length = context->args()[1].toInteger();
double count = value.length();
if (start < 0)
@@ -756,8 +756,8 @@ ReturnedValue StringPrototype::method_substring(CallContext *context)
double start = 0;
double end = length;
- if (context->d()->callData->argc > 0)
- start = context->d()->callData->args[0].toInteger();
+ if (context->argc() > 0)
+ start = context->args()[0].toInteger();
Scope scope(context);
ScopedValue endValue(scope, context->argument(1));
@@ -815,10 +815,10 @@ ReturnedValue StringPrototype::method_toLocaleUpperCase(CallContext *ctx)
ReturnedValue StringPrototype::method_fromCharCode(CallContext *context)
{
- QString str(context->d()->callData->argc, Qt::Uninitialized);
+ QString str(context->argc(), Qt::Uninitialized);
QChar *ch = str.data();
- for (int i = 0; i < context->d()->callData->argc; ++i) {
- *ch = QChar(context->d()->callData->args[i].toUInt16());
+ for (int i = 0; i < context->argc(); ++i) {
+ *ch = QChar(context->args()[i].toUInt16());
++ch;
}
return context->d()->engine->newString(str)->asReturnedValue();
diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp
index 1b9c5d58e4..ba3ebdd60c 100644
--- a/src/qml/jsruntime/qv4typedarray.cpp
+++ b/src/qml/jsruntime/qv4typedarray.cpp
@@ -404,7 +404,7 @@ void TypedArrayPrototype::init(ExecutionEngine *engine, TypedArrayCtor *ctor)
ReturnedValue TypedArrayPrototype::method_get_buffer(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<TypedArray> v(scope, ctx->d()->callData->thisObject);
+ Scoped<TypedArray> v(scope, ctx->thisObject());
if (!v)
return scope.engine->throwTypeError();
@@ -414,7 +414,7 @@ ReturnedValue TypedArrayPrototype::method_get_buffer(CallContext *ctx)
ReturnedValue TypedArrayPrototype::method_get_byteLength(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<TypedArray> v(scope, ctx->d()->callData->thisObject);
+ Scoped<TypedArray> v(scope, ctx->thisObject());
if (!v)
return scope.engine->throwTypeError();
@@ -424,7 +424,7 @@ ReturnedValue TypedArrayPrototype::method_get_byteLength(CallContext *ctx)
ReturnedValue TypedArrayPrototype::method_get_byteOffset(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<TypedArray> v(scope, ctx->d()->callData->thisObject);
+ Scoped<TypedArray> v(scope, ctx->thisObject());
if (!v)
return scope.engine->throwTypeError();
@@ -434,7 +434,7 @@ ReturnedValue TypedArrayPrototype::method_get_byteOffset(CallContext *ctx)
ReturnedValue TypedArrayPrototype::method_get_length(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<TypedArray> v(scope, ctx->d()->callData->thisObject);
+ Scoped<TypedArray> v(scope, ctx->thisObject());
if (!v)
return scope.engine->throwTypeError();
@@ -444,14 +444,14 @@ ReturnedValue TypedArrayPrototype::method_get_length(CallContext *ctx)
ReturnedValue TypedArrayPrototype::method_set(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<TypedArray> a(scope, ctx->d()->callData->thisObject);
+ Scoped<TypedArray> a(scope, ctx->thisObject());
if (!a)
return scope.engine->throwTypeError();
Scoped<ArrayBuffer> buffer(scope, a->d()->buffer);
if (!buffer)
scope.engine->throwTypeError();
- double doffset = ctx->d()->callData->argc >= 2 ? ctx->d()->callData->args[1].toInteger() : 0;
+ double doffset = ctx->argc() >= 2 ? ctx->args()[1].toInteger() : 0;
if (scope.engine->hasException)
return Encode::undefined();
@@ -460,10 +460,10 @@ ReturnedValue TypedArrayPrototype::method_set(CallContext *ctx)
uint offset = (uint)doffset;
uint elementSize = a->d()->type->bytesPerElement;
- Scoped<TypedArray> srcTypedArray(scope, ctx->d()->callData->args[0]);
+ Scoped<TypedArray> srcTypedArray(scope, ctx->args()[0]);
if (!srcTypedArray) {
// src is a regular object
- ScopedObject o(scope, ctx->d()->callData->args[0].toObject(scope.engine));
+ ScopedObject o(scope, ctx->args()[0].toObject(scope.engine));
if (scope.engine->hasException || !o)
return scope.engine->throwTypeError();
@@ -533,7 +533,7 @@ ReturnedValue TypedArrayPrototype::method_set(CallContext *ctx)
ReturnedValue TypedArrayPrototype::method_subarray(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<TypedArray> a(scope, ctx->d()->callData->thisObject);
+ Scoped<TypedArray> a(scope, ctx->thisObject());
if (!a)
return scope.engine->throwTypeError();
@@ -543,12 +543,12 @@ ReturnedValue TypedArrayPrototype::method_subarray(CallContext *ctx)
return scope.engine->throwTypeError();
int len = a->length();
- double b = ctx->d()->callData->argc > 0 ? ctx->d()->callData->args[0].toInteger() : 0;
+ double b = ctx->argc() > 0 ? ctx->args()[0].toInteger() : 0;
if (b < 0)
b = len + b;
uint begin = (uint)qBound(0., b, (double)len);
- double e = ctx->d()->callData->argc < 2 || ctx->d()->callData->args[1].isUndefined() ? len : ctx->d()->callData->args[1].toInteger();
+ double e = ctx->argc() < 2 || ctx->args()[1].isUndefined() ? len : ctx->args()[1].toInteger();
if (e < 0)
e = len + e;
uint end = (uint)qBound(0., e, (double)len);
diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp
index a1339bb90a..cf323fc6bc 100644
--- a/src/qml/jsruntime/qv4variantobject.cpp
+++ b/src/qml/jsruntime/qv4variantobject.cpp
@@ -103,7 +103,7 @@ void VariantPrototype::init()
QV4::ReturnedValue VariantPrototype::method_preserve(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<VariantObject> o(scope, ctx->d()->callData->thisObject.as<QV4::VariantObject>());
+ Scoped<VariantObject> o(scope, ctx->thisObject().as<QV4::VariantObject>());
if (o && o->d()->isScarce())
o->d()->node.remove();
return Encode::undefined();
@@ -112,7 +112,7 @@ QV4::ReturnedValue VariantPrototype::method_preserve(CallContext *ctx)
QV4::ReturnedValue VariantPrototype::method_destroy(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<VariantObject> o(scope, ctx->d()->callData->thisObject.as<QV4::VariantObject>());
+ Scoped<VariantObject> o(scope, ctx->thisObject().as<QV4::VariantObject>());
if (o) {
if (o->d()->isScarce())
o->d()->node.remove();
@@ -124,7 +124,7 @@ QV4::ReturnedValue VariantPrototype::method_destroy(CallContext *ctx)
QV4::ReturnedValue VariantPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<VariantObject> o(scope, ctx->d()->callData->thisObject.as<QV4::VariantObject>());
+ Scoped<VariantObject> o(scope, ctx->thisObject().as<QV4::VariantObject>());
if (!o)
return Encode::undefined();
QString result = o->d()->data.toString();
@@ -136,7 +136,7 @@ QV4::ReturnedValue VariantPrototype::method_toString(CallContext *ctx)
QV4::ReturnedValue VariantPrototype::method_valueOf(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<VariantObject> o(scope, ctx->d()->callData->thisObject.as<QV4::VariantObject>());
+ Scoped<VariantObject> o(scope, ctx->thisObject().as<QV4::VariantObject>());
if (o) {
QVariant v = o->d()->data;
switch (v.type()) {
@@ -157,7 +157,7 @@ QV4::ReturnedValue VariantPrototype::method_valueOf(CallContext *ctx)
break;
}
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 87b1387eed..6f1838728e 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -627,7 +627,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
MOTH_END_INSTR(Debug)
MOTH_BEGIN_INSTR(LoadThis)
- VALUE(instr.result) = context->d()->callData->thisObject;
+ VALUE(instr.result) = context->thisObject();
MOTH_END_INSTR(LoadThis)
MOTH_BEGIN_INSTR(LoadQmlIdArray)
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 0b76c0f176..428c59767b 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1420,7 +1420,7 @@ QQmlComponentExtension::QQmlComponentExtension(QV4::ExecutionEngine *v4)
QV4::ReturnedValue QV4::QmlIncubatorObject::method_get_object(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
+ QV4::Scoped<QmlIncubatorObject> o(scope, ctx->thisObject().as<QmlIncubatorObject>());
if (!o)
return ctx->engine()->throwTypeError();
@@ -1430,7 +1430,7 @@ QV4::ReturnedValue QV4::QmlIncubatorObject::method_get_object(QV4::CallContext *
QV4::ReturnedValue QV4::QmlIncubatorObject::method_forceCompletion(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
+ QV4::Scoped<QmlIncubatorObject> o(scope, ctx->thisObject().as<QmlIncubatorObject>());
if (!o)
return ctx->engine()->throwTypeError();
@@ -1442,7 +1442,7 @@ QV4::ReturnedValue QV4::QmlIncubatorObject::method_forceCompletion(QV4::CallCont
QV4::ReturnedValue QV4::QmlIncubatorObject::method_get_status(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
+ QV4::Scoped<QmlIncubatorObject> o(scope, ctx->thisObject().as<QmlIncubatorObject>());
if (!o)
return ctx->engine()->throwTypeError();
@@ -1452,7 +1452,7 @@ QV4::ReturnedValue QV4::QmlIncubatorObject::method_get_status(QV4::CallContext *
QV4::ReturnedValue QV4::QmlIncubatorObject::method_get_statusChanged(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
+ QV4::Scoped<QmlIncubatorObject> o(scope, ctx->thisObject().as<QmlIncubatorObject>());
if (!o)
return ctx->engine()->throwTypeError();
@@ -1462,12 +1462,12 @@ QV4::ReturnedValue QV4::QmlIncubatorObject::method_get_statusChanged(QV4::CallCo
QV4::ReturnedValue QV4::QmlIncubatorObject::method_set_statusChanged(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
- if (!o || ctx->d()->callData->argc < 1)
+ QV4::Scoped<QmlIncubatorObject> o(scope, ctx->thisObject().as<QmlIncubatorObject>());
+ if (!o || ctx->argc() < 1)
return ctx->engine()->throwTypeError();
- o->d()->statusChanged = ctx->d()->callData->args[0];
+ o->d()->statusChanged = ctx->args()[0];
return QV4::Encode::undefined();
}
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index 5a27739156..34fb585309 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -76,36 +76,36 @@ void QQmlDateExtension::registerExtension(QV4::ExecutionEngine *engine)
QV4::ReturnedValue QQmlDateExtension::method_toLocaleString(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc > 2)
+ if (ctx->argc() > 2)
return QV4::DatePrototype::method_toLocaleString(ctx);
QV4::Scope scope(ctx);
- QV4::DateObject *date = ctx->d()->callData->thisObject.asDateObject();
+ QV4::DateObject *date = ctx->thisObject().asDateObject();
if (!date)
return QV4::DatePrototype::method_toLocaleString(ctx);
QDateTime dt = date->toQDateTime();
- if (ctx->d()->callData->argc == 0) {
+ if (ctx->argc() == 0) {
// Use QLocale for standard toLocaleString() function
QLocale locale;
return ctx->d()->engine->newString(locale.toString(dt))->asReturnedValue();
}
- if (!isLocaleObject(ctx->d()->callData->args[0]))
+ if (!isLocaleObject(ctx->args()[0]))
return QV4::DatePrototype::method_toLocaleString(ctx); // Use the default Date toLocaleString()
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QLocale::FormatType enumFormat = QLocale::LongFormat;
QString formattedDt;
- if (ctx->d()->callData->argc == 2) {
- if (ctx->d()->callData->args[1].isString()) {
- QString format = ctx->d()->callData->args[1].stringValue()->toQString();
+ if (ctx->argc() == 2) {
+ if (ctx->args()[1].isString()) {
+ QString format = ctx->args()[1].stringValue()->toQString();
formattedDt = r->d()->locale.toString(dt, format);
- } else if (ctx->d()->callData->args[1].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[1].toNumber();
+ } else if (ctx->args()[1].isNumber()) {
+ quint32 intFormat = ctx->args()[1].toNumber();
QLocale::FormatType format = QLocale::FormatType(intFormat);
formattedDt = r->d()->locale.toString(dt, format);
} else {
@@ -120,37 +120,37 @@ QV4::ReturnedValue QQmlDateExtension::method_toLocaleString(QV4::CallContext *ct
QV4::ReturnedValue QQmlDateExtension::method_toLocaleTimeString(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc > 2)
+ if (ctx->argc() > 2)
return QV4::DatePrototype::method_toLocaleTimeString(ctx);
QV4::Scope scope(ctx);
- QV4::DateObject *date = ctx->d()->callData->thisObject.asDateObject();
+ QV4::DateObject *date = ctx->thisObject().asDateObject();
if (!date)
return QV4::DatePrototype::method_toLocaleTimeString(ctx);
QDateTime dt = date->toQDateTime();
QTime time = dt.time();
- if (ctx->d()->callData->argc == 0) {
+ if (ctx->argc() == 0) {
// Use QLocale for standard toLocaleString() function
QLocale locale;
return ctx->d()->engine->newString(locale.toString(time))->asReturnedValue();
}
- if (!isLocaleObject(ctx->d()->callData->args[0]))
+ if (!isLocaleObject(ctx->args()[0]))
return QV4::DatePrototype::method_toLocaleTimeString(ctx); // Use the default Date toLocaleTimeString()
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QLocale::FormatType enumFormat = QLocale::LongFormat;
QString formattedTime;
- if (ctx->d()->callData->argc == 2) {
- if (ctx->d()->callData->args[1].isString()) {
- QString format = ctx->d()->callData->args[1].stringValue()->toQString();
+ if (ctx->argc() == 2) {
+ if (ctx->args()[1].isString()) {
+ QString format = ctx->args()[1].stringValue()->toQString();
formattedTime = r->d()->locale.toString(time, format);
- } else if (ctx->d()->callData->args[1].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[1].toNumber();
+ } else if (ctx->args()[1].isNumber()) {
+ quint32 intFormat = ctx->args()[1].toNumber();
QLocale::FormatType format = QLocale::FormatType(intFormat);
formattedTime = r->d()->locale.toString(time, format);
} else {
@@ -165,37 +165,37 @@ QV4::ReturnedValue QQmlDateExtension::method_toLocaleTimeString(QV4::CallContext
QV4::ReturnedValue QQmlDateExtension::method_toLocaleDateString(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc > 2)
+ if (ctx->argc() > 2)
return QV4::DatePrototype::method_toLocaleDateString(ctx);
QV4::Scope scope(ctx);
- QV4::DateObject *dateObj = ctx->d()->callData->thisObject.asDateObject();
+ QV4::DateObject *dateObj = ctx->thisObject().asDateObject();
if (!dateObj)
return QV4::DatePrototype::method_toLocaleDateString(ctx);
QDateTime dt = dateObj->toQDateTime();
QDate date = dt.date();
- if (ctx->d()->callData->argc == 0) {
+ if (ctx->argc() == 0) {
// Use QLocale for standard toLocaleString() function
QLocale locale;
return ctx->d()->engine->newString(locale.toString(date))->asReturnedValue();
}
- if (!isLocaleObject(ctx->d()->callData->args[0]))
+ if (!isLocaleObject(ctx->args()[0]))
return QV4::DatePrototype::method_toLocaleDateString(ctx); // Use the default Date toLocaleDateString()
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QLocale::FormatType enumFormat = QLocale::LongFormat;
QString formattedDate;
- if (ctx->d()->callData->argc == 2) {
- if (ctx->d()->callData->args[1].isString()) {
- QString format = ctx->d()->callData->args[1].stringValue()->toQString();
+ if (ctx->argc() == 2) {
+ if (ctx->args()[1].isString()) {
+ QString format = ctx->args()[1].stringValue()->toQString();
formattedDate = r->d()->locale.toString(date, format);
- } else if (ctx->d()->callData->args[1].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[1].toNumber();
+ } else if (ctx->args()[1].isNumber()) {
+ quint32 intFormat = ctx->args()[1].toNumber();
QLocale::FormatType format = QLocale::FormatType(intFormat);
formattedDate = r->d()->locale.toString(date, format);
} else {
@@ -211,29 +211,29 @@ QV4::ReturnedValue QQmlDateExtension::method_toLocaleDateString(QV4::CallContext
QV4::ReturnedValue QQmlDateExtension::method_fromLocaleString(QV4::CallContext *ctx)
{
QV4::ExecutionEngine * const engine = ctx->d()->engine;
- if (ctx->d()->callData->argc == 1 && ctx->d()->callData->args[0].isString()) {
+ if (ctx->argc() == 1 && ctx->args()[0].isString()) {
QLocale locale;
- QString dateString = ctx->d()->callData->args[0].stringValue()->toQString();
+ QString dateString = ctx->args()[0].stringValue()->toQString();
QDateTime dt = locale.toDateTime(dateString);
return QV4::Encode(engine->newDateObject(dt));
}
QV4::Scope scope(ctx);
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 3 || !isLocaleObject(ctx->d()->callData->args[0]))
+ if (ctx->argc() < 1 || ctx->argc() > 3 || !isLocaleObject(ctx->args()[0]))
V4THROW_ERROR("Locale: Date.fromLocaleString(): Invalid arguments");
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QLocale::FormatType enumFormat = QLocale::LongFormat;
QDateTime dt;
- QString dateString = ctx->d()->callData->args[1].toQStringNoThrow();
- if (ctx->d()->callData->argc == 3) {
- if (ctx->d()->callData->args[2].isString()) {
- QString format = ctx->d()->callData->args[2].stringValue()->toQString();
+ QString dateString = ctx->args()[1].toQStringNoThrow();
+ if (ctx->argc() == 3) {
+ if (ctx->args()[2].isString()) {
+ QString format = ctx->args()[2].stringValue()->toQString();
dt = r->d()->locale.toDateTime(dateString, format);
- } else if (ctx->d()->callData->args[2].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[2].toNumber();
+ } else if (ctx->args()[2].isNumber()) {
+ quint32 intFormat = ctx->args()[2].toNumber();
QLocale::FormatType format = QLocale::FormatType(intFormat);
dt = r->d()->locale.toDateTime(dateString, format);
} else {
@@ -250,31 +250,31 @@ QV4::ReturnedValue QQmlDateExtension::method_fromLocaleTimeString(QV4::CallConte
{
QV4::ExecutionEngine * const engine = ctx->d()->engine;
- if (ctx->d()->callData->argc == 1 && ctx->d()->callData->args[0].isString()) {
+ if (ctx->argc() == 1 && ctx->args()[0].isString()) {
QLocale locale;
- QString timeString = ctx->d()->callData->args[0].stringValue()->toQString();
+ QString timeString = ctx->args()[0].stringValue()->toQString();
QTime time = locale.toTime(timeString);
QDateTime dt = QDateTime::currentDateTime();
dt.setTime(time);
return QV4::Encode(engine->newDateObject(dt));
}
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 3 || !isLocaleObject(ctx->d()->callData->args[0]))
+ if (ctx->argc() < 1 || ctx->argc() > 3 || !isLocaleObject(ctx->args()[0]))
V4THROW_ERROR("Locale: Date.fromLocaleTimeString(): Invalid arguments");
QV4::Scope scope(ctx);
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QLocale::FormatType enumFormat = QLocale::LongFormat;
QTime tm;
- QString dateString = ctx->d()->callData->args[1].toQStringNoThrow();
- if (ctx->d()->callData->argc == 3) {
- if (ctx->d()->callData->args[2].isString()) {
- QString format = ctx->d()->callData->args[2].stringValue()->toQString();
+ QString dateString = ctx->args()[1].toQStringNoThrow();
+ if (ctx->argc() == 3) {
+ if (ctx->args()[2].isString()) {
+ QString format = ctx->args()[2].stringValue()->toQString();
tm = r->d()->locale.toTime(dateString, format);
- } else if (ctx->d()->callData->args[2].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[2].toNumber();
+ } else if (ctx->args()[2].isNumber()) {
+ quint32 intFormat = ctx->args()[2].toNumber();
QLocale::FormatType format = QLocale::FormatType(intFormat);
tm = r->d()->locale.toTime(dateString, format);
} else {
@@ -297,29 +297,29 @@ QV4::ReturnedValue QQmlDateExtension::method_fromLocaleDateString(QV4::CallConte
{
QV4::ExecutionEngine * const engine = ctx->d()->engine;
- if (ctx->d()->callData->argc == 1 && ctx->d()->callData->args[0].isString()) {
+ if (ctx->argc() == 1 && ctx->args()[0].isString()) {
QLocale locale;
- QString dateString = ctx->d()->callData->args[0].stringValue()->toQString();
+ QString dateString = ctx->args()[0].stringValue()->toQString();
QDate date = locale.toDate(dateString);
return QV4::Encode(engine->newDateObject(QDateTime(date)));
}
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 3 || !isLocaleObject(ctx->d()->callData->args[0]))
+ if (ctx->argc() < 1 || ctx->argc() > 3 || !isLocaleObject(ctx->args()[0]))
V4THROW_ERROR("Locale: Date.fromLocaleDateString(): Invalid arguments");
QV4::Scope scope(ctx);
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QLocale::FormatType enumFormat = QLocale::LongFormat;
QDate dt;
- QString dateString = ctx->d()->callData->args[1].toQStringNoThrow();
- if (ctx->d()->callData->argc == 3) {
- if (ctx->d()->callData->args[2].isString()) {
- QString format = ctx->d()->callData->args[2].stringValue()->toQString();
+ QString dateString = ctx->args()[1].toQStringNoThrow();
+ if (ctx->argc() == 3) {
+ if (ctx->args()[2].isString()) {
+ QString format = ctx->args()[2].stringValue()->toQString();
dt = r->d()->locale.toDate(dateString, format);
- } else if (ctx->d()->callData->args[2].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[2].toNumber();
+ } else if (ctx->args()[2].isNumber()) {
+ quint32 intFormat = ctx->args()[2].toNumber();
QLocale::FormatType format = QLocale::FormatType(intFormat);
dt = r->d()->locale.toDate(dateString, format);
} else {
@@ -334,7 +334,7 @@ QV4::ReturnedValue QQmlDateExtension::method_fromLocaleDateString(QV4::CallConte
QV4::ReturnedValue QQmlDateExtension::method_timeZoneUpdated(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 0)
+ if (ctx->argc() != 0)
V4THROW_ERROR("Locale: Date.timeZoneUpdated(): Invalid arguments");
QV4::DatePrototype::timezoneUpdated();
@@ -354,37 +354,37 @@ void QQmlNumberExtension::registerExtension(QV4::ExecutionEngine *engine)
QV4::ReturnedValue QQmlNumberExtension::method_toLocaleString(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc > 3)
+ if (ctx->argc() > 3)
V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
- double number = ctx->d()->callData->thisObject.toNumber();
+ double number = ctx->thisObject().toNumber();
- if (ctx->d()->callData->argc == 0) {
+ if (ctx->argc() == 0) {
// Use QLocale for standard toLocaleString() function
QLocale locale;
return ctx->d()->engine->newString(locale.toString(number))->asReturnedValue();
}
- if (!isLocaleObject(ctx->d()->callData->args[0]))
+ if (!isLocaleObject(ctx->args()[0]))
return QV4::NumberPrototype::method_toLocaleString(ctx); // Use the default Number toLocaleString()
QV4::Scope scope(ctx);
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
quint16 format = 'f';
- if (ctx->d()->callData->argc > 1) {
- if (!ctx->d()->callData->args[1].isString())
+ if (ctx->argc() > 1) {
+ if (!ctx->args()[1].isString())
V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
- QString fs = ctx->d()->callData->args[1].toQString();
+ QString fs = ctx->args()[1].toQString();
if (fs.length())
format = fs.at(0).unicode();
}
int prec = 2;
- if (ctx->d()->callData->argc > 2) {
- if (!ctx->d()->callData->args[2].isNumber())
+ if (ctx->argc() > 2) {
+ if (!ctx->args()[2].isNumber())
V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
- prec = ctx->d()->callData->args[2].toInt32();
+ prec = ctx->args()[2].toInt32();
}
return ctx->d()->engine->newString(r->d()->locale.toString(number, (char)format, prec))->asReturnedValue();
@@ -392,29 +392,29 @@ QV4::ReturnedValue QQmlNumberExtension::method_toLocaleString(QV4::CallContext *
QV4::ReturnedValue QQmlNumberExtension::method_toLocaleCurrencyString(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc > 2)
+ if (ctx->argc() > 2)
V4THROW_ERROR("Locale: Number.toLocaleCurrencyString(): Invalid arguments");
- double number = ctx->d()->callData->thisObject.toNumber();
+ double number = ctx->thisObject().toNumber();
- if (ctx->d()->callData->argc == 0) {
+ if (ctx->argc() == 0) {
// Use QLocale for standard toLocaleString() function
QLocale locale;
return ctx->d()->engine->newString(locale.toString(number))->asReturnedValue();
}
- if (!isLocaleObject(ctx->d()->callData->args[0]))
+ if (!isLocaleObject(ctx->args()[0]))
V4THROW_ERROR("Locale: Number.toLocaleCurrencyString(): Invalid arguments");
QV4::Scope scope(ctx);
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QString symbol;
- if (ctx->d()->callData->argc > 1) {
- if (!ctx->d()->callData->args[1].isString())
+ if (ctx->argc() > 1) {
+ if (!ctx->args()[1].isString())
V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
- symbol = ctx->d()->callData->args[1].toQStringNoThrow();
+ symbol = ctx->args()[1].toQStringNoThrow();
}
return ctx->d()->engine->newString(r->d()->locale.toCurrencyString(number, symbol))->asReturnedValue();
@@ -422,7 +422,7 @@ QV4::ReturnedValue QQmlNumberExtension::method_toLocaleCurrencyString(QV4::CallC
QV4::ReturnedValue QQmlNumberExtension::method_fromLocaleString(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 2)
+ if (ctx->argc() < 1 || ctx->argc() > 2)
V4THROW_ERROR("Locale: Number.fromLocaleString(): Invalid arguments");
int numberIdx = 0;
@@ -430,17 +430,17 @@ QV4::ReturnedValue QQmlNumberExtension::method_fromLocaleString(QV4::CallContext
QV4::Scope scope(ctx);
- if (ctx->d()->callData->argc == 2) {
- if (!isLocaleObject(ctx->d()->callData->args[0]))
+ if (ctx->argc() == 2) {
+ if (!isLocaleObject(ctx->args()[0]))
V4THROW_ERROR("Locale: Number.fromLocaleString(): Invalid arguments");
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
locale = r->d()->locale;
numberIdx = 1;
}
- QString ns = ctx->d()->callData->args[numberIdx].toQString();
+ QString ns = ctx->args()[numberIdx].toQString();
if (!ns.length())
return QV4::Encode(Q_QNAN);
@@ -531,12 +531,12 @@ QV4::ReturnedValue QQmlLocaleData::method_currencySymbol(QV4::CallContext *ctx)
if (!locale)
return QV4::Encode::undefined();
- if (ctx->d()->callData->argc > 1)
+ if (ctx->argc() > 1)
V4THROW_ERROR("Locale: currencySymbol(): Invalid arguments");
QLocale::CurrencySymbolFormat format = QLocale::CurrencySymbol;
- if (ctx->d()->callData->argc == 1) {
- quint32 intFormat = ctx->d()->callData->args[0].toNumber();
+ if (ctx->argc() == 1) {
+ quint32 intFormat = ctx->args()[0].toNumber();
format = QLocale::CurrencySymbolFormat(intFormat);
}
@@ -548,11 +548,11 @@ QV4::ReturnedValue QQmlLocaleData::method_ ##FUNC (QV4::CallContext *ctx) { \
QLocale *locale = getThisLocale(ctx); \
if (!locale) \
return QV4::Encode::undefined(); \
- if (ctx->d()->callData->argc > 1) \
+ if (ctx->argc() > 1) \
V4THROW_ERROR("Locale: " #FUNC "(): Invalid arguments"); \
QLocale::FormatType format = QLocale::LongFormat;\
- if (ctx->d()->callData->argc == 1) { \
- quint32 intFormat = ctx->d()->callData->args[0].toUInt32(); \
+ if (ctx->argc() == 1) { \
+ quint32 intFormat = ctx->args()[0].toUInt32(); \
format = QLocale::FormatType(intFormat); \
} \
return ctx->engine()->newString(locale-> FUNC (format))->asReturnedValue(); \
@@ -568,16 +568,16 @@ QV4::ReturnedValue QQmlLocaleData::method_ ## VARIABLE (QV4::CallContext *ctx) {
QLocale *locale = getThisLocale(ctx); \
if (!locale) \
return QV4::Encode::undefined(); \
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 2) \
+ if (ctx->argc() < 1 || ctx->argc() > 2) \
V4THROW_ERROR("Locale: " #VARIABLE "(): Invalid arguments"); \
QLocale::FormatType enumFormat = QLocale::LongFormat; \
- int idx = ctx->d()->callData->args[0].toInt32() + 1; \
+ int idx = ctx->args()[0].toInt32() + 1; \
if (idx < 1 || idx > 12) \
V4THROW_ERROR("Locale: Invalid month"); \
QString name; \
- if (ctx->d()->callData->argc == 2) { \
- if (ctx->d()->callData->args[1].isNumber()) { \
- quint32 intFormat = ctx->d()->callData->args[1].toUInt32(); \
+ if (ctx->argc() == 2) { \
+ if (ctx->args()[1].isNumber()) { \
+ quint32 intFormat = ctx->args()[1].toUInt32(); \
QLocale::FormatType format = QLocale::FormatType(intFormat); \
name = locale-> VARIABLE(idx, format); \
} else { \
@@ -595,17 +595,17 @@ QV4::ReturnedValue QQmlLocaleData::method_ ## VARIABLE (QV4::CallContext *ctx) {
QLocale *locale = getThisLocale(ctx); \
if (!locale) \
return QV4::Encode::undefined(); \
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 2) \
+ if (ctx->argc() < 1 || ctx->argc() > 2) \
V4THROW_ERROR("Locale: " #VARIABLE "(): Invalid arguments"); \
QLocale::FormatType enumFormat = QLocale::LongFormat; \
- int idx = ctx->d()->callData->args[0].toInt32(); \
+ int idx = ctx->args()[0].toInt32(); \
if (idx < 0 || idx > 7) \
V4THROW_ERROR("Locale: Invalid day"); \
if (idx == 0) idx = 7; \
QString name; \
- if (ctx->d()->callData->argc == 2) { \
- if (ctx->d()->callData->args[1].isNumber()) { \
- quint32 intFormat = ctx->d()->callData->args[1].toUInt32(); \
+ if (ctx->argc() == 2) { \
+ if (ctx->args()[1].isNumber()) { \
+ quint32 intFormat = ctx->args()[1].toUInt32(); \
QLocale::FormatType format = QLocale::FormatType(intFormat); \
name = locale-> VARIABLE(idx, format); \
} else { \
@@ -820,14 +820,14 @@ void QQmlLocale::registerStringLocaleCompare(QV4::ExecutionEngine *engine)
QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1 || (!ctx->d()->callData->args[0].isString() && !ctx->d()->callData->args[0].asStringObject()))
+ if (ctx->argc() != 1 || (!ctx->args()[0].isString() && !ctx->args()[0].asStringObject()))
return QV4::StringPrototype::method_localeCompare(ctx);
- if (!ctx->d()->callData->thisObject.isString() && !ctx->d()->callData->thisObject.asStringObject())
+ if (!ctx->thisObject().isString() && !ctx->thisObject().asStringObject())
return QV4::StringPrototype::method_localeCompare(ctx);
- QString thisString = ctx->d()->callData->thisObject.toQStringNoThrow();
- QString thatString = ctx->d()->callData->args[0].toQStringNoThrow();
+ QString thisString = ctx->thisObject().toQStringNoThrow();
+ QString thatString = ctx->args()[0].toQStringNoThrow();
return QV4::Encode(QString::localeAwareCompare(thisString, thatString));
}
diff --git a/src/qml/qml/qqmllocale_p.h b/src/qml/qml/qqmllocale_p.h
index 1b9afd1c81..169eab4dde 100644
--- a/src/qml/qml/qqmllocale_p.h
+++ b/src/qml/qml/qqmllocale_p.h
@@ -137,7 +137,7 @@ struct QQmlLocaleData : public QV4::Object
V4_NEEDS_DESTROY
static QLocale *getThisLocale(QV4::CallContext *ctx) {
- QV4::Object *o = ctx->d()->callData->thisObject.asObject();
+ QV4::Object *o = ctx->thisObject().asObject();
QQmlLocaleData *thisObject = o ? o->as<QQmlLocaleData>() : 0;
if (!thisObject) {
ctx->engine()->throwTypeError();
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp
index b80472559b..271b986a34 100644
--- a/src/qml/qml/qqmlvaluetypewrapper.cpp
+++ b/src/qml/qml/qqmlvaluetypewrapper.cpp
@@ -250,7 +250,7 @@ bool QQmlValueTypeWrapper::isEqual(const QVariant& value)
ReturnedValue QQmlValueTypeWrapper::method_toString(CallContext *ctx)
{
- Object *o = ctx->d()->callData->thisObject.asObject();
+ Object *o = ctx->thisObject().asObject();
if (!o)
return ctx->engine()->throwTypeError();
QQmlValueTypeWrapper *w = o->as<QQmlValueTypeWrapper>();
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 527e9c8446..e05d83364d 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -418,7 +418,7 @@ void NodeImpl::release()
ReturnedValue NodePrototype::method_get_nodeName(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return ctx->engine()->throwTypeError();
@@ -443,7 +443,7 @@ ReturnedValue NodePrototype::method_get_nodeName(CallContext *ctx)
ReturnedValue NodePrototype::method_get_nodeValue(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return ctx->engine()->throwTypeError();
@@ -462,7 +462,7 @@ ReturnedValue NodePrototype::method_get_nodeValue(CallContext *ctx)
ReturnedValue NodePrototype::method_get_nodeType(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return ctx->engine()->throwTypeError();
@@ -472,7 +472,7 @@ ReturnedValue NodePrototype::method_get_nodeType(CallContext *ctx)
ReturnedValue NodePrototype::method_get_parentNode(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return ctx->engine()->throwTypeError();
@@ -485,7 +485,7 @@ ReturnedValue NodePrototype::method_get_parentNode(CallContext *ctx)
ReturnedValue NodePrototype::method_get_childNodes(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return ctx->engine()->throwTypeError();
@@ -495,7 +495,7 @@ ReturnedValue NodePrototype::method_get_childNodes(CallContext *ctx)
ReturnedValue NodePrototype::method_get_firstChild(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return ctx->engine()->throwTypeError();
@@ -508,7 +508,7 @@ ReturnedValue NodePrototype::method_get_firstChild(CallContext *ctx)
ReturnedValue NodePrototype::method_get_lastChild(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return ctx->engine()->throwTypeError();
@@ -521,7 +521,7 @@ ReturnedValue NodePrototype::method_get_lastChild(CallContext *ctx)
ReturnedValue NodePrototype::method_get_previousSibling(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return ctx->engine()->throwTypeError();
@@ -543,7 +543,7 @@ ReturnedValue NodePrototype::method_get_previousSibling(CallContext *ctx)
ReturnedValue NodePrototype::method_get_nextSibling(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return ctx->engine()->throwTypeError();
@@ -565,7 +565,7 @@ ReturnedValue NodePrototype::method_get_nextSibling(CallContext *ctx)
ReturnedValue NodePrototype::method_get_attributes(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return ctx->engine()->throwTypeError();
@@ -656,7 +656,7 @@ ReturnedValue Attr::prototype(ExecutionEngine *engine)
ReturnedValue Attr::method_name(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return Encode::undefined();
@@ -666,7 +666,7 @@ ReturnedValue Attr::method_name(CallContext *ctx)
ReturnedValue Attr::method_value(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return Encode::undefined();
@@ -676,7 +676,7 @@ ReturnedValue Attr::method_value(CallContext *ctx)
ReturnedValue Attr::method_ownerElement(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return Encode::undefined();
@@ -686,7 +686,7 @@ ReturnedValue Attr::method_ownerElement(CallContext *ctx)
ReturnedValue CharacterData::method_length(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return Encode::undefined();
@@ -712,7 +712,7 @@ ReturnedValue CharacterData::prototype(ExecutionEngine *v4)
ReturnedValue Text::method_isElementContentWhitespace(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r) return Encode::undefined();
return Encode(r->d()->d->data.trimmed().isEmpty());
@@ -721,7 +721,7 @@ ReturnedValue Text::method_isElementContentWhitespace(CallContext *ctx)
ReturnedValue Text::method_wholeText(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return Encode::undefined();
@@ -956,7 +956,7 @@ ReturnedValue NodeList::create(ExecutionEngine *v4, NodeImpl *data)
ReturnedValue Document::method_documentElement(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r || r->d()->d->type != NodeImpl::Document)
return Encode::undefined();
@@ -966,7 +966,7 @@ ReturnedValue Document::method_documentElement(CallContext *ctx)
ReturnedValue Document::method_xmlStandalone(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r || r->d()->d->type != NodeImpl::Document)
return Encode::undefined();
@@ -976,7 +976,7 @@ ReturnedValue Document::method_xmlStandalone(CallContext *ctx)
ReturnedValue Document::method_xmlVersion(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r || r->d()->d->type != NodeImpl::Document)
return Encode::undefined();
@@ -986,7 +986,7 @@ ReturnedValue Document::method_xmlVersion(CallContext *ctx)
ReturnedValue Document::method_xmlEncoding(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r || r->d()->d->type != NodeImpl::Document)
return Encode::undefined();
@@ -1704,16 +1704,16 @@ void QQmlXMLHttpRequestCtor::setupProto()
ReturnedValue QQmlXMLHttpRequestCtor::method_open(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- if (ctx->d()->callData->argc < 2 || ctx->d()->callData->argc > 5)
+ if (ctx->argc() < 2 || ctx->argc() > 5)
V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
// Argument 0 - Method
- QString method = ctx->d()->callData->args[0].toQStringNoThrow().toUpper();
+ QString method = ctx->args()[0].toQStringNoThrow().toUpper();
if (method != QLatin1String("GET") &&
method != QLatin1String("PUT") &&
method != QLatin1String("HEAD") &&
@@ -1723,23 +1723,23 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_open(CallContext *ctx)
V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Unsupported HTTP method type");
// Argument 1 - URL
- QUrl url = QUrl(ctx->d()->callData->args[1].toQStringNoThrow());
+ QUrl url = QUrl(ctx->args()[1].toQStringNoThrow());
if (url.isRelative())
url = scope.engine->v8Engine->callingContext()->resolvedUrl(url);
bool async = true;
// Argument 2 - async (optional)
- if (ctx->d()->callData->argc > 2) {
- async = ctx->d()->callData->args[2].booleanValue();
+ if (ctx->argc() > 2) {
+ async = ctx->args()[2].booleanValue();
}
// Argument 3/4 - user/pass (optional)
QString username, password;
- if (ctx->d()->callData->argc > 3)
- username = ctx->d()->callData->args[3].toQStringNoThrow();
- if (ctx->d()->callData->argc > 4)
- password = ctx->d()->callData->args[4].toQStringNoThrow();
+ if (ctx->argc() > 3)
+ username = ctx->args()[3].toQStringNoThrow();
+ if (ctx->argc() > 4)
+ password = ctx->args()[4].toQStringNoThrow();
// Clear the fragment (if any)
url.setFragment(QString());
@@ -1748,26 +1748,26 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_open(CallContext *ctx)
if (!username.isNull()) url.setUserName(username);
if (!password.isNull()) url.setPassword(password);
- ScopedValue meObject(scope, constructMeObject(ctx->d()->callData->thisObject, scope.engine));
+ ScopedValue meObject(scope, constructMeObject(ctx->thisObject(), scope.engine));
return r->open(meObject, method, url, async ? QQmlXMLHttpRequest::AsynchronousLoad : QQmlXMLHttpRequest::SynchronousLoad);
}
ReturnedValue QQmlXMLHttpRequestCtor::method_setRequestHeader(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- if (ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 2)
V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
if (r->readyState() != QQmlXMLHttpRequest::Opened || r->sendFlag())
V4THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
- QString name = ctx->d()->callData->args[0].toQStringNoThrow();
- QString value = ctx->d()->callData->args[1].toQStringNoThrow();
+ QString name = ctx->args()[0].toQStringNoThrow();
+ QString value = ctx->args()[1].toQStringNoThrow();
// ### Check that name and value are well formed
@@ -1802,7 +1802,7 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_setRequestHeader(CallContext *ctx)
ReturnedValue QQmlXMLHttpRequestCtor::method_send(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
@@ -1812,34 +1812,34 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_send(CallContext *ctx)
V4THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
QByteArray data;
- if (ctx->d()->callData->argc > 0)
- data = ctx->d()->callData->args[0].toQStringNoThrow().toUtf8();
+ if (ctx->argc() > 0)
+ data = ctx->args()[0].toQStringNoThrow().toUtf8();
- ScopedValue meObject(scope, constructMeObject(ctx->d()->callData->thisObject, scope.engine));
+ ScopedValue meObject(scope, constructMeObject(ctx->thisObject(), scope.engine));
return r->send(meObject, data);
}
ReturnedValue QQmlXMLHttpRequestCtor::method_abort(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- ScopedValue meObject(scope, constructMeObject(ctx->d()->callData->thisObject, scope.engine));
+ ScopedValue meObject(scope, constructMeObject(ctx->thisObject(), scope.engine));
return r->abort(meObject);
}
ReturnedValue QQmlXMLHttpRequestCtor::method_getResponseHeader(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
if (r->readyState() != QQmlXMLHttpRequest::Loading &&
@@ -1847,18 +1847,18 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_getResponseHeader(CallContext *ctx)
r->readyState() != QQmlXMLHttpRequest::HeadersReceived)
V4THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
- return QV4::Encode(scope.engine->newString(r->header(ctx->d()->callData->args[0].toQStringNoThrow())));
+ return QV4::Encode(scope.engine->newString(r->header(ctx->args()[0].toQStringNoThrow())));
}
ReturnedValue QQmlXMLHttpRequestCtor::method_getAllResponseHeaders(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- if (ctx->d()->callData->argc != 0)
+ if (ctx->argc() != 0)
V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
if (r->readyState() != QQmlXMLHttpRequest::Loading &&
@@ -1873,7 +1873,7 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_getAllResponseHeaders(CallContext *
ReturnedValue QQmlXMLHttpRequestCtor::method_get_readyState(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
@@ -1884,7 +1884,7 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_readyState(CallContext *ctx)
ReturnedValue QQmlXMLHttpRequestCtor::method_get_status(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
@@ -1902,7 +1902,7 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_status(CallContext *ctx)
ReturnedValue QQmlXMLHttpRequestCtor::method_get_statusText(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
@@ -1920,7 +1920,7 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_statusText(CallContext *ctx)
ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseText(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
@@ -1935,7 +1935,7 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseText(CallContext *ctx)
ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseXML(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index 0878063f2e..cd1387b5b4 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -150,10 +150,10 @@ Returns true if \c object is a valid reference to a Qt or QML object, otherwise
*/
ReturnedValue QtObject::method_isQtObject(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc == 0)
+ if (ctx->argc() == 0)
return QV4::Encode(false);
- return QV4::Encode(ctx->d()->callData->args[0].as<QV4::QObjectWrapper>() != 0);
+ return QV4::Encode(ctx->args()[0].as<QV4::QObjectWrapper>() != 0);
}
/*!
@@ -164,14 +164,14 @@ All components should be in the range 0-1 inclusive.
*/
ReturnedValue QtObject::method_rgba(QV4::CallContext *ctx)
{
- int argCount = ctx->d()->callData->argc;
+ int argCount = ctx->argc();
if (argCount < 3 || argCount > 4)
V4THROW_ERROR("Qt.rgba(): Invalid arguments");
- double r = ctx->d()->callData->args[0].toNumber();
- double g = ctx->d()->callData->args[1].toNumber();
- double b = ctx->d()->callData->args[2].toNumber();
- double a = (argCount == 4) ? ctx->d()->callData->args[3].toNumber() : 1;
+ double r = ctx->args()[0].toNumber();
+ double g = ctx->args()[1].toNumber();
+ double b = ctx->args()[2].toNumber();
+ double a = (argCount == 4) ? ctx->args()[3].toNumber() : 1;
if (r < 0.0) r=0.0;
if (r > 1.0) r=1.0;
@@ -193,14 +193,14 @@ All components should be in the range 0-1 inclusive.
*/
ReturnedValue QtObject::method_hsla(QV4::CallContext *ctx)
{
- int argCount = ctx->d()->callData->argc;
+ int argCount = ctx->argc();
if (argCount < 3 || argCount > 4)
V4THROW_ERROR("Qt.hsla(): Invalid arguments");
- double h = ctx->d()->callData->args[0].toNumber();
- double s = ctx->d()->callData->args[1].toNumber();
- double l = ctx->d()->callData->args[2].toNumber();
- double a = (argCount == 4) ? ctx->d()->callData->args[3].toNumber() : 1;
+ double h = ctx->args()[0].toNumber();
+ double s = ctx->args()[1].toNumber();
+ double l = ctx->args()[2].toNumber();
+ double a = (argCount == 4) ? ctx->args()[3].toNumber() : 1;
if (h < 0.0) h=0.0;
if (h > 1.0) h=1.0;
@@ -224,12 +224,12 @@ basic type.
*/
ReturnedValue QtObject::method_colorEqual(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 2)
V4THROW_ERROR("Qt.colorEqual(): Invalid arguments");
bool ok = false;
- QVariant lhs = ctx->d()->engine->toVariant(ctx->d()->callData->args[0], -1);
+ QVariant lhs = ctx->d()->engine->toVariant(ctx->args()[0], -1);
if (lhs.userType() == QVariant::String) {
lhs = QQmlStringConverters::colorFromString(lhs.toString(), &ok);
if (!ok) {
@@ -239,7 +239,7 @@ ReturnedValue QtObject::method_colorEqual(QV4::CallContext *ctx)
V4THROW_ERROR("Qt.colorEqual(): Invalid arguments");
}
- QVariant rhs = ctx->engine()->toVariant(ctx->d()->callData->args[1], -1);
+ QVariant rhs = ctx->engine()->toVariant(ctx->args()[1], -1);
if (rhs.userType() == QVariant::String) {
rhs = QQmlStringConverters::colorFromString(rhs.toString(), &ok);
if (!ok) {
@@ -262,13 +262,13 @@ The returned object has \c x, \c y, \c width and \c height attributes with the g
*/
ReturnedValue QtObject::method_rect(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 4)
+ if (ctx->argc() != 4)
V4THROW_ERROR("Qt.rect(): Invalid arguments");
- double x = ctx->d()->callData->args[0].toNumber();
- double y = ctx->d()->callData->args[1].toNumber();
- double w = ctx->d()->callData->args[2].toNumber();
- double h = ctx->d()->callData->args[3].toNumber();
+ double x = ctx->args()[0].toNumber();
+ double y = ctx->args()[1].toNumber();
+ double w = ctx->args()[2].toNumber();
+ double h = ctx->args()[3].toNumber();
return ctx->engine()->fromVariant(QVariant::fromValue(QRectF(x, y, w, h)));
}
@@ -279,11 +279,11 @@ Returns a Point with the specified \c x and \c y coordinates.
*/
ReturnedValue QtObject::method_point(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 2)
V4THROW_ERROR("Qt.point(): Invalid arguments");
- double x = ctx->d()->callData->args[0].toNumber();
- double y = ctx->d()->callData->args[1].toNumber();
+ double x = ctx->args()[0].toNumber();
+ double y = ctx->args()[1].toNumber();
return ctx->engine()->fromVariant(QVariant::fromValue(QPointF(x, y)));
}
@@ -294,11 +294,11 @@ Returns a Size with the specified \c width and \c height.
*/
ReturnedValue QtObject::method_size(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 2)
V4THROW_ERROR("Qt.size(): Invalid arguments");
- double w = ctx->d()->callData->args[0].toNumber();
- double h = ctx->d()->callData->args[1].toNumber();
+ double w = ctx->args()[0].toNumber();
+ double h = ctx->args()[1].toNumber();
return ctx->engine()->fromVariant(QVariant::fromValue(QSizeF(w, h)));
}
@@ -313,12 +313,12 @@ Invalid keys will be ignored.
*/
ReturnedValue QtObject::method_font(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1 || !ctx->d()->callData->args[0].isObject())
+ if (ctx->argc() != 1 || !ctx->args()[0].isObject())
V4THROW_ERROR("Qt.font(): Invalid arguments");
QV4::ExecutionEngine *v4 = ctx->d()->engine;
bool ok = false;
- QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QFont, QQmlV4Handle(ctx->d()->callData->args[0]), v4, &ok);
+ QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QFont, QQmlV4Handle(ctx->args()[0]), v4, &ok);
if (!ok)
V4THROW_ERROR("Qt.font(): Invalid argument: no valid font subproperties specified");
return ctx->engine()->fromVariant(v);
@@ -332,12 +332,12 @@ Returns a Vector2D with the specified \c x and \c y.
*/
ReturnedValue QtObject::method_vector2d(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 2)
V4THROW_ERROR("Qt.vector2d(): Invalid arguments");
float xy[3]; // qvector2d uses float internally
- xy[0] = ctx->d()->callData->args[0].toNumber();
- xy[1] = ctx->d()->callData->args[1].toNumber();
+ xy[0] = ctx->args()[0].toNumber();
+ xy[1] = ctx->args()[1].toNumber();
const void *params[] = { xy };
return ctx->engine()->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QVector2D, 1, params));
@@ -349,13 +349,13 @@ Returns a Vector3D with the specified \c x, \c y and \c z.
*/
ReturnedValue QtObject::method_vector3d(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 3)
+ if (ctx->argc() != 3)
V4THROW_ERROR("Qt.vector3d(): Invalid arguments");
float xyz[3]; // qvector3d uses float internally
- xyz[0] = ctx->d()->callData->args[0].toNumber();
- xyz[1] = ctx->d()->callData->args[1].toNumber();
- xyz[2] = ctx->d()->callData->args[2].toNumber();
+ xyz[0] = ctx->args()[0].toNumber();
+ xyz[1] = ctx->args()[1].toNumber();
+ xyz[2] = ctx->args()[2].toNumber();
const void *params[] = { xyz };
return ctx->engine()->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QVector3D, 1, params));
@@ -367,14 +367,14 @@ Returns a Vector4D with the specified \c x, \c y, \c z and \c w.
*/
ReturnedValue QtObject::method_vector4d(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 4)
+ if (ctx->argc() != 4)
V4THROW_ERROR("Qt.vector4d(): Invalid arguments");
float xyzw[4]; // qvector4d uses float internally
- xyzw[0] = ctx->d()->callData->args[0].toNumber();
- xyzw[1] = ctx->d()->callData->args[1].toNumber();
- xyzw[2] = ctx->d()->callData->args[2].toNumber();
- xyzw[3] = ctx->d()->callData->args[3].toNumber();
+ xyzw[0] = ctx->args()[0].toNumber();
+ xyzw[1] = ctx->args()[1].toNumber();
+ xyzw[2] = ctx->args()[2].toNumber();
+ xyzw[3] = ctx->args()[3].toNumber();
const void *params[] = { xyzw };
return ctx->engine()->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QVector4D, 1, params));
@@ -386,14 +386,14 @@ Returns a Quaternion with the specified \c scalar, \c x, \c y, and \c z.
*/
ReturnedValue QtObject::method_quaternion(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 4)
+ if (ctx->argc() != 4)
V4THROW_ERROR("Qt.quaternion(): Invalid arguments");
qreal sxyz[4]; // qquaternion uses qreal internally
- sxyz[0] = ctx->d()->callData->args[0].toNumber();
- sxyz[1] = ctx->d()->callData->args[1].toNumber();
- sxyz[2] = ctx->d()->callData->args[2].toNumber();
- sxyz[3] = ctx->d()->callData->args[3].toNumber();
+ sxyz[0] = ctx->args()[0].toNumber();
+ sxyz[1] = ctx->args()[1].toNumber();
+ sxyz[2] = ctx->args()[2].toNumber();
+ sxyz[3] = ctx->args()[3].toNumber();
const void *params[] = { sxyz };
return ctx->engine()->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QQuaternion, 1, params));
@@ -410,34 +410,34 @@ ReturnedValue QtObject::method_matrix4x4(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->d()->engine;
- if (ctx->d()->callData->argc == 1 && ctx->d()->callData->args[0].isObject()) {
+ if (ctx->argc() == 1 && ctx->args()[0].isObject()) {
bool ok = false;
- QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QMatrix4x4, QQmlV4Handle(ctx->d()->callData->args[0]), v4, &ok);
+ QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QMatrix4x4, QQmlV4Handle(ctx->args()[0]), v4, &ok);
if (!ok)
V4THROW_ERROR("Qt.matrix4x4(): Invalid argument: not a valid matrix4x4 values array");
return ctx->engine()->fromVariant(v);
}
- if (ctx->d()->callData->argc != 16)
+ if (ctx->argc() != 16)
V4THROW_ERROR("Qt.matrix4x4(): Invalid arguments");
qreal vals[16]; // qmatrix4x4 uses qreal internally
- vals[0] = ctx->d()->callData->args[0].toNumber();
- vals[1] = ctx->d()->callData->args[1].toNumber();
- vals[2] = ctx->d()->callData->args[2].toNumber();
- vals[3] = ctx->d()->callData->args[3].toNumber();
- vals[4] = ctx->d()->callData->args[4].toNumber();
- vals[5] = ctx->d()->callData->args[5].toNumber();
- vals[6] = ctx->d()->callData->args[6].toNumber();
- vals[7] = ctx->d()->callData->args[7].toNumber();
- vals[8] = ctx->d()->callData->args[8].toNumber();
- vals[9] = ctx->d()->callData->args[9].toNumber();
- vals[10] = ctx->d()->callData->args[10].toNumber();
- vals[11] = ctx->d()->callData->args[11].toNumber();
- vals[12] = ctx->d()->callData->args[12].toNumber();
- vals[13] = ctx->d()->callData->args[13].toNumber();
- vals[14] = ctx->d()->callData->args[14].toNumber();
- vals[15] = ctx->d()->callData->args[15].toNumber();
+ vals[0] = ctx->args()[0].toNumber();
+ vals[1] = ctx->args()[1].toNumber();
+ vals[2] = ctx->args()[2].toNumber();
+ vals[3] = ctx->args()[3].toNumber();
+ vals[4] = ctx->args()[4].toNumber();
+ vals[5] = ctx->args()[5].toNumber();
+ vals[6] = ctx->args()[6].toNumber();
+ vals[7] = ctx->args()[7].toNumber();
+ vals[8] = ctx->args()[8].toNumber();
+ vals[9] = ctx->args()[9].toNumber();
+ vals[10] = ctx->args()[10].toNumber();
+ vals[11] = ctx->args()[11].toNumber();
+ vals[12] = ctx->args()[12].toNumber();
+ vals[13] = ctx->args()[13].toNumber();
+ vals[14] = ctx->args()[14].toNumber();
+ vals[15] = ctx->args()[15].toNumber();
const void *params[] = { vals };
return ctx->engine()->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QMatrix4x4, 1, params));
@@ -459,10 +459,10 @@ If \c factor is not supplied, returns a color 50% lighter than \c baseColor (fac
*/
ReturnedValue QtObject::method_lighter(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1 && ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 1 && ctx->argc() != 2)
V4THROW_ERROR("Qt.lighter(): Invalid arguments");
- QVariant v = ctx->engine()->toVariant(ctx->d()->callData->args[0], -1);
+ QVariant v = ctx->engine()->toVariant(ctx->args()[0], -1);
if (v.userType() == QVariant::String) {
bool ok = false;
v = QQmlStringConverters::colorFromString(v.toString(), &ok);
@@ -474,8 +474,8 @@ ReturnedValue QtObject::method_lighter(QV4::CallContext *ctx)
}
qreal factor = 1.5;
- if (ctx->d()->callData->argc == 2)
- factor = ctx->d()->callData->args[1].toNumber();
+ if (ctx->argc() == 2)
+ factor = ctx->args()[1].toNumber();
return ctx->engine()->fromVariant(QQml_colorProvider()->lighter(v, factor));
}
@@ -497,10 +497,10 @@ If \c factor is not supplied, returns a color 50% darker than \c baseColor (fact
*/
ReturnedValue QtObject::method_darker(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1 && ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 1 && ctx->argc() != 2)
V4THROW_ERROR("Qt.darker(): Invalid arguments");
- QVariant v = ctx->engine()->toVariant(ctx->d()->callData->args[0], -1);
+ QVariant v = ctx->engine()->toVariant(ctx->args()[0], -1);
if (v.userType() == QVariant::String) {
bool ok = false;
v = QQmlStringConverters::colorFromString(v.toString(), &ok);
@@ -512,8 +512,8 @@ ReturnedValue QtObject::method_darker(QV4::CallContext *ctx)
}
qreal factor = 2.0;
- if (ctx->d()->callData->argc == 2)
- factor = ctx->d()->callData->args[1].toNumber();
+ if (ctx->argc() == 2)
+ factor = ctx->args()[1].toNumber();
return ctx->engine()->fromVariant(QQml_colorProvider()->darker(v, factor));
}
@@ -544,11 +544,11 @@ ReturnedValue QtObject::method_darker(QV4::CallContext *ctx)
*/
ReturnedValue QtObject::method_tint(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 2)
V4THROW_ERROR("Qt.tint(): Invalid arguments");
// base color
- QVariant v1 = ctx->engine()->toVariant(ctx->d()->callData->args[0], -1);
+ QVariant v1 = ctx->engine()->toVariant(ctx->args()[0], -1);
if (v1.userType() == QVariant::String) {
bool ok = false;
v1 = QQmlStringConverters::colorFromString(v1.toString(), &ok);
@@ -560,7 +560,7 @@ ReturnedValue QtObject::method_tint(QV4::CallContext *ctx)
}
// tint color
- QVariant v2 = ctx->engine()->toVariant(ctx->d()->callData->args[1], -1);
+ QVariant v2 = ctx->engine()->toVariant(ctx->args()[1], -1);
if (v2.userType() == QVariant::String) {
bool ok = false;
v2 = QQmlStringConverters::colorFromString(v2.toString(), &ok);
@@ -592,20 +592,20 @@ If \a format is not specified, \a date is formatted using
*/
ReturnedValue QtObject::method_formatDate(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 2)
+ if (ctx->argc() < 1 || ctx->argc() > 2)
V4THROW_ERROR("Qt.formatDate(): Invalid arguments");
QV4::Scope scope(ctx);
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
- QDate date = ctx->engine()->toVariant(ctx->d()->callData->args[0], -1).toDateTime().date();
+ QDate date = ctx->engine()->toVariant(ctx->args()[0], -1).toDateTime().date();
QString formattedDate;
- if (ctx->d()->callData->argc == 2) {
- QV4::ScopedString s(scope, ctx->d()->callData->args[1]);
+ if (ctx->argc() == 2) {
+ QV4::ScopedString s(scope, ctx->args()[1]);
if (s) {
QString format = s->toQString();
formattedDate = date.toString(format);
- } else if (ctx->d()->callData->args[1].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[1].asDouble();
+ } else if (ctx->args()[1].isNumber()) {
+ quint32 intFormat = ctx->args()[1].asDouble();
Qt::DateFormat format = Qt::DateFormat(intFormat);
formattedDate = date.toString(format);
} else {
@@ -635,26 +635,26 @@ If \a format is not specified, \a time is formatted using
*/
ReturnedValue QtObject::method_formatTime(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 2)
+ if (ctx->argc() < 1 || ctx->argc() > 2)
V4THROW_ERROR("Qt.formatTime(): Invalid arguments");
QV4::Scope scope(ctx);
- QVariant argVariant = ctx->engine()->toVariant(ctx->d()->callData->args[0], -1);
+ QVariant argVariant = ctx->engine()->toVariant(ctx->args()[0], -1);
QTime time;
- if (ctx->d()->callData->args[0].asDateObject() || (argVariant.type() == QVariant::String))
+ if (ctx->args()[0].asDateObject() || (argVariant.type() == QVariant::String))
time = argVariant.toDateTime().time();
else // if (argVariant.type() == QVariant::Time), or invalid.
time = argVariant.toTime();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
QString formattedTime;
- if (ctx->d()->callData->argc == 2) {
- QV4::ScopedString s(scope, ctx->d()->callData->args[1]);
+ if (ctx->argc() == 2) {
+ QV4::ScopedString s(scope, ctx->args()[1]);
if (s) {
QString format = s->toQString();
formattedTime = time.toString(format);
- } else if (ctx->d()->callData->args[1].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[1].asDouble();
+ } else if (ctx->args()[1].isNumber()) {
+ quint32 intFormat = ctx->args()[1].asDouble();
Qt::DateFormat format = Qt::DateFormat(intFormat);
formattedTime = time.toString(format);
} else {
@@ -759,20 +759,20 @@ with the \a format values below to produce the following results:
*/
ReturnedValue QtObject::method_formatDateTime(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 2)
+ if (ctx->argc() < 1 || ctx->argc() > 2)
V4THROW_ERROR("Qt.formatDateTime(): Invalid arguments");
QV4::Scope scope(ctx);
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
- QDateTime dt = ctx->engine()->toVariant(ctx->d()->callData->args[0], -1).toDateTime();
+ QDateTime dt = ctx->engine()->toVariant(ctx->args()[0], -1).toDateTime();
QString formattedDt;
- if (ctx->d()->callData->argc == 2) {
- QV4::ScopedString s(scope, ctx->d()->callData->args[1]);
+ if (ctx->argc() == 2) {
+ QV4::ScopedString s(scope, ctx->args()[1]);
if (s) {
QString format = s->toQString();
formattedDt = dt.toString(format);
- } else if (ctx->d()->callData->args[1].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[1].asDouble();
+ } else if (ctx->args()[1].isNumber()) {
+ quint32 intFormat = ctx->args()[1].asDouble();
Qt::DateFormat format = Qt::DateFormat(intFormat);
formattedDt = dt.toString(format);
} else {
@@ -791,7 +791,7 @@ Attempts to open the specified \c target url in an external application, based o
*/
ReturnedValue QtObject::method_openUrlExternally(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
return QV4::Encode(false);
QUrl url(Value::fromReturnedValue(method_resolvedUrl(ctx)).toQStringNoThrow());
@@ -806,7 +806,7 @@ ReturnedValue QtObject::method_resolvedUrl(QV4::CallContext *ctx)
{
QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- QUrl url = ctx->engine()->toVariant(ctx->d()->callData->args[0], -1).toUrl();
+ QUrl url = ctx->engine()->toVariant(ctx->args()[0], -1).toUrl();
QQmlEngine *e = v8engine->engine();
QQmlEnginePrivate *p = 0;
if (e) p = QQmlEnginePrivate::get(e);
@@ -827,7 +827,7 @@ Returns a list of the font families available to the application.
*/
ReturnedValue QtObject::method_fontFamilies(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 0)
+ if (ctx->argc() != 0)
V4THROW_ERROR("Qt.fontFamilies(): Invalid arguments");
return ctx->engine()->fromVariant(QVariant(QQml_guiProvider()->fontFamilies()));
@@ -839,10 +839,10 @@ Returns a hex string of the md5 hash of \c data.
*/
ReturnedValue QtObject::method_md5(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("Qt.md5(): Invalid arguments");
- QByteArray data = ctx->d()->callData->args[0].toQStringNoThrow().toUtf8();
+ QByteArray data = ctx->args()[0].toQStringNoThrow().toUtf8();
QByteArray result = QCryptographicHash::hash(data, QCryptographicHash::Md5);
return ctx->d()->engine->newString(QLatin1String(result.toHex()))->asReturnedValue();
}
@@ -853,10 +853,10 @@ Binary to ASCII - this function returns a base64 encoding of \c data.
*/
ReturnedValue QtObject::method_btoa(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("Qt.btoa(): Invalid arguments");
- QByteArray data = ctx->d()->callData->args[0].toQStringNoThrow().toUtf8();
+ QByteArray data = ctx->args()[0].toQStringNoThrow().toUtf8();
return ctx->d()->engine->newString(QLatin1String(data.toBase64()))->asReturnedValue();
}
@@ -867,10 +867,10 @@ ASCII to binary - this function returns a base64 decoding of \c data.
*/
ReturnedValue QtObject::method_atob(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("Qt.atob(): Invalid arguments");
- QByteArray data = ctx->d()->callData->args[0].toQStringNoThrow().toLatin1();
+ QByteArray data = ctx->args()[0].toQStringNoThrow().toLatin1();
return ctx->d()->engine->newString(QString::fromUtf8(QByteArray::fromBase64(data)))->asReturnedValue();
}
@@ -915,7 +915,7 @@ See \l {Dynamic QML Object Creation from JavaScript} for more information on usi
ReturnedValue QtObject::method_createQmlObject(CallContext *ctx)
{
Scope scope(ctx);
- if (ctx->d()->callData->argc < 2 || ctx->d()->callData->argc > 3)
+ if (ctx->argc() < 2 || ctx->argc() > 3)
V4THROW_ERROR("Qt.createQmlObject(): Invalid arguments");
struct Error {
@@ -957,13 +957,13 @@ ReturnedValue QtObject::method_createQmlObject(CallContext *ctx)
effectiveContext = context->asQQmlContext();
Q_ASSERT(effectiveContext);
- QString qml = ctx->d()->callData->args[0].toQStringNoThrow();
+ QString qml = ctx->args()[0].toQStringNoThrow();
if (qml.isEmpty())
return QV4::Encode::null();
QUrl url;
- if (ctx->d()->callData->argc > 2)
- url = QUrl(ctx->d()->callData->args[2].toQStringNoThrow());
+ if (ctx->argc() > 2)
+ url = QUrl(ctx->args()[2].toQStringNoThrow());
else
url = QUrl(QLatin1String("inline"));
@@ -971,7 +971,7 @@ ReturnedValue QtObject::method_createQmlObject(CallContext *ctx)
url = context->resolvedUrl(url);
QObject *parentArg = 0;
- QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, ctx->d()->callData->args[1]);
+ QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, ctx->args()[1]);
if (!!qobjectWrapper)
parentArg = qobjectWrapper->object();
if (!parentArg)
@@ -1047,7 +1047,7 @@ use \l{QtQml::Qt::createQmlObject()}{Qt.createQmlObject()}.
*/
ReturnedValue QtObject::method_createComponent(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 3)
+ if (ctx->argc() < 1 || ctx->argc() > 3)
return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
Scope scope(ctx);
@@ -1061,7 +1061,7 @@ ReturnedValue QtObject::method_createComponent(CallContext *ctx)
if (context->isPragmaLibraryContext)
effectiveContext = 0;
- QString arg = ctx->d()->callData->args[0].toQStringNoThrow();
+ QString arg = ctx->args()[0].toQStringNoThrow();
if (arg.isEmpty())
return QV4::Encode::null();
@@ -1069,23 +1069,23 @@ ReturnedValue QtObject::method_createComponent(CallContext *ctx)
QObject *parentArg = 0;
int consumedCount = 1;
- if (ctx->d()->callData->argc > 1) {
- ScopedValue lastArg(scope, ctx->d()->callData->args[ctx->d()->callData->argc-1]);
+ if (ctx->argc() > 1) {
+ ScopedValue lastArg(scope, ctx->args()[ctx->argc()-1]);
// The second argument could be the mode enum
- if (ctx->d()->callData->args[1].isInteger()) {
- int mode = ctx->d()->callData->args[1].integerValue();
+ if (ctx->args()[1].isInteger()) {
+ int mode = ctx->args()[1].integerValue();
if (mode != int(QQmlComponent::PreferSynchronous) && mode != int(QQmlComponent::Asynchronous))
return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
compileMode = QQmlComponent::CompilationMode(mode);
consumedCount += 1;
} else {
// The second argument could be the parent only if there are exactly two args
- if ((ctx->d()->callData->argc != 2) || !(lastArg->isObject() || lastArg->isNull()))
+ if ((ctx->argc() != 2) || !(lastArg->isObject() || lastArg->isNull()))
return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
}
- if (consumedCount < ctx->d()->callData->argc) {
+ if (consumedCount < ctx->argc()) {
if (lastArg->isObject()) {
Scoped<QObjectWrapper> qobjectWrapper(scope, lastArg);
if (qobjectWrapper)
@@ -1132,13 +1132,13 @@ ReturnedValue QtObject::method_createComponent(CallContext *ctx)
ReturnedValue QtObject::method_locale(CallContext *ctx)
{
QString code;
- if (ctx->d()->callData->argc > 1)
+ if (ctx->argc() > 1)
V4THROW_ERROR("locale() requires 0 or 1 argument");
- if (ctx->d()->callData->argc == 1 && !ctx->d()->callData->args[0].isString())
+ if (ctx->argc() == 1 && !ctx->args()[0].isString())
V4THROW_TYPE("locale(): argument (locale code) must be a string");
- if (ctx->d()->callData->argc == 1)
- code = ctx->d()->callData->args[0].toQStringNoThrow();
+ if (ctx->argc() == 1)
+ code = ctx->args()[0].toQStringNoThrow();
return QQmlLocale::locale(ctx->engine(), code);
}
@@ -1219,9 +1219,9 @@ DEFINE_OBJECT_VTABLE(QQmlBindingFunction);
*/
ReturnedValue QtObject::method_binding(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("binding() requires 1 argument");
- QV4::FunctionObject *f = ctx->d()->callData->args[0].asFunctionObject();
+ QV4::FunctionObject *f = ctx->args()[0].asFunctionObject();
if (!f)
V4THROW_TYPE("binding(): argument (binding expression) must be a function");
@@ -1232,7 +1232,7 @@ ReturnedValue QtObject::method_binding(CallContext *ctx)
ReturnedValue QtObject::method_get_platform(CallContext *ctx)
{
// ### inefficient. Should be just a value based getter
- Object *o = ctx->d()->callData->thisObject.asObject();
+ Object *o = ctx->thisObject().asObject();
if (!o)
return ctx->engine()->throwTypeError();
QtObject *qt = o->as<QtObject>();
@@ -1249,7 +1249,7 @@ ReturnedValue QtObject::method_get_platform(CallContext *ctx)
ReturnedValue QtObject::method_get_application(CallContext *ctx)
{
// ### inefficient. Should be just a value based getter
- Object *o = ctx->d()->callData->thisObject.asObject();
+ Object *o = ctx->thisObject().asObject();
if (!o)
return ctx->engine()->throwTypeError();
QtObject *qt = o->as<QtObject>();
@@ -1340,14 +1340,14 @@ static QV4::ReturnedValue writeToConsole(ConsoleLogTypes logType, CallContext *c
QString result;
QV4::ExecutionEngine *v4 = ctx->d()->engine;
- for (int i = 0; i < ctx->d()->callData->argc; ++i) {
+ for (int i = 0; i < ctx->argc(); ++i) {
if (i != 0)
result.append(QLatin1Char(' '));
- if (ctx->d()->callData->args[i].asArrayObject())
- result.append(QStringLiteral("[") + ctx->d()->callData->args[i].toQStringNoThrow() + QStringLiteral("]"));
+ if (ctx->args()[i].asArrayObject())
+ result.append(QStringLiteral("[") + ctx->args()[i].toQStringNoThrow() + QStringLiteral("]"));
else
- result.append(ctx->d()->callData->args[i].toQStringNoThrow());
+ result.append(ctx->args()[i].toQStringNoThrow());
}
if (printStack) {
@@ -1442,24 +1442,24 @@ QV4::ReturnedValue ConsoleObject::method_profileEnd(CallContext *ctx)
QV4::ReturnedValue ConsoleObject::method_time(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("console.time(): Invalid arguments");
QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- QString name = ctx->d()->callData->args[0].toQStringNoThrow();
+ QString name = ctx->args()[0].toQStringNoThrow();
v8engine->startTimer(name);
return QV4::Encode::undefined();
}
QV4::ReturnedValue ConsoleObject::method_timeEnd(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("console.time(): Invalid arguments");
QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- QString name = ctx->d()->callData->args[0].toQStringNoThrow();
+ QString name = ctx->args()[0].toQStringNoThrow();
bool wasRunning;
qint64 elapsed = v8engine->stopTimer(name, &wasRunning);
if (wasRunning) {
@@ -1472,8 +1472,8 @@ QV4::ReturnedValue ConsoleObject::method_count(CallContext *ctx)
{
// first argument: name to print. Ignore any additional arguments
QString name;
- if (ctx->d()->callData->argc > 0)
- name = ctx->d()->callData->args[0].toQStringNoThrow();
+ if (ctx->argc() > 0)
+ name = ctx->args()[0].toQStringNoThrow();
QV4::ExecutionEngine *v4 = ctx->d()->engine;
QV8Engine *v8engine = ctx->d()->engine->v8Engine;
@@ -1494,7 +1494,7 @@ QV4::ReturnedValue ConsoleObject::method_count(CallContext *ctx)
QV4::ReturnedValue ConsoleObject::method_trace(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 0)
+ if (ctx->argc() != 0)
V4THROW_ERROR("console.trace(): Invalid arguments");
QV4::ExecutionEngine *v4 = ctx->d()->engine;
@@ -1516,18 +1516,18 @@ QV4::ReturnedValue ConsoleObject::method_warn(CallContext *ctx)
QV4::ReturnedValue ConsoleObject::method_assert(CallContext *ctx)
{
- if (ctx->d()->callData->argc == 0)
+ if (ctx->argc() == 0)
V4THROW_ERROR("console.assert(): Missing argument");
QV4::ExecutionEngine *v4 = ctx->d()->engine;
- if (!ctx->d()->callData->args[0].toBoolean()) {
+ if (!ctx->args()[0].toBoolean()) {
QString message;
- for (int i = 1; i < ctx->d()->callData->argc; ++i) {
+ for (int i = 1; i < ctx->argc(); ++i) {
if (i != 1)
message.append(QLatin1Char(' '));
- message.append(ctx->d()->callData->args[i].toQStringNoThrow());
+ message.append(ctx->args()[i].toQStringNoThrow());
}
QString stack = jsStack(v4);
@@ -1543,7 +1543,7 @@ QV4::ReturnedValue ConsoleObject::method_assert(CallContext *ctx)
QV4::ReturnedValue ConsoleObject::method_exception(CallContext *ctx)
{
- if (ctx->d()->callData->argc == 0)
+ if (ctx->argc() == 0)
V4THROW_ERROR("console.exception(): Missing argument");
writeToConsole(Error, ctx, true);
@@ -1601,29 +1601,29 @@ void QV4::GlobalExtensions::init(QQmlEngine *qmlEngine, Object *globalObject)
*/
ReturnedValue GlobalExtensions::method_qsTranslate(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 2)
+ if (ctx->argc() < 2)
V4THROW_ERROR("qsTranslate() requires at least two arguments");
- if (!ctx->d()->callData->args[0].isString())
+ if (!ctx->args()[0].isString())
V4THROW_ERROR("qsTranslate(): first argument (context) must be a string");
- if (!ctx->d()->callData->args[1].isString())
+ if (!ctx->args()[1].isString())
V4THROW_ERROR("qsTranslate(): second argument (sourceText) must be a string");
- if ((ctx->d()->callData->argc > 2) && !ctx->d()->callData->args[2].isString())
+ if ((ctx->argc() > 2) && !ctx->args()[2].isString())
V4THROW_ERROR("qsTranslate(): third argument (disambiguation) must be a string");
- QString context = ctx->d()->callData->args[0].toQStringNoThrow();
- QString text = ctx->d()->callData->args[1].toQStringNoThrow();
+ QString context = ctx->args()[0].toQStringNoThrow();
+ QString text = ctx->args()[1].toQStringNoThrow();
QString comment;
- if (ctx->d()->callData->argc > 2) comment = ctx->d()->callData->args[2].toQStringNoThrow();
+ if (ctx->argc() > 2) comment = ctx->args()[2].toQStringNoThrow();
int i = 3;
- if (ctx->d()->callData->argc > i && ctx->d()->callData->args[i].isString()) {
+ if (ctx->argc() > i && ctx->args()[i].isString()) {
qWarning("qsTranslate(): specifying the encoding as fourth argument is deprecated");
++i;
}
int n = -1;
- if (ctx->d()->callData->argc > i)
- n = ctx->d()->callData->args[i].toInt32();
+ if (ctx->argc() > i)
+ n = ctx->args()[i].toInt32();
QString result = QCoreApplication::translate(context.toUtf8().constData(),
text.toUtf8().constData(),
@@ -1657,9 +1657,9 @@ ReturnedValue GlobalExtensions::method_qsTranslate(CallContext *ctx)
*/
ReturnedValue GlobalExtensions::method_qsTranslateNoOp(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 2)
+ if (ctx->argc() < 2)
return QV4::Encode::undefined();
- return ctx->d()->callData->args[1].asReturnedValue();
+ return ctx->args()[1].asReturnedValue();
}
/*!
@@ -1681,13 +1681,13 @@ ReturnedValue GlobalExtensions::method_qsTranslateNoOp(CallContext *ctx)
*/
ReturnedValue GlobalExtensions::method_qsTr(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1)
+ if (ctx->argc() < 1)
V4THROW_ERROR("qsTr() requires at least one argument");
- if (!ctx->d()->callData->args[0].isString())
+ if (!ctx->args()[0].isString())
V4THROW_ERROR("qsTr(): first argument (sourceText) must be a string");
- if ((ctx->d()->callData->argc > 1) && !ctx->d()->callData->args[1].isString())
+ if ((ctx->argc() > 1) && !ctx->args()[1].isString())
V4THROW_ERROR("qsTr(): second argument (disambiguation) must be a string");
- if ((ctx->d()->callData->argc > 2) && !ctx->d()->callData->args[2].isNumber())
+ if ((ctx->argc() > 2) && !ctx->args()[2].isNumber())
V4THROW_ERROR("qsTr(): third argument (n) must be a number");
Scope scope(ctx);
@@ -1719,13 +1719,13 @@ ReturnedValue GlobalExtensions::method_qsTr(CallContext *ctx)
}
}
- QString text = ctx->d()->callData->args[0].toQStringNoThrow();
+ QString text = ctx->args()[0].toQStringNoThrow();
QString comment;
- if (ctx->d()->callData->argc > 1)
- comment = ctx->d()->callData->args[1].toQStringNoThrow();
+ if (ctx->argc() > 1)
+ comment = ctx->args()[1].toQStringNoThrow();
int n = -1;
- if (ctx->d()->callData->argc > 2)
- n = ctx->d()->callData->args[2].toInt32();
+ if (ctx->argc() > 2)
+ n = ctx->args()[2].toInt32();
QString result = QCoreApplication::translate(context.toUtf8().constData(), text.toUtf8().constData(),
comment.toUtf8().constData(), n);
@@ -1757,9 +1757,9 @@ ReturnedValue GlobalExtensions::method_qsTr(CallContext *ctx)
*/
ReturnedValue GlobalExtensions::method_qsTrNoOp(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1)
+ if (ctx->argc() < 1)
return QV4::Encode::undefined();
- return ctx->d()->callData->args[0].asReturnedValue();
+ return ctx->args()[0].asReturnedValue();
}
/*!
@@ -1794,18 +1794,18 @@ ReturnedValue GlobalExtensions::method_qsTrNoOp(CallContext *ctx)
*/
ReturnedValue GlobalExtensions::method_qsTrId(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1)
+ if (ctx->argc() < 1)
V4THROW_ERROR("qsTrId() requires at least one argument");
- if (!ctx->d()->callData->args[0].isString())
+ if (!ctx->args()[0].isString())
V4THROW_TYPE("qsTrId(): first argument (id) must be a string");
- if (ctx->d()->callData->argc > 1 && !ctx->d()->callData->args[1].isNumber())
+ if (ctx->argc() > 1 && !ctx->args()[1].isNumber())
V4THROW_TYPE("qsTrId(): second argument (n) must be a number");
int n = -1;
- if (ctx->d()->callData->argc > 1)
- n = ctx->d()->callData->args[1].toInt32();
+ if (ctx->argc() > 1)
+ n = ctx->args()[1].toInt32();
- return ctx->d()->engine->newString(qtTrId(ctx->d()->callData->args[0].toQStringNoThrow().toUtf8().constData(), n))->asReturnedValue();
+ return ctx->d()->engine->newString(qtTrId(ctx->args()[0].toQStringNoThrow().toUtf8().constData(), n))->asReturnedValue();
}
/*!
@@ -1826,9 +1826,9 @@ ReturnedValue GlobalExtensions::method_qsTrId(CallContext *ctx)
*/
ReturnedValue GlobalExtensions::method_qsTrIdNoOp(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1)
+ if (ctx->argc() < 1)
return QV4::Encode::undefined();
- return ctx->d()->callData->args[0].asReturnedValue();
+ return ctx->args()[0].asReturnedValue();
}
#endif // QT_NO_TRANSLATION
@@ -1844,13 +1844,13 @@ QV4::ReturnedValue GlobalExtensions::method_gc(CallContext *ctx)
ReturnedValue GlobalExtensions::method_string_arg(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("String.arg(): Invalid arguments");
- QString value = ctx->d()->callData->thisObject.toQString();
+ QString value = ctx->thisObject().toQString();
QV4::Scope scope(ctx);
- QV4::ScopedValue arg(scope, ctx->d()->callData->args[0]);
+ QV4::ScopedValue arg(scope, ctx->args()[0]);
if (arg->isInteger())
return ctx->d()->engine->newString(value.arg(arg->integerValue()))->asReturnedValue();
else if (arg->isDouble())
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index 96f5b008b1..81210b2036 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -1802,7 +1802,7 @@ int QQmlDelegateModelItemMetaType::parseGroups(const QV4::Value &groups) const
QV4::ReturnedValue QQmlDelegateModelItem::get_model(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
if (!o->d()->item->metaType->model)
@@ -1814,7 +1814,7 @@ QV4::ReturnedValue QQmlDelegateModelItem::get_model(QV4::CallContext *ctx)
QV4::ReturnedValue QQmlDelegateModelItem::get_groups(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
@@ -1830,17 +1830,17 @@ QV4::ReturnedValue QQmlDelegateModelItem::get_groups(QV4::CallContext *ctx)
QV4::ReturnedValue QQmlDelegateModelItem::set_groups(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
return ctx->engine()->throwTypeError();
if (!o->d()->item->metaType->model)
return QV4::Encode::undefined();
QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(o->d()->item->metaType->model);
- const int groupFlags = model->m_cacheMetaType->parseGroups(ctx->d()->callData->args[0]);
+ const int groupFlags = model->m_cacheMetaType->parseGroups(ctx->args()[0]);
const int cacheIndex = model->m_cache.indexOf(o->d()->item);
Compositor::iterator it = model->m_compositor.find(Compositor::Cache, cacheIndex);
model->setGroups(it, 1, Compositor::Cache, groupFlags);
@@ -3236,21 +3236,21 @@ struct QQmlDelegateModelGroupChange : QV4::Object
static QV4::ReturnedValue method_get_index(QV4::CallContext *ctx) {
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelGroupChange> that(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelGroupChange>());
+ QV4::Scoped<QQmlDelegateModelGroupChange> that(scope, ctx->thisObject().as<QQmlDelegateModelGroupChange>());
if (!that)
return ctx->engine()->throwTypeError();
return QV4::Encode(that->d()->change.index);
}
static QV4::ReturnedValue method_get_count(QV4::CallContext *ctx) {
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelGroupChange> that(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelGroupChange>());
+ QV4::Scoped<QQmlDelegateModelGroupChange> that(scope, ctx->thisObject().as<QQmlDelegateModelGroupChange>());
if (!that)
return ctx->engine()->throwTypeError();
return QV4::Encode(that->d()->change.count);
}
static QV4::ReturnedValue method_get_moveId(QV4::CallContext *ctx) {
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelGroupChange> that(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelGroupChange>());
+ QV4::Scoped<QQmlDelegateModelGroupChange> that(scope, ctx->thisObject().as<QQmlDelegateModelGroupChange>());
if (!that)
return ctx->engine()->throwTypeError();
if (that->d()->change.moveId < 0)
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp
index 651f1f9231..b2767e5dbf 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qml/types/qquickworkerscript.cpp
@@ -277,10 +277,10 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::method_sendMessage(QV4::Call
{
WorkerEngine *engine = (WorkerEngine*)ctx->engine()->v8Engine;
- int id = ctx->d()->callData->argc > 1 ? ctx->d()->callData->args[1].toInt32() : 0;
+ int id = ctx->argc() > 1 ? ctx->args()[1].toInt32() : 0;
QV4::Scope scope(ctx);
- QV4::ScopedValue v(scope, ctx->d()->callData->argument(2));
+ QV4::ScopedValue v(scope, ctx->argument(2));
QByteArray data = QV4::Serialize::serialize(v, scope.engine);
QMutexLocker locker(&engine->p->m_lock);
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp
index 4cf34ae078..a14d397e35 100644
--- a/src/qml/util/qqmladaptormodel.cpp
+++ b/src/qml/util/qqmladaptormodel.cpp
@@ -58,7 +58,7 @@ V4_DEFINE_EXTENSION(QQmlAdaptorModelEngineData, engineData)
static QV4::ReturnedValue get_index(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
@@ -190,7 +190,7 @@ public:
static QV4::ReturnedValue get_hasModelChildren(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
@@ -338,7 +338,7 @@ bool QQmlDMCachedModelData::resolveIndex(const QQmlAdaptorModel &, int idx)
QV4::ReturnedValue QQmlDMCachedModelData::get_property(QV4::CallContext *ctx, uint propertyId)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
@@ -358,20 +358,20 @@ QV4::ReturnedValue QQmlDMCachedModelData::get_property(QV4::CallContext *ctx, ui
QV4::ReturnedValue QQmlDMCachedModelData::set_property(QV4::CallContext *ctx, uint propertyId)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
return ctx->engine()->throwTypeError();
if (o->d()->item->index == -1) {
QQmlDMCachedModelData *modelData = static_cast<QQmlDMCachedModelData *>(o->d()->item);
if (!modelData->cachedData.isEmpty()) {
if (modelData->cachedData.count() > 1) {
- modelData->cachedData[propertyId] = scope.engine->toVariant(ctx->d()->callData->args[0], QVariant::Invalid);
+ modelData->cachedData[propertyId] = scope.engine->toVariant(ctx->args()[0], QVariant::Invalid);
QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), propertyId, 0);
} else if (modelData->cachedData.count() == 1) {
- modelData->cachedData[0] = scope.engine->toVariant(ctx->d()->callData->args[0], QVariant::Invalid);
+ modelData->cachedData[0] = scope.engine->toVariant(ctx->args()[0], QVariant::Invalid);
QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 0, 0);
QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 1, 0);
}
@@ -580,7 +580,7 @@ public:
static QV4::ReturnedValue get_modelData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
@@ -590,13 +590,13 @@ public:
static QV4::ReturnedValue set_modelData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
return ctx->engine()->throwTypeError();
- static_cast<QQmlDMListAccessorData *>(o->d()->item)->setModelData(scope.engine->toVariant(ctx->d()->callData->args[0], QVariant::Invalid));
+ static_cast<QQmlDMListAccessorData *>(o->d()->item)->setModelData(scope.engine->toVariant(ctx->args()[0], QVariant::Invalid));
return QV4::Encode::undefined();
}
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 7d5362b078..5d8d9dfae8 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -963,7 +963,7 @@ static QV4::ReturnedValue qt_create_image_data(qreal w, qreal h, QV4::ExecutionE
QV4::ReturnedValue QQuickJSContext2DPrototype::method_get_canvas(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
return QV4::QObjectWrapper::wrap(scope.engine, r->d()->context->canvas());
@@ -978,11 +978,11 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_get_canvas(QV4::CallContex
QV4::ReturnedValue QQuickJSContext2DPrototype::method_restore(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
r->d()->context->popState();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -992,12 +992,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_restore(QV4::CallContext *
QV4::ReturnedValue QQuickJSContext2DPrototype::method_reset(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
r->d()->context->reset();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1033,12 +1033,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_reset(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2DPrototype::method_save(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
r->d()->context->pushState();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
// transformations
@@ -1062,12 +1062,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_save(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2DPrototype::method_rotate(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 1)
- r->d()->context->rotate(ctx->d()->callData->args[0].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 1)
+ r->d()->context->rotate(ctx->args()[0].toNumber());
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1090,13 +1090,13 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_rotate(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2DPrototype::method_scale(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 2)
- r->d()->context->scale(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 2)
+ r->d()->context->scale(ctx->args()[0].toNumber(), ctx->args()[1].toNumber());
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1136,19 +1136,19 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_scale(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2DPrototype::method_setTransform(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 6)
- r->d()->context->setTransform( ctx->d()->callData->args[0].toNumber()
- , ctx->d()->callData->args[1].toNumber()
- , ctx->d()->callData->args[2].toNumber()
- , ctx->d()->callData->args[3].toNumber()
- , ctx->d()->callData->args[4].toNumber()
- , ctx->d()->callData->args[5].toNumber());
+ if (ctx->argc() >= 6)
+ r->d()->context->setTransform( ctx->args()[0].toNumber()
+ , ctx->args()[1].toNumber()
+ , ctx->args()[2].toNumber()
+ , ctx->args()[3].toNumber()
+ , ctx->args()[4].toNumber()
+ , ctx->args()[5].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1165,18 +1165,18 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_setTransform(QV4::CallCont
QV4::ReturnedValue QQuickJSContext2DPrototype::method_transform(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 6)
- r->d()->context->transform( ctx->d()->callData->args[0].toNumber()
- , ctx->d()->callData->args[1].toNumber()
- , ctx->d()->callData->args[2].toNumber()
- , ctx->d()->callData->args[3].toNumber()
- , ctx->d()->callData->args[4].toNumber()
- , ctx->d()->callData->args[5].toNumber());
+ if (ctx->argc() >= 6)
+ r->d()->context->transform( ctx->args()[0].toNumber()
+ , ctx->args()[1].toNumber()
+ , ctx->args()[2].toNumber()
+ , ctx->args()[3].toNumber()
+ , ctx->args()[4].toNumber()
+ , ctx->args()[5].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1191,12 +1191,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_transform(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_translate(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 2)
- r->d()->context->translate(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 2)
+ r->d()->context->translate(ctx->args()[0].toNumber(), ctx->args()[1].toNumber());
+ return ctx->thisObject().asReturnedValue();
}
@@ -1211,12 +1211,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_translate(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_resetTransform(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
r->d()->context->setTransform(1, 0, 0, 1, 0, 0);
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
@@ -1229,13 +1229,13 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_resetTransform(QV4::CallCo
QV4::ReturnedValue QQuickJSContext2DPrototype::method_shear(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 2)
- r->d()->context->shear(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber());
+ if (ctx->argc() >= 2)
+ r->d()->context->shear(ctx->args()[0].toNumber(), ctx->args()[1].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
// compositing
@@ -1249,7 +1249,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_shear(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2D::method_get_globalAlpha(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
return QV4::Encode(r->d()->context->state.globalAlpha);
@@ -1258,10 +1258,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_globalAlpha(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2D::method_set_globalAlpha(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT_SETTER(r)
- double globalAlpha = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double globalAlpha = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
if (!qIsFinite(globalAlpha))
return QV4::Encode::undefined();
@@ -1302,7 +1302,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_globalAlpha(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2D::method_get_globalCompositeOperation(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
return QV4::Encode(scope.engine->newString(qt_composite_mode_to_string(r->d()->context->state.globalCompositeOperation)));
@@ -1311,13 +1311,13 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_globalCompositeOperation(QV4::C
QV4::ReturnedValue QQuickJSContext2D::method_set_globalCompositeOperation(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT_SETTER(r)
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
return ctx->engine()->throwTypeError();
- QString mode = ctx->d()->callData->args[0].toQString();
+ QString mode = ctx->args()[0].toQString();
QPainter::CompositionMode cm = qt_composite_mode_from_string(mode);
if (cm == QPainter::CompositionMode_SourceOver && mode != QStringLiteral("source-over"))
return QV4::Encode::undefined();
@@ -1355,7 +1355,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_globalCompositeOperation(QV4::C
QV4::ReturnedValue QQuickJSContext2D::method_get_fillStyle(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
QColor color = r->d()->context->state.fillStyle.color();
@@ -1376,7 +1376,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_fillStyle(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT_SETTER(r)
QV4::ScopedValue value(scope, ctx->argument(0));
@@ -1422,7 +1422,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2D::method_get_fillRule(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
return scope.engine->fromVariant(r->d()->context->state.fillRule);
@@ -1431,7 +1431,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_fillRule(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_set_fillRule(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT_SETTER(r)
QV4::ScopedValue value(scope, ctx->argument(0));
@@ -1464,7 +1464,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillRule(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_get_strokeStyle(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
QColor color = r->d()->context->state.strokeStyle.color();
@@ -1485,7 +1485,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_strokeStyle(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT_SETTER(r)
QV4::ScopedValue value(scope, ctx->argument(0));
@@ -1538,14 +1538,14 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2DPrototype::method_createLinearGradient(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4) {
- qreal x0 = ctx->d()->callData->args[0].toNumber();
- qreal y0 = ctx->d()->callData->args[1].toNumber();
- qreal x1 = ctx->d()->callData->args[2].toNumber();
- qreal y1 = ctx->d()->callData->args[3].toNumber();
+ if (ctx->argc() >= 4) {
+ qreal x0 = ctx->args()[0].toNumber();
+ qreal y0 = ctx->args()[1].toNumber();
+ qreal x1 = ctx->args()[2].toNumber();
+ qreal y1 = ctx->args()[3].toNumber();
if (!qIsFinite(x0)
|| !qIsFinite(y0)
@@ -1562,7 +1562,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createLinearGradient(QV4::
return gradient.asReturnedValue();
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1581,16 +1581,16 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createLinearGradient(QV4::
QV4::ReturnedValue QQuickJSContext2DPrototype::method_createRadialGradient(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 6) {
- qreal x0 = ctx->d()->callData->args[0].toNumber();
- qreal y0 = ctx->d()->callData->args[1].toNumber();
- qreal r0 = ctx->d()->callData->args[2].toNumber();
- qreal x1 = ctx->d()->callData->args[3].toNumber();
- qreal y1 = ctx->d()->callData->args[4].toNumber();
- qreal r1 = ctx->d()->callData->args[5].toNumber();
+ if (ctx->argc() >= 6) {
+ qreal x0 = ctx->args()[0].toNumber();
+ qreal y0 = ctx->args()[1].toNumber();
+ qreal r0 = ctx->args()[2].toNumber();
+ qreal x1 = ctx->args()[3].toNumber();
+ qreal y1 = ctx->args()[4].toNumber();
+ qreal r1 = ctx->args()[5].toNumber();
if (!qIsFinite(x0)
|| !qIsFinite(y0)
@@ -1613,7 +1613,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createRadialGradient(QV4::
return gradient.asReturnedValue();
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1632,13 +1632,13 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createRadialGradient(QV4::
QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 3) {
- qreal x = ctx->d()->callData->args[0].toNumber();
- qreal y = ctx->d()->callData->args[1].toNumber();
- qreal angle = DEGREES(ctx->d()->callData->args[2].toNumber());
+ if (ctx->argc() >= 3) {
+ qreal x = ctx->args()[0].toNumber();
+ qreal y = ctx->args()[1].toNumber();
+ qreal angle = DEGREES(ctx->args()[2].toNumber());
if (!qIsFinite(x) || !qIsFinite(y)) {
V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createConicalGradient(): Incorrect arguments");
}
@@ -1656,7 +1656,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(QV4:
return gradient.asReturnedValue();
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
\qmlmethod variant QtQuick::Context2D::createPattern(color color, enumeration patternMode)
@@ -1704,15 +1704,15 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(QV4:
QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 2) {
+ if (ctx->argc() >= 2) {
QV4::Scoped<QQuickContext2DStyle> pattern(scope, scope.engine->memoryManager->alloc<QQuickContext2DStyle>(scope.engine));
- QColor color = scope.engine->toVariant(ctx->d()->callData->args[0], qMetaTypeId<QColor>()).value<QColor>();
+ QColor color = scope.engine->toVariant(ctx->args()[0], qMetaTypeId<QColor>()).value<QColor>();
if (color.isValid()) {
- int patternMode = ctx->d()->callData->args[1].toInt32();
+ int patternMode = ctx->args()[1].toInt32();
Qt::BrushStyle style = Qt::SolidPattern;
if (patternMode >= 0 && patternMode < Qt::LinearGradientPattern) {
style = static_cast<Qt::BrushStyle>(patternMode);
@@ -1721,20 +1721,20 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::CallCon
} else {
QImage patternTexture;
- if (QV4::Object *o = ctx->d()->callData->args[0].asObject()) {
+ if (QV4::Object *o = ctx->args()[0].asObject()) {
QV4::ScopedString s(scope, scope.engine->newString(QStringLiteral("data")));
QV4::Scoped<QQuickJSContext2DPixelData> pixelData(scope, o->get(s));
if (!!pixelData) {
patternTexture = pixelData->d()->image;
}
} else {
- patternTexture = r->d()->context->createPixmap(QUrl(ctx->d()->callData->args[0].toQStringNoThrow()))->image();
+ patternTexture = r->d()->context->createPixmap(QUrl(ctx->args()[0].toQStringNoThrow()))->image();
}
if (!patternTexture.isNull()) {
pattern->d()->brush.setTextureImage(patternTexture);
- QString repetition = ctx->d()->callData->args[1].toQStringNoThrow();
+ QString repetition = ctx->args()[1].toQStringNoThrow();
if (repetition == QStringLiteral("repeat") || repetition.isEmpty()) {
pattern->d()->patternRepeatX = true;
pattern->d()->patternRepeatY = true;
@@ -1775,7 +1775,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::CallCon
QV4::ReturnedValue QQuickJSContext2D::method_get_lineCap(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
switch (r->d()->context->state.lineCap) {
@@ -1793,10 +1793,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineCap(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_set_lineCap(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- QString lineCap = ctx->d()->callData->args[0].toQString();
+ QString lineCap = ctx->args()[0].toQString();
Qt::PenCapStyle cap;
if (lineCap == QStringLiteral("round"))
cap = Qt::RoundCap;
@@ -1831,7 +1831,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineCap(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_get_lineJoin(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
switch (r->d()->context->state.lineJoin) {
@@ -1849,13 +1849,13 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineJoin(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_set_lineJoin(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
return ctx->engine()->throwTypeError();
- QString lineJoin = ctx->d()->callData->args[0].toQString();
+ QString lineJoin = ctx->args()[0].toQString();
Qt::PenJoinStyle join;
if (lineJoin == QStringLiteral("round"))
join = Qt::RoundJoin;
@@ -1880,7 +1880,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineJoin(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_get_lineWidth(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(r->d()->context->state.lineWidth);
@@ -1889,10 +1889,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineWidth(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2D::method_set_lineWidth(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- qreal w = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : -1;
+ qreal w = ctx->argc() ? ctx->args()[0].toNumber() : -1;
if (w > 0 && qIsFinite(w) && w != r->d()->context->state.lineWidth) {
r->d()->context->state.lineWidth = w;
@@ -1909,7 +1909,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineWidth(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2D::method_get_miterLimit(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(r->d()->context->state.miterLimit);
@@ -1918,10 +1918,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_miterLimit(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2D::method_set_miterLimit(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- qreal ml = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : -1;
+ qreal ml = ctx->argc() ? ctx->args()[0].toNumber() : -1;
if (ml > 0 && qIsFinite(ml) && ml != r->d()->context->state.miterLimit) {
r->d()->context->state.miterLimit = ml;
@@ -1938,7 +1938,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_miterLimit(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2D::method_get_shadowBlur(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(r->d()->context->state.shadowBlur);
@@ -1947,10 +1947,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowBlur(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2D::method_set_shadowBlur(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- qreal blur = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : -1;
+ qreal blur = ctx->argc() ? ctx->args()[0].toNumber() : -1;
if (blur > 0 && qIsFinite(blur) && blur != r->d()->context->state.shadowBlur) {
r->d()->context->state.shadowBlur = blur;
@@ -1966,7 +1966,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowBlur(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2D::method_get_shadowColor(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(scope.engine->newString(r->d()->context->state.shadowColor.name()));
@@ -1975,12 +1975,12 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowColor(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2D::method_set_shadowColor(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
QColor color;
- if (ctx->d()->callData->argc)
- color = qt_color_from_string(ctx->d()->callData->args[0]);
+ if (ctx->argc())
+ color = qt_color_from_string(ctx->args()[0]);
if (color.isValid() && color != r->d()->context->state.shadowColor) {
r->d()->context->state.shadowColor = color;
@@ -1999,7 +1999,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowColor(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetX(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(r->d()->context->state.shadowOffsetX);
@@ -2008,10 +2008,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetX(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetX(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- qreal offsetX = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ qreal offsetX = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
if (qIsFinite(offsetX) && offsetX != r->d()->context->state.shadowOffsetX) {
r->d()->context->state.shadowOffsetX = offsetX;
r->d()->context->buffer()->setShadowOffsetX(offsetX);
@@ -2027,7 +2027,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetX(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetY(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(r->d()->context->state.shadowOffsetY);
@@ -2036,10 +2036,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetY(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetY(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- qreal offsetY = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ qreal offsetY = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
if (qIsFinite(offsetY) && offsetY != r->d()->context->state.shadowOffsetY) {
r->d()->context->state.shadowOffsetY = offsetY;
r->d()->context->buffer()->setShadowOffsetY(offsetY);
@@ -2050,7 +2050,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetY(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2D::method_get_path(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return r->d()->context->m_v4path.value();
@@ -2059,7 +2059,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_path(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_set_path(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
QV4::ScopedValue value(scope, ctx->argument(0));
@@ -2084,17 +2084,17 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_path(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2DPrototype::method_clearRect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4)
- r->d()->context->clearRect(ctx->d()->callData->args[0].toNumber(),
- ctx->d()->callData->args[1].toNumber(),
- ctx->d()->callData->args[2].toNumber(),
- ctx->d()->callData->args[3].toNumber());
+ if (ctx->argc() >= 4)
+ r->d()->context->clearRect(ctx->args()[0].toNumber(),
+ ctx->args()[1].toNumber(),
+ ctx->args()[2].toNumber(),
+ ctx->args()[3].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
\qmlmethod object QtQuick::Context2D::fillRect(real x, real y, real w, real h)
@@ -2105,12 +2105,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_clearRect(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillRect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4)
- r->d()->context->fillRect(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber(), ctx->d()->callData->args[2].toNumber(), ctx->d()->callData->args[3].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 4)
+ r->d()->context->fillRect(ctx->args()[0].toNumber(), ctx->args()[1].toNumber(), ctx->args()[2].toNumber(), ctx->args()[3].toNumber());
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2126,13 +2126,13 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillRect(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeRect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4)
- r->d()->context->strokeRect(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber(), ctx->d()->callData->args[2].toNumber(), ctx->d()->callData->args[3].toNumber());
+ if (ctx->argc() >= 4)
+ r->d()->context->strokeRect(ctx->args()[0].toNumber(), ctx->args()[1].toNumber(), ctx->args()[2].toNumber(), ctx->args()[3].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
// Complex shapes (paths) API
@@ -2159,29 +2159,29 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeRect(QV4::CallContex
QV4::ReturnedValue QQuickJSContext2DPrototype::method_arc(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 5) {
+ if (ctx->argc() >= 5) {
bool antiClockwise = false;
- if (ctx->d()->callData->argc == 6)
- antiClockwise = ctx->d()->callData->args[5].toBoolean();
+ if (ctx->argc() == 6)
+ antiClockwise = ctx->args()[5].toBoolean();
- qreal radius = ctx->d()->callData->args[2].toNumber();
+ qreal radius = ctx->args()[2].toNumber();
if (qIsFinite(radius) && radius < 0)
V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "Incorrect argument radius");
- r->d()->context->arc(ctx->d()->callData->args[0].toNumber(),
- ctx->d()->callData->args[1].toNumber(),
+ r->d()->context->arc(ctx->args()[0].toNumber(),
+ ctx->args()[1].toNumber(),
radius,
- ctx->d()->callData->args[3].toNumber(),
- ctx->d()->callData->args[4].toNumber(),
+ ctx->args()[3].toNumber(),
+ ctx->args()[4].toNumber(),
antiClockwise);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2210,23 +2210,23 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_arc(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2DPrototype::method_arcTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 5) {
- qreal radius = ctx->d()->callData->args[4].toNumber();
+ if (ctx->argc() >= 5) {
+ qreal radius = ctx->args()[4].toNumber();
if (qIsFinite(radius) && radius < 0)
V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "Incorrect argument radius");
- r->d()->context->arcTo(ctx->d()->callData->args[0].toNumber(),
- ctx->d()->callData->args[1].toNumber(),
- ctx->d()->callData->args[2].toNumber(),
- ctx->d()->callData->args[3].toNumber(),
+ r->d()->context->arcTo(ctx->args()[0].toNumber(),
+ ctx->args()[1].toNumber(),
+ ctx->args()[2].toNumber(),
+ ctx->args()[3].toNumber(),
radius);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2237,12 +2237,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_arcTo(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2DPrototype::method_beginPath(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
r->d()->context->beginPath();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2267,25 +2267,25 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_beginPath(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_bezierCurveTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 6) {
- qreal cp1x = ctx->d()->callData->args[0].toNumber();
- qreal cp1y = ctx->d()->callData->args[1].toNumber();
- qreal cp2x = ctx->d()->callData->args[2].toNumber();
- qreal cp2y = ctx->d()->callData->args[3].toNumber();
- qreal x = ctx->d()->callData->args[4].toNumber();
- qreal y = ctx->d()->callData->args[5].toNumber();
+ if (ctx->argc() >= 6) {
+ qreal cp1x = ctx->args()[0].toNumber();
+ qreal cp1y = ctx->args()[1].toNumber();
+ qreal cp2x = ctx->args()[2].toNumber();
+ qreal cp2y = ctx->args()[3].toNumber();
+ qreal x = ctx->args()[4].toNumber();
+ qreal y = ctx->args()[5].toNumber();
if (!qIsFinite(cp1x) || !qIsFinite(cp1y) || !qIsFinite(cp2x) || !qIsFinite(cp2y) || !qIsFinite(x) || !qIsFinite(y))
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
r->d()->context->bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2315,11 +2315,11 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_bezierCurveTo(QV4::CallCon
QV4::ReturnedValue QQuickJSContext2DPrototype::method_clip(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
r->d()->context->clip();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2332,13 +2332,13 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_clip(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2DPrototype::method_closePath(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
r->d()->context->closePath();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2353,10 +2353,10 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_closePath(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_fill(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r);
r->d()->context->fill();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2367,21 +2367,21 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fill(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2DPrototype::method_lineTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 2) {
- qreal x = ctx->d()->callData->args[0].toNumber();
- qreal y = ctx->d()->callData->args[1].toNumber();
+ if (ctx->argc() >= 2) {
+ qreal x = ctx->args()[0].toNumber();
+ qreal y = ctx->args()[1].toNumber();
if (!qIsFinite(x) || !qIsFinite(y))
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
r->d()->context->lineTo(x, y);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2392,18 +2392,18 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_lineTo(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2DPrototype::method_moveTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 2) {
- qreal x = ctx->d()->callData->args[0].toNumber();
- qreal y = ctx->d()->callData->args[1].toNumber();
+ if (ctx->argc() >= 2) {
+ qreal x = ctx->args()[0].toNumber();
+ qreal y = ctx->args()[1].toNumber();
if (!qIsFinite(x) || !qIsFinite(y))
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
r->d()->context->moveTo(x, y);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2416,22 +2416,22 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_moveTo(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2DPrototype::method_quadraticCurveTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4) {
- qreal cpx = ctx->d()->callData->args[0].toNumber();
- qreal cpy = ctx->d()->callData->args[1].toNumber();
- qreal x = ctx->d()->callData->args[2].toNumber();
- qreal y = ctx->d()->callData->args[3].toNumber();
+ if (ctx->argc() >= 4) {
+ qreal cpx = ctx->args()[0].toNumber();
+ qreal cpy = ctx->args()[1].toNumber();
+ qreal x = ctx->args()[2].toNumber();
+ qreal y = ctx->args()[3].toNumber();
if (!qIsFinite(cpx) || !qIsFinite(cpy) || !qIsFinite(x) || !qIsFinite(y))
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
r->d()->context->quadraticCurveTo(cpx, cpy, x, y);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2442,12 +2442,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_quadraticCurveTo(QV4::Call
QV4::ReturnedValue QQuickJSContext2DPrototype::method_rect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4)
- r->d()->context->rect(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber(), ctx->d()->callData->args[2].toNumber(), ctx->d()->callData->args[3].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 4)
+ r->d()->context->rect(ctx->args()[0].toNumber(), ctx->args()[1].toNumber(), ctx->args()[2].toNumber(), ctx->args()[3].toNumber());
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2459,17 +2459,17 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_rect(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2DPrototype::method_roundedRect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 6)
- r->d()->context->roundedRect(ctx->d()->callData->args[0].toNumber()
- , ctx->d()->callData->args[1].toNumber()
- , ctx->d()->callData->args[2].toNumber()
- , ctx->d()->callData->args[3].toNumber()
- , ctx->d()->callData->args[4].toNumber()
- , ctx->d()->callData->args[5].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 6)
+ r->d()->context->roundedRect(ctx->args()[0].toNumber()
+ , ctx->args()[1].toNumber()
+ , ctx->args()[2].toNumber()
+ , ctx->args()[3].toNumber()
+ , ctx->args()[4].toNumber()
+ , ctx->args()[5].toNumber());
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2483,14 +2483,14 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_roundedRect(QV4::CallConte
QV4::ReturnedValue QQuickJSContext2DPrototype::method_ellipse(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4)
- r->d()->context->ellipse(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber(), ctx->d()->callData->args[2].toNumber(), ctx->d()->callData->args[3].toNumber());
+ if (ctx->argc() >= 4)
+ r->d()->context->ellipse(ctx->args()[0].toNumber(), ctx->args()[1].toNumber(), ctx->args()[2].toNumber(), ctx->args()[3].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2502,18 +2502,18 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_ellipse(QV4::CallContext *
QV4::ReturnedValue QQuickJSContext2DPrototype::method_text(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 3) {
- qreal x = ctx->d()->callData->args[1].toNumber();
- qreal y = ctx->d()->callData->args[2].toNumber();
+ if (ctx->argc() >= 3) {
+ qreal x = ctx->args()[1].toNumber();
+ qreal y = ctx->args()[2].toNumber();
if (!qIsFinite(x) || !qIsFinite(y))
- return ctx->d()->callData->thisObject.asReturnedValue();
- r->d()->context->text(ctx->d()->callData->args[0].toQStringNoThrow(), x, y);
+ return ctx->thisObject().asReturnedValue();
+ r->d()->context->text(ctx->args()[0].toQStringNoThrow(), x, y);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2528,11 +2528,11 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_text(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2DPrototype::method_stroke(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
r->d()->context->stroke();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2545,12 +2545,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_stroke(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2DPrototype::method_isPointInPath(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
bool pointInPath = false;
- if (ctx->d()->callData->argc >= 2)
- pointInPath = r->d()->context->isPointInPath(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber());
+ if (ctx->argc() >= 2)
+ pointInPath = r->d()->context->isPointInPath(ctx->args()[0].toNumber(), ctx->args()[1].toNumber());
return QV4::Primitive::fromBoolean(pointInPath).asReturnedValue();
}
@@ -2601,7 +2601,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_caretBlinkRate(QV4::CallCo
QV4::ReturnedValue QQuickJSContext2D::method_get_font(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(scope.engine->newString(r->d()->context->state.font.toString()));
@@ -2610,7 +2610,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_font(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_set_font(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
QV4::ScopedString s(scope, ctx->argument(0), QV4::ScopedString::Convert);
@@ -2640,7 +2640,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_font(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_get_textAlign(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
switch (r->d()->context->state.textAlign) {
@@ -2662,7 +2662,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_textAlign(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2D::method_set_textAlign(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
QV4::ScopedString s(scope, ctx->argument(0), QV4::ScopedString::Convert);
@@ -2708,7 +2708,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_textAlign(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2D::method_get_textBaseline(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
switch (r->d()->context->state.textBaseline) {
@@ -2730,7 +2730,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_textBaseline(QV4::CallContext *
QV4::ReturnedValue QQuickJSContext2D::method_set_textBaseline(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
QV4::ScopedString s(scope, ctx->argument(0), QV4::ScopedString::Convert);
if (scope.engine->hasException)
@@ -2768,18 +2768,18 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_textBaseline(QV4::CallContext *
QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillText(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 3) {
- qreal x = ctx->d()->callData->args[1].toNumber();
- qreal y = ctx->d()->callData->args[2].toNumber();
+ if (ctx->argc() >= 3) {
+ qreal x = ctx->args()[1].toNumber();
+ qreal y = ctx->args()[2].toNumber();
if (!qIsFinite(x) || !qIsFinite(y))
- return ctx->d()->callData->thisObject.asReturnedValue();
- QPainterPath textPath = r->d()->context->createTextGlyphs(x, y, ctx->d()->callData->args[0].toQStringNoThrow());
+ return ctx->thisObject().asReturnedValue();
+ QPainterPath textPath = r->d()->context->createTextGlyphs(x, y, ctx->args()[0].toQStringNoThrow());
r->d()->context->buffer()->fill(textPath);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
\qmlmethod object QtQuick::Context2D::strokeText(text, x, y)
@@ -2792,12 +2792,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillText(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeText(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 3)
- r->d()->context->drawText(ctx->d()->callData->args[0].toQStringNoThrow(), ctx->d()->callData->args[1].toNumber(), ctx->d()->callData->args[2].toNumber(), false);
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 3)
+ r->d()->context->drawText(ctx->args()[0].toQStringNoThrow(), ctx->args()[1].toNumber(), ctx->args()[2].toNumber(), false);
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2809,12 +2809,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeText(QV4::CallContex
QV4::ReturnedValue QQuickJSContext2DPrototype::method_measureText(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 1) {
+ if (ctx->argc() >= 1) {
QFontMetrics fm(r->d()->context->state.font);
- uint width = fm.width(ctx->d()->callData->args[0].toQStringNoThrow());
+ uint width = fm.width(ctx->args()[0].toQStringNoThrow());
QV4::ScopedObject tm(scope, scope.engine->newObject());
tm->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("width"))).getPointer(),
QV4::ScopedValue(scope, QV4::Primitive::fromDouble(width)));
@@ -2885,21 +2885,21 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_measureText(QV4::CallConte
QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
qreal sx, sy, sw, sh, dx, dy, dw, dh;
- if (!ctx->d()->callData->argc)
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (!ctx->argc())
+ return ctx->thisObject().asReturnedValue();
//FIXME:This function should be moved to QQuickContext2D::drawImage(...)
if (!r->d()->context->state.invertibleCTM)
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
QQmlRefPointer<QQuickCanvasPixmap> pixmap;
- QV4::ScopedValue arg(scope, ctx->d()->callData->args[0]);
+ QV4::ScopedValue arg(scope, ctx->args()[0]);
if (arg->isString()) {
QUrl url(arg->toQString());
if (!url.isValid())
@@ -2940,29 +2940,29 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext
}
if (pixmap.isNull() || !pixmap->isValid())
- return ctx->d()->callData->thisObject.asReturnedValue();
-
- if (ctx->d()->callData->argc >= 9) {
- sx = ctx->d()->callData->args[1].toNumber();
- sy = ctx->d()->callData->args[2].toNumber();
- sw = ctx->d()->callData->args[3].toNumber();
- sh = ctx->d()->callData->args[4].toNumber();
- dx = ctx->d()->callData->args[5].toNumber();
- dy = ctx->d()->callData->args[6].toNumber();
- dw = ctx->d()->callData->args[7].toNumber();
- dh = ctx->d()->callData->args[8].toNumber();
- } else if (ctx->d()->callData->argc >= 5) {
+ return ctx->thisObject().asReturnedValue();
+
+ if (ctx->argc() >= 9) {
+ sx = ctx->args()[1].toNumber();
+ sy = ctx->args()[2].toNumber();
+ sw = ctx->args()[3].toNumber();
+ sh = ctx->args()[4].toNumber();
+ dx = ctx->args()[5].toNumber();
+ dy = ctx->args()[6].toNumber();
+ dw = ctx->args()[7].toNumber();
+ dh = ctx->args()[8].toNumber();
+ } else if (ctx->argc() >= 5) {
sx = 0;
sy = 0;
sw = pixmap->width();
sh = pixmap->height();
- dx = ctx->d()->callData->args[1].toNumber();
- dy = ctx->d()->callData->args[2].toNumber();
- dw = ctx->d()->callData->args[3].toNumber();
- dh = ctx->d()->callData->args[4].toNumber();
- } else if (ctx->d()->callData->argc >= 3) {
- dx = ctx->d()->callData->args[1].toNumber();
- dy = ctx->d()->callData->args[2].toNumber();
+ dx = ctx->args()[1].toNumber();
+ dy = ctx->args()[2].toNumber();
+ dw = ctx->args()[3].toNumber();
+ dh = ctx->args()[4].toNumber();
+ } else if (ctx->argc() >= 3) {
+ dx = ctx->args()[1].toNumber();
+ dy = ctx->args()[2].toNumber();
sx = 0;
sy = 0;
sw = pixmap->width();
@@ -2970,7 +2970,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext
dw = sw;
dh = sh;
} else {
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
if (!qIsFinite(sx)
@@ -2981,7 +2981,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext
|| !qIsFinite(dy)
|| !qIsFinite(dw)
|| !qIsFinite(dh))
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
if (sx < 0
|| sy < 0
@@ -2995,7 +2995,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext
r->d()->context->buffer()->drawPixmap(pixmap, QRectF(sx, sy, sw, sh), QRectF(dx, dy, dw, dh));
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
// pixel manipulation
@@ -3025,7 +3025,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DImageData::method_get_width(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->thisObject());
if (!imageData)
return ctx->engine()->throwTypeError();
QV4::Scoped<QQuickJSContext2DPixelData> r(scope, imageData->d()->pixelData.as<QQuickJSContext2DPixelData>());
@@ -3041,7 +3041,7 @@ QV4::ReturnedValue QQuickJSContext2DImageData::method_get_width(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DImageData::method_get_height(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->thisObject());
if (!imageData)
return ctx->engine()->throwTypeError();
QV4::Scoped<QQuickJSContext2DPixelData> r(scope, imageData->d()->pixelData.as<QQuickJSContext2DPixelData>());
@@ -3057,7 +3057,7 @@ QV4::ReturnedValue QQuickJSContext2DImageData::method_get_height(QV4::CallContex
QV4::ReturnedValue QQuickJSContext2DImageData::method_get_data(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->thisObject());
if (!imageData)
return ctx->engine()->throwTypeError();
return imageData->d()->pixelData.asReturnedValue();
@@ -3084,7 +3084,7 @@ QV4::ReturnedValue QQuickJSContext2DImageData::method_get_data(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPixelData::proto_get_length(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2DPixelData> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2DPixelData>());
+ QV4::Scoped<QQuickJSContext2DPixelData> r(scope, ctx->thisObject().as<QQuickJSContext2DPixelData>());
if (!r || r->d()->image.isNull())
return QV4::Encode::undefined();
@@ -3180,11 +3180,11 @@ void QQuickJSContext2DPixelData::putIndexed(QV4::Managed *m, uint index, const Q
QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc == 1) {
- QV4::ScopedValue arg0(scope, ctx->d()->callData->args[0]);
+ if (ctx->argc() == 1) {
+ QV4::ScopedValue arg0(scope, ctx->args()[0]);
QV4::Scoped<QQuickJSContext2DImageData> imgData(scope, arg0);
if (!!imgData) {
QV4::Scoped<QQuickJSContext2DPixelData> pa(scope, imgData->d()->pixelData.as<QQuickJSContext2DPixelData>());
@@ -3197,9 +3197,9 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(QV4::CallC
QImage image = r->d()->context->createPixmap(QUrl(arg0->toQStringNoThrow()))->image();
return qt_create_image_data(image.width(), image.height(), scope.engine, image);
}
- } else if (ctx->d()->callData->argc == 2) {
- qreal w = ctx->d()->callData->args[0].toNumber();
- qreal h = ctx->d()->callData->args[1].toNumber();
+ } else if (ctx->argc() == 2) {
+ qreal w = ctx->args()[0].toNumber();
+ qreal h = ctx->args()[1].toNumber();
if (!qIsFinite(w) || !qIsFinite(h))
V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createImageData(): invalid arguments");
@@ -3219,14 +3219,14 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(QV4::CallC
QV4::ReturnedValue QQuickJSContext2DPrototype::method_getImageData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4) {
- qreal x = ctx->d()->callData->args[0].toNumber();
- qreal y = ctx->d()->callData->args[1].toNumber();
- qreal w = ctx->d()->callData->args[2].toNumber();
- qreal h = ctx->d()->callData->args[3].toNumber();
+ if (ctx->argc() >= 4) {
+ qreal x = ctx->args()[0].toNumber();
+ qreal y = ctx->args()[1].toNumber();
+ qreal w = ctx->args()[2].toNumber();
+ qreal h = ctx->args()[3].toNumber();
if (!qIsFinite(x) || !qIsFinite(y) || !qIsFinite(w) || !qIsFinite(h))
V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "getImageData(): Invalid arguments");
@@ -3246,17 +3246,17 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_getImageData(QV4::CallCont
QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc < 7)
+ if (ctx->argc() < 7)
return QV4::Encode::undefined();
- QV4::ScopedValue arg0(scope, ctx->d()->callData->args[0]);
+ QV4::ScopedValue arg0(scope, ctx->args()[0]);
if (!arg0->isObject())
V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "Context2D::putImageData, the image data type mismatch");
- qreal dx = ctx->d()->callData->args[1].toNumber();
- qreal dy = ctx->d()->callData->args[2].toNumber();
+ qreal dx = ctx->args()[1].toNumber();
+ qreal dy = ctx->args()[2].toNumber();
qreal w, h, dirtyX, dirtyY, dirtyWidth, dirtyHeight;
if (!qIsFinite(dx) || !qIsFinite(dy))
@@ -3264,18 +3264,18 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallCont
QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, arg0);
if (!imageData)
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
QV4::Scoped<QQuickJSContext2DPixelData> pixelArray(scope, imageData->d()->pixelData.as<QQuickJSContext2DPixelData>());
if (pixelArray) {
w = pixelArray->d()->image.width();
h = pixelArray->d()->image.height();
- if (ctx->d()->callData->argc == 7) {
- dirtyX = ctx->d()->callData->args[3].toNumber();
- dirtyY = ctx->d()->callData->args[4].toNumber();
- dirtyWidth = ctx->d()->callData->args[5].toNumber();
- dirtyHeight = ctx->d()->callData->args[6].toNumber();
+ if (ctx->argc() == 7) {
+ dirtyX = ctx->args()[3].toNumber();
+ dirtyY = ctx->args()[4].toNumber();
+ dirtyWidth = ctx->args()[5].toNumber();
+ dirtyHeight = ctx->args()[6].toNumber();
if (!qIsFinite(dirtyX) || !qIsFinite(dirtyY) || !qIsFinite(dirtyWidth) || !qIsFinite(dirtyHeight))
V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "putImageData() : Invalid arguments");
@@ -3310,7 +3310,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallCont
}
if (dirtyWidth <=0 || dirtyHeight <= 0)
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
} else {
dirtyX = 0;
dirtyY = 0;
@@ -3321,7 +3321,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallCont
QImage image = pixelArray->d()->image.copy(dirtyX, dirtyY, dirtyWidth, dirtyHeight);
r->d()->context->buffer()->drawImage(image, QRectF(dirtyX, dirtyY, dirtyWidth, dirtyHeight), QRectF(dx, dy, dirtyWidth, dirtyHeight));
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -3347,22 +3347,22 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallCont
QV4::ReturnedValue QQuickContext2DStyle::gradient_proto_addColorStop(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickContext2DStyle> style(scope, ctx->d()->callData->thisObject.as<QQuickContext2DStyle>());
+ QV4::Scoped<QQuickContext2DStyle> style(scope, ctx->thisObject().as<QQuickContext2DStyle>());
if (!style)
V4THROW_ERROR("Not a CanvasGradient object");
- if (ctx->d()->callData->argc == 2) {
+ if (ctx->argc() == 2) {
if (!style->d()->brush.gradient())
V4THROW_ERROR("Not a valid CanvasGradient object, can't get the gradient information");
QGradient gradient = *(style->d()->brush.gradient());
- qreal pos = ctx->d()->callData->args[0].toNumber();
+ qreal pos = ctx->args()[0].toNumber();
QColor color;
- if (ctx->d()->callData->args[1].asObject()) {
- color = scope.engine->toVariant(ctx->d()->callData->args[1], qMetaTypeId<QColor>()).value<QColor>();
+ if (ctx->args()[1].asObject()) {
+ color = scope.engine->toVariant(ctx->args()[1], qMetaTypeId<QColor>()).value<QColor>();
} else {
- color = qt_color_from_string(ctx->d()->callData->args[1]);
+ color = qt_color_from_string(ctx->args()[1]);
}
if (pos < 0.0 || pos > 1.0 || !qIsFinite(pos)) {
V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "CanvasGradient: parameter offset out of range");
@@ -3376,7 +3376,7 @@ QV4::ReturnedValue QQuickContext2DStyle::gradient_proto_addColorStop(QV4::CallCo
style->d()->brush = gradient;
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
void QQuickContext2D::scale(qreal x, qreal y)