Haven't tested it but there seems to be a validator in here.
A quick look in the tests hints that it can be used as follows:
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);
}
0
NoBugs
On
You can check that it compiles, in the Web Console: Given a page with "use asm" in a module, it should give:
Error: successfully compiled asm.js code (total compilation time 0ms)
or, an actual error about why it couldn't compile to asm.
Haven't tested it but there seems to be a validator in here.
A quick look in the tests hints that it can be used as follows: