diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-10-15 22:27:10 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-19 14:59:02 +0200 |
commit | f0eaaef4aeb6fa8951cca1e1e90def3411896e9f (patch) | |
tree | a294933a656a8bdf2b70703b3caa1f450dba0e53 /src/qml/jsruntime/qv4object.cpp | |
parent | 436b8397ca23a85cf15884655895901f4537a467 (diff) |
Some minor optimizations
Change-Id: Ib2e08e7c89ca59a48f8fd52b30981e5d7e60803b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 795362e691..b04c65196e 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -241,19 +241,39 @@ void Object::markObjects(Managed *that) { Object *o = static_cast<Object *>(that); - for (int i = 0; i < o->internalClass->size; ++i) { - const Property &pd = o->memberData[i]; - if (o->internalClass->propertyData[i].isData()) { - if (Managed *m = pd.value.asManaged()) - m->mark(); - } else { - if (pd.getter()) - pd.getter()->mark(); - if (pd.setter()) - pd.setter()->mark(); + if (!o->hasAccessorProperty) { + for (int i = 0; i < o->internalClass->size; ++i) + o->memberData[i].value.mark(); + } else { + for (int i = 0; i < o->internalClass->size; ++i) { + const Property &pd = o->memberData[i]; + if (o->internalClass->propertyData[i].isAccessor()) { + if (pd.getter()) + pd.getter()->mark(); + if (pd.setter()) + pd.setter()->mark(); + } else { + pd.value.mark(); + } + } + } + if (o->flags & SimpleArray) { + for (uint i = 0; i < o->arrayDataLen; ++i) + o->arrayData[i].value.mark(); + return; + } else { + for (uint i = 0; i < o->arrayDataLen; ++i) { + const Property &pd = o->arrayData[i]; + if (o->arrayAttributes && o->arrayAttributes[i].isAccessor()) { + if (pd.getter()) + pd.getter()->mark(); + if (pd.setter()) + pd.setter()->mark(); + } else { + pd.value.mark(); + } } } - o->markArrayObjects(); } void Object::ensureMemberIndex(uint idx) @@ -1374,22 +1394,6 @@ bool Object::setArrayLength(uint newLen) { return ok; } -void Object::markArrayObjects() const -{ - for (uint i = 0; i < arrayDataLen; ++i) { - const Property &pd = arrayData[i]; - if (!arrayAttributes || arrayAttributes[i].isData()) { - if (Managed *m = pd.value.asManaged()) - m->mark(); - } else if (arrayAttributes[i].isAccessor()) { - if (pd.getter()) - pd.getter()->mark(); - if (pd.setter()) - pd.setter()->mark(); - } - } -} - DEFINE_MANAGED_VTABLE(ArrayObject); ArrayObject::ArrayObject(ExecutionEngine *engine, const QStringList &list) |