Remove context parameter from Manged::put.
authorLars Knoll <lars.knoll@digia.com>
Fri, 21 Jun 2013 22:09:24 +0000 (00:09 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Sat, 22 Jun 2013 19:54:09 +0000 (21:54 +0200)
Change-Id: Ib99e726ffbb20463d45a8444b4fbdfe32cd6dbef
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
28 files changed:
src/imports/localstorage/plugin.cpp
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/v4/qv4arrayobject.cpp
src/qml/qml/v4/qv4context.cpp
src/qml/qml/v4/qv4jsonobject.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/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/v8/qjsvalue.cpp
src/qml/qml/v8/qv4domerrors_p.h
src/qml/qml/v8/qv8engine.cpp
src/quick/items/context2d/qquickcontext2d.cpp
tools/v4/main.cpp

index 131de2b..9357b5a 100644 (file)
@@ -65,7 +65,7 @@ using namespace QV4;
 #define V4THROW_SQL(error, desc) { \
     Value v = Value::fromString(ctx, desc); \
     Object *ex = ctx->engine->newErrorObject(v); \
-    ex->put(ctx, ctx->engine->newIdentifier(QStringLiteral("code")), Value::fromInt32(error)); \
+    ex->put(ctx->engine->newIdentifier(QStringLiteral("code")), Value::fromInt32(error)); \
     ctx->throwError(Value::fromObject(ex)); \
 }
 
@@ -201,9 +201,9 @@ static Value qmlsqldatabase_rows_index(QQmlSqlDatabaseWrapper *r, ExecutionEngin
         for (int ii = 0; ii < record.count(); ++ii) {
             QVariant v = record.value(ii);
             if (v.isNull()) {
-                row->put(v4->current, v4->newIdentifier(record.fieldName(ii)), Value::nullValue());
+                row->put(v4->newIdentifier(record.fieldName(ii)), Value::nullValue());
             } else {
-                row->put(v4->current, v4->newIdentifier(record.fieldName(ii)), v8->fromVariant(v));
+                row->put(v4->newIdentifier(record.fieldName(ii)), v8->fromVariant(v));
             }
         }
         if (hasProperty)
@@ -294,9 +294,9 @@ static Value qmlsqldatabase_executeSql(SimpleCallContext *ctx)
             Object *resultObject = ctx->engine->newObject();
             result = Value::fromObject(resultObject);
             // XXX optimize
-            resultObject->put(ctx, ctx->engine->newIdentifier("rowsAffected"), Value::fromInt32(query.numRowsAffected()));
-            resultObject->put(ctx, ctx->engine->newIdentifier("insertId"), engine->toString(query.lastInsertId().toString()));
-            resultObject->put(ctx, ctx->engine->newIdentifier("rows"), Value::fromObject(rows));
+            resultObject->put(ctx->engine->newIdentifier("rowsAffected"), Value::fromInt32(query.numRowsAffected()));
+            resultObject->put(ctx->engine->newIdentifier("insertId"), engine->toString(query.lastInsertId().toString()));
+            resultObject->put(ctx->engine->newIdentifier("rows"), Value::fromObject(rows));
         } else {
             err = true;
         }
index 2413ebe..bae2e03 100644 (file)
@@ -262,27 +262,28 @@ Value QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty)
     return Value::undefinedValue();
 }
 
