Interestingly, emscripten now also supports an interpreted byte code mode (called emterpreter), which stores code in a byte code format, and runs this inside an JS interpreter(!). The reason for this was quicker startup time for large scripts, but (my own speculation!) it might also be a path to a future byte code distribution format if there are indeed any other practical advantages.
Another interesting point is that Safari actually has now an LLVM based compilation layer in their Javascript engine, so it's coming together from both sides with LLVM being the glue (emscripten's front end is also LLVM).
The disadvantage is that compilation takes a not-insignificant amount of time, particularly if you want to go from running AST on a VM to running platform native code. It takes even longer if you're on an underpowered device which could take the most advantage of a simple IR bytecode -> native bytecode compilation.
This is evidenced in the 50% numbers from the OP's article.
I believe this is the same reason Khronos defined their own IR (SPIR) instead of using LLVM's. Needs to be stable.
LLVM has a single implementation, is very complex, isn't even remotely portable, and is primarily suited to C and C++, or similar languages.
We also already have a very performant transformation format for LLVM IR into JS: asm.js. And asm.js fixes most of LLVM IR's problems:
* It's very simple
* It's portable across architectures
* It doesn't have undefined behaviour
* It has multiple implementations
* It has forwards-compatibility (existing browsers, regardless of explicit support, can run asm.js code)
* It is standardised
It might not compile on an AT-MEGA, but it seems portable enough for the purposes of acting as a browser bytecode representation.
> So why did the author throw out LLVM byte code again?
"Again" is right. I don't particularly seek out discussions on this topic, but I've seen this question asked and answered at least half a dozen times before, which is enough for it to start getting annoying.
What does that even mean?
So why did the author throw out LLVM byte code again? It's BSD, it has bytecode compilers for most platforms browsers exist on (100% vs. 50% speed), and doesn't rely on a subset of another language. It also doesn't have the requirement to fall back to vanilla Javascript. As an added bonus, Javascript could easily compile down to LLVM bytecode.
Seems like the author already preferred their answer and threw out some BS to "justify" their choice.
JS probably will remain the "byte code of the web", but this article adds nothing to that trajectory.