On 2014/10/27 08:16:45, marja wrote:
rossberg@, this CL enables making inner functions lazy, but it always
context-allocates outer function variables if any inner function refers to a
variable with the same name, e.g.,

function outer() {
   var a; // will be unnecessarily context-allocated
   function inner() {
     var a;
     a = 5;
   }
}

... can you provide more insight into whether this is okay? My gut feeling
says
it's not okay to add a bunch of stuff into the context unnecessarily, but my
V8
fu is not good enough to say that for sure.

Definitely not okay. This could tank some functions severely, just imagine:

  function outer() {
    function inner() {
      for (var i = 0; ...) { ... }
    }
    for (var i = 0; ...) { ... }
  }

The outer loop would become much slower if i was forced into the context.
Especially in optimised code.

We would need to implement a form of preparsing with proper scope and binding
analysis to enable lazy parsing of inner functions.


https://codereview.chromium.org/641283003/

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