|
Sep 02
2008
|
The Google V8 JavaScript EnginePosted by Christopher Diggins in virtual machines, Programming Languages, language engineering, JavaScript, Google |
I am really pleased to see that Google has recently released the source to its new V8 JavaScript Engine, at the core of the Chrome browser project. While I can only speculate at this point, I suspect it is going to be darn fast.
The V8 project boasts itself to be a high-performance JavaScript interpreter. While I haven't verified the benchmarks (except to see that there are currently only a handful of programs in their benchmark suite) I have briefly looked at the source, and I for one am predisposed to believe their claim.
The V8 engine is a bit exotic because it generates assembly code at run-time. While this technique is well-known in the compiler community and has been around for a while (for some discussion see http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.25.8634) most dynamic language interpreters you can get your hands on don't use the technique.
As one can easily imagine dynamic assembly code generation produces very fast interpreters, when compared to straight bytecode interpreters or the syntax tree walking approaches. Consider for instance the recent hullabaloo made by the webkit team when moving from a tree walking interpreter to a bytecode approach. I believe you can reasonably expect V8 performance over SquirrelFish to be at least as dramatic.
If you are at all interested in compiler or interpreter design, not only is the source for V8 available at http://code.google.com/p/v8/source/checkout (click on Browse to view the source online with syntax coloring) there is some very well-written and easy to read documentation available at http://code.google.com/apis/v8/intro.html.
Kudos to Google for open-sourcing their code. Perhaps they will inspire more companies to do like wise.










