From b6bb3fe4238c93d865e255c4681f07b9d4175529 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 8 Jan 2018 11:44:51 +0100 Subject: Clean up Engine::newObject/newArrayObject They don't need a prototype argument neither anymore. Change-Id: I80fa99cb382e8dca4cfa51fdd87b4c9b0f59573a Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4engine.cpp | 14 ++++---------- src/qml/jsruntime/qv4engine_p.h | 4 ++-- src/qml/jsruntime/qv4functionobject.cpp | 2 +- src/qml/jsruntime/qv4regexpobject.cpp | 2 +- src/qml/jsruntime/qv4runtime.cpp | 2 +- 5 files changed, 9 insertions(+), 15 deletions(-) (limited to 'src/qml/jsruntime') diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 1fcfd5047d..acbc1c3d7c 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -548,9 +548,8 @@ Heap::Object *ExecutionEngine::newObject() return memoryManager->allocate(); } -Heap::Object *ExecutionEngine::newObject(InternalClass *internalClass, QV4::Object *prototype) +Heap::Object *ExecutionEngine::newObject(InternalClass *internalClass) { - Q_UNUSED(prototype); return memoryManager->allocObject(internalClass); } @@ -623,17 +622,12 @@ Heap::ArrayObject *ExecutionEngine::newArrayObject(const Value *values, int leng Heap::ArrayObject *ExecutionEngine::newArrayObject(const QStringList &list) { - Scope scope(this); - ScopedArrayObject object(scope, memoryManager->allocate(list)); - return object->d(); + return memoryManager->allocate(list); } -Heap::ArrayObject *ExecutionEngine::newArrayObject(InternalClass *internalClass, Object *prototype) +Heap::ArrayObject *ExecutionEngine::newArrayObject(InternalClass *internalClass) { - Q_UNUSED(prototype); - Scope scope(this); - ScopedArrayObject object(scope, memoryManager->allocObject(internalClass)); - return object->d(); + return memoryManager->allocObject(internalClass); } Heap::ArrayBuffer *ExecutionEngine::newArrayBuffer(const QByteArray &array) diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index d5897c1f36..c1ee5ee926 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -403,7 +403,7 @@ public: InternalClass *newInternalClass(const VTable *vtable, Object *prototype); Heap::Object *newObject(); - Heap::Object *newObject(InternalClass *internalClass, Object *prototype); + Heap::Object *newObject(InternalClass *internalClass); Heap::String *newString(const QString &s = QString()); Heap::String *newIdentifier(const QString &text); @@ -415,7 +415,7 @@ public: Heap::ArrayObject *newArrayObject(int count = 0); Heap::ArrayObject *newArrayObject(const Value *values, int length); Heap::ArrayObject *newArrayObject(const QStringList &list); - Heap::ArrayObject *newArrayObject(InternalClass *ic, Object *prototype); + Heap::ArrayObject *newArrayObject(InternalClass *ic); Heap::ArrayBuffer *newArrayBuffer(const QByteArray &array); Heap::ArrayBuffer *newArrayBuffer(size_t length); diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 43cef36629..27c97858c6 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -144,7 +144,7 @@ void FunctionObject::init(String *n, bool createProto) Q_ASSERT(internalClass() && internalClass()->find(s.engine->id_prototype()) == Heap::FunctionObject::Index_Prototype); if (createProto) { - ScopedObject proto(s, s.engine->newObject(s.engine->internalClasses[EngineBase::Class_ObjectProto], s.engine->objectPrototype())); + ScopedObject proto(s, s.engine->newObject(s.engine->internalClasses[EngineBase::Class_ObjectProto])); Q_ASSERT(s.engine->internalClasses[EngineBase::Class_ObjectProto]->find(s.engine->id_constructor()) == Heap::FunctionObject::Index_ProtoConstructor); proto->setProperty(Heap::FunctionObject::Index_ProtoConstructor, d()); setProperty(Heap::FunctionObject::Index_Prototype, proto); diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index 000e2c3a7e..69b8451a5b 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -387,7 +387,7 @@ ReturnedValue RegExpPrototype::method_exec(const FunctionObject *b, const Value } // fill in result data - ScopedArrayObject array(scope, scope.engine->newArrayObject(scope.engine->internalClasses[EngineBase::Class_RegExpExecArray], scope.engine->arrayPrototype())); + ScopedArrayObject array(scope, scope.engine->newArrayObject(scope.engine->internalClasses[EngineBase::Class_RegExpExecArray])); int len = r->value()->captureCount(); array->arrayReserve(len); ScopedValue v(scope); diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 950a8220f4..11f66446d2 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -1218,7 +1218,7 @@ ReturnedValue Runtime::method_objectLiteral(ExecutionEngine *engine, const QV4:: { Scope scope(engine); QV4::InternalClass *klass = static_cast(engine->currentStackFrame->v4Function->compilationUnit)->runtimeClasses[classId]; - ScopedObject o(scope, engine->newObject(klass, engine->objectPrototype())); + ScopedObject o(scope, engine->newObject(klass)); { bool needSparseArray = arrayGetterSetterCountAndFlags >> 30; -- cgit v1.2.3