Re: [v8-users] Re: Where are let / const objects stored?

2018-06-22 Thread Gonzalo Diethelm
Jakob, I can see why that is the case for lexical scoped variables. Can you 
point me to more docs (LOL) or examples of how to traverse these Context 
objects? I will also check Zac's suggestion of looking at the debugging 
interface.

Cheers!

On Thursday, June 21, 2018 at 11:31:24 PM UTC+2, Jakob Kummerow wrote:
>
> Variable allocation is complicated. In short, Function-local variables are 
> allocated on the stack. When nested closures refer to them, they get 
> allocated in a Context object.
>
>
> On Thu, Jun 21, 2018 at 12:15 AM Zac Hansen  > wrote:
>
>> I don't know the answer, but they are accessible via the debugging 
>> interface, so that may be a place to look.  
>>
>> On Wednesday, June 20, 2018 at 11:01:23 PM UTC-7, Gonzalo Diethelm wrote:
>>>
>>> I run the following JS code in the Chrome console:
>>>
>>> // Version 67.0.3396.87 (Official Build) (64-bit)
>>>
>>> var p = 11
>>> p // returns 11
>>>
>>> let q = 12
>>> q // returns 12
>>>
>>> const r = 13
>>> r // returns 13
>>>
>>> Now, from C++ code, I can look up p in the global context, and it is 
>>> found; its value is, unsurprisingly, 11.
>>>
>>> On the other hand, q and r are not found in the global context.  This is 
>>> fine, I guess, since let / const have lexical scoping.
>>>
>>> My question is: how does Chrome / V8 find q and r?  Where is it looking 
>>> for them?
>>>
>>> Thanks!
>>>
>> -- 
>> -- 
>> 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-users+u...@googlegroups.com .
>> 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.


Re: [v8-users] Re: Where are let / const objects stored?

2018-06-21 Thread Jakob Kummerow
Variable allocation is complicated. In short, Function-local variables are
allocated on the stack. When nested closures refer to them, they get
allocated in a Context object.


On Thu, Jun 21, 2018 at 12:15 AM Zac Hansen  wrote:

> I don't know the answer, but they are accessible via the debugging
> interface, so that may be a place to look.
>
> On Wednesday, June 20, 2018 at 11:01:23 PM UTC-7, Gonzalo Diethelm wrote:
>>
>> I run the following JS code in the Chrome console:
>>
>> // Version 67.0.3396.87 (Official Build) (64-bit)
>>
>> var p = 11
>> p // returns 11
>>
>> let q = 12
>> q // returns 12
>>
>> const r = 13
>> r // returns 13
>>
>> Now, from C++ code, I can look up p in the global context, and it is
>> found; its value is, unsurprisingly, 11.
>>
>> On the other hand, q and r are not found in the global context.  This is
>> fine, I guess, since let / const have lexical scoping.
>>
>> My question is: how does Chrome / V8 find q and r?  Where is it looking
>> for them?
>>
>> Thanks!
>>
> --
> --
> 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.
>

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