So how can I check if it's executed like normal Javascript via for example Google's V8 engine or executed with near native performance using assembly?
If you just look at the console, Firefox will tell you whether your asm.js validated or not. In the case of the script pasted above, I get:
TypeError: asm.js type error: non-expression-statement call must be coerced test.html:23
which suggests not. Line 23 in this case is:
return +sqrt(square(x) + square(y));
If I replace that line with this:
return +sqrt(+square(x) + +square(y));
then the error console says:
Error: successfully compiled asm.js code (total compilation time 0ms)
which means it all worked fine (and the "Error" there is just a bogus quirk of how the JS engine reports success in this case; I filed https://bugzilla.mozilla.org/show_bug.cgi?id=950527 to get that fixed).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With