V8 under the hood
offthelip.org
offthelip.org
That's like the Smalltalk image! (A few years ago, a 10 megabyte VisualWorks image could load faster than the 768k Perl runtime.)
"The most interesting part is a new implementation for the JavaScript Engine called "V8" done by members of the orginal Animorphic team. Animorphic Smalltalk was a Smalltalk system built around the mid-90s as part of a startup that was informally known as Animorphic Systems. In early 1997, Animorphic was acquired by Sun, and much of the underlying VM technology was put to real use in the Java Hotspot VM."
Then again, it probably wouldn't help too much, since most websites employ fancy packaging tricks to speed up javascript file load times.
Maybe they should "cache" this data for the most common files. Voila, no favoritism, only sweet sweet performance. (At the cost of having some sort of frequency table.)
And cache eviction and all that is pretty well understood too...
The most likely reason I can think of is that it makes it easier to interface with the existing WebKit code, but this doesn't seem like a very strong reason to me.
That's a whole lot of unnecessary -- and nontrivial -- work, when all you want to do is interpret Javascript.
When you build V8 from source, you can have it generate a snapshot of the memory state once the libraries are loaded and this gets packaged in the executable. It makes it slightly bigger but the load time is blazingly fast.
There's certainly extra work in this approach, but maybe it would be worth it if it allows the compiler to be written in a more productive language.
They would have had to make their compiler provide a batch compilation mode in addition to the incremental compilation mode, but that should not be a pain point. After all, batch compiling is easier to do than incremental compiling.
This linked to a post where one of the key developers (Dave Griswold) said "The release of the V8 VM is the beginning of a whole new era for dynamic languages"...
From this, I wouldn't see this as the case at all. I can't imagine many people wanting to use JavaScript as an intermediate language.
Without an intermediate language or some form I wouldn't call this a Virtual Machine - it's an interpreter... Granted, a pretty fast and sophisticated one.
If it was an interpreter it would have execute the code directly, and would have leave the resource allocation to the OS
But anyway, if you want to run your $NEW_LANGUAGE on V8, just compile your language to JavaScript. That is the "IR".
Interestingly enough, server-side Javascript is actually quite old. I remember one of the very first web apps I worked with was in SSJS (aka Server-Side JavaScript), on the Netscape Enterprise Server.