On 2015/05/20 07:06:46, Dmitry Lomov (chromium) wrote:
Here is a design I came up with yesterday evening (nothing done yet): for
    [a, b, c, ...d]
parser builds an ast:
    %SpreadArrayLiteral([a,b,c], d)

This will have similar issues with evaluation order as the spread calls.
Concretely, the following:
   [a, ...b, c, ...d]
Will have evaluation order:
   "a, b, c, d, b.next(), d.next()",
Instead of:
   "a, b, b.next(), c, d, d.next()"

I didn't check with the spec draft, so I don't actually know which of these
evaluation orders is the expected one. But I have the feeling the later is the
intended order. Please correct me if I am wrong.

where builtin:
    function SpreadArrayLiteral(lit, rest) {
        let index = lit.length;
        let done = false;
        while (!done) {
            let result = IteratorNext(rest);
            done = result.done;
            if (!done) lit[index+] = result.value;
        }
    }
Codegen will generate the code as-is, whereas PatternRewriter will reinterpret
this as a pattern.



https://codereview.chromium.org/1125183008/

--
--
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.

Reply via email to