简体   繁体   English

如何检查Firefox是否使用asm.js代码?

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

那么如何通过例如Google的V8引擎检查它是否像普通的Javascript一样执行,或者使用程序集以近原生性能执行?

If you just look at the console, Firefox will tell you whether your asm.js validated or not. 如果您只是查看控制台,Firefox会告诉您asm.js是否已经过验证。 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: 在这种情况下,第23行是:

                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). 这意味着它一切正常(而且“错误”只是在这种情况下JS引擎如何报告成功的一个虚假怪癖;我提交了https://bugzilla.mozilla.org/show_bug.cgi?id=950527以获取固定的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM