diff options
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4dataview.cpp | 11 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4dataview_p.h | 3 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 10 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4object_p.h | 8 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4objectiterator_p.h | 7 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 14 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper_p.h | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4script.cpp | 11 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4sequenceobject.cpp | 23 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4typedarray_p.h | 7 |
11 files changed, 35 insertions, 67 deletions
diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp index e5ac32283e..8901834e76 100644 --- a/src/qml/jsruntime/qv4dataview.cpp +++ b/src/qml/jsruntime/qv4dataview.cpp @@ -62,7 +62,7 @@ ReturnedValue DataViewCtor::construct(const Managed *m, CallData *callData) if (bo != byteOffset || bl != byteLength || byteOffset + byteLength > bufferLength) return scope.engine->throwRangeError(QStringLiteral("DataView: constructor arguments out of range")); - Scoped<DataView> a(scope, scope.engine->memoryManager->alloc<DataView>(scope.engine)); + Scoped<DataView> a(scope, scope.engine->memoryManager->allocObject<DataView>()); a->d()->buffer = buffer->d(); a->d()->byteLength = byteLength; a->d()->byteOffset = byteOffset; @@ -76,15 +76,6 @@ ReturnedValue DataViewCtor::call(const Managed *that, CallData *callData) } -Heap::DataView::DataView(ExecutionEngine *e) - : Heap::Object(e->emptyClass, e->dataViewPrototype()), - buffer(0), - byteLength(0), - byteOffset(0) -{ -} - - void DataView::markObjects(Heap::Base *that, ExecutionEngine *e) { DataView::Data *v = static_cast<DataView::Data *>(that); diff --git a/src/qml/jsruntime/qv4dataview_p.h b/src/qml/jsruntime/qv4dataview_p.h index e98239396a..37a8363645 100644 --- a/src/qml/jsruntime/qv4dataview_p.h +++ b/src/qml/jsruntime/qv4dataview_p.h @@ -47,7 +47,7 @@ struct DataViewCtor : FunctionObject { }; struct DataView : Object { - DataView(ExecutionEngine *e); + DataView() {} Pointer<ArrayBuffer> buffer; uint byteLength; uint byteOffset; @@ -66,6 +66,7 @@ struct DataViewCtor: FunctionObject struct DataView : Object { V4_OBJECT2(DataView, Object) + V4_PROTOTYPE(dataViewPrototype) static void markObjects(Heap::Base *that, ExecutionEngine *e); }; diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index b3017e694d..9bd296166f 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -428,7 +428,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) for (int i = 0; i < Heap::TypedArray::NTypes; ++i) { static_cast<Value &>(typedArrayCtors[i]) = memoryManager->allocObject<TypedArrayCtor>(global, Heap::TypedArray::Type(i)); - static_cast<Value &>(typedArrayPrototype[i]) = memoryManager->alloc<TypedArrayPrototype>(this, Heap::TypedArray::Type(i)); + static_cast<Value &>(typedArrayPrototype[i]) = memoryManager->allocObject<TypedArrayPrototype>(Heap::TypedArray::Type(i)); typedArrayPrototype[i].as<TypedArrayPrototype>()->init(this, static_cast<TypedArrayCtor *>(typedArrayCtors[i].as<Object>())); } @@ -742,7 +742,7 @@ Heap::Object *ExecutionEngine::newVariantObject(const QVariant &v) Heap::Object *ExecutionEngine::newForEachIteratorObject(Object *o) { Scope scope(this); - ScopedObject obj(scope, memoryManager->alloc<ForEachIteratorObject>(this, o)); + ScopedObject obj(scope, memoryManager->allocObject<ForEachIteratorObject>(o)); return obj->d(); } diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 2245e1de61..42cc3c7df4 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -51,16 +51,6 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(Object); -Heap::Object::Object(InternalClass *internalClass, QV4::Object *prototype) - : prototype(prototype ? prototype->d() : 0) -{ - if (internalClass) { - Scope scope(internalClass->engine); - ScopedObject o(scope, this); - o->setInternalClass(internalClass); - } -} - void Object::setInternalClass(InternalClass *ic) { d()->internalClass = ic; diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index cd54e6c83d..58dab9691f 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -49,8 +49,6 @@ namespace Heap { struct Object : Base { inline Object() {} - inline Object(ExecutionEngine *engine); - Object(InternalClass *internal, QV4::Object *prototype); const Value *propertyData(uint index) const { if (index < inlineMemberSize) return reinterpret_cast<const Value *>(this) + inlineMemberOffset + index; return memberData->data + index - inlineMemberSize; } Value *propertyData(uint index) { if (index < inlineMemberSize) return reinterpret_cast<Value *>(this) + inlineMemberOffset + index; return memberData->data + index - inlineMemberSize; } @@ -343,12 +341,6 @@ private: namespace Heap { -inline Object::Object(ExecutionEngine *engine) - : internalClass(engine->emptyClass), - prototype(static_cast<Object *>(engine->objectPrototype()->m())) -{ -} - struct BooleanObject : Object { BooleanObject() {} BooleanObject(bool b) diff --git a/src/qml/jsruntime/qv4objectiterator_p.h b/src/qml/jsruntime/qv4objectiterator_p.h index bfe04b33aa..e34b641be9 100644 --- a/src/qml/jsruntime/qv4objectiterator_p.h +++ b/src/qml/jsruntime/qv4objectiterator_p.h @@ -67,7 +67,7 @@ struct Q_QML_EXPORT ObjectIterator namespace Heap { struct ForEachIteratorObject : Object { - ForEachIteratorObject(QV4::ExecutionEngine *engine, QV4::Object *o); + ForEachIteratorObject(QV4::Object *o); ObjectIterator it; Value workArea[2]; }; @@ -85,9 +85,8 @@ protected: }; inline -Heap::ForEachIteratorObject::ForEachIteratorObject(QV4::ExecutionEngine *engine, QV4::Object *o) - : Heap::Object(engine) - , it(engine, workArea, workArea + 1, o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain) +Heap::ForEachIteratorObject::ForEachIteratorObject(QV4::Object *o) + : it(internalClass->engine, workArea, workArea + 1, o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain) { } diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index b9d8180a26..6b0abc60de 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -228,9 +228,8 @@ static QV4::ReturnedValue LoadProperty(QV4::ExecutionEngine *v4, QObject *object } } -Heap::QObjectWrapper::QObjectWrapper(ExecutionEngine *engine, QObject *object) - : Heap::Object(engine) - , object(object) +Heap::QObjectWrapper::QObjectWrapper(QObject *object) + : object(object) { } @@ -336,7 +335,7 @@ ReturnedValue QObjectWrapper::getProperty(ExecutionEngine *engine, QObject *obje ScopedContext global(scope, scope.engine->qmlContext()); return QV4::QObjectMethod::create(global, object, property->coreIndex); } else if (property->isSignalHandler()) { - QV4::Scoped<QV4::QmlSignalHandler> handler(scope, scope.engine->memoryManager->alloc<QV4::QmlSignalHandler>(engine, object, property->coreIndex)); + QV4::Scoped<QV4::QmlSignalHandler> handler(scope, scope.engine->memoryManager->allocObject<QV4::QmlSignalHandler>(object, property->coreIndex)); QV4::ScopedString connect(scope, engine->newIdentifier(QStringLiteral("connect"))); QV4::ScopedString disconnect(scope, engine->newIdentifier(QStringLiteral("disconnect"))); @@ -684,7 +683,7 @@ ReturnedValue QObjectWrapper::create(ExecutionEngine *engine, QObject *object) { if (engine->jsEngine()) QQmlData::ensurePropertyCache(engine->jsEngine(), object); - return (engine->memoryManager->alloc<QV4::QObjectWrapper>(engine, object))->asReturnedValue(); + return (engine->memoryManager->allocObject<QV4::QObjectWrapper>(object))->asReturnedValue(); } QV4::ReturnedValue QObjectWrapper::get(const Managed *m, String *name, bool *hasProperty) @@ -1884,9 +1883,8 @@ void QObjectMethod::markObjects(Heap::Base *that, ExecutionEngine *e) DEFINE_OBJECT_VTABLE(QObjectMethod); -Heap::QmlSignalHandler::QmlSignalHandler(QV4::ExecutionEngine *engine, QObject *object, int signalIndex) - : Heap::Object(engine) - , object(object) +Heap::QmlSignalHandler::QmlSignalHandler(QObject *object, int signalIndex) + : object(object) , signalIndex(signalIndex) { } diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index da24c81f40..bf591dc9b1 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -70,7 +70,7 @@ struct QObjectSlotDispatcher; namespace Heap { struct QObjectWrapper : Object { - QObjectWrapper(QV4::ExecutionEngine *engine, QObject *object); + QObjectWrapper(QObject *object); QPointer<QObject> object; }; @@ -86,7 +86,7 @@ struct QObjectMethod : FunctionObject { }; struct QmlSignalHandler : Object { - QmlSignalHandler(QV4::ExecutionEngine *engine, QObject *object, int signalIndex); + QmlSignalHandler(QObject *object, int signalIndex); QPointer<QObject> object; int signalIndex; }; diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 9bb3b2b605..7f2f22780e 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -59,7 +59,7 @@ namespace QV4 { namespace Heap { struct CompilationUnitHolder : Object { - inline CompilationUnitHolder(ExecutionEngine *engine, CompiledData::CompilationUnit *unit); + inline CompilationUnitHolder(CompiledData::CompilationUnit *unit); QQmlRefPointer<CompiledData::CompilationUnit> unit; }; @@ -77,9 +77,8 @@ struct CompilationUnitHolder : public Object }; inline -Heap::CompilationUnitHolder::CompilationUnitHolder(ExecutionEngine *engine, CompiledData::CompilationUnit *unit) - : Heap::Object(engine) - , unit(unit) +Heap::CompilationUnitHolder::CompilationUnitHolder(CompiledData::CompilationUnit *unit) + : unit(unit) { } @@ -143,7 +142,7 @@ Script::Script(ExecutionEngine *v4, QmlContext *qml, CompiledData::CompilationUn vmFunction = compilationUnit ? compilationUnit->linkToEngine(v4) : 0; if (vmFunction) { Scope valueScope(v4); - ScopedObject holder(valueScope, v4->memoryManager->alloc<CompilationUnitHolder>(v4, compilationUnit)); + ScopedObject holder(valueScope, v4->memoryManager->allocObject<CompilationUnitHolder>(compilationUnit)); compilationUnitHolder.set(v4, holder); } } @@ -214,7 +213,7 @@ void Script::parse() isel->setUseFastLookups(false); QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit = isel->compile(); vmFunction = compilationUnit->linkToEngine(v4); - ScopedObject holder(valueScope, v4->memoryManager->alloc<CompilationUnitHolder>(v4, compilationUnit)); + ScopedObject holder(valueScope, v4->memoryManager->allocObject<CompilationUnitHolder>(compilationUnit)); compilationUnitHolder.set(v4, holder); } diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index 23bbcc60e1..36ee848d00 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -207,8 +207,8 @@ namespace Heap { template <typename Container> struct QQmlSequence : Object { - QQmlSequence(QV4::ExecutionEngine *engine, const Container &container); - QQmlSequence(QV4::ExecutionEngine *engine, QObject *object, int propertyIndex); + QQmlSequence(const Container &container); + QQmlSequence(QObject *object, int propertyIndex); mutable Container container; QPointer<QObject> object; @@ -223,6 +223,7 @@ struct QQmlSequence : public QV4::Object { V4_OBJECT2(QQmlSequence<Container>, QV4::Object) Q_MANAGED_TYPE(QmlSequence) + V4_PROTOTYPE(sequencePrototype) V4_NEEDS_DESTROY public: @@ -543,26 +544,24 @@ public: template <typename Container> -Heap::QQmlSequence<Container>::QQmlSequence(QV4::ExecutionEngine *engine, const Container &container) - : Heap::Object(engine->emptyClass, engine->sequencePrototype()) - , container(container) +Heap::QQmlSequence<Container>::QQmlSequence(const Container &container) + : container(container) , propertyIndex(-1) , isReference(false) { - QV4::Scope scope(engine); + QV4::Scope scope(internalClass->engine); QV4::Scoped<QV4::QQmlSequence<Container> > o(scope, this); o->setArrayType(Heap::ArrayData::Custom); o->init(); } template <typename Container> -Heap::QQmlSequence<Container>::QQmlSequence(QV4::ExecutionEngine *engine, QObject *object, int propertyIndex) - : Heap::Object(engine->emptyClass, engine->sequencePrototype()) - , object(object) +Heap::QQmlSequence<Container>::QQmlSequence(QObject *object, int propertyIndex) + : object(object) , propertyIndex(propertyIndex) , isReference(true) { - QV4::Scope scope(engine); + QV4::Scope scope(internalClass->engine); QV4::Scoped<QV4::QQmlSequence<Container> > o(scope, this); o->setArrayType(Heap::ArrayData::Custom); o->loadReference(); @@ -644,7 +643,7 @@ bool SequencePrototype::isSequenceType(int sequenceTypeId) #define NEW_REFERENCE_SEQUENCE(ElementType, ElementTypeName, SequenceType, unused) \ if (sequenceType == qMetaTypeId<SequenceType>()) { \ - QV4::ScopedObject obj(scope, engine->memoryManager->alloc<QQml##ElementTypeName##List>(engine, object, propertyIndex)); \ + QV4::ScopedObject obj(scope, engine->memoryManager->allocObject<QQml##ElementTypeName##List>(object, propertyIndex)); \ return obj.asReturnedValue(); \ } else @@ -662,7 +661,7 @@ ReturnedValue SequencePrototype::newSequence(QV4::ExecutionEngine *engine, int s #define NEW_COPY_SEQUENCE(ElementType, ElementTypeName, SequenceType, unused) \ if (sequenceType == qMetaTypeId<SequenceType>()) { \ - QV4::ScopedObject obj(scope, engine->memoryManager->alloc<QQml##ElementTypeName##List>(engine, v.value<SequenceType >())); \ + QV4::ScopedObject obj(scope, engine->memoryManager->allocObject<QQml##ElementTypeName##List>(v.value<SequenceType >())); \ return obj.asReturnedValue(); \ } else diff --git a/src/qml/jsruntime/qv4typedarray_p.h b/src/qml/jsruntime/qv4typedarray_p.h index b07fccba09..74ee285da4 100644 --- a/src/qml/jsruntime/qv4typedarray_p.h +++ b/src/qml/jsruntime/qv4typedarray_p.h @@ -85,7 +85,7 @@ struct TypedArrayCtor : FunctionObject { }; struct TypedArrayPrototype : Object { - inline TypedArrayPrototype(ExecutionEngine *e, TypedArray::Type t); + inline TypedArrayPrototype(TypedArray::Type t); TypedArray::Type type; }; @@ -144,9 +144,8 @@ struct TypedArrayPrototype : Object }; inline -Heap::TypedArrayPrototype::TypedArrayPrototype(ExecutionEngine *e, TypedArray::Type t) - : Heap::Object(e) - , type(t) +Heap::TypedArrayPrototype::TypedArrayPrototype(TypedArray::Type t) + : type(t) { } |