BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News WebAssembly Preview Functionality Arrives in Browsers

WebAssembly Preview Functionality Arrives in Browsers

This item in japanese

In a coordinated announcement, Microsoft, Google, and Mozilla each published a blog post showing off WebAssembly functionality in their respective browsers.

This collaboration represents an essential step in standardizing the WebAssembly binary format. The work that each vendor has done allows them to have a better conversation about the format and how to move forward.

The vendors' WebAssembly work builds on their asm.js implementations. Like asm.js, WebAssembly offers a "memory-safe, sandboxed execution environment". Unlike asm.js, an equivalent WebAssembly binary is much smaller, and eliminates the need to parse JavaScript. The browsers can natively parse the binary representation much faster. In his Fluent 2016 Conference Keynote, Brendan Eich described it as "safe, quick, self-verifying code that can do things that JavaScript can't. At some point, WebAssembly becomes the safe, native format for the web."

On Google's V8 announcement, Seth Thompson says that:

the WebAssembly implementation in V8 is designed to reuse much of the existing JavaScript virtual machine infrastructure, specifically the TurboFan compiler. The decoder produces a TurboFan graph which is processed by various optimization passes and finally turned into machine code by the same backend which generates machine code for optimized JavaScript and asm.js.

From the Mozilla camp, Luke Wagner, Chair of the WebAssembly W3C Community Group says:

Within Firefox, we refactored our existing asm.js optimization pipeline to use WebAssembly’s binary format as the representation of asm.js code sent from the main parsing thread to the background compiler threads.

A demo WebAssembly app is available at http://webassembly.github.io/demo/; below, a video of the game play inside Edge:

To enable the experimental features:

  • In Chrome: Using Chrome Canary 51.0.2677.0 or higher, turn on the chrome://flags#enable-webassembly flag
  • In Firefox: using the latest nightly build, set the javascript.options.wasm to true

Edge support for WebAssembly is currently only available in an Microsoft internal build and WebKit's implementation is still in development.

Rate this Article

Adoption
Style

BT