-void QmlContextWrapper::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value)
+void QmlContextWrapper::put(Managed *m, String *name, const Value &value)
 {
     QmlContextWrapper *wrapper = m->as<QmlContextWrapper>();
+    ExecutionEngine *v4 = m->engine();
     if (!wrapper)
-        ctx->throwTypeError();
+        v4->current->throwTypeError();
 
     if (wrapper->isNullWrapper) {
         if (wrapper && wrapper->readOnly) {
             QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
                             QLatin1Char('"');
-            ctx->throwError(Value::fromString(ctx->engine->newString(error)));
+            v4->current->throwError(Value::fromString(v4->current->engine->newString(error)));
         }
 
-        Object::put(m, ctx, name, value);
+        Object::put(m, name, value);
         return;
     }
 
     PropertyAttributes attrs;
     Property *pd  = wrapper->__getOwnProperty__(name, &attrs);
     if (pd) {
-        wrapper->putValue(ctx, pd, attrs, value);
+        wrapper->putValue(v4->current, pd, attrs, value);
         return;
     }
 
@@ -296,7 +297,6 @@ void QmlContextWrapper::put(Managed *m, ExecutionContext *ctx, String *name, con
 
     // See QV8ContextWrapper::Getter for resolution order
 
-    QV8Engine *engine = wrapper->v8;
     QObject *scopeObject = wrapper->getScopeObject();
 
     QHashedV4String propertystring(Value::fromString(name));
@@ -308,13 +308,13 @@ void QmlContextWrapper::put(Managed *m, ExecutionContext *ctx, String *name, con
 
         // Search scope object
         if (scopeObject &&
-            QV4::QObjectWrapper::setQmlProperty(ctx, context, scopeObject, name, QV4::QObjectWrapper::CheckRevision, value))
+            QV4::QObjectWrapper::setQmlProperty(v4->current, context, scopeObject, name, QV4::QObjectWrapper::CheckRevision, value))
             return;
         scopeObject = 0;
 
         // Search context object
         if (context->contextObject &&
-            QV4::QObjectWrapper::setQmlProperty(ctx, context, context->contextObject, name, QV4::QObjectWrapper::CheckRevision, value))
+            QV4::QObjectWrapper::setQmlProperty(v4->current, context, context->contextObject, name, QV4::QObjectWrapper::CheckRevision, value))
             return;
 
         context = context->parent;
@@ -325,10 +325,10 @@ void QmlContextWrapper::put(Managed *m, ExecutionContext *ctx, String *name, con
     if (wrapper->readOnly) {
         QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
                         QLatin1Char('"');
-        ctx->throwError(error);
+        v4->current->throwError(error);
     }
 
-    Object::put(m, ctx, name, value);
+    Object::put(m, name, value);
 }
 
 void QmlContextWrapper::destroy(Managed *that)
index dab10c0..646135b 100644 (file)
@@ -83,7 +83,7 @@ struct Q_QML_EXPORT QmlContextWrapper : Object
     void setReadOnly(bool b) { readOnly = b; }
 
     static Value get(Managed *m, String *name, bool *hasProperty);
-    static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
+    static void put(Managed *m, String *name, const Value &value);
     static void destroy(Managed *that);
 
 
index aba6b6c..e396f70 100644 (file)
@@ -130,11 +130,10 @@ Value QmlListWrapper::getIndexed(Managed *m, uint index, bool *hasProperty)
     return Value::undefinedValue();
 }
 
-void QmlListWrapper::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value)
+void QmlListWrapper::put(Managed *m, String *name, const Value &value)
 {
     // doesn't do anything. Should we throw?
     Q_UNUSED(m);
-    Q_UNUSED(ctx);
     Q_UNUSED(name);
     Q_UNUSED(value);
 }
index 3d0a831..83624d1 100644 (file)
@@ -82,7 +82,7 @@ public:
 
     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 put(Managed *m, String *name, const Value &value);
     static Property *advanceIterator(Managed *m, ObjectIterator *it, String **name, uint *index, PropertyAttributes *attributes);
     static void destroy(Managed *that);
 
index aa03b0e..241d1f4 100644 (file)
@@ -226,13 +226,14 @@ Value QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
 }
 
 
