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

Reply via email to