![](/img/trans.png)
[英]Is there a clever way to check from code whether asm.js is active or not?
[英]Is there a way to validate asm.js code
我希望在Firefox Nightly中发现编译消息,但不会发生。 为此有特殊的开关吗?
没有测试过,但似乎有一个验证器在这里 。
快速浏览测试提示它可以按以下方式使用:
var asm = require('asm.js');
try {
report = asm.validate(String(function f(stdlib, foreign, heap) {
"use asm";
// this is what we're validating
function f() {
var x = 0, y = 0;
x = ((x|0)%(y|0))|0;
}
return {};
}));
console.log('Validated!');
} catch(e) {
console.error(e);
}
您可以在Web控制台中检查它是否可以编译:给定一个模块中带有“ use asm”的页面,它应该提供:
Error: successfully compiled asm.js code (total compilation time 0ms)
或者是有关为何无法编译为asm的实际错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.