Remove context parameter from Managed::get()
authorLars Knoll <lars.knoll@digia.com>
Fri, 21 Jun 2013 21:26:11 +0000 (23:26 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Sat, 22 Jun 2013 19:32:34 +0000 (21:32 +0200)
Change-Id: I61837e4b17d7475dcda2f31b8a293c0020930d52
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
32 files changed:
src/qml/qml/qqmlcontextwrapper.cpp
src/qml/qml/qqmlcontextwrapper_p.h
src/qml/qml/qqmllistwrapper.cpp
src/qml/qml/qqmllistwrapper_p.h
src/qml/qml/qqmltypewrapper.cpp
src/qml/qml/qqmltypewrapper_p.h
src/qml/qml/qqmlvaluetypewrapper.cpp
src/qml/qml/qqmlvaluetypewrapper_p.h
src/qml/qml/qqmlxmlhttprequest.cpp
src/qml/qml/v4/qv4arrayobject.cpp
src/qml/qml/v4/qv4context.cpp
src/qml/qml/v4/qv4dateobject.cpp
src/qml/qml/v4/qv4errorobject.cpp
src/qml/qml/v4/qv4functionobject.cpp
src/qml/qml/v4/qv4jsonobject.cpp
src/qml/qml/v4/qv4lookup.cpp
src/qml/qml/v4/qv4managed.cpp
src/qml/qml/v4/qv4managed_p.h
src/qml/qml/v4/qv4object.cpp
src/qml/qml/v4/qv4object_p.h
src/qml/qml/v4/qv4objectproto.cpp
src/qml/qml/v4/qv4qobjectwrapper.cpp
src/qml/qml/v4/qv4qobjectwrapper_p.h
src/qml/qml/v4/qv4regexp.cpp
src/qml/qml/v4/qv4regexp_p.h
src/qml/qml/v4/qv4runtime.cpp
src/qml/qml/v4/qv4string.cpp
src/qml/qml/v4/qv4string_p.h
src/qml/qml/v4/qv4stringobject.cpp
src/qml/qml/v4/qv4value.cpp
src/qml/qml/v8/qjsvalue.cpp
src/qml/types/qqmldelegatemodel.cpp

index 6bdcda9..2413ebe 100644 (file)
@@ -126,17 +126,18 @@ void QmlContextWrapper::takeContextOwnership(const Value &qmlglobal)
 }
 
 
