Automotive
Improved ECMAScript support
V8 5.1 contains a number of changes towards compliance with the ES2017 draft spec.Symbol.species
Array methods like Array.prototype.map construct instances of the subclass as its output, with the option to customize this by changing Symbol.species. Analogous changes are made to 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);
Array.prototype.values
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)
WASM
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).Memory
V8 implemented more slices of Orinoco:- Parallel young generation evacuation
- Scalable remembered sets
- Black allocation
V8 API
Please check out our summary of API changes. This document gets regularly updated a few weeks after each major release.Developers with an active V8 checkout can use 'git checkout -b 5.1 -t branch-heads/5.1' to experiment with the new features in V8 5.1. Alternatively you can subscribe to Chrome's Beta channel and try the new features out yourself soon.
Posted by the V8 team