On Thu, Aug 25, 2011 at 3:48 PM, Michael Schwartz <[email protected]> wrote:
> 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.
>
Except that many (if not most) of those pointers will point to v8-internal
heap-allocated stuff which cannot be re-mapped on the receiving side.
> Rhino has a compiler that will convert a JavaScript program into a Java
> .class file. SImilar concept.
>
Similar, but that's bytecode, not native data. v8 has no bytecode.
> environments are so radically different. But if you compiled in all of
> NodeJS as well, it'd work.
>
i don't think it's possible, not with native code. Let's say we have this JS
code:
x.foo();
foo is bound to some arbitrary native function. When its compiled by v8 into
machine code, the address of that function is part of that code, and the
identity (name/symbol) of the function is lost. If we then transfer that
code, we have no way of knowing which symbol on the receiving side to map
that to. Even v8 doesn't know exactly which native function it is (its
name), only its address. v8 knows what name we bound it too ("foo"), but
that's not enough to recreate the binding on the other end.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users