aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp8
-rw-r--r--src/qml/jsruntime/qv4mm_p.h3
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp47
-rw-r--r--src/qml/jsruntime/qv4objectproto_p.h4
4 files changed, 28 insertions, 34 deletions
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index b3c295ed87..dde1d6c39e 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -112,8 +112,7 @@ ReturnedValue Lookup::indexedGetterGeneric(Lookup *l, const ValueRef object, con
ReturnedValue Lookup::indexedGetterFallback(Lookup *l, const ValueRef object, const ValueRef index)
{
Q_UNUSED(l);
- ExecutionContext *ctx = l->engine->currentContext();
- Scope scope(ctx);
+ Scope scope(l->engine);
uint idx = index->asArrayIndex();
Scoped<Object> o(scope, object);
@@ -130,7 +129,7 @@ ReturnedValue Lookup::indexedGetterFallback(Lookup *l, const ValueRef object, co
if (object->isNullOrUndefined()) {
QString message = QStringLiteral("Cannot read property '%1' of %2").arg(index->toQStringNoThrow()).arg(object->toQStringNoThrow());
- return ctx->engine()->throwTypeError(message);
+ return l->engine->throwTypeError(message);
}
o = RuntimeHelpers::convertToObject(scope.engine, object);
@@ -188,8 +187,7 @@ void Lookup::indexedSetterGeneric(Lookup *l, const ValueRef object, const ValueR
void Lookup::indexedSetterFallback(Lookup *l, const ValueRef object, const ValueRef index, const ValueRef value)
{
- ExecutionContext *ctx = l->engine->currentContext();
- Scope scope(ctx);
+ Scope scope(l->engine);
ScopedObject o(scope, object->toObject(scope.engine));
if (scope.engine->hasException)
return;
diff --git a/src/qml/jsruntime/qv4mm_p.h b/src/qml/jsruntime/qv4mm_p.h
index ddee32116c..57c6870842 100644
--- a/src/qml/jsruntime/qv4mm_p.h
+++ b/src/qml/jsruntime/qv4mm_p.h
@@ -44,9 +44,6 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
-struct ExecutionEngine;
-struct ExecutionContext;
-struct Managed;
struct GCDeletable;
class Q_QML_EXPORT MemoryManager
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index a23be99b0a..585c773c6b 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -140,7 +140,7 @@ ReturnedValue ObjectPrototype::method_getOwnPropertyDescriptor(CallContext *ctx)
return Encode::undefined();
PropertyAttributes attrs;
Property *desc = O->__getOwnProperty__(name.getPointer(), &attrs);
- return fromPropertyDescriptor(ctx, desc, attrs);
+ return fromPropertyDescriptor(scope.engine, desc, attrs);
}
ReturnedValue ObjectPrototype::method_getOwnPropertyNames(CallContext *context)
@@ -186,7 +186,7 @@ ReturnedValue ObjectPrototype::method_defineProperty(CallContext *ctx)
ScopedValue attributes(scope, ctx->argument(2));
Property pd;
PropertyAttributes attrs;
- toPropertyDescriptor(ctx, attributes, &pd, &attrs);
+ toPropertyDescriptor(scope.engine, attributes, &pd, &attrs);
if (scope.engine->hasException)
return Encode::undefined();
@@ -222,7 +222,7 @@ ReturnedValue ObjectPrototype::method_defineProperties(CallContext *ctx)
Property n;
PropertyAttributes nattrs;
val = o->getValue(&pd, attrs);
- toPropertyDescriptor(ctx, val, &n, &nattrs);
+ toPropertyDescriptor(scope.engine, val, &n, &nattrs);
if (scope.engine->hasException)
return Encode::undefined();
bool ok;
@@ -563,12 +563,12 @@ ReturnedValue ObjectPrototype::method_set_proto(CallContext *ctx)
return Encode::undefined();
}
-void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, const ValueRef v, Property *desc, PropertyAttributes *attrs)
+void ObjectPrototype::toPropertyDescriptor(ExecutionEngine *engine, const ValueRef v, Property *desc, PropertyAttributes *attrs)
{
- Scope scope(ctx);
+ Scope scope(engine);
ScopedObject o(scope, v);
if (!o) {
- ctx->engine()->throwTypeError();
+ engine->throwTypeError();
return;
}
@@ -577,52 +577,52 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, const ValueRef
desc->set = Primitive::emptyValue();
ScopedValue tmp(scope);
- if (o->hasProperty(ctx->d()->engine->id_enumerable))
- attrs->setEnumerable((tmp = o->get(ctx->d()->engine->id_enumerable))->toBoolean());
+ if (o->hasProperty(engine->id_enumerable))
+ attrs->setEnumerable((tmp = o->get(engine->id_enumerable))->toBoolean());
- if (o->hasProperty(ctx->d()->engine->id_configurable))
- attrs->setConfigurable((tmp = o->get(ctx->d()->engine->id_configurable))->toBoolean());
+ if (o->hasProperty(engine->id_configurable))
+ attrs->setConfigurable((tmp = o->get(engine->id_configurable))->toBoolean());
- if (o->hasProperty(ctx->d()->engine->id_get)) {
- ScopedValue get(scope, o->get(ctx->d()->engine->id_get));
+ if (o->hasProperty(engine->id_get)) {
+ ScopedValue get(scope, o->get(engine->id_get));
FunctionObject *f = get->asFunctionObject();
if (f || get->isUndefined()) {
desc->value = get;
} else {
- ctx->engine()->throwTypeError();
+ engine->throwTypeError();
return;
}
attrs->setType(PropertyAttributes::Accessor);
}
- if (o->hasProperty(ctx->d()->engine->id_set)) {
- ScopedValue set(scope, o->get(ctx->d()->engine->id_set));
+ if (o->hasProperty(engine->id_set)) {
+ ScopedValue set(scope, o->get(engine->id_set));
FunctionObject *f = set->asFunctionObject();
if (f || set->isUndefined()) {
desc->set = set;
} else {
- ctx->engine()->throwTypeError();
+ engine->throwTypeError();
return;
}
attrs->setType(PropertyAttributes::Accessor);
}
- if (o->hasProperty(ctx->d()->engine->id_writable)) {
+ if (o->hasProperty(engine->id_writable)) {
if (attrs->isAccessor()) {
- ctx->engine()->throwTypeError();
+ engine->throwTypeError();
return;
}
- attrs->setWritable((tmp = o->get(ctx->d()->engine->id_writable))->toBoolean());
+ attrs->setWritable((tmp = o->get(engine->id_writable))->toBoolean());
// writable forces it to be a data descriptor
desc->value = Primitive::undefinedValue();
}
- if (o->hasProperty(ctx->d()->engine->id_value)) {
+ if (o->hasProperty(engine->id_value)) {
if (attrs->isAccessor()) {
- ctx->engine()->throwTypeError();
+ engine->throwTypeError();
return;
}
- desc->value = o->get(ctx->d()->engine->id_value);
+ desc->value = o->get(engine->id_value);
attrs->setType(PropertyAttributes::Data);
}
@@ -631,12 +631,11 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, const ValueRef
}
-ReturnedValue ObjectPrototype::fromPropertyDescriptor(ExecutionContext *ctx, const Property *desc, PropertyAttributes attrs)
+ReturnedValue ObjectPrototype::fromPropertyDescriptor(ExecutionEngine *engine, const Property *desc, PropertyAttributes attrs)
{
if (!desc)
return Encode::undefined();
- 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/qv4objectproto_p.h b/src/qml/jsruntime/qv4objectproto_p.h
index e58ef10492..4bbcb297be 100644
--- a/src/qml/jsruntime/qv4objectproto_p.h
+++ b/src/qml/jsruntime/qv4objectproto_p.h
@@ -88,8 +88,8 @@ struct ObjectPrototype: Object
static ReturnedValue method_get_proto(CallContext *ctx);
static ReturnedValue method_set_proto(CallContext *ctx);
- static void toPropertyDescriptor(ExecutionContext *ctx, const ValueRef v, Property *desc, PropertyAttributes *attrs);
- static ReturnedValue fromPropertyDescriptor(ExecutionContext *ctx, const Property *desc, PropertyAttributes attrs);
+ static void toPropertyDescriptor(ExecutionEngine *engine, const ValueRef v, Property *desc, PropertyAttributes *attrs);
+ static ReturnedValue fromPropertyDescriptor(ExecutionEngine *engine, const Property *desc, PropertyAttributes attrs);
static Heap::ArrayObject *getOwnPropertyNames(ExecutionEngine *v4, const ValueRef o);
};