Version 5.1 of The V8 JavaScript Engine Released


Version 5.1 of the popular V8 JavaScript runtime was just released.  V8 started life as a high performance JavaScript runtime intended to power the Chromium (Google Chrome) web browser.  As it is one of those silent behind the scenes technologies we just take for granted, it’s perhaps useful to start with a description of V8 itself before continuing.  Here is Google’s own description of the V8 project:

V8 implements ECMAScript as specified in ECMA-262, 5th edition, and runs on Windows (XP or newer), Mac OS X (10.5 or newer), and Linux systems that use IA-32, x64, or ARM processors.

V8 compiles and executes JavaScript source code, handles memory allocation for objects, and garbage collects objects it no longer needs. V8’s stop-the-world, generational, accurate garbage collector is one of the keys to V8’s performance. You can learn about this and other performance aspects in V8 Design Elements.

JavaScript is most commonly used for client-side scripting in a browser, being used to manipulate Document Object Model (DOM) objects for example. The DOM is not, however, typically provided by the JavaScript engine but instead by a browser. The same is true of V8—Google Chrome provides the DOM. V8 does however provide all the data types, operators, objects and functions specified in the ECMA standard.

While providing a fast JavaScript runtime for a browser is important, it’s V8’s embeddability that has perhaps been it’s most important contribution.  Notice how JavaScript outside the browser has been more and more popular of late?  Most of this can be attributed to NodeJS.  Well Node itself is built on top of the V8 runtime.  Almost every single HTML5 based tool or engine I’ve discussed recently such as Cocos Creator, Superpowers or QICI Engine are in turn powered by Node.  Many modern tools are also built on top of Node as well including Visual Studio Code, Atom and MongoDB.  Sufficed to say V8 is increasingly important to game developers, and all developers in general.


So that’s a brief overview of V8 and hopefully explains why it might be of some importance to you, even if you don’t develop directly in JavaScript.  Now let’s get back to the details of the release.  So what does 5.1 bring?

Improved ECMAScript support

V8 5.1 contains a number of changes towards compliance with the ES2017 draft spec.


Symbol.species allows you to override which constructor is used to construct objects when calling methods on a subclass of Array, RegExp, and other built-in classes.

instanceof customization

Constructors can implement their own Symbol.hasInstance method, which overrides the default behavior.

Iterator closing

Iterators created as part of a for-of loop (or other built-in iteration, such as the spread operator) are now checked for a close method which is called if the loop terminates early. This can be used for clean-up duty after the iteration has finished.

RegExp subclassing exec method

RegExp subclasses can overwrite the exec method to change just the core matching algorithm, with the guarantee that this is called by higher level functions like String.prototype.replace.

Function name inference

Function names inferred for function expressions are now typically made available in the name property of functions, following the ES2015 formalization of these rules. This may change existing stack traces and provide different names from previous V8 versions. It also gives useful names to properties and methods with computed property names:

class Container {     ...     [Symbol.iterator]() { ... }     ...  }  let c = new Container;  // Logs "[Symbol.iterator]".  console.log(c[Symbol.iterator].name);  

Analogous to other collection types, the values method on Array returns an iterator over the contents of the Array.

Performance improvements

Release 5.1 also brings a few notable performance improvements to the following JavaScript features:

  • Executing loops like for-in
  • Object.assign
  • Promise and RegExp instantiation
  • Calling Object.prototype.hasOwnProperty
  • Math.floor, Math.round and Math.ceil
  • Array.prototype.push
  • Object.keys
  • Array.prototype.join & Array.prototype.toString
  • Flattening repeat strings e.g. ‘.’.repeat(1000)


5.1 has a preliminary support for WASM. You can enable it via the flag –expose_wasm in d8. Alternatively you can try out the WASM demos with Chrome 51 (Beta Channel).


V8 implemented more slices of Orinoco:

  • Parallel young generation evacuation 
  • Scalable remembered sets 
  • Black allocation

The impact is reduced jank and memory consumption in times of need.


You can read the full release notes here.The WASM announcement is perhaps the most interesting and confusing part of the release, so we will go into a bit of detail now.  So what exactly is Web Assembly?  Well:

WebAssembly is a low-level, portable bytecode that is designed to be encoded in a compact binary format and executed at near-native speed in a memory-safe sandbox. As an evolution of existing technologies, WebAssembly is tightly integrated with the web platform, as well as faster to download over the network and faster to instantiate than asm.js, a low-level subset of JavaScript.

So, essentially it’s a byte code for the web.  You can read more about the topic here if you are interested.

GameDev News

Scroll to Top