aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-05-06 09:23:59 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-07-22 13:49:11 +0200
commit9744e8bd423d528165f5e78704c6e017852b8e9a (patch)
treeb1210199c698d3b09d80b9267d9aaab2b12ac5ab /src/qml/jsruntime
parentf3f31957b79c55f3e076473b0d4c41c8872535b3 (diff)
Convert ExecutionContext to new storage scheme
Change-Id: I9fcc13da5360f37cef3149b114ed9263b9b74281 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4argumentsobject.cpp54
-rw-r--r--src/qml/jsruntime/qv4argumentsobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp152
-rw-r--r--src/qml/jsruntime/qv4booleanobject.cpp14
-rw-r--r--src/qml/jsruntime/qv4context.cpp184
-rw-r--r--src/qml/jsruntime/qv4context_p.h96
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp152
-rw-r--r--src/qml/jsruntime/qv4debugging.cpp22
-rw-r--r--src/qml/jsruntime/qv4engine.cpp40
-rw-r--r--src/qml/jsruntime/qv4errorobject.cpp12
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp108
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp94
-rw-r--r--src/qml/jsruntime/qv4include.cpp33
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp20
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp14
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp48
-rw-r--r--src/qml/jsruntime/qv4numberobject.cpp56
-rw-r--r--src/qml/jsruntime/qv4object.cpp26
-rw-r--r--src/qml/jsruntime/qv4objectiterator_p.h2
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp88
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp82
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp46
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp108
-rw-r--r--src/qml/jsruntime/qv4script.cpp42
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp24
-rw-r--r--src/qml/jsruntime/qv4sequenceobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp144
-rw-r--r--src/qml/jsruntime/qv4variantobject.cpp14
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp48
29 files changed, 872 insertions, 855 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp
index 092d151409..11e15d8d1b 100644
--- a/src/qml/jsruntime/qv4argumentsobject.cpp
+++ b/src/qml/jsruntime/qv4argumentsobject.cpp
@@ -47,34 +47,34 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(ArgumentsObject);
ArgumentsObject::ArgumentsObject(CallContext *context)
- : Object(context->strictMode ? context->engine->strictArgumentsObjectClass : context->engine->argumentsObjectClass)
+ : Object(context->d()->strictMode ? context->d()->engine->strictArgumentsObjectClass : context->d()->engine->argumentsObjectClass)
{
d()->context = context;
d()->fullyCreated = false;
- ExecutionEngine *v4 = context->engine;
+ ExecutionEngine *v4 = context->d()->engine;
Scope scope(v4);
ScopedObject protectThis(scope, this);
setArrayType(ArrayData::Complex);
- if (context->strictMode) {
- Q_ASSERT(CalleePropertyIndex == internalClass()->find(context->engine->id_callee));
- Q_ASSERT(CallerPropertyIndex == internalClass()->find(context->engine->id_caller));
+ if (context->d()->strictMode) {
+ Q_ASSERT(CalleePropertyIndex == internalClass()->find(context->d()->engine->id_callee));
+ Q_ASSERT(CallerPropertyIndex == internalClass()->find(context->d()->engine->id_caller));
propertyAt(CalleePropertyIndex)->value = v4->thrower;
propertyAt(CalleePropertyIndex)->set = v4->thrower;
propertyAt(CallerPropertyIndex)->value = v4->thrower;
propertyAt(CallerPropertyIndex)->set = v4->thrower;
- arrayReserve(context->callData->argc);
- arrayPut(0, context->callData->args, context->callData->argc);
+ arrayReserve(context->d()->callData->argc);
+ arrayPut(0, context->d()->callData->args, context->d()->callData->argc);
d()->fullyCreated = true;
} else {
setHasAccessorProperty();
- Q_ASSERT(CalleePropertyIndex == internalClass()->find(context->engine->id_callee));
+ Q_ASSERT(CalleePropertyIndex == internalClass()->find(context->d()->engine->id_callee));
memberData()[CalleePropertyIndex] = context->function->asReturnedValue();
}
- Q_ASSERT(LengthPropertyIndex == internalClass()->find(context->engine->id_length));
+ Q_ASSERT(LengthPropertyIndex == internalClass()->find(context->d()->engine->id_length));
memberData()[LengthPropertyIndex] = Primitive::fromInt32(context->realArgumentCount);
Q_ASSERT(internalClass()->vtable == staticVTable());
@@ -86,15 +86,15 @@ void ArgumentsObject::fullyCreate()
return;
uint numAccessors = qMin((int)context()->function->formalParameterCount(), context()->realArgumentCount);
- uint argCount = qMin(context()->realArgumentCount, context()->callData->argc);
+ uint argCount = qMin(context()->realArgumentCount, context()->d()->callData->argc);
ArrayData::realloc(this, ArrayData::Sparse, 0, argCount, true);
- context()->engine->requireArgumentsAccessors(numAccessors);
+ context()->d()->engine->requireArgumentsAccessors(numAccessors);
mappedArguments().ensureIndex(engine(), numAccessors);
for (uint i = 0; i < (uint)numAccessors; ++i) {
- mappedArguments()[i] = context()->callData->args[i];
- arraySet(i, context()->engine->argumentsAccessors[i], Attr_Accessor);
+ mappedArguments()[i] = context()->d()->callData->args[i];
+ arraySet(i, context()->d()->engine->argumentsAccessors[i], Attr_Accessor);
}
- arrayPut(numAccessors, context()->callData->args + numAccessors, argCount - numAccessors);
+ arrayPut(numAccessors, context()->d()->callData->args + numAccessors, argCount - numAccessors);
for (uint i = numAccessors; i < argCount; ++i)
setArrayAttributes(i, Attr_Data);
@@ -112,7 +112,7 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const
bool isMapped = false;
uint numAccessors = qMin((int)context()->function->formalParameterCount(), context()->realArgumentCount);
if (pd && index < (uint)numAccessors)
- isMapped = arrayData()->attributes(index).isAccessor() && pd->getter() == context()->engine->argumentsAccessors[index].getter();
+ isMapped = arrayData()->attributes(index).isAccessor() && pd->getter() == context()->d()->engine->argumentsAccessors[index].getter();
if (isMapped) {
mapAttrs = arrayData()->attributes(index);
@@ -122,10 +122,10 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const
pd->value = mappedArguments()[index];
}
- bool strict = ctx->strictMode;
- ctx->strictMode = false;
+ bool strict = ctx->d()->strictMode;
+ ctx->d()->strictMode = false;
bool result = Object::defineOwnProperty2(ctx, index, desc, attrs);
- ctx->strictMode = strict;
+ ctx->d()->strictMode = strict;
if (isMapped && attrs.isData()) {
ScopedCallData callData(scope, 1);
@@ -140,7 +140,7 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const
}
}
- if (ctx->strictMode && !result)
+ if (ctx->d()->strictMode && !result)
return ctx->throwTypeError();
return result;
}
@@ -151,10 +151,10 @@ ReturnedValue ArgumentsObject::getIndexed(Managed *m, uint index, bool *hasPrope
if (args->fullyCreated())
return Object::getIndexed(m, index, hasProperty);
- if (index < static_cast<uint>(args->context()->callData->argc)) {
+ if (index < static_cast<uint>(args->context()->d()->callData->argc)) {
if (hasProperty)
*hasProperty = true;
- return args->context()->callData->args[index].asReturnedValue();
+ return args->context()->d()->callData->args[index].asReturnedValue();
}
if (hasProperty)
*hasProperty = false;
@@ -164,7 +164,7 @@ ReturnedValue ArgumentsObject::getIndexed(Managed *m, uint index, bool *hasPrope
void ArgumentsObject::putIndexed(Managed *m, uint index, const ValueRef value)
{
ArgumentsObject *args = static_cast<ArgumentsObject *>(m);
- if (!args->fullyCreated() && index >= static_cast<uint>(args->context()->callData->argc))
+ if (!args->fullyCreated() && index >= static_cast<uint>(args->context()->d()->callData->argc))
args->fullyCreate();
if (args->fullyCreated()) {
@@ -172,7 +172,7 @@ void ArgumentsObject::putIndexed(Managed *m, uint index, const ValueRef value)
return;
}
- args->context()->callData->args[index] = value;
+ args->context()->d()->callData->args[index] = value;
}
bool ArgumentsObject::deleteIndexedProperty(Managed *m, uint index)
@@ -190,7 +190,7 @@ PropertyAttributes ArgumentsObject::queryIndexed(const Managed *m, uint index)
return Object::queryIndexed(m, index);
uint numAccessors = qMin((int)args->context()->function->formalParameterCount(), args->context()->realArgumentCount);
- uint argCount = qMin(args->context()->realArgumentCount, args->context()->callData->argc);
+ uint argCount = qMin(args->context()->realArgumentCount, args->context()->d()->callData->argc);
if (index >= argCount)
return PropertyAttributes();
if (index >= numAccessors)
@@ -209,7 +209,7 @@ ReturnedValue ArgumentsGetterFunction::call(Managed *getter, CallData *callData)
if (!o)
return v4->currentContext()->throwTypeError();
- Q_ASSERT(g->index() < static_cast<unsigned>(o->context()->callData->argc));
+ Q_ASSERT(g->index() < static_cast<unsigned>(o->context()->d()->callData->argc));
return o->context()->argument(g->index());
}
@@ -224,8 +224,8 @@ ReturnedValue ArgumentsSetterFunction::call(Managed *setter, CallData *callData)
if (!o)
return v4->currentContext()->throwTypeError();
- Q_ASSERT(s->index() < static_cast<unsigned>(o->context()->callData->argc));
- o->context()->callData->args[s->index()] = callData->argc ? callData->args[0].asReturnedValue() : Encode::undefined();
+ Q_ASSERT(s->index() < static_cast<unsigned>(o->context()->d()->callData->argc));
+ o->context()->d()->callData->args[s->index()] = callData->argc ? callData->args[0].asReturnedValue() : Encode::undefined();
return Encode::undefined();
}
diff --git a/src/qml/jsruntime/qv4argumentsobject_p.h b/src/qml/jsruntime/qv4argumentsobject_p.h
index 50eb776359..b32e935cb4 100644
--- a/src/qml/jsruntime/qv4argumentsobject_p.h
+++ b/src/qml/jsruntime/qv4argumentsobject_p.h
@@ -115,7 +115,7 @@ struct ArgumentsObject: Object {
static bool isNonStrictArgumentsObject(Managed *m) {
return m->internalClass()->vtable->type == Type_ArgumentsObject &&
- !static_cast<ArgumentsObject *>(m)->context()->strictMode;
+ !static_cast<ArgumentsObject *>(m)->context()->d()->strictMode;
}
enum {
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index 74712f9b3f..88700e17d0 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -122,21 +122,21 @@ void ArrayPrototype::init(ExecutionEngine *engine, ObjectRef ctor)
ReturnedValue ArrayPrototype::method_isArray(CallContext *ctx)
{
- bool isArray = ctx->callData->argc && ctx->callData->args[0].asArrayObject();
+ bool isArray = ctx->d()->callData->argc && ctx->d()->callData->args[0].asArrayObject();
return Encode(isArray);
}
ReturnedValue ArrayPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->callData->thisObject, ScopedObject::Convert);
- if (ctx->engine->hasException)
+ ScopedObject o(scope, ctx->d()->callData->thisObject, ScopedObject::Convert);
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
- ScopedString s(scope, ctx->engine->newString(QStringLiteral("join")));
+ ScopedString s(scope, ctx->d()->engine->newString(QStringLiteral("join")));
ScopedFunctionObject f(scope, o->get(s));
if (!!f) {
ScopedCallData d(scope, 0);
- d->thisObject = ctx->callData->thisObject;
+ d->thisObject = ctx->d()->callData->thisObject;
return f->call(d);
}
return ObjectPrototype::method_toString(ctx);
@@ -150,9 +150,9 @@ ReturnedValue ArrayPrototype::method_toLocaleString(CallContext *ctx)
ReturnedValue ArrayPrototype::method_concat(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject result(scope, ctx->engine->newArrayObject());
+ ScopedObject result(scope, ctx->d()->engine->newArrayObject());
- ScopedObject thisObject(scope, ctx->callData->thisObject.toObject(ctx));
+ ScopedObject thisObject(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!thisObject)
return Encode::undefined();
ScopedArrayObject instance(scope, thisObject);
@@ -165,9 +165,9 @@ ReturnedValue ArrayPrototype::method_concat(CallContext *ctx)
ScopedArrayObject elt(scope);
ScopedObject eltAsObj(scope);
ScopedValue entry(scope);
- for (int i = 0; i < ctx->callData->argc; ++i) {
- eltAsObj = ctx->callData->args[i];
- elt = ctx->callData->args[i];
+ for (int i = 0; i < ctx->d()->callData->argc; ++i) {
+ eltAsObj = ctx->d()->callData->args[i];
+ elt = ctx->d()->callData->args[i];
if (elt) {
uint n = elt->getLength();
uint newLen = ArrayData::append(result.getPointer(), elt.getPointer(), n);
@@ -179,7 +179,7 @@ ReturnedValue ArrayPrototype::method_concat(CallContext *ctx)
result->putIndexed(startIndex + i, entry);
}
} else {
- result->arraySet(result->getLength(), ValueRef(ctx->callData->args[i]));
+ result->arraySet(result->getLength(), ValueRef(ctx->d()->callData->args[i]));
}
}
@@ -197,12 +197,12 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
else
r4 = arg->toQString();
- ScopedObject self(scope, ctx->callData->thisObject);
- ScopedValue length(scope, self->get(ctx->engine->id_length));
+ ScopedObject self(scope, ctx->d()->callData->thisObject);
+ ScopedValue length(scope, self->get(ctx->d()->engine->id_length));
const quint32 r2 = length->isUndefined() ? 0 : length->toUInt32();
if (!r2)
- return ctx->engine->newString(QString())->asReturnedValue();
+ return ctx->d()->engine->newString(QString())->asReturnedValue();
QString R;
@@ -223,7 +223,7 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
//
// crazy!
//
- ScopedString name(scope, ctx->engine->newString(QStringLiteral("0")));
+ ScopedString name(scope, ctx->d()->engine->newString(QStringLiteral("0")));
ScopedValue r6(scope, self->get(name));
if (!r6->isNullOrUndefined())
R = r6->toString(ctx)->toQString();
@@ -242,20 +242,20 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
}
}
- return ctx->engine->newString(R)->asReturnedValue();
+ return ctx->d()->engine->newString(R)->asReturnedValue();
}
ReturnedValue ArrayPrototype::method_pop(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
if (!len) {
if (!instance->isArrayObject())
- instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromInt32(0)));
+ instance->put(ctx->d()->engine->id_length, ScopedValue(scope, Primitive::fromInt32(0)));
return Encode::undefined();
}
@@ -269,14 +269,14 @@ ReturnedValue ArrayPrototype::method_pop(CallContext *ctx)
if (instance->isArrayObject())
instance->setArrayLength(len - 1);
else
- instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len - 1)));
+ instance->put(ctx->d()->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len - 1)));
return result.asReturnedValue();
}
ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
@@ -284,38 +284,38 @@ ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
uint len = instance->getLength();
- if (len + ctx->callData->argc < len) {
+ if (len + ctx->d()->callData->argc < len) {
// ughh...
double l = len;
ScopedString s(scope);
- for (int i = 0; i < ctx->callData->argc; ++i) {
+ for (int i = 0; i < ctx->d()->callData->argc; ++i) {
s = Primitive::fromDouble(l + i).toString(ctx);
- instance->put(s, ctx->callData->args[i]);
+ instance->put(s, ctx->d()->callData->args[i]);
}
- double newLen = l + ctx->callData->argc;
+ double newLen = l + ctx->d()->callData->argc;
if (!instance->isArrayObject())
- instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(newLen)));
+ instance->put(ctx->d()->engine->id_length, ScopedValue(scope, Primitive::fromDouble(newLen)));
else {
- ScopedString str(scope, ctx->engine->newString(QStringLiteral("Array.prototype.push: Overflow")));
+ ScopedString str(scope, ctx->d()->engine->newString(QStringLiteral("Array.prototype.push: Overflow")));
return ctx->throwRangeError(str);
}
return Encode(newLen);
}
- if (!ctx->callData->argc) {
+ if (!ctx->d()->callData->argc) {
;
} else if (!instance->protoHasArray() && instance->arrayData()->length() <= len && instance->arrayType() == ArrayData::Simple) {
- instance->arrayData()->vtable()->putArray(instance.getPointer(), len, ctx->callData->args, ctx->callData->argc);
+ instance->arrayData()->vtable()->putArray(instance.getPointer(), len, ctx->d()->callData->args, ctx->d()->callData->argc);
len = instance->arrayData()->length();
} else {
- for (int i = 0; i < ctx->callData->argc; ++i)
- instance->putIndexed(len + i, ctx->callData->args[i]);
- len += ctx->callData->argc;
+ for (int i = 0; i < ctx->d()->callData->argc; ++i)
+ instance->putIndexed(len + i, ctx->d()->callData->args[i]);
+ len += ctx->d()->callData->argc;
}
if (instance->isArrayObject())
instance->setArrayLengthUnchecked(len);
else
- instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len)));
+ instance->put(ctx->d()->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len)));
return Encode(len);
}
@@ -323,7 +323,7 @@ ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
ReturnedValue ArrayPrototype::method_reverse(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
uint length = instance->getLength();
@@ -355,7 +355,7 @@ ReturnedValue ArrayPrototype::method_reverse(CallContext *ctx)
ReturnedValue ArrayPrototype::method_shift(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
@@ -365,7 +365,7 @@ ReturnedValue ArrayPrototype::method_shift(CallContext *ctx)
if (!len) {
if (!instance->isArrayObject())
- instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromInt32(0)));
+ instance->put(ctx->d()->engine->id_length, ScopedValue(scope, Primitive::fromInt32(0)));
return Encode::undefined();
}
@@ -399,18 +399,18 @@ ReturnedValue ArrayPrototype::method_shift(CallContext *ctx)
if (instance->isArrayObject())
instance->setArrayLengthUnchecked(len - 1);
else
- instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len - 1)));
+ instance->put(ctx->d()->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len - 1)));
return result.asReturnedValue();
}
ReturnedValue ArrayPrototype::method_slice(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->callData->thisObject.toObject(ctx));
+ ScopedObject o(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!o)
return Encode::undefined();
- Scoped<ArrayObject> result(scope, ctx->engine->newArrayObject());
+ Scoped<ArrayObject> result(scope, ctx->d()->engine->newArrayObject());
uint len = o->getLength();
double s = ScopedValue(scope, ctx->argument(0))->toInteger();
uint start;
@@ -421,8 +421,8 @@ ReturnedValue ArrayPrototype::method_slice(CallContext *ctx)
else
start = (uint) s;
uint end = len;
- if (ctx->callData->argc > 1 && !ctx->callData->args[1].isUndefined()) {
- double e = ctx->callData->args[1].toInteger();
+ if (ctx->d()->callData->argc > 1 && !ctx->d()->callData->args[1].isUndefined()) {
+ double e = ctx->d()->callData->args[1].toInteger();
if (e < 0)
end = (uint)qMax(len + e, 0.);
else if (e > len)
@@ -448,7 +448,7 @@ ReturnedValue ArrayPrototype::method_slice(CallContext *ctx)
ReturnedValue ArrayPrototype::method_sort(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->callData->thisObject.toObject(ctx));
+ Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
@@ -456,18 +456,18 @@ ReturnedValue ArrayPrototype::method_sort(CallContext *ctx)
ScopedValue comparefn(scope, ctx->argument(0));
ArrayData::sort(ctx, instance, comparefn, len);
- return ctx->callData->thisObject.asReturnedValue();
+ return ctx->d()->callData->thisObject.asReturnedValue();
}
ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
- Scoped<ArrayObject> newArray(scope, ctx->engine->newArrayObject());
+ Scoped<ArrayObject> newArray(scope, ctx->d()->engine->newArrayObject());
double rs = ScopedValue(scope, ctx->argument(0))->toInteger();
uint start;
@@ -490,7 +490,7 @@ ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
}
newArray->setArrayLengthUnchecked(deleteCount);
- uint itemCount = ctx->callData->argc < 2 ? 0 : ctx->callData->argc - 2;
+ uint itemCount = ctx->d()->callData->argc < 2 ? 0 : ctx->d()->callData->argc - 2;
if (itemCount < deleteCount) {
for (uint k = start; k < len - deleteCount; ++k) {
@@ -528,13 +528,13 @@ ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
}
for (uint i = 0; i < itemCount; ++i) {
- instance->putIndexed(start + i, ctx->callData->args[i + 2]);
+ instance->putIndexed(start + i, ctx->d()->callData->args[i + 2]);
if (scope.hasException())
return Encode::undefined();
}
- ctx->strictMode = true;
- instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len - deleteCount + itemCount)));
+ ctx->d()->strictMode = true;
+ instance->put(ctx->d()->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len - deleteCount + itemCount)));
return newArray.asReturnedValue();
}
@@ -542,7 +542,7 @@ ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
ReturnedValue ArrayPrototype::method_unshift(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
@@ -551,26 +551,26 @@ ReturnedValue ArrayPrototype::method_unshift(CallContext *ctx)
uint len = instance->getLength();
if (!instance->protoHasArray() && !instance->arrayData()->hasAttributes() && instance->arrayData()->length() <= len) {
- instance->arrayData()->vtable()->push_front(instance.getPointer(), ctx->callData->args, ctx->callData->argc);
+ instance->arrayData()->vtable()->push_front(instance.getPointer(), ctx->d()->callData->args, ctx->d()->callData->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->callData->argc - 1, v);
+ instance->putIndexed(k + ctx->d()->callData->argc - 1, v);
else
- instance->deleteIndexedProperty(k + ctx->callData->argc - 1);
+ instance->deleteIndexedProperty(k + ctx->d()->callData->argc - 1);
}
- for (int i = 0; i < ctx->callData->argc; ++i)
- instance->putIndexed(i, ctx->callData->args[i]);
+ for (int i = 0; i < ctx->d()->callData->argc; ++i)
+ instance->putIndexed(i, ctx->d()->callData->args[i]);
}
- uint newLen = len + ctx->callData->argc;
+ uint newLen = len + ctx->d()->callData->argc;
if (instance->isArrayObject())
instance->setArrayLengthUnchecked(newLen);
else
- instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(newLen)));
+ instance->put(ctx->d()->engine->id_length, ScopedValue(scope, Primitive::fromDouble(newLen)));
return Encode(newLen);
}
@@ -579,18 +579,18 @@ ReturnedValue ArrayPrototype::method_indexOf(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
if (!len)
return Encode(-1);
- ScopedValue searchValue(scope, ctx->callData->argument(0));
+ ScopedValue searchValue(scope, ctx->d()->callData->argument(0));
uint fromIndex = 0;
- if (ctx->callData->argc >= 2) {
- double f = ctx->callData->args[1].toInteger();
+ if (ctx->d()->callData->argc >= 2) {
+ double f = ctx->d()->callData->args[1].toInteger();
if (scope.hasException())
return Encode::undefined();
if (f >= len)
@@ -650,7 +650,7 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
@@ -660,13 +660,13 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(CallContext *ctx)
ScopedValue searchValue(scope);
uint fromIndex = len;
- if (ctx->callData->argc >= 1)
+ if (ctx->d()->callData->argc >= 1)
searchValue = ctx->argument(0);
else
searchValue = Primitive::undefinedValue();
- if (ctx->callData->argc >= 2) {
- double f = ctx->callData->args[1].toInteger();
+ if (ctx->d()->callData->argc >= 2) {
+ double f = ctx->d()->callData->args[1].toInteger();
if (scope.hasException())
return Encode::undefined();
if (f > 0)
@@ -695,7 +695,7 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(CallContext *ctx)
ReturnedValue ArrayPrototype::method_every(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->callData->thisObject.toObject(ctx));
+ Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
@@ -729,7 +729,7 @@ ReturnedValue ArrayPrototype::method_every(CallContext *ctx)
ReturnedValue ArrayPrototype::method_some(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->callData->thisObject.toObject(ctx));
+ Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
@@ -763,7 +763,7 @@ ReturnedValue ArrayPrototype::method_some(CallContext *ctx)
ReturnedValue ArrayPrototype::method_forEach(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->callData->thisObject.toObject(ctx));
+ Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
@@ -794,7 +794,7 @@ ReturnedValue ArrayPrototype::method_forEach(CallContext *ctx)
ReturnedValue ArrayPrototype::method_map(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->callData->thisObject.toObject(ctx));
+ Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
@@ -804,7 +804,7 @@ ReturnedValue ArrayPrototype::method_map(CallContext *ctx)
if (!callback)
return ctx->throwTypeError();
- Scoped<ArrayObject> a(scope, ctx->engine->newArrayObject());
+ Scoped<ArrayObject> a(scope, ctx->d()->engine->newArrayObject());
a->arrayReserve(len);
a->setArrayLengthUnchecked(len);
@@ -831,7 +831,7 @@ ReturnedValue ArrayPrototype::method_map(CallContext *ctx)
ReturnedValue ArrayPrototype::method_filter(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->callData->thisObject.toObject(ctx));
+ Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
@@ -841,7 +841,7 @@ ReturnedValue ArrayPrototype::method_filter(CallContext *ctx)
if (!callback)
return ctx->throwTypeError();
- Scoped<ArrayObject> a(scope, ctx->engine->newArrayObject());
+ Scoped<ArrayObject> a(scope, ctx->d()->engine->newArrayObject());
a->arrayReserve(len);
ScopedValue selected(scope);
@@ -872,7 +872,7 @@ ReturnedValue ArrayPrototype::method_filter(CallContext *ctx)
ReturnedValue ArrayPrototype::method_reduce(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->callData->thisObject.toObject(ctx));
+ Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
@@ -886,7 +886,7 @@ ReturnedValue ArrayPrototype::method_reduce(CallContext *ctx)
ScopedValue acc(scope);
ScopedValue v(scope);
- if (ctx->callData->argc > 1) {
+ if (ctx->d()->callData->argc > 1) {
acc = ctx->argument(1);
} else {
bool kPresent = false;
@@ -922,7 +922,7 @@ ReturnedValue ArrayPrototype::method_reduce(CallContext *ctx)
ReturnedValue ArrayPrototype::method_reduceRight(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->callData->thisObject.toObject(ctx));
+ Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
@@ -933,7 +933,7 @@ ReturnedValue ArrayPrototype::method_reduceRight(CallContext *ctx)
return ctx->throwTypeError();
if (len == 0) {
- if (ctx->callData->argc == 1)
+ if (ctx->d()->callData->argc == 1)
return ctx->throwTypeError();
return ctx->argument(1);
}
@@ -941,7 +941,7 @@ ReturnedValue ArrayPrototype::method_reduceRight(CallContext *ctx)
uint k = len;
ScopedValue acc(scope);
ScopedValue v(scope);
- if (ctx->callData->argc > 1) {
+ if (ctx->d()->callData->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 b2851abd7d..f1b4bbc901 100644
--- a/src/qml/jsruntime/qv4booleanobject.cpp
+++ b/src/qml/jsruntime/qv4booleanobject.cpp
@@ -80,26 +80,26 @@ void BooleanPrototype::init(ExecutionEngine *engine, ObjectRef ctor)
ReturnedValue BooleanPrototype::method_toString(CallContext *ctx)
{
bool result;
- if (ctx->callData->thisObject.isBoolean()) {
- result = ctx->callData->thisObject.booleanValue();
+ if (ctx->d()->callData->thisObject.isBoolean()) {
+ result = ctx->d()->callData->thisObject.booleanValue();
} else {
Scope scope(ctx);
- Scoped<BooleanObject> thisObject(scope, ctx->callData->thisObject);
+ Scoped<BooleanObject> thisObject(scope, ctx->d()->callData->thisObject);
if (!thisObject)
return ctx->throwTypeError();
result = thisObject->value().booleanValue();
}
- return Encode(ctx->engine->newString(QLatin1String(result ? "true" : "false")));
+ return Encode(ctx->d()->engine->newString(QLatin1String(result ? "true" : "false")));
}
ReturnedValue BooleanPrototype::method_valueOf(CallContext *ctx)
{
- if (ctx->callData->thisObject.isBoolean())
- return ctx->callData->thisObject.asReturnedValue();
+ if (ctx->d()->callData->thisObject.isBoolean())
+ return ctx->d()->callData->thisObject.asReturnedValue();
Scope scope(ctx);
- Scoped<BooleanObject> thisObject(scope, ctx->callData->thisObject);
+ Scoped<BooleanObject> thisObject(scope, ctx->d()->callData->thisObject);
if (!thisObject)
return ctx->throwTypeError();
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 655df13e27..528ca97208 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -57,19 +57,19 @@ CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData
{
Q_ASSERT(function->function());
- CallContext *c = static_cast<CallContext *>(engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(function, callData->argc)));
- new (c) CallContext(engine, Type_CallContext);
+ CallContext *c = static_cast<CallContext *>(d()->engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(function, callData->argc)));
+ new (c) CallContext(d()->engine, Type_CallContext);
c->function = function;
c->realArgumentCount = callData->argc;
- c->strictMode = function->strictMode();
- c->outer = function->scope();
+ c->d()->strictMode = function->strictMode();
+ c->d()->outer = function->scope();
c->activation = 0;
- c->compilationUnit = function->function()->compilationUnit;
- c->lookups = c->compilationUnit->runtimeLookups;
+ c->d()->compilationUnit = function->function()->compilationUnit;
+ c->d()->lookups = c->d()->compilationUnit->runtimeLookups;
c->locals = (Value *)((quintptr(c + 1) + 7) & ~7);
const CompiledData::Function *compiledFunction = function->function()->compiledFunction;
@@ -77,31 +77,31 @@ CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData
if (nLocals)
std::fill(c->locals, c->locals + nLocals, Primitive::undefinedValue());
- c->callData = reinterpret_cast<CallData *>(c->locals + nLocals);
- ::memcpy(c->callData, callData, sizeof(CallData) + (callData->argc - 1) * sizeof(Value));
+ c->d()->callData = reinterpret_cast<CallData *>(c->locals + nLocals);
+ ::memcpy(c->d()->callData, callData, sizeof(CallData) + (callData->argc - 1) * sizeof(Value));
if (callData->argc < static_cast<int>(compiledFunction->nFormals))
- std::fill(c->callData->args + c->callData->argc, c->callData->args + compiledFunction->nFormals, Primitive::undefinedValue());
- c->callData->argc = qMax((uint)callData->argc, compiledFunction->nFormals);
+ std::fill(c->d()->callData->args + c->d()->callData->argc, c->d()->callData->args + compiledFunction->nFormals, Primitive::undefinedValue());
+ c->d()->callData->argc = qMax((uint)callData->argc, compiledFunction->nFormals);
return c;
}
WithContext *ExecutionContext::newWithContext(ObjectRef with)
{
- WithContext *w = new (engine->memoryManager) WithContext(engine, with);
+ WithContext *w = new (d()->engine->memoryManager) WithContext(d()->engine, with);
return w;
}
CatchContext *ExecutionContext::newCatchContext(const StringRef exceptionVarName, const ValueRef exceptionValue)
{
- CatchContext *c = new (engine->memoryManager) CatchContext(engine, exceptionVarName, exceptionValue);
+ CatchContext *c = new (d()->engine->memoryManager) CatchContext(d()->engine, exceptionVarName, exceptionValue);
return c;
}
CallContext *ExecutionContext::newQmlContext(FunctionObject *f, ObjectRef qml)
{
- CallContext *c = static_cast<CallContext *>(engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(f, 0)));
- new (c) CallContext(engine, qml, f);
+ CallContext *c = static_cast<CallContext *>(d()->engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(f, 0)));
+ new (c) CallContext(d()->engine, qml, f);
return c;
}
@@ -112,17 +112,17 @@ void ExecutionContext::createMutableBinding(const StringRef name, bool deletable
Scope scope(this);
// find the right context to create the binding on
- ScopedObject activation(scope, engine->globalObject);
+ ScopedObject activation(scope, d()->engine->globalObject);
ExecutionContext *ctx = this;
while (ctx) {
- if (ctx->type >= Type_CallContext) {
+ if (ctx->d()->type >= Type_CallContext) {
CallContext *c = static_cast<CallContext *>(ctx);
if (!c->activation)
- c->activation = engine->newObject()->getPointer();
+ c->activation = d()->engine->newObject()->getPointer();
activation = c->activation;
break;
}
- ctx = ctx->outer;
+ ctx = ctx->d()->outer;
}
if (activation->hasProperty(name))
@@ -143,10 +143,10 @@ GlobalContext::GlobalContext(ExecutionEngine *eng)
WithContext::WithContext(ExecutionEngine *engine, ObjectRef with)
: ExecutionContext(engine, Type_WithContext)
{
- callData = parent->callData;
- outer = parent;
- lookups = parent->lookups;
- compilationUnit = parent->compilationUnit;
+ d()->callData = d()->parent->d()->callData;
+ d()->outer = d()->parent;
+ d()->lookups = d()->parent->d()->lookups;
+ d()->compilationUnit = d()->parent->d()->compilationUnit;
withObject = with.getPointer();
}
@@ -154,11 +154,11 @@ WithContext::WithContext(ExecutionEngine *engine, ObjectRef with)
CatchContext::CatchContext(ExecutionEngine *engine, const StringRef exceptionVarName, const ValueRef exceptionValue)
: ExecutionContext(engine, Type_CatchContext)
{
- strictMode = parent->strictMode;
- callData = parent->callData;
- outer = parent;
- lookups = parent->lookups;
- compilationUnit = parent->compilationUnit;
+ d()->strictMode = d()->parent->d()->strictMode;
+ d()->callData = d()->parent->d()->callData;
+ d()->outer = d()->parent;
+ d()->lookups = d()->parent->d()->lookups;
+ d()->compilationUnit = d()->parent->d()->compilationUnit;
this->exceptionVarName = exceptionVarName;
this->exceptionValue = exceptionValue;
@@ -168,19 +168,19 @@ CallContext::CallContext(ExecutionEngine *engine, ObjectRef qml, FunctionObject
: ExecutionContext(engine, Type_QmlContext)
{
this->function = function;
- callData = reinterpret_cast<CallData *>(this + 1);
- callData->tag = QV4::Value::_Integer_Type;
- callData->argc = 0;
- callData->thisObject = Primitive::undefinedValue();
+ d()->callData = reinterpret_cast<CallData *>(this + 1);
+ d()->callData->tag = QV4::Value::_Integer_Type;
+ d()->callData->argc = 0;
+ d()->callData->thisObject = Primitive::undefinedValue();
- strictMode = true;
- outer = function->scope();
+ d()->strictMode = true;
+ d()->outer = function->scope();
activation = qml.getPointer();
if (function->function()) {
- compilationUnit = function->function()->compilationUnit;
- lookups = compilationUnit->runtimeLookups;
+ d()->compilationUnit = function->function()->compilationUnit;
+ d()->lookups = d()->compilationUnit->runtimeLookups;
}
locals = (Value *)(this + 1);
@@ -214,17 +214,17 @@ bool ExecutionContext::deleteProperty(const StringRef name)
{
Scope scope(this);
bool hasWith = false;
- for (ExecutionContext *ctx = this; ctx; ctx = ctx->outer) {
- if (ctx->type == Type_WithContext) {
+ for (ExecutionContext *ctx = this; ctx; ctx = ctx->d()->outer) {
+ if (ctx->d()->type == Type_WithContext) {
hasWith = true;
WithContext *w = static_cast<WithContext *>(ctx);
if (w->withObject->hasProperty(name))
return w->withObject->deleteProperty(name);
- } else if (ctx->type == Type_CatchContext) {
+ } else if (ctx->d()->type == Type_CatchContext) {
CatchContext *c = static_cast<CatchContext *>(ctx);
if (c->exceptionVarName->isEqualTo(name))
return false;
- } else if (ctx->type >= Type_CallContext) {
+ } else if (ctx->d()->type >= Type_CallContext) {
CallContext *c = static_cast<CallContext *>(ctx);
FunctionObject *f = c->function;
if (f->needsActivation() || hasWith) {
@@ -235,50 +235,50 @@ bool ExecutionContext::deleteProperty(const StringRef name)
}
if (c->activation && c->activation->hasProperty(name))
return c->activation->deleteProperty(name);
- } else if (ctx->type == Type_GlobalContext) {
+ } else if (ctx->d()->type == Type_GlobalContext) {
GlobalContext *g = static_cast<GlobalContext *>(ctx);
if (g->global->hasProperty(name))
return g->global->deleteProperty(name);
}
}
- if (strictMode)
+ if (d()->strictMode)
throwSyntaxError(QStringLiteral("Can't delete property %1").arg(name->toQString()));
return true;
}
bool CallContext::needsOwnArguments() const
{
- return function->needsActivation() || callData->argc < static_cast<int>(function->formalParameterCount());
+ return function->needsActivation() || d()->callData->argc < static_cast<int>(function->formalParameterCount());
}
void ExecutionContext::markObjects(Managed *m, ExecutionEngine *engine)
{
ExecutionContext *ctx = static_cast<ExecutionContext *>(m);
- if (ctx->outer)
- ctx->outer->mark(engine);
+ if (ctx->d()->outer)
+ ctx->d()->outer->mark(engine);
// ### shouldn't need these 3 lines
- ctx->callData->thisObject.mark(engine);
- for (int arg = 0; arg < ctx->callData->argc; ++arg)
- ctx->callData->args[arg].mark(engine);
+ ctx->d()->callData->thisObject.mark(engine);
+ for (int arg = 0; arg < ctx->d()->callData->argc; ++arg)
+ ctx->d()->callData->args[arg].mark(engine);
- if (ctx->type >= Type_CallContext) {
+ if (ctx->d()->type >= Type_CallContext) {
QV4::CallContext *c = static_cast<CallContext *>(ctx);
for (unsigned local = 0, lastLocal = c->function->varCount(); local < lastLocal; ++local)
c->locals[local].mark(engine);
if (c->activation)
c->activation->mark(engine);
c->function->mark(engine);
- } else if (ctx->type == Type_WithContext) {
+ } else if (ctx->d()->type == Type_WithContext) {
WithContext *w = static_cast<WithContext *>(ctx);
w->withObject->mark(engine);
- } else if (ctx->type == Type_CatchContext) {
+ } else if (ctx->d()->type == Type_CatchContext) {
CatchContext *c = static_cast<CatchContext *>(ctx);
c->exceptionVarName->mark(engine);
c->exceptionValue.mark(engine);
- } else if (ctx->type == Type_GlobalContext) {
+ } else if (ctx->d()->type == Type_GlobalContext) {
GlobalContext *g = static_cast<GlobalContext *>(ctx);
g->global->mark(engine);
}
@@ -287,25 +287,25 @@ void ExecutionContext::markObjects(Managed *m, ExecutionEngine *engine)
void ExecutionContext::setProperty(const StringRef name, const ValueRef value)
{
Scope scope(this);
- for (ExecutionContext *ctx = this; ctx; ctx = ctx->outer) {
- if (ctx->type == Type_WithContext) {
+ for (ExecutionContext *ctx = this; ctx; ctx = ctx->d()->outer) {
+ if (ctx->d()->type == Type_WithContext) {
ScopedObject w(scope, static_cast<WithContext *>(ctx)->withObject);
if (w->hasProperty(name)) {
w->put(name, value);
return;
}
- } else if (ctx->type == Type_CatchContext && static_cast<CatchContext *>(ctx)->exceptionVarName->isEqualTo(name)) {
+ } else if (ctx->d()->type == Type_CatchContext && static_cast<CatchContext *>(ctx)->exceptionVarName->isEqualTo(name)) {
static_cast<CatchContext *>(ctx)->exceptionValue = *value;
return;
} else {
ScopedObject activation(scope, (Object *)0);
- if (ctx->type >= Type_CallContext) {
+ if (ctx->d()->type >= Type_CallContext) {
CallContext *c = static_cast<CallContext *>(ctx);
if (c->function->function()) {
uint index = c->function->function()->internalClass->find(name);
if (index < UINT_MAX) {
if (index < c->function->formalParameterCount()) {
- c->callData->args[c->function->formalParameterCount() - index - 1] = *value;
+ c->d()->callData->args[c->function->formalParameterCount() - index - 1] = *value;
} else {
index -= c->function->formalParameterCount();
c->locals[index] = *value;
@@ -314,12 +314,12 @@ void ExecutionContext::setProperty(const StringRef name, const ValueRef value)
}
}
activation = c->activation;
- } else if (ctx->type == Type_GlobalContext) {
+ } else if (ctx->d()->type == Type_GlobalContext) {
activation = static_cast<GlobalContext *>(ctx)->global;
}
if (activation) {
- if (ctx->type == Type_QmlContext) {
+ if (ctx->d()->type == Type_QmlContext) {
activation->put(name, value);
return;
} else {
@@ -332,12 +332,12 @@ void ExecutionContext::setProperty(const StringRef name, const ValueRef value)
}
}
}
- if (strictMode || name->equals(engine->id_this)) {
+ if (d()->strictMode || name->equals(d()->engine->id_this)) {
ScopedValue n(scope, name.asReturnedValue());
throwReferenceError(n);
return;
}
- engine->globalObject->put(name, value);
+ d()->engine->globalObject->put(name, value);
}
ReturnedValue ExecutionContext::getProperty(const StringRef name)
@@ -346,13 +346,13 @@ ReturnedValue ExecutionContext::getProperty(const StringRef name)
ScopedValue v(scope);
name->makeIdentifier();
- if (name->equals(engine->id_this))
- return callData->thisObject.asReturnedValue();
+ if (name->equals(d()->engine->id_this))
+ return d()->callData->thisObject.asReturnedValue();
bool hasWith = false;
bool hasCatchScope = false;
- for (ExecutionContext *ctx = this; ctx; ctx = ctx->outer) {
- if (ctx->type == Type_WithContext) {
+ for (ExecutionContext *ctx = this; ctx; ctx = ctx->d()->outer) {
+ if (ctx->d()->type == Type_WithContext) {
ScopedObject w(scope, static_cast<WithContext *>(ctx)->withObject);
hasWith = true;
bool hasProperty = false;
@@ -363,21 +363,21 @@ ReturnedValue ExecutionContext::getProperty(const StringRef name)
continue;
}
- else if (ctx->type == Type_CatchContext) {
+ else if (ctx->d()->type == Type_CatchContext) {
hasCatchScope = true;
CatchContext *c = static_cast<CatchContext *>(ctx);
if (c->exceptionVarName->isEqualTo(name))
return c->exceptionValue.asReturnedValue();
}
- else if (ctx->type >= Type_CallContext) {
+ else if (ctx->d()->type >= Type_CallContext) {
QV4::CallContext *c = static_cast<CallContext *>(ctx);
ScopedFunctionObject f(scope, c->function);
if (f->function() && (f->needsActivation() || hasWith || hasCatchScope)) {
uint index = f->function()->internalClass->find(name);
if (index < UINT_MAX) {
if (index < c->function->formalParameterCount())
- return c->callData->args[c->function->formalParameterCount() - index - 1].asReturnedValue();
+ return c->d()->callData->args[c->function->formalParameterCount() - index - 1].asReturnedValue();
return c->locals[index - c->function->formalParameterCount()].asReturnedValue();
}
}
@@ -392,7 +392,7 @@ ReturnedValue ExecutionContext::getProperty(const StringRef name)
return f.asReturnedValue();
}
- else if (ctx->type == Type_GlobalContext) {
+ else if (ctx->d()->type == Type_GlobalContext) {
GlobalContext *g = static_cast<GlobalContext *>(ctx);
bool hasProperty = false;
v = g->global->get(name, &hasProperty);
@@ -411,13 +411,13 @@ ReturnedValue ExecutionContext::getPropertyAndBase(const StringRef name, ObjectR
base = (Object *)0;
name->makeIdentifier();
- if (name->equals(engine->id_this))
- return callData->thisObject.asReturnedValue();
+ if (name->equals(d()->engine->id_this))
+ return d()->callData->thisObject.asReturnedValue();
bool hasWith = false;
bool hasCatchScope = false;
- for (ExecutionContext *ctx = this; ctx; ctx = ctx->outer) {
- if (ctx->type == Type_WithContext) {
+ for (ExecutionContext *ctx = this; ctx; ctx = ctx->d()->outer) {
+ if (ctx->d()->type == Type_WithContext) {
Object *w = static_cast<WithContext *>(ctx)->withObject;
hasWith = true;
bool hasProperty = false;
@@ -429,21 +429,21 @@ ReturnedValue ExecutionContext::getPropertyAndBase(const StringRef name, ObjectR
continue;
}
- else if (ctx->type == Type_CatchContext) {
+ else if (ctx->d()->type == Type_CatchContext) {
hasCatchScope = true;
CatchContext *c = static_cast<CatchContext *>(ctx);
if (c->exceptionVarName->isEqualTo(name))
return c->exceptionValue.asReturnedValue();
}
- else if (ctx->type >= Type_CallContext) {
+ else if (ctx->d()->type >= Type_CallContext) {
QV4::CallContext *c = static_cast<CallContext *>(ctx);
FunctionObject *f = c->function;
if (f->function() && (f->needsActivation() || hasWith || hasCatchScope)) {
uint index = f->function()->internalClass->find(name);
if (index < UINT_MAX) {
if (index < c->function->formalParameterCount())
- return c->callData->args[c->function->formalParameterCount() - index - 1].asReturnedValue();
+ return c->d()->callData->args[c->function->formalParameterCount() - index - 1].asReturnedValue();
return c->locals[index - c->function->formalParameterCount()].asReturnedValue();
}
}
@@ -451,7 +451,7 @@ ReturnedValue ExecutionContext::getPropertyAndBase(const StringRef name, ObjectR
bool hasProperty = false;
v = c->activation->get(name, &hasProperty);
if (hasProperty) {
- if (ctx->type == Type_QmlContext)
+ if (ctx->d()->type == Type_QmlContext)
base = c->activation;
return v.asReturnedValue();
}
@@ -461,7 +461,7 @@ ReturnedValue ExecutionContext::getPropertyAndBase(const StringRef name, ObjectR
return c->function->asReturnedValue();
}
- else if (ctx->type == Type_GlobalContext) {
+ else if (ctx->d()->type == Type_GlobalContext) {
GlobalContext *g = static_cast<GlobalContext *>(ctx);
bool hasProperty = false;
v = g->global->get(name, &hasProperty);
@@ -476,56 +476,56 @@ ReturnedValue ExecutionContext::getPropertyAndBase(const StringRef name, ObjectR
ReturnedValue ExecutionContext::throwError(const ValueRef value)
{
- return engine->throwException(value);
+ return d()->engine->throwException(value);
}
ReturnedValue ExecutionContext::throwError(const QString &message)
{
Scope scope(this);
- ScopedValue v(scope, engine->newString(message));
- v = engine->newErrorObject(v);
+ ScopedValue v(scope, d()->engine->newString(message));
+ v = d()->engine->newErrorObject(v);
return throwError(v);
}
ReturnedValue ExecutionContext::throwSyntaxError(const QString &message, const QString &fileName, int line, int column)
{
Scope scope(this);
- Scoped<Object> error(scope, engine->newSyntaxErrorObject(message, fileName, line, column));
+ Scoped<Object> error(scope, d()->engine->newSyntaxErrorObject(message, fileName, line, column));
return throwError(error);
}
ReturnedValue ExecutionContext::throwSyntaxError(const QString &message)
{
Scope scope(this);
- Scoped<Object> error(scope, engine->newSyntaxErrorObject(message));
+ Scoped<Object> error(scope, d()->engine->newSyntaxErrorObject(message));
return throwError(error);
}
ReturnedValue ExecutionContext::throwTypeError()
{
Scope scope(this);
- Scoped<Object> error(scope, engine->newTypeErrorObject(QStringLiteral("Type error")));
+ Scoped<Object> error(scope, d()->engine->newTypeErrorObject(QStringLiteral("Type error")));
return throwError(error);
}
ReturnedValue ExecutionContext::throwTypeError(const QString &message)
{
Scope scope(this);
- Scoped<Object> error(scope, engine->newTypeErrorObject(message));
+ Scoped<Object> error(scope, d()->engine->newTypeErrorObject(message));
return throwError(error);
}
ReturnedValue ExecutionContext::throwUnimplemented(const QString &message)
{
Scope scope(this);
- ScopedValue v(scope, engine->newString(QStringLiteral("Unimplemented ") + message));
- v = engine->newErrorObject(v);
+ ScopedValue v(scope, d()->engine->newString(QStringLiteral("Unimplemented ") + message));
+ v = d()->engine->newErrorObject(v);
return throwError(v);
}
ReturnedValue ExecutionContext::catchException(StackTrace *trace)
{
- return engine->catchException(this, trace);
+ return d()->engine->catchException(this, trace);
}
ReturnedValue ExecutionContext::throwReferenceError(const ValueRef value)
@@ -533,7 +533,7 @@ ReturnedValue ExecutionContext::throwReferenceError(const ValueRef value)
Scope scope(this);
Scoped<String> s(scope, value->toString(this));
QString msg = s->toQString() + QStringLiteral(" is not defined");
- Scoped<Object> error(scope, engine->newReferenceErrorObject(msg));
+ Scoped<Object> error(scope, d()->engine->newReferenceErrorObject(msg));
return throwError(error);
}
@@ -541,7 +541,7 @@ ReturnedValue ExecutionContext::throwReferenceError(const QString &message, cons
{
Scope scope(this);
QString msg = message;
- Scoped<Object> error(scope, engine->newReferenceErrorObject(msg, fileName, line, column));
+ Scoped<Object> error(scope, d()->engine->newReferenceErrorObject(msg, fileName, line, column));
return throwError(error);
}
@@ -550,20 +550,20 @@ ReturnedValue ExecutionContext::throwRangeError(const ValueRef value)
Scope scope(this);
ScopedString s(scope, value->toString(this));
QString msg = s->toQString() + QStringLiteral(" out of range");
- ScopedObject error(scope, engine->newRangeErrorObject(msg));
+ ScopedObject error(scope, d()->engine->newRangeErrorObject(msg));
return throwError(error);
}
ReturnedValue ExecutionContext::throwRangeError(const QString &message)
{
Scope scope(this);
- ScopedObject error(scope, engine->newRangeErrorObject(message));
+ ScopedObject error(scope, d()->engine->newRangeErrorObject(message));
return throwError(error);
}
ReturnedValue ExecutionContext::throwURIError(const ValueRef msg)
{
Scope scope(this);
- ScopedObject error(scope, engine->newURIErrorObject(msg));
+ ScopedObject error(scope, d()->engine->newURIErrorObject(msg));
return throwError(error);
}
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index a07cbf2da5..e4e9c09ad8 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -69,8 +69,6 @@ struct WithContext;
struct Q_QML_EXPORT ExecutionContext : public Managed
{
- V4_MANAGED
- Q_MANAGED_TYPE(ExecutionContext)
enum {
IsExecutionContext = true
};
@@ -83,41 +81,61 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
Type_CallContext = 0x5,
Type_QmlContext = 0x6
};
-
- ExecutionContext(ExecutionEngine *engine, ContextType t)
- : Managed(engine->executionContextClass)
+ struct EvalCode
{
- this->type = t;
- strictMode = false;
- this->engine = engine;
- this->parent = engine->currentContext();
- outer = 0;
- lookups = 0;
- compilationUnit = 0;
- currentEvalCode = 0;
- lineNumber = -1;
- engine->current = this;
- }
+ Function *function;
+ EvalCode *next;
+ };
- ContextType type;
- bool strictMode;
+ struct Data : Managed::Data {
+ ContextType type;
+ bool strictMode;
- CallData *callData;
+ CallData *callData;
- ExecutionEngine *engine;
- ExecutionContext *parent;
- ExecutionContext *outer;
- Lookup *lookups;
- CompiledData::CompilationUnit *compilationUnit;
+ ExecutionEngine *engine;
+ ExecutionContext *parent;
+ ExecutionContext *outer;
+ Lookup *lookups;
+ CompiledData::CompilationUnit *compilationUnit;
+ EvalCode *currentEvalCode;
+
+ int lineNumber;
- struct EvalCode
- {
- Function *function;
- EvalCode *next;
};
- EvalCode *currentEvalCode;
+ struct {
+ ContextType type;
+ bool strictMode;
+
+ CallData *callData;
- int lineNumber;
+ ExecutionEngine *engine;
+ ExecutionContext *parent;
+ ExecutionContext *outer;
+ Lookup *lookups;
+ CompiledData::CompilationUnit *compilationUnit;
+ EvalCode *currentEvalCode;
+
+ int lineNumber;
+ } __data;
+
+ V4_MANAGED_NEW
+ Q_MANAGED_TYPE(ExecutionContext)
+
+ ExecutionContext(ExecutionEngine *engine, ContextType t)
+ : Managed(engine->executionContextClass)
+ {
+ d()->type = t;
+ d()->strictMode = false;
+ d()->engine = engine;
+ d()->parent = engine->currentContext();
+ d()->outer = 0;
+ d()->lookups = 0;
+ d()->compilationUnit = 0;
+ d()->currentEvalCode = 0;
+ d()->lineNumber = -1;
+ engine->current = this;
+ }
CallContext *newCallContext(FunctionObject *f, CallData *callData);
WithContext *newWithContext(ObjectRef with);
@@ -180,7 +198,7 @@ struct CallContext : public ExecutionContext
};
inline ReturnedValue CallContext::argument(int i) {
- return i < callData->argc ? callData->args[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue();
+ return i < d()->callData->argc ? d()->callData->args[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue();
}
struct GlobalContext : public ExecutionContext
@@ -206,26 +224,26 @@ struct WithContext : public ExecutionContext
inline CallContext *ExecutionContext::asCallContext()
{
- return type >= Type_SimpleCallContext ? static_cast<CallContext *>(this) : 0;
+ return d()->type >= Type_SimpleCallContext ? static_cast<CallContext *>(this) : 0;
}
inline const CallContext *ExecutionContext::asCallContext() const
{
- return type >= Type_SimpleCallContext ? static_cast<const CallContext *>(this) : 0;
+ return d()->type >= Type_SimpleCallContext ? static_cast<const CallContext *>(this) : 0;
}
inline void ExecutionEngine::pushContext(CallContext *context)
{
- context->parent = current;
+ context->d()->parent = current;
current = context;
- current->currentEvalCode = 0;
+ current->d()->currentEvalCode = 0;
}
inline ExecutionContext *ExecutionEngine::popContext()
{
- Q_ASSERT(current->parent);
- current = current->parent;
+ Q_ASSERT(current->d()->parent);
+ current = current->d()->parent;
return current;
}
@@ -235,7 +253,7 @@ struct ExecutionContextSaver
ExecutionContext *savedContext;
ExecutionContextSaver(ExecutionContext *context)
- : engine(context->engine)
+ : engine(context->d()->engine)
, savedContext(context)
{
}
@@ -246,7 +264,7 @@ struct ExecutionContextSaver
};
inline Scope::Scope(ExecutionContext *ctx)
- : engine(ctx->engine)
+ : engine(ctx->d()->engine)
#ifndef QT_NO_DEBUG
, size(0)
#endif
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index 61261d6b8a..6c485200c9 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -770,7 +770,7 @@ void DatePrototype::init(ExecutionEngine *engine, ObjectRef ctor)
double DatePrototype::getThisDate(ExecutionContext *ctx)
{
- if (DateObject *thisObject = ctx->callData->thisObject.asDateObject())
+ if (DateObject *thisObject = ctx->d()->callData->thisObject.asDateObject())
return thisObject->date().asDouble();
else {
ctx->throwTypeError();
@@ -780,22 +780,22 @@ double DatePrototype::getThisDate(ExecutionContext *ctx)
ReturnedValue DatePrototype::method_parse(CallContext *ctx)
{
- if (!ctx->callData->argc)
+ if (!ctx->d()->callData->argc)
return Encode(qSNaN());
- return Encode(ParseString(ctx->callData->args[0].toString(ctx)->toQString()));
+ return Encode(ParseString(ctx->d()->callData->args[0].toString(ctx)->toQString()));
}
ReturnedValue DatePrototype::method_UTC(CallContext *ctx)
{
- const int numArgs = ctx->callData->argc;
+ const int numArgs = ctx->d()->callData->argc;
if (numArgs >= 2) {
- double year = ctx->callData->args[0].toNumber();
- double month = ctx->callData->args[1].toNumber();
- double day = numArgs >= 3 ? ctx->callData->args[2].toNumber() : 1;
- double hours = numArgs >= 4 ? ctx->callData->args[3].toNumber() : 0;
- double mins = numArgs >= 5 ? ctx->callData->args[4].toNumber() : 0;
- double secs = numArgs >= 6 ? ctx->callData->args[5].toNumber() : 0;
- double ms = numArgs >= 7 ? ctx->callData->args[6].toNumber() : 0;
+ 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;
if (year >= 0 && year <= 99)
year += 1900;
double t = MakeDate(MakeDay(year, month, day),
@@ -815,37 +815,37 @@ ReturnedValue DatePrototype::method_now(CallContext *ctx)
ReturnedValue DatePrototype::method_toString(CallContext *ctx)
{
double t = getThisDate(ctx);
- return ctx->engine->newString(ToString(t))->asReturnedValue();
+ return ctx->d()->engine->newString(ToString(t))->asReturnedValue();
}
ReturnedValue DatePrototype::method_toDateString(CallContext *ctx)
{
double t = getThisDate(ctx);
- return ctx->engine->newString(ToDateString(t))->asReturnedValue();
+ return ctx->d()->engine->newString(ToDateString(t))->asReturnedValue();
}
ReturnedValue DatePrototype::method_toTimeString(CallContext *ctx)
{
double t = getThisDate(ctx);
- return ctx->engine->newString(ToTimeString(t))->asReturnedValue();
+ return ctx->d()->engine->newString(ToTimeString(t))->asReturnedValue();
}
ReturnedValue DatePrototype::method_toLocaleString(CallContext *ctx)
{
double t = getThisDate(ctx);
- return ctx->engine->newString(ToLocaleString(t))->asReturnedValue();
+ return ctx->d()->engine->newString(ToLocaleString(t))->asReturnedValue();
}
ReturnedValue DatePrototype::method_toLocaleDateString(CallContext *ctx)
{
double t = getThisDate(ctx);
- return ctx->engine->newString(ToLocaleDateString(t))->asReturnedValue();
+ return ctx->d()->engine->newString(ToLocaleDateString(t))->asReturnedValue();
}
ReturnedValue DatePrototype::method_toLocaleTimeString(CallContext *ctx)
{
double t = getThisDate(ctx);
- return ctx->engine->newString(ToLocaleTimeString(t))->asReturnedValue();
+ return ctx->d()->engine->newString(ToLocaleTimeString(t))->asReturnedValue();
}
ReturnedValue DatePrototype::method_valueOf(CallContext *ctx)
@@ -1007,11 +1007,11 @@ ReturnedValue DatePrototype::method_getTimezoneOffset(CallContext *ctx)
ReturnedValue DatePrototype::method_setTime(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DateObject> self(scope, ctx->callData->thisObject);
+ Scoped<DateObject> self(scope, ctx->d()->callData->thisObject);
if (!self)
return ctx->throwTypeError();
- double t = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
+ double t = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
self->date().setDouble(TimeClip(t));
return self->date().asReturnedValue();
}
@@ -1019,37 +1019,37 @@ ReturnedValue DatePrototype::method_setTime(CallContext *ctx)
ReturnedValue DatePrototype::method_setMilliseconds(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DateObject> self(scope, ctx->callData->thisObject);
+ Scoped<DateObject> self(scope, ctx->d()->callData->thisObject);
if (!self)
return ctx->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double ms = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
+ double ms = ctx->d()->callData->argc ? ctx->d()->callData->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->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = self->date().asDouble();
- double ms = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
+ double ms = ctx->d()->callData->argc ? ctx->d()->callData->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_setSeconds(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double sec = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
- double ms = (ctx->callData->argc < 2) ? msFromTime(t) : ctx->callData->args[1].toNumber();
+ 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();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), sec, ms))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1057,13 +1057,13 @@ ReturnedValue DatePrototype::method_setSeconds(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCSeconds(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = self->date().asDouble();
- double sec = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
- double ms = (ctx->callData->argc < 2) ? msFromTime(t) : ctx->callData->args[1].toNumber();
+ 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();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), sec, ms))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1071,14 +1071,14 @@ ReturnedValue DatePrototype::method_setUTCSeconds(CallContext *ctx)
ReturnedValue DatePrototype::method_setMinutes(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double min = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
- double sec = (ctx->callData->argc < 2) ? SecFromTime(t) : ctx->callData->args[1].toNumber();
- double ms = (ctx->callData->argc < 3) ? msFromTime(t) : ctx->callData->args[2].toNumber();
+ 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();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), min, sec, ms))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1086,14 +1086,14 @@ ReturnedValue DatePrototype::method_setMinutes(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCMinutes(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = self->date().asDouble();
- double min = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
- double sec = (ctx->callData->argc < 2) ? SecFromTime(t) : ctx->callData->args[1].toNumber();
- double ms = (ctx->callData->argc < 3) ? msFromTime(t) : ctx->callData->args[2].toNumber();
+ 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();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), min, sec, ms))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1101,15 +1101,15 @@ ReturnedValue DatePrototype::method_setUTCMinutes(CallContext *ctx)
ReturnedValue DatePrototype::method_setHours(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double hour = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
- double min = (ctx->callData->argc < 2) ? MinFromTime(t) : ctx->callData->args[1].toNumber();
- double sec = (ctx->callData->argc < 3) ? SecFromTime(t) : ctx->callData->args[2].toNumber();
- double ms = (ctx->callData->argc < 4) ? msFromTime(t) : ctx->callData->args[3].toNumber();
+ 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();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(hour, min, sec, ms))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1117,15 +1117,15 @@ ReturnedValue DatePrototype::method_setHours(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCHours(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = self->date().asDouble();
- double hour = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
- double min = (ctx->callData->argc < 2) ? MinFromTime(t) : ctx->callData->args[1].toNumber();
- double sec = (ctx->callData->argc < 3) ? SecFromTime(t) : ctx->callData->args[2].toNumber();
- double ms = (ctx->callData->argc < 4) ? msFromTime(t) : ctx->callData->args[3].toNumber();
+ 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();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(hour, min, sec, ms))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1133,12 +1133,12 @@ ReturnedValue DatePrototype::method_setUTCHours(CallContext *ctx)
ReturnedValue DatePrototype::method_setDate(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double date = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
+ double date = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), date), TimeWithinDay(t))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1146,12 +1146,12 @@ ReturnedValue DatePrototype::method_setDate(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCDate(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = self->date().asDouble();
- double date = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
+ double date = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), date), TimeWithinDay(t))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1159,13 +1159,13 @@ ReturnedValue DatePrototype::method_setUTCDate(CallContext *ctx)
ReturnedValue DatePrototype::method_setMonth(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double month = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
- double date = (ctx->callData->argc < 2) ? DateFromTime(t) : ctx->callData->args[1].toNumber();
+ 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();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), month, date), TimeWithinDay(t))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1173,13 +1173,13 @@ ReturnedValue DatePrototype::method_setMonth(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCMonth(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = self->date().asDouble();
- double month = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
- double date = (ctx->callData->argc < 2) ? DateFromTime(t) : ctx->callData->args[1].toNumber();
+ 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();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), month, date), TimeWithinDay(t))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1187,7 +1187,7 @@ ReturnedValue DatePrototype::method_setUTCMonth(CallContext *ctx)
ReturnedValue DatePrototype::method_setYear(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
@@ -1196,7 +1196,7 @@ ReturnedValue DatePrototype::method_setYear(CallContext *ctx)
t = 0;
else
t = LocalTime(t);
- double year = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
+ double year = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
double r;
if (std::isnan(year)) {
r = qSNaN();
@@ -1213,14 +1213,14 @@ ReturnedValue DatePrototype::method_setYear(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCFullYear(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = self->date().asDouble();
- double year = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
- double month = (ctx->callData->argc < 2) ? MonthFromTime(t) : ctx->callData->args[1].toNumber();
- double date = (ctx->callData->argc < 3) ? DateFromTime(t) : ctx->callData->args[2].toNumber();
+ 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();
t = TimeClip(UTC(MakeDate(MakeDay(year, month, date), TimeWithinDay(t))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1228,16 +1228,16 @@ ReturnedValue DatePrototype::method_setUTCFullYear(CallContext *ctx)
ReturnedValue DatePrototype::method_setFullYear(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = LocalTime(self->date().asDouble());
if (std::isnan(t))
t = 0;
- double year = ctx->callData->argc ? ctx->callData->args[0].toNumber() : qSNaN();
- double month = (ctx->callData->argc < 2) ? MonthFromTime(t) : ctx->callData->args[1].toNumber();
- double date = (ctx->callData->argc < 3) ? DateFromTime(t) : ctx->callData->args[2].toNumber();
+ 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();
t = TimeClip(UTC(MakeDate(MakeDay(year, month, date), TimeWithinDay(t))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1245,12 +1245,12 @@ ReturnedValue DatePrototype::method_setFullYear(CallContext *ctx)
ReturnedValue DatePrototype::method_toUTCString(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = self->date().asDouble();
- return ctx->engine->newString(ToUTCString(t))->asReturnedValue();
+ return ctx->d()->engine->newString(ToUTCString(t))->asReturnedValue();
}
static void addZeroPrefixedInt(QString &str, int num, int nDigits)
@@ -1268,19 +1268,19 @@ static void addZeroPrefixedInt(QString &str, int num, int nDigits)
ReturnedValue DatePrototype::method_toISOString(CallContext *ctx)
{
- DateObject *self = ctx->callData->thisObject.asDateObject();
+ DateObject *self = ctx->d()->callData->thisObject.asDateObject();
if (!self)
return ctx->throwTypeError();
double t = self->date().asDouble();
if (!std::isfinite(t))
- return ctx->throwRangeError(ctx->callData->thisObject);
+ return ctx->throwRangeError(ctx->d()->callData->thisObject);
QString result;
int year = (int)YearFromTime(t);
if (year < 0 || year > 9999) {
if (qAbs(year) >= 1000000)
- return ctx->engine->newString(QStringLiteral("Invalid Date"))->asReturnedValue();
+ return ctx->d()->engine->newString(QStringLiteral("Invalid Date"))->asReturnedValue();
result += year < 0 ? QLatin1Char('-') : QLatin1Char('+');
year = qAbs(year);
addZeroPrefixedInt(result, year, 6);
@@ -1301,19 +1301,19 @@ ReturnedValue DatePrototype::method_toISOString(CallContext *ctx)
addZeroPrefixedInt(result, msFromTime(t), 3);
result += QLatin1Char('Z');
- return ctx->engine->newString(result)->asReturnedValue();
+ return ctx->d()->engine->newString(result)->asReturnedValue();
}
ReturnedValue DatePrototype::method_toJSON(CallContext *ctx)
{
Scope scope(ctx);
- ScopedValue O(scope, RuntimeHelpers::toObject(ctx, ValueRef(&ctx->callData->thisObject)));
+ ScopedValue O(scope, RuntimeHelpers::toObject(ctx, ValueRef(&ctx->d()->callData->thisObject)));
ScopedValue tv(scope, RuntimeHelpers::toPrimitive(O, NUMBER_HINT));
if (tv->isNumber() && !std::isfinite(tv->toNumber()))
return Encode::null();
- ScopedString s(scope, ctx->engine->newString(QStringLiteral("toISOString")));
+ ScopedString s(scope, ctx->d()->engine->newString(QStringLiteral("toISOString")));
ScopedValue v(scope, O->objectValue()->get(s));
FunctionObject *toIso = v->asFunctionObject();
@@ -1321,7 +1321,7 @@ ReturnedValue DatePrototype::method_toJSON(CallContext *ctx)
return ctx->throwTypeError();
ScopedCallData callData(scope, 0);
- callData->thisObject = ctx->callData->thisObject;
+ callData->thisObject = ctx->d()->callData->thisObject;
return toIso->call(callData);
}
diff --git a/src/qml/jsruntime/qv4debugging.cpp b/src/qml/jsruntime/qv4debugging.cpp
index 9917426284..59b7c5fb9c 100644
--- a/src/qml/jsruntime/qv4debugging.cpp
+++ b/src/qml/jsruntime/qv4debugging.cpp
@@ -210,7 +210,7 @@ Debugger::ExecutionState Debugger::currentExecutionState() const
{
ExecutionState state;
state.fileName = getFunction()->sourceFile();
- state.lineNumber = engine()->currentContext()->lineNumber;
+ state.lineNumber = engine()->currentContext()->d()->lineNumber;
return state;
}
@@ -229,7 +229,7 @@ static inline CallContext *findContext(ExecutionContext *ctxt, int frame)
return cCtxt;
--frame;
}
- ctxt = ctxt->parent;
+ ctxt = ctxt->d()->parent;
}
return 0;
@@ -238,7 +238,7 @@ static inline CallContext *findContext(ExecutionContext *ctxt, int frame)
static inline CallContext *findScope(ExecutionContext *ctxt, int scope)
{
for (; scope > 0 && ctxt; --scope)
- ctxt = ctxt->outer;
+ ctxt = ctxt->d()->outer;
return ctxt ? ctxt->asCallContext() : 0;
}
@@ -369,7 +369,7 @@ bool Debugger::collectThisInContext(Debugger::Collector *collector, int frame)
if (CallContext *cCtxt = ctxt->asCallContext())
if (cCtxt->activation)
break;
- ctxt = ctxt->outer;
+ ctxt = ctxt->d()->outer;
}
if (!ctxt)
@@ -434,12 +434,12 @@ QVector<ExecutionContext::ContextType> Debugger::getScopeTypes(int frame) const
return types;
CallContext *sctxt = findContext(m_engine->currentContext(), frame);
- if (!sctxt || sctxt->type < ExecutionContext::Type_SimpleCallContext)
+ if (!sctxt || sctxt->d()->type < ExecutionContext::Type_SimpleCallContext)
return types;
CallContext *ctxt = static_cast<CallContext *>(sctxt);
- for (ExecutionContext *it = ctxt; it; it = it->outer)
- types.append(it->type);
+ for (ExecutionContext *it = ctxt; it; it = it->d()->outer)
+ types.append(it->d()->type);
return types;
}
@@ -450,7 +450,7 @@ void Debugger::maybeBreakAtInstruction()
return;
QMutexLocker locker(&m_lock);
- int lineNumber = engine()->currentContext()->lineNumber;
+ int lineNumber = engine()->currentContext()->d()->lineNumber;
if (m_gatherSources) {
m_gatherSources->run();
@@ -495,7 +495,7 @@ void Debugger::leavingFunction(const ReturnedValue &retVal)
QMutexLocker locker(&m_lock);
if (m_stepping != NotStepping && m_currentContext == m_engine->currentContext()) {
- m_currentContext = m_engine->currentContext()->parent;
+ m_currentContext = m_engine->currentContext()->d()->parent;
m_stepping = StepOver;
m_returnedValue = retVal;
}
@@ -519,8 +519,8 @@ Function *Debugger::getFunction() const
if (CallContext *callCtx = context->asCallContext())
return callCtx->function->function();
else {
- Q_ASSERT(context->type == QV4::ExecutionContext::Type_GlobalContext);
- return context->engine->globalCode;
+ Q_ASSERT(context->d()->type == QV4::ExecutionContext::Type_GlobalContext);
+ return context->d()->engine->globalCode;
}
}
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index f089737e42..e0325bb7ac 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -371,7 +371,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
//
globalObject = newObject()->getPointer();
rootContext->global = globalObject;
- rootContext->callData->thisObject = globalObject;
+ rootContext->d()->callData->thisObject = globalObject;
Q_ASSERT(globalObject->internalClass()->vtable);
globalObject->defineDefaultProperty(QStringLiteral("Object"), objectCtor);
@@ -460,11 +460,11 @@ void ExecutionEngine::initRootContext()
{
rootContext = static_cast<GlobalContext *>(memoryManager->allocManaged(sizeof(GlobalContext) + sizeof(CallData)));
new (rootContext) GlobalContext(this);
- rootContext->callData = reinterpret_cast<CallData *>(rootContext + 1);
- rootContext->callData->tag = QV4::Value::_Integer_Type;
- rootContext->callData->argc = 0;
- rootContext->callData->thisObject = globalObject;
- rootContext->callData->args[0] = Encode::undefined();
+ rootContext->d()->callData = reinterpret_cast<CallData *>(rootContext + 1);
+ rootContext->d()->callData->tag = QV4::Value::_Integer_Type;
+ rootContext->d()->callData->argc = 0;
+ rootContext->d()->callData->thisObject = globalObject;
+ rootContext->d()->callData->args[0] = Encode::undefined();
}
InternalClass *ExecutionEngine::newClass(const InternalClass &other)
@@ -475,7 +475,7 @@ InternalClass *ExecutionEngine::newClass(const InternalClass &other)
ExecutionContext *ExecutionEngine::pushGlobalContext()
{
GlobalContext *g = new (memoryManager) GlobalContext(this);
- g->callData = rootContext->callData;
+ g->d()->callData = rootContext->d()->callData;
Q_ASSERT(currentContext() == g);
return g;
@@ -670,17 +670,17 @@ Returned<Object> *ExecutionEngine::qmlContextObject() const
{
ExecutionContext *ctx = currentContext();
- if (ctx->type == QV4::ExecutionContext::Type_SimpleCallContext && !ctx->outer)
- ctx = ctx->parent;
+ if (ctx->d()->type == QV4::ExecutionContext::Type_SimpleCallContext && !ctx->d()->outer)
+ ctx = ctx->d()->parent;
- if (!ctx->outer)
+ if (!ctx->d()->outer)
return 0;
- while (ctx->outer && ctx->outer->type != ExecutionContext::Type_GlobalContext)
- ctx = ctx->outer;
+ while (ctx->d()->outer && ctx->d()->outer->d()->type != ExecutionContext::Type_GlobalContext)
+ ctx = ctx->d()->outer;
Q_ASSERT(ctx);
- if (ctx->type != ExecutionContext::Type_QmlContext)
+ if (ctx->d()->type != ExecutionContext::Type_QmlContext)
return 0;
return static_cast<CallContext *>(ctx)->activation->asReturned<Object>();
@@ -706,19 +706,19 @@ QVector<StackFrame> ExecutionEngine::stackTrace(int frameLimit) const
if (callCtx->function->function())
// line numbers can be negative for places where you can't set a real breakpoint
- frame.line = qAbs(callCtx->lineNumber);
+ frame.line = qAbs(callCtx->d()->lineNumber);
stack.append(frame);
--frameLimit;
}
- c = c->parent;
+ c = c->d()->parent;
}
if (frameLimit && globalCode) {
StackFrame frame;
frame.source = globalCode->sourceFile();
frame.function = globalCode->name()->toQString();
- frame.line = rootContext->lineNumber;
+ frame.line = rootContext->d()->lineNumber;
frame.column = -1;
@@ -752,8 +752,8 @@ static inline char *v4StackTrace(const ExecutionContext *context)
QString result;
QTextStream str(&result);
str << "stack=[";
- if (context && context->engine) {
- const QVector<StackFrame> stackTrace = context->engine->stackTrace(20);
+ if (context && context->d()->engine) {
+ const QVector<StackFrame> stackTrace = context->d()->engine->stackTrace(20);
for (int i = 0; i < stackTrace.size(); ++i) {
if (i)
str << ',';
@@ -788,7 +788,7 @@ QUrl ExecutionEngine::resolvedUrl(const QString &file)
base.setUrl(callCtx->function->function()->sourceFile());
break;
}
- c = c->parent;
+ c = c->d()->parent;
}
if (base.isEmpty() && globalCode)
@@ -842,7 +842,7 @@ void ExecutionEngine::markObjects()
ExecutionContext *c = currentContext();
while (c) {
c->mark(this);
- c = c->parent;
+ c = c->d()->parent;
}
id_empty->mark(this);
diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp
index 9c1e4f607f..f8fbbf09cb 100644
--- a/src/qml/jsruntime/qv4errorobject.cpp
+++ b/src/qml/jsruntime/qv4errorobject.cpp
@@ -156,7 +156,7 @@ ErrorObject::ErrorObject(InternalClass *ic, const QString &message, const QStrin
ReturnedValue ErrorObject::method_get_stack(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<ErrorObject> This(scope, ctx->callData->thisObject);
+ Scoped<ErrorObject> This(scope, ctx->d()->callData->thisObject);
if (!This)
return ctx->throwTypeError();
if (!This->d()->stack) {
@@ -173,7 +173,7 @@ ReturnedValue ErrorObject::method_get_stack(CallContext *ctx)
trace += QString::number(frame.line);
}
}
- This->d()->stack = ctx->engine->newString(trace)->getPointer();
+ This->d()->stack = ctx->d()->engine->newString(trace)->getPointer();
}
return This->d()->stack->asReturnedValue();
}
@@ -371,18 +371,18 @@ ReturnedValue ErrorPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- Object *o = ctx->callData->thisObject.asObject();
+ Object *o = ctx->d()->callData->thisObject.asObject();
if (!o)
return ctx->throwTypeError();
- ScopedValue name(scope, o->get(ctx->engine->id_name));
+ ScopedValue name(scope, o->get(ctx->d()->engine->id_name));
QString qname;
if (name->isUndefined())
qname = QString::fromLatin1("Error");
else
qname = name->toQString();
- ScopedString s(scope, ctx->engine->newString(QString::fromLatin1("message")));
+ ScopedString s(scope, ctx->d()->engine->newString(QString::fromLatin1("message")));
ScopedValue message(scope, o->get(s));
QString qmessage;
if (!message->isUndefined())
@@ -397,5 +397,5 @@ ReturnedValue ErrorPrototype::method_toString(CallContext *ctx)
str = qname + QLatin1String(": ") + qmessage;
}
- return ctx->engine->newString(str)->asReturnedValue();
+ return ctx->d()->engine->newString(str)->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 198138aab9..236e4be219 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -75,7 +75,7 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(FunctionObject);
FunctionObject::FunctionObject(ExecutionContext *scope, const StringRef name, bool createProto)
- : Object(scope->engine->functionClass)
+ : Object(scope->d()->engine->functionClass)
{
d()->scope = scope;
d()->function = 0;
@@ -83,7 +83,7 @@ FunctionObject::FunctionObject(ExecutionContext *scope, const StringRef name, bo
}
FunctionObject::FunctionObject(ExecutionContext *scope, const QString &name, bool createProto)
- : Object(scope->engine->functionClass)
+ : Object(scope->d()->engine->functionClass)
{
d()->scope = scope;
d()->function = 0;
@@ -95,7 +95,7 @@ FunctionObject::FunctionObject(ExecutionContext *scope, const QString &name, boo
}
FunctionObject::FunctionObject(ExecutionContext *scope, const ReturnedValue name)
- : Object(scope->engine->functionClass)
+ : Object(scope->d()->engine->functionClass)
{
d()->scope = scope;
d()->function = 0;
@@ -132,7 +132,7 @@ void FunctionObject::init(const StringRef n, bool createProto)
d()->strictMode = false;
if (createProto) {
- Scoped<Object> proto(s, scope()->engine->newObject(scope()->engine->protoClass));
+ Scoped<Object> proto(s, scope()->d()->engine->newObject(scope()->d()->engine->protoClass));
proto->memberData()[Index_ProtoConstructor] = this->asReturnedValue();
memberData()[Index_Prototype] = proto.asReturnedValue();
} else {
@@ -140,12 +140,12 @@ void FunctionObject::init(const StringRef n, bool createProto)
}
ScopedValue v(s, n.asReturnedValue());
- defineReadonlyProperty(scope()->engine->id_name, v);
+ defineReadonlyProperty(scope()->d()->engine->id_name, v);
}
ReturnedValue FunctionObject::name()
{
- return get(scope()->engine->id_name);
+ return get(scope()->d()->engine->id_name);
}
@@ -182,8 +182,8 @@ FunctionObject *FunctionObject::createScriptFunction(ExecutionContext *scope, Fu
function->compiledFunction->flags & CompiledData::Function::HasCatchOrWith ||
function->compiledFunction->nFormals > QV4::Global::ReservedArgumentCount ||
function->isNamedExpression())
- return new (scope->engine->memoryManager) ScriptFunction(scope, function);
- return new (scope->engine->memoryManager) SimpleScriptFunction(scope, function, createProto);
+ return new (scope->d()->engine->memoryManager) ScriptFunction(scope, function);
+ return new (scope->d()->engine->memoryManager) SimpleScriptFunction(scope, function, createProto);
}
DEFINE_OBJECT_VTABLE(FunctionCtor);
@@ -210,7 +210,7 @@ ReturnedValue FunctionCtor::construct(Managed *that, CallData *callData)
}
body = callData->args[callData->argc - 1].toString(ctx)->toQString();
}
- if (ctx->engine->hasException)
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
QString function = QLatin1String("function(") + arguments + QLatin1String("){") + body + QLatin1String("}");
@@ -273,17 +273,17 @@ void FunctionPrototype::init(ExecutionEngine *engine, ObjectRef ctor)
ReturnedValue FunctionPrototype::method_toString(CallContext *ctx)
{
- FunctionObject *fun = ctx->callData->thisObject.asFunctionObject();
+ FunctionObject *fun = ctx->d()->callData->thisObject.asFunctionObject();
if (!fun)
return ctx->throwTypeError();
- return ctx->engine->newString(QStringLiteral("function() { [code] }"))->asReturnedValue();
+ return ctx->d()->engine->newString(QStringLiteral("function() { [code] }"))->asReturnedValue();
}
ReturnedValue FunctionPrototype::method_apply(CallContext *ctx)
{
Scope scope(ctx);
- FunctionObject *o = ctx->callData->thisObject.asFunctionObject();
+ FunctionObject *o = ctx->d()->callData->thisObject.asFunctionObject();
if (!o)
return ctx->throwTypeError();
@@ -323,14 +323,14 @@ ReturnedValue FunctionPrototype::method_call(CallContext *ctx)
{
Scope scope(ctx);
- FunctionObject *o = ctx->callData->thisObject.asFunctionObject();
+ FunctionObject *o = ctx->d()->callData->thisObject.asFunctionObject();
if (!o)
return ctx->throwTypeError();
- ScopedCallData callData(scope, ctx->callData->argc ? ctx->callData->argc - 1 : 0);
- if (ctx->callData->argc) {
- for (int i = 1; i < ctx->callData->argc; ++i)
- callData->args[i - 1] = ctx->callData->args[i];
+ 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];
}
callData->thisObject = ctx->argument(0);
return o->call(callData);
@@ -339,21 +339,21 @@ ReturnedValue FunctionPrototype::method_call(CallContext *ctx)
ReturnedValue FunctionPrototype::method_bind(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<FunctionObject> target(scope, ctx->callData->thisObject);
+ Scoped<FunctionObject> target(scope, ctx->d()->callData->thisObject);
if (!target)
return ctx->throwTypeError();
ScopedValue boundThis(scope, ctx->argument(0));
Members boundArgs;
boundArgs.reset();
- if (ctx->callData->argc > 1) {
- boundArgs.ensureIndex(scope.engine, ctx->callData->argc - 1);
- boundArgs.d()->d()->size = ctx->callData->argc - 1;
- memcpy(boundArgs.data(), ctx->callData->args + 1, (ctx->callData->argc - 1)*sizeof(Value));
+ if (ctx->d()->callData->argc > 1) {
+ boundArgs.ensureIndex(scope.engine, ctx->d()->callData->argc - 1);
+ boundArgs.d()->d()->size = ctx->d()->callData->argc - 1;
+ memcpy(boundArgs.data(), ctx->d()->callData->args + 1, (ctx->d()->callData->argc - 1)*sizeof(Value));
}
ScopedValue protectBoundArgs(scope, boundArgs.d());
- return ctx->engine->newBoundFunction(ctx->engine->rootContext, target, boundThis, boundArgs)->asReturnedValue();
+ return ctx->d()->engine->newBoundFunction(ctx->d()->engine->rootContext, target, boundThis, boundArgs)->asReturnedValue();
}
DEFINE_OBJECT_VTABLE(ScriptFunction);
@@ -369,13 +369,13 @@ ScriptFunction::ScriptFunction(ExecutionContext *scope, Function *function)
d()->needsActivation = function->needsActivation();
d()->strictMode = function->isStrict();
- defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(formalParameterCount()));
+ defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(formalParameterCount()));
- if (scope->strictMode) {
+ if (scope->d()->strictMode) {
ExecutionEngine *v4 = scope->engine;
Property pd(v4->thrower, v4->thrower);
- insertMember(scope->engine->id_caller, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
- insertMember(scope->engine->id_arguments, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
+ insertMember(scope->d()->engine->id_caller, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
+ insertMember(scope->d()->engine->id_arguments, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
}
}
@@ -424,7 +424,7 @@ ReturnedValue ScriptFunction::call(Managed *that, CallData *callData)
ScopedValue result(scope, Q_V4_PROFILE(v4, ctx, f->function()));
if (f->function()->compiledFunction->hasQmlDependencies())
- QmlContextWrapper::registerQmlDependencies(ctx->engine, f->function()->compiledFunction);
+ QmlContextWrapper::registerQmlDependencies(ctx->d()->engine, f->function()->compiledFunction);
return result.asReturnedValue();
}
@@ -448,17 +448,17 @@ SimpleScriptFunction::SimpleScriptFunction(ExecutionContext *scope, Function *fu
if (!scope)
return;
- ExecutionEngine *v4 = scope->engine;
+ ExecutionEngine *v4 = scope->d()->engine;
d()->needsActivation = function->needsActivation();
d()->strictMode = function->isStrict();
- defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(formalParameterCount()));
+ defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(formalParameterCount()));
- if (scope->strictMode) {
+ if (scope->d()->strictMode) {
Property pd(v4->thrower, v4->thrower);
- insertMember(scope->engine->id_caller, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
- insertMember(scope->engine->id_arguments, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
+ insertMember(scope->d()->engine->id_caller, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
+ insertMember(scope->d()->engine->id_arguments, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
}
}
@@ -479,12 +479,12 @@ ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData)
ExecutionContextSaver ctxSaver(context);
CallContext ctx(v4);
- ctx.strictMode = f->strictMode();
- ctx.callData = callData;
+ ctx.d()->strictMode = f->strictMode();
+ ctx.d()->callData = callData;
ctx.function = f.getPointer();
- ctx.compilationUnit = f->function()->compilationUnit;
- ctx.lookups = ctx.compilationUnit->runtimeLookups;
- ctx.outer = f->scope();
+ ctx.d()->compilationUnit = f->function()->compilationUnit;
+ ctx.d()->lookups = ctx.d()->compilationUnit->runtimeLookups;
+ ctx.d()->outer = f->scope();
ctx.locals = v4->stackPush(f->varCount());
while (callData->argc < (int)f->formalParameterCount()) {
callData->args[callData->argc] = Encode::undefined();
@@ -516,12 +516,12 @@ ReturnedValue SimpleScriptFunction::call(Managed *that, CallData *callData)
ExecutionContextSaver ctxSaver(context);
CallContext ctx(v4);
- ctx.strictMode = f->strictMode();
- ctx.callData = callData;
+ ctx.d()->strictMode = f->strictMode();
+ ctx.d()->callData = callData;
ctx.function = f;
- ctx.compilationUnit = f->function()->compilationUnit;
- ctx.lookups = ctx.compilationUnit->runtimeLookups;
- ctx.outer = f->scope();
+ ctx.d()->compilationUnit = f->function()->compilationUnit;
+ ctx.d()->lookups = ctx.d()->compilationUnit->runtimeLookups;
+ ctx.d()->outer = f->scope();
ctx.locals = v4->stackPush(f->varCount());
while (callData->argc < (int)f->formalParameterCount()) {
callData->args[callData->argc] = Encode::undefined();
@@ -579,8 +579,8 @@ ReturnedValue BuiltinFunction::call(Managed *that, CallData *callData)
ExecutionContextSaver ctxSaver(context);
CallContext ctx(v4);
- ctx.strictMode = f->scope()->strictMode; // ### needed? scope or parent context?
- ctx.callData = callData;
+ ctx.d()->strictMode = f->scope()->d()->strictMode; // ### needed? scope or parent context?
+ ctx.d()->callData = callData;
Q_ASSERT(v4->currentContext() == &ctx);
return f->d()->code(&ctx);
@@ -598,8 +598,8 @@ ReturnedValue IndexedBuiltinFunction::call(Managed *that, CallData *callData)
ExecutionContextSaver ctxSaver(context);
CallContext ctx(v4);
- ctx.strictMode = f->scope()->strictMode; // ### needed? scope or parent context?
- ctx.callData = callData;
+ ctx.d()->strictMode = f->scope()->d()->strictMode; // ### needed? scope or parent context?
+ ctx.d()->callData = callData;
Q_ASSERT(v4->currentContext() == &ctx);
return f->d()->code(&ctx, f->d()->index);
@@ -622,18 +622,18 @@ BoundFunction::BoundFunction(ExecutionContext *scope, FunctionObjectRef target,
Scope s(scope);
ScopedValue protectThis(s, this);
- ScopedValue l(s, target->get(scope->engine->id_length));
+ ScopedValue l(s, target->get(scope->d()->engine->id_length));
int len = l->toUInt32();
len -= boundArgs.size();
if (len < 0)
len = 0;
- defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(len));
+ defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(len));
- ExecutionEngine *v4 = scope->engine;
+ ExecutionEngine *v4 = scope->d()->engine;
Property pd(v4->thrower, v4->thrower);
- insertMember(scope->engine->id_arguments, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
- insertMember(scope->engine->id_caller, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
+ insertMember(scope->d()->engine->id_arguments, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
+ insertMember(scope->d()->engine->id_caller, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
}
void BoundFunction::destroy(Managed *that)
@@ -644,7 +644,7 @@ void BoundFunction::destroy(Managed *that)
ReturnedValue BoundFunction::call(Managed *that, CallData *dd)
{
BoundFunction *f = static_cast<BoundFunction *>(that);
- Scope scope(f->scope()->engine);
+ Scope scope(f->scope()->d()->engine);
if (scope.hasException())
return Encode::undefined();
@@ -658,7 +658,7 @@ ReturnedValue BoundFunction::call(Managed *that, CallData *dd)
ReturnedValue BoundFunction::construct(Managed *that, CallData *dd)
{
BoundFunction *f = static_cast<BoundFunction *>(that);
- Scope scope(f->scope()->engine);
+ Scope scope(f->scope()->d()->engine);
if (scope.hasException())
return Encode::undefined();
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index e78b913302..1be9561193 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -347,10 +347,10 @@ static QString decode(const QString &input, DecodeMode decodeMode, bool *ok)
DEFINE_OBJECT_VTABLE(EvalFunction);
EvalFunction::EvalFunction(ExecutionContext *scope)
- : FunctionObject(scope, scope->engine->id_eval)
+ : FunctionObject(scope, scope->d()->engine->id_eval)
{
setVTable(staticVTable());
- defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(1));
+ defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(1));
}
ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
@@ -363,16 +363,16 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
ContextStateSaver(ExecutionContext *context)
: savedContext(context)
- , strictMode(context->strictMode)
- , evalCode(context->currentEvalCode)
- , compilationUnit(context->compilationUnit)
+ , strictMode(context->d()->strictMode)
+ , evalCode(context->d()->currentEvalCode)
+ , compilationUnit(context->d()->compilationUnit)
{}
~ContextStateSaver()
{
- savedContext->strictMode = strictMode;
- savedContext->currentEvalCode = evalCode;
- savedContext->compilationUnit = compilationUnit;
+ savedContext->d()->strictMode = strictMode;
+ savedContext->d()->currentEvalCode = evalCode;
+ savedContext->d()->compilationUnit = compilationUnit;
}
};
@@ -396,10 +396,10 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
return callData->args[0].asReturnedValue();
const QString code = callData->args[0].stringValue()->toQString();
- bool inheritContext = !ctx->strictMode;
+ bool inheritContext = !ctx->d()->strictMode;
Script script(ctx, code, QStringLiteral("eval code"));
- script.strictMode = (directCall && parentContext->strictMode);
+ script.strictMode = (directCall && parentContext->d()->strictMode);
script.inheritContext = inheritContext;
script.parse();
if (scope.engine->hasException)
@@ -409,14 +409,14 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
if (!function)
return Encode::undefined();
- d()->strictMode = function->isStrict() || (ctx->strictMode);
+ d()->strictMode = function->isStrict() || (ctx->d()->strictMode);
d()->needsActivation = function->needsActivation();
if (strictMode()) {
ScopedFunctionObject e(scope, FunctionObject::createScriptFunction(ctx, function));
ScopedCallData callData(scope, 0);
- callData->thisObject = ctx->callData->thisObject;
+ callData->thisObject = ctx->d()->callData->thisObject;
return e->call(callData);
}
@@ -424,12 +424,12 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
ExecutionContext::EvalCode evalCode;
evalCode.function = function;
- evalCode.next = ctx->currentEvalCode;
- ctx->currentEvalCode = &evalCode;
+ evalCode.next = ctx->d()->currentEvalCode;
+ ctx->d()->currentEvalCode = &evalCode;
// set the correct strict mode flag on the context
- ctx->strictMode = strictMode();
- ctx->compilationUnit = function->compilationUnit;
+ ctx->d()->strictMode = strictMode();
+ ctx->d()->compilationUnit = function->compilationUnit;
return function->code(ctx, function->codeData);
}
@@ -470,7 +470,7 @@ ReturnedValue GlobalFunctions::method_parseInt(CallContext *ctx)
String *inputString = string->toString(ctx); // 1
QString trimmed = inputString->toQString().trimmed(); // 2
- if (ctx->engine->hasException)
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
const QChar *pos = trimmed.constData();
@@ -574,117 +574,117 @@ ReturnedValue GlobalFunctions::method_parseFloat(CallContext *ctx)
/// isNaN [15.1.2.4]
ReturnedValue GlobalFunctions::method_isNaN(CallContext *ctx)
{
- if (!ctx->callData->argc)
+ if (!ctx->d()->callData->argc)
// undefined gets converted to NaN
return Encode(true);
- if (ctx->callData->args[0].integerCompatible())
+ if (ctx->d()->callData->args[0].integerCompatible())
return Encode(false);
- double d = ctx->callData->args[0].toNumber();
+ double d = ctx->d()->callData->args[0].toNumber();
return Encode((bool)std::isnan(d));
}
/// isFinite [15.1.2.5]
ReturnedValue GlobalFunctions::method_isFinite(CallContext *ctx)
{
- if (!ctx->callData->argc)
+ if (!ctx->d()->callData->argc)
// undefined gets converted to NaN
return Encode(false);
- if (ctx->callData->args[0].integerCompatible())
+ if (ctx->d()->callData->args[0].integerCompatible())
return Encode(true);
- double d = ctx->callData->args[0].toNumber();
+ double d = ctx->d()->callData->args[0].toNumber();
return Encode((bool)std::isfinite(d));
}
/// decodeURI [15.1.3.1]
ReturnedValue GlobalFunctions::method_decodeURI(CallContext *context)
{
- if (context->callData->argc == 0)
+ if (context->d()->callData->argc == 0)
return Encode::undefined();
- QString uriString = context->callData->args[0].toString(context)->toQString();
+ QString uriString = context->d()->callData->args[0].toString(context)->toQString();
bool ok;
QString out = decode(uriString, DecodeNonReserved, &ok);
if (!ok) {
Scope scope(context);
- ScopedString s(scope, context->engine->newString(QStringLiteral("malformed URI sequence")));
+ ScopedString s(scope, context->d()->engine->newString(QStringLiteral("malformed URI sequence")));
return context->throwURIError(s);
}
- return context->engine->newString(out)->asReturnedValue();
+ return context->d()->engine->newString(out)->asReturnedValue();
}
/// decodeURIComponent [15.1.3.2]
ReturnedValue GlobalFunctions::method_decodeURIComponent(CallContext *context)
{
- if (context->callData->argc == 0)
+ if (context->d()->callData->argc == 0)
return Encode::undefined();
- QString uriString = context->callData->args[0].toString(context)->toQString();
+ QString uriString = context->d()->callData->args[0].toString(context)->toQString();
bool ok;
QString out = decode(uriString, DecodeAll, &ok);
if (!ok) {
Scope scope(context);
- ScopedString s(scope, context->engine->newString(QStringLiteral("malformed URI sequence")));
+ ScopedString s(scope, context->d()->engine->newString(QStringLiteral("malformed URI sequence")));
return context->throwURIError(s);
}
- return context->engine->newString(out)->asReturnedValue();
+ return context->d()->engine->newString(out)->asReturnedValue();
}
/// encodeURI [15.1.3.3]
ReturnedValue GlobalFunctions::method_encodeURI(CallContext *context)
{
- if (context->callData->argc == 0)
+ if (context->d()->callData->argc == 0)
return Encode::undefined();
- QString uriString = context->callData->args[0].toString(context)->toQString();
+ QString uriString = context->d()->callData->args[0].toString(context)->toQString();
bool ok;
QString out = encode(uriString, uriUnescapedReserved, &ok);
if (!ok) {
Scope scope(context);
- ScopedString s(scope, context->engine->newString(QStringLiteral("malformed URI sequence")));
+ ScopedString s(scope, context->d()->engine->newString(QStringLiteral("malformed URI sequence")));
return context->throwURIError(s);
}
- return context->engine->newString(out)->asReturnedValue();
+ return context->d()->engine->newString(out)->asReturnedValue();
}
/// encodeURIComponent [15.1.3.4]
ReturnedValue GlobalFunctions::method_encodeURIComponent(CallContext *context)
{
- if (context->callData->argc == 0)
+ if (context->d()->callData->argc == 0)
return Encode::undefined();
- QString uriString = context->callData->args[0].toString(context)->toQString();
+ QString uriString = context->d()->callData->args[0].toString(context)->toQString();
bool ok;
QString out = encode(uriString, uriUnescaped, &ok);
if (!ok) {
Scope scope(context);
- ScopedString s(scope, context->engine->newString(QStringLiteral("malformed URI sequence")));
+ ScopedString s(scope, context->d()->engine->newString(QStringLiteral("malformed URI sequence")));
return context->throwURIError(s);
}
- return context->engine->newString(out)->asReturnedValue();
+ return context->d()->engine->newString(out)->asReturnedValue();
}
ReturnedValue GlobalFunctions::method_escape(CallContext *context)
{
- if (!context->callData->argc)
- return context->engine->newString(QStringLiteral("undefined"))->asReturnedValue();
+ if (!context->d()->callData->argc)
+ return context->d()->engine->newString(QStringLiteral("undefined"))->asReturnedValue();
- QString str = context->callData->args[0].toString(context)->toQString();
- return context->engine->newString(escape(str))->asReturnedValue();
+ QString str = context->d()->callData->args[0].toString(context)->toQString();
+ return context->d()->engine->newString(escape(str))->asReturnedValue();
}
ReturnedValue GlobalFunctions::method_unescape(CallContext *context)
{
- if (!context->callData->argc)
- return context->engine->newString(QStringLiteral("undefined"))->asReturnedValue();
+ if (!context->d()->callData->argc)
+ return context->d()->engine->newString(QStringLiteral("undefined"))->asReturnedValue();
- QString str = context->callData->args[0].toString(context)->toQString();
- return context->engine->newString(unescape(str))->asReturnedValue();
+ QString str = context->d()->callData->args[0].toString(context)->toQString();
+ return context->d()->engine->newString(unescape(str))->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp
index d5bae0e35e..6b382b53fa 100644
--- a/src/qml/jsruntime/qv4include.cpp
+++ b/src/qml/jsruntime/qv4include.cpp
@@ -181,27 +181,26 @@ void QV4Include::finished()
*/
QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx)
{
- if (!ctx->callData->argc)
+ if (!ctx->d()->callData->argc)
return QV4::Encode::undefined();
- QV4::ExecutionEngine *v4 = ctx->engine;
- QV4::Scope scope(v4);
- QV8Engine *engine = v4->v8Engine;
- QQmlContextData *context = QV4::QmlContextWrapper::callingContext(v4);
+ QV4::Scope scope(ctx->engine());
+ QV8Engine *engine = scope.engine->v8Engine;
+ QQmlContextData *context = QV4::QmlContextWrapper::callingContext(scope.engine);
if (!context || !context->isJSContext)
V4THROW_ERROR("Qt.include(): Can only be called from JavaScript files");
- QUrl url(ctx->engine->resolvedUrl(ctx->callData->args[0].toQStringNoThrow()));
+ QUrl url(scope.engine->resolvedUrl(ctx->d()->callData->args[0].toQStringNoThrow()));
QV4::ScopedValue callbackFunction(scope, QV4::Primitive::undefinedValue());
- if (ctx->callData->argc >= 2 && ctx->callData->args[1].asFunctionObject())
- callbackFunction = ctx->callData->args[1];
+ if (ctx->d()->callData->argc >= 2 && ctx->d()->callData->args[1].asFunctionObject())
+ callbackFunction = ctx->d()->callData->args[1];
QString localFile = QQmlFile::urlToLocalFileOrQrc(url);
QV4::ScopedValue result(scope);
- QV4::ScopedObject qmlcontextobject(scope, v4->qmlContextObject());
+ QV4::ScopedObject qmlcontextobject(scope, scope.engine->qmlContextObject());
if (localFile.isEmpty()) {
QV4Include *i = new QV4Include(url, engine, context,
@@ -218,21 +217,21 @@ QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx)
QString code = QString::fromUtf8(data);
QmlIR::Document::removeScriptPragmas(code);
- QV4::Script script(v4, qmlcontextobject, code, url.toString());
+ QV4::Script script(scope.engine, qmlcontextobject, code, url.toString());
- QV4::ExecutionContext *ctx = v4->currentContext();
+ QV4::ExecutionContext *ctx = scope.engine->currentContext();
script.parse();
- if (!v4->hasException)
+ if (!scope.engine->hasException)
script.run();
- if (v4->hasException) {
+ if (scope.engine->hasException) {
QV4::ScopedValue ex(scope, ctx->catchException());
- result = resultValue(v4, Exception);
- result->asObject()->put(QV4::ScopedString(scope, v4->newString(QStringLiteral("exception"))), ex);
+ result = resultValue(scope.engine, Exception);
+ result->asObject()->put(QV4::ScopedString(scope, scope.engine->newString(QStringLiteral("exception"))), ex);
} else {
- result = resultValue(v4, Ok);
+ result = resultValue(scope.engine, Ok);
}
} else {
- result = resultValue(v4, NetworkError);
+ result = resultValue(scope.engine, NetworkError);
}
callback(callbackFunction, result);
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index c904dd95c9..8552936663 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -237,7 +237,7 @@ ReturnedValue JsonParser::parseObject()
BEGIN << "parseObject pos=" << json;
Scope scope(context);
- ScopedObject o(scope, context->engine->newObject());
+ ScopedObject o(scope, context->d()->engine->newObject());
QChar token = nextToken();
while (token == Quote) {
@@ -285,7 +285,7 @@ bool JsonParser::parseMember(ObjectRef o)
if (!parseValue(val))
return false;
- ScopedString s(scope, context->engine->newIdentifier(key));
+ ScopedString s(scope, context->d()->engine->newIdentifier(key));
uint idx = s->asArrayIndex();
if (idx < UINT_MAX) {
o->putIndexed(idx, val);
@@ -304,7 +304,7 @@ ReturnedValue JsonParser::parseArray()
{
Scope scope(context);
BEGIN << "parseArray";
- Scoped<ArrayObject> array(scope, context->engine->newArrayObject());
+ Scoped<ArrayObject> array(scope, context->d()->engine->newArrayObject());
if (++nestingLevel > nestingLimit) {
lastError = QJsonParseError::DeepNesting;
@@ -407,7 +407,7 @@ bool JsonParser::parseValue(ValueRef val)
return false;
DEBUG << "value: string";
END;
- val = context->engine->newString(value);
+ val = context->d()->engine->newString(value);
return true;
}
case BeginArray: {
@@ -710,21 +710,21 @@ QString Stringify::Str(const QString &key, ValueRef v)
ScopedValue value(scope, *v);
ScopedObject o(scope, value);
if (o) {
- ScopedString s(scope, ctx->engine->newString(QStringLiteral("toJSON")));
+ ScopedString s(scope, ctx->d()->engine->newString(QStringLiteral("toJSON")));
Scoped<FunctionObject> toJSON(scope, o->get(s));
if (!!toJSON) {
ScopedCallData callData(scope, 1);
callData->thisObject = value;
- callData->args[0] = ctx->engine->newString(key);
+ callData->args[0] = ctx->d()->engine->newString(key);
value = toJSON->call(callData);
}
}
if (replacerFunction) {
- ScopedObject holder(scope, ctx->engine->newObject());
+ ScopedObject holder(scope, ctx->d()->engine->newObject());
holder->put(ctx, QString(), value);
ScopedCallData callData(scope, 2);
- callData->args[0] = ctx->engine->newString(key);
+ callData->args[0] = ctx->d()->engine->newString(key);
callData->args[1] = value;
callData->thisObject = holder;
value = replacerFunction->call(callData);
@@ -954,7 +954,7 @@ ReturnedValue JsonObject::method_stringify(CallContext *ctx)
QString result = stringify.Str(QString(), arg0);
if (result.isEmpty() || scope.engine->hasException)
return Encode::undefined();
- return ctx->engine->newString(result)->asReturnedValue();
+ return ctx->d()->engine->newString(result)->asReturnedValue();
}
@@ -962,7 +962,7 @@ ReturnedValue JsonObject::method_stringify(CallContext *ctx)
ReturnedValue JsonObject::fromJsonValue(ExecutionEngine *engine, const QJsonValue &value)
{
if (value.isString())
- return engine->currentContext()->engine->newString(value.toString())->asReturnedValue();
+ return engine->currentContext()->d()->engine->newString(value.toString())->asReturnedValue();
else if (value.isDouble())
return Encode(value.toDouble());
else if (value.isBool())
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index 4d56a7de98..ed555b7763 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -581,7 +581,7 @@ ReturnedValue Lookup::arrayLengthGetter(Lookup *l, const ValueRef object)
ReturnedValue Lookup::globalGetterGeneric(Lookup *l, ExecutionContext *ctx)
{
- Object *o = ctx->engine->globalObject;
+ Object *o = ctx->d()->engine->globalObject;
PropertyAttributes attrs;
ReturnedValue v = l->lookup(o, &attrs);
if (v != Primitive::emptyValue().asReturnedValue()) {
@@ -610,7 +610,7 @@ ReturnedValue Lookup::globalGetterGeneric(Lookup *l, ExecutionContext *ctx)
ReturnedValue Lookup::globalGetter0(Lookup *l, ExecutionContext *ctx)
{
- Object *o = ctx->engine->globalObject;
+ Object *o = ctx->d()->engine->globalObject;
if (l->classList[0] == o->internalClass())
return o->memberData()[l->index].asReturnedValue();
@@ -620,7 +620,7 @@ ReturnedValue Lookup::globalGetter0(Lookup *l, ExecutionContext *ctx)
ReturnedValue Lookup::globalGetter1(Lookup *l, ExecutionContext *ctx)
{
- Object *o = ctx->engine->globalObject;
+ Object *o = ctx->d()->engine->globalObject;
if (l->classList[0] == o->internalClass() &&
l->classList[1] == o->prototype()->internalClass())
return o->prototype()->memberData()[l->index].asReturnedValue();
@@ -631,7 +631,7 @@ ReturnedValue Lookup::globalGetter1(Lookup *l, ExecutionContext *ctx)
ReturnedValue Lookup::globalGetter2(Lookup *l, ExecutionContext *ctx)
{
- Object *o = ctx->engine->globalObject;
+ Object *o = ctx->d()->engine->globalObject;
if (l->classList[0] == o->internalClass()) {
o = o->prototype();
if (l->classList[1] == o->internalClass()) {
@@ -647,7 +647,7 @@ ReturnedValue Lookup::globalGetter2(Lookup *l, ExecutionContext *ctx)
ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionContext *ctx)
{
- Object *o = ctx->engine->globalObject;
+ Object *o = ctx->d()->engine->globalObject;
if (l->classList[0] == o->internalClass()) {
Scope scope(o->engine());
FunctionObject *getter = o->propertyAt(l->index)->getter();
@@ -664,7 +664,7 @@ ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionContext *ctx)
ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionContext *ctx)
{
- Object *o = ctx->engine->globalObject;
+ Object *o = ctx->d()->engine->globalObject;
if (l->classList[0] == o->internalClass() &&
l->classList[1] == o->prototype()->internalClass()) {
Scope scope(o->engine());
@@ -682,7 +682,7 @@ ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionContext *ctx)
ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionContext *ctx)
{
- Object *o = ctx->engine->globalObject;
+ Object *o = ctx->d()->engine->globalObject;
if (l->classList[0] == o->internalClass()) {
o = o->prototype();
if (l->classList[1] == o->internalClass()) {
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index 16d76e6914..6216fddaad 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -104,15 +104,15 @@ static double copySign(double x, double y)
ReturnedValue MathObject::method_abs(CallContext *context)
{
- if (!context->callData->argc)
+ if (!context->d()->callData->argc)
return Encode(qSNaN());
- if (context->callData->args[0].isInteger()) {
- int i = context->callData->args[0].integerValue();
+ if (context->d()->callData->args[0].isInteger()) {
+ int i = context->d()->callData->args[0].integerValue();
return Encode(i < 0 ? - i : i);
}
- double v = context->callData->args[0].toNumber();
+ double v = context->d()->callData->args[0].toNumber();
if (v == 0) // 0 | -0
return Encode(0);
@@ -121,7 +121,7 @@ ReturnedValue MathObject::method_abs(CallContext *context)
ReturnedValue MathObject::method_acos(CallContext *context)
{
- double v = context->callData->argc ? context->callData->args[0].toNumber() : 2;
+ double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : 2;
if (v > 1)
return Encode(qSNaN());
@@ -130,7 +130,7 @@ ReturnedValue MathObject::method_acos(CallContext *context)
ReturnedValue MathObject::method_asin(CallContext *context)
{
- double v = context->callData->argc ? context->callData->args[0].toNumber() : 2;
+ double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : 2;
if (v > 1)
return Encode(qSNaN());
else
@@ -139,7 +139,7 @@ ReturnedValue MathObject::method_asin(CallContext *context)
ReturnedValue MathObject::method_atan(CallContext *context)
{
- double v = context->callData->argc ? context->callData->args[0].toNumber() : qSNaN();
+ double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
if (v == 0.0)
return Encode(v);
else
@@ -148,8 +148,8 @@ ReturnedValue MathObject::method_atan(CallContext *context)
ReturnedValue MathObject::method_atan2(CallContext *context)
{
- double v1 = context->callData->argc ? context->callData->args[0].toNumber() : qSNaN();
- double v2 = context->callData->argc > 1 ? context->callData->args[1].toNumber() : qSNaN();
+ 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();
if ((v1 < 0) && qIsFinite(v1) && qIsInf(v2) && (copySign(1.0, v2) == 1.0))
return Encode(copySign(0, -1.0));
@@ -166,7 +166,7 @@ ReturnedValue MathObject::method_atan2(CallContext *context)
ReturnedValue MathObject::method_ceil(CallContext *context)
{
- double v = context->callData->argc ? context->callData->args[0].toNumber() : qSNaN();
+ double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
if (v < 0.0 && v > -1.0)
return Encode(copySign(0, -1.0));
else
@@ -175,13 +175,13 @@ ReturnedValue MathObject::method_ceil(CallContext *context)
ReturnedValue MathObject::method_cos(CallContext *context)
{
- double v = context->callData->argc ? context->callData->args[0].toNumber() : qSNaN();
+ double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
return Encode(::cos(v));
}
ReturnedValue MathObject::method_exp(CallContext *context)
{
- double v = context->callData->argc ? context->callData->args[0].toNumber() : qSNaN();
+ double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
if (qIsInf(v)) {
if (copySign(1.0, v) == -1.0)
return Encode(0);
@@ -194,13 +194,13 @@ ReturnedValue MathObject::method_exp(CallContext *context)
ReturnedValue MathObject::method_floor(CallContext *context)
{
- double v = context->callData->argc ? context->callData->args[0].toNumber() : qSNaN();
+ double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
return Encode(::floor(v));
}
ReturnedValue MathObject::method_log(CallContext *context)
{
- double v = context->callData->argc ? context->callData->args[0].toNumber() : qSNaN();
+ double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
if (v < 0)
return Encode(qSNaN());
else
@@ -210,8 +210,8 @@ ReturnedValue MathObject::method_log(CallContext *context)
ReturnedValue MathObject::method_max(CallContext *context)
{
double mx = -qInf();
- for (int i = 0; i < context->callData->argc; ++i) {
- double x = context->callData->args[i].toNumber();
+ for (int i = 0; i < context->d()->callData->argc; ++i) {
+ double x = context->d()->callData->args[i].toNumber();
if (x > mx || std::isnan(x))
mx = x;
}
@@ -221,8 +221,8 @@ ReturnedValue MathObject::method_max(CallContext *context)
ReturnedValue MathObject::method_min(CallContext *context)
{
double mx = qInf();
- for (int i = 0; i < context->callData->argc; ++i) {
- double x = context->callData->args[i].toNumber();
+ for (int i = 0; i < context->d()->callData->argc; ++i) {
+ double x = context->d()->callData->args[i].toNumber();
if ((x == 0 && mx == x && copySign(1.0, x) == -1.0)
|| (x < mx) || std::isnan(x)) {
mx = x;
@@ -233,8 +233,8 @@ ReturnedValue MathObject::method_min(CallContext *context)
ReturnedValue MathObject::method_pow(CallContext *context)
{
- double x = context->callData->argc > 0 ? context->callData->args[0].toNumber() : qSNaN();
- double y = context->callData->argc > 1 ? context->callData->args[1].toNumber() : qSNaN();
+ 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();
if (std::isnan(y))
return Encode(qSNaN());
@@ -294,26 +294,26 @@ ReturnedValue MathObject::method_random(CallContext *context)
ReturnedValue MathObject::method_round(CallContext *context)
{
- double v = context->callData->argc ? context->callData->args[0].toNumber() : qSNaN();
+ double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
v = copySign(::floor(v + 0.5), v);
return Encode(v);
}
ReturnedValue MathObject::method_sin(CallContext *context)
{
- double v = context->callData->argc ? context->callData->args[0].toNumber() : qSNaN();
+ double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
return Encode(::sin(v));
}
ReturnedValue MathObject::method_sqrt(CallContext *context)
{
- double v = context->callData->argc ? context->callData->args[0].toNumber() : qSNaN();
+ double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
return Encode(::sqrt(v));
}
ReturnedValue MathObject::method_tan(CallContext *context)
{
- double v = context->callData->argc ? context->callData->args[0].toNumber() : qSNaN();
+ double v = context->d()->callData->argc ? context->d()->callData->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 1a41150bd2..426f2c7861 100644
--- a/src/qml/jsruntime/qv4numberobject.cpp
+++ b/src/qml/jsruntime/qv4numberobject.cpp
@@ -103,9 +103,9 @@ void NumberPrototype::init(ExecutionEngine *engine, ObjectRef ctor)
inline ReturnedValue thisNumberValue(ExecutionContext *ctx)
{
- if (ctx->callData->thisObject.isNumber())
- return ctx->callData->thisObject.asReturnedValue();
- NumberObject *n = ctx->callData->thisObject.asNumberObject();
+ if (ctx->d()->callData->thisObject.isNumber())
+ return ctx->d()->callData->thisObject.asReturnedValue();
+ NumberObject *n = ctx->d()->callData->thisObject.asNumberObject();
if (!n)
return ctx->throwTypeError();
return n->value().asReturnedValue();
@@ -113,9 +113,9 @@ inline ReturnedValue thisNumberValue(ExecutionContext *ctx)
inline double thisNumber(ExecutionContext *ctx)
{
- if (ctx->callData->thisObject.isNumber())
- return ctx->callData->thisObject.asDouble();
- NumberObject *n = ctx->callData->thisObject.asNumberObject();
+ if (ctx->d()->callData->thisObject.isNumber())
+ return ctx->d()->callData->thisObject.asDouble();
+ NumberObject *n = ctx->d()->callData->thisObject.asNumberObject();
if (!n)
return ctx->throwTypeError();
return n->value().asDouble();
@@ -124,19 +124,19 @@ inline double thisNumber(ExecutionContext *ctx)
ReturnedValue NumberPrototype::method_toString(CallContext *ctx)
{
double num = thisNumber(ctx);
- if (ctx->engine->hasException)
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
- if (ctx->callData->argc && !ctx->callData->args[0].isUndefined()) {
- int radix = ctx->callData->args[0].toInt32();
+ if (ctx->d()->callData->argc && !ctx->d()->callData->args[0].isUndefined()) {
+ int radix = ctx->d()->callData->args[0].toInt32();
if (radix < 2 || radix > 36)
return ctx->throwError(QString::fromLatin1("Number.prototype.toString: %0 is not a valid radix")
.arg(radix));
if (std::isnan(num)) {
- return ctx->engine->newString(QStringLiteral("NaN"))->asReturnedValue();
+ return ctx->d()->engine->newString(QStringLiteral("NaN"))->asReturnedValue();
} else if (qIsInf(num)) {
- return ctx->engine->newString(QLatin1String(num < 0 ? "-Infinity" : "Infinity"))->asReturnedValue();
+ return ctx->d()->engine->newString(QLatin1String(num < 0 ? "-Infinity" : "Infinity"))->asReturnedValue();
}
if (radix != 10) {
@@ -166,7 +166,7 @@ ReturnedValue NumberPrototype::method_toString(CallContext *ctx)
}
if (negative)
str.prepend(QLatin1Char('-'));
- return ctx->engine->newString(str)->asReturnedValue();
+ return ctx->d()->engine->newString(str)->asReturnedValue();
}
}
@@ -178,7 +178,7 @@ ReturnedValue NumberPrototype::method_toLocaleString(CallContext *ctx)
Scope scope(ctx);
ScopedValue v(scope, thisNumberValue(ctx));
ScopedString str(scope, v->toString(ctx));
- if (ctx->engine->hasException)
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
return str.asReturnedValue();
}
@@ -191,19 +191,19 @@ ReturnedValue NumberPrototype::method_valueOf(CallContext *ctx)
ReturnedValue NumberPrototype::method_toFixed(CallContext *ctx)
{
double v = thisNumber(ctx);
- if (ctx->engine->hasException)
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
double fdigits = 0;
- if (ctx->callData->argc > 0)
- fdigits = ctx->callData->args[0].toInteger();
+ if (ctx->d()->callData->argc > 0)
+ fdigits = ctx->d()->callData->args[0].toInteger();
if (std::isnan(fdigits))
fdigits = 0;
if (fdigits < 0 || fdigits > 20)
- return ctx->throwRangeError(ctx->callData->thisObject);
+ return ctx->throwRangeError(ctx->d()->callData->thisObject);
QString str;
if (std::isnan(v))
@@ -214,22 +214,22 @@ ReturnedValue NumberPrototype::method_toFixed(CallContext *ctx)
str = QString::number(v, 'f', int (fdigits));
else
return RuntimeHelpers::stringFromNumber(ctx, v)->asReturnedValue();
- return ctx->engine->newString(str)->asReturnedValue();
+ return ctx->d()->engine->newString(str)->asReturnedValue();
}
ReturnedValue NumberPrototype::method_toExponential(CallContext *ctx)
{
Scope scope(ctx);
double d = thisNumber(ctx);
- if (ctx->engine->hasException)
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
int fdigits = -1;
- if (ctx->callData->argc && !ctx->callData->args[0].isUndefined()) {
- fdigits = ctx->callData->args[0].toInt32();
+ if (ctx->d()->callData->argc && !ctx->d()->callData->args[0].isUndefined()) {
+ fdigits = ctx->d()->callData->args[0].toInt32();
if (fdigits < 0 || fdigits > 20) {
- ScopedString error(scope, ctx->engine->newString(QStringLiteral("Number.prototype.toExponential: fractionDigits out of range")));
+ ScopedString error(scope, ctx->d()->engine->newString(QStringLiteral("Number.prototype.toExponential: fractionDigits out of range")));
return ctx->throwRangeError(error);
}
}
@@ -239,22 +239,22 @@ ReturnedValue NumberPrototype::method_toExponential(CallContext *ctx)
double_conversion::DoubleToStringConverter::EcmaScriptConverter().ToExponential(d, fdigits, &builder);
QString result = QString::fromLatin1(builder.Finalize());
- return ctx->engine->newString(result)->asReturnedValue();
+ return ctx->d()->engine->newString(result)->asReturnedValue();
}
ReturnedValue NumberPrototype::method_toPrecision(CallContext *ctx)
{
Scope scope(ctx);
ScopedValue v(scope, thisNumberValue(ctx));
- if (ctx->engine->hasException)
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
- if (!ctx->callData->argc || ctx->callData->args[0].isUndefined())
+ if (!ctx->d()->callData->argc || ctx->d()->callData->args[0].isUndefined())
return RuntimeHelpers::toString(ctx, v);
- double precision = ctx->callData->args[0].toInt32();
+ double precision = ctx->d()->callData->args[0].toInt32();
if (precision < 1 || precision > 21) {
- ScopedString error(scope, ctx->engine->newString(QStringLiteral("Number.prototype.toPrecision: precision out of range")));
+ ScopedString error(scope, ctx->d()->engine->newString(QStringLiteral("Number.prototype.toPrecision: precision out of range")));
return ctx->throwRangeError(error);
}
@@ -263,5 +263,5 @@ ReturnedValue NumberPrototype::method_toPrecision(CallContext *ctx)
double_conversion::DoubleToStringConverter::EcmaScriptConverter().ToPrecision(v->asDouble(), precision, &builder);
QString result = QString::fromLatin1(builder.Finalize());
- return ctx->engine->newString(result)->asReturnedValue();
+ return ctx->d()->engine->newString(result)->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 3fcc52e995..d24ae97d41 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -103,7 +103,7 @@ bool Object::setPrototype(Object *proto)
void Object::put(ExecutionContext *ctx, const QString &name, const ValueRef value)
{
Scope scope(ctx);
- ScopedString n(scope, ctx->engine->newString(name));
+ ScopedString n(scope, ctx->d()->engine->newString(name));
put(n, value);
}
@@ -145,7 +145,7 @@ void Object::putValue(Property *pd, PropertyAttributes attrs, const ValueRef val
return;
reject:
- if (engine()->currentContext()->strictMode)
+ if (engine()->currentContext()->d()->strictMode)
engine()->currentContext()->throwTypeError();
}
@@ -737,7 +737,7 @@ void Object::internalPut(const StringRef name, const ValueRef value)
return;
reject:
- if (engine()->currentContext()->strictMode) {
+ if (engine()->currentContext()->d()->strictMode) {
QString message = QStringLiteral("Cannot assign to read-only property \"");
message += name->toQString();
message += QLatin1Char('\"');
@@ -809,7 +809,7 @@ void Object::internalPutIndexed(uint index, const ValueRef value)
return;
reject:
- if (engine()->currentContext()->strictMode)
+ if (engine()->currentContext()->d()->strictMode)
engine()->currentContext()->throwTypeError();
}
@@ -831,7 +831,7 @@ bool Object::internalDeleteProperty(const StringRef name)
InternalClass::removeMember(this, name->identifier());
return true;
}
- if (engine()->currentContext()->strictMode)
+ if (engine()->currentContext()->d()->strictMode)
engine()->currentContext()->throwTypeError();
return false;
}
@@ -847,7 +847,7 @@ bool Object::internalDeleteIndexedProperty(uint index)
if (!arrayData() || arrayData()->vtable()->del(this, index))
return true;
- if (engine()->currentContext()->strictMode)
+ if (engine()->currentContext()->d()->strictMode)
engine()->currentContext()->throwTypeError();
return false;
}
@@ -866,8 +866,8 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, const StringRef name,
PropertyAttributes *cattrs;
uint memberIndex;
- if (isArrayObject() && name->equals(ctx->engine->id_length)) {
- assert(ArrayObject::LengthPropertyIndex == internalClass()->find(ctx->engine->id_length));
+ if (isArrayObject() && name->equals(ctx->d()->engine->id_length)) {
+ assert(ArrayObject::LengthPropertyIndex == internalClass()->find(ctx->d()->engine->id_length));
Property *lp = propertyAt(ArrayObject::LengthPropertyIndex);
cattrs = internalClass()->propertyData.constData() + ArrayObject::LengthPropertyIndex;
if (attrs.isEmpty() || p.isSubset(attrs, *lp, *cattrs))
@@ -913,7 +913,7 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, const StringRef name,
return __defineOwnProperty__(ctx, memberIndex, name, p, attrs);
reject:
- if (ctx->strictMode)
+ if (ctx->d()->strictMode)
ctx->throwTypeError();
return false;
}
@@ -929,7 +929,7 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, const Prop
return defineOwnProperty2(ctx, index, p, attrs);
reject:
- if (ctx->strictMode)
+ if (ctx->d()->strictMode)
ctx->throwTypeError();
return false;
}
@@ -965,7 +965,7 @@ bool Object::defineOwnProperty2(ExecutionContext *ctx, uint index, const Propert
return __defineOwnProperty__(ctx, index, StringRef::null(), p, attrs);
reject:
- if (ctx->strictMode)
+ if (ctx->d()->strictMode)
ctx->throwTypeError();
return false;
}
@@ -1057,7 +1057,7 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, const Stri
setHasAccessorProperty();
return true;
reject:
- if (ctx->strictMode)
+ if (ctx->d()->strictMode)
ctx->throwTypeError();
return false;
}
@@ -1066,7 +1066,7 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, const Stri
bool Object::__defineOwnProperty__(ExecutionContext *ctx, const QString &name, const Property &p, PropertyAttributes attrs)
{
Scope scope(ctx);
- ScopedString s(scope, ctx->engine->newString(name));
+ ScopedString s(scope, ctx->d()->engine->newString(name));
return __defineOwnProperty__(ctx, s, p, attrs);
}
diff --git a/src/qml/jsruntime/qv4objectiterator_p.h b/src/qml/jsruntime/qv4objectiterator_p.h
index 7fb46344dc..9a212df5a5 100644
--- a/src/qml/jsruntime/qv4objectiterator_p.h
+++ b/src/qml/jsruntime/qv4objectiterator_p.h
@@ -99,7 +99,7 @@ struct ForEachIteratorObject: Object {
Q_MANAGED_TYPE(ForeachIteratorObject)
ForEachIteratorObject(ExecutionContext *ctx, const ObjectRef o)
- : Object(ctx->engine)
+ : Object(ctx->d()->engine)
, __data(o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain) {
setVTable(staticVTable());
}
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index 9971289730..48fea0d0bf 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -176,7 +176,7 @@ ReturnedValue ObjectPrototype::method_getOwnPropertyNames(CallContext *context)
if (!O)
return context->throwTypeError();
- ScopedArrayObject array(scope, getOwnPropertyNames(context->engine, context->callData->args[0]));
+ ScopedArrayObject array(scope, getOwnPropertyNames(context->d()->engine, context->d()->callData->args[0]));
return array.asReturnedValue();
}
@@ -187,11 +187,11 @@ ReturnedValue ObjectPrototype::method_create(CallContext *ctx)
if (!O->isObject() && !O->isNull())
return ctx->throwTypeError();
- Scoped<Object> newObject(scope, ctx->engine->newObject());
+ Scoped<Object> newObject(scope, ctx->d()->engine->newObject());
newObject->setPrototype(O->asObject());
- if (ctx->callData->argc > 1 && !ctx->callData->args[1].isUndefined()) {
- ctx->callData->args[0] = newObject.asReturnedValue();
+ if (ctx->d()->callData->argc > 1 && !ctx->d()->callData->args[1].isUndefined()) {
+ ctx->d()->callData->args[0] = newObject.asReturnedValue();
return method_defineProperties(ctx);
}
@@ -395,7 +395,7 @@ ReturnedValue ObjectPrototype::method_keys(CallContext *ctx)
if (!o)
return ctx->throwTypeError();
- Scoped<ArrayObject> a(scope, ctx->engine->newArrayObject());
+ Scoped<ArrayObject> a(scope, ctx->d()->engine->newArrayObject());
ObjectIterator it(scope, o, ObjectIterator::EnumerableOnly);
ScopedValue name(scope);
@@ -412,24 +412,24 @@ ReturnedValue ObjectPrototype::method_keys(CallContext *ctx)
ReturnedValue ObjectPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- if (ctx->callData->thisObject.isUndefined()) {
- return ctx->engine->newString(QStringLiteral("[object Undefined]"))->asReturnedValue();
- } else if (ctx->callData->thisObject.isNull()) {
- return ctx->engine->newString(QStringLiteral("[object Null]"))->asReturnedValue();
+ if (ctx->d()->callData->thisObject.isUndefined()) {
+ return ctx->d()->engine->newString(QStringLiteral("[object Undefined]"))->asReturnedValue();
+ } else if (ctx->d()->callData->thisObject.isNull()) {
+ return ctx->d()->engine->newString(QStringLiteral("[object Null]"))->asReturnedValue();
} else {
- ScopedObject obj(scope, RuntimeHelpers::toObject(ctx, ValueRef(&ctx->callData->thisObject)));
+ ScopedObject obj(scope, RuntimeHelpers::toObject(ctx, ValueRef(&ctx->d()->callData->thisObject)));
QString className = obj->className();
- return ctx->engine->newString(QString::fromLatin1("[object %1]").arg(className))->asReturnedValue();
+ return ctx->d()->engine->newString(QString::fromLatin1("[object %1]").arg(className))->asReturnedValue();
}
}
ReturnedValue ObjectPrototype::method_toLocaleString(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->callData->thisObject.toObject(ctx));
+ ScopedObject o(scope, ctx->d()->callData->thisObject.toObject(ctx));
if (!o)
return Encode::undefined();
- Scoped<FunctionObject> f(scope, o->get(ctx->engine->id_toString));
+ Scoped<FunctionObject> f(scope, o->get(ctx->d()->engine->id_toString));
if (!f)
return ctx->throwTypeError();
ScopedCallData callData(scope, 0);
@@ -440,8 +440,8 @@ ReturnedValue ObjectPrototype::method_toLocaleString(CallContext *ctx)
ReturnedValue ObjectPrototype::method_valueOf(CallContext *ctx)
{
Scope scope(ctx);
- ScopedValue v(scope, ctx->callData->thisObject.toObject(ctx));
- if (ctx->engine->hasException)
+ ScopedValue v(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
return v.asReturnedValue();
}
@@ -452,7 +452,7 @@ ReturnedValue ObjectPrototype::method_hasOwnProperty(CallContext *ctx)
Scoped<String> P(scope, ctx->argument(0), Scoped<String>::Convert);
if (scope.engine->hasException)
return Encode::undefined();
- Scoped<Object> O(scope, ctx->callData->thisObject, Scoped<Object>::Convert);
+ Scoped<Object> O(scope, ctx->d()->callData->thisObject, Scoped<Object>::Convert);
if (scope.engine->hasException)
return Encode::undefined();
bool r = O->hasOwnProperty(P);
@@ -468,7 +468,7 @@ ReturnedValue ObjectPrototype::method_isPrototypeOf(CallContext *ctx)
if (!V)
return Encode(false);
- Scoped<Object> O(scope, ctx->callData->thisObject, Scoped<Object>::Convert);
+ Scoped<Object> O(scope, ctx->d()->callData->thisObject, Scoped<Object>::Convert);
if (scope.engine->hasException)
return Encode::undefined();
Scoped<Object> proto(scope, V->prototype());
@@ -487,7 +487,7 @@ ReturnedValue ObjectPrototype::method_propertyIsEnumerable(CallContext *ctx)
if (scope.engine->hasException)
return Encode::undefined();
- Scoped<Object> o(scope, ctx->callData->thisObject, Scoped<Object>::Convert);
+ Scoped<Object> o(scope, ctx->d()->callData->thisObject, Scoped<Object>::Convert);
if (scope.engine->hasException)
return Encode::undefined();
PropertyAttributes attrs;
@@ -497,7 +497,7 @@ ReturnedValue ObjectPrototype::method_propertyIsEnumerable(CallContext *ctx)
ReturnedValue ObjectPrototype::method_defineGetter(CallContext *ctx)
{
- if (ctx->callData->argc < 2)
+ if (ctx->d()->callData->argc < 2)
return ctx->throwTypeError();
Scope scope(ctx);
@@ -509,11 +509,11 @@ ReturnedValue ObjectPrototype::method_defineGetter(CallContext *ctx)
if (scope.engine->hasException)
return Encode::undefined();
- Scoped<Object> o(scope, ctx->callData->thisObject);
+ Scoped<Object> o(scope, ctx->d()->callData->thisObject);
if (!o) {
- if (!ctx->callData->thisObject.isUndefined())
+ if (!ctx->d()->callData->thisObject.isUndefined())
return Encode::undefined();
- o = ctx->engine->globalObject;
+ o = ctx->d()->engine->globalObject;
}
Property pd;
@@ -525,7 +525,7 @@ ReturnedValue ObjectPrototype::method_defineGetter(CallContext *ctx)
ReturnedValue ObjectPrototype::method_defineSetter(CallContext *ctx)
{
- if (ctx->callData->argc < 2)
+ if (ctx->d()->callData->argc < 2)
return ctx->throwTypeError();
Scope scope(ctx);
@@ -537,11 +537,11 @@ ReturnedValue ObjectPrototype::method_defineSetter(CallContext *ctx)
if (scope.engine->hasException)
return Encode::undefined();
- Scoped<Object> o(scope, ctx->callData->thisObject);
+ Scoped<Object> o(scope, ctx->d()->callData->thisObject);
if (!o) {
- if (!ctx->callData->thisObject.isUndefined())
+ if (!ctx->d()->callData->thisObject.isUndefined())
return Encode::undefined();
- o = ctx->engine->globalObject;
+ o = ctx->d()->engine->globalObject;
}
Property pd;
@@ -554,7 +554,7 @@ ReturnedValue ObjectPrototype::method_defineSetter(CallContext *ctx)
ReturnedValue ObjectPrototype::method_get_proto(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->callData->thisObject.asObject());
+ ScopedObject o(scope, ctx->d()->callData->thisObject.asObject());
if (!o)
return ctx->throwTypeError();
@@ -564,16 +564,16 @@ ReturnedValue ObjectPrototype::method_get_proto(CallContext *ctx)
ReturnedValue ObjectPrototype::method_set_proto(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> o(scope, ctx->callData->thisObject);
- if (!o || !ctx->callData->argc)
+ Scoped<Object> o(scope, ctx->d()->callData->thisObject);
+ if (!o || !ctx->d()->callData->argc)
return ctx->throwTypeError();
- if (ctx->callData->args[0].isNull()) {
+ if (ctx->d()->callData->args[0].isNull()) {
o->setPrototype(0);
return Encode::undefined();
}
- Scoped<Object> p(scope, ctx->callData->args[0]);
+ Scoped<Object> p(scope, ctx->d()->callData->args[0]);
bool ok = false;
if (!!p) {
if (o->prototype() == p.getPointer()) {
@@ -601,14 +601,14 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, const ValueRef
desc->set = Primitive::emptyValue();
ScopedValue tmp(scope);
- if (o->hasProperty(ctx->engine->id_enumerable))
- attrs->setEnumerable((tmp = o->get(ctx->engine->id_enumerable))->toBoolean());
+ if (o->hasProperty(ctx->d()->engine->id_enumerable))
+ attrs->setEnumerable((tmp = o->get(ctx->d()->engine->id_enumerable))->toBoolean());
- if (o->hasProperty(ctx->engine->id_configurable))
- attrs->setConfigurable((tmp = o->get(ctx->engine->id_configurable))->toBoolean());
+ if (o->hasProperty(ctx->d()->engine->id_configurable))
+ attrs->setConfigurable((tmp = o->get(ctx->d()->engine->id_configurable))->toBoolean());
- if (o->hasProperty(ctx->engine->id_get)) {
- ScopedValue get(scope, o->get(ctx->engine->id_get));
+ if (o->hasProperty(ctx->d()->engine->id_get)) {
+ ScopedValue get(scope, o->get(ctx->d()->engine->id_get));
FunctionObject *f = get->asFunctionObject();
if (f || get->isUndefined()) {
desc->value = get;
@@ -619,8 +619,8 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, const ValueRef
attrs->setType(PropertyAttributes::Accessor);
}
- if (o->hasProperty(ctx->engine->id_set)) {
- ScopedValue set(scope, o->get(ctx->engine->id_set));
+ if (o->hasProperty(ctx->d()->engine->id_set)) {
+ ScopedValue set(scope, o->get(ctx->d()->engine->id_set));
FunctionObject *f = set->asFunctionObject();
if (f || set->isUndefined()) {
desc->set = set;
@@ -631,22 +631,22 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, const ValueRef
attrs->setType(PropertyAttributes::Accessor);
}
- if (o->hasProperty(ctx->engine->id_writable)) {
+ if (o->hasProperty(ctx->d()->engine->id_writable)) {
if (attrs->isAccessor()) {
ctx->throwTypeError();
return;
}
- attrs->setWritable((tmp = o->get(ctx->engine->id_writable))->toBoolean());
+ attrs->setWritable((tmp = o->get(ctx->d()->engine->id_writable))->toBoolean());
// writable forces it to be a data descriptor
desc->value = Primitive::undefinedValue();
}
- if (o->hasProperty(ctx->engine->id_value)) {
+ if (o->hasProperty(ctx->d()->engine->id_value)) {
if (attrs->isAccessor()) {
ctx->throwTypeError();
return;
}
- desc->value = o->get(ctx->engine->id_value);
+ desc->value = o->get(ctx->d()->engine->id_value);
attrs->setType(PropertyAttributes::Data);
}
@@ -660,7 +660,7 @@ ReturnedValue ObjectPrototype::fromPropertyDescriptor(ExecutionContext *ctx, con
if (!desc)
return Encode::undefined();
- ExecutionEngine *engine = ctx->engine;
+ ExecutionEngine *engine = ctx->d()->engine;
Scope scope(engine);
// Let obj be the result of creating a new object as if by the expression new Object() where Object
// is the standard built-in constructor with that name.
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index b81b273f1d..a731eee624 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -284,14 +284,14 @@ ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextD
if (name->equals(scope.engine->id_destroy) || name->equals(scope.engine->id_toString)) {
int index = name->equals(scope.engine->id_destroy) ? QV4::QObjectMethod::DestroyMethod : QV4::QObjectMethod::ToStringMethod;
- QV4::ScopedValue method(scope, QV4::QObjectMethod::create(ctx->engine->rootContext, d()->object, index));
+ QV4::ScopedValue method(scope, QV4::QObjectMethod::create(ctx->d()->engine->rootContext, d()->object, index));
if (hasProperty)
*hasProperty = true;
return method.asReturnedValue();
}
QQmlPropertyData local;
- QQmlPropertyData *result = findProperty(ctx->engine, qmlContext, name.getPointer(), revisionMode, &local);
+ QQmlPropertyData *result = findProperty(ctx->d()->engine, qmlContext, name.getPointer(), revisionMode, &local);
if (!result) {
if (includeImports && name->startsWithUpper()) {
@@ -306,9 +306,9 @@ ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextD
if (r.scriptIndex != -1) {
return QV4::Encode::undefined();
} else if (r.type) {
- return QmlTypeWrapper::create(ctx->engine->v8Engine, d()->object, r.type, QmlTypeWrapper::ExcludeEnums);
+ return QmlTypeWrapper::create(ctx->d()->engine->v8Engine, d()->object, r.type, QmlTypeWrapper::ExcludeEnums);
} else if (r.importNamespace) {
- return QmlTypeWrapper::create(ctx->engine->v8Engine, d()->object, qmlContext->imports, r.importNamespace, QmlTypeWrapper::ExcludeEnums);
+ return QmlTypeWrapper::create(ctx->d()->engine->v8Engine, d()->object, qmlContext->imports, r.importNamespace, QmlTypeWrapper::ExcludeEnums);
}
Q_ASSERT(!"Unreachable");
}
@@ -345,23 +345,23 @@ ReturnedValue QObjectWrapper::getProperty(QObject *object, ExecutionContext *ctx
Q_ASSERT(vmemo);
return vmemo->vmeMethod(property->coreIndex);
} else if (property->isV4Function()) {
- QV4::Scoped<QV4::Object> qmlcontextobject(scope, ctx->engine->qmlContextObject());
- return QV4::QObjectMethod::create(ctx->engine->rootContext, object, property->coreIndex, qmlcontextobject);
+ QV4::Scoped<QV4::Object> qmlcontextobject(scope, ctx->d()->engine->qmlContextObject());
+ return QV4::QObjectMethod::create(ctx->d()->engine->rootContext, object, property->coreIndex, qmlcontextobject);
} else if (property->isSignalHandler()) {
- QV4::Scoped<QV4::QmlSignalHandler> handler(scope, new (ctx->engine->memoryManager) QV4::QmlSignalHandler(ctx->engine, object, property->coreIndex));
+ QV4::Scoped<QV4::QmlSignalHandler> handler(scope, new (ctx->d()->engine->memoryManager) QV4::QmlSignalHandler(ctx->d()->engine, object, property->coreIndex));
- QV4::ScopedString connect(scope, ctx->engine->newIdentifier(QStringLiteral("connect")));
- QV4::ScopedString disconnect(scope, ctx->engine->newIdentifier(QStringLiteral("disconnect")));
- handler->put(connect, QV4::ScopedValue(scope, ctx->engine->functionClass->prototype->get(connect)));
- handler->put(disconnect, QV4::ScopedValue(scope, ctx->engine->functionClass->prototype->get(disconnect)));
+ QV4::ScopedString connect(scope, ctx->d()->engine->newIdentifier(QStringLiteral("connect")));
+ QV4::ScopedString disconnect(scope, ctx->d()->engine->newIdentifier(QStringLiteral("disconnect")));
+ handler->put(connect, QV4::ScopedValue(scope, ctx->d()->engine->functionClass->prototype->get(connect)));
+ handler->put(disconnect, QV4::ScopedValue(scope, ctx->d()->engine->functionClass->prototype->get(disconnect)));
return handler.asReturnedValue();
} else {
- return QV4::QObjectMethod::create(ctx->engine->rootContext, object, property->coreIndex);
+ return QV4::QObjectMethod::create(ctx->d()->engine->rootContext, object, property->coreIndex);
}
}
- QQmlEnginePrivate *ep = ctx->engine->v8Engine->engine() ? QQmlEnginePrivate::get(ctx->engine->v8Engine->engine()) : 0;
+ QQmlEnginePrivate *ep = ctx->d()->engine->v8Engine->engine() ? QQmlEnginePrivate::get(ctx->d()->engine->v8Engine->engine()) : 0;
if (property->hasAccessors()) {
QQmlNotifier *n = 0;
@@ -370,7 +370,7 @@ ReturnedValue QObjectWrapper::getProperty(QObject *object, ExecutionContext *ctx
if (ep && ep->propertyCapture && property->accessors->notifier)
nptr = &n;
- QV4::ScopedValue rv(scope, LoadProperty<ReadAccessor::Accessor>(ctx->engine->v8Engine, object, *property, nptr));
+ QV4::ScopedValue rv(scope, LoadProperty<ReadAccessor::Accessor>(ctx->d()->engine->v8Engine, object, *property, nptr));
if (captureRequired) {
if (property->accessors->notifier) {
@@ -392,9 +392,9 @@ ReturnedValue QObjectWrapper::getProperty(QObject *object, ExecutionContext *ctx
Q_ASSERT(vmemo);
return vmemo->vmeProperty(property->coreIndex);
} else if (property->isDirect()) {
- return LoadProperty<ReadAccessor::Direct>(ctx->engine->v8Engine, object, *property, 0);
+ return LoadProperty<ReadAccessor::Direct>(ctx->d()->engine->v8Engine, object, *property, 0);
} else {
- return LoadProperty<ReadAccessor::Indirect>(ctx->engine->v8Engine, object, *property, 0);
+ return LoadProperty<ReadAccessor::Indirect>(ctx->d()->engine->v8Engine, object, *property, 0);
}
}
@@ -413,7 +413,7 @@ ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextD
return QV4::Encode::null();
}
- QV4::Scoped<QObjectWrapper> wrapper(scope, wrap(ctx->engine, object));
+ QV4::Scoped<QObjectWrapper> wrapper(scope, wrap(ctx->d()->engine, object));
if (!wrapper) {
if (hasProperty)
*hasProperty = false;
@@ -431,7 +431,7 @@ bool QObjectWrapper::setQmlProperty(ExecutionContext *ctx, QQmlContextData *qmlC
QQmlPropertyData local;
QQmlPropertyData *result = 0;
{
- result = QQmlPropertyCache::property(ctx->engine->v8Engine->engine(), object, name, qmlContext, local);
+ result = QQmlPropertyCache::property(ctx->d()->engine->v8Engine->engine(), object, name, qmlContext, local);
}
if (!result)
@@ -473,7 +473,7 @@ void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPro
}
} else {
// binding assignment.
- QQmlContextData *callingQmlContext = QV4::QmlContextWrapper::callingContext(ctx->engine);
+ QQmlContextData *callingQmlContext = QV4::QmlContextWrapper::callingContext(ctx->d()->engine);
QV4::Scoped<QQmlBindingFunction> bindingFunction(scope, f);
bindingFunction->initBindingLocation();
@@ -513,7 +513,7 @@ void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPro
} else if (value->isUndefined() && property->propType == QMetaType::QJsonValue) {
PROPERTY_STORE(QJsonValue, QJsonValue(QJsonValue::Undefined));
} else if (!newBinding && property->propType == qMetaTypeId<QJSValue>()) {
- PROPERTY_STORE(QJSValue, new QJSValuePrivate(ctx->engine, value));
+ PROPERTY_STORE(QJSValue, new QJSValuePrivate(ctx->d()->engine, value));
} else if (value->isUndefined()) {
QString error = QLatin1String("Cannot assign [undefined] to ");
if (!QMetaType::typeName(property->propType))
@@ -541,11 +541,11 @@ void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPro
} else {
QVariant v;
if (property->isQList())
- v = ctx->engine->v8Engine->toVariant(value, qMetaTypeId<QList<QObject *> >());
+ v = ctx->d()->engine->v8Engine->toVariant(value, qMetaTypeId<QList<QObject *> >());
else
- v = ctx->engine->v8Engine->toVariant(value, property->propType);
+ v = ctx->d()->engine->v8Engine->toVariant(value, property->propType);
- QQmlContextData *callingQmlContext = QV4::QmlContextWrapper::callingContext(ctx->engine);
+ QQmlContextData *callingQmlContext = QV4::QmlContextWrapper::callingContext(ctx->d()->engine);
if (!QQmlPropertyPrivate::write(object, *property, v, callingQmlContext)) {
const char *valueType = 0;
if (v.userType() == QVariant::Invalid) valueType = "null";
@@ -866,10 +866,10 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
ReturnedValue QObjectWrapper::method_connect(CallContext *ctx)
{
- if (ctx->callData->argc == 0)
+ if (ctx->d()->callData->argc == 0)
V4THROW_ERROR("Function.prototype.connect: no arguments given");
- QPair<QObject *, int> signalInfo = extractQtSignal(ctx->callData->thisObject);
+ QPair<QObject *, int> signalInfo = extractQtSignal(ctx->d()->callData->thisObject);
QObject *signalObject = signalInfo.first;
int signalIndex = signalInfo.second; // in method range, not signal range!
@@ -886,11 +886,11 @@ ReturnedValue QObjectWrapper::method_connect(CallContext *ctx)
QV4::ScopedFunctionObject f(scope);
QV4::ScopedValue thisObject (scope, QV4::Encode::undefined());
- if (ctx->callData->argc == 1) {
- f = ctx->callData->args[0];
- } else if (ctx->callData->argc >= 2) {
- thisObject = ctx->callData->args[0];
- f = ctx->callData->args[1];
+ 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 (!f)
@@ -917,12 +917,12 @@ ReturnedValue QObjectWrapper::method_connect(CallContext *ctx)
ReturnedValue QObjectWrapper::method_disconnect(CallContext *ctx)
{
- if (ctx->callData->argc == 0)
+ if (ctx->d()->callData->argc == 0)
V4THROW_ERROR("Function.prototype.disconnect: no arguments given");
QV4::Scope scope(ctx);
- QPair<QObject *, int> signalInfo = extractQtSignal(ctx->callData->thisObject);
+ QPair<QObject *, int> signalInfo = extractQtSignal(ctx->d()->callData->thisObject);
QObject *signalObject = signalInfo.first;
int signalIndex = signalInfo.second;
@@ -938,11 +938,11 @@ ReturnedValue QObjectWrapper::method_disconnect(CallContext *ctx)
QV4::ScopedFunctionObject functionValue(scope);
QV4::ScopedValue functionThisValue(scope, QV4::Encode::undefined());
- if (ctx->callData->argc == 1) {
- functionValue = ctx->callData->args[0];
- } else if (ctx->callData->argc >= 2) {
- functionThisValue = ctx->callData->args[0];
- functionValue = ctx->callData->args[1];
+ 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 (!functionValue)
@@ -954,7 +954,7 @@ ReturnedValue QObjectWrapper::method_disconnect(CallContext *ctx)
QPair<QObject *, int> functionData = extractQtMethod(functionValue);
void *a[] = {
- ctx->engine,
+ ctx->d()->engine,
functionValue.ptr,
functionThisValue.ptr,
functionData.first,
@@ -1750,7 +1750,7 @@ QV4::ReturnedValue CallArgument::toValue(QV8Engine *engine)
ReturnedValue QObjectMethod::create(ExecutionContext *scope, QObject *object, int index, const ValueRef qmlGlobal)
{
- return (new (scope->engine->memoryManager) QObjectMethod(scope, object, index, qmlGlobal))->asReturnedValue();
+ return (new (scope->d()->engine->memoryManager) QObjectMethod(scope, object, index, qmlGlobal))->asReturnedValue();
}
QObjectMethod::QObjectMethod(ExecutionContext *scope, QObject *object, int index, const ValueRef qmlGlobal)
@@ -1784,7 +1784,7 @@ QV4::ReturnedValue QObjectMethod::method_toString(QV4::ExecutionContext *ctx)
result = QLatin1String("null");
}
- return ctx->engine->newString(result)->asReturnedValue();
+ return ctx->d()->engine->newString(result)->asReturnedValue();
}
QV4::ReturnedValue QObjectMethod::method_destroy(QV4::ExecutionContext *ctx, const ValueRef args, int argc)
@@ -1828,7 +1828,7 @@ ReturnedValue QObjectMethod::callInternal(CallData *callData)
if (!ddata)
return Encode::undefined();
- QV8Engine *v8Engine = context->engine->v8Engine;
+ QV8Engine *v8Engine = context->d()->engine->v8Engine;
QV4::ExecutionEngine *v4 = QV8Engine::getV4(v8Engine);
QV4::Scope scope(v4);
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index b46c6914d5..7e3400d4a6 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -181,7 +181,7 @@ void RegExpObject::markObjects(Managed *that, ExecutionEngine *e)
Property *RegExpObject::lastIndexProperty(ExecutionContext *ctx)
{
Q_UNUSED(ctx);
- Q_ASSERT(0 == internalClass()->find(ctx->engine->newIdentifier(QStringLiteral("lastIndex"))));
+ Q_ASSERT(0 == internalClass()->find(ctx->d()->engine->newIdentifier(QStringLiteral("lastIndex"))));
return propertyAt(0);
}
@@ -257,7 +257,7 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
return ctx->throwTypeError();
Scoped<RegExp> newRe(scope, re->value());
- return Encode(ctx->engine->newRegExpObject(newRe, re->global()));
+ return Encode(ctx->d()->engine->newRegExpObject(newRe, re->global()));
}
QString pattern;
@@ -287,11 +287,11 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
}
}
- Scoped<RegExp> regexp(scope, RegExp::create(ctx->engine, pattern, ignoreCase, multiLine));
+ Scoped<RegExp> regexp(scope, RegExp::create(ctx->d()->engine, pattern, ignoreCase, multiLine));
if (!regexp->isValid())
return ctx->throwSyntaxError(QStringLiteral("Invalid regular expression"));
- return Encode(ctx->engine->newRegExpObject(regexp, global));
+ return Encode(ctx->d()->engine->newRegExpObject(regexp, global));
}
ReturnedValue RegExpCtor::call(Managed *that, CallData *callData)
@@ -351,7 +351,7 @@ void RegExpPrototype::init(ExecutionEngine *engine, ObjectRef ctor)
ReturnedValue RegExpPrototype::method_exec(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<RegExpObject> r(scope, ctx->callData->thisObject.as<RegExpObject>());
+ Scoped<RegExpObject> r(scope, ctx->d()->callData->thisObject.as<RegExpObject>());
if (!r)
return ctx->throwTypeError();
@@ -370,7 +370,7 @@ ReturnedValue RegExpPrototype::method_exec(CallContext *ctx)
uint* matchOffsets = (uint*)alloca(r->value()->captureCount() * 2 * sizeof(uint));
const int result = r->value()->match(s, offset, matchOffsets);
- Scoped<RegExpCtor> regExpCtor(scope, ctx->engine->regExpCtor);
+ Scoped<RegExpCtor> regExpCtor(scope, ctx->d()->engine->regExpCtor);
regExpCtor->clearLastMatch();
if (result == -1) {
@@ -379,14 +379,14 @@ ReturnedValue RegExpPrototype::method_exec(CallContext *ctx)
}
// fill in result data
- Scoped<ArrayObject> array(scope, ctx->engine->newArrayObject(ctx->engine->regExpExecArrayClass));
+ Scoped<ArrayObject> array(scope, ctx->d()->engine->newArrayObject(ctx->d()->engine->regExpExecArrayClass));
int len = r->value()->captureCount();
array->arrayReserve(len);
ScopedValue v(scope);
for (int i = 0; i < len; ++i) {
int start = matchOffsets[i * 2];
int end = matchOffsets[i * 2 + 1];
- v = (start != -1 && end != -1) ? ctx->engine->newString(s.mid(start, end - start))->asReturnedValue() : Encode::undefined();
+ v = (start != -1 && end != -1) ? ctx->d()->engine->newString(s.mid(start, end - start))->asReturnedValue() : Encode::undefined();
array->arrayPut(i, v);
}
array->setArrayLengthUnchecked(len);
@@ -415,24 +415,24 @@ ReturnedValue RegExpPrototype::method_test(CallContext *ctx)
ReturnedValue RegExpPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<RegExpObject> r(scope, ctx->callData->thisObject.as<RegExpObject>());
+ Scoped<RegExpObject> r(scope, ctx->d()->callData->thisObject.as<RegExpObject>());
if (!r)
return ctx->throwTypeError();
- return ctx->engine->newString(r->toString())->asReturnedValue();
+ return ctx->d()->engine->newString(r->toString())->asReturnedValue();
}
ReturnedValue RegExpPrototype::method_compile(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<RegExpObject> r(scope, ctx->callData->thisObject.as<RegExpObject>());
+ Scoped<RegExpObject> r(scope, ctx->d()->callData->thisObject.as<RegExpObject>());
if (!r)
return ctx->throwTypeError();
- ScopedCallData callData(scope, ctx->callData->argc);
- memcpy(callData->args, ctx->callData->args, ctx->callData->argc*sizeof(Value));
+ ScopedCallData callData(scope, ctx->d()->callData->argc);
+ memcpy(callData->args, ctx->d()->callData->args, ctx->d()->callData->argc*sizeof(Value));
- Scoped<RegExpObject> re(scope, ctx->engine->regExpCtor.asFunctionObject()->construct(callData));
+ Scoped<RegExpObject> re(scope, ctx->d()->engine->regExpCtor.asFunctionObject()->construct(callData));
r->d()->value = re->value();
r->d()->global = re->global();
@@ -443,42 +443,42 @@ template <int index>
ReturnedValue RegExpPrototype::method_get_lastMatch_n(CallContext *ctx)
{
Scope scope(ctx);
- ScopedArrayObject lastMatch(scope, static_cast<RegExpCtor*>(ctx->engine->regExpCtor.objectValue())->lastMatch());
+ ScopedArrayObject lastMatch(scope, static_cast<RegExpCtor*>(ctx->d()->engine->regExpCtor.objectValue())->lastMatch());
ScopedValue result(scope, lastMatch ? lastMatch->getIndexed(index) : Encode::undefined());
if (result->isUndefined())
- return ctx->engine->newString(QString())->asReturnedValue();
+ return ctx->d()->engine->newString(QString())->asReturnedValue();
return result.asReturnedValue();
}
ReturnedValue RegExpPrototype::method_get_lastParen(CallContext *ctx)
{
Scope scope(ctx);
- ScopedArrayObject lastMatch(scope, static_cast<RegExpCtor*>(ctx->engine->regExpCtor.objectValue())->lastMatch());
+ ScopedArrayObject lastMatch(scope, static_cast<RegExpCtor*>(ctx->d()->engine->regExpCtor.objectValue())->lastMatch());
ScopedValue result(scope, lastMatch ? lastMatch->getIndexed(lastMatch->getLength() - 1) : Encode::undefined());
if (result->isUndefined())
- return ctx->engine->newString(QString())->asReturnedValue();
+ return ctx->d()->engine->newString(QString())->asReturnedValue();
return result.asReturnedValue();
}
ReturnedValue RegExpPrototype::method_get_input(CallContext *ctx)
{
- return static_cast<RegExpCtor*>(ctx->engine->regExpCtor.objectValue())->lastInput().asReturnedValue();
+ return static_cast<RegExpCtor*>(ctx->d()->engine->regExpCtor.objectValue())->lastInput().asReturnedValue();
}
ReturnedValue RegExpPrototype::method_get_leftContext(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<RegExpCtor> regExpCtor(scope, ctx->engine->regExpCtor);
+ Scoped<RegExpCtor> regExpCtor(scope, ctx->d()->engine->regExpCtor);
QString lastInput = regExpCtor->lastInput()->toQString();
- return ctx->engine->newString(lastInput.left(regExpCtor->lastMatchStart()))->asReturnedValue();
+ return ctx->d()->engine->newString(lastInput.left(regExpCtor->lastMatchStart()))->asReturnedValue();
}
ReturnedValue RegExpPrototype::method_get_rightContext(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<RegExpCtor> regExpCtor(scope, ctx->engine->regExpCtor);
+ Scoped<RegExpCtor> regExpCtor(scope, ctx->d()->engine->regExpCtor);
QString lastInput = regExpCtor->lastInput()->toQString();
- return ctx->engine->newString(lastInput.mid(regExpCtor->lastMatchEnd()))->asReturnedValue();
+ return ctx->d()->engine->newString(lastInput.mid(regExpCtor->lastMatchEnd()))->asReturnedValue();
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 86eb0c7fe7..3fa8db9098 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -265,7 +265,7 @@ void RuntimeHelpers::numberToString(QString *result, double num, int radix)
ReturnedValue Runtime::closure(ExecutionContext *ctx, int functionId)
{
- QV4::Function *clos = ctx->compilationUnit->runtimeFunctions[functionId];
+ QV4::Function *clos = ctx->d()->compilationUnit->runtimeFunctions[functionId];
Q_ASSERT(clos);
FunctionObject *f = FunctionObject::createScriptFunction(ctx, clos);
return f->asReturnedValue();
@@ -370,7 +370,7 @@ Returned<String> *RuntimeHelpers::stringFromNumber(ExecutionContext *ctx, double
{
QString qstr;
RuntimeHelpers::numberToString(&qstr, number, 10);
- return ctx->engine->newString(qstr);
+ return ctx->engine()->newString(qstr);
}
ReturnedValue RuntimeHelpers::objectDefaultValue(Object *object, int typeHint)
@@ -428,13 +428,13 @@ Returned<Object> *RuntimeHelpers::convertToObject(ExecutionContext *ctx, const V
ctx->throwTypeError();
return 0;
case Value::Boolean_Type:
- return ctx->engine->newBooleanObject(value);
+ return ctx->engine()->newBooleanObject(value);
case Value::Managed_Type:
Q_ASSERT(value->isString());
- return ctx->engine->newStringObject(value);
+ return ctx->engine()->newStringObject(value);
case Value::Integer_Type:
default: // double
- return ctx->engine->newNumberObject(value);
+ return ctx->engine()->newNumberObject(value);
}
}
@@ -444,14 +444,14 @@ Returned<String> *RuntimeHelpers::convertToString(ExecutionContext *ctx, const V
case Value::Empty_Type:
Q_ASSERT(!"empty Value encountered");
case Value::Undefined_Type:
- return ctx->engine->id_undefined.ret();
+ return ctx->engine()->id_undefined.ret();
case Value::Null_Type:
- return ctx->engine->id_null.ret();
+ return ctx->engine()->id_null.ret();
case Value::Boolean_Type:
if (value->booleanValue())
- return ctx->engine->id_true.ret();
+ return ctx->engine()->id_true.ret();
else
- return ctx->engine->id_false.ret();
+ return ctx->engine()->id_false.ret();
case Value::Managed_Type:
if (value->isString())
return value->stringValue()->asReturned<String>();
@@ -475,14 +475,14 @@ static Returned<String> *convert_to_string_add(ExecutionContext *ctx, const Valu
case Value::Empty_Type:
Q_ASSERT(!"empty Value encountered");
case Value::Undefined_Type:
- return ctx->engine->id_undefined.ret();
+ return ctx->engine()->id_undefined.ret();
case Value::Null_Type:
- return ctx->engine->id_null.ret();
+ return ctx->engine()->id_null.ret();
case Value::Boolean_Type:
if (value->booleanValue())
- return ctx->engine->id_true.ret();
+ return ctx->engine()->id_true.ret();
else
- return ctx->engine->id_false.ret();
+ return ctx->engine()->id_false.ret();
case Value::Managed_Type:
if (value->isString())
return value->stringValue()->asReturned<String>();
@@ -515,7 +515,7 @@ QV4::ReturnedValue RuntimeHelpers::addHelper(ExecutionContext *ctx, const ValueR
return pright->asReturnedValue();
if (!pright->stringValue()->length())
return pleft->asReturnedValue();
- return (new (ctx->engine->memoryManager) String(ctx->engine, pleft->stringValue(), pright->stringValue()))->asReturnedValue();
+ return (new (ctx->engine()->memoryManager) String(ctx->d()->engine, pleft->stringValue(), pright->stringValue()))->asReturnedValue();
}
double x = RuntimeHelpers::toNumber(pleft);
double y = RuntimeHelpers::toNumber(pright);
@@ -531,7 +531,7 @@ QV4::ReturnedValue Runtime::addString(QV4::ExecutionContext *ctx, const QV4::Val
return right->asReturnedValue();
if (!right->stringValue()->length())
return left->asReturnedValue();
- return (new (ctx->engine->memoryManager) String(ctx->engine, left->stringValue(), right->stringValue()))->asReturnedValue();
+ return (new (ctx->engine()->memoryManager) String(ctx->d()->engine, left->stringValue(), right->stringValue()))->asReturnedValue();
}
Scope scope(ctx);
@@ -548,7 +548,7 @@ QV4::ReturnedValue Runtime::addString(QV4::ExecutionContext *ctx, const QV4::Val
return pright->asReturnedValue();
if (!pright->stringValue()->length())
return pleft->asReturnedValue();
- return (new (ctx->engine->memoryManager) String(ctx->engine, pleft->stringValue(), pright->stringValue()))->asReturnedValue();
+ return (new (ctx->engine()->memoryManager) String(ctx->d()->engine, pleft->stringValue(), pright->stringValue()))->asReturnedValue();
}
void Runtime::setProperty(ExecutionContext *ctx, const ValueRef object, const StringRef name, const ValueRef value)
@@ -633,7 +633,7 @@ ReturnedValue Runtime::foreachIterator(ExecutionContext *ctx, const ValueRef in)
Scoped<Object> o(scope, (Object *)0);
if (!in->isNullOrUndefined())
o = in->toObject(ctx);
- Scoped<Object> it(scope, ctx->engine->newForEachIteratorObject(ctx, o));
+ Scoped<Object> it(scope, ctx->engine()->newForEachIteratorObject(ctx, o));
return it.asReturnedValue();
}
@@ -871,12 +871,12 @@ ReturnedValue Runtime::callGlobalLookup(ExecutionContext *context, uint index, C
Scope scope(context);
Q_ASSERT(callData->thisObject.isUndefined());
- Lookup *l = context->lookups + index;
+ Lookup *l = context->d()->lookups + index;
Scoped<FunctionObject> o(scope, l->globalGetter(l, context));
if (!o)
return context->throwTypeError();
- if (o.getPointer() == context->engine->evalFunction && l->name->equals(context->engine->id_eval))
+ if (o.getPointer() == scope.engine->evalFunction && l->name->equals(scope.engine->id_eval))
return static_cast<EvalFunction *>(o.getPointer())->evalCall(callData, true);
return o->call(callData);
@@ -890,7 +890,7 @@ ReturnedValue Runtime::callActivationProperty(ExecutionContext *context, const S
ScopedObject base(scope);
ScopedValue func(scope, context->getPropertyAndBase(name, base));
- if (context->engine->hasException)
+ if (scope.engine->hasException)
return Encode::undefined();
if (base)
@@ -905,7 +905,7 @@ ReturnedValue Runtime::callActivationProperty(ExecutionContext *context, const S
return context->throwTypeError(msg);
}
- if (o == context->engine->evalFunction && name->equals(context->engine->id_eval)) {
+ if (o == scope.engine->evalFunction && name->equals(scope.engine->id_eval)) {
return static_cast<EvalFunction *>(o)->evalCall(callData, true);
}
@@ -940,7 +940,7 @@ ReturnedValue Runtime::callProperty(ExecutionContext *context, const StringRef n
ReturnedValue Runtime::callPropertyLookup(ExecutionContext *context, uint index, CallDataRef callData)
{
- Lookup *l = context->lookups + index;
+ Lookup *l = context->d()->lookups + index;
Value v;
v = l->getter(l, callData->thisObject);
if (!v.isObject())
@@ -980,7 +980,7 @@ ReturnedValue Runtime::constructGlobalLookup(ExecutionContext *context, uint ind
Scope scope(context);
Q_ASSERT(callData->thisObject.isUndefined());
- Lookup *l = context->lookups + index;
+ Lookup *l = context->d()->lookups + index;
Scoped<Object> f(scope, l->globalGetter(l, context));
if (!f)
return context->throwTypeError();
@@ -993,7 +993,7 @@ ReturnedValue Runtime::constructActivationProperty(ExecutionContext *context, co
{
Scope scope(context);
ScopedValue func(scope, context->getProperty(name));
- if (context->engine->hasException)
+ if (scope.engine->hasException)
return Encode::undefined();
Object *f = func->asObject();
@@ -1028,7 +1028,7 @@ ReturnedValue Runtime::constructProperty(ExecutionContext *context, const String
ReturnedValue Runtime::constructPropertyLookup(ExecutionContext *context, uint index, CallDataRef callData)
{
- Lookup *l = context->lookups + index;
+ Lookup *l = context->d()->lookups + index;
Value v;
v = l->getter(l, callData->thisObject);
if (!v.isObject())
@@ -1050,24 +1050,24 @@ ReturnedValue Runtime::typeofValue(ExecutionContext *ctx, const ValueRef value)
ScopedString res(scope);
switch (value->type()) {
case Value::Undefined_Type:
- res = ctx->engine->id_undefined;
+ res = ctx->engine()->id_undefined;
break;
case Value::Null_Type:
- res = ctx->engine->id_object;
+ res = ctx->engine()->id_object;
break;
case Value::Boolean_Type:
- res = ctx->engine->id_boolean;
+ res = ctx->engine()->id_boolean;
break;
case Value::Managed_Type:
if (value->isString())
- res = ctx->engine->id_string;
+ res = ctx->engine()->id_string;
else if (value->objectValue()->asFunctionObject())
- res = ctx->engine->id_function;
+ res = ctx->engine()->id_function;
else
- res = ctx->engine->id_object; // ### implementation-defined
+ res = ctx->engine()->id_object; // ### implementation-defined
break;
default:
- res = ctx->engine->id_number;
+ res = ctx->engine()->id_number;
break;
}
return res.asReturnedValue();
@@ -1078,7 +1078,7 @@ QV4::ReturnedValue Runtime::typeofName(ExecutionContext *context, const StringRe
Scope scope(context);
ScopedValue prop(scope, context->getProperty(name));
// typeof doesn't throw. clear any possible exception
- context->engine->hasException = false;
+ scope.engine->hasException = false;
return Runtime::typeofValue(context, prop);
}
@@ -1112,21 +1112,21 @@ ExecutionContext *Runtime::pushWithScope(const ValueRef o, ExecutionContext *ctx
ReturnedValue Runtime::unwindException(ExecutionContext *ctx)
{
- if (!ctx->engine->hasException)
+ if (!ctx->engine()->hasException)
return Primitive::emptyValue().asReturnedValue();
- return ctx->engine->catchException(ctx, 0);
+ return ctx->engine()->catchException(ctx, 0);
}
ExecutionContext *Runtime::pushCatchScope(ExecutionContext *ctx, const StringRef exceptionVarName)
{
Scope scope(ctx);
- ScopedValue v(scope, ctx->engine->catchException(ctx, 0));
+ ScopedValue v(scope, ctx->engine()->catchException(ctx, 0));
return ctx->newCatchContext(exceptionVarName, v);
}
ExecutionContext *Runtime::popScope(ExecutionContext *ctx)
{
- return ctx->engine->popContext();
+ return ctx->engine()->popContext();
}
void Runtime::declareVar(ExecutionContext *ctx, bool deletable, const StringRef name)
@@ -1137,7 +1137,7 @@ void Runtime::declareVar(ExecutionContext *ctx, bool deletable, const StringRef
ReturnedValue Runtime::arrayLiteral(ExecutionContext *ctx, Value *values, uint length)
{
Scope scope(ctx);
- Scoped<ArrayObject> a(scope, ctx->engine->newArrayObject());
+ Scoped<ArrayObject> a(scope, ctx->engine()->newArrayObject());
if (length) {
a->arrayReserve(length);
@@ -1150,8 +1150,8 @@ ReturnedValue Runtime::arrayLiteral(ExecutionContext *ctx, Value *values, uint l
ReturnedValue Runtime::objectLiteral(QV4::ExecutionContext *ctx, const QV4::Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags)
{
Scope scope(ctx);
- QV4::InternalClass *klass = ctx->compilationUnit->runtimeClasses[classId];
- Scoped<Object> o(scope, ctx->engine->newObject(klass));
+ QV4::InternalClass *klass = ctx->d()->compilationUnit->runtimeClasses[classId];
+ Scoped<Object> o(scope, ctx->engine()->newObject(klass));
{
bool needSparseArray = arrayGetterSetterCountAndFlags >> 30;
@@ -1191,9 +1191,9 @@ ReturnedValue Runtime::objectLiteral(QV4::ExecutionContext *ctx, const QV4::Valu
QV4::ReturnedValue Runtime::setupArgumentsObject(ExecutionContext *ctx)
{
- assert(ctx->type >= ExecutionContext::Type_CallContext);
+ Q_ASSERT(ctx->d()->type >= ExecutionContext::Type_CallContext);
CallContext *c = static_cast<CallContext *>(ctx);
- return (new (c->engine->memoryManager) ArgumentsObject(c))->asReturnedValue();
+ return (new (c->engine()->memoryManager) ArgumentsObject(c))->asReturnedValue();
}
#endif // V4_BOOTSTRAP
@@ -1279,27 +1279,27 @@ unsigned Runtime::doubleToUInt(const double &d)
ReturnedValue Runtime::regexpLiteral(ExecutionContext *ctx, int id)
{
- return ctx->compilationUnit->runtimeRegularExpressions[id].asReturnedValue();
+ return ctx->d()->compilationUnit->runtimeRegularExpressions[id].asReturnedValue();
}
ReturnedValue Runtime::getQmlIdArray(NoThrowContext *ctx)
{
- return ctx->engine->qmlContextObject()->getPointer()->as<QmlContextWrapper>()->idObjectsArray();
+ return ctx->engine()->qmlContextObject()->getPointer()->as<QmlContextWrapper>()->idObjectsArray();
}
ReturnedValue Runtime::getQmlContextObject(NoThrowContext *ctx)
{
- QQmlContextData *context = QmlContextWrapper::callingContext(ctx->engine);
+ QQmlContextData *context = QmlContextWrapper::callingContext(ctx->engine());
if (!context)
return Encode::undefined();
- return QObjectWrapper::wrap(ctx->engine, context->contextObject);
+ return QObjectWrapper::wrap(ctx->d()->engine, context->contextObject);
}
ReturnedValue Runtime::getQmlScopeObject(NoThrowContext *ctx)
{
Scope scope(ctx);
- QV4::Scoped<QmlContextWrapper> c(scope, ctx->engine->qmlContextObject()->getPointer()->as<QmlContextWrapper>());
- return QObjectWrapper::wrap(ctx->engine, c->getScopeObject());
+ QV4::Scoped<QmlContextWrapper> c(scope, ctx->engine()->qmlContextObject()->getPointer()->as<QmlContextWrapper>());
+ return QObjectWrapper::wrap(ctx->d()->engine, c->getScopeObject());
}
ReturnedValue Runtime::getQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired)
@@ -1316,11 +1316,11 @@ ReturnedValue Runtime::getQmlQObjectProperty(ExecutionContext *ctx, const ValueR
QV4::ReturnedValue Runtime::getQmlAttachedProperty(ExecutionContext *ctx, int attachedPropertiesId, int propertyIndex)
{
Scope scope(ctx);
- QV4::Scoped<QmlContextWrapper> c(scope, ctx->engine->qmlContextObject()->getPointer()->as<QmlContextWrapper>());
+ QV4::Scoped<QmlContextWrapper> c(scope, ctx->engine()->qmlContextObject()->getPointer()->as<QmlContextWrapper>());
QObject *scopeObject = c->getScopeObject();
QObject *attachedObject = qmlAttachedPropertiesObjectById(attachedPropertiesId, scopeObject);
- QQmlEngine *qmlEngine = ctx->engine->v8Engine->engine();
+ QQmlEngine *qmlEngine = ctx->engine()->v8Engine->engine();
QQmlData::ensurePropertyCache(qmlEngine, attachedObject);
return QV4::QObjectWrapper::getProperty(attachedObject, ctx, propertyIndex, /*captureRequired*/true);
}
@@ -1338,7 +1338,7 @@ void Runtime::setQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object
ReturnedValue Runtime::getQmlImportedScripts(NoThrowContext *ctx)
{
- QQmlContextData *context = QmlContextWrapper::callingContext(ctx->engine);
+ QQmlContextData *context = QmlContextWrapper::callingContext(ctx->engine());
if (!context)
return Encode::undefined();
return context->importedScripts.value();
@@ -1346,16 +1346,16 @@ ReturnedValue Runtime::getQmlImportedScripts(NoThrowContext *ctx)
QV4::ReturnedValue Runtime::getQmlSingleton(QV4::NoThrowContext *ctx, const QV4::StringRef name)
{
- return ctx->engine->qmlContextObject()->getPointer()->as<QmlContextWrapper>()->qmlSingletonWrapper(ctx->engine->v8Engine, name);
+ return ctx->engine()->qmlContextObject()->getPointer()->as<QmlContextWrapper>()->qmlSingletonWrapper(ctx->engine()->v8Engine, name);
}
void Runtime::convertThisToObject(ExecutionContext *ctx)
{
- Value *t = &ctx->callData->thisObject;
+ Value *t = &ctx->d()->callData->thisObject;
if (t->isObject())
return;
if (t->isNullOrUndefined()) {
- *t = ctx->engine->globalObject->asReturnedValue();
+ *t = ctx->engine()->globalObject->asReturnedValue();
} else {
*t = t->toObject(ctx)->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index f67cd6c52a..fa856be6a2 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -62,7 +62,7 @@
using namespace QV4;
QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, Function *f, ObjectRef qml)
- : FunctionObject(scope, scope->engine->id_eval, /*createProto = */ false)
+ : FunctionObject(scope, scope->d()->engine->id_eval, /*createProto = */ false)
{
d()->qml = qml;
@@ -77,14 +77,14 @@ QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, Function *f, Objec
Scope s(scope);
ScopedValue protectThis(s, this);
- defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(1));
+ defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(1));
- d()->qmlContext = scope->engine->currentContext()->newQmlContext(this, qml);
- scope->engine->popContext();
+ d()->qmlContext = scope->d()->engine->currentContext()->newQmlContext(this, qml);
+ scope->d()->engine->popContext();
}
QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, ObjectRef qml)
- : FunctionObject(scope, scope->engine->id_eval, /*createProto = */ false)
+ : FunctionObject(scope, scope->d()->engine->id_eval, /*createProto = */ false)
{
d()->qml = qml;
@@ -96,10 +96,10 @@ QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, ObjectRef qml)
Scope s(scope);
ScopedValue protectThis(s, this);
- defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(1));
+ defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(1));
- d()->qmlContext = scope->engine->currentContext()->newQmlContext(this, qml);
- scope->engine->popContext();
+ d()->qmlContext = scope->d()->engine->currentContext()->newQmlContext(this, qml);
+ scope->d()->engine->popContext();
}
ReturnedValue QmlBindingWrapper::call(Managed *that, CallData *)
@@ -133,7 +133,7 @@ void QmlBindingWrapper::markObjects(Managed *m, ExecutionEngine *e)
static ReturnedValue signalParameterGetter(QV4::CallContext *ctx, uint parameterIndex)
{
- QV4::CallContext *signalEmittingContext = ctx->parent->asCallContext();
+ QV4::CallContext *signalEmittingContext = ctx->d()->parent->asCallContext();
Q_ASSERT(signalEmittingContext);
return signalEmittingContext->argument(parameterIndex);
}
@@ -226,7 +226,7 @@ void Script::parse()
parsed = true;
- ExecutionEngine *v4 = scope->engine;
+ ExecutionEngine *v4 = scope->d()->engine;
Scope valueScope(v4);
MemoryManager::GCBlocker gcBlocker(v4->memoryManager);
@@ -300,16 +300,16 @@ ReturnedValue Script::run()
ContextStateSaver(ExecutionContext *context)
: savedContext(context)
- , strictMode(context->strictMode)
- , lookups(context->lookups)
- , compilationUnit(context->compilationUnit)
+ , strictMode(context->d()->strictMode)
+ , lookups(context->d()->lookups)
+ , compilationUnit(context->d()->compilationUnit)
{}
~ContextStateSaver()
{
- savedContext->strictMode = strictMode;
- savedContext->lookups = lookups;
- savedContext->compilationUnit = compilationUnit;
+ savedContext->d()->strictMode = strictMode;
+ savedContext->d()->lookups = lookups;
+ savedContext->d()->compilationUnit = compilationUnit;
}
};
@@ -318,7 +318,7 @@ ReturnedValue Script::run()
if (!vmFunction)
return Encode::undefined();
- QV4::ExecutionEngine *engine = scope->engine;
+ QV4::ExecutionEngine *engine = scope->d()->engine;
QV4::Scope valueScope(engine);
if (qml.isUndefined()) {
@@ -326,9 +326,9 @@ ReturnedValue Script::run()
ExecutionContextSaver ctxSaver(scope);
ContextStateSaver stateSaver(scope);
- scope->strictMode = vmFunction->isStrict();
- scope->lookups = vmFunction->compilationUnit->runtimeLookups;
- scope->compilationUnit = vmFunction->compilationUnit;
+ scope->d()->strictMode = vmFunction->isStrict();
+ scope->d()->lookups = vmFunction->compilationUnit->runtimeLookups;
+ scope->d()->compilationUnit = vmFunction->compilationUnit;
return vmFunction->code(scope, vmFunction->codeData);
} else {
@@ -406,7 +406,7 @@ ReturnedValue Script::qmlBinding()
{
if (!parsed)
parse();
- ExecutionEngine *v4 = scope->engine;
+ ExecutionEngine *v4 = scope->d()->engine;
Scope valueScope(v4);
ScopedObject qmlObj(valueScope, qml.value());
ScopedObject v(valueScope, new (v4->memoryManager) QmlBindingWrapper(scope, vmFunction, qmlObj));
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index 17ec640244..6dbe787ab5 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -58,13 +58,13 @@ using namespace QV4;
// helper function to generate valid warnings if errors occur during sequence operations.
static void generateWarning(QV4::ExecutionContext *ctx, const QString& description)
{
- QQmlEngine *engine = ctx->engine->v8Engine->engine();
+ QQmlEngine *engine = ctx->d()->engine->v8Engine->engine();
if (!engine)
return;
QQmlError retn;
retn.setDescription(description);
- QV4::StackFrame frame = ctx->engine->currentStackFrame();
+ QV4::StackFrame frame = ctx->d()->engine->currentStackFrame();
retn.setLine(frame.line);
retn.setUrl(QUrl(frame.source));
@@ -380,9 +380,9 @@ public:
QV4::Scope scope(m_ctx);
ScopedObject compare(scope, m_compareFn);
ScopedCallData callData(scope, 2);
- callData->args[0] = convertElementToValue(this->m_ctx->engine, lhs);
- callData->args[1] = convertElementToValue(this->m_ctx->engine, rhs);
- callData->thisObject = this->m_ctx->engine->globalObject;
+ callData->args[0] = convertElementToValue(this->m_ctx->d()->engine, lhs);
+ callData->args[1] = convertElementToValue(this->m_ctx->d()->engine, rhs);
+ callData->thisObject = this->m_ctx->d()->engine->globalObject;
QV4::ScopedValue result(scope, compare->call(callData));
return result->toNumber() < 0;
}
@@ -401,8 +401,8 @@ public:
}
QV4::Scope scope(ctx);
- if (ctx->callData->argc == 1 && ctx->callData->args[0].asFunctionObject()) {
- CompareFunctor cf(ctx, ctx->callData->args[0]);
+ if (ctx->d()->callData->argc == 1 && ctx->d()->callData->args[0].asFunctionObject()) {
+ CompareFunctor cf(ctx, ctx->d()->callData->args[0]);
std::sort(d()->container.begin(), d()->container.end(), cf);
} else {
DefaultCompareFunctor cf;
@@ -416,7 +416,7 @@ public:
static QV4::ReturnedValue method_get_length(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSequence<Container> > This(scope, ctx->callData->thisObject.as<QQmlSequence<Container> >());
+ QV4::Scoped<QQmlSequence<Container> > This(scope, ctx->d()->callData->thisObject.as<QQmlSequence<Container> >());
if (!This)
return ctx->throwTypeError();
@@ -431,11 +431,11 @@ public:
static QV4::ReturnedValue method_set_length(QV4::CallContext* ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSequence<Container> > This(scope, ctx->callData->thisObject.as<QQmlSequence<Container> >());
+ QV4::Scoped<QQmlSequence<Container> > This(scope, ctx->d()->callData->thisObject.as<QQmlSequence<Container> >());
if (!This)
return ctx->throwTypeError();
- quint32 newLength = ctx->callData->args[0].toUInt32();
+ quint32 newLength = ctx->d()->callData->args[0].toUInt32();
/* Qt containers have int (rather than uint) allowable indexes. */
if (newLength > INT_MAX) {
generateWarning(ctx, QLatin1String("Index out of range during length set"));
@@ -564,11 +564,11 @@ void SequencePrototype::init()
QV4::ReturnedValue SequencePrototype::method_sort(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::ScopedObject o(scope, ctx->callData->thisObject);
+ QV4::ScopedObject o(scope, ctx->d()->callData->thisObject);
if (!o || !o->isListType())
return ctx->throwTypeError();
- if (ctx->callData->argc >= 2)
+ if (ctx->d()->callData->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 4a5e82b688..d82f80d35e 100644
--- a/src/qml/jsruntime/qv4sequenceobject_p.h
+++ b/src/qml/jsruntime/qv4sequenceobject_p.h
@@ -71,7 +71,7 @@ struct SequencePrototype : public QV4::Object
static ReturnedValue method_valueOf(QV4::CallContext *ctx)
{
- return ctx->callData->thisObject.toString(ctx)->asReturnedValue();
+ return ctx->d()->callData->thisObject.toString(ctx)->asReturnedValue();
}
static ReturnedValue method_sort(QV4::CallContext *ctx);
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index b0cfb3e53c..5cc1b13c4f 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -128,7 +128,7 @@ bool StringObject::deleteIndexedProperty(Managed *m, uint index)
}
if (index < static_cast<uint>(o->d()->value.stringValue()->toQString().length())) {
- if (v4->currentContext()->strictMode)
+ if (v4->currentContext()->d()->strictMode)
v4->currentContext()->throwTypeError();
return false;
}
@@ -238,7 +238,7 @@ void StringPrototype::init(ExecutionEngine *engine, ObjectRef ctor)
static QString getThisString(ExecutionContext *ctx)
{
Scope scope(ctx);
- ScopedValue t(scope, ctx->callData->thisObject);
+ ScopedValue t(scope, ctx->d()->callData->thisObject);
if (t->isString())
return t->stringValue()->toQString();
if (StringObject *thisString = t->asStringObject())
@@ -252,10 +252,10 @@ static QString getThisString(ExecutionContext *ctx)
ReturnedValue StringPrototype::method_toString(CallContext *context)
{
- if (context->callData->thisObject.isString())
- return context->callData->thisObject.asReturnedValue();
+ if (context->d()->callData->thisObject.isString())
+ return context->d()->callData->thisObject.asReturnedValue();
- StringObject *o = context->callData->thisObject.asStringObject();
+ StringObject *o = context->d()->callData->thisObject.asStringObject();
if (!o)
return context->throwTypeError();
return o->d()->value.asReturnedValue();
@@ -264,29 +264,29 @@ ReturnedValue StringPrototype::method_toString(CallContext *context)
ReturnedValue StringPrototype::method_charAt(CallContext *context)
{
const QString str = getThisString(context);
- if (context->engine->hasException)
+ if (context->d()->engine->hasException)
return Encode::undefined();
int pos = 0;
- if (context->callData->argc > 0)
- pos = (int) context->callData->args[0].toInteger();
+ if (context->d()->callData->argc > 0)
+ pos = (int) context->d()->callData->args[0].toInteger();
QString result;
if (pos >= 0 && pos < str.length())
result += str.at(pos);
- return context->engine->newString(result)->asReturnedValue();
+ return context->d()->engine->newString(result)->asReturnedValue();
}
ReturnedValue StringPrototype::method_charCodeAt(CallContext *context)
{
const QString str = getThisString(context);
- if (context->engine->hasException)
+ if (context->d()->engine->hasException)
return Encode::undefined();
int pos = 0;
- if (context->callData->argc > 0)
- pos = (int) context->callData->args[0].toInteger();
+ if (context->d()->callData->argc > 0)
+ pos = (int) context->d()->callData->args[0].toInteger();
if (pos >= 0 && pos < str.length())
@@ -304,30 +304,30 @@ ReturnedValue StringPrototype::method_concat(CallContext *context)
return Encode::undefined();
ScopedValue v(scope);
- for (int i = 0; i < context->callData->argc; ++i) {
- v = RuntimeHelpers::toString(context, ValueRef(&context->callData->args[i]));
+ for (int i = 0; i < context->d()->callData->argc; ++i) {
+ v = RuntimeHelpers::toString(context, ValueRef(&context->d()->callData->args[i]));
if (scope.hasException())
return Encode::undefined();
Q_ASSERT(v->isString());
value += v->stringValue()->toQString();
}
- return context->engine->newString(value)->asReturnedValue();
+ return context->d()->engine->newString(value)->asReturnedValue();
}
ReturnedValue StringPrototype::method_indexOf(CallContext *context)
{
QString value = getThisString(context);
- if (context->engine->hasException)
+ if (context->d()->engine->hasException)
return Encode::undefined();
QString searchString;
- if (context->callData->argc)
- searchString = context->callData->args[0].toString(context)->toQString();
+ if (context->d()->callData->argc)
+ searchString = context->d()->callData->args[0].toString(context)->toQString();
int pos = 0;
- if (context->callData->argc > 1)
- pos = (int) context->callData->args[1].toInteger();
+ if (context->d()->callData->argc > 1)
+ pos = (int) context->d()->callData->args[1].toInteger();
int index = -1;
if (! value.isEmpty())
@@ -345,8 +345,8 @@ ReturnedValue StringPrototype::method_lastIndexOf(CallContext *context)
return Encode::undefined();
QString searchString;
- if (context->callData->argc)
- searchString = context->callData->args[0].toQString();
+ if (context->d()->callData->argc)
+ searchString = context->d()->callData->args[0].toQString();
ScopedValue posArg(scope, context->argument(1));
double position = RuntimeHelpers::toNumber(posArg);
@@ -371,25 +371,25 @@ ReturnedValue StringPrototype::method_localeCompare(CallContext *context)
if (scope.engine->hasException)
return Encode::undefined();
- ScopedValue v(scope, context->callData->argument(0));
+ ScopedValue v(scope, context->d()->callData->argument(0));
const QString that = v->toQString();
return Encode(QString::localeAwareCompare(value, that));
}
ReturnedValue StringPrototype::method_match(CallContext *context)
{
- if (context->callData->thisObject.isUndefined() || context->callData->thisObject.isNull())
+ if (context->d()->callData->thisObject.isUndefined() || context->d()->callData->thisObject.isNull())
return context->throwTypeError();
Scope scope(context);
- ScopedString s(scope, context->callData->thisObject.toString(context));
+ ScopedString s(scope, context->d()->callData->thisObject.toString(context));
- ScopedValue regexp(scope, context->callData->argument(0));
+ ScopedValue regexp(scope, context->d()->callData->argument(0));
Scoped<RegExpObject> rx(scope, regexp);
if (!rx) {
ScopedCallData callData(scope, 1);
callData->args[0] = regexp;
- rx = context->engine->regExpCtor.asFunctionObject()->construct(callData);
+ rx = context->d()->engine->regExpCtor.asFunctionObject()->construct(callData);
}
if (!rx)
@@ -399,8 +399,8 @@ ReturnedValue StringPrototype::method_match(CallContext *context)
bool global = rx->global();
// ### use the standard builtin function, not the one that might be redefined in the proto
- ScopedString execString(scope, context->engine->newString(QStringLiteral("exec")));
- Scoped<FunctionObject> exec(scope, context->engine->regExpClass->prototype->get(execString));
+ ScopedString execString(scope, context->d()->engine->newString(QStringLiteral("exec")));
+ Scoped<FunctionObject> exec(scope, context->d()->engine->regExpClass->prototype->get(execString));
ScopedCallData callData(scope, 1);
callData->thisObject = rx;
@@ -408,9 +408,9 @@ ReturnedValue StringPrototype::method_match(CallContext *context)
if (!global)
return exec->call(callData);
- ScopedString lastIndex(scope, context->engine->newString(QStringLiteral("lastIndex")));
+ ScopedString lastIndex(scope, context->d()->engine->newString(QStringLiteral("lastIndex")));
rx->put(lastIndex, ScopedValue(scope, Primitive::fromInt32(0)));
- Scoped<ArrayObject> a(scope, context->engine->newArrayObject());
+ Scoped<ArrayObject> a(scope, context->d()->engine->newArrayObject());
double previousLastIndex = 0;
uint n = 0;
@@ -491,10 +491,10 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx)
{
Scope scope(ctx);
QString string;
- if (StringObject *thisString = ctx->callData->thisObject.asStringObject())
+ if (StringObject *thisString = ctx->d()->callData->thisObject.asStringObject())
string = thisString->d()->value.stringValue()->toQString();
else
- string = ctx->callData->thisObject.toString(ctx)->toQString();
+ string = ctx->d()->callData->thisObject.toString(ctx)->toQString();
int numCaptures = 0;
int numStringMatches = 0;
@@ -563,14 +563,14 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx)
uint end = matchOffsets[idx + 1];
entry = Primitive::undefinedValue();
if (start != JSC::Yarr::offsetNoMatch && end != JSC::Yarr::offsetNoMatch)
- entry = ctx->engine->newString(string.mid(start, end - start));
+ entry = ctx->d()->engine->newString(string.mid(start, end - start));
callData->args[k] = entry;
}
uint matchStart = matchOffsets[i * numCaptures * 2];
Q_ASSERT(matchStart >= static_cast<uint>(lastEnd));
uint matchEnd = matchOffsets[i * numCaptures * 2 + 1];
callData->args[numCaptures] = Primitive::fromUInt32(matchStart);
- callData->args[numCaptures + 1] = ctx->engine->newString(string);
+ callData->args[numCaptures + 1] = ctx->d()->engine->newString(string);
replacement = searchCallback->call(callData);
result += string.midRef(lastEnd, matchStart - lastEnd);
@@ -600,7 +600,7 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx)
if (matchOffsets != _matchOffsets)
free(matchOffsets);
- return ctx->engine->newString(result)->asReturnedValue();
+ return ctx->d()->engine->newString(result)->asReturnedValue();
}
ReturnedValue StringPrototype::method_search(CallContext *ctx)
@@ -614,7 +614,7 @@ ReturnedValue StringPrototype::method_search(CallContext *ctx)
if (!regExp) {
ScopedCallData callData(scope, 1);
callData->args[0] = regExpValue;
- regExpValue = ctx->engine->regExpCtor.asFunctionObject()->construct(callData);
+ regExpValue = ctx->d()->engine->regExpCtor.asFunctionObject()->construct(callData);
if (scope.engine->hasException)
return Encode::undefined();
regExp = regExpValue->as<RegExpObject>();
@@ -630,14 +630,14 @@ ReturnedValue StringPrototype::method_search(CallContext *ctx)
ReturnedValue StringPrototype::method_slice(CallContext *ctx)
{
const QString text = getThisString(ctx);
- if (ctx->engine->hasException)
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
const double length = text.length();
- double start = ctx->callData->argc ? ctx->callData->args[0].toInteger() : 0;
- double end = (ctx->callData->argc < 2 || ctx->callData->args[1].isUndefined())
- ? length : ctx->callData->args[1].toInteger();
+ 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();
if (start < 0)
start = qMax(length + start, 0.);
@@ -653,7 +653,7 @@ ReturnedValue StringPrototype::method_slice(CallContext *ctx)
const int intEnd = int(end);
int count = qMax(0, intEnd - intStart);
- return ctx->engine->newString(text.mid(intStart, count))->asReturnedValue();
+ return ctx->d()->engine->newString(text.mid(intStart, count))->asReturnedValue();
}
ReturnedValue StringPrototype::method_split(CallContext *ctx)
@@ -666,15 +666,15 @@ ReturnedValue StringPrototype::method_split(CallContext *ctx)
ScopedValue separatorValue(scope, ctx->argument(0));
ScopedValue limitValue(scope, ctx->argument(1));
- ScopedArrayObject array(scope, ctx->engine->newArrayObject());
+ ScopedArrayObject array(scope, ctx->d()->engine->newArrayObject());
if (separatorValue->isUndefined()) {
if (limitValue->isUndefined()) {
- ScopedString s(scope, ctx->engine->newString(text));
+ ScopedString s(scope, ctx->d()->engine->newString(text));
array->push_back(s);
return array.asReturnedValue();
}
- return ctx->engine->newString(text.left(limitValue->toInteger()))->asReturnedValue();
+ return ctx->d()->engine->newString(text.left(limitValue->toInteger()))->asReturnedValue();
}
uint limit = limitValue->isUndefined() ? UINT_MAX : limitValue->toUInt32();
@@ -686,7 +686,7 @@ ReturnedValue StringPrototype::method_split(CallContext *ctx)
if (re) {
if (re->value()->pattern().isEmpty()) {
re = (RegExpObject *)0;
- separatorValue = ctx->engine->newString(QString());
+ separatorValue = ctx->d()->engine->newString(QString());
}
}
@@ -699,7 +699,7 @@ ReturnedValue StringPrototype::method_split(CallContext *ctx)
if (result == JSC::Yarr::offsetNoMatch)
break;
- array->push_back((s = ctx->engine->newString(text.mid(offset, matchOffsets[0] - offset))));
+ array->push_back((s = ctx->d()->engine->newString(text.mid(offset, matchOffsets[0] - offset))));
offset = qMax(offset + 1, matchOffsets[1]);
if (array->getLength() >= limit)
@@ -708,31 +708,31 @@ ReturnedValue StringPrototype::method_split(CallContext *ctx)
for (int i = 1; i < re->value()->captureCount(); ++i) {
uint start = matchOffsets[i * 2];
uint end = matchOffsets[i * 2 + 1];
- array->push_back((s = ctx->engine->newString(text.mid(start, end - start))));
+ array->push_back((s = ctx->d()->engine->newString(text.mid(start, end - start))));
if (array->getLength() >= limit)
break;
}
}
if (array->getLength() < limit)
- array->push_back((s = ctx->engine->newString(text.mid(offset))));
+ array->push_back((s = ctx->d()->engine->newString(text.mid(offset))));
} else {
QString separator = separatorValue->toString(ctx)->toQString();
if (separator.isEmpty()) {
for (uint i = 0; i < qMin(limit, uint(text.length())); ++i)
- array->push_back((s = ctx->engine->newString(text.mid(i, 1))));
+ array->push_back((s = ctx->d()->engine->newString(text.mid(i, 1))));
return array.asReturnedValue();
}
int start = 0;
int end;
while ((end = text.indexOf(separator, start)) != -1) {
- array->push_back((s = ctx->engine->newString(text.mid(start, end - start))));
+ array->push_back((s = ctx->d()->engine->newString(text.mid(start, end - start))));
start = end + separator.size();
if (array->getLength() >= limit)
break;
}
if (array->getLength() < limit && start != -1)
- array->push_back((s = ctx->engine->newString(text.mid(start))));
+ array->push_back((s = ctx->d()->engine->newString(text.mid(start))));
}
return array.asReturnedValue();
}
@@ -740,16 +740,16 @@ ReturnedValue StringPrototype::method_split(CallContext *ctx)
ReturnedValue StringPrototype::method_substr(CallContext *context)
{
const QString value = getThisString(context);
- if (context->engine->hasException)
+ if (context->d()->engine->hasException)
return Encode::undefined();
double start = 0;
- if (context->callData->argc > 0)
- start = context->callData->args[0].toInteger();
+ if (context->d()->callData->argc > 0)
+ start = context->d()->callData->args[0].toInteger();
double length = +qInf();
- if (context->callData->argc > 1)
- length = context->callData->args[1].toInteger();
+ if (context->d()->callData->argc > 1)
+ length = context->d()->callData->args[1].toInteger();
double count = value.length();
if (start < 0)
@@ -759,21 +759,21 @@ ReturnedValue StringPrototype::method_substr(CallContext *context)
qint32 x = Primitive::toInt32(start);
qint32 y = Primitive::toInt32(length);
- return context->engine->newString(value.mid(x, y))->asReturnedValue();
+ return context->d()->engine->newString(value.mid(x, y))->asReturnedValue();
}
ReturnedValue StringPrototype::method_substring(CallContext *context)
{
QString value = getThisString(context);
- if (context->engine->hasException)
+ if (context->d()->engine->hasException)
return Encode::undefined();
int length = value.length();
double start = 0;
double end = length;
- if (context->callData->argc > 0)
- start = context->callData->args[0].toInteger();
+ if (context->d()->callData->argc > 0)
+ start = context->d()->callData->args[0].toInteger();
Scope scope(context);
ScopedValue endValue(scope, context->argument(1));
@@ -800,15 +800,15 @@ ReturnedValue StringPrototype::method_substring(CallContext *context)
qint32 x = (int)start;
qint32 y = (int)(end - start);
- return context->engine->newString(value.mid(x, y))->asReturnedValue();
+ return context->d()->engine->newString(value.mid(x, y))->asReturnedValue();
}
ReturnedValue StringPrototype::method_toLowerCase(CallContext *ctx)
{
QString value = getThisString(ctx);
- if (ctx->engine->hasException)
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
- return ctx->engine->newString(value.toLower())->asReturnedValue();
+ return ctx->d()->engine->newString(value.toLower())->asReturnedValue();
}
ReturnedValue StringPrototype::method_toLocaleLowerCase(CallContext *ctx)
@@ -819,9 +819,9 @@ ReturnedValue StringPrototype::method_toLocaleLowerCase(CallContext *ctx)
ReturnedValue StringPrototype::method_toUpperCase(CallContext *ctx)
{
QString value = getThisString(ctx);
- if (ctx->engine->hasException)
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
- return ctx->engine->newString(value.toUpper())->asReturnedValue();
+ return ctx->d()->engine->newString(value.toUpper())->asReturnedValue();
}
ReturnedValue StringPrototype::method_toLocaleUpperCase(CallContext *ctx)
@@ -831,19 +831,19 @@ ReturnedValue StringPrototype::method_toLocaleUpperCase(CallContext *ctx)
ReturnedValue StringPrototype::method_fromCharCode(CallContext *context)
{
- QString str(context->callData->argc, Qt::Uninitialized);
+ QString str(context->d()->callData->argc, Qt::Uninitialized);
QChar *ch = str.data();
- for (int i = 0; i < context->callData->argc; ++i) {
- *ch = QChar(context->callData->args[i].toUInt16());
+ for (int i = 0; i < context->d()->callData->argc; ++i) {
+ *ch = QChar(context->d()->callData->args[i].toUInt16());
++ch;
}
- return context->engine->newString(str)->asReturnedValue();
+ return context->d()->engine->newString(str)->asReturnedValue();
}
ReturnedValue StringPrototype::method_trim(CallContext *ctx)
{
QString s = getThisString(ctx);
- if (ctx->engine->hasException)
+ if (ctx->d()->engine->hasException)
return Encode::undefined();
const QChar *chars = s.constData();
@@ -857,5 +857,5 @@ ReturnedValue StringPrototype::method_trim(CallContext *ctx)
break;
}
- return ctx->engine->newString(QString(chars + start, end - start + 1))->asReturnedValue();
+ return ctx->d()->engine->newString(QString(chars + start, end - start + 1))->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp
index 269a2b4b48..195c356cb9 100644
--- a/src/qml/jsruntime/qv4variantobject.cpp
+++ b/src/qml/jsruntime/qv4variantobject.cpp
@@ -151,7 +151,7 @@ void VariantPrototype::init()
QV4::ReturnedValue VariantPrototype::method_preserve(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<VariantObject> o(scope, ctx->callData->thisObject.as<QV4::VariantObject>());
+ Scoped<VariantObject> o(scope, ctx->d()->callData->thisObject.as<QV4::VariantObject>());
if (o && o->isScarce())
o->d()->node.remove();
return Encode::undefined();
@@ -160,7 +160,7 @@ QV4::ReturnedValue VariantPrototype::method_preserve(CallContext *ctx)
QV4::ReturnedValue VariantPrototype::method_destroy(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<VariantObject> o(scope, ctx->callData->thisObject.as<QV4::VariantObject>());
+ Scoped<VariantObject> o(scope, ctx->d()->callData->thisObject.as<QV4::VariantObject>());
if (o) {
if (o->isScarce())
o->d()->node.remove();
@@ -172,26 +172,26 @@ QV4::ReturnedValue VariantPrototype::method_destroy(CallContext *ctx)
QV4::ReturnedValue VariantPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<VariantObject> o(scope, ctx->callData->thisObject.as<QV4::VariantObject>());
+ Scoped<VariantObject> o(scope, ctx->d()->callData->thisObject.as<QV4::VariantObject>());
if (!o)
return Encode::undefined();
QString result = o->d()->data.toString();
if (result.isEmpty() && !o->d()->data.canConvert(QVariant::String))
result = QString::fromLatin1("QVariant(%0)").arg(QString::fromLatin1(o->d()->data.typeName()));
- return Encode(ctx->engine->newString(result));
+ return Encode(ctx->d()->engine->newString(result));
}
QV4::ReturnedValue VariantPrototype::method_valueOf(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<VariantObject> o(scope, ctx->callData->thisObject.as<QV4::VariantObject>());
+ Scoped<VariantObject> o(scope, ctx->d()->callData->thisObject.as<QV4::VariantObject>());
if (o) {
QVariant v = o->d()->data;
switch (v.type()) {
case QVariant::Invalid:
return Encode::undefined();
case QVariant::String:
- return Encode(ctx->engine->newString(v.toString()));
+ return Encode(ctx->d()->engine->newString(v.toString()));
case QVariant::Int:
return Encode(v.toInt());
case QVariant::Double:
@@ -203,7 +203,7 @@ QV4::ReturnedValue VariantPrototype::method_valueOf(CallContext *ctx)
break;
}
}
- return ctx->callData->thisObject.asReturnedValue();
+ return ctx->d()->callData->thisObject.asReturnedValue();
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 8e52ed5a96..99aba9c2bd 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -185,14 +185,14 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
const uchar *exceptionHandler = 0;
- context->lineNumber = -1;
- QV4::ExecutionEngine *engine = context->engine;
+ context->d()->lineNumber = -1;
+ QV4::ExecutionEngine *engine = context->d()->engine;
#ifdef DO_TRACE_INSTR
qDebug("Starting VME with context=%p and code=%p", context, code);
#endif // DO_TRACE_INSTR
- QV4::StringValue * const runtimeStrings = context->compilationUnit->runtimeStrings;
+ QV4::StringValue * const runtimeStrings = context->d()->compilationUnit->runtimeStrings;
// setup lookup scopes
int scopeDepth = 0;
@@ -200,28 +200,28 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
QV4::ExecutionContext *scope = context;
while (scope) {
++scopeDepth;
- scope = scope->outer;
+ scope = scope->d()->outer;
}
}
QV4::Value **scopes = static_cast<QV4::Value **>(alloca(sizeof(QV4::Value *)*(2 + 2*scopeDepth)));
{
- scopes[0] = const_cast<QV4::Value *>(context->compilationUnit->data->constants());
+ scopes[0] = const_cast<QV4::Value *>(context->d()->compilationUnit->data->constants());
// stack gets setup in push instruction
scopes[1] = 0;
QV4::ExecutionContext *scope = context;
int i = 0;
while (scope) {
- if (scope->type >= QV4::ExecutionContext::Type_SimpleCallContext) {
+ if (scope->d()->type >= QV4::ExecutionContext::Type_SimpleCallContext) {
QV4::CallContext *cc = static_cast<QV4::CallContext *>(scope);
- scopes[2*i + 2] = cc->callData->args;
+ scopes[2*i + 2] = cc->d()->callData->args;
scopes[2*i + 3] = cc->locals;
} else {
scopes[2*i + 2] = 0;
scopes[2*i + 3] = 0;
}
++i;
- scope = scope->outer;
+ scope = scope->d()->outer;
}
}
@@ -253,7 +253,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_BEGIN_INSTR(LoadRegExp)
// TRACE(value, "%s", instr.value.toString(context)->toQString().toUtf8().constData());
- VALUE(instr.result) = context->compilationUnit->runtimeRegularExpressions[instr.regExpId];
+ VALUE(instr.result) = context->d()->compilationUnit->runtimeRegularExpressions[instr.regExpId];
MOTH_END_INSTR(LoadRegExp)
MOTH_BEGIN_INSTR(LoadClosure)
@@ -267,7 +267,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_BEGIN_INSTR(GetGlobalLookup)
TRACE(inline, "property name = %s", runtimeStrings[instr.name]->toQString().toUtf8().constData());
- QV4::Lookup *l = context->lookups + instr.index;
+ QV4::Lookup *l = context->d()->lookups + instr.index;
STOREVALUE(instr.result, l->globalGetter(l, context));
MOTH_END_INSTR(GetGlobalLookup)
@@ -282,7 +282,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(LoadElement)
MOTH_BEGIN_INSTR(LoadElementLookup)
- QV4::Lookup *l = context->lookups + instr.lookup;
+ QV4::Lookup *l = context->d()->lookups + instr.lookup;
STOREVALUE(instr.result, l->indexedGetter(l, VALUEPTR(instr.base), VALUEPTR(instr.index)));
MOTH_END_INSTR(LoadElementLookup)
@@ -292,7 +292,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(StoreElement)
MOTH_BEGIN_INSTR(StoreElementLookup)
- QV4::Lookup *l = context->lookups + instr.lookup;
+ QV4::Lookup *l = context->d()->lookups + instr.lookup;
l->indexedSetter(l, VALUEPTR(instr.base), VALUEPTR(instr.index), VALUEPTR(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreElementLookup)
@@ -302,7 +302,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(LoadProperty)
MOTH_BEGIN_INSTR(GetLookup)
- QV4::Lookup *l = context->lookups + instr.index;
+ QV4::Lookup *l = context->d()->lookups + instr.index;
STOREVALUE(instr.result, l->getter(l, VALUEPTR(instr.base)));
MOTH_END_INSTR(GetLookup)
@@ -312,7 +312,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(StoreProperty)
MOTH_BEGIN_INSTR(SetLookup)
- QV4::Lookup *l = context->lookups + instr.index;
+ QV4::Lookup *l = context->d()->lookups + instr.index;
l->setter(l, VALUEPTR(instr.base), VALUEPTR(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(SetLookup)
@@ -333,7 +333,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_BEGIN_INSTR(Push)
TRACE(inline, "stack size: %u", instr.value);
stackSize = instr.value;
- stack = context->engine->stackPush(stackSize);
+ stack = context->engine()->stackPush(stackSize);
#ifndef QT_NO_DEBUG
memset(stack, 0, stackSize * sizeof(QV4::Value));
#endif
@@ -342,7 +342,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_BEGIN_INSTR(CallValue)
#if 0 //def DO_TRACE_INSTR
- if (Debugging::Debugger *debugger = context->engine->debugger) {
+ if (Debugging::Debugger *debugger = context->engine()->debugger) {
if (QV4::FunctionObject *o = (VALUE(instr.dest)).asFunctionObject()) {
if (Debugging::FunctionDebugInfo *info = debugger->debugInfo(o)) {
QString n = debugger->name(o);
@@ -655,24 +655,24 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(BinopContext)
MOTH_BEGIN_INSTR(Ret)
- context->engine->stackPop(stackSize);
+ context->engine()->stackPop(stackSize);
// TRACE(Ret, "returning value %s", result.toString(context)->toQString().toUtf8().constData());
return VALUE(instr.result).asReturnedValue();
MOTH_END_INSTR(Ret)
MOTH_BEGIN_INSTR(Debug)
- context->lineNumber = instr.lineNumber;
- QV4::Debugging::Debugger *debugger = context->engine->debugger;
+ context->d()->lineNumber = instr.lineNumber;
+ QV4::Debugging::Debugger *debugger = context->engine()->debugger;
if (debugger && debugger->pauseAtNextOpportunity())
debugger->maybeBreakAtInstruction();
MOTH_END_INSTR(Debug)
MOTH_BEGIN_INSTR(Line)
- context->lineNumber = instr.lineNumber;
+ context->d()->lineNumber = instr.lineNumber;
MOTH_END_INSTR(Debug)
MOTH_BEGIN_INSTR(LoadThis)
- VALUE(instr.result) = context->callData->thisObject;
+ VALUE(instr.result) = context->d()->callData->thisObject;
MOTH_END_INSTR(LoadThis)
MOTH_BEGIN_INSTR(LoadQmlIdArray)
@@ -706,9 +706,9 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
Q_ASSERT(false);
catchException:
- Q_ASSERT(context->engine->hasException);
+ Q_ASSERT(context->engine()->hasException);
if (!exceptionHandler) {
- context->engine->stackPop(stackSize);
+ context->engine()->stackPop(stackSize);
return QV4::Encode::undefined();
}
code = exceptionHandler;
@@ -732,7 +732,7 @@ void **VME::instructionJumpTable()
QV4::ReturnedValue VME::exec(QV4::ExecutionContext *ctxt, const uchar *code)
{
VME vme;
- QV4::Debugging::Debugger *debugger = ctxt->engine->debugger;
+ QV4::Debugging::Debugger *debugger = ctxt->engine()->debugger;
if (debugger)
debugger->enteringFunction();
QV4::ReturnedValue retVal = vme.run(ctxt, code);