-void QmlTypeWrapper::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value)
+void QmlTypeWrapper::put(Managed *m, String *name, const Value &value)
 {
     QmlTypeWrapper *w = m->as<QmlTypeWrapper>();
+    QV4::ExecutionEngine *v4 = m->engine();
     if (!w)
-        ctx->throwTypeError();
+        v4->current->throwTypeError();
 
-    QV8Engine *v8engine = w->v8;
+    QV8Engine *v8engine = v4->v8Engine;
     QQmlContextData *context = v8engine->callingContext();
 
     QHashedV4String propertystring(Value::fromString(name));
@@ -242,7 +243,7 @@ void QmlTypeWrapper::put(Managed *m, ExecutionContext *ctx, String *name, const
         QObject *object = w->object;
         QObject *ao = qmlAttachedPropertiesObjectById(type->attachedPropertiesId(), object);
         if (ao) 
-            QV4::QObjectWrapper::setQmlProperty(ctx, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, value);
+            QV4::QObjectWrapper::setQmlProperty(v4->current, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, value);
     } else if (type && type->isSingleton()) {
         QQmlEngine *e = v8engine->engine();
         QQmlType::SingletonInstanceInfo *siinfo = type->singletonInstanceInfo();
@@ -250,15 +251,14 @@ void QmlTypeWrapper::put(Managed *m, ExecutionContext *ctx, String *name, const
 
         QObject *qobjectSingleton = siinfo->qobjectApi(e);
         if (qobjectSingleton) {
-            QV4::QObjectWrapper::setQmlProperty(ctx, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, value);
+            QV4::QObjectWrapper::setQmlProperty(v4->current, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, value);
         } else if (!siinfo->scriptApi(e).isUndefined()) {
             QV4::Object *apiprivate = QJSValuePrivate::get(siinfo->scriptApi(e))->value.asObject();
             if (!apiprivate) {
                 QString error = QLatin1String("Cannot assign to read-only property \"") + name->toQString() + QLatin1Char('\"');
-                ctx->throwError(error);
+                v4->current->throwError(error);
             } else {
-                QV4::ExecutionEngine *engine = QV8Engine::getV4(v8engine);
-                apiprivate->put(engine->current, name, value);
+                apiprivate->put(name, value);
             }
         }
     }
index 511406d..9ad364e 100644 (file)
@@ -83,7 +83,7 @@ public:
 
 
     static Value get(Managed *m, String *name, bool *hasProperty);
-    static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
+    static void put(Managed *m, String *name, const Value &value);
     static void destroy(Managed *that);
 
 private:
index 268cdb3..388025d 100644 (file)
@@ -308,11 +308,12 @@ Value QmlValueTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
 #undef VALUE_TYPE_ACCESSOR
 }
 
-void QmlValueTypeWrapper::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value)
+void QmlValueTypeWrapper::put(Managed *m, String *name, const Value &value)
 {
     QmlValueTypeWrapper *r = m->as<QmlValueTypeWrapper>();
+    ExecutionEngine *v4 = m->engine();
     if (!r)
-        ctx->throwTypeError();
+        v4->current->throwTypeError();
 
     QByteArray propName = name->toQString().toUtf8();
     if (r->objectType == QmlValueTypeWrapper::Reference) {
@@ -335,7 +336,7 @@ void QmlValueTypeWrapper::put(Managed *m, ExecutionContext *ctx, String *name, c
             if (!f->bindingKeyFlag) {
                 // assigning a JS function to a non-var-property is not allowed.
                 QString error = QLatin1String("Cannot assign JavaScript function to value-type property");
-                ctx->throwError(r->v8->toString(error));
+                v4->current->throwError(r->v8->toString(error));
             }
 
             QQmlContextData *context = r->v8->callingContext();
@@ -349,7 +350,6 @@ void QmlValueTypeWrapper::put(Managed *m, ExecutionContext *ctx, String *name, c
             cacheData.valueTypeCoreIndex = index;
             cacheData.valueTypePropType = p.userType();
 
-            QV4::ExecutionEngine *v4 = ctx->engine;
             QV4::ExecutionEngine::StackFrame frame = v4->currentStackFrame();
 
             newBinding = new QQmlBinding(value, reference->object, context,
index d36fc80..18dca0a 100644 (file)
@@ -84,7 +84,7 @@ public:
 
 
     static Value get(Managed *m, String *name, bool *hasProperty);
-    static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
+    static void put(Managed *m, String *name, const Value &value);
     static void destroy(Managed *that);
     static bool isEqualTo(Managed *m, Managed *other);
 
index 4a36f66..26ee41d 100644 (file)
@@ -228,7 +228,7 @@ Value ArrayPrototype::method_pop(SimpleCallContext *ctx)
 
     if (!len) {
         if (!instance->isArrayObject())
-            instance->put(ctx, ctx->engine->id_length, Value::fromInt32(0));
+            instance->put(ctx->engine->id_length, Value::fromInt32(0));
         return Value::undefinedValue();
     }
 
@@ -238,7 +238,7 @@ Value ArrayPrototype::method_pop(SimpleCallContext *ctx)
     if (instance->isArrayObject())
         instance->setArrayLengthUnchecked(len - 1);
     else
-        instance->put(ctx, ctx->engine->id_length, Value::fromDouble(len - 1));
+        instance->put(ctx->engine->id_length, Value::fromDouble(len - 1));
     return result;
 }
 
@@ -252,11 +252,11 @@ Value ArrayPrototype::method_push(SimpleCallContext *ctx)
         double l = len;
         for (double i = 0; i < ctx->argumentCount; ++i) {
             Value idx = Value::fromDouble(l + i);
-            instance->put(ctx, idx.toString(ctx), ctx->argument(i));
+            instance->put(idx.toString(ctx), ctx->argument(i));
         }
         double newLen = l + ctx->argumentCount;
         if (!instance->isArrayObject())
-            instance->put(ctx, ctx->engine->id_length, Value::fromDouble(newLen));
+            instance->put(ctx->engine->id_length, Value::fromDouble(newLen));
         else
             ctx->throwRangeError(Value::fromString(ctx, QStringLiteral("Array.prototype.push: Overflow")));
         return Value::fromDouble(newLen);
@@ -293,7 +293,7 @@ Value ArrayPrototype::method_push(SimpleCallContext *ctx)
     if (instance->isArrayObject())
         instance->setArrayLengthUnchecked(len);
     else
-        instance->put(ctx, ctx->engine->id_length, Value::fromDouble(len));
+        instance->put(ctx->engine->id_length, Value::fromDouble(len));
 
     if (len < INT_MAX)
         return Value::fromInt32(len);
@@ -331,7 +331,7 @@ Value ArrayPrototype::method_shift(SimpleCallContext *ctx)
 
     if (!len) {
         if (!instance->isArrayObject())
-            instance->put(ctx, ctx->engine->id_length, Value::fromInt32(0));
+            instance->put(ctx->engine->id_length, Value::fromInt32(0));
         return Value::undefinedValue();
     }
 
@@ -378,7 +378,7 @@ Value ArrayPrototype::method_shift(SimpleCallContext *ctx)
     if (instance->isArrayObject())
         instance->setArrayLengthUnchecked(len - 1);
     else
-        instance->put(ctx, ctx->engine->id_length, Value::fromDouble(len - 1));
+        instance->put(ctx->engine->id_length, Value::fromDouble(len - 1));
     return result;
 }
 
@@ -485,7 +485,7 @@ Value ArrayPrototype::method_splice(SimpleCallContext *ctx)
         instance->putIndexed(start + i, ctx->argument(i + 2));
 
     ctx->strictMode = true;
-    instance->put(ctx, ctx->engine->id_length, Value::fromDouble(len - deleteCount + itemCount));
+    instance->put(ctx->engine->id_length, Value::fromDouble(len - deleteCount + itemCount));
 
     return Value::fromObject(newArray);
 }
@@ -539,7 +539,7 @@ Value ArrayPrototype::method_unshift(SimpleCallContext *ctx)
     if (instance->isArrayObject())
         instance->setArrayLengthUnchecked(newLen);
     else
-        instance->put(ctx, ctx->engine->id_length, Value::fromDouble(newLen));
+        instance->put(ctx->engine->id_length, Value::fromDouble(newLen));
 
     if (newLen < INT_MAX)
         return Value::fromInt32(newLen);
index 88dc30b..7ab493c 100644 (file)
@@ -312,7 +312,7 @@ void ExecutionContext::setProperty(String *name, const Value& value)
         if (ctx->type == Type_WithContext) {
             Object *w = static_cast<WithContext *>(ctx)->withObject;
             if (w->__hasProperty__(name)) {
-                w->put(ctx, name, value);
+                w->put(name, value);
                 return;
             }
         } else if (ctx->type == Type_CatchContext && static_cast<CatchContext *>(ctx)->exceptionVarName->isEqualTo(name)) {
@@ -338,14 +338,14 @@ void ExecutionContext::setProperty(String *name, const Value& value)
             }
 
             if (activation && (ctx->type == Type_QmlContext || activation->__hasProperty__(name))) {
-                activation->put(this, name, value);
+                activation->put(name, value);
                 return;
             }
         }
     }
     if (strictMode || name->isEqualTo(engine->id_this))
         throwReferenceError(Value::fromString(name));
