The flag is --print-code which will print all code generated, and the flag
in only available for a debug build. When your first functions are compiled
you will see compilation of some internal stuff, and as a lot of the
builtins as lazily compiled you will see auxiliary code generation first
time some builtins are used. E.g. the function 'function
f(){"sss".indexOf('s')}' when run for the first time will cause parts of the
String implementation to get compiled as well (large parts of the String
implementation is in JavaScript). To avoid this and to see the code for your
functions "immediately" you can add the --nolazy flag as well to turn off
lazy compilation. Without lazy compilation all functions will be egerly
compiled when added and not on first use.

Regards,
Søren

On Wed, May 27, 2009 at 19:13, Mikhail Naganov <[email protected]> wrote:

>
> Actually, I don't see any switch in shell to print disassembler dump,
> but you can look into test/cctest/test-log-ia32.cc to see how it can
> be programmed.
>
> In a debug build, you can do the following:
>
>  v8::internal::Handle<v8::internal::JSFunction> func =
> CompileFunction(<your code>);
>  v8::internal::Code* func_code = func->code();
>  func_code->Print();
>
> But remember that functions are compiled lazily. If you've declared a
> function, it doesn't get compiled until the first call to it. Put all
> your code into top-level script if you want it to be compiled
> immediately.
>
> On Wed, May 27, 2009 at 20:22, silverburgh <[email protected]>
> wrote:
> >
> >
> > In here,
> > http://code.google.com/apis/v8/design.html
> > it dumps the machine code for 'point.x'.
> >
> > How can I dump the machine code for my JS file that I give to V8?
> >
> > Thank you.
> >
> >
> >
> > >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to