aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-15 15:01:06 +0100
committerLars Knoll <lars.knoll@digia.com>2015-01-23 08:07:35 +0100
commit13cf87fa93b584091a51d775953074db9df1b453 (patch)
treedef0d8107e1a152faff71b31902eaade14531e12
parent002a5d4303b3b182ae4abc4a752c49787c1c2821 (diff)
Remove all remaining usages of ValueRef
Change-Id: Icd76d3d03fac2e57530e55f8ec15b97109dcdcbc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/qml/debugger/qv4debugservice.cpp4
-rw-r--r--src/qml/jsapi/qjsvalue.cpp4
-rw-r--r--src/qml/jsapi/qjsvalue_p.h2
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp2
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4debugging_p.h2
-rw-r--r--src/qml/jsruntime/qv4global_p.h1
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp20
-rw-r--r--src/qml/jsruntime/qv4objectiterator.cpp8
-rw-r--r--src/qml/jsruntime/qv4objectiterator_p.h4
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp6
-rw-r--r--src/qml/jsruntime/qv4persistent_p.h2
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp2
-rw-r--r--src/qml/jsruntime/qv4scopedvalue_p.h21
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4value.cpp8
-rw-r--r--src/qml/jsruntime/qv4value_p.h57
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp4
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp4
-rw-r--r--src/qml/qml/qqmlvmemetaobject_p.h2
-rw-r--r--src/qml/qml/v8/qv8engine_p.h8
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp4
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp8
-rw-r--r--tests/auto/qml/qv4debugger/tst_qv4debugger.cpp4
-rw-r--r--tools/qmljs/qmljs.cpp4
26 files changed, 53 insertions, 134 deletions
diff --git a/src/qml/debugger/qv4debugservice.cpp b/src/qml/debugger/qv4debugservice.cpp
index 79c384ead9..09c6ec127b 100644
--- a/src/qml/debugger/qv4debugservice.cpp
+++ b/src/qml/debugger/qv4debugservice.cpp
@@ -227,10 +227,10 @@ protected:
addHandle(name, o, QStringLiteral("string"));
}
- virtual void addObject(const QString &name, QV4::ValueRef value)
+ virtual void addObject(const QString &name, const QV4::Value &value)
{
QV4::Scope scope(engine());
- QV4::ScopedObject obj(scope, value->asObject());
+ QV4::ScopedObject obj(scope, value.asObject());
int ref = cachedObjectRef(obj);
if (ref != -1) {
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index ac47e2b5c2..d57b8dcc16 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -205,7 +205,7 @@ QJSValue::QJSValue(const QJSValue& other)
{
QV4::Value *v = QJSValuePrivate::getValue(&other);
if (v) {
- QJSValuePrivate::setValue(this, QJSValuePrivate::engine(&other), v);
+ QJSValuePrivate::setValue(this, QJSValuePrivate::engine(&other), *v);
} else if (QVariant *v = QJSValuePrivate::getVariant(&other)) {
QJSValuePrivate::setVariant(this, *v);
}
@@ -854,7 +854,7 @@ QJSValue& QJSValue::operator=(const QJSValue& other)
QV4::Value *v = QJSValuePrivate::getValue(&other);
if (v) {
- QJSValuePrivate::setValue(this, QJSValuePrivate::engine(&other), v);
+ QJSValuePrivate::setValue(this, QJSValuePrivate::engine(&other), *v);
} else if (QVariant *v = QJSValuePrivate::getVariant(&other)) {
QJSValuePrivate::setVariant(this, *v);
}
diff --git a/src/qml/jsapi/qjsvalue_p.h b/src/qml/jsapi/qjsvalue_p.h
index 83dbe82f76..13ee107846 100644
--- a/src/qml/jsapi/qjsvalue_p.h
+++ b/src/qml/jsapi/qjsvalue_p.h
@@ -79,7 +79,7 @@ public:
jsval->d = reinterpret_cast<quintptr>(val) | 1;
}
- static inline void setValue(QJSValue *jsval, QV4::ExecutionEngine *engine, QV4::ValueRef v) {
+ static inline void setValue(QJSValue *jsval, QV4::ExecutionEngine *engine, const QV4::Value &v) {
QV4::Value *value = engine->memoryManager->m_persistentValues->allocate();
*value = v;
jsval->d = reinterpret_cast<quintptr>(value);
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index 3157a41d21..68c289a52d 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -587,7 +587,7 @@ uint ArrayData::append(Object *obj, ArrayObject *otherObj, uint n)
} else {
for (const SparseArrayNode *it = other->d()->sparse->begin();
it != os->sparse->end(); it = it->nextNode())
- obj->arraySet(oldSize + it->key(), ValueRef(os->arrayData[it->value]));
+ obj->arraySet(oldSize + it->key(), os->arrayData[it->value]);
}
} else {
Heap::SimpleArrayData *os = static_cast<Heap::SimpleArrayData *>(other->d());
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index d3c16bc2c0..e4403f5a57 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -166,7 +166,7 @@ ReturnedValue ArrayPrototype::method_concat(CallContext *ctx)
result->putIndexed(startIndex + i, entry);
}
} else {
- result->arraySet(result->getLength(), ValueRef(ctx->d()->callData->args[i]));
+ result->arraySet(result->getLength(), ctx->d()->callData->args[i]);
}
}
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index fde0818f0e..423c36963f 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -1292,7 +1292,7 @@ ReturnedValue DatePrototype::method_toISOString(CallContext *ctx)
ReturnedValue DatePrototype::method_toJSON(CallContext *ctx)
{
Scope scope(ctx);
- ScopedValue O(scope, RuntimeHelpers::toObject(scope.engine, ValueRef(&ctx->d()->callData->thisObject)));
+ ScopedValue O(scope, RuntimeHelpers::toObject(scope.engine, ctx->d()->callData->thisObject));
ScopedValue tv(scope, RuntimeHelpers::toPrimitive(O, NUMBER_HINT));
if (tv->isNumber() && !std::isfinite(tv->toNumber()))
diff --git a/src/qml/jsruntime/qv4debugging_p.h b/src/qml/jsruntime/qv4debugging_p.h
index 5780dc7c0d..a88b017019 100644
--- a/src/qml/jsruntime/qv4debugging_p.h
+++ b/src/qml/jsruntime/qv4debugging_p.h
@@ -104,7 +104,7 @@ public:
virtual void addNull(const QString &name) = 0;
virtual void addBoolean(const QString &name, bool value) = 0;
virtual void addString(const QString &name, const QString &value) = 0;
- virtual void addObject(const QString &name, ValueRef value) = 0;
+ virtual void addObject(const QString &name, const Value &value) = 0;
virtual void addInteger(const QString &name, int value) = 0;
virtual void addDouble(const QString &name, double value) = 0;
diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h
index 5378cc92df..0d1ed71da1 100644
--- a/src/qml/jsruntime/qv4global_p.h
+++ b/src/qml/jsruntime/qv4global_p.h
@@ -190,7 +190,6 @@ typedef quint64 ReturnedValue;
struct CallData;
struct Scope;
struct ScopedValue;
-struct ValueRef;
template<typename T> struct Scoped;
typedef Scoped<String> ScopedString;
typedef Scoped<Object> ScopedObject;
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index ffeaa1b1db..1423c4ac6a 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -77,8 +77,8 @@ private:
ReturnedValue parseArray();
bool parseMember(Object *o);
bool parseString(QString *string);
- bool parseValue(ValueRef val);
- bool parseNumber(ValueRef val);
+ bool parseValue(Value *val);
+ bool parseNumber(Value *val);
ExecutionEngine *engine;
const QChar *head;
@@ -344,7 +344,7 @@ value = false / null / true / object / array / number / string
*/
-bool JsonParser::parseValue(ValueRef val)
+bool JsonParser::parseValue(Value *val)
{
BEGIN << "parse Value" << *json;
@@ -401,7 +401,7 @@ bool JsonParser::parseValue(ValueRef val)
return false;
DEBUG << "value: string";
END;
- val = Value::fromHeapObject(engine->newString(value));
+ *val = Value::fromHeapObject(engine->newString(value));
return true;
}
case BeginArray: {
@@ -452,7 +452,7 @@ bool JsonParser::parseValue(ValueRef val)
*/
-bool JsonParser::parseNumber(ValueRef val)
+bool JsonParser::parseNumber(Value *val)
{
BEGIN << "parseNumber" << *json;
@@ -651,11 +651,11 @@ struct Stringify
Stringify(ExecutionContext *ctx) : ctx(ctx), replacerFunction(0) {}
- QString Str(const QString &key, ValueRef v);
+ QString Str(const QString &key, const Value &v);
QString JA(ArrayObject *a);
QString JO(Object *o);
- QString makeMember(const QString &key, ValueRef v);
+ QString makeMember(const QString &key, const Value &v);
};
static QString quote(const QString &str)
@@ -699,11 +699,11 @@ static QString quote(const QString &str)
return product;
}
-QString Stringify::Str(const QString &key, ValueRef v)
+QString Stringify::Str(const QString &key, const Value &v)
{
Scope scope(ctx);
- ScopedValue value(scope, *v);
+ ScopedValue value(scope, v);
ScopedObject o(scope, value);
if (o) {
ScopedString s(scope, ctx->d()->engine->newString(QStringLiteral("toJSON")));
@@ -762,7 +762,7 @@ QString Stringify::Str(const QString &key, ValueRef v)
return QString();
}
-QString Stringify::makeMember(const QString &key, ValueRef v)
+QString Stringify::makeMember(const QString &key, const Value &v)
{
QString strP = Str(key, v);
if (!strP.isEmpty()) {
diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp
index 2ce5c98316..641efc5615 100644
--- a/src/qml/jsruntime/qv4objectiterator.cpp
+++ b/src/qml/jsruntime/qv4objectiterator.cpp
@@ -129,7 +129,7 @@ void ObjectIterator::next(Heap::String **name, uint *index, Property *pd, Proper
*attrs = PropertyAttributes();
}
-ReturnedValue ObjectIterator::nextPropertyName(ValueRef value)
+ReturnedValue ObjectIterator::nextPropertyName(Value *value)
{
if (!object->asObject())
return Encode::null();
@@ -143,7 +143,7 @@ ReturnedValue ObjectIterator::nextPropertyName(ValueRef value)
if (attrs.isEmpty())
return Encode::null();
- value = object->objectValue()->getValue(p, attrs);
+ *value = object->objectValue()->getValue(p, attrs);
if (!!name)
return name->asReturnedValue();
@@ -151,7 +151,7 @@ ReturnedValue ObjectIterator::nextPropertyName(ValueRef value)
return Encode(index);
}
-ReturnedValue ObjectIterator::nextPropertyNameAsString(ValueRef value)
+ReturnedValue ObjectIterator::nextPropertyNameAsString(Value *value)
{
if (!object->asObject())
return Encode::null();
@@ -165,7 +165,7 @@ ReturnedValue ObjectIterator::nextPropertyNameAsString(ValueRef value)
if (attrs.isEmpty())
return Encode::null();
- value = object->objectValue()->getValue(p, attrs);
+ *value = object->objectValue()->getValue(p, attrs);
if (!!name)
return name->asReturnedValue();
diff --git a/src/qml/jsruntime/qv4objectiterator_p.h b/src/qml/jsruntime/qv4objectiterator_p.h
index cee7024df8..1c65ac6c0d 100644
--- a/src/qml/jsruntime/qv4objectiterator_p.h
+++ b/src/qml/jsruntime/qv4objectiterator_p.h
@@ -60,8 +60,8 @@ struct Q_QML_EXPORT ObjectIterator
ObjectIterator(Scope &scope, Object *o, uint flags);
void init(Object *o);
void next(Heap::String **name, uint *index, Property *pd, PropertyAttributes *attributes = 0);
- ReturnedValue nextPropertyName(ValueRef value);
- ReturnedValue nextPropertyNameAsString(ValueRef value);
+ ReturnedValue nextPropertyName(Value *value);
+ ReturnedValue nextPropertyNameAsString(Value *value);
ReturnedValue nextPropertyNameAsString();
};
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index b3302d214d..64d5f5641c 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -66,7 +66,7 @@ ReturnedValue ObjectCtor::construct(Managed *that, CallData *callData)
obj->setPrototype(proto);
return obj.asReturnedValue();
}
- return RuntimeHelpers::toObject(scope.engine, ValueRef(&callData->args[0]));
+ return RuntimeHelpers::toObject(scope.engine, callData->args[0]);
}
ReturnedValue ObjectCtor::call(Managed *m, CallData *callData)
@@ -75,7 +75,7 @@ ReturnedValue ObjectCtor::call(Managed *m, CallData *callData)
ExecutionEngine *v4 = ctor->engine();
if (!callData->argc || callData->args[0].isUndefined() || callData->args[0].isNull())
return v4->newObject()->asReturnedValue();
- return RuntimeHelpers::toObject(v4, ValueRef(&callData->args[0]));
+ return RuntimeHelpers::toObject(v4, callData->args[0]);
}
void ObjectPrototype::init(ExecutionEngine *v4, Object *ctor)
@@ -390,7 +390,7 @@ ReturnedValue ObjectPrototype::method_toString(CallContext *ctx)
} else if (ctx->d()->callData->thisObject.isNull()) {
return ctx->d()->engine->newString(QStringLiteral("[object Null]"))->asReturnedValue();
} else {
- ScopedObject obj(scope, RuntimeHelpers::toObject(scope.engine, ValueRef(&ctx->d()->callData->thisObject)));
+ ScopedObject obj(scope, RuntimeHelpers::toObject(scope.engine, ctx->d()->callData->thisObject));
QString className = obj->className();
return ctx->d()->engine->newString(QString::fromLatin1("[object %1]").arg(className))->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4persistent_p.h b/src/qml/jsruntime/qv4persistent_p.h
index 02d4007f62..b57d6398ed 100644
--- a/src/qml/jsruntime/qv4persistent_p.h
+++ b/src/qml/jsruntime/qv4persistent_p.h
@@ -114,8 +114,6 @@ public:
bool isEmpty() { return !val; }
private:
- friend struct ValueRef;
-
Value *val;
};
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index fdff79538c..73ae88f80c 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -960,7 +960,7 @@ ReturnedValue Runtime::callProperty(ExecutionEngine *engine, int nameIndex, Call
return engine->throwTypeError(message);
}
- baseObject = RuntimeHelpers::convertToObject(scope.engine, ValueRef(&callData->thisObject));
+ baseObject = RuntimeHelpers::convertToObject(scope.engine, callData->thisObject);
if (!baseObject) // type error
return Encode::undefined();
callData->thisObject = baseObject.asReturnedValue();
diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h
index d72d23bbe9..81b81f6c5c 100644
--- a/src/qml/jsruntime/qv4scopedvalue_p.h
+++ b/src/qml/jsruntime/qv4scopedvalue_p.h
@@ -105,8 +105,6 @@ private:
Q_DISABLE_COPY(Scope)
};
-struct ValueRef;
-
struct ScopedValue
{
ScopedValue(const Scope &scope)
@@ -460,25 +458,6 @@ inline TypedValue<T> &TypedValue<T>::operator=(const TypedValue<T> &t)
return *this;
}
-inline ValueRef::ValueRef(const ScopedValue &v)
- : ptr(v.ptr)
-{}
-
-template <typename T>
-inline ValueRef::ValueRef(const Scoped<T> &v)
- : ptr(v.ptr)
-{}
-
-inline ValueRef::ValueRef(const PersistentValue &v)
- : ptr(v.val)
-{}
-
-inline ValueRef &ValueRef::operator=(const ScopedValue &o)
-{
- *ptr = *o.ptr;
- return *this;
-}
-
struct ScopedProperty
{
ScopedProperty(Scope &scope)
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index ed4d70270c..dad3cf0ebc 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -287,7 +287,7 @@ ReturnedValue StringPrototype::method_concat(CallContext *context)
ScopedValue v(scope);
for (int i = 0; i < context->d()->callData->argc; ++i) {
- v = RuntimeHelpers::toString(scope.engine, ValueRef(&context->d()->callData->args[i]));
+ v = RuntimeHelpers::toString(scope.engine, context->d()->callData->args[i]);
if (scope.hasException())
return Encode::undefined();
Q_ASSERT(v->isString());
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp
index 0f81c94f24..b3ca1fb268 100644
--- a/src/qml/jsruntime/qv4value.cpp
+++ b/src/qml/jsruntime/qv4value.cpp
@@ -128,7 +128,7 @@ QString Value::toQStringNoThrow() const
Scope scope(objectValue()->engine());
ScopedValue ex(scope);
bool caughtException = false;
- ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), STRING_HINT));
+ ScopedValue prim(scope, RuntimeHelpers::toPrimitive(*this, STRING_HINT));
if (scope.hasException()) {
ex = scope.engine->catchException();
caughtException = true;
@@ -179,7 +179,7 @@ QString Value::toQString() const
{
Q_ASSERT(isObject());
Scope scope(objectValue()->engine());
- ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), STRING_HINT));
+ ScopedValue prim(scope, RuntimeHelpers::toPrimitive(*this, STRING_HINT));
return prim->toQString();
}
case Value::Integer_Type: {
@@ -271,14 +271,14 @@ Heap::String *Value::toString(ExecutionEngine *e) const
{
if (isString())
return stringValue()->d();
- return RuntimeHelpers::convertToString(e, ValueRef::fromRawValue(this));
+ return RuntimeHelpers::convertToString(e, *this);
}
Heap::Object *Value::toObject(ExecutionEngine *e) const
{
if (isObject())
return objectValue()->d();
- return RuntimeHelpers::convertToObject(e, ValueRef::fromRawValue(this));
+ return RuntimeHelpers::convertToObject(e, *this);
}
#endif // V4_BOOTSTRAP
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index 22f0e1e4d5..3bd986ff8e 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -420,8 +420,6 @@ struct Q_QML_PRIVATE_EXPORT Primitive : public Value
static double toInteger(double fromNumber);
static int toInt32(double value);
static unsigned int toUInt32(double value);
-
- inline operator ValueRef();
};
inline Primitive Primitive::undefinedValue()
@@ -518,61 +516,6 @@ private:
Encode(void *);
};
-struct ValueRef {
- ValueRef(const ScopedValue &v);
- template <typename T>
- ValueRef(const Scoped<T> &v);
- ValueRef(const PersistentValue &v);
- ValueRef(Value &v) { ptr = &v; }
- // Important: Do NOT add a copy constructor to this class
- // adding a copy constructor actually changes the calling convention, ie.
- // is not even binary compatible. Adding it would break assumptions made
- // in the jit'ed code.
- ValueRef &operator=(const ScopedValue &o);
- ValueRef &operator=(const Value &v)
- { *ptr = v; return *this; }
- ValueRef &operator=(const ReturnedValue &v) {
- ptr->val = v;
- return *this;
- }
-
- operator const Value *() const {
- return ptr;
- }
- const Value *operator->() const {
- return ptr;
- }
-
- operator Value &() { return *ptr; }
- operator const Value &() const { return *ptr; }
-
- operator Value *() {
- return ptr;
- }
- Value *operator->() {
- return ptr;
- }
-
- static ValueRef fromRawValue(Value *v) {
- return ValueRef(v);
- }
- static const Value &fromRawValue(const Value *v) {
- return ValueRef(const_cast<Value *>(v));
- }
-
- ReturnedValue asReturnedValue() const { return ptr->val; }
-
- // ### get rid of this one!
- ValueRef(Value *v) { ptr = v; }
-private:
- Value *ptr;
-};
-
-inline Primitive::operator ValueRef()
-{
- return ValueRef(this);
-}
-
inline
ReturnedValue Heap::Base::asReturnedValue() const
{
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 69b68be8a3..dc359f7fa5 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -1171,8 +1171,8 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
Q_ASSERT(sharedState->allJavaScriptObjects);
- QV4::ValueRef ref = QV4::ValueRef::fromRawValue(sharedState->allJavaScriptObjects++);
- ref = QV4::QObjectWrapper::wrap(v4, instance);
+ *sharedState->allJavaScriptObjects = QV4::QObjectWrapper::wrap(v4, instance);
+ ++sharedState->allJavaScriptObjects;
QV4::Scope valueScope(v4);
QV4::ScopedObject qmlScope(valueScope, QV4::QmlContextWrapper::qmlScope(v4, context, _scopeObject));
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index 3c078ea42a..b816083a52 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -1170,7 +1170,7 @@ QV4::ReturnedValue QQmlVMEMetaObject::vmeMethod(int index)
}
// Used by debugger
-void QQmlVMEMetaObject::setVmeMethod(int index, QV4::ValueRef function)
+void QQmlVMEMetaObject::setVmeMethod(int index, const QV4::Value &function)
{
if (index < methodOffset()) {
Q_ASSERT(parentVMEMetaObject());
@@ -1183,7 +1183,7 @@ void QQmlVMEMetaObject::setVmeMethod(int index, QV4::ValueRef function)
v8methods = new QV4::PersistentValue[metaData->methodCount];
int methodIndex = index - methodOffset() - plainSignals;
- v8methods[methodIndex].set(function->asObject()->engine(), function);
+ v8methods[methodIndex].set(function.asObject()->engine(), function);
}
QV4::ReturnedValue QQmlVMEMetaObject::vmeProperty(int index)
diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h
index b9cdc0a8cd..6725a0b6d6 100644
--- a/src/qml/qml/qqmlvmemetaobject_p.h
+++ b/src/qml/qml/qqmlvmemetaobject_p.h
@@ -160,7 +160,7 @@ public:
void registerInterceptor(int index, int valueIndex, QQmlPropertyValueInterceptor *interceptor);
QV4::ReturnedValue vmeMethod(int index);
quint16 vmeMethodLineNumber(int index);
- void setVmeMethod(int index, QV4::ValueRef function);
+ void setVmeMethod(int index, const QV4::Value &function);
QV4::ReturnedValue vmeProperty(int index);
void setVMEProperty(int index, const QV4::Value &v);
diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h
index 25f599ca72..298b97d1e9 100644
--- a/src/qml/qml/v8/qv8engine_p.h
+++ b/src/qml/qml/v8/qv8engine_p.h
@@ -121,7 +121,7 @@ public:
QV4::ReturnedValue operator[](int idx) { return (idx < callData->argc ? callData->args[idx].asReturnedValue() : QV4::Encode::undefined()); }
QQmlContextData *context() { return ctx; }
QV4::ReturnedValue qmlGlobal() { return callData->thisObject.asReturnedValue(); }
- void setReturnValue(QV4::ReturnedValue rv) { retVal = rv; }
+ void setReturnValue(QV4::ReturnedValue rv) { *retVal = rv; }
QV4::ExecutionEngine *v4engine() const { return e; }
private:
friend struct QV4::QObjectMethod;
@@ -129,7 +129,7 @@ private:
QQmlV4Function(const QQmlV4Function &);
QQmlV4Function &operator=(const QQmlV4Function &);
- QQmlV4Function(QV4::CallData *callData, QV4::ValueRef retVal,
+ QQmlV4Function(QV4::CallData *callData, QV4::Value *retVal,
const QV4::Value &global, QQmlContextData *c, QV4::ExecutionEngine *e)
: callData(callData), retVal(retVal), ctx(c), e(e)
{
@@ -137,7 +137,7 @@ private:
}
QV4::CallData *callData;
- QV4::ValueRef retVal;
+ QV4::Value *retVal;
QQmlContextData *ctx;
QV4::ExecutionEngine *e;
};
@@ -146,7 +146,7 @@ class Q_QML_PRIVATE_EXPORT QQmlV4Handle
{
public:
QQmlV4Handle() : d(QV4::Encode::undefined()) {}
- explicit QQmlV4Handle(QV4::ValueRef v) : d(v.asReturnedValue()) {}
+ explicit QQmlV4Handle(const QV4::Value &v) : d(v.asReturnedValue()) {}
explicit QQmlV4Handle(QV4::ReturnedValue v) : d(v) {}
operator QV4::ReturnedValue() const { return d; }
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index d38299bb4d..7d5362b078 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -124,9 +124,9 @@ static const double Q_PI = 3.14159265358979323846; // pi
V4THROW_ERROR("Not a Context2D object");
#define qClamp(val, min, max) qMin(qMax(val, min), max)
#define CHECK_RGBA(c) (c == '-' || c == '.' || (c >=0 && c <= 9))
-QColor qt_color_from_string(const QV4::ValueRef name)
+QColor qt_color_from_string(const QV4::Value &name)
{
- QByteArray str = name->toQString().toUtf8();
+ QByteArray str = name.toQString().toUtf8();
char *p = str.data();
int len = str.length();
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index a73e71764a..8931c2fd15 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -2297,7 +2297,7 @@ void tst_qqmlecmascript::regExpBug()
}
}
-static inline bool evaluate_error(QV8Engine *engine, const QV4::ValueRef o, const char *source)
+static inline bool evaluate_error(QV8Engine *engine, const QV4::Value &o, const char *source)
{
QString functionSource = QLatin1String("(function(object) { return ") +
QLatin1String(source) + QLatin1String(" })");
@@ -2322,8 +2322,8 @@ static inline bool evaluate_error(QV8Engine *engine, const QV4::ValueRef o, cons
return false;
}
-static inline bool evaluate_value(QV8Engine *engine, const QV4::ValueRef o,
- const char *source, const QV4::ValueRef result)
+static inline bool evaluate_value(QV8Engine *engine, const QV4::Value &o,
+ const char *source, const QV4::Value &result)
{
QString functionSource = QLatin1String("(function(object) { return ") +
QLatin1String(source) + QLatin1String(" })");
@@ -2352,7 +2352,7 @@ static inline bool evaluate_value(QV8Engine *engine, const QV4::ValueRef o,
return QV4::Runtime::strictEqual(value, result);
}
-static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::ValueRef o,
+static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::Value &o,
const char *source)
{
QString functionSource = QLatin1String("(function(object) { return ") +
diff --git a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
index 628cd143cf..3690d2d4ed 100644
--- a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
+++ b/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
@@ -128,10 +128,10 @@ protected:
destination->insert(name, value);
}
- virtual void addObject(const QString &name, QV4::ValueRef value)
+ virtual void addObject(const QString &name, const QV4::Value &value)
{
QV4::Scope scope(engine());
- QV4::ScopedObject obj(scope, value->asObject());
+ QV4::ScopedObject obj(scope, value.asObject());
QVariantMap props, *prev = &props;
qSwap(destination, prev);
diff --git a/tools/qmljs/qmljs.cpp b/tools/qmljs/qmljs.cpp
index 2309069114..c557b9bb50 100644
--- a/tools/qmljs/qmljs.cpp
+++ b/tools/qmljs/qmljs.cpp
@@ -109,10 +109,10 @@ DEFINE_OBJECT_VTABLE(GC);
} // builtins
-static void showException(QV4::ExecutionContext *ctx, const QV4::ValueRef exception, const QV4::StackTrace &trace)
+static void showException(QV4::ExecutionContext *ctx, const QV4::Value &exception, const QV4::StackTrace &trace)
{
QV4::Scope scope(ctx);
- QV4::ScopedValue ex(scope, *exception);
+ QV4::ScopedValue ex(scope, exception);
QV4::ErrorObject *e = ex->asErrorObject();
if (!e) {
std::cerr << "Uncaught exception: " << qPrintable(ex->toQString()) << std::endl;