-    engine->globalObject->put(this, name, value);
+    engine->globalObject->put(name, value);
 }
 
 Value ExecutionContext::getProperty(String *name)
index 57b241f..b4ecbb9 100644 (file)
@@ -965,7 +965,7 @@ QV4::Value JsonObject::fromJsonObject(ExecutionEngine *engine, const QJsonObject
 {
     Object *o = engine->newObject();
     for (QJsonObject::const_iterator it = object.begin(); it != object.end(); ++it)
-        o->put(engine->current, engine->newString(it.key()), fromJsonValue(engine, it.value()));
+        o->put(engine->newString(it.key()), fromJsonValue(engine, it.value()));
     return Value::fromObject(o);
 }
 
index 6061f92..2f88478 100644 (file)
@@ -107,7 +107,7 @@ struct ManagedVTable
     bool (*hasInstance)(Managed *, const Value &value);
     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 (*put)(Managed *, String *name, const Value &value);
     void (*putIndexed)(Managed *, uint index, const Value &value);
     PropertyAttributes (*query)(const Managed *, String *name);
     PropertyAttributes (*queryIndexed)(const Managed *, uint index);
@@ -264,8 +264,8 @@ public:
     Value call(ExecutionContext *context, const Value &thisObject, Value *args, int argc);
     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); }
