BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Microsoft's JavaScript Engine Learns New Tricks For Windows 10

Microsoft's JavaScript Engine Learns New Tricks For Windows 10

This item in japanese

The Internet Explorer team at Microsoft recently detailed changes to the JavaScript engine coming in Windows 10. A significant change is the addition of a new tier in the Just-in-Time (JIT) compiler.

The JavaScript engine, Chakra, was first introduced in IE9 and powers not only Internet Explorer but web-based apps downloaded from Microsoft's app stores. Chakra starts by running JavaScript with an interpreter, a slow but flexible method. Once a method or loop becomes "hot", Chakra will use its JIT compiler to generate optimized machine code.

In Windows 10, Chakra now includes a second JIT compiler that bridges the gap between slow, interpreted code and fast, optimized code. It uses this middle-tier compiler, called Simple JIT, as a "good enough" layer that can move execution away from the interpreter quicker than the Full JIT can. Microsoft claims that the changes will allow certain workloads to "run up to 30% faster".

Simple JIT avoids generating code with complex optimizations... In most cases, the time to compile the code by the Simple JIT is much smaller than the time needed to compile highly optimized JIT code by the Full JIT compiler.

The move to a two-tiered JIT compiler structure mirrors what other browsers have done. SpiderMonkey, the JavaScript engine in Firefox, has an interpreter and two compilers: Baseline and IonMonkey. The Baseline compiler was first introduced in Firefox 23 and provides the same intermediate step as the Simple JIT compiler in Chakra. In Google Chrome, the V8 JavaScript engine announced their two-tiered compilation system in 2010, but V8 does not use an interpreter.

Beyond the addition of a new JIT tier, Chakra can now split the job of compiling code to many background threads. Before, it only used a single background thread,

Whenever Chakra determines that it is running on a potentially underutilized hardware, Chakra now has the ability to spawn multiple concurrent background threads for JIT compilation.

The V8 Engine compiles on a single background thread.

The nature of the web doesn't allow JavaScript code to be compiled ahead of time; thus, the compilation must happen on the client. The first version of Firefox to include a JavaScript native code JIT compiler was version 3.1 and Internet Explorer first got the feature in IE9. V8 has had its JIT compiler from its start.

The new Internet Explorer is available as part of the Windows 10 Technical Preview.

Rate this Article

Adoption
Style

BT