Remove context parameter from Managed::getIndexed
authorLars Knoll <lars.knoll@digia.com>
Fri, 21 Jun 2013 20:55:13 +0000 (22:55 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Sat, 22 Jun 2013 19:24:13 +0000 (21:24 +0200)
Change-Id: Ibc6271dbe789ef5ed063d8650ee36978f7c18021
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
22 files changed:
src/imports/localstorage/plugin.cpp
src/qml/qml/qqmllistwrapper.cpp
src/qml/qml/qqmllistwrapper_p.h
src/qml/qml/qqmlxmlhttprequest.cpp
src/qml/qml/v4/qv4arrayobject.cpp
src/qml/qml/v4/qv4functionobject.cpp
src/qml/qml/v4/qv4jsonobject.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/qv4regexp.cpp
src/qml/qml/v4/qv4regexp_p.h
src/qml/qml/v4/qv4runtime.cpp
src/qml/qml/v4/qv4sequenceobject.cpp
src/qml/qml/v4/qv4string.cpp
src/qml/qml/v4/qv4string_p.h
src/qml/qml/v4/qv4stringobject.cpp
src/qml/qml/v8/qjsvalue.cpp
src/qml/qml/v8/qv8engine.cpp
src/qml/types/qqmldelegatemodel.cpp
src/quick/items/context2d/qquickcontext2d.cpp

index 1c57b03..131de2b 100644 (file)
@@ -104,7 +104,7 @@ public:
     ~QQmlSqlDatabaseWrapper() {
     }
 
-    static Value getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty);
+    static Value getIndexed(Managed *m, uint index, bool *hasProperty);
     static void destroy(Managed *that) {
         static_cast<QQmlSqlDatabaseWrapper *>(that)->~QQmlSqlDatabaseWrapper();
     }
@@ -216,13 +216,13 @@ static Value qmlsqldatabase_rows_index(QQmlSqlDatabaseWrapper *r, ExecutionEngin
     }
 }
 
-Value QQmlSqlDatabaseWrapper::getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty)
+Value QQmlSqlDatabaseWrapper::getIndexed(Managed *m, uint index, bool *hasProperty)
 {
     QQmlSqlDatabaseWrapper *r = m->as<QQmlSqlDatabaseWrapper>();
     if (!r || r->type != QQmlSqlDatabaseWrapper::Rows)
-        return Object::getIndexed(m, ctx, index, hasProperty);
+        return Object::getIndexed(m, index, hasProperty);
 
-    return qmlsqldatabase_rows_index(r, ctx->engine, index, hasProperty);
+    return qmlsqldatabase_rows_index(r, m->engine(), index, hasProperty);
 }
 
 static Value qmlsqldatabase_rows_item(SimpleCallContext *ctx)
index 719119c..639a5a5 100644 (file)
@@ -110,20 +110,21 @@ Value QmlListWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool
 
     uint idx = name->asArrayIndex();
     if (idx != UINT_MAX)
-        return getIndexed(m, ctx, idx, hasProperty);
+        return getIndexed(m, idx, hasProperty);
 
     return Value::undefinedValue();
 }
 
-Value QmlListWrapper::getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty)
+Value QmlListWrapper::getIndexed(Managed *m, uint index, bool *hasProperty)
 {
+    QV4::ExecutionEngine *e = m->engine();
     QmlListWrapper *w = m->as<QmlListWrapper>();
     if (!w)
-        ctx->throwTypeError();
+        e->current->throwTypeError();
 
     quint32 count = w->property.count ? w->property.count(&w->property) : 0;
     if (index < count && w->property.at)
-        return QV4::QObjectWrapper::wrap(ctx->engine, w->property.at(&w->property, index));
+        return QV4::QObjectWrapper::wrap(e, w->property.at(&w->property, index));
 
     return Value::undefinedValue();
 }
index de2a047..8c52b79 100644 (file)
@@ -81,7 +81,7 @@ public:
     QVariant toVariant() const;
 
     static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
-    static Value getIndexed(Managed *m, ExecutionContext *ctx, uint index, 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);
     static void destroy(Managed *that);
