diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-05-24 12:45:13 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-05-24 12:50:11 +0200 |
commit | e598f400d88f21b07e8c50c85e367cacea5a5960 (patch) | |
tree | 788a9f0bbfb59a100f490f9bcc73f81fffff9ca6 | |
parent | be4f0622f8c0d89371e9314e2d53c246dd77871b (diff) |
Get rid of some v8 based code
Change-Id: Iee910dcc1d3148922d2f92055eb06cdb0b889502
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r-- | src/qml/qml/qqmlexpression.cpp | 11 | ||||
-rw-r--r-- | src/qml/qml/qqmlexpression_p.h | 7 | ||||
-rw-r--r-- | src/qml/qml/qqmlproperty.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlvme.cpp | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmlvmemetaobject.cpp | 42 | ||||
-rw-r--r-- | src/qml/qml/qqmlvmemetaobject_p.h | 12 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8qobjectwrapper.cpp | 4 |
7 files changed, 41 insertions, 41 deletions
diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp index 2f2bee6dea..ab22fe6134 100644 --- a/src/qml/qml/qqmlexpression.cpp +++ b/src/qml/qml/qqmlexpression.cpp @@ -47,6 +47,7 @@ #include "qqmlcontext_p.h" #include "qqmlscriptstring_p.h" #include "qqmlcompiler_p.h" +#include <private/qv8engine_p.h> #include <QtCore/qdebug.h> @@ -259,15 +260,15 @@ void QQmlExpression::setExpression(const QString &expression) } // Must be called with a valid handle scope -v8::Handle<v8::Value> QQmlExpressionPrivate::v8value(bool *isUndefined) +QV4::Value QQmlExpressionPrivate::v4value(bool *isUndefined) { if (!expressionFunctionValid) { - v8function = qmlBinding(context(), scopeObject(), expression, url, line, &v8qmlscope); + function = qmlBinding(context(), scopeObject(), expression, url, line, &qmlscope); setUseSharedContext(false); expressionFunctionValid = true; } - return evaluate(context(), v8function.value(), isUndefined); + return evaluate(context(), function.value(), isUndefined); } QVariant QQmlExpressionPrivate::value(bool *isUndefined) @@ -285,8 +286,8 @@ QVariant QQmlExpressionPrivate::value(bool *isUndefined) ep->referenceScarceResources(); // "hold" scarce resources in memory during evaluation. { - v8::Handle<v8::Value> result = v8value(isUndefined); - rv = ep->v8engine()->toVariant(result->v4Value(), -1); + QV4::Value result = v4value(isUndefined); + rv = ep->v8engine()->toVariant(result, -1); } ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete. diff --git a/src/qml/qml/qqmlexpression_p.h b/src/qml/qml/qqmlexpression_p.h index d0e819f7c3..b7f5624fb2 100644 --- a/src/qml/qml/qqmlexpression_p.h +++ b/src/qml/qml/qqmlexpression_p.h @@ -55,7 +55,6 @@ #include "qqmlexpression.h" -#include <private/qv8engine_p.h> #include <private/qqmlguard_p.h> #include <private/qqmlengine_p.h> #include <private/qfieldlist_p.h> @@ -83,7 +82,7 @@ public: QVariant value(bool *isUndefined = 0); - v8::Handle<v8::Value> v8value(bool *isUndefined = 0); + QV4::Value v4value(bool *isUndefined = 0); static inline QQmlExpressionPrivate *get(QQmlExpression *expr); static inline QQmlExpression *get(QQmlExpressionPrivate *expr); @@ -99,8 +98,8 @@ public: QString expression; - QV4::PersistentValue v8qmlscope; - QV4::PersistentValue v8function; + QV4::PersistentValue qmlscope; + QV4::PersistentValue function; QString url; // This is a QString for a reason. QUrls are slooooooow... quint16 line; diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index 56e63473e0..f48a7973a1 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -1535,7 +1535,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, QQmlVMEMetaObject *vmemo = QQmlVMEMetaObject::get(object); Q_ASSERT(vmemo); - vmemo->setVMEProperty(core.coreIndex, result); + vmemo->setVMEProperty(core.coreIndex, result->v4Value()); } else if (isUndefined && core.isResettable()) { void *args[] = { 0 }; QMetaObject::metacall(object, QMetaObject::ResetProperty, core.coreIndex, args); diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index b6067b57e5..ea1316f601 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -292,12 +292,12 @@ static QVariant variantFromString(const QString &string) #define QML_STORE_VAR(name, value) \ QML_BEGIN_INSTR(name) \ - v8::Handle<v8::Value> v8value = value; \ + QV4::Value v4value = value; \ QObject *target = objects.top(); \ CLEAN_PROPERTY(target, instr.propertyIndex); \ QQmlVMEMetaObject *vmemo = QQmlVMEMetaObject::get(target); \ Q_ASSERT(vmemo); \ - vmemo->setVMEProperty(instr.propertyIndex, v8value); \ + vmemo->setVMEProperty(instr.propertyIndex, v4value); \ QML_END_INSTR(name) #define QML_STORE_POINTER(name, value) \ diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index b22816f0fe..995b01264f 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -912,7 +912,7 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) QQmlEnginePrivate *ep = QQmlEnginePrivate::get(ctxt->engine); ep->referenceScarceResources(); // "hold" scarce resources in memory during evaluation. - QV4::FunctionObject *function = method(id)->v4Value().asFunctionObject(); + QV4::FunctionObject *function = method(id).asFunctionObject(); if (!function) { // The function was not compiled. There are some exceptional cases which the // expression rewriter does not rewrite properly (e.g., \r-terminated lines @@ -959,11 +959,11 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) return object->qt_metacall(c, _id, a); } -v8::Handle<v8::Function> QQmlVMEMetaObject::method(int index) +QV4::Value QQmlVMEMetaObject::method(int index) { if (!ctxt || !ctxt->isValid()) { qWarning("QQmlVMEMetaObject: Internal error - attempted to evaluate a function in an invalid context"); - return v8::Handle<v8::Function>(); + return QV4::Value::emptyValue(); } if (!v8methods) @@ -984,16 +984,16 @@ v8::Handle<v8::Function> QQmlVMEMetaObject::method(int index) data->lineNumber); } - return v8::Handle<v8::Function>(v8methods[index]); + return v8methods[index]; } -v8::Handle<v8::Value> QQmlVMEMetaObject::readVarProperty(int id) +QV4::Value QQmlVMEMetaObject::readVarProperty(int id) { Q_ASSERT(id >= firstVarPropertyIndex); if (ensureVarPropertiesAllocated()) return varProperties.value().asObject()->getIndexed(id - firstVarPropertyIndex); - return v8::Handle<v8::Value>(); + return QV4::Value::emptyValue(); } QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id) @@ -1012,7 +1012,7 @@ QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id) } } -void QQmlVMEMetaObject::writeVarProperty(int id, v8::Handle<v8::Value> value) +void QQmlVMEMetaObject::writeVarProperty(int id, const QV4::Value &value) { Q_ASSERT(id >= firstVarPropertyIndex); if (!ensureVarPropertiesAllocated()) @@ -1020,19 +1020,19 @@ void QQmlVMEMetaObject::writeVarProperty(int id, v8::Handle<v8::Value> value) // Importantly, if the current value is a scarce resource, we need to ensure that it // gets automatically released by the engine if no other references to it exist. - v8::Handle<v8::Value> oldv = varProperties.value().asObject()->getIndexed(id - firstVarPropertyIndex); - if (QV4::VariantObject *v = oldv->v4Value().asVariantObject()) + QV4::Value oldv = varProperties.value().asObject()->getIndexed(id - firstVarPropertyIndex); + if (QV4::VariantObject *v = oldv.asVariantObject()) v->removeVmePropertyReference(); QObject *valueObject = 0; QQmlVMEVariantQObjectPtr *guard = getQObjectGuardForProperty(id); - if (value->IsObject()) { + if (QV4::Object *o = value.asObject()) { // And, if the new value is a scarce resource, we need to ensure that it does not get // automatically released by the engine until no other references to it exist. - if (QV4::VariantObject *v = value->v4Value().asVariantObject()) { + if (QV4::VariantObject *v = o->asVariantObject()) { v->addVmePropertyReference(); - } else if (QV4::QObjectWrapper *wrapper = value->v4Value().asQObjectWrapper()) { + } else if (QV4::QObjectWrapper *wrapper = o->asQObjectWrapper()) { // We need to track this QObject to signal its deletion valueObject = wrapper->object; @@ -1049,7 +1049,7 @@ void QQmlVMEMetaObject::writeVarProperty(int id, v8::Handle<v8::Value> value) } // Write the value and emit change signal as appropriate. - varProperties.value().asObject()->putIndexed(id - firstVarPropertyIndex, value->v4Value()); + varProperties.value().asObject()->putIndexed(id - firstVarPropertyIndex, value); activate(object, methodOffset() + id, 0); } @@ -1061,19 +1061,19 @@ void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value) // Importantly, if the current value is a scarce resource, we need to ensure that it // gets automatically released by the engine if no other references to it exist. - v8::Handle<v8::Value> oldv = varProperties.value().asObject()->getIndexed(id - firstVarPropertyIndex); - if (QV4::VariantObject *v = oldv->v4Value().asVariantObject()) + QV4::Value oldv = varProperties.value().asObject()->getIndexed(id - firstVarPropertyIndex); + if (QV4::VariantObject *v = oldv.asVariantObject()) v->removeVmePropertyReference(); // And, if the new value is a scarce resource, we need to ensure that it does not get // automatically released by the engine until no other references to it exist. - v8::Handle<v8::Value> newv = QQmlEnginePrivate::get(ctxt->engine)->v8engine()->fromVariant(value); - if (QV4::VariantObject *v = newv->v4Value().asVariantObject()) + QV4::Value newv = QQmlEnginePrivate::get(ctxt->engine)->v8engine()->fromVariant(value); + if (QV4::VariantObject *v = newv.asVariantObject()) v->addVmePropertyReference(); // Write the value and emit change signal as appropriate. QVariant currentValue = readPropertyAsVariant(id); - varProperties.value().asObject()->putIndexed(id - firstVarPropertyIndex, newv->v4Value()); + varProperties.value().asObject()->putIndexed(id - firstVarPropertyIndex, newv); if ((currentValue.userType() != value.userType() || currentValue != value)) activate(object, methodOffset() + id, 0); } else { @@ -1147,7 +1147,7 @@ quint16 QQmlVMEMetaObject::vmeMethodLineNumber(int index) return data->lineNumber; } -v8::Handle<v8::Function> QQmlVMEMetaObject::vmeMethod(int index) +QV4::Value QQmlVMEMetaObject::vmeMethod(int index) { if (index < methodOffset()) { Q_ASSERT(parentVMEMetaObject()); @@ -1175,7 +1175,7 @@ void QQmlVMEMetaObject::setVmeMethod(int index, QV4::PersistentValue function) v8methods[methodIndex] = function; } -v8::Handle<v8::Value> QQmlVMEMetaObject::vmeProperty(int index) +QV4::Value QQmlVMEMetaObject::vmeProperty(int index) { if (index < propOffset()) { Q_ASSERT(parentVMEMetaObject()); @@ -1184,7 +1184,7 @@ v8::Handle<v8::Value> QQmlVMEMetaObject::vmeProperty(int index) return readVarProperty(index - propOffset()); } -void QQmlVMEMetaObject::setVMEProperty(int index, v8::Handle<v8::Value> v) +void QQmlVMEMetaObject::setVMEProperty(int index, const QV4::Value &v) { if (index < propOffset()) { Q_ASSERT(parentVMEMetaObject()); diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h index 4bc464338c..cb437683e5 100644 --- a/src/qml/qml/qqmlvmemetaobject_p.h +++ b/src/qml/qml/qqmlvmemetaobject_p.h @@ -168,11 +168,11 @@ public: bool aliasTarget(int index, QObject **target, int *coreIndex, int *valueTypeIndex) const; void registerInterceptor(int index, int valueIndex, QQmlPropertyValueInterceptor *interceptor); - v8::Handle<v8::Function> vmeMethod(int index); + QV4::Value vmeMethod(int index); quint16 vmeMethodLineNumber(int index); void setVmeMethod(int index, QV4::PersistentValue function); - v8::Handle<v8::Value> vmeProperty(int index); - void setVMEProperty(int index, v8::Handle<v8::Value> v); + QV4::Value vmeProperty(int index); + void setVMEProperty(int index, const QV4::Value &v); void connectAliasSignal(int index, bool indexInSignalRange); @@ -219,10 +219,10 @@ public: QQmlPropertyValueInterceptor *interceptors; QV4::PersistentValue *v8methods; - v8::Handle<v8::Function> method(int); + QV4::Value method(int); - v8::Handle<v8::Value> readVarProperty(int); - void writeVarProperty(int, v8::Handle<v8::Value>); + QV4::Value readVarProperty(int); + void writeVarProperty(int, const QV4::Value &); QVariant readPropertyAsVariant(int); void writeProperty(int, const QVariant &); diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp index 73d396d262..173c71acd0 100644 --- a/src/qml/qml/v8/qv8qobjectwrapper.cpp +++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp @@ -763,7 +763,7 @@ static inline void StoreProperty(QV8Engine *engine, QObject *object, QQmlPropert // allow assignment of "special" values (null, undefined, function) to var properties QQmlVMEMetaObject *vmemo = QQmlVMEMetaObject::get(object); Q_ASSERT(vmemo); - vmemo->setVMEProperty(property->coreIndex, value); + vmemo->setVMEProperty(property->coreIndex, value->v4Value()); return; } @@ -807,7 +807,7 @@ static inline void StoreProperty(QV8Engine *engine, QObject *object, QQmlPropert } else if (property->isVarProperty()) { QQmlVMEMetaObject *vmemo = QQmlVMEMetaObject::get(object); Q_ASSERT(vmemo); - vmemo->setVMEProperty(property->coreIndex, value); + vmemo->setVMEProperty(property->coreIndex, value->v4Value()); } else { QVariant v; if (property->isQList()) |