+    void put(String *name, const Value &value)
+    { vtbl->put(this, name, value); }
     void putIndexed(uint index, const Value &value)
     { vtbl->putIndexed(this, index, value); }
     PropertyAttributes query(String *name) const
index 85171b8..f542f34 100644 (file)
@@ -128,7 +128,7 @@ void Object::destroy(Managed *that)
 
 void Object::put(ExecutionContext *ctx, const QString &name, const Value &value)
 {
-    put(ctx, ctx->engine->newString(name), value);
+    put(ctx->engine->newString(name), value);
 }
 
 Value Object::getValue(const Value &thisObject, ExecutionContext *ctx, const Property *p, PropertyAttributes attrs)
@@ -171,7 +171,7 @@ void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, String *name, const V
     Value v = get(name);
     Value result;
     op(ctx, &result, v, rhs);
-    put(ctx, name, result);
+    put(name, result);
 }
 
 void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, const Value &index, const Value &rhs)
@@ -404,9 +404,9 @@ Value Object::getIndexed(Managed *m, uint index, bool *hasProperty)
     return static_cast<Object *>(m)->internalGetIndexed(index, hasProperty);
 }
 
-void Object::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value)
+void Object::put(Managed *m, String *name, const Value &value)
 {
-    static_cast<Object *>(m)->internalPut(ctx, name, value);
+    static_cast<Object *>(m)->internalPut(name, value);
 }
 
 void Object::putIndexed(Managed *m, uint index, const Value &value)
@@ -516,7 +516,7 @@ void Object::setLookup(Managed *m, Lookup *l, const Value &value)
         }
     }
 
-    o->put(o->engine()->current, l->name, value);
+    o->put(l->name, value);
 }
 
 Property *Object::advanceIterator(Managed *m, ObjectIterator *it, String **name, uint *index, PropertyAttributes *attrs)
@@ -645,13 +645,13 @@ Value Object::internalGetIndexed(uint index, bool *hasProperty)
 
 
 // Section 8.12.5
