Hacker News new | ask | show | jobs
by masklinn 4244 days ago
> It is just JavaScript, so any browser can execute asm.js code, but it can be AOT compiled by some browsers for extra performance

Or JIT-compiled with phases specifically built for the kind of JS it produces e.g. Webkit's FTL tends to work very well on asm.js code, though it's not an asm.js AOT compiler.

> It doesn't require a new runtime or API, merely using the existing web APIs

That's not entirely true, AFAIK asm.js adds at least two functions to the Math namespace (imul and fround)

1 comments

> Or JIT-compiled with phases specifically built for the kind of JS it produces e.g. Webkit's FTL tends to work very well on asm.js code, though it's not an asm.js AOT compiler.

This is true, too. While I think you'd get the best results from AOT compilation, it should also compile really well under JITs since it has all the type information you normally have to guess.

> That's not entirely true, AFAIK asm.js adds at least two functions to the Math namespace (imul and fround)

That's an addition to JavaScript which isn't specific to asm.js, however, and both can be polyfilled. Math.fround, in particular, is useful outside of asm.js.

The stuff asm.js needs is all part of standard JS now, while NaCl and PNaCl require their own special API (Pepper) which only has one implementation (Google's).