Prepack, https://prepack.io, is also in the same realm of an optimizing Javascript compiler.
Of course prepack also isn't even close to production ready yet either.
function add5(x) {
return x + 5;
}
console.log(add5(3));
compiles down to console.log(8);Unlike GCC, it can unroll any kind of metaprogramming, but it needs to have a model of the environment (e.g. it won’t execute code relying on DOM) and it can produce larger code (in terms of absolute size).
Admittedly it doesn't take JS as input, but I was somewhat confused when I read your comment nonetheless.
Also if you need faster numeric calculations https://github.com/non/spire (has scala.js support)