From 57f08e59fcc289742fe88ee45b82b52b26dbf945 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 7 May 2014 16:14:08 +0200 Subject: Get rid of all uses of ObjectRef Change-Id: I705e2362dcda542f56826dadec6b0a6f15848788 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4arraydata.cpp | 6 ++-- src/qml/jsruntime/qv4arraydata_p.h | 2 +- src/qml/jsruntime/qv4arrayobject.cpp | 2 +- src/qml/jsruntime/qv4arrayobject_p.h | 2 +- src/qml/jsruntime/qv4booleanobject.cpp | 2 +- src/qml/jsruntime/qv4booleanobject_p.h | 2 +- src/qml/jsruntime/qv4context.cpp | 14 ++++----- src/qml/jsruntime/qv4context_p.h | 10 +++---- src/qml/jsruntime/qv4dateobject.cpp | 2 +- src/qml/jsruntime/qv4dateobject_p.h | 2 +- src/qml/jsruntime/qv4debugging.cpp | 2 +- src/qml/jsruntime/qv4debugging_p.h | 2 +- src/qml/jsruntime/qv4engine.cpp | 32 ++++++++++----------- src/qml/jsruntime/qv4engine_p.h | 2 +- src/qml/jsruntime/qv4errorobject.cpp | 2 +- src/qml/jsruntime/qv4errorobject_p.h | 16 +++++------ src/qml/jsruntime/qv4functionobject.cpp | 2 +- src/qml/jsruntime/qv4functionobject_p.h | 2 +- src/qml/jsruntime/qv4global_p.h | 1 - src/qml/jsruntime/qv4jsonobject.cpp | 14 ++++----- src/qml/jsruntime/qv4jsonobject_p.h | 4 +-- src/qml/jsruntime/qv4numberobject.cpp | 2 +- src/qml/jsruntime/qv4numberobject_p.h | 2 +- src/qml/jsruntime/qv4object_p.h | 15 ---------- src/qml/jsruntime/qv4objectiterator.cpp | 50 ++++++++++++++++----------------- src/qml/jsruntime/qv4objectiterator_p.h | 14 ++++----- src/qml/jsruntime/qv4objectproto.cpp | 2 +- src/qml/jsruntime/qv4objectproto_p.h | 2 +- src/qml/jsruntime/qv4regexpobject.cpp | 2 +- src/qml/jsruntime/qv4regexpobject_p.h | 2 +- src/qml/jsruntime/qv4runtime.cpp | 2 +- src/qml/jsruntime/qv4scopedvalue_p.h | 2 -- src/qml/jsruntime/qv4script.cpp | 10 +++---- src/qml/jsruntime/qv4script_p.h | 12 ++++---- src/qml/jsruntime/qv4sequenceobject.cpp | 4 +-- src/qml/jsruntime/qv4sequenceobject_p.h | 4 +-- src/qml/jsruntime/qv4stringobject.cpp | 2 +- src/qml/jsruntime/qv4stringobject_p.h | 2 +- src/qml/qml/qqmlcomponent.cpp | 2 +- src/qml/qml/qqmltypeloader.cpp | 2 +- src/qml/qml/v8/qv8engine.cpp | 5 ++-- src/qml/qml/v8/qv8engine_p.h | 4 +-- src/qml/types/qqmllistmodel.cpp | 12 ++++---- src/qml/types/qqmllistmodel_p_p.h | 12 ++++---- 44 files changed, 135 insertions(+), 154 deletions(-) diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp index 3b9b2cbd26..fbc404878e 100644 --- a/src/qml/jsruntime/qv4arraydata.cpp +++ b/src/qml/jsruntime/qv4arraydata.cpp @@ -633,14 +633,14 @@ Property *ArrayData::insert(Object *o, uint index, bool isAccessor) class ArrayElementLessThan { public: - inline ArrayElementLessThan(ExecutionContext *context, ObjectRef thisObject, const ValueRef comparefn) + inline ArrayElementLessThan(ExecutionContext *context, Object *thisObject, const ValueRef comparefn) : m_context(context), thisObject(thisObject), m_comparefn(comparefn) {} bool operator()(const Value &v1, const Value &v2) const; private: ExecutionContext *m_context; - ObjectRef thisObject; + Object *thisObject; const ValueRef m_comparefn; }; @@ -670,7 +670,7 @@ bool ArrayElementLessThan::operator()(const Value &v1, const Value &v2) const return p1s->toQString() < p2s->toQString(); } -void ArrayData::sort(ExecutionContext *context, ObjectRef thisObject, const ValueRef comparefn, uint len) +void ArrayData::sort(ExecutionContext *context, Object *thisObject, const ValueRef comparefn, uint len) { if (!len) return; diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h index a5524da4f9..fb748ef031 100644 --- a/src/qml/jsruntime/qv4arraydata_p.h +++ b/src/qml/jsruntime/qv4arraydata_p.h @@ -144,7 +144,7 @@ struct Q_QML_EXPORT ArrayData : public Managed static void ensureAttributes(Object *o); static void realloc(Object *o, Type newType, uint offset, uint alloc, bool enforceAttributes); - static void sort(ExecutionContext *context, ObjectRef thisObject, const ValueRef comparefn, uint dataLen); + static void sort(ExecutionContext *context, Object *thisObject, const ValueRef comparefn, uint dataLen); static uint append(Object *obj, const ArrayObject *otherObj, uint n); static Property *insert(Object *o, uint index, bool isAccessor = false); }; diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index e65ec2c019..1b0a5bf723 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -89,7 +89,7 @@ ArrayPrototype::ArrayPrototype(InternalClass *ic) { } -void ArrayPrototype::init(ExecutionEngine *engine, ObjectRef ctor) +void ArrayPrototype::init(ExecutionEngine *engine, Object *ctor) { Scope scope(engine); ScopedObject o(scope); diff --git a/src/qml/jsruntime/qv4arrayobject_p.h b/src/qml/jsruntime/qv4arrayobject_p.h index e7f8ba711f..341b7be581 100644 --- a/src/qml/jsruntime/qv4arrayobject_p.h +++ b/src/qml/jsruntime/qv4arrayobject_p.h @@ -62,7 +62,7 @@ struct ArrayPrototype: ArrayObject { ArrayPrototype(InternalClass *ic); - void init(ExecutionEngine *engine, ObjectRef ctor); + void init(ExecutionEngine *engine, Object *ctor); static ReturnedValue method_isArray(CallContext *ctx); static ReturnedValue method_toString(CallContext *ctx); diff --git a/src/qml/jsruntime/qv4booleanobject.cpp b/src/qml/jsruntime/qv4booleanobject.cpp index f1b4bbc901..305f80a415 100644 --- a/src/qml/jsruntime/qv4booleanobject.cpp +++ b/src/qml/jsruntime/qv4booleanobject.cpp @@ -66,7 +66,7 @@ ReturnedValue BooleanCtor::call(Managed *, CallData *callData) return Encode(value); } -void BooleanPrototype::init(ExecutionEngine *engine, ObjectRef ctor) +void BooleanPrototype::init(ExecutionEngine *engine, Object *ctor) { Scope scope(engine); ScopedObject o(scope); diff --git a/src/qml/jsruntime/qv4booleanobject_p.h b/src/qml/jsruntime/qv4booleanobject_p.h index 617f7f6b01..3dc4a3d59e 100644 --- a/src/qml/jsruntime/qv4booleanobject_p.h +++ b/src/qml/jsruntime/qv4booleanobject_p.h @@ -61,7 +61,7 @@ struct BooleanCtor: FunctionObject struct BooleanPrototype: BooleanObject { BooleanPrototype(InternalClass *ic): BooleanObject(ic) {} - void init(ExecutionEngine *engine, ObjectRef ctor); + void init(ExecutionEngine *engine, Object *ctor); static ReturnedValue method_toString(CallContext *ctx); static ReturnedValue method_valueOf(CallContext *ctx); diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index 91fdfc8554..3f4bd72a7e 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -86,7 +86,7 @@ CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData return c; } -WithContext *ExecutionContext::newWithContext(ObjectRef with) +WithContext *ExecutionContext::newWithContext(Object *with) { WithContext *w = new (d()->engine->memoryManager) WithContext(d()->engine, with); return w; @@ -98,7 +98,7 @@ CatchContext *ExecutionContext::newCatchContext(String *exceptionVarName, const return c; } -CallContext *ExecutionContext::newQmlContext(FunctionObject *f, ObjectRef qml) +CallContext *ExecutionContext::newQmlContext(FunctionObject *f, Object *qml) { CallContext *c = static_cast(d()->engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(f, 0))); new (c) CallContext(d()->engine, qml, f); @@ -140,7 +140,7 @@ GlobalContext::GlobalContext(ExecutionEngine *eng) d()->global = eng->globalObject; } -WithContext::WithContext(ExecutionEngine *engine, ObjectRef with) +WithContext::WithContext(ExecutionEngine *engine, Object *with) : ExecutionContext(engine, Type_WithContext) { d()->callData = d()->parent->d()->callData; @@ -148,7 +148,7 @@ WithContext::WithContext(ExecutionEngine *engine, ObjectRef with) d()->lookups = d()->parent->d()->lookups; d()->compilationUnit = d()->parent->d()->compilationUnit; - d()->withObject = with.getPointer(); + d()->withObject = with; } CatchContext::CatchContext(ExecutionEngine *engine, String *exceptionVarName, const ValueRef exceptionValue) @@ -164,7 +164,7 @@ CatchContext::CatchContext(ExecutionEngine *engine, String *exceptionVarName, co this->d()->exceptionValue = exceptionValue; } -CallContext::CallContext(ExecutionEngine *engine, ObjectRef qml, FunctionObject *function) +CallContext::CallContext(ExecutionEngine *engine, Object *qml, FunctionObject *function) : ExecutionContext(engine, Type_QmlContext) { this->function = function; @@ -176,7 +176,7 @@ CallContext::CallContext(ExecutionEngine *engine, ObjectRef qml, FunctionObject d()->strictMode = true; d()->outer = function->scope(); - activation = qml.getPointer(); + activation = qml; if (function->function()) { d()->compilationUnit = function->function()->compilationUnit; @@ -404,7 +404,7 @@ ReturnedValue ExecutionContext::getProperty(String *name) return throwReferenceError(n); } -ReturnedValue ExecutionContext::getPropertyAndBase(String *name, ObjectRef base) +ReturnedValue ExecutionContext::getPropertyAndBase(String *name, Object *&base) { Scope scope(this); ScopedValue v(scope); diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index cea6499f00..beb3368b3b 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -138,9 +138,9 @@ struct Q_QML_EXPORT ExecutionContext : public Managed } CallContext *newCallContext(FunctionObject *f, CallData *callData); - WithContext *newWithContext(ObjectRef with); + WithContext *newWithContext(Object *with); CatchContext *newCatchContext(String *exceptionVarName, const ValueRef exceptionValue); - CallContext *newQmlContext(FunctionObject *f, ObjectRef qml); + CallContext *newQmlContext(FunctionObject *f, Object *qml); void createMutableBinding(String *name, bool deletable); @@ -159,7 +159,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed void setProperty(String *name, const ValueRef value); ReturnedValue getProperty(String *name); - ReturnedValue getPropertyAndBase(String *name, ObjectRef base); + ReturnedValue getPropertyAndBase(String *name, Object *&base); bool deleteProperty(String *name); // Can only be called from within catch(...), rethrows if no JS exception. @@ -180,7 +180,7 @@ struct CallContext : public ExecutionContext locals = 0; activation = 0; } - CallContext(ExecutionEngine *engine, ObjectRef qml, QV4::FunctionObject *function); + CallContext(ExecutionEngine *engine, Object *qml, QV4::FunctionObject *function); FunctionObject *function; int realArgumentCount; @@ -239,7 +239,7 @@ struct WithContext : public ExecutionContext } __data; V4_MANAGED - WithContext(ExecutionEngine *engine, ObjectRef with); + WithContext(ExecutionEngine *engine, Object *with); }; inline CallContext *ExecutionContext::asCallContext() diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index 13e6bda8e5..b27d08eb8c 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -707,7 +707,7 @@ ReturnedValue DateCtor::call(Managed *m, CallData *) return m->engine()->newString(ToString(t))->asReturnedValue(); } -void DatePrototype::init(ExecutionEngine *engine, ObjectRef ctor) +void DatePrototype::init(ExecutionEngine *engine, Object *ctor) { Scope scope(engine); ScopedObject o(scope); diff --git a/src/qml/jsruntime/qv4dateobject_p.h b/src/qml/jsruntime/qv4dateobject_p.h index 505891b2c6..85e85e29ed 100644 --- a/src/qml/jsruntime/qv4dateobject_p.h +++ b/src/qml/jsruntime/qv4dateobject_p.h @@ -94,7 +94,7 @@ struct DateCtor: FunctionObject struct DatePrototype: DateObject { DatePrototype(InternalClass *ic): DateObject(ic) {} - void init(ExecutionEngine *engine, ObjectRef ctor); + void init(ExecutionEngine *engine, Object *ctor); static double getThisDate(ExecutionContext *ctx); diff --git a/src/qml/jsruntime/qv4debugging.cpp b/src/qml/jsruntime/qv4debugging.cpp index 59b7c5fb9c..f2a95fc5fc 100644 --- a/src/qml/jsruntime/qv4debugging.cpp +++ b/src/qml/jsruntime/qv4debugging.cpp @@ -726,7 +726,7 @@ void Debugger::Collector::collect(const QString &name, const ScopedValue &value) } } -void Debugger::Collector::collect(const ObjectRef object) +void Debugger::Collector::collect(Object *object) { bool property = true; qSwap(property, m_isProperty); diff --git a/src/qml/jsruntime/qv4debugging_p.h b/src/qml/jsruntime/qv4debugging_p.h index 47a7d77b28..f834b8d15f 100644 --- a/src/qml/jsruntime/qv4debugging_p.h +++ b/src/qml/jsruntime/qv4debugging_p.h @@ -105,7 +105,7 @@ public: virtual ~Collector(); void collect(const QString &name, const ScopedValue &value); - void collect(const ObjectRef object); + void collect(Object *object); protected: virtual void addUndefined(const QString &name) = 0; diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 148e4fc214..2f64ce48bc 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -347,21 +347,21 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) typeErrorCtor = new (memoryManager) TypeErrorCtor(rootContext); uRIErrorCtor = new (memoryManager) URIErrorCtor(rootContext); - objectPrototype->init(this, objectCtor); - stringPrototype->init(this, stringCtor); - numberPrototype->init(this, numberCtor); - booleanPrototype->init(this, booleanCtor); - arrayPrototype->init(this, arrayCtor); - datePrototype->init(this, dateCtor); - functionPrototype->init(this, functionCtor); - regExpPrototype->init(this, regExpCtor); - errorPrototype->init(this, errorCtor); - evalErrorPrototype->init(this, evalErrorCtor); - rangeErrorPrototype->init(this, rangeErrorCtor); - referenceErrorPrototype->init(this, referenceErrorCtor); - syntaxErrorPrototype->init(this, syntaxErrorCtor); - typeErrorPrototype->init(this, typeErrorCtor); - uRIErrorPrototype->init(this, uRIErrorCtor); + objectPrototype->init(this, objectCtor.asObject()); + stringPrototype->init(this, stringCtor.asObject()); + numberPrototype->init(this, numberCtor.asObject()); + booleanPrototype->init(this, booleanCtor.asObject()); + arrayPrototype->init(this, arrayCtor.asObject()); + datePrototype->init(this, dateCtor.asObject()); + functionPrototype->init(this, functionCtor.asObject()); + regExpPrototype->init(this, regExpCtor.asObject()); + errorPrototype->init(this, errorCtor.asObject()); + evalErrorPrototype->init(this, evalErrorCtor.asObject()); + rangeErrorPrototype->init(this, rangeErrorCtor.asObject()); + referenceErrorPrototype->init(this, referenceErrorCtor.asObject()); + syntaxErrorPrototype->init(this, syntaxErrorCtor.asObject()); + typeErrorPrototype->init(this, typeErrorCtor.asObject()); + uRIErrorPrototype->init(this, uRIErrorCtor.asObject()); variantPrototype->init(); static_cast(sequencePrototype.managed())->init(); @@ -660,7 +660,7 @@ Returned *ExecutionEngine::newVariantObject(const QVariant &v) return o->asReturned(); } -Returned *ExecutionEngine::newForEachIteratorObject(ExecutionContext *ctx, const ObjectRef o) +Returned *ExecutionEngine::newForEachIteratorObject(ExecutionContext *ctx, Object *o) { Object *obj = new (memoryManager) ForEachIteratorObject(ctx, o); return obj->asReturned(); diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 3ad25c0521..8d8527e3da 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -342,7 +342,7 @@ public: Returned *newVariantObject(const QVariant &v); - Returned *newForEachIteratorObject(ExecutionContext *ctx, const ObjectRef o); + Returned *newForEachIteratorObject(ExecutionContext *ctx, Object *o); Returned *qmlContextObject() const; diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index 5b3ffdec76..666353fa6e 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -355,7 +355,7 @@ ReturnedValue URIErrorCtor::construct(Managed *m, CallData *callData) return (new (m->engine()->memoryManager) URIErrorObject(scope.engine, v))->asReturnedValue(); } -void ErrorPrototype::init(ExecutionEngine *engine, ObjectRef ctor, Object *obj) +void ErrorPrototype::init(ExecutionEngine *engine, Object *ctor, Object *obj) { Scope scope(engine); ScopedString s(scope); diff --git a/src/qml/jsruntime/qv4errorobject_p.h b/src/qml/jsruntime/qv4errorobject_p.h index bf8a90fac4..949ac3b3ae 100644 --- a/src/qml/jsruntime/qv4errorobject_p.h +++ b/src/qml/jsruntime/qv4errorobject_p.h @@ -187,46 +187,46 @@ struct ErrorPrototype: ErrorObject { // ### shouldn't be undefined ErrorPrototype(InternalClass *ic): ErrorObject(ic) {} - void init(ExecutionEngine *engine, ObjectRef ctor) { init(engine, ctor, this); } + void init(ExecutionEngine *engine, Object *ctor) { init(engine, ctor, this); } - static void init(ExecutionEngine *engine, ObjectRef ctor, Object *obj); + static void init(ExecutionEngine *engine, Object *ctor, Object *obj); static ReturnedValue method_toString(CallContext *ctx); }; struct EvalErrorPrototype: ErrorObject { EvalErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(staticVTable()); } - void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); } + void init(ExecutionEngine *engine, Object *ctor) { ErrorPrototype::init(engine, ctor, this); } }; struct RangeErrorPrototype: ErrorObject { RangeErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(staticVTable()); } - void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); } + void init(ExecutionEngine *engine, Object *ctor) { ErrorPrototype::init(engine, ctor, this); } }; struct ReferenceErrorPrototype: ErrorObject { ReferenceErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(staticVTable()); } - void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); } + void init(ExecutionEngine *engine, Object *ctor) { ErrorPrototype::init(engine, ctor, this); } }; struct SyntaxErrorPrototype: ErrorObject { SyntaxErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(staticVTable()); } - void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); } + void init(ExecutionEngine *engine, Object *ctor) { ErrorPrototype::init(engine, ctor, this); } }; struct TypeErrorPrototype: ErrorObject { TypeErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(staticVTable()); } - void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); } + void init(ExecutionEngine *engine, Object *ctor) { ErrorPrototype::init(engine, ctor, this); } }; struct URIErrorPrototype: ErrorObject { URIErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(staticVTable()); } - void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); } + void init(ExecutionEngine *engine, Object *ctor) { ErrorPrototype::init(engine, ctor, this); } }; diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 571a85de61..7fef9f700e 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -254,7 +254,7 @@ FunctionPrototype::FunctionPrototype(InternalClass *ic) { } -void FunctionPrototype::init(ExecutionEngine *engine, ObjectRef ctor) +void FunctionPrototype::init(ExecutionEngine *engine, Object *ctor) { Scope scope(engine); ScopedObject o(scope); diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 181125acbd..824743bbb3 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -178,7 +178,7 @@ struct FunctionCtor: FunctionObject struct FunctionPrototype: FunctionObject { FunctionPrototype(InternalClass *ic); - void init(ExecutionEngine *engine, ObjectRef ctor); + void init(ExecutionEngine *engine, Object *ctor); static ReturnedValue method_toString(CallContext *ctx); static ReturnedValue method_apply(CallContext *ctx); diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h index 331b9a7245..b601f0a668 100644 --- a/src/qml/jsruntime/qv4global_p.h +++ b/src/qml/jsruntime/qv4global_p.h @@ -164,7 +164,6 @@ typedef Returned ReturnedString; typedef Returned ReturnedObject; typedef Returned ReturnedFunctionObject; struct ManagedRef; -struct ObjectRef; struct PersistentValuePrivate; class PersistentValue; diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index 752d647072..dc8bd7ac1c 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -81,7 +81,7 @@ private: ReturnedValue parseObject(); ReturnedValue parseArray(); - bool parseMember(ObjectRef o); + bool parseMember(Object *o); bool parseString(QString *string); bool parseValue(ValueRef val); bool parseNumber(ValueRef val); @@ -268,7 +268,7 @@ ReturnedValue JsonParser::parseObject() /* member = string name-separator value */ -bool JsonParser::parseMember(ObjectRef o) +bool JsonParser::parseMember(Object *o) { BEGIN << "parseMember"; Scope scope(context); @@ -657,7 +657,7 @@ struct Stringify QString Str(const QString &key, ValueRef v); QString JA(ArrayObject *a); - QString JO(ObjectRef o); + QString JO(Object *o); QString makeMember(const QString &key, ValueRef v); }; @@ -780,9 +780,9 @@ QString Stringify::makeMember(const QString &key, ValueRef v) return QString(); } -QString Stringify::JO(ObjectRef o) +QString Stringify::JO(Object *o) { - if (stack.contains(o.getPointer())) { + if (stack.contains(o)) { ctx->throwTypeError(); return QString(); } @@ -790,7 +790,7 @@ QString Stringify::JO(ObjectRef o) Scope scope(ctx); QString result; - stack.push(o.getPointer()); + stack.push(o); QString stepback = indent; indent += gap; @@ -1013,7 +1013,7 @@ QV4::ReturnedValue JsonObject::fromJsonObject(ExecutionEngine *engine, const QJs return o.asReturnedValue(); } -QJsonObject JsonObject::toJsonObject(ObjectRef o, V4ObjectSet &visitedObjects) +QJsonObject JsonObject::toJsonObject(Object *o, V4ObjectSet &visitedObjects) { QJsonObject result; if (!o || o->asFunctionObject()) diff --git a/src/qml/jsruntime/qv4jsonobject_p.h b/src/qml/jsruntime/qv4jsonobject_p.h index b42c63a9ce..34a0c744ed 100644 --- a/src/qml/jsruntime/qv4jsonobject_p.h +++ b/src/qml/jsruntime/qv4jsonobject_p.h @@ -67,14 +67,14 @@ public: static inline QJsonValue toJsonValue(const QV4::ValueRef value) { V4ObjectSet visitedObjects; return toJsonValue(value, visitedObjects); } - static inline QJsonObject toJsonObject(QV4::ObjectRef o) + static inline QJsonObject toJsonObject(QV4::Object *o) { V4ObjectSet visitedObjects; return toJsonObject(o, visitedObjects); } static inline QJsonArray toJsonArray(QV4::ArrayObject *a) { V4ObjectSet visitedObjects; return toJsonArray(a, visitedObjects); } private: static QJsonValue toJsonValue(const QV4::ValueRef value, V4ObjectSet &visitedObjects); - static QJsonObject toJsonObject(QV4::ObjectRef o, V4ObjectSet &visitedObjects); + static QJsonObject toJsonObject(Object *o, V4ObjectSet &visitedObjects); static QJsonArray toJsonArray(ArrayObject *a, V4ObjectSet &visitedObjects); }; diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp index 426f2c7861..1c8552cf03 100644 --- a/src/qml/jsruntime/qv4numberobject.cpp +++ b/src/qml/jsruntime/qv4numberobject.cpp @@ -71,7 +71,7 @@ ReturnedValue NumberCtor::call(Managed *, CallData *callData) return Encode(dbl); } -void NumberPrototype::init(ExecutionEngine *engine, ObjectRef ctor) +void NumberPrototype::init(ExecutionEngine *engine, Object *ctor) { Scope scope(engine); ScopedObject o(scope); diff --git a/src/qml/jsruntime/qv4numberobject_p.h b/src/qml/jsruntime/qv4numberobject_p.h index ccabcf6727..6a7b54e815 100644 --- a/src/qml/jsruntime/qv4numberobject_p.h +++ b/src/qml/jsruntime/qv4numberobject_p.h @@ -61,7 +61,7 @@ struct NumberCtor: FunctionObject struct NumberPrototype: NumberObject { NumberPrototype(InternalClass *ic): NumberObject(ic) {} - void init(ExecutionEngine *engine, ObjectRef ctor); + void init(ExecutionEngine *engine, Object *ctor); static ReturnedValue method_toString(CallContext *ctx); static ReturnedValue method_toLocaleString(CallContext *ctx); diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index b9a95c625b..19105b18d3 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -453,21 +453,6 @@ inline ReturnedValue value_convert(ExecutionEngine *e, const Value &v) } #endif -struct ObjectRef : public ManagedRef -{ - DEFINE_REF_METHODS(Object, Managed) - - static ObjectRef fromValuePointer(Value *s) { - ObjectRef r; - r.ptr = s; - if (sizeof(void *) == 8) - r.ptr->val = 0; - else - *r.ptr = Value::fromManaged(0); - return r; - } -}; - } QT_END_NAMESPACE diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp index ff17d8fb20..581380a1fd 100644 --- a/src/qml/jsruntime/qv4objectiterator.cpp +++ b/src/qml/jsruntime/qv4objectiterator.cpp @@ -46,35 +46,35 @@ using namespace QV4; -ObjectIterator::ObjectIterator(Value *scratch1, Value *scratch2, const ObjectRef o, uint flags) - : object(ObjectRef::fromValuePointer(scratch1)) - , current(ObjectRef::fromValuePointer(scratch2)) +ObjectIterator::ObjectIterator(Value *scratch1, Value *scratch2, Object *o, uint flags) + : object(scratch1) + , current(scratch2) , arrayNode(0) , arrayIndex(0) , memberIndex(0) , flags(flags) { - object = o.getPointer(); - current = o.getPointer(); + object->o = o; + current->o = o; - if (!!object && object->asArgumentsObject()) { + if (object->as()) { Scope scope(object->engine()); Scoped (scope, object->asReturnedValue())->fullyCreate(); } } -ObjectIterator::ObjectIterator(Scope &scope, const ObjectRef o, uint flags) - : object(ObjectRef::fromValuePointer(scope.alloc(1))) - , current(ObjectRef::fromValuePointer(scope.alloc(1))) +ObjectIterator::ObjectIterator(Scope &scope, Object *o, uint flags) + : object(scope.alloc(1)) + , current(scope.alloc(1)) , arrayNode(0) , arrayIndex(0) , memberIndex(0) , flags(flags) { - object = o; - current = o; + object->o = o; + current->o = o; - if (!!object && object->asArgumentsObject()) { + if (object->as()) { Scope scope(object->engine()); Scoped (scope, object->asReturnedValue())->fullyCreate(); } @@ -85,24 +85,24 @@ void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttr name = (String *)0; *index = UINT_MAX; - if (!object) { + if (!object->asObject()) { *attrs = PropertyAttributes(); return; } while (1) { - if (!current) + if (!current->asObject()) break; while (1) { - current->advanceIterator(this, name, index, pd, attrs); + current->asObject()->advanceIterator(this, name, index, pd, attrs); if (attrs->isEmpty()) break; // check the property is not already defined earlier in the proto chain - if (current != object) { - Object *o = object; + if (current->asObject() != object->asObject()) { + Object *o = object->asObject(); bool shadowed = false; - while (o != current) { + while (o != current->asObject()) { if ((!!name && o->hasOwnProperty(name)) || (*index != UINT_MAX && o->hasOwnProperty(*index))) { shadowed = true; @@ -117,9 +117,9 @@ void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttr } if (flags & WithProtoChain) - current = current->prototype(); + current->o = current->objectValue()->prototype(); else - current = (Object *)0; + current->o = (Object *)0; arrayIndex = 0; memberIndex = 0; @@ -129,7 +129,7 @@ void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttr ReturnedValue ObjectIterator::nextPropertyName(ValueRef value) { - if (!object) + if (!object->asObject()) return Encode::null(); PropertyAttributes attrs; @@ -143,7 +143,7 @@ ReturnedValue ObjectIterator::nextPropertyName(ValueRef value) if (attrs.isEmpty()) return Encode::null(); - value = object->getValue(&p, attrs); + value = object->objectValue()->getValue(&p, attrs); if (!!name) return name->asReturnedValue(); @@ -153,7 +153,7 @@ ReturnedValue ObjectIterator::nextPropertyName(ValueRef value) ReturnedValue ObjectIterator::nextPropertyNameAsString(ValueRef value) { - if (!object) + if (!object->asObject()) return Encode::null(); PropertyAttributes attrs; @@ -167,7 +167,7 @@ ReturnedValue ObjectIterator::nextPropertyNameAsString(ValueRef value) if (attrs.isEmpty()) return Encode::null(); - value = object->getValue(&p, attrs); + value = object->objectValue()->getValue(&p, attrs); if (!!name) return name->asReturnedValue(); @@ -177,7 +177,7 @@ ReturnedValue ObjectIterator::nextPropertyNameAsString(ValueRef value) ReturnedValue ObjectIterator::nextPropertyNameAsString() { - if (!object) + if (!object->asObject()) return Encode::null(); PropertyAttributes attrs; diff --git a/src/qml/jsruntime/qv4objectiterator_p.h b/src/qml/jsruntime/qv4objectiterator_p.h index 8ee2ae4e4f..6a8431913d 100644 --- a/src/qml/jsruntime/qv4objectiterator_p.h +++ b/src/qml/jsruntime/qv4objectiterator_p.h @@ -67,15 +67,15 @@ struct Q_QML_EXPORT ObjectIterator WithProtoChain = 0x2, }; - ObjectRef object; - ObjectRef current; + Value *object; + Value *current; SparseArrayNode *arrayNode; uint arrayIndex; uint memberIndex; uint flags; - ObjectIterator(Value *scratch1, Value *scratch2, const ObjectRef o, uint flags); - ObjectIterator(Scope &scope, const ObjectRef o, uint flags); + ObjectIterator(Value *scratch1, Value *scratch2, Object *o, uint flags); + ObjectIterator(Scope &scope, Object *o, uint flags); void next(String *&name, uint *index, Property *pd, PropertyAttributes *attributes = 0); ReturnedValue nextPropertyName(ValueRef value); ReturnedValue nextPropertyNameAsString(ValueRef value); @@ -84,13 +84,13 @@ struct Q_QML_EXPORT ObjectIterator struct ForEachIteratorObject: Object { struct Data : Object::Data { - Data(const ObjectRef o, uint flags) + Data(Object *o, uint flags) : it(workArea, workArea + 1, o, flags) {} ObjectIterator it; Value workArea[2]; }; struct _Data { - _Data(const ObjectRef o, uint flags) + _Data(Object *o, uint flags) : it(workArea, workArea + 1, o, flags) {} ObjectIterator it; Value workArea[2]; @@ -98,7 +98,7 @@ struct ForEachIteratorObject: Object { V4_OBJECT Q_MANAGED_TYPE(ForeachIteratorObject) - ForEachIteratorObject(ExecutionContext *ctx, const ObjectRef o) + ForEachIteratorObject(ExecutionContext *ctx, Object *o) : Object(ctx->d()->engine) , __data(o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain) { setVTable(staticVTable()); diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 05ad95b400..3d9d2ee271 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -102,7 +102,7 @@ ReturnedValue ObjectCtor::call(Managed *m, CallData *callData) return RuntimeHelpers::toObject(m->engine()->currentContext(), ValueRef(&callData->args[0])); } -void ObjectPrototype::init(ExecutionEngine *v4, ObjectRef ctor) +void ObjectPrototype::init(ExecutionEngine *v4, Object *ctor) { Scope scope(v4); ScopedObject o(scope, this); diff --git a/src/qml/jsruntime/qv4objectproto_p.h b/src/qml/jsruntime/qv4objectproto_p.h index 2b9974be06..3f7c21ef2c 100644 --- a/src/qml/jsruntime/qv4objectproto_p.h +++ b/src/qml/jsruntime/qv4objectproto_p.h @@ -62,7 +62,7 @@ struct ObjectPrototype: Object { ObjectPrototype(InternalClass *ic) : Object(ic) {} - void init(ExecutionEngine *engine, ObjectRef ctor); + void init(ExecutionEngine *engine, Object *ctor); static ReturnedValue method_getPrototypeOf(CallContext *ctx); static ReturnedValue method_getOwnPropertyDescriptor(CallContext *ctx); diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index 5c6c067944..2406fa223d 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -312,7 +312,7 @@ void RegExpCtor::markObjects(Managed *that, ExecutionEngine *e) FunctionObject::markObjects(that, e); } -void RegExpPrototype::init(ExecutionEngine *engine, ObjectRef ctor) +void RegExpPrototype::init(ExecutionEngine *engine, Object *ctor) { Scope scope(engine); ScopedObject o(scope); diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h index 90827c1293..f6d2f66f6a 100644 --- a/src/qml/jsruntime/qv4regexpobject_p.h +++ b/src/qml/jsruntime/qv4regexpobject_p.h @@ -141,7 +141,7 @@ struct RegExpCtor: FunctionObject struct RegExpPrototype: RegExpObject { RegExpPrototype(InternalClass *ic): RegExpObject(ic) {} - void init(ExecutionEngine *engine, ObjectRef ctor); + void init(ExecutionEngine *engine, Object *ctor); static ReturnedValue method_exec(CallContext *ctx); static ReturnedValue method_test(CallContext *ctx); diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 3aca34e086..72d60e492f 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -889,7 +889,7 @@ ReturnedValue Runtime::callActivationProperty(ExecutionContext *context, String Scope scope(context); ScopedObject base(scope); - ScopedValue func(scope, context->getPropertyAndBase(name, base)); + ScopedValue func(scope, context->getPropertyAndBase(name, base.ptr->o)); if (scope.engine->hasException) return Encode::undefined(); diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h index 82f7e1f17e..13a1f33610 100644 --- a/src/qml/jsruntime/qv4scopedvalue_p.h +++ b/src/qml/jsruntime/qv4scopedvalue_p.h @@ -382,8 +382,6 @@ struct ScopedCallData { }; -struct ObjectRef; - template inline Scoped::Scoped(const Scope &scope, const ValueRef &v) { diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index a7d3845d41..6627aa216b 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -61,7 +61,7 @@ using namespace QV4; -QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, Function *f, ObjectRef qml) +QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, Function *f, Object *qml) : FunctionObject(scope, scope->d()->engine->id_eval, /*createProto = */ false) { d()->qml = qml; @@ -83,7 +83,7 @@ QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, Function *f, Objec scope->d()->engine->popContext(); } -QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, ObjectRef qml) +QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, Object *qml) : FunctionObject(scope, scope->d()->engine->id_eval, /*createProto = */ false) { d()->qml = qml; @@ -197,9 +197,9 @@ struct CompilationUnitHolder : public Object DEFINE_OBJECT_VTABLE(CompilationUnitHolder); -Script::Script(ExecutionEngine *v4, ObjectRef qml, CompiledData::CompilationUnit *compilationUnit) +Script::Script(ExecutionEngine *v4, Object *qml, CompiledData::CompilationUnit *compilationUnit) : line(0), column(0), scope(v4->rootContext), strictMode(false), inheritContext(true), parsed(false) - , qml(qml.asReturnedValue()), vmFunction(0), parseAsBinding(true) + , qml(qml->asReturnedValue()), vmFunction(0), parseAsBinding(true) { parsed = true; @@ -413,7 +413,7 @@ ReturnedValue Script::qmlBinding() return v.asReturnedValue(); } -QV4::ReturnedValue Script::evaluate(ExecutionEngine *engine, const QString &script, ObjectRef scopeObject) +QV4::ReturnedValue Script::evaluate(ExecutionEngine *engine, const QString &script, Object *scopeObject) { QV4::Scope scope(engine); QV4::Script qmlScript(engine, scopeObject, script, QString()); diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h index 8b15479f88..02fa82e282 100644 --- a/src/qml/jsruntime/qv4script_p.h +++ b/src/qml/jsruntime/qv4script_p.h @@ -67,9 +67,9 @@ struct Q_QML_EXPORT QmlBindingWrapper : FunctionObject { V4_OBJECT - QmlBindingWrapper(ExecutionContext *scope, Function *f, ObjectRef qml); + QmlBindingWrapper(ExecutionContext *scope, Function *f, Object *qml); // Constructor for QML functions and signal handlers, resulting binding wrapper is not callable! - QmlBindingWrapper(ExecutionContext *scope, ObjectRef qml); + QmlBindingWrapper(ExecutionContext *scope, Object *qml); static ReturnedValue call(Managed *that, CallData *); static void markObjects(Managed *m, ExecutionEngine *e); @@ -87,11 +87,11 @@ struct Q_QML_EXPORT Script { : sourceFile(source), line(line), column(column), sourceCode(sourceCode) , scope(scope), strictMode(false), inheritContext(false), parsed(false) , vmFunction(0), parseAsBinding(false) {} - Script(ExecutionEngine *engine, ObjectRef qml, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0) + Script(ExecutionEngine *engine, Object *qml, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0) : sourceFile(source), line(line), column(column), sourceCode(sourceCode) , scope(engine->rootContext), strictMode(false), inheritContext(true), parsed(false) - , qml(qml.asReturnedValue()), vmFunction(0), parseAsBinding(true) {} - Script(ExecutionEngine *engine, ObjectRef qml, CompiledData::CompilationUnit *compilationUnit); + , qml(qml->asReturnedValue()), vmFunction(0), parseAsBinding(true) {} + Script(ExecutionEngine *engine, Object *qml, CompiledData::CompilationUnit *compilationUnit); ~Script(); QString sourceFile; int line; @@ -114,7 +114,7 @@ struct Q_QML_EXPORT Script { static QV4::CompiledData::CompilationUnit *precompile(IR::Module *module, Compiler::JSUnitGenerator *unitGenerator, ExecutionEngine *engine, const QUrl &url, const QString &source, QList *reportedErrors = 0); - static ReturnedValue evaluate(ExecutionEngine *engine, const QString &script, ObjectRef scopeObject); + static ReturnedValue evaluate(ExecutionEngine *engine, const QString &script, Object *scopeObject); }; } diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index 9842c063cf..9d300b353f 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -636,7 +636,7 @@ ReturnedValue SequencePrototype::fromVariant(QV4::ExecutionEngine *engine, const return list->toVariant(); \ else -QVariant SequencePrototype::toVariant(ObjectRef object) +QVariant SequencePrototype::toVariant(Object *object) { Q_ASSERT(object->isListType()); FOREACH_QML_SEQUENCE_TYPE(SEQUENCE_TO_VARIANT) { /* else */ return QVariant(); } @@ -669,7 +669,7 @@ QVariant SequencePrototype::toVariant(const QV4::ValueRef array, int typeHint, b return qMetaTypeId(); \ } else -int SequencePrototype::metaTypeForSequence(QV4::ObjectRef object) +int SequencePrototype::metaTypeForSequence(QV4::Object *object) { FOREACH_QML_SEQUENCE_TYPE(MAP_META_TYPE) /*else*/ { diff --git a/src/qml/jsruntime/qv4sequenceobject_p.h b/src/qml/jsruntime/qv4sequenceobject_p.h index d82f80d35e..e952dda630 100644 --- a/src/qml/jsruntime/qv4sequenceobject_p.h +++ b/src/qml/jsruntime/qv4sequenceobject_p.h @@ -79,8 +79,8 @@ struct SequencePrototype : public QV4::Object static bool isSequenceType(int sequenceTypeId); static ReturnedValue newSequence(QV4::ExecutionEngine *engine, int sequenceTypeId, QObject *object, int propertyIndex, bool *succeeded); static ReturnedValue fromVariant(QV4::ExecutionEngine *engine, const QVariant& v, bool *succeeded); - static int metaTypeForSequence(ObjectRef object); - static QVariant toVariant(QV4::ObjectRef object); + static int metaTypeForSequence(Object *object); + static QVariant toVariant(Object *object); static QVariant toVariant(const ValueRef array, int typeHint, bool *succeeded); }; diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 42c5e8f16a..3969de35f9 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -203,7 +203,7 @@ ReturnedValue StringCtor::call(Managed *m, CallData *callData) return value.asReturnedValue(); } -void StringPrototype::init(ExecutionEngine *engine, ObjectRef ctor) +void StringPrototype::init(ExecutionEngine *engine, Object *ctor) { Scope scope(engine); ScopedObject o(scope); diff --git a/src/qml/jsruntime/qv4stringobject_p.h b/src/qml/jsruntime/qv4stringobject_p.h index cc852ba88b..5999a4f30a 100644 --- a/src/qml/jsruntime/qv4stringobject_p.h +++ b/src/qml/jsruntime/qv4stringobject_p.h @@ -86,7 +86,7 @@ struct StringCtor: FunctionObject struct StringPrototype: StringObject { StringPrototype(InternalClass *ic): StringObject(ic) {} - void init(ExecutionEngine *engine, ObjectRef ctor); + void init(ExecutionEngine *engine, Object *ctor); static ReturnedValue method_toString(CallContext *context); static ReturnedValue method_charAt(CallContext *context); diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 0968b3a0d7..ce9771fac0 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1499,7 +1499,7 @@ void QmlIncubatorObject::setInitialState(QObject *o) QV4::ExecutionEngine *v4 = QV8Engine::getV4(d()->v8); QV4::Scope scope(v4); - QV4::Scoped f(scope, QV4::Script::evaluate(v4, QString::fromLatin1(INITIALPROPERTIES_SOURCE), d()->qmlGlobal)); + QV4::Scoped f(scope, QV4::Script::evaluate(v4, QString::fromLatin1(INITIALPROPERTIES_SOURCE), d()->qmlGlobal.asObject())); QV4::ScopedCallData callData(scope, 2); callData->thisObject = v4->globalObject; callData->args[0] = QV4::QObjectWrapper::wrap(v4, o); diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index c5a4d65725..36dc17a085 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2554,7 +2554,7 @@ void QQmlScriptData::initialize(QQmlEngine *engine) QV8Engine *v8engine = ep->v8engine(); QV4::ExecutionEngine *v4 = QV8Engine::getV4(v8engine); - m_program = new QV4::Script(v4, QV4::ObjectRef::null(), m_precompiledScript); + m_program = new QV4::Script(v4, 0, m_precompiledScript); addToEngine(engine); diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index a8a4f6a29e..c4ab148c88 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -469,7 +469,7 @@ void QV8Engine::initializeGlobal() " }"\ "})" - QV4::Scoped result(scope, QV4::Script::evaluate(m_v4Engine, QString::fromUtf8(FREEZE_SOURCE), QV4::ObjectRef::null())); + QV4::Scoped result(scope, QV4::Script::evaluate(m_v4Engine, QString::fromUtf8(FREEZE_SOURCE), 0)); Q_ASSERT(!!result); m_freezeObject = result; #undef FREEZE_SOURCE @@ -613,8 +613,7 @@ QV4::ReturnedValue QV8Engine::variantMapToJS(const QVariantMap &vmap) // The result is a QVariantMap with keys being the property names // of the object, and values being the values of the JS object's // properties converted to QVariants, recursively. -QVariantMap QV8Engine::variantMapFromJS(QV4::ObjectRef o, - V8ObjectSet &visitedObjects) +QVariantMap QV8Engine::variantMapFromJS(QV4::Object *o, V8ObjectSet &visitedObjects) { QVariantMap result; diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index dfdce4556a..152eaebb2f 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -232,7 +232,7 @@ public: { V8ObjectSet visitedObjects; return variantListFromJS(array, visitedObjects); } QV4::ReturnedValue variantMapToJS(const QVariantMap &vmap); - inline QVariantMap variantMapFromJS(QV4::ObjectRef object) + inline QVariantMap variantMapFromJS(QV4::Object *object) { V8ObjectSet visitedObjects; return variantMapFromJS(object, visitedObjects); } QV4::ReturnedValue variantToJS(const QVariant &value); @@ -281,7 +281,7 @@ protected: private: QVariantList variantListFromJS(QV4::ArrayObject *array, V8ObjectSet &visitedObjects); - QVariantMap variantMapFromJS(QV4::ObjectRef object, V8ObjectSet &visitedObjects); + QVariantMap variantMapFromJS(QV4::Object *object, V8ObjectSet &visitedObjects); QVariant variantFromJS(const QV4::ValueRef value, V8ObjectSet &visitedObjects); Q_DISABLE_COPY(QV8Engine) diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 00ddf1319a..46916656b6 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -409,7 +409,7 @@ ListModel *ListModel::getListProperty(int elementIndex, const ListLayout::Role & return e->getListProperty(role); } -void ListModel::set(int elementIndex, QV4::ObjectRef object, QVector *roles, QV8Engine *eng) +void ListModel::set(int elementIndex, QV4::Object *object, QVector *roles, QV8Engine *eng) { ListElement *e = elements[elementIndex]; @@ -483,7 +483,7 @@ void ListModel::set(int elementIndex, QV4::ObjectRef object, QVector *roles } } -void ListModel::set(int elementIndex, QV4::ObjectRef object, QV8Engine *eng) +void ListModel::set(int elementIndex, QV4::Object *object, QV8Engine *eng) { if (!object) return; @@ -580,13 +580,13 @@ void ListModel::remove(int index, int count) updateCacheIndices(); } -void ListModel::insert(int elementIndex, QV4::ObjectRef object, QV8Engine *eng) +void ListModel::insert(int elementIndex, QV4::Object *object, QV8Engine *eng) { insertElement(elementIndex); set(elementIndex, object, eng); } -int ListModel::append(QV4::ObjectRef object, QV8Engine *eng) +int ListModel::append(QV4::Object *object, QV8Engine *eng) { int elementIndex = appendElement(); set(elementIndex, object, eng); @@ -883,7 +883,7 @@ int ListElement::setQObjectProperty(const ListLayout::Role &role, QObject *o) return roleIndex; } -int ListElement::setVariantMapProperty(const ListLayout::Role &role, QV4::ObjectRef o, QV8Engine *eng) +int ListElement::setVariantMapProperty(const ListLayout::Role &role, QV4::Object *o, QV8Engine *eng) { int roleIndex = -1; @@ -970,7 +970,7 @@ void ListElement::setListPropertyFast(const ListLayout::Role &role, ListModel *m *value = m; } -void ListElement::setVariantMapFast(const ListLayout::Role &role, QV4::ObjectRef o, QV8Engine *eng) +void ListElement::setVariantMapFast(const ListLayout::Role &role, QV4::Object *o, QV8Engine *eng) { char *mem = getPropertyMemory(role); QVariantMap *map = new (mem) QVariantMap; diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h index 4f9b3c1555..a27b8026d7 100644 --- a/src/qml/types/qqmllistmodel_p_p.h +++ b/src/qml/types/qqmllistmodel_p_p.h @@ -260,7 +260,7 @@ private: int setBoolProperty(const ListLayout::Role &role, bool b); int setListProperty(const ListLayout::Role &role, ListModel *m); int setQObjectProperty(const ListLayout::Role &role, QObject *o); - int setVariantMapProperty(const ListLayout::Role &role, QV4::ObjectRef o, QV8Engine *eng); + int setVariantMapProperty(const ListLayout::Role &role, QV4::Object *o, QV8Engine *eng); int setVariantMapProperty(const ListLayout::Role &role, QVariantMap *m); int setDateTimeProperty(const ListLayout::Role &role, const QDateTime &dt); @@ -269,7 +269,7 @@ private: void setBoolPropertyFast(const ListLayout::Role &role, bool b); void setQObjectPropertyFast(const ListLayout::Role &role, QObject *o); void setListPropertyFast(const ListLayout::Role &role, ListModel *m); - void setVariantMapFast(const ListLayout::Role &role, QV4::ObjectRef o, QV8Engine *eng); + void setVariantMapFast(const ListLayout::Role &role, QV4::Object *o, QV8Engine *eng); void setDateTimePropertyFast(const ListLayout::Role &role, const QDateTime &dt); void clearProperty(const ListLayout::Role &role); @@ -333,11 +333,11 @@ public: return elements.count(); } - void set(int elementIndex, QV4::ObjectRef object, QVector *roles, QV8Engine *eng); - void set(int elementIndex, QV4::ObjectRef object, QV8Engine *eng); + void set(int elementIndex, QV4::Object *object, QVector *roles, QV8Engine *eng); + void set(int elementIndex, QV4::Object *object, QV8Engine *eng); - int append(QV4::ObjectRef object, QV8Engine *eng); - void insert(int elementIndex, QV4::ObjectRef object, QV8Engine *eng); + int append(QV4::Object *object, QV8Engine *eng); + void insert(int elementIndex, QV4::Object *object, QV8Engine *eng); void clear(); void remove(int index, int count); -- cgit v1.2.3