Today we’re happy to announce, in tandem with Firefox and Edge, a WebAssembly Browser Preview. WebAssembly or wasm is a new runtime and compilation target for the web, designed by collaborators from Google, Mozilla, Microsoft, Apple, and the W3C WebAssembly Community Group.
Since WebAssembly is still behind a flag in Chrome (chrome://flags/#enable-webassembly), it is not yet recommended for production use. However, the Browser Preview period marks a time during which we are actively collecting feedback on the design and implementation of the spec. Developers are encouraged to test out compiling and porting applications and running them in the browser.
V8 continues to optimize the implementation of WebAssembly in the TurboFan compiler. Since last March when we first announced experimental support, we’ve added support for parallel compilation. In addition, we’re nearing completion of an alternate asm.js pipeline, which converts asm.js to WebAssembly under the hood so that existing asm.js sites can reap some of the benefits of WebAssembly ahead-of-time compilation.
What does this milestone mark?
This milestone is significant because it marks:- a release candidate for our MVP (minimum viable product) design (including semantics, binary format, and JS API)
- compatible and stable implementations of WebAssembly behind a flag on trunk in V8 and SpiderMonkey, in development builds of Chakra, and in progress in JavaScriptCore
- a working toolchain for developers to compile WebAssembly modules from C/C++ source files
- a roadmap to ship WebAssembly on-by-default barring changes based on community feedback
Raw Bytes | Text Format | C Source |
02 40 03 40 20 00 45 0d 01 | block loop get_local 0 i32.eqz br_if 1 | while (x != 0) { |
20 00 21 02 | get_local 0 set_local 2 | z = x; |
20 01 20 00 6f 21 00 | get_local 1 get_local 0 i32.rem_s set_local 0 | x = y % x; |
20 02 21 01 | get_local 2 set_local 1 | y = z; |
0c 00 0b 0b | br 0 end end | } |
20 01 | get_local 1 | return y; |
Greatest Common Divisor function
Since WebAssembly is still behind a flag in Chrome (chrome://flags/#enable-webassembly), it is not yet recommended for production use. However, the Browser Preview period marks a time during which we are actively collecting feedback on the design and implementation of the spec. Developers are encouraged to test out compiling and porting applications and running them in the browser.
V8 continues to optimize the implementation of WebAssembly in the TurboFan compiler. Since last March when we first announced experimental support, we’ve added support for parallel compilation. In addition, we’re nearing completion of an alternate asm.js pipeline, which converts asm.js to WebAssembly under the hood so that existing asm.js sites can reap some of the benefits of WebAssembly ahead-of-time compilation.
What's next?
Barring major design changes arising from community feedback, the WebAssembly Community Group plans to produce an official specification in Q1 2017, at which point browsers will be encouraged to ship WebAssembly on-by-default. From that point forward, the binary format will be reset to version 1 and WebAssembly will be versionless, feature-tested, and backwards-compatible. A more detailed roadmap can be found on the WebAssembly project site.