Wow, its cool! So it means those variables in the same function may not 
stored in the same place and  we got those information before generate the 
byteCode right?

On Friday, April 5, 2019 at 4:24:56 PM UTC+8, Jakob Kummerow wrote:
>
> After parsing we do scope analysis to decide where to allocate each 
> variable. Variables required by inner functions are allocated to the 
> context. They are then directly written to and read from the context object 
> whenever they are accessed.
>
> On Fri, Apr 5, 2019 at 9:03 AM <yanglia...@bytedance.com <javascript:>> 
> wrote:
>
>> Oh, thanks. So it seems that I guess right. But in which moment we do 
>> that? Is that when the outer function finished or when we pre-parsing the 
>> function itself ? 
>>
>> On Thursday, April 4, 2019 at 5:55:43 PM UTC+8, Jakob Kummerow wrote:
>>>
>>> Yes, a closure's "context" (i.e. variables from its outer scope) is 
>>> stored on the heap.
>>>
>>> On Thu, Apr 4, 2019 at 8:37 AM <yanglia...@bytedance.com> wrote:
>>>
>>>>     I have a problem about v8's closure. The problem is that when the 
>>>> caller function finished, it's stack frame shall dismissed, then how could 
>>>> the callee function get access to the caller's context if the stack is not 
>>>> exist anymore ? Did we move those variable to the heap so that it could 
>>>> still be find ?
>>>>
>>>> -- 
>>>> -- 
>>>> v8-users mailing list
>>>> v8-u...@googlegroups.com
>>>> http://groups.google.com/group/v8-users
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "v8-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to v8-u...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> -- 
>> -- 
>> v8-users mailing list
>> v8-u...@googlegroups.com <javascript:>
>> http://groups.google.com/group/v8-users
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to v8-u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to