-void Object::internalPut(ExecutionContext *ctx, String *name, const Value &value)
+void Object::internalPut(String *name, const Value &value)
 {
     uint idx = name->asArrayIndex();
     if (idx != UINT_MAX)
         return putIndexed(idx, value);
 
-    name->makeIdentifier(ctx);
+    name->makeIdentifier(engine()->current);
 
     uint member = internalClass->find(name);
     Property *pd = 0;
@@ -669,11 +669,11 @@ void Object::internalPut(ExecutionContext *ctx, String *name, const Value &value
             goto reject;
         } else if (!attrs.isWritable())
             goto reject;
-        else if (isArrayObject() && name->isEqualTo(ctx->engine->id_length)) {
+        else if (isArrayObject() && name->isEqualTo(engine()->id_length)) {
             bool ok;
             uint l = value.asArrayLength(&ok);
             if (!ok)
-                ctx->throwRangeError(value);
+                engine()->current->throwRangeError(value);
             ok = setArrayLength(l);
             if (!ok)
                 goto reject;
@@ -706,7 +706,7 @@ void Object::internalPut(ExecutionContext *ctx, String *name, const Value &value
 
         Value args[1];
         args[0] = value;
-        pd->setter()->call(ctx, Value::fromObject(this), args, 1);
+        pd->setter()->call(engine()->current, Value::fromObject(this), args, 1);
         return;
     }
 
@@ -717,11 +717,11 @@ void Object::internalPut(ExecutionContext *ctx, String *name, const Value &value
     }
 
   reject:
-    if (ctx->strictMode) {
+    if (engine()->current->strictMode) {
         QString message = QStringLiteral("Cannot assign to read-only property \"");
         message += name->toQString();
         message += QLatin1Char('\"');
-        ctx->throwTypeError(message);
+        engine()->current->throwTypeError(message);
     }
 }
 
index 287513d..dcdeca1 100644 (file)
@@ -332,7 +332,7 @@ public:
     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); }
+    { vtbl->put(this, name, v); }
     inline void putIndexed(uint idx, const Value &v)
     { vtbl->putIndexed(this, idx, v); }
     using Managed::get;
@@ -352,7 +352,7 @@ protected:
     static void markObjects(Managed *that);
     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 put(Managed *m, String *name, const Value &value);
     static void putIndexed(Managed *m, uint index, const Value &value);
     static PropertyAttributes query(const Managed *m, String *name);
     static PropertyAttributes queryIndexed(const Managed *m, uint index);
@@ -366,7 +366,7 @@ protected:
 private:
     Value internalGet(String *name, bool *hasProperty);
     Value internalGetIndexed(uint index, bool *hasProperty);
-    void internalPut(ExecutionContext *ctx, String *name, const Value &value);
+    void internalPut(String *name, const Value &value);
     void internalPutIndexed(uint index, const Value &value);
     bool internalDeleteProperty(String *name);
     bool internalDeleteIndexedProperty(uint index);
index a911c6f..2cb6a36 100644 (file)
@@ -612,18 +612,19 @@ QV4::Value QObjectWrapper::get(Managed *m, String *name, bool *hasProperty)
     return that->getQmlProperty(v4->current, qmlContext, name, IgnoreRevision, hasProperty, /*includeImports*/ true);
 }
 
-void QObjectWrapper::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value)
+void QObjectWrapper::put(Managed *m, String *name, const Value &value)
 {
     QObjectWrapper *that = static_cast<QObjectWrapper*>(m);
+    ExecutionEngine *v4 = m->engine();
 
     if (QQmlData::wasDeleted(that->m_object))
         return;
 
-    QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(ctx->engine);
-    if (!setQmlProperty(ctx, qmlContext, that->m_object, name, QV4::QObjectWrapper::IgnoreRevision, value)) {
+    QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(v4);
+    if (!setQmlProperty(v4->current, qmlContext, that->m_object, name, QV4::QObjectWrapper::IgnoreRevision, value)) {
         QString error = QLatin1String("Cannot assign to non-existent property \"") +
                         name->toQString() + QLatin1Char('\"');
-        ctx->throwError(error);
+        v4->current->throwError(error);
     }
 }
 
index 70d21a3..708c2a7 100644 (file)
@@ -106,7 +106,7 @@ private:
     String *m_toString;
 
     static Value get(Managed *m, String *name, bool *hasProperty);
-    static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
+    static void put(Managed *m, 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);
     static void markObjects(Managed *that);
index 621ed89..b359169 100644 (file)
@@ -146,7 +146,7 @@ Value RegExp::getIndexed(Managed *m, uint index, bool *hasProperty)
     return Value::undefinedValue();
 }
 
-void RegExp::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value)
+void RegExp::put(Managed *m, String *name, const Value &value)
 {
 }
 
index ff6d30c..cac4508 100644 (file)
@@ -113,7 +113,7 @@ protected:
     static void markObjects(Managed *that);
     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 put(Managed *m, String *name, const Value &value);
     static void putIndexed(Managed *m, uint index, const Value &value);
     static PropertyAttributes query(const Managed *m, String *name);
     static PropertyAttributes queryIndexed(const Managed *m, uint index);
