Thank Ben, but I need to some example:

function add(a, b) {
 return a + b;
}


print(add(37, 73));
I execute this code via d8.

What is context in that case?

I've got the asm listing via  --print-code: listing 
<http://pastebin.com/NhWyhRDK>
Actually I can't understand why the listing consists so many codes? The 
adder function is very simple.

0xda955b3eff6   150  49ba0000000025000000 REX.W movq r10,0x2500000000
0xda955b3f000   160  4152           push r10
0xda955b3f002   162  49ba0000000049000000 REX.W movq r10,0x4900000000
0xda955b3f00c   172  4152           push r10
0xda955b3f00e   174  48ba0000000007000000 REX.W movq rdx,0x700000000
0xda955b3f018   184  488b7c2418     REX.W movq rdi,[rsp+0x18]
0xda955b3f01d   189  e85efcffff     call 0xda955b3ec80       ;; code: 
CALL_IC, GENERIC
0xda955b3f022   194  488b75f8       REX.W movq rsi,[rbp-0x8]
0xda955b3f026   198  48890424       REX.W movq [rsp],rax


On Monday, February 15, 2016 at 11:14:58 PM UTC+6, Ben Noordhuis wrote:
>
> On Mon, Feb 15, 2016 at 1:57 PM,  <[email protected] <javascript:>> 
> wrote: 
> > Hi all! 
> > 
> > I'm trying to understand the full-codegen compiler in v8. 
> > 
> > Ok, I've taken the full-codegen code for x64 architecture. 
> > 
> > As I can see in code, it does following things: 
> > Build x64 frame 
> > Allocate locals 
> > And then allocate context <- this is magic for me 
> > 
> > The code's: 
> > 
> > // Possibly allocate a local context. 
> > 
> >   if (info->scope()->num_heap_slots() > 0) { 
> > 
> >     Comment cmnt(masm_, "[ Allocate context"); 
> > 
> >     bool need_write_barrier = true; 
> > 
> >     int slots = info->scope()->num_heap_slots() - 
> > Context::MIN_CONTEXT_SLOTS; 
> > 
> >     // Argument to NewContext is the function, which is still in rdi. 
> > 
> > ... 
> > 
> > 
> > What does the full-codegen does here? 
>
> The context it allocates is the storage for a function's free 
> variables.  V8's garbage collector is generational; the write barrier 
> is for tracking object references from the old space to the new space. 
>

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