diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-08-27 22:32:38 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-09-22 08:20:01 +0000 |
commit | d7e535e99babae46d01311059f5ef6080dc90751 (patch) | |
tree | a526cf8c87c4838554fd7768bfca106e585b61ac /src/qml/jsruntime | |
parent | 9420eb5c4e55d68b996bb0120db1f2dfeeef3a8c (diff) |
Convert variant object and ObjectProto
Change-Id: I5ee3b453b74f5832997aca68d04979302f9afac5
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 10 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4errorobject.cpp | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4variantobject.cpp | 9 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4variantobject_p.h | 6 |
4 files changed, 12 insertions, 14 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index d881474bbc..19a4467ca8 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -298,7 +298,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) jsStrings[String_buffer] = newIdentifier(QStringLiteral("buffer")); jsStrings[String_lastIndex] = newIdentifier(QStringLiteral("lastIndex")); - jsObjects[ObjectProto] = memoryManager->alloc<ObjectPrototype>(emptyClass, (QV4::Object *)0); + jsObjects[ObjectProto] = memoryManager->allocObject<ObjectPrototype>(emptyClass); arrayClass = emptyClass->addMember(id_length(), Attr_NotConfigurable|Attr_NotEnumerable); jsObjects[ArrayProto] = memoryManager->allocObject<ArrayPrototype>(arrayClass, objectPrototype()); @@ -359,10 +359,10 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) jsObjects[TypeErrorProto] = memoryManager->alloc<TypeErrorPrototype>(emptyClass, errorPrototype()); jsObjects[URIErrorProto] = memoryManager->alloc<URIErrorPrototype>(emptyClass, errorPrototype()); - jsObjects[VariantProto] = memoryManager->alloc<VariantPrototype>(emptyClass, objectPrototype()); + jsObjects[VariantProto] = memoryManager->allocObject<VariantPrototype>(emptyClass, objectPrototype()); Q_ASSERT(variantPrototype()->prototype() == objectPrototype()->d()); - jsObjects[SequenceProto] = ScopedValue(scope, memoryManager->alloc<SequencePrototype>(arrayClass, arrayPrototype())); + jsObjects[SequenceProto] = ScopedValue(scope, memoryManager->allocObject<SequencePrototype>(arrayClass, arrayPrototype())); ExecutionContext *global = rootContext(); jsObjects[Object_Ctor] = memoryManager->alloc<ObjectCtor>(global); @@ -723,9 +723,7 @@ Heap::Object *ExecutionEngine::newURIErrorObject(const Value &message) Heap::Object *ExecutionEngine::newVariantObject(const QVariant &v) { - Scope scope(this); - ScopedObject o(scope, memoryManager->alloc<VariantObject>(this, v)); - return o->d(); + return memoryManager->allocObject<VariantObject>(emptyClass, variantPrototype(), v); } Heap::Object *ExecutionEngine::newForEachIteratorObject(Object *o) diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index a6c2a25b91..f052efe03e 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -63,7 +63,6 @@ using namespace QV4; Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype) : Heap::Object(ic, prototype) - , stack(Q_NULLPTR) { Scope scope(ic->engine); Scoped<QV4::ErrorObject> e(scope, this); diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp index f9e26efe71..4609373cc9 100644 --- a/src/qml/jsruntime/qv4variantobject.cpp +++ b/src/qml/jsruntime/qv4variantobject.cpp @@ -43,12 +43,15 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(VariantObject); -Heap::VariantObject::VariantObject(QV4::ExecutionEngine *engine, const QVariant &value) - : Heap::Object(engine->emptyClass, engine->variantPrototype()) +Heap::VariantObject::VariantObject() +{ +} + +Heap::VariantObject::VariantObject(const QVariant &value) { data = value; if (isScarce()) - engine->scarceResources.insert(this); + internalClass->engine->scarceResources.insert(this); } bool VariantObject::Data::isScarce() const diff --git a/src/qml/jsruntime/qv4variantobject_p.h b/src/qml/jsruntime/qv4variantobject_p.h index b19f12bb98..40a45f8eb5 100644 --- a/src/qml/jsruntime/qv4variantobject_p.h +++ b/src/qml/jsruntime/qv4variantobject_p.h @@ -60,10 +60,8 @@ namespace Heap { struct VariantObject : Object, public ExecutionEngine::ScarceResourceData { - VariantObject(InternalClass *ic, QV4::Object *prototype) - : Object(ic, prototype) - {} - VariantObject(QV4::ExecutionEngine *engine, const QVariant &value); + VariantObject(); + VariantObject(const QVariant &value); ~VariantObject() { if (isScarce()) node.remove(); |