2 ms·
Without having actually done much to investigate the feasibility of this, it seems to me like someone could write a compiler infrastructure that would generate
by apendleton 14y ago
Without having actually done much to investigate the feasibility of this, it seems to me like someone could write a compiler infrastructure that would generate both asm.js and (P)NaCL output from the same lower-level non-JS code, since you can get to both from LLVM bytecode. Combined with a JS client library to paper over the differences between the two, developers could just write one set of low-level code and not care which fast-path execution strategy the browser implemented, and the asm.js version, along with whatever polyfill hacks were necessary to make it work, could be served to old browsers to run the same code slowly.
This is, I guess, not that different from the OP's suggestion to create a bytecode and define a one-pass transformation of that into JS.