Could ASM.JS be implemented into the JavaScript V8 engine to make it much faster which in turn makes Node.js overall even faster than it is now? So basically all the JS you code with Node would be compiled to asm.js and/or Asm.js be added to V8 to create a faster VM and faster platform? Is it possible and will it happen?
Asm.js already runs on V8. It's just not fast. If you want to see if/when asm.js becomes fast in V8, see <a href="https://code.google.com/p/v8/issues/detail?id=2599" rel="nofollow">https://code.google.com/p/v8/issues/detail?id=2599</a><p>However, you don't seem to understand what asm.js is.<p>Asm.js is not JavaScript.<p>Syntactically it does look like JavaScript but it's really bytecode emulating CPU in JavaScript clothing.<p>As such asm.js is used to execute C code bases cross-compiled to asm.js with a tool like emscripten.<p>There is no such thing as "compiling JavaScript to asm.js" because there's no point. V8 (and every other modern JS VM) already compiles JavaScript to optimized CPU instruction set so it doesn't make sense to do JavaScript -> asm.js -> CPU instructions set.<p>To re-iterate: asm.js targets the same use case as p(nacl) i.e. compiling C/C++ code bases to something that can be executed in the web.<p>See <a href="http://mrale.ph/blog/2013/03/28/why-asmjs-bothers-me.html" rel="nofollow">http://mrale.ph/blog/2013/03/28/why-asmjs-bothers-me.html</a> for more info.
I'm not an asm.js expert by anyway means, but I did have some success using it. So here's some basic facts:<p>1) asm.js <i>is</i> Javascript, albeit a strict subset<p>2) asm.js is not Emscripten. Emscripten is rather a tool that converts LLVM IR to asm.js - in fact, before asm.js was released, Emscripten still worked, albeit significantly slower.<p>3) While you can't 'compile' Javascript to asm.js, you could in theory manually convert it - the reason it's so closely associated with C/C++ is that there's type information available to do the conversion to asm.js automatically<p>4) Just as an example, asm.js works by doing things like bitwise ORing numbers with zero to make it possible for the Javascript engine to immediately know you're actually only dealing with integers. In that sense it gives you AOT-like potential, rather than running the loop a few hundred times to see what you're getting before JITing it.<p>With V8, Google seem to be taking the approach it's better to optimise more generally, rather than focussing on asm.js.