On 2014/06/24 22:18:53, arv wrote:
Danno,
Since the MapIterator.prototype.next and SetIterator.prototype.next always
needs
to generate a new array if the iterator kind is entries, and since we do
not
know the kind we need on the JS side I ended up keeping the original
Next()
method.
I think you can still unify this with the next() implementation. Make
XXXNextForEach return an integer value { DONE = 0, KEY = 1, VALUE = 2,
ENTRY =
3 }. The forEach implementation stays essentially the same, simply checking
for
0 rather than boolean true.
next() then looks something like this:
var entry = { value: [UNDEFINED, UNDEFINED], done: false };
switch (%XXXNextForEach(iterator, entry.value)) {
case 0:
entry.value = undefined;
entry.done = true;
return entry;
case 1:
entry.value = entry.value[0];
return entry;
case 2:
entry.value = entry.value[1];
return entry;
case 3:
return entry;
}
I suspect this will be much faster than allocating the entry in the runtime
and
the array allocation will get folded into the entry literal allocation in
optimized code.
https://codereview.chromium.org/355663002/
--
--
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/d/optout.