index af4a6e7..2cff28b 100644 (file)
@@ -544,7 +544,7 @@ String *__qmljs_convert_to_string(ExecutionContext *ctx, const Value &value)
 void __qmljs_set_property(ExecutionContext *ctx, const Value &object, String *name, const Value &value)
 {
     Object *o = object.toObject(ctx);
-    o->put(ctx, name, value);
+    o->put(name, value);
 }
 
 void __qmljs_get_element(ExecutionContext *ctx, Value *result, const Value &object, const Value &index)
@@ -636,7 +636,7 @@ void __qmljs_set_element(ExecutionContext *ctx, const Value &object, const Value
     }
 
     String *name = index.toString(ctx);
-    o->put(ctx, name, value);
+    o->put(name, value);
 }
 
 void __qmljs_foreach_iterator_object(ExecutionContext *ctx, Value *result, const Value &in)
@@ -1070,7 +1070,7 @@ void __qmljs_builtin_post_increment_member(ExecutionContext *context, Value *res
         v = Value::fromDouble(d + 1);
     }
 
-    o->put(context, name, v);
+    o->put(name, v);
 }
 
 void __qmljs_builtin_post_increment_element(ExecutionContext *context, Value *result, const Value &base, const Value *index)
@@ -1150,7 +1150,7 @@ void __qmljs_builtin_post_decrement_member(ExecutionContext *context, Value *res
         v = Value::fromDouble(d - 1);
     }
 
-    o->put(context, name, v);
+    o->put(name, v);
 }
 
 void __qmljs_builtin_post_decrement_element(ExecutionContext *context, Value *result, const Value &base, const Value &index)
index ed01efa..c9e6657 100644 (file)
@@ -144,11 +144,11 @@ Value String::getIndexed(Managed *m, uint index, bool *hasProperty)
     return engine->stringPrototype->getValue(Value::fromString(that), engine->current, pd, attrs);
 }
 
-void String::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value)
+void String::put(Managed *m, String *name, const Value &value)
 {
     String *that = static_cast<String *>(m);
-    Object *o = ctx->engine->newStringObject(Value::fromString(that));
-    o->put(ctx, name, value);
+    Object *o = that->engine()->newStringObject(Value::fromString(that));
+    o->put(name, value);
 }
 
 void String::putIndexed(Managed *m, uint index, const Value &value)
index bafeb21..2a855a2 100644 (file)
@@ -122,7 +122,7 @@ protected:
     static void destroy(Managed *);
     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 put(Managed *m, String *name, const Value &value);
     static void putIndexed(Managed *m, uint index, const Value &value);
     static PropertyAttributes query(const Managed *m, String *name);
     static PropertyAttributes queryIndexed(const Managed *m, uint index);
index 4b30a3e..350a2c4 100644 (file)
@@ -358,7 +358,7 @@ Value StringPrototype::method_match(SimpleCallContext *context)
         return exec->call(context, Value::fromObject(rx), &arg, 1);
 
     String *lastIndex = context->engine->newString(QStringLiteral("lastIndex"));
-    rx->put(context, lastIndex, Value::fromInt32(0));
+    rx->put(lastIndex, Value::fromInt32(0));
     ArrayObject *a = context->engine->newArrayObject();
 
     double previousLastIndex = 0;
@@ -371,7 +371,7 @@ Value StringPrototype::method_match(SimpleCallContext *context)
         double thisIndex = rx->get(lastIndex, 0).toInteger();
         if (previousLastIndex == thisIndex) {
             previousLastIndex = thisIndex + 1;
-            rx->put(context, lastIndex, Value::fromDouble(previousLastIndex));
+            rx->put(lastIndex, Value::fromDouble(previousLastIndex));
         } else {
             previousLastIndex = thisIndex;
         }
index df54418..e45a221 100644 (file)
@@ -873,7 +873,7 @@ void QJSValue::setProperty(const QString& name, const QJSValue& value)
     QV4::ExecutionContext *ctx = engine->current;
     s->makeIdentifier(ctx);
     try {
-        o->put(ctx, s, value.d->getValue(engine));
+        o->put(s, value.d->getValue(engine));
     } catch (QV4::Exception &e) {
         e.accept(ctx);
     }
