Hi Ben, Thanks for your reply. I am still confused about the difference between contexts. How does v8 restrict the JS code to access objects only in its context? Does it achieved by allocating objects in a given heap range, or associating each object with a Context property?
在 2018年5月17日星期四 UTC+8下午1:25:30,Ben Noordhuis写道: > > On Wed, May 16, 2018 at 2:35 PM, Luo Wu <lwy...@pku.edu.cn <javascript:>> > wrote: > > Hi guys, > > > > I am a freshman to learn chromium and v8. I know that the main thread in > the > > renderer process is bound to an Isolate in v8, and an Isolate can > possess > > several contexts. But I am confused about the memory layout of the main > > thread in the renderer process. > > > > I want to know how v8 manages the heap and stack for a given context. > Does > > all codes(including the v8 code and JS code in different context) have > the > > same stack? And if they have different stacks, how v8 maintains these > > stacks, for example, by changing the esp register? And what about the > heap > > for different contexts? > > > > Any ideas are appreciated. Thank you. > > They all use the same heap and stack. > > The heap is a per-isolate property. It has to be or contexts couldn't > touch each other's objects. > > The machine code that V8 emits uses the thread's stack (i.e., the C > stack), no stack swapping takes place. > -- -- 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.