Remove all remaining usages of ValueRef
authorLars Knoll <lars.knoll@theqtcompany.com>
Thu, 15 Jan 2015 14:01:06 +0000 (15:01 +0100)
committerLars Knoll <lars.knoll@digia.com>
Fri, 23 Jan 2015 07:07:35 +0000 (08:07 +0100)
Change-Id: Icd76d3d03fac2e57530e55f8ec15b97109dcdcbc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
26 files changed:
src/qml/debugger/qv4debugservice.cpp
src/qml/jsapi/qjsvalue.cpp
src/qml/jsapi/qjsvalue_p.h
src/qml/jsruntime/qv4arraydata.cpp
src/qml/jsruntime/qv4arrayobject.cpp
src/qml/jsruntime/qv4dateobject.cpp
src/qml/jsruntime/qv4debugging_p.h
src/qml/jsruntime/qv4global_p.h
src/qml/jsruntime/qv4jsonobject.cpp
src/qml/jsruntime/qv4objectiterator.cpp
src/qml/jsruntime/qv4objectiterator_p.h
src/qml/jsruntime/qv4objectproto.cpp
src/qml/jsruntime/qv4persistent_p.h
src/qml/jsruntime/qv4runtime.cpp
src/qml/jsruntime/qv4scopedvalue_p.h
src/qml/jsruntime/qv4stringobject.cpp
src/qml/jsruntime/qv4value.cpp
src/qml/jsruntime/qv4value_p.h
src/qml/qml/qqmlobjectcreator.cpp
src/qml/qml/qqmlvmemetaobject.cpp
src/qml/qml/qqmlvmemetaobject_p.h
src/qml/qml/v8/qv8engine_p.h
src/quick/items/context2d/qquickcontext2d.cpp
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
tools/qmljs/qmljs.cpp

index 79c384e..09c6ec1 100644 (file)
@@ -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) {
index ac47e2b..d57b8dc 100644 (file)
@@ -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);
     }
index 83dbe82..13ee107 100644 (file)
@@ -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);
index 3157a41..68c289a 100644 (file)
@@ -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());
index d3c16bc..e4403f5 100644 (file)
@@ -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]);
         }
     }
 
index fde0818..423c369 100644 (file)
@@ -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()))
index 5780dc7..a88b017 100644 (file)
@@ -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;
 
index 5378cc9..0d1ed71 100644 (file)
@@ -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;
index ffeaa1b..1423c4a 100644 (file)
@@ -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()) {
index 2ce5c98..641efc5 100644 (file)
@@ -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();
index cee7024..1c65ac6 100644 (file)
@@ -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();
 };
 
index b3302d2..64d5f56 100644 (file)
@@ -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();
     }
index 02d4007..b57d639 100644 (file)
@@ -114,8 +114,6 @@ public:
     bool isEmpty() { return !val; }
 
 private:
-    friend struct ValueRef;
-
     Value *val;
 };
 
index fdff795..73ae88f 100644 (file)
@@ -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();
index d72d23b..81b81f6 100644 (file)
@@ -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)
index ed4d702..dad3cf0 100644 (file)
@@ -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());
index 0f81c94..b3ca1fb 100644 (file)
@@ -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
index 22f0e1e..3bd986f 100644 (file)
@@ -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
 {
index 69b68be..dc359f7 100644 (file)
@@ -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));
index 3c078ea..b816083 100644 (file)
@@ -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)
index b9cdc0a..6725a0b 100644 (file)
@@ -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);
 
index 25f599c..298b97d 100644 (file)
@@ -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; }
index d38299b..7d5362b 100644 (file)
@@ -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();
index a73e717..8931c2f 100644 (file)
@@ -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 ") +
index 628cd14..3690d2d 100644 (file)
@@ -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);
index 2309069..c557b9b 100644 (file)
@@ -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;