2 ms·
tl;dr Asm.js is a subset of JavaScript that is easy to optimize. It's sort-of a competitor to NaCl, but its basic premise is that a specialized runtime is just
by lmkg 14y ago
tl;dr Asm.js is a subset of JavaScript that is easy to optimize. It's sort-of a competitor to NaCl, but its basic premise is that a specialized runtime is just a bonus, not a requirement, to run asm.js files.
Any and all asm.js code has the same semantics as regular JavaScript. This is the most important thing about it--it already runs, everywhere. If a browser gets an asm.js runtime, the only thing that changes is speed.
Asm.js code is very, very low-level. Pretty much the only operations supported are statically-typed arithmetic, and array load/stores. It doesn't use any dynamic behavior--the closest it has, is arrays of functions that must have identical signatures, so that you can implement vtables yourself. Its resemblance to assembly is intended to make it a better compiler target.