5 ms·
Once WebAssembly supports all the features of JavaScript, which is on the roadmap (step 3, "everything else" [1]), it'll be a very sensible thing to do, especia
by DonHopkins 11y ago
Once WebAssembly supports all the features of JavaScript, which is on the roadmap (step 3, "everything else" [1]), it'll be a very sensible thing to do, especially for mobile.
Compiling JavaScript text source code into a binary representation of its AST will save time and space downloading, and time starting up.
You won't need another JIT compiler, the web browser usually already has one. WebAssembly is bytecode and JIT agnostic. Compiling text JavaScript into a binary WebAssembly representation of the parse tree is different than compiling the parse tree to bytecode, or JITting the parse tree or bytecode to machine code. They are complementary layers, and both synergistically useful together.
[1] http://bytecrafter.blogspot.nl/2015/06/a-quick-overview-of-what-webassembly-is.html http://bytecrafter.blogspot.nl/2015/06/a-quick-overview-of-w...
- twistedpair 11y agoI can only imagine the possible security exploits available by passing AST binaries directly to the browser, rather than letting the JS lexer/tokenizer and compiler enforce language rules from the source.
- jfbastien 11y agoThe wasm AST is also a language, and a very simple one at that. Much easier to test and fuzz than all-out JS.
- robbrown451 11y agoLuckily, the designers of WebAssembly imagined those things before you.
- lisivka 11y agoThat's true of version 1, but supporting arbitrary JavaScript is on the roadmap.