@@ -903,7 +903,7 @@ void QJSValue::setProperty(quint32 arrayIndex, const QJSValue& value)
         if (arrayIndex != UINT_MAX)
             o->putIndexed(arrayIndex, value.d->getValue(engine));
         else
-            o->put(ctx, engine->id_uintMax, value.d->getValue(engine));
+            o->put(engine->id_uintMax, value.d->getValue(engine));
     } catch (QV4::Exception &e) {
         e.accept(ctx);
     }
index 85fa271..ed38886 100644 (file)
@@ -79,7 +79,7 @@ QT_BEGIN_NAMESPACE
 #define V4THROW_DOM(error, string) { \
     QV4::Value v = QV4::Value::fromString(ctx, QStringLiteral(string)); \
     QV4::Object *ex = ctx->engine->newErrorObject(v); \
-    ex->put(ctx, ctx->engine->newIdentifier(QStringLiteral("code")), QV4::Value::fromInt32(error)); \
+    ex->put(ctx->engine->newIdentifier(QStringLiteral("code")), QV4::Value::fromInt32(error)); \
     ctx->throwError(QV4::Value::fromObject(ex)); \
 }
 
index 51edb6c..0336a16 100644 (file)
@@ -209,7 +209,7 @@ static QV4::Value objectFromVariantMap(QV8Engine *engine, const QVariantMap &map
     QV4::ExecutionEngine *e = QV8Engine::getV4(engine);
     QV4::Object *o = e->newObject();
     for (QVariantMap::ConstIterator iter = map.begin(); iter != map.end(); ++iter)
-        o->put(e->current, e->newString(iter.key()), engine->fromVariant(iter.value()));
+        o->put(e->newString(iter.key()), engine->fromVariant(iter.value()));
     return QV4::Value::fromObject(o);
 }
 
index d7d956d..5011fd4 100644 (file)
@@ -2419,7 +2419,7 @@ QV4::Value QQuickJSContext2DPrototype::method_measureText(QV4::SimpleCallContext
         QFontMetrics fm(r->context->state.font);
         uint width = fm.width(ctx->arguments[0].toQString());
         QV4::Object *tm = ctx->engine->newObject();
-        tm->put(ctx->engine->current, ctx->engine->newIdentifier(QStringLiteral("width")), QV4::Value::fromDouble(width));
+        tm->put(ctx->engine->newIdentifier(QStringLiteral("width")), QV4::Value::fromDouble(width));
         return QV4::Value::fromObject(tm);
     }
     return QV4::Value::undefinedValue();
index e30fd8d..bc95178 100644 (file)
@@ -137,7 +137,7 @@ static void showException(QV4::ExecutionContext *ctx, const QV4::Exception &exce
                 std::cerr << qPrintable(msg->buildFullMessage(ctx)->toQString()) << std::endl;
             }
         } else {
-            std::cerr << "Uncaught exception: " << qPrintable(e->get(ctx, ctx->engine->newString(QStringLiteral("message")), 0).toString(ctx)->toQString()) << std::endl;
+            std::cerr << "Uncaught exception: " << qPrintable(e->get(ctx->engine->newString(QStringLiteral("message")), 0).toString(ctx)->toQString()) << std::endl;
         }
     }
 
@@ -379,12 +379,10 @@ int main(int argc, char *argv[])
         QV4::Object *globalObject = vm.globalObject;
         QV4::Object *print = new (ctx->engine->memoryManager) builtins::Print(ctx);
         print->prototype = ctx->engine->objectPrototype;
-        globalObject->put(ctx, vm.newIdentifier(QStringLiteral("print")),
-                                  QV4::Value::fromObject(print));
+        globalObject->put(vm.newIdentifier(QStringLiteral("print")), QV4::Value::fromObject(print));
         QV4::Object *gc = new (ctx->engine->memoryManager) builtins::GC(ctx);
         gc->prototype = ctx->engine->objectPrototype;
-        globalObject->put(ctx, vm.newIdentifier(QStringLiteral("gc")),
-                                  QV4::Value::fromObject(gc));
+        globalObject->put(vm.newIdentifier(QStringLiteral("gc")), QV4::Value::fromObject(gc));
 
         foreach (const QString &fn, args) {
             QFile file(fn);