The "variable environment" of a closure is stored in a Context object on
the heap. HandleScope has nothing to do with it. Where variables are stored
depends on how they are used: variables local to a function are stored on
the stack, variables used by closures are stored in the Context.

On Wed, Jun 20, 2018 at 8:56 AM <[email protected]> wrote:

> I have a question about how V8 deals with closures. I understand that the
> variable environment becomes part of the function object, I dont know if
> this is re-written in place when the variables in it's [[scope]] change,
> and how these are dealt with in memory since the functions as they execute
> are pushed on and popped off the stack. Does the handler (HandleScope I
> believe has something to do with it) write a new definition with the new
> environment variables? Sorry if this is an unclear question, Im a newer
> developer and this is a curious behavior that I want to thoroughly
> understand. This may actually be a behavior that isnt unique to closures
> and perhaps all functions are treated the same in the heap, but Im truly
> curious and cant figure this out looking through the V8 documentation.
>
> --
> --
> 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.
>

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