Re: Why are we limited to JS in browsers - would a bytecode ...
by silentbicycle on Thursday November 11, 2010 @01:22PM
(#1894679)
> Just to note though: Javascript in fact doesn't require representing objects as hash tables. For example, the V8 javascript engine represents objects as instances of classes, more or less exactly how C++ would do it (the build the class definitions automatically in the background.)
That sounds like what Self does, too. See the excellent paper, "An Efficient Implementation of SELF" (http://selflanguage.org/documentation/published/implementati...).
The Self bibliography page (http://selflanguage.org/documentation/published/index.html) has a lot of other content applicable to dynamic languages in general, too.
Re: Why are we limited to JS in browsers - would a bytecode ...
by wmf on Thursday November 11, 2010 @01:52PM
(#1894767)
Self and V8 are connected through Lars Bak. http://en.wikipedia.org/wiki/Lars_Bak_(computer_programmer)
Re: Why are we limited to JS in browsers - would a bytecode ...
by silentbicycle on Thursday November 11, 2010 @02:00PM
(#1894795)
He worked on Beta / Mjølner, too. Neat!
Re: Why are we limited to JS in browsers - would a bytecode ...
by jules on Thursday November 11, 2010 @02:02PM
(#1894806)
Yep, sophisticated implementations try to infer the patterns in which objects occur and then dynamically generate classes for them. However this is not without problems, because if you assign to a new slot then you need to change the object's class, it needs to gracefully degrade to when the objects are used as hash tables, etc.
LLVM IL would be excellent for speed. The problem is that it's not memory safe (i.e. it allows reading and writing to arbitrary memory locations). NativeClient at Google is trying to solve that. http://code.google.com/p/nativeclient/
You are right on integers though, and other types of memory block in general, they are trickier to fix in a javascript engine. Surely the best IL is LLVM IL though, since it was designed so everything can compile down to it.