index 449acca..0300817 100644 (file)
@@ -204,7 +204,7 @@ public:
         that->as<NamedNodeMap>()->~NamedNodeMap();
     }
     static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
-    static Value getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty);
+    static Value getIndexed(Managed *m, uint index, bool *hasProperty);
 
     QList<NodeImpl *> list; // Only used in NamedNodeMap
     NodeImpl *d;
@@ -235,7 +235,7 @@ public:
         that->as<NodeList>()->~NodeList();
     }
     static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
-    static Value getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty);
+    static Value getIndexed(Managed *m, uint index, bool *hasProperty);
 
     // C++ API
     static Value create(QV8Engine *, NodeImpl *);
@@ -842,13 +842,14 @@ bool Node::isNull() const
     return d == 0;
 }
 
-Value NamedNodeMap::getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty)
+Value NamedNodeMap::getIndexed(Managed *m, uint index, bool *hasProperty)
 {
+    QV4::ExecutionEngine *v4 = m->engine();
     NamedNodeMap *r = m->as<NamedNodeMap>();
     if (!r)
-        ctx->throwTypeError();
+        v4->current->throwTypeError();
 
-    QV8Engine *engine = ctx->engine->v8Engine;
+    QV8Engine *engine = v4->v8Engine;
 
     if ((int)index < r->list.count()) {
         if (hasProperty)
@@ -895,13 +896,14 @@ Value NamedNodeMap::create(QV8Engine *engine, NodeImpl *data, const QList<NodeIm
     return Value::fromObject(instance);
 }
 
-Value NodeList::getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty)
+Value NodeList::getIndexed(Managed *m, uint index, bool *hasProperty)
 {
+    QV4::ExecutionEngine *v4 = m->engine();
     NodeList *r = m->as<NodeList>();
     if (!r)
-        ctx->throwTypeError();
+        v4->current->throwTypeError();
 
-    QV8Engine *engine = ctx->engine->v8Engine;
+    QV8Engine *engine = v4->v8Engine;
 
     if ((int)index < r->d->children.count()) {
         if (hasProperty)
index 5ab8dc8..3b1d223 100644 (file)
@@ -194,7 +194,7 @@ Value ArrayPrototype::method_join(SimpleCallContext *ctx)
             if (i)
                 R += r4;
 
-            Value e = a->getIndexed(ctx, i);
+            Value e = a->getIndexed(i);
             if (! (e.isUndefined() || e.isNull()))
                 R += e.toString(ctx)->toQString();
         }
@@ -232,7 +232,7 @@ Value ArrayPrototype::method_pop(SimpleCallContext *ctx)
         return Value::undefinedValue();
     }
 
-    Value result = instance->getIndexed(ctx, len - 1);
+    Value result = instance->getIndexed(len - 1);
 
     instance->deleteIndexedProperty(len - 1);
     if (instance->isArrayObject())
@@ -310,8 +310,8 @@ Value ArrayPrototype::method_reverse(SimpleCallContext *ctx)
 
     for (; lo < hi; ++lo, --hi) {
         bool loExists, hiExists;
-        Value lval = instance->getIndexed(ctx, lo, &loExists);
-        Value hval = instance->getIndexed(ctx, hi, &hiExists);
+        Value lval = instance->getIndexed(lo, &loExists);
+        Value hval = instance->getIndexed(hi, &hiExists);
         if (hiExists)
             instance->putIndexed(ctx, lo, hval);
         else
@@ -366,7 +366,7 @@ Value ArrayPrototype::method_shift(SimpleCallContext *ctx)
         // do it the slow way
         for (uint k = 1; k < len; ++k) {
             bool exists;
-            Value v = instance->getIndexed(ctx, k, &exists);
+            Value v = instance->getIndexed(k, &exists);
             if (exists)
                 instance->putIndexed(ctx, k - 1, v);
             else
@@ -410,7 +410,7 @@ Value ArrayPrototype::method_slice(SimpleCallContext *ctx)
     uint n = 0;
     for (uint i = start; i < end; ++i) {
         bool exists;
-        Value v = o->getIndexed(ctx, i, &exists);
+        Value v = o->getIndexed(i, &exists);
         if (exists) {
             result->arraySet(n, v);
         }
@@ -449,7 +449,7 @@ Value ArrayPrototype::method_splice(SimpleCallContext *ctx)
     newArray->arrayReserve(deleteCount);
     Property *pd = newArray->arrayData;
     for (uint i = 0; i < deleteCount; ++i) {
-        pd->value = instance->getIndexed(ctx, start + i);
+        pd->value = instance->getIndexed(start + i);
         ++pd;
     }
     newArray->arrayDataLen = deleteCount;
@@ -460,7 +460,7 @@ Value ArrayPrototype::method_splice(SimpleCallContext *ctx)
     if (itemCount < deleteCount) {
         for (uint k = start; k < len - deleteCount; ++k) {
             bool exists;
-            Value v = instance->getIndexed(ctx, k + deleteCount, &exists);
+            Value v = instance->getIndexed(k + deleteCount, &exists);
             if (exists)
                 instance->putIndexed(k + itemCount, v);
             else
@@ -472,7 +472,7 @@ Value ArrayPrototype::method_splice(SimpleCallContext *ctx)
         uint k = len - deleteCount;
         while (k > start) {
             bool exists;
-            Value v = instance->getIndexed(ctx, k + deleteCount - 1, &exists);
+            Value v = instance->getIndexed(k + deleteCount - 1, &exists);
             if (exists)
                 instance->putIndexed(k + itemCount - 1, v);
             else
@@ -525,7 +525,7 @@ Value ArrayPrototype::method_unshift(SimpleCallContext *ctx)
     } else {
         for (uint k = len; k > 0; --k) {
             bool exists;
-            Value v = instance->getIndexed(ctx, k - 1, &exists);
+            Value v = instance->getIndexed(k - 1, &exists);
             if (exists)
                 instance->putIndexed(ctx, k + ctx->argumentCount - 1, v);
             else
@@ -573,7 +573,7 @@ Value ArrayPrototype::method_indexOf(SimpleCallContext *ctx)
     if (instance->isStringObject()) {
         for (uint k = fromIndex; k < len; ++k) {
             bool exists;
-            Value v = instance->getIndexed(ctx, k, &exists);
+            Value v = instance->getIndexed(k, &exists);
             if (exists && __qmljs_strict_equal(v, searchValue))
                 return Value::fromDouble(k);
         }
@@ -613,7 +613,7 @@ Value ArrayPrototype::method_lastIndexOf(SimpleCallContext *ctx)
     for (uint k = fromIndex; k > 0;) {
         --k;
         bool exists;
-        Value v = instance->getIndexed(ctx, k, &exists);
+        Value v = instance->getIndexed(k, &exists);
         if (exists && __qmljs_strict_equal(v, searchValue))
             return Value::fromDouble(k);
     }
@@ -635,7 +635,7 @@ Value ArrayPrototype::method_every(SimpleCallContext *ctx)
     bool ok = true;
     for (uint k = 0; ok && k < len; ++k) {
         bool exists;
-        Value v = instance->getIndexed(ctx, k, &exists);
+        Value v = instance->getIndexed(k, &exists);
         if (!exists)
             continue;
 
@@ -663,7 +663,7 @@ Value ArrayPrototype::method_some(SimpleCallContext *ctx)
 
     for (uint k = 0; k < len; ++k) {
         bool exists;
-        Value v = instance->getIndexed(ctx, k, &exists);
+        Value v = instance->getIndexed(k, &exists);
         if (!exists)
             continue;
 
@@ -692,7 +692,7 @@ Value ArrayPrototype::method_forEach(SimpleCallContext *ctx)
 
     for (uint k = 0; k < len; ++k) {
         bool exists;
-        Value v = instance->getIndexed(ctx, k, &exists);
+        Value v = instance->getIndexed(k, &exists);
         if (!exists)
             continue;
 
@@ -723,7 +723,7 @@ Value ArrayPrototype::method_map(SimpleCallContext *ctx)
 
     for (uint k = 0; k < len; ++k) {
         bool exists;
-        Value v = instance->getIndexed(ctx, k, &exists);
+        Value v = instance->getIndexed(k, &exists);
         if (!exists)
             continue;
 
@@ -755,7 +755,7 @@ Value ArrayPrototype::method_filter(SimpleCallContext *ctx)
     uint to = 0;
     for (uint k = 0; k < len; ++k) {
         bool exists;
-        Value v = instance->getIndexed(ctx, k, &exists);
+        Value v = instance->getIndexed(k, &exists);
         if (!exists)
             continue;
 
@@ -789,7 +789,7 @@ Value ArrayPrototype::method_reduce(SimpleCallContext *ctx)
     } else {
         bool kPresent = false;
         while (k < len && !kPresent) {
-            Value v = instance->getIndexed(ctx, k, &kPresent);
+            Value v = instance->getIndexed(k, &kPresent);
             if (kPresent)
                 acc = v;
             ++k;
@@ -800,7 +800,7 @@ Value ArrayPrototype::method_reduce(SimpleCallContext *ctx)
 
     while (k < len) {
         bool kPresent;
-        Value v = instance->getIndexed(ctx, k, &kPresent);
+        Value v = instance->getIndexed(k, &kPresent);
         if (kPresent) {
             Value args[4];
             args[0] = acc;
@@ -837,7 +837,7 @@ Value ArrayPrototype::method_reduceRight(SimpleCallContext *ctx)
     } else {
         bool kPresent = false;
         while (k > 0 && !kPresent) {
-            Value v = instance->getIndexed(ctx, k - 1, &kPresent);
+            Value v = instance->getIndexed(k - 1, &kPresent);
             if (kPresent)
                 acc = v;
             --k;
@@ -848,7 +848,7 @@ Value ArrayPrototype::method_reduceRight(SimpleCallContext *ctx)
 
     while (k > 0) {
         bool kPresent;
-        Value v = instance->getIndexed(ctx, k - 1, &kPresent);
+        Value v = instance->getIndexed(k - 1, &kPresent);
         if (kPresent) {
             Value args[4];
             args[0] = acc;
index 09ee5f1..5363be6 100644 (file)
@@ -253,7 +253,7 @@ Value FunctionPrototype::method_apply(SimpleCallContext *ctx)
     if (Object *arr = arg.asObject()) {
         quint32 len = arr->get(ctx, ctx->engine->id_length).toUInt32();
         for (quint32 i = 0; i < len; ++i) {
-            Value a = arr->getIndexed(ctx, i);
+            Value a = arr->getIndexed(i);
             args.append(a);
         }
     } else if (!(arg.isUndefined() || arg.isNull())) {
index 34f4809..79e746f 100644 (file)
@@ -827,7 +827,7 @@ QString Stringify::JA(ArrayObject *a)
     uint len = a->arrayLength();
     for (uint i = 0; i < len; ++i) {
         bool exists;
-        Value v = a->getIndexed(ctx, i, &exists);
+        Value v = a->getIndexed(i, &exists);
         if (!exists) {
             partial += QStringLiteral("null");
             continue;
@@ -891,7 +891,7 @@ Value JsonObject::method_stringify(SimpleCallContext *ctx)
         if (o->isArrayObject()) {
             uint arrayLen = o->arrayLength();
             for (uint i = 0; i < arrayLen; ++i) {
-                Value v = o->getIndexed(ctx, i);
+                Value v = o->getIndexed(i);
                 if (v.asNumberObject() || v.asStringObject() || v.isNumber())
                     v = __qmljs_to_string(v, ctx);
                 if (v.isString()) {
index 941c465..5d2e856 100644 (file)
@@ -206,7 +206,7 @@ Value Managed::get(ExecutionContext *ctx, String *name, bool *hasProperty)
     return vtbl->get(this, ctx, name, hasProperty);
 }
 
-Value Managed::getIndexed(ExecutionContext *ctx, uint index, bool *hasProperty)
+Value Managed::getIndexed(uint index, bool *hasProperty)
 {
-    return vtbl->getIndexed(this, ctx, index, hasProperty);
+    return vtbl->getIndexed(this, index, hasProperty);
 }
index a8e94e1..ad1d051 100644 (file)
@@ -106,7 +106,7 @@ struct ManagedVTable
     void (*collectDeletables)(Managed *, GCDeletable **deletable);
     bool (*hasInstance)(Managed *, const Value &value);
     Value (*get)(Managed *, ExecutionContext *ctx, String *name, bool *hasProperty);
-    Value (*getIndexed)(Managed *, ExecutionContext *ctx, uint index, 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);
     PropertyAttributes (*query)(const Managed *, String *name);
@@ -263,7 +263,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 getIndexed(ExecutionContext *ctx, uint index, 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); }
     void putIndexed(ExecutionContext *ctx, uint index, const Value &value)
index f41365e..085d907 100644 (file)
@@ -179,7 +179,7 @@ void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, const Value &index, c
     uint idx = index.asArrayIndex();
     if (idx < UINT_MAX) {
         bool hasProperty = false;
-        Value v = getIndexed(ctx, idx, &hasProperty);
+        Value v = getIndexed(idx, &hasProperty);
         Value result;
         op(ctx, &result, v, rhs);
         putIndexed(ctx, idx, result);
@@ -399,9 +399,9 @@ Value Object::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProp
     return static_cast<Object *>(m)->internalGet(ctx, name, hasProperty);
 }
 
-Value Object::getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty)
+Value Object::getIndexed(Managed *m, uint index, bool *hasProperty)
 {
-    return static_cast<Object *>(m)->internalGetIndexed(ctx, index, hasProperty);
+    return static_cast<Object *>(m)->internalGetIndexed(index, hasProperty);
 }
 
 void Object::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value)
@@ -586,7 +586,7 @@ Value Object::internalGet(ExecutionContext *ctx, String *name, bool *hasProperty
 {
     uint idx = name->asArrayIndex();
     if (idx != UINT_MAX)
-        return getIndexed(ctx, idx, hasProperty);
+        return getIndexed(idx, hasProperty);
 
     name->makeIdentifier(ctx);
 
@@ -607,7 +607,7 @@ Value Object::internalGet(ExecutionContext *ctx, String *name, bool *hasProperty
     return Value::undefinedValue();
 }
 
-Value Object::internalGetIndexed(ExecutionContext *ctx, uint index, bool *hasProperty)
+Value Object::internalGetIndexed(uint index, bool *hasProperty)
 {
     Property *pd = 0;
     PropertyAttributes attrs = Attr_Data;
@@ -635,7 +635,7 @@ Value Object::internalGetIndexed(ExecutionContext *ctx, uint index, bool *hasPro
     if (pd) {
         if (hasProperty)
             *hasProperty = true;
-        return getValue(ctx, pd, attrs);
+        return getValue(engine()->current, pd, attrs);
     }
 
     if (hasProperty)
@@ -1054,7 +1054,7 @@ Value Object::arrayIndexOf(Value v, uint fromIndex, uint endIndex, ExecutionCont
         // lets be safe and slow
         for (uint i = fromIndex; i < endIndex; ++i) {
             bool exists;
-            Value value = o->getIndexed(ctx, i, &exists);
+            Value value = o->getIndexed(i, &exists);
             if (exists && __qmljs_strict_equal(value, v))
                 return Value::fromDouble(i);
         }
@@ -1114,7 +1114,7 @@ void Object::arrayConcat(const ArrayObject *other)
         if (other->arrayAttributes) {
             for (int i = 0; i < arrayDataLen; ++i) {
                 bool exists;
-                arrayData[oldSize + i].value = const_cast<ArrayObject *>(other)->getIndexed(internalClass->engine->current, i, &exists);
+                arrayData[oldSize + i].value = const_cast<ArrayObject *>(other)->getIndexed(i, &exists);
                 if (arrayAttributes)
                     arrayAttributes[oldSize + i] = Attr_Data;
                 if (!exists) {
@@ -1366,7 +1366,7 @@ QStringList ArrayObject::toQStringList() const
 
     uint32_t length = arrayLength();
     for (uint32_t i = 0; i < length; ++i)
-        result.append(const_cast<ArrayObject *>(this)->getIndexed(engine->current, i).toString(engine->current)->toQString());
+        result.append(const_cast<ArrayObject *>(this)->getIndexed(i).toString(engine->current)->toQString());
     return result;
 }
 
index 557e4fd..02b9180 100644 (file)
@@ -329,8 +329,8 @@ public:
 
     inline Value get(String *name)
     { return vtbl->get(this, engine()->current, name, 0); }
-    inline Value getIndexed(uint idx)
-    { return vtbl->getIndexed(this, engine()->current, idx, 0); }
+    inline Value getIndexed(uint idx, bool *hasProperty = 0)
+    { return vtbl->getIndexed(this, idx, hasProperty); }
     inline void put(String *name, const Value &v)
     { vtbl->put(this, engine()->current, name, v); }
     inline void putIndexed(uint idx, const Value &v)
@@ -351,7 +351,7 @@ protected:
     static void destroy(Managed *that);
     static void markObjects(Managed *that);
     static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
-    static Value getIndexed(Managed *m, ExecutionContext *ctx, uint index, 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);
     static PropertyAttributes query(const Managed *m, String *name);
@@ -365,7 +365,7 @@ protected:
 
 private:
     Value internalGet(ExecutionContext *ctx, String *name, bool *hasProperty);
-    Value internalGetIndexed(ExecutionContext *ctx, uint index, 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);
     bool internalDeleteProperty(String *name);
index a698976..475287a 100644 (file)
@@ -141,7 +141,7 @@ Value RegExp::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProp
     return Value::undefinedValue();
 }
 
-Value RegExp::getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty)
+Value RegExp::getIndexed(Managed *m, uint index, bool *hasProperty)
 {
     return Value::undefinedValue();
 }
index 9b9bd51..1d0a9f4 100644 (file)
@@ -112,7 +112,7 @@ protected:
     static void destroy(Managed *that);
     static void markObjects(Managed *that);
     static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
-    static Value getIndexed(Managed *m, ExecutionContext *ctx, uint index, 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);
     static PropertyAttributes query(const Managed *m, String *name);
index c47be00..654314e 100644 (file)
@@ -585,7 +585,7 @@ void __qmljs_get_element(ExecutionContext *ctx, Value *result, const Value &obje
             }
         }
 
-        Value res = o->getIndexed(ctx, idx);
+        Value res = o->getIndexed(idx);
         if (result)
             *result = res;
         return;
@@ -1084,7 +1084,7 @@ void __qmljs_builtin_post_increment_element(ExecutionContext *context, Value *re
         return __qmljs_builtin_post_increment_member(context, result, base, s);
     }
 
-    Value v = o->getIndexed(context, idx);
+    Value v = o->getIndexed(idx);
 
     if (v.isInteger() && v.integerValue() < INT_MAX) {
         if (result)
@@ -1164,7 +1164,7 @@ void __qmljs_builtin_post_decrement_element(ExecutionContext *context, Value *re
         return __qmljs_builtin_post_decrement_member(context, result, base, s);
     }
 
-    Value v = o->getIndexed(context, idx);
+    Value v = o->getIndexed(idx);
 
     if (v.isInteger() && v.integerValue() > INT_MIN) {
         if (result)
index ef4b5c0..cce1957 100644 (file)
@@ -194,11 +194,11 @@ public:
         defineAccessorProperty(engine, QStringLiteral("length"), method_get_length, method_set_length);
     }
 
-    QV4::Value containerGetIndexed(QV4::ExecutionContext *ctx, uint index, bool *hasProperty)
+    QV4::Value containerGetIndexed(uint index, bool *hasProperty)
     {
         /* Qt containers have int (rather than uint) allowable indexes. */
         if (index > INT_MAX) {
-            generateWarning(ctx, QLatin1String("Index out of range during indexed get"));
+            generateWarning(engine()->current, QLatin1String("Index out of range during indexed get"));
             if (hasProperty)
                 *hasProperty = false;
             return QV4::Value::undefinedValue();
@@ -215,7 +215,7 @@ public:
         if (signedIdx < m_container.count()) {
             if (hasProperty)
                 *hasProperty = true;
-            return convertElementToValue(ctx->engine, m_container.at(signedIdx));
+            return convertElementToValue(engine(), m_container.at(signedIdx));
         }
         if (hasProperty)
             *hasProperty = false;
@@ -484,8 +484,8 @@ private:
     int m_propertyIndex;
     bool m_isReference;
 
-    static QV4::Value getIndexed(QV4::Managed *that, QV4::ExecutionContext *ctx, uint index, bool *hasProperty)
-    { return static_cast<QQmlSequence<Container> *>(that)->containerGetIndexed(ctx, index, hasProperty); }
+    static QV4::Value getIndexed(QV4::Managed *that, uint index, bool *hasProperty)
+    { return static_cast<QQmlSequence<Container> *>(that)->containerGetIndexed(index, hasProperty); }
     static void putIndexed(Managed *that, QV4::ExecutionContext *ctx, uint index, const QV4::Value &value)
     { static_cast<QQmlSequence<Container> *>(that)->containerPutIndexed(ctx, index, value); }
     static QV4::PropertyAttributes queryIndexed(const QV4::Managed *that, uint index)
index bf68f5e..e47b177 100644 (file)
@@ -122,16 +122,17 @@ Value String::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProp
     return ctx->engine->stringPrototype->getValue(Value::fromString(that), ctx, pd, attrs);
 }
 
-Value String::getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty)
+Value String::getIndexed(Managed *m, uint index, bool *hasProperty)
 {
     String *that = static_cast<String *>(m);
+    ExecutionEngine *engine = that->engine();
     if (index < that->_text.length()) {
         if (hasProperty)
             *hasProperty = true;
-        return Value::fromString(ctx, that->toQString().mid(index, 1));
+        return Value::fromString(engine->newString(that->toQString().mid(index, 1)));
     }
     PropertyAttributes attrs;
-    Property *pd = ctx->engine->stringPrototype->__getPropertyDescriptor__(index, &attrs);
+    Property *pd = engine->stringPrototype->__getPropertyDescriptor__(index, &attrs);
     if (!pd || attrs.isGeneric()) {
         if (hasProperty)
             *hasProperty = false;
@@ -139,7 +140,7 @@ Value String::getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *ha
     }
     if (hasProperty)
         *hasProperty = true;
-    return ctx->engine->stringPrototype->getValue(Value::fromString(that), ctx, pd, attrs);
+    return engine->stringPrototype->getValue(Value::fromString(that), engine->current, pd, attrs);
 }
 
 void String::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value)
index 95f6b40..75ce173 100644 (file)
@@ -121,7 +121,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 getIndexed(Managed *m, ExecutionContext *ctx, uint index, 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);
     static PropertyAttributes query(const Managed *m, String *name);
index 0596ea6..472fea5 100644 (file)
@@ -375,7 +375,7 @@ Value StringPrototype::method_match(SimpleCallContext *context)
         } else {
             previousLastIndex = thisIndex;
         }
-        Value matchStr = result.objectValue()->getIndexed(context, 0, (bool *)0);
+        Value matchStr = result.objectValue()->getIndexed(0);
         a->arraySet(n, matchStr);
         ++n;
     }
index 9b92019..e2fcbfc 100644 (file)
@@ -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(ctx, arrayIndex);
+        QV4::Value v = arrayIndex == UINT_MAX ? o->get(ctx, engine->id_uintMax) : o->getIndexed(arrayIndex);
         return new QJSValuePrivate(engine, v);
     } catch (QV4::Exception &e) {
         e.accept(ctx);
index a039637..51edb6c 100644 (file)
@@ -156,7 +156,7 @@ QVariant QV8Engine::toVariant(const QV4::Value &value, int typeHint)
             QList<QObject *> list;
             uint32_t length = a->arrayLength();
             for (uint32_t ii = 0; ii < length; ++ii) {
-                QV4::Value arrayItem = a->getIndexed(m_v4Engine->current, ii);
+                QV4::Value arrayItem = a->getIndexed(ii);
                 if (QV4::QObjectWrapper *qobjectWrapper = arrayItem.as<QV4::QObjectWrapper>()) {
                     list << qobjectWrapper->object();
                 } else {
@@ -382,7 +382,7 @@ QVariant QV8Engine::toBasicVariant(const QV4::Value &value)
 
         int length = a->arrayLength();
         for (int ii = 0; ii < length; ++ii)
-            rv << toVariant(a->getIndexed(m_v4Engine->current, ii), -1);
+            rv << toVariant(a->getIndexed(ii), -1);
         return rv;
     }
     if (!value.asFunctionObject())
index 8effbd8..b682425 100644 (file)
@@ -3106,11 +3106,12 @@ public:
     virtual quint32 count() const = 0;
     virtual const QQmlChangeSet::Change &at(int index) const = 0;
 
-    static QV4::Value getIndexed(QV4::Managed *m, QV4::ExecutionContext *ctx, uint index, bool *hasProperty)
+    static QV4::Value getIndexed(QV4::Managed *m, uint index, bool *hasProperty)
     {
+        QV4::ExecutionEngine *v4 = m->engine();
         QQmlDelegateModelGroupChangeArray *array = m->as<QQmlDelegateModelGroupChangeArray>();
         if (!array)
-            ctx->throwTypeError();
+            v4->current->throwTypeError();
 
         if (index >= array->count()) {
             if (hasProperty)
@@ -3120,8 +3121,7 @@ public:
 
         const QQmlChangeSet::Change &change = array->at(index);
 
-        QV4::Object *changeProto = engineData(array->engine()->v8Engine)->changeProto.value().asObject();
-        QV4::ExecutionEngine *v4 = changeProto->engine();
+        QV4::Object *changeProto = engineData(v4->v8Engine)->changeProto.value().asObject();
         QQmlDelegateModelGroupChange *object = new (v4->memoryManager) QQmlDelegateModelGroupChange(v4);
         object->prototype = changeProto;
         object->change = change;
index 689646f..f670faa 100644 (file)
@@ -595,7 +595,7 @@ struct QQuickJSContext2DPixelData : public QV4::Object
     static void destroy(QV4::Managed *that) {
         static_cast<QQuickJSContext2DPixelData *>(that)->~QQuickJSContext2DPixelData();
     }
-    static QV4::Value getIndexed(QV4::Managed *m, QV4::ExecutionContext *ctx, uint index, bool *hasProperty);
+    static QV4::Value getIndexed(QV4::Managed *m, uint index, bool *hasProperty);
     static void putIndexed(QV4::Managed *m, QV4::ExecutionContext *ctx, uint index, const QV4::Value &value);
 
     static QV4::Value proto_get_length(QV4::SimpleCallContext *ctx);
@@ -2679,11 +2679,11 @@ QV4::Value QQuickJSContext2DPixelData::proto_get_length(QV4::SimpleCallContext *
     return QV4::Value::fromInt32(r->image.width() * r->image.height() * 4);
 }
 
-QV4::Value QQuickJSContext2DPixelData::getIndexed(QV4::Managed *m, QV4::ExecutionContext *ctx, uint index, bool *hasProperty)
+QV4::Value QQuickJSContext2DPixelData::getIndexed(QV4::Managed *m, uint index, bool *hasProperty)
 {
     QQuickJSContext2DPixelData *r = m->as<QQuickJSContext2DPixelData>();
     if (!m)
-        ctx->throwTypeError();
+        m->engine()->current->throwTypeError();
 
     if (r && index < static_cast<quint32>(r->image.width() * r->image.height() * 4)) {
         if (hasProperty)