-Value QmlContextWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty)
+Value QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty)
 {
     QmlContextWrapper *resource = m->as<QmlContextWrapper>();
+    QV4::ExecutionEngine *v4 = m->engine();
     if (!resource)
-        ctx->throwTypeError();
+        v4->current->throwTypeError();
 
     if (resource->isNullWrapper)
-        return Object::get(m, ctx, name, hasProperty);
+        return Object::get(m, name, hasProperty);
 
     bool hasProp;
-    Value result = Object::get(m, ctx, name, &hasProp);
+    Value result = Object::get(m, name, &hasProp);
     if (hasProp) {
         if (hasProperty)
             *hasProperty = hasProp;
@@ -206,7 +207,7 @@ Value QmlContextWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bo
                     ep->captureProperty(&context->idValues[propertyIdx].bindings);
                     if (hasProperty)
                         *hasProperty = true;
-                    return QV4::QObjectWrapper::wrap(ctx->engine, context->idValues[propertyIdx]);
+                    return QV4::QObjectWrapper::wrap(v4, context->idValues[propertyIdx]);
                 } else {
 
                     QQmlContextPrivate *cp = context->asQQmlContextPrivate();
@@ -232,7 +233,7 @@ Value QmlContextWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bo
         // Search scope object
         if (scopeObject) {
             bool hasProp = false;
-            QV4::Value result = QV4::QObjectWrapper::getQmlProperty(ctx, context, scopeObject, name, QV4::QObjectWrapper::CheckRevision, &hasProp);
+            QV4::Value result = QV4::QObjectWrapper::getQmlProperty(v4->current, context, scopeObject, name, QV4::QObjectWrapper::CheckRevision, &hasProp);
             if (hasProp) {
                 if (hasProperty)
                     *hasProperty = true;
@@ -245,7 +246,7 @@ Value QmlContextWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bo
         // Search context object
         if (context->contextObject) {
             bool hasProp = false;
-            QV4::Value result = QV4::QObjectWrapper::getQmlProperty(ctx, context, context->contextObject, name, QV4::QObjectWrapper::CheckRevision, &hasProp);
+            QV4::Value result = QV4::QObjectWrapper::getQmlProperty(v4->current, context, context->contextObject, name, QV4::QObjectWrapper::CheckRevision, &hasProp);
             if (hasProp) {
                 if (hasProperty)
                     *hasProperty = true;
index 1ef8f74..dab10c0 100644 (file)
@@ -82,7 +82,7 @@ struct Q_QML_EXPORT QmlContextWrapper : Object
 
     void setReadOnly(bool b) { readOnly = b; }
 
-    static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
+    static Value get(Managed *m, String *name, bool *hasProperty);
     static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
     static void destroy(Managed *that);
 
index 639a5a5..aba6b6c 100644 (file)
@@ -97,13 +97,14 @@ QVariant QmlListWrapper::toVariant() const
 }
 
 
-Value QmlListWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty)
+Value QmlListWrapper::get(Managed *m, String *name, bool *hasProperty)
 {
+    QV4::ExecutionEngine *v4 = m->engine();
     QmlListWrapper *w = m->as<QmlListWrapper>();
     if (!w)
-        ctx->throwTypeError();
+        v4->current->throwTypeError();
 
-    if (name == ctx->engine->id_length && !w->object.isNull()) {
+    if (name == v4->id_length && !w->object.isNull()) {
         quint32 count = w->property.count ? w->property.count(&w->property) : 0;
         return Value::fromUInt32(count);
     }
index 8c52b79..3d0a831 100644 (file)
@@ -80,7 +80,7 @@ public:
 
     QVariant toVariant() const;
 
-    static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
+    static Value get(Managed *m, String *name, bool *hasProperty);
     static Value getIndexed(Managed *m, uint index, bool *hasProperty);
     static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
     static Property *advanceIterator(Managed *m, ObjectIterator *it, String **name, uint *index, PropertyAttributes *attributes);
index a41e3c4..aa03b0e 100644 (file)
@@ -114,11 +114,12 @@ Value QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlTypeNameCache *t, co
 }
 
 
-Value QmlTypeWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty)
+Value QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
 {
     QmlTypeWrapper *w = m->as<QmlTypeWrapper>();
+    QV4::ExecutionEngine *v4 = m->engine();
     if (!w)
-        ctx->throwTypeError();
+        v4->current->throwTypeError();
 
     if (hasProperty)
         *hasProperty = true;
@@ -158,13 +159,13 @@ Value QmlTypeWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool
                 }
 
                 // check for property.
-                return QV4::QObjectWrapper::getQmlProperty(ctx, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision);
+                return QV4::QObjectWrapper::getQmlProperty(v4->current, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision);
             } else if (!siinfo->scriptApi(e).isUndefined()) {
                 QV4::ExecutionEngine *engine = QV8Engine::getV4(v8engine);
                 // NOTE: if used in a binding, changes will not trigger re-evaluation since non-NOTIFYable.
                 QV4::Object *o = QJSValuePrivate::get(siinfo->scriptApi(e))->getValue(engine).asObject();
                 if (o)
-                    return o->get(engine->current, name);
+                    return o->get(name);
             }
 
             // Fall through to base implementation
@@ -182,7 +183,7 @@ Value QmlTypeWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool
             } else if (w->object) {
                 QObject *ao = qmlAttachedPropertiesObjectById(type->attachedPropertiesId(), object);
                 if (ao)
-                    return QV4::QObjectWrapper::getQmlProperty(ctx, context, ao, name, QV4::QObjectWrapper::IgnoreRevision);
+                    return QV4::QObjectWrapper::getQmlProperty(v4->current, context, ao, name, QV4::QObjectWrapper::IgnoreRevision);
 
                 // Fall through to base implementation
             }
@@ -221,7 +222,7 @@ Value QmlTypeWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool
 
     if (hasProperty)
         *hasProperty = false;
-    return Object::get(m, ctx, name, hasProperty);
+    return Object::get(m, name, hasProperty);
 }
 
 
index c81b4cc..511406d 100644 (file)
@@ -82,7 +82,7 @@ public:
     static QV4::Value create(QV8Engine *, QObject *, QQmlTypeNameCache *, const void *, TypeNameMode = IncludeEnums);
 
 
-    static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
+    static Value get(Managed *m, String *name, bool *hasProperty);
     static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
     static void destroy(Managed *that);
 
index aaa7db2..268cdb3 100644 (file)
@@ -244,11 +244,12 @@ Value QmlValueTypeWrapper::method_toString(SimpleCallContext *ctx)
     }
 }
 
-Value QmlValueTypeWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty)
+Value QmlValueTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
 {
     QmlValueTypeWrapper *r = m->as<QmlValueTypeWrapper>();
+    QV4::ExecutionEngine *v4 = m->engine();
     if (!r)
-        ctx->throwTypeError();
+        v4->current->throwTypeError();
 
     QHashedV4String propertystring(Value::fromString(name));
 
@@ -278,12 +279,12 @@ Value QmlValueTypeWrapper::get(Managed *m, ExecutionContext *ctx, String *name,
     }
 
     if (!result)
-        return Object::get(m, ctx, name, hasProperty);
+        return Object::get(m, name, hasProperty);
 
     if (result->isFunction()) {
         // calling a Q_INVOKABLE function of a value type
-        QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(ctx->engine);
-        return QV4::QObjectWrapper::getQmlProperty(ctx, qmlContext, r->type, name, QV4::QObjectWrapper::IgnoreRevision);
+        QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(v4);
+        return QV4::QObjectWrapper::getQmlProperty(v4->current, qmlContext, r->type, name, QV4::QObjectWrapper::IgnoreRevision);
     }
 
 #define VALUE_TYPE_LOAD(metatype, cpptype, constructor) \
index ccf4fd3..d36fc80 100644 (file)
@@ -83,7 +83,7 @@ public:
     bool isEqual(const QVariant& value);
 
 
-    static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
+    static Value get(Managed *m, String *name, bool *hasProperty);
     static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
     static void destroy(Managed *that);
     static bool isEqualTo(Managed *m, Managed *other);
index 0300817..8b6471f 100644 (file)
@@ -203,7 +203,7 @@ public:
     static void destroy(Managed *that) {
         that->as<NamedNodeMap>()->~NamedNodeMap();
     }
-    static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
+    static Value get(Managed *m, String *name, bool *hasProperty);
     static Value getIndexed(Managed *m, uint index, bool *hasProperty);
 
     QList<NodeImpl *> list; // Only used in NamedNodeMap
@@ -234,7 +234,7 @@ public:
     static void destroy(Managed *that) {
         that->as<NodeList>()->~NodeList();
     }
-    static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
+    static Value get(Managed *m, String *name, bool *hasProperty);
     static Value getIndexed(Managed *m, uint index, bool *hasProperty);
 
     // C++ API
@@ -861,17 +861,18 @@ Value NamedNodeMap::getIndexed(Managed *m, uint index, bool *hasProperty)
     return Value::undefinedValue();
 }
 
