Hi,

Currently there are 4 different builtin functions used for Await 
operations, 2 for Async Functions and 2 for Async Generators.
The reason there are 2 versions of each is so that a Promise bitfield can 
be conditionally updated to indicate that promise
rejection is handled by a catch handler in an async function. The operation 
`promise.[[flags]] = promise.[[flags]] & <constant>` ends
up costing a little less than 4-5kb in snapshot size, which is more than it 
ought to need.

It's not the most critical thing, but it might be a simple way to 
streamline these builtins a bit and gain a small amt of savings for
mobile devices. I'd appreciate feedback on those ideas before spending time 
trying to do any of it.

I think reducing snapshot size is appreciated, so a few ideas came to mind, 
sorted from least to most "exotic":

1) pass the current catch prediction to the Await builtin explicitly as a 
parameter to the builtin (increase the bytecode cost of each Await 
operation by ~1byte).

2) save catch prediction in flags field of JSGeneratorObject on entry and 
exit from a top-level Try block in body of an async function body (in 
BytecodeBenerator::VisitTryStatement),
and load this flag from the AsyncFunctionAwait and AsyncGeneratorAwait 
builtins (very minor increase in bytecode size on average, a few bytes per 
top-level try-block in async function body).

3) refactor these builtins so that they have access to the caller's PC, and 
calculate availability of a catch handler from that (my least
preferred option, unknown cost in terms of bytecode size).

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