diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-08-26 16:40:11 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-09-22 08:19:53 +0000 |
commit | 833c99db20a6ccbf337d77855098141e008b04ee (patch) | |
tree | d6bfae879061b1de22740ce20960542025c7a4d5 /src/qml/jsruntime/qv4engine.cpp | |
parent | 884097f463b1ab8c3fed929c3586d6ceea612442 (diff) |
Inline property data into the object
Append the part of the objects property data that is
known ad instantiation time to the object itself and
by that avoid creating a separate MemberData. Saves
some memory and should speed up object creation.
Currently implemented only for Object and ArrayObject.
Change-Id: I7693bf2f3a28fb718522398ebb94ac115e021fa4
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 58193fd68f..6c2705871a 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -301,7 +301,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) jsObjects[ObjectProto] = memoryManager->alloc<ObjectPrototype>(emptyClass, (QV4::Object *)0); arrayClass = emptyClass->addMember(id_length(), Attr_NotConfigurable|Attr_NotEnumerable); - jsObjects[ArrayProto] = memoryManager->alloc<ArrayPrototype>(arrayClass, objectPrototype()); + jsObjects[ArrayProto] = memoryManager->allocObject<ArrayPrototype>(arrayClass, objectPrototype()); InternalClass *argsClass = emptyClass->addMember(id_length(), Attr_NotEnumerable); argumentsObjectClass = argsClass->addMember(id_callee(), Attr_Data|Attr_NotEnumerable); @@ -540,16 +540,12 @@ ExecutionContext *ExecutionEngine::parentContext(ExecutionContext *context) cons Heap::Object *ExecutionEngine::newObject() { - Scope scope(this); - ScopedObject object(scope, memoryManager->alloc<Object>(this)); - return object->d(); + return memoryManager->allocObject<Object>(emptyClass, objectPrototype()); } Heap::Object *ExecutionEngine::newObject(InternalClass *internalClass, QV4::Object *prototype) { - Scope scope(this); - ScopedObject object(scope, memoryManager->alloc<Object>(internalClass, prototype)); - return object->d(); + return memoryManager->allocObject<Object>(internalClass, prototype); } Heap::String *ExecutionEngine::newString(const QString &s) @@ -587,7 +583,7 @@ Heap::Object *ExecutionEngine::newBooleanObject(bool b) Heap::ArrayObject *ExecutionEngine::newArrayObject(int count) { Scope scope(this); - ScopedArrayObject object(scope, memoryManager->alloc<ArrayObject>(this)); + ScopedArrayObject object(scope, memoryManager->allocObject<ArrayObject>(arrayClass, arrayPrototype())); if (count) { if (count < 0x1000) @@ -600,14 +596,14 @@ Heap::ArrayObject *ExecutionEngine::newArrayObject(int count) Heap::ArrayObject *ExecutionEngine::newArrayObject(const QStringList &list) { Scope scope(this); - ScopedArrayObject object(scope, memoryManager->alloc<ArrayObject>(this, list)); + ScopedArrayObject object(scope, memoryManager->allocObject<ArrayObject>(arrayClass, arrayPrototype(), list)); return object->d(); } -Heap::ArrayObject *ExecutionEngine::newArrayObject(InternalClass *ic, Object *prototype) +Heap::ArrayObject *ExecutionEngine::newArrayObject(InternalClass *internalClass, Object *prototype) { Scope scope(this); - ScopedArrayObject object(scope, memoryManager->alloc<ArrayObject>(ic, prototype)); + ScopedArrayObject object(scope, memoryManager->allocObject<ArrayObject>(internalClass, prototype)); return object->d(); } |