On 2013/08/08 20:57:46, arv wrote:
On 2013/08/08 20:40:32, adamk wrote: > I like it! I doubt it would slow things down much, but can you add a
benchmark
> for a non-packed case to see how much the extra branch costs us? >> Note that there's a more complex version that works even for slightly-sparse> arrays: > > if (%HasFastElements(array)) { > var element = array[i]; > if (!IS_UNDEFINED(element) || i in array) { > // do whatever > } > } else if (i in array) { > // normal path > } > > This works because fast elements can't have getters.
What if the prototype has a non undefined value?
var a = [0, /* 1 */, 2];
a.__proto__ = {1: 3};
Ugh, you're right, you need to walk up the proto chain checking %HasFastElements. I'm sold that optimizing packed arrays is way easier as a first try. 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.