-Value NamedNodeMap::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty)
+Value NamedNodeMap::get(Managed *m, String *name, bool *hasProperty)
 {
     NamedNodeMap *r = m->as<NamedNodeMap>();
+    QV4::ExecutionEngine *v4 = m->engine();
     if (!r)
-        ctx->throwTypeError();
+        v4->current->throwTypeError();
 
-    name->makeIdentifier(ctx);
-    if (name->isEqualTo(ctx->engine->id_length))
+    name->makeIdentifier(v4->current);
+    if (name->isEqualTo(v4->id_length))
         return Value::fromInt32(r->list.count());
 
-    QV8Engine *engine = ctx->engine->v8Engine;
+    QV8Engine *engine = v4->v8Engine;
 
     QString str = name->toQString();
     for (int ii = 0; ii < r->list.count(); ++ii) {
@@ -915,17 +916,18 @@ Value NodeList::getIndexed(Managed *m, uint index, bool *hasProperty)
     return Value::undefinedValue();
 }
 
-Value NodeList::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty)
+Value NodeList::get(Managed *m, String *name, bool *hasProperty)
 {
+    QV4::ExecutionEngine *v4 = m->engine();
     NodeList *r = m->as<NodeList>();
     if (!r)
-        ctx->throwTypeError();
+        v4->current->throwTypeError();
 
-    name->makeIdentifier(ctx);
+    name->makeIdentifier(v4->current);
 
-    if (name->isEqualTo(ctx->engine->id_length))
+    if (name->isEqualTo(v4->id_length))
         return Value::fromInt32(r->d->children.count());
-    return Object::get(m, ctx, name, hasProperty);
+    return Object::get(m, name, hasProperty);
 }
 
 Value NodeList::create(QV8Engine *engine, NodeImpl *data)
index 3b1d223..5263048 100644 (file)
@@ -120,7 +120,7 @@ uint ArrayPrototype::getLength(ExecutionContext *ctx, Object *o)
 {
     if (o->isArrayObject())
         return o->arrayLength();
-    return o->get(ctx, ctx->engine->id_length).toUInt32();
+    return o->get(ctx->engine->id_length).toUInt32();
 }
 
 Value ArrayPrototype::method_isArray(SimpleCallContext *ctx)
@@ -387,7 +387,7 @@ Value ArrayPrototype::method_slice(SimpleCallContext *ctx)
     Object *o = ctx->thisObject.toObject(ctx);
 
     ArrayObject *result = ctx->engine->newArrayObject();
-    uint len = o->get(ctx, ctx->engine->id_length).toUInt32();
+    uint len = o->get(ctx->engine->id_length).toUInt32();
     double s = ctx->argument(0).toInteger();
     uint start;
     if (s < 0)
index 5d4d941..88dc30b 100644 (file)
@@ -362,7 +362,7 @@ Value ExecutionContext::getProperty(String *name)
             Object *w = static_cast<WithContext *>(ctx)->withObject;
             hasWith = true;
             bool hasProperty = false;
-            Value v = w->get(ctx, name, &hasProperty);
+            Value v = w->get(name, &hasProperty);
             if (hasProperty) {
                 return v;
             }
@@ -389,7 +389,7 @@ Value ExecutionContext::getProperty(String *name)
             }
             if (c->activation) {
                 bool hasProperty = false;
-                Value v = c->activation->get(c, name, &hasProperty);
+                Value v = c->activation->get(name, &hasProperty);
                 if (hasProperty)
                     return v;
             }
@@ -401,7 +401,7 @@ Value ExecutionContext::getProperty(String *name)
         else if (ctx->type == Type_GlobalContext) {
             GlobalContext *g = static_cast<GlobalContext *>(ctx);
             bool hasProperty = false;
-            Value v = g->global->get(g, name, &hasProperty);
+            Value v = g->global->get(name, &hasProperty);
             if (hasProperty)
                 return v;
         }
@@ -424,7 +424,7 @@ Value ExecutionContext::getPropertyNoThrow(String *name)
             Object *w = static_cast<WithContext *>(ctx)->withObject;
             hasWith = true;
             bool hasProperty = false;
-            Value v = w->get(ctx, name, &hasProperty);
+            Value v = w->get(name, &hasProperty);
             if (hasProperty) {
                 return v;
             }
@@ -451,7 +451,7 @@ Value ExecutionContext::getPropertyNoThrow(String *name)
             }
             if (c->activation) {
                 bool hasProperty = false;
-                Value v = c->activation->get(c, name, &hasProperty);
+                Value v = c->activation->get(name, &hasProperty);
                 if (hasProperty)
                     return v;
             }
@@ -463,7 +463,7 @@ Value ExecutionContext::getPropertyNoThrow(String *name)
         else if (ctx->type == Type_GlobalContext) {
             GlobalContext *g = static_cast<GlobalContext *>(ctx);
             bool hasProperty = false;
-            Value v = g->global->get(g, name, &hasProperty);
+            Value v = g->global->get(name, &hasProperty);
             if (hasProperty)
                 return v;
         }
