Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check if Firefox uses asm.js code?

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?

like image 909
I LOVE YOU Avatar asked Dec 15 '13 15:12

I LOVE YOU


1 Answers

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).

like image 76
Boris Zbarsky Avatar answered Oct 16 '22 06:10

Boris Zbarsky