On 2013/08/14 14:48:55, Toon Verwaest wrote:
You can actually create, using Object.defineProperty, an array that doesn't
have
foreign accessors as its length anymore.

No, Array instances have a non configurable length data property.

At that point values don't get deleted
anymore when you reduce the length. This means you can create a "packed array"
which has elements beyond its length (which you can find just by reading
them).

Also, given that forEach reads the length before starting to loop, it means
that
the array essentially becomes "holey" at the moment you shorted the length
dynamically; in the sense that you have to look for elements beyond the actual length of the array. Those elements can come from the prototype chain; and can
obviously be a getter or so.

Yeah, Michael pointed that out. Both length and packed needs to be checked.

https://codereview.chromium.org/22545007/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to