Post Fri May 20, 2011 6:47 pm

JavaScript: Now powerful enough to run Linux

Step aside, Google Docs, there's a new JavaScript tour de force in town.
I'm talking about the latest project from programmer Fabrice Bellard, a JavaScript program that emulates an x86 processor fast enough to run Linux in a Web browser.
The JavaScript PC Emulator can do the work of an Intel 486 chip from the 1990s, but doesn't have a built-in floating point unit for numeric processing, Bellard said. Happily, Linux itself can emulate that, and a version of the operating system's core--2.6.20--runs on the foundation.
Bellard published a technical description of the JavaScript PC Emulator on Saturday, but today the project caught the notice of prominent techies, including Brendan Eich, a Mozilla programmer and the creator of JavaScript.
"I did it for fun, just because newer JavaScript engines are fast enough to do complicated things," Bellard said of the project. "I happen to be interested by the implementation of JavaScript engines these days--but I don't know yet if I will write my own any time soon! Anyway, this emulator was a way to learn how to write optimized code for recent JavaScript engines, in particular JaegerMonkey (for Firefox 4) and V8 (for Chrome)."
Bellard suggests some possibilities for more serious use, including benchmarks or running old DOS games. But probably the project's biggest practical repercussion is simply the news that JavaScript has matured enough to run an entire computer-within-a-computer.
Curious people can try the emulator with a modern browser that has fast JavaScript performance; it works with Firefox 4 but not newer versions of Google Chrome. And those who really want to dig in can look at the JavaScript PC Emulator's actual JavaScript code.

Pretty cool....