diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-12-16 09:16:57 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-09 07:47:06 +0100 |
commit | 459c9a2a8840995436e610459216957bc7ebd914 (patch) | |
tree | ef28df2fdbc62bf551088d13850492d2c6a771b1 /src/qml/jsruntime/qv4managed_p.h | |
parent | 5cf95512af83fc6a0f70d3493be571accaf50d84 (diff) |
Rework array handling for JS objects
Split up ArrayData into two classes, one for regular
arrays, one for sparse arrays and cleanly separate
the two cases. Only create array data on demand.
Change-Id: I9ca8d0b53592174f213ba0f20caf93e77dba690a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4managed_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4managed_p.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h index 124392197f..932dbe818c 100644 --- a/src/qml/jsruntime/qv4managed_p.h +++ b/src/qml/jsruntime/qv4managed_p.h @@ -106,6 +106,7 @@ struct ManagedVTable ReturnedValue (*getLookup)(Managed *m, Lookup *l); void (*setLookup)(Managed *m, Lookup *l, const ValueRef v); bool (*isEqualTo)(Managed *m, Managed *other); + uint (*getLength)(const Managed *m); Property *(*advanceIterator)(Managed *m, ObjectIterator *it, StringRef name, uint *index, PropertyAttributes *attributes); const char *className; }; @@ -136,6 +137,7 @@ const QV4::ManagedVTable classname::static_vtbl = \ getLookup, \ setLookup, \ isEqualTo, \ + getLength, \ advanceIterator, \ #classname \ } @@ -166,6 +168,7 @@ const QV4::ManagedVTable classname::static_vtbl = \ getLookup, \ setLookup, \ isEqualTo, \ + getLength, \ advanceIterator, \ #name \ } @@ -196,6 +199,7 @@ const QV4::ManagedVTable classname::static_vtbl = \ getLookup, \ setLookup, \ isEqualTo, \ + getLength, \ advanceIterator, \ #classname \ } @@ -327,6 +331,7 @@ public: bool isEqualTo(Managed *other) { return internalClass->vtable->isEqualTo(this, other); } + uint getLength() const { return internalClass->vtable->getLength(this); } Property *advanceIterator(ObjectIterator *it, StringRef name, uint *index, PropertyAttributes *attributes); static void destroy(Managed *that) { that->_data = 0; } @@ -335,16 +340,13 @@ public: static ReturnedValue getLookup(Managed *m, Lookup *); static void setLookup(Managed *m, Lookup *l, const ValueRef v); static bool isEqualTo(Managed *m, Managed *other); + static uint getLength(const Managed *) { return 0; } ReturnedValue asReturnedValue() { return Value::fromManaged(this).asReturnedValue(); } InternalClass *internalClass; - enum { - SimpleArray = 1 - }; - union { uint _data; struct { @@ -358,7 +360,7 @@ public: uchar hasAccessorProperty : 1; uchar _type; mutable uchar subtype; - uchar flags; + uchar _flags; }; }; |