In theory, you could convert a binary image into a .elf file and transmit it that way. When the .elf file is loaded, all references to things like pointers and libraries would be relocated.
I'm not sure at all why you'd want to transfer such an image from a running machine to another running machine (.e.g. v8 contexts) though. Rhino has a compiler that will convert a JavaScript program into a Java .class file. SImilar concept. Being able to create raw executable binary files for distribution, as in compiling a JavaScript program to a.out format, does make sense to me. However, those compiled programs would have to have a lot of stuff compiled in. For example, a program written for NodeJS could be compiled, but you couldn't run it inside the Chrome browser. The environments are so radically different. But if you compiled in all of NodeJS as well, it'd work. On Aug 25, 2011, at 6:21 AM, Ligon Liu wrote: > Good points. Thank you for all the replies. > > I believe js run in similar execution paths for each machine/use case. > > can we get the statistical information on the server about the most > common execution trace of the JS, analyze it and just transmit the top > a few possible binaries to "computer B"? so it will be likely to > receive the binaries needed from cloud (and fallback to local JIT when > type prediction miss) > > > yeah, I agree transmitting binary code is dangerous -- but verifying > it is in fact easy, just deploy the JS-to-binary in trustable machine > and also check CRC32 will ensure the code's integrity? Is it still too > costly? > > > > > On Aug 24, 7:44 pm, Chris Angelico <[email protected]> wrote: >> On Thu, Aug 25, 2011 at 4:02 AM, 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"? >> >> As well as what Jakob has said, such a scheme would raise major trust >> issues. You would be transmitting compiled code across the internet - >> have you any protection against malicious or damaged code? If not, >> you're majorly at risk; if so, the protection probably costs as much >> processing (and therefore power) as the compilation would have. >> >> ChrisA > > -- > 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
