On Thu, Aug 25, 2011 at 22:59, Ligon Liu <[email protected]> wrote:

> do we have a document on which part in the V8 source code does the
> following things?
>

No, we don't.


> 1.When execution starts, quickly compile JS to pretty generic, sort of
> slow machine code
>

Look at files having to do with "full codegen", "code stubs", "stub cache",
and some related bits all over the place.


> 2. As that code runs, patch it in certain places with type information
> about the objects you've seen so far
>

Anything containing "IC".

3. if an object of unexpected type (or some other weird situation) is
> encountered, throw away the optimized code and go back to generic,
> slow code to collect new/more type information.
>

grep for "Deopt".

Be warned, though: understanding any significant part of V8's code takes
weeks of intense concentration, it's not something you get done in an
afternoon.


> thank you.
>
> On Aug 24, 5:18 pm, Jakob Kummerow <[email protected]> wrote:
> > Short answer: No, not possible.
> >
> > Longer answer: V8 is a little more complicated than "take JS, compile it,
> > run the binary code". Instead, it works approximately like this:
> > When execution starts, quickly compile JS to pretty generic, sort of slow
> > machine code. As that code runs, patch it in certain places with type
> > information about the objects you've seen so far. If a function turns out
> to
> > be used a lot, take some more time to compile it to optimized, fast
> machine
> > code, under the assumption that the collected type information is
> accurate.
> > Later on, if an object of unexpected type (or some other weird situation)
> is
> > encountered, throw away the optimized code and go back to generic, slow
> code
> > to collect new/more type information. Repeat the last steps
> > (optimization+deoptimization) as necessary.
> > All of this happens within a couple of milliseconds. Putting network
> latency
> > in between the phases would kill anything resembling performance. So, to
> do
> > what you're asking, you'd need to build a new JS engine that's designed
> > completely differently than V8 (and, AFAIK, all other JS engines
> currently
> > around). I guess it's a lot easier to just buy a laptop (or phone, or
> > whatever) with a larger battery ;-)
> >
> >
> >
> >
> >
> >
> >
> > On Wed, Aug 24, 2011 at 20:02, Ligon Liu <[email protected]> wrote:
> > > I'm a total newbie to V8 but I have a question: after javascript is
> > > compiled to binary code in memory by the v8 engine at "computer A", is
> > > there any way to separate the binary code into a file and transmit it
> > > to another "computer B" with v8 engine and execute the code on
> > > "computer B"?
> >
> > > my aim is to reduce battery power consumption of mobile device (B) by
> > > shifting the compiling to cloud(computer A).  Thank you.
> >
> > > --
> > > v8-users mailing list
> > > [email protected]
> > >http://groups.google.com/group/v8-users
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>

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

Reply via email to