Apple’s WebKit joins the WebAssembly bandwagon

Posted on 07-06-2017 , by: admin , in , 0 Comments

Momentum continues to build for the WebAssembly binary format. WebKit, Apple’s open source browser engine used in Safari, now has a full implementation of WebAssembly.

The implementation supports WebAssembly on Intel x86-64 and ARM64 processors. Calling WebAsembly a “no-nonsense sidekick to JavaScript,” Apple’s Saam Barati and two colleagues, JF Bastien and Keith Miller, described WebAssembly as a low-level binary format designed to be a suitable compilation target for languages such as C++. “The WebAssembly code that the browser sees will already have undergone high-level, language-specific optimizations. This is great because it means implementations don’t have to know about how C++ or other languages are optimized,” Barati said.

With WebAssembly, the hope is that it will boost web application speeds and enable languages other than JavaScript to run in browsers. The technology also has the support of the other three major browser vendors: Google, Microsoft, and Mozilla.

But WebAssembly cannot do everything JavaScript does. It cannot, for example, access the DOM without calling into JavaScript, so it is meant to be used with JavaScript. Because WebAssembly exposes itself as a regular JavaScript object, its WebKit implementation can reuse some machinery already in WebKit, including an ECMAScript module used to implement WebAssembly. To allow sharing of modules between web workers and prepare for features such as threads, Apple’s internal representation of WebAssembly code has been made thread-safe.