@@ -486,7 +486,7 @@ Value ExecutionContext::getPropertyAndBase(String *name, Object **base)
             Object *w = static_cast<WithContext *>(ctx)->withObject;
             hasWith = true;
             bool hasProperty = false;
-            Value v = w->get(ctx, name, &hasProperty);
+            Value v = w->get(name, &hasProperty);
             if (hasProperty) {
                 *base = w;
                 return v;
@@ -514,7 +514,7 @@ Value ExecutionContext::getPropertyAndBase(String *name, Object **base)
             }
             if (c->activation) {
                 bool hasProperty = false;
-                Value v = c->activation->get(c, name, &hasProperty);
+                Value v = c->activation->get(name, &hasProperty);
                 if (hasProperty) {
                     *base = c->activation;
                     return v;
@@ -528,7 +528,7 @@ Value ExecutionContext::getPropertyAndBase(String *name, Object **base)
         else if (ctx->type == Type_GlobalContext) {
             GlobalContext *g = static_cast<GlobalContext *>(ctx);
             bool hasProperty = false;
-            Value v = g->global->get(g, name, &hasProperty);
+            Value v = g->global->get(name, &hasProperty);
             if (hasProperty)
                 return v;
         }
index 6e5112c..83fdc2f 100644 (file)
@@ -1301,7 +1301,7 @@ Value DatePrototype::method_toJSON(SimpleCallContext *ctx)
     if (tv.isNumber() && !std::isfinite(tv.toNumber()))
         return Value::nullValue();
 
-    FunctionObject *toIso = O.objectValue()->get(ctx, ctx->engine->newString(QStringLiteral("toISOString"))).asFunctionObject();
+    FunctionObject *toIso = O.objectValue()->get(ctx->engine->newString(QStringLiteral("toISOString"))).asFunctionObject();
 
     if (!toIso)
         ctx->throwTypeError();
index 6df3ffe..ffd3058 100644 (file)
@@ -326,14 +326,14 @@ Value ErrorPrototype::method_toString(SimpleCallContext *ctx)
     if (!o)
         ctx->throwTypeError();
 
-    Value name = o->get(ctx, ctx->engine->newString(QString::fromLatin1("name")));
+    Value name = o->get(ctx->engine->newString(QString::fromLatin1("name")));
     QString qname;
     if (name.isUndefined())
         qname = QString::fromLatin1("Error");
     else
         qname = __qmljs_to_string(name, ctx).stringValue()->toQString();
 
-    Value message = o->get(ctx, ctx->engine->newString(QString::fromLatin1("message")));
+    Value message = o->get(ctx->engine->newString(QString::fromLatin1("message")));
     QString qmessage;
     if (!message.isUndefined())
         qmessage = __qmljs_to_string(message, ctx).stringValue()->toQString();
index 5363be6..a27ac16 100644 (file)
@@ -106,7 +106,7 @@ bool FunctionObject::hasInstance(Managed *that, const Value &value)
         return false;
 
     ExecutionContext *ctx = f->engine()->current;
-    Object *o = f->get(ctx, ctx->engine->id_prototype).asObject();
+    Object *o = f->get(ctx->engine->id_prototype).asObject();
     if (!o)
         ctx->throwTypeError();
 
@@ -127,7 +127,7 @@ Value FunctionObject::construct(Managed *that, ExecutionContext *context, Value
     FunctionObject *f = static_cast<FunctionObject *>(that);
 
     Object *obj = context->engine->newObject();
-    Value proto = f->get(context, context->engine->id_prototype);
+    Value proto = f->get(context->engine->id_prototype);
     if (proto.isObject())
         obj->prototype = proto.objectValue();
     return Value::fromObject(obj);
@@ -251,7 +251,7 @@ Value FunctionPrototype::method_apply(SimpleCallContext *ctx)
     QVector<Value> args;
 
     if (Object *arr = arg.asObject()) {
-        quint32 len = arr->get(ctx, ctx->engine->id_length).toUInt32();
+        quint32 len = arr->get(ctx->engine->id_length).toUInt32();
         for (quint32 i = 0; i < len; ++i) {
             Value a = arr->getIndexed(i);
             args.append(a);
@@ -351,7 +351,7 @@ Value ScriptFunction::construct(Managed *that, ExecutionContext *context, Value
     ScriptFunction *f = static_cast<ScriptFunction *>(that);
     assert(f->function->code);
     Object *obj = context->engine->newObject();
-    Value proto = f->get(context, context->engine->id_prototype);
+    Value proto = f->get(context->engine->id_prototype);
     if (proto.isObject())
         obj->prototype = proto.objectValue();
 
@@ -490,7 +490,7 @@ BoundFunction::BoundFunction(ExecutionContext *scope, FunctionObject *target, Va
     , boundArgs(boundArgs)
 {
     vtbl = &static_vtbl;
-    int len = target->get(scope, scope->engine->id_length).toUInt32();
+    int len = target->get(scope->engine->id_length).toUInt32();
     len -= boundArgs.size();
     if (len < 0)
         len = 0;
index 79e746f..57b241f 100644 (file)
@@ -700,7 +700,7 @@ QString Stringify::Str(const QString &key, Value value)
     QString result;
 
     if (Object *o = value.asObject()) {
-        FunctionObject *toJSON = o->get(ctx, ctx->engine->newString(QStringLiteral("toJSON"))).asFunctionObject();
+        FunctionObject *toJSON = o->get(ctx->engine->newString(QStringLiteral("toJSON"))).asFunctionObject();
         if (toJSON) {
             Value arg = Value::fromString(ctx, key);
             value = toJSON->call(ctx, value, &arg, 1);
@@ -790,7 +790,7 @@ QString Stringify::JO(Object *o)
     } else {
         for (int i = 0; i < propertyList.size(); ++i) {
             bool exists;
-            Value v = o->get(ctx, propertyList.at(i), &exists);
+            Value v = o->get(propertyList.at(i), &exists);
             if (!exists)
                 continue;
             QString member = makeMember(propertyList.at(i)->toQString(), v);
index 2292908..b462777 100644 (file)
@@ -95,11 +95,11 @@ void Lookup::getterGeneric(QV4::Lookup *l, QV4::Value *result, const QV4::Value
 
     Value res;
     if (Managed *m = object.asManaged()) {
-        res = m->get(m->engine()->current, l->name);
+        res = m->get(l->name);
     } else {
         ExecutionContext *ctx = l->name->engine()->current;
         Object *o = __qmljs_convert_to_object(ctx, object);
-        res = o->get(ctx, l->name);
+        res = o->get(l->name);
     }
     if (result)
         *result = res;
index 5d2e856..6372719 100644 (file)
@@ -201,9 +201,9 @@ bool Managed::isEqualTo(Managed *, Managed *)
     return false;
 }
 
-Value Managed::get(ExecutionContext *ctx, String *name, bool *hasProperty)
+Value Managed::get(String *name, bool *hasProperty)
 {
-    return vtbl->get(this, ctx, name, hasProperty);
+    return vtbl->get(this, name, hasProperty);
 }
 
 Value Managed::getIndexed(uint index, bool *hasProperty)
index ad1d051..4a8410c 100644 (file)
@@ -105,7 +105,7 @@ struct ManagedVTable
     void (*destroy)(Managed *);
     void (*collectDeletables)(Managed *, GCDeletable **deletable);
     bool (*hasInstance)(Managed *, const Value &value);
-    Value (*get)(Managed *, ExecutionContext *ctx, String *name, bool *hasProperty);
+    Value (*get)(Managed *, String *name, bool *hasProperty);
     Value (*getIndexed)(Managed *, uint index, bool *hasProperty);
     void (*put)(Managed *, ExecutionContext *ctx, String *name, const Value &value);
     void (*putIndexed)(Managed *, ExecutionContext *ctx, uint index, const Value &value);
@@ -262,7 +262,7 @@ public:
     }
     Value construct(ExecutionContext *context, Value *args, int argc);
     Value call(ExecutionContext *context, const Value &thisObject, Value *args, int argc);
-    Value get(ExecutionContext *ctx, String *name, bool *hasProperty = 0);
+    Value get(String *name, bool *hasProperty = 0);
     Value getIndexed(uint index, bool *hasProperty = 0);
     void put(ExecutionContext *ctx, String *name, const Value &value)
     { vtbl->put(this, ctx, name, value); }
index 085d907..18bea21 100644 (file)
@@ -168,7 +168,7 @@ void Object::putValue(ExecutionContext *ctx, Property *pd, PropertyAttributes at
 
 void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, String *name, const Value &rhs)
 {
-    Value v = get(ctx, name);
+    Value v = get(name);
     Value result;
     op(ctx, &result, v, rhs);
     put(ctx, name, result);
@@ -394,9 +394,9 @@ bool Object::__hasProperty__(String *name) const
     return !query(name).isEmpty();
 }
 
-Value Object::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty)
+Value Object::get(Managed *m, String *name, bool *hasProperty)
 {
-    return static_cast<Object *>(m)->internalGet(ctx, name, hasProperty);
+    return static_cast<Object *>(m)->internalGet(name, hasProperty);
 }
 
 Value Object::getIndexed(Managed *m, uint index, bool *hasProperty)
@@ -582,13 +582,13 @@ Property *Object::advanceIterator(Managed *m, ObjectIterator *it, String **name,
 }
 
 // Section 8.12.3
-Value Object::internalGet(ExecutionContext *ctx, String *name, bool *hasProperty)
+Value Object::internalGet(String *name, bool *hasProperty)
 {
     uint idx = name->asArrayIndex();
     if (idx != UINT_MAX)
         return getIndexed(idx, hasProperty);
 
-    name->makeIdentifier(ctx);
+    name->makeIdentifier(engine()->current);
 
     Object *o = this;
     while (o) {
@@ -596,7 +596,7 @@ Value Object::internalGet(ExecutionContext *ctx, String *name, bool *hasProperty
         if (idx < UINT_MAX) {
             if (hasProperty)
                 *hasProperty = true;
-            return getValue(ctx, o->memberData + idx, o->internalClass->propertyData.at(idx));
+            return getValue(engine()->current, o->memberData + idx, o->internalClass->propertyData.at(idx));
         }
 
         o = o->prototype;
index 02b9180..9505d29 100644 (file)
@@ -327,8 +327,8 @@ public:
     void arrayReserve(uint n);
     void ensureArrayAttributes();
 
-    inline Value get(String *name)
-    { return vtbl->get(this, engine()->current, name, 0); }
+    inline Value get(String *name, bool *hasProperty = 0)
+    { return vtbl->get(this, name, hasProperty); }
     inline Value getIndexed(uint idx, bool *hasProperty = 0)
     { return vtbl->getIndexed(this, idx, hasProperty); }
     inline void put(String *name, const Value &v)
@@ -350,7 +350,7 @@ protected:
     static const ManagedVTable static_vtbl;
     static void destroy(Managed *that);
     static void markObjects(Managed *that);
-    static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
+    static Value get(Managed *m, String *name, bool *hasProperty);
     static Value getIndexed(Managed *m, uint index, bool *hasProperty);
     static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
     static void putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value);
@@ -364,7 +364,7 @@ protected:
 
 
 private:
-    Value internalGet(ExecutionContext *ctx, String *name, bool *hasProperty);
+    Value internalGet(String *name, bool *hasProperty);
     Value internalGetIndexed(uint index, bool *hasProperty);
     void internalPut(ExecutionContext *ctx, String *name, const Value &value);
     void internalPutIndexed(ExecutionContext *ctx, uint index, const Value &value);
index bec56d6..517d733 100644 (file)
@@ -84,7 +84,7 @@ Value ObjectCtor::construct(Managed *that, ExecutionContext *ctx, Value *args, i
     ObjectCtor *ctor = static_cast<ObjectCtor *>(that);
     if (!argc || args[0].isUndefined() || args[0].isNull()) {
         Object *obj = ctx->engine->newObject();
-        Value proto = ctor->get(ctx, ctx->engine->id_prototype);
+        Value proto = ctor->get(ctx->engine->id_prototype);
         if (proto.isObject())
             obj->prototype = proto.objectValue();
         return Value::fromObject(obj);
@@ -381,7 +381,7 @@ Value ObjectPrototype::method_toString(SimpleCallContext *ctx)
 Value ObjectPrototype::method_toLocaleString(SimpleCallContext *ctx)
 {
     Object *o = ctx->thisObject.toObject(ctx);
-    Value ts = o->get(ctx, ctx->engine->newString(QStringLiteral("toString")));
+    Value ts = o->get(ctx->engine->newString(QStringLiteral("toString")));
     FunctionObject *f = ts.asFunctionObject();
     if (!f)
         ctx->throwTypeError();
@@ -524,13 +524,13 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, Value v, Prope
     desc->setSetter(0);
 
     if (o->__hasProperty__(ctx->engine->id_enumerable))
-        attrs->setEnumerable(o->get(ctx, ctx->engine->id_enumerable).toBoolean());
+        attrs->setEnumerable(o->get(ctx->engine->id_enumerable).toBoolean());
 
     if (o->__hasProperty__(ctx->engine->id_configurable))
-        attrs->setConfigurable(o->get(ctx, ctx->engine->id_configurable).toBoolean());
+        attrs->setConfigurable(o->get(ctx->engine->id_configurable).toBoolean());
 
     if (o->__hasProperty__(ctx->engine->id_get)) {
-        Value get = o->get(ctx, ctx->engine->id_get);
+        Value get = o->get(ctx->engine->id_get);
         FunctionObject *f = get.asFunctionObject();
         if (f) {
             desc->setGetter(f);
@@ -543,7 +543,7 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, Value v, Prope
     }
 
     if (o->__hasProperty__(ctx->engine->id_set)) {
-        Value set = o->get(ctx, ctx->engine->id_set);
+        Value set = o->get(ctx->engine->id_set);
         FunctionObject *f = set.asFunctionObject();
         if (f) {
             desc->setSetter(f);
@@ -558,7 +558,7 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, Value v, Prope
     if (o->__hasProperty__(ctx->engine->id_writable)) {
         if (attrs->isAccessor())
             ctx->throwTypeError();
-        attrs->setWritable(o->get(ctx, ctx->engine->id_writable).toBoolean());
+        attrs->setWritable(o->get(ctx->engine->id_writable).toBoolean());
         // writable forces it to be a data descriptor
         desc->value = Value::undefinedValue();
     }
@@ -566,7 +566,7 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, Value v, Prope
     if (o->__hasProperty__(ctx->engine->id_value)) {
         if (attrs->isAccessor())
             ctx->throwTypeError();
-        desc->value = o->get(ctx, ctx->engine->id_value);
+        desc->value = o->get(ctx->engine->id_value);
         attrs->setType(PropertyAttributes::Data);
     }
 
index 67f2e07..a911c6f 100644 (file)
@@ -313,7 +313,7 @@ Value QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextData *qml
                 }
             }
         }
-        return QV4::Object::get(this, ctx, name, hasProperty);
+        return QV4::Object::get(this, name, hasProperty);
     }
 
     QQmlData::flushPendingBinding(m_object, result->coreIndex);
@@ -604,11 +604,12 @@ QV4::Value QObjectWrapper::create(ExecutionEngine *engine, QQmlData *ddata, QObj
     return Value::fromObject(new (engine->memoryManager) QV4::QObjectWrapper(engine, object));
 }
 
-QV4::Value QObjectWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty)
+QV4::Value QObjectWrapper::get(Managed *m, String *name, bool *hasProperty)
 {
     QObjectWrapper *that = static_cast<QObjectWrapper*>(m);
-    QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(ctx->engine);
-    return that->getQmlProperty(ctx, qmlContext, name, IgnoreRevision, hasProperty, /*includeImports*/ true);
+    ExecutionEngine *v4 = m->engine();
+    QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(v4);
+    return that->getQmlProperty(v4->current, qmlContext, name, IgnoreRevision, hasProperty, /*includeImports*/ true);
 }
 
 void QObjectWrapper::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value)
index 5aa418a..70d21a3 100644 (file)
@@ -105,7 +105,7 @@ private:
     String *m_destroy;
     String *m_toString;
 
-    static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
+    static Value get(Managed *m, String *name, bool *hasProperty);
     static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
     static PropertyAttributes query(const Managed *, String *name);
     static Property *advanceIterator(Managed *m, ObjectIterator *it, String **name, uint *index, PropertyAttributes *attributes);
index 475287a..33b962e 100644 (file)
@@ -136,7 +136,7 @@ void RegExp::markObjects(Managed *that)
 {
 }
 
-Value RegExp::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty)
+Value RegExp::get(Managed *m, String *name, bool *hasProperty)
 {
     return Value::undefinedValue();
 }
index 1d0a9f4..52a998a 100644 (file)
@@ -111,7 +111,7 @@ public:
 protected:
     static void destroy(Managed *that);
     static void markObjects(Managed *that);
-    static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
+    static Value get(Managed *m, String *name, bool *hasProperty);
     static Value getIndexed(Managed *m, uint index, bool *hasProperty);
     static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
     static void putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value);
index 654314e..02dd67a 100644 (file)
@@ -469,14 +469,14 @@ Value __qmljs_object_default_value(Object *object, int typeHint)
 
     ExecutionContext *ctx = engine->current;
 
-    Value conv = object->get(ctx, meth1);
+    Value conv = object->get(meth1);
     if (FunctionObject *o = conv.asFunctionObject()) {
         Value r = o->call(ctx, Value::fromObject(object), 0, 0);
         if (r.isPrimitive())
             return r;
     }
 
-    conv = object->get(ctx, meth2);
+    conv = object->get(meth2);
     if (FunctionObject *o = conv.asFunctionObject()) {
         Value r = o->call(ctx, Value::fromObject(object), 0, 0);
         if (r.isPrimitive())
@@ -592,7 +592,7 @@ void __qmljs_get_element(ExecutionContext *ctx, Value *result, const Value &obje
     }
 
     String *name = index.toString(ctx);
-    Value res = o->get(ctx, name);
+    Value res = o->get(name);
     if (result)
         *result = res;
 }
@@ -669,7 +669,7 @@ void __qmljs_get_property(ExecutionContext *ctx, Value *result, const Value &obj
     Value res;
     Managed *m = object.asManaged();
     if (m) {
-        res = m->get(ctx, name);
+        res = m->get(name);
     } else {
         if (object.isNull() || object.isUndefined()) {
             QString message = QStringLiteral("Cannot read property '%1' of %2").arg(name->toQString()).arg(object.toQString());
@@ -677,7 +677,7 @@ void __qmljs_get_property(ExecutionContext *ctx, Value *result, const Value &obj
         }
 
         m = __qmljs_convert_to_object(ctx, object);
-        res = m->get(ctx, name);
+        res = m->get(name);
     }
     if (result)
         *result = res;
@@ -818,7 +818,7 @@ void __qmljs_call_property(ExecutionContext *context, Value *result, const Value
         thisObject = Value::fromObject(static_cast<Object *>(baseObject));
     }
 
-    Value func = baseObject->get(context, name);
+    Value func = baseObject->get(name);
     FunctionObject *o = func.asFunctionObject();
     if (!o) {
         QString error = QString("Property '%1' of object %2 is not a function").arg(name->toQString(), thisObject.toQString());
@@ -861,7 +861,7 @@ void __qmljs_call_element(ExecutionContext *context, Value *result, const Value
     Object *baseObject = that.toObject(context);
     Value thisObject = Value::fromObject(baseObject);
 
-    Value func = baseObject->get(context, index.toString(context));
+    Value func = baseObject->get(index.toString(context));
     Object *o = func.asObject();
     if (!o)
         context->throwTypeError();
@@ -921,7 +921,7 @@ void __qmljs_construct_property(ExecutionContext *context, Value *result, const
 {
     Object *thisObject = base.toObject(context);
 
-    Value func = thisObject->get(context, name);
+    Value func = thisObject->get(name);
     if (Object *f = func.asObject()) {
         Value res = f->construct(context, args, argc);
         if (result)
@@ -1005,7 +1005,7 @@ void __qmljs_builtin_typeof_member(ExecutionContext *context, Value *result, con
 {
     Object *obj = base.toObject(context);
     Value res;
-    __qmljs_builtin_typeof(context, &res, obj->get(context, name));
+    __qmljs_builtin_typeof(context, &res, obj->get(name));
     if (result)
         *result = res;
 }
@@ -1015,7 +1015,7 @@ void __qmljs_builtin_typeof_element(ExecutionContext *context, Value *result, co
     String *name = index.toString(context);
     Object *obj = base.toObject(context);
     Value res;
-    __qmljs_builtin_typeof(context, &res, obj->get(context, name));
+    __qmljs_builtin_typeof(context, &res, obj->get(name));
     if (result)
         *result = res;
 }
@@ -1057,7 +1057,7 @@ void __qmljs_builtin_post_increment_member(ExecutionContext *context, Value *res
 {
     Object *o = base.toObject(context);
 
-    Value v = o->get(context, name);
+    Value v = o->get(name);
 
     if (v.isInteger() && v.integerValue() < INT_MAX) {
         if (result)
@@ -1137,7 +1137,7 @@ void __qmljs_builtin_post_decrement_member(ExecutionContext *context, Value *res
 {
     Object *o = base.toObject(context);
 
-    Value v = o->get(context, name);
+    Value v = o->get(name);
 
     if (v.isInteger() && v.integerValue() > INT_MIN) {
         if (result)
index e47b177..33d9b7d 100644 (file)
@@ -102,16 +102,17 @@ void String::destroy(Managed *that)
     static_cast<String*>(that)->~String();
 }
 
-Value String::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty)
+Value String::get(Managed *m, String *name, bool *hasProperty)
 {
     String *that = static_cast<String *>(m);
-    if (name == ctx->engine->id_length) {
+    ExecutionEngine *v4 = m->engine();
+    if (name == v4->id_length) {
         if (hasProperty)
             *hasProperty = true;
         return Value::fromInt32(that->_text.length());
     }
     PropertyAttributes attrs;
-    Property *pd = ctx->engine->stringPrototype->__getPropertyDescriptor__(name, &attrs);
+    Property *pd = v4->stringPrototype->__getPropertyDescriptor__(name, &attrs);
     if (!pd || attrs.isGeneric()) {
         if (hasProperty)
             *hasProperty = false;
@@ -119,7 +120,7 @@ Value String::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProp
     }
     if (hasProperty)
         *hasProperty = true;
-    return ctx->engine->stringPrototype->getValue(Value::fromString(that), ctx, pd, attrs);
+    return v4->stringPrototype->getValue(Value::fromString(that), v4->current, pd, attrs);
 }
 
 Value String::getIndexed(Managed *m, uint index, bool *hasProperty)
index 75ce173..3fee3a0 100644 (file)
@@ -120,7 +120,7 @@ struct Q_QML_EXPORT String : public Managed {
 
 protected:
     static void destroy(Managed *);
-    static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
+    static Value get(Managed *m, String *name, bool *hasProperty);
     static Value getIndexed(Managed *m, uint index, bool *hasProperty);
     static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
     static void putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value);
index 472fea5..4b30a3e 100644 (file)
@@ -351,7 +351,7 @@ Value StringPrototype::method_match(SimpleCallContext *context)
     bool global = rx->global;
 
     // ### use the standard builtin function, not the one that might be redefined in the proto
-    FunctionObject *exec = context->engine->regExpPrototype->get(context, context->engine->newString(QStringLiteral("exec")), 0).asFunctionObject();
+    FunctionObject *exec = context->engine->regExpPrototype->get(context->engine->newString(QStringLiteral("exec")), 0).asFunctionObject();
 
     Value arg = Value::fromString(s);
     if (!global)
@@ -368,7 +368,7 @@ Value StringPrototype::method_match(SimpleCallContext *context)
         if (result.isNull())
             break;
         assert(result.isObject());
-        double thisIndex = rx->get(context, lastIndex, 0).toInteger();
+        double thisIndex = rx->get(lastIndex, 0).toInteger();
         if (previousLastIndex == thisIndex) {
             previousLastIndex = thisIndex + 1;
             rx->put(context, lastIndex, Value::fromDouble(previousLastIndex));
index 5f31a20..44394bc 100644 (file)
@@ -220,7 +220,7 @@ String *Value::toString(ExecutionContext *ctx) const
 
 Value Value::property(ExecutionContext *ctx, String *name) const
 {
-    return isObject() ? objectValue()->get(ctx, name) : undefinedValue();
+    return isObject() ? objectValue()->get(name) : undefinedValue();
 }
 
 
index e2fcbfc..28234af 100644 (file)
@@ -803,7 +803,7 @@ QJSValue QJSValue::property(const QString& name) const
     s->makeIdentifier(engine->current);
     QV4::ExecutionContext *ctx = engine->current;
     try {
-        QV4::Value v = o->get(ctx, s);
+        QV4::Value v = o->get(s);
         return new QJSValuePrivate(engine, v);
     } catch (QV4::Exception &e) {
         e.accept(ctx);
@@ -832,7 +832,7 @@ QJSValue QJSValue::property(quint32 arrayIndex) const
     ExecutionEngine *engine = d->engine;
     QV4::ExecutionContext *ctx = engine->current;
     try {
-        QV4::Value v = arrayIndex == UINT_MAX ? o->get(ctx, engine->id_uintMax) : o->getIndexed(arrayIndex);
+        QV4::Value v = arrayIndex == UINT_MAX ? o->get(engine->id_uintMax) : o->getIndexed(arrayIndex);
         return new QJSValuePrivate(engine, v);
     } catch (QV4::Exception &e) {
         e.accept(ctx);
index b682425..8926615 100644 (file)
@@ -3131,19 +3131,19 @@ public:
         return QV4::Value::fromObject(object);
     }
 
-    static QV4::Value get(QV4::Managed *m, QV4::ExecutionContext *ctx, QV4::String *name, bool *hasProperty)
+    static QV4::Value get(QV4::Managed *m, QV4::String *name, bool *hasProperty)
     {
         QQmlDelegateModelGroupChangeArray *array = m->as<QQmlDelegateModelGroupChangeArray>();
         if (!array)
-            ctx->throwTypeError();
+            m->engine()->current->throwTypeError();
 
-        if (name == ctx->engine->id_length) {
+        if (name == m->engine()->id_length) {
             if (hasProperty)
                 *hasProperty = true;
             return QV4::Value::fromInt32(array->count());
         }
 
-        return Object::get(m, ctx, name, hasProperty);
+        return Object::get(m, name, hasProperty);
     }
     static void destroy(Managed *that) {
         QQmlDelegateModelGroupChangeArray *array = that->as<QQmlDelegateModelGroupChangeArray>();