Saturday, April 23, 2016

V8 Release 5.1

The first step in the V8 release process is a new branch from the git master immediately before Chromium branches for a Chrome Beta milestone (roughly every six weeks). Our newest release branch is V8 5.1, which will remain in beta until we release a stable build in conjunction with Chrome 51 Stable. Here’s a highlight of the new developer-facing features in this version of V8.

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 
The impact is reduced jank and memory consumption in times of need.

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

12 comments:

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

    perhaps ES2016?

    ReplyDelete
    Replies
    1. ES2016, as far as I know, is already finished and contains almost no changes. ES2017 is where the development is at, currently.
      Link: http://www.2ality.com/2016/01/ecmascript-2016.html

      Delete
    2. That's right.

      See http://www.2ality.com/2015/11/tc39-process.html #3

      There is no such a thing as ES2017 yet.

      Delete
    3. Yes, with ES2017 draft spec we mean the spec currently in development by TC39.

      Delete
  2. You can find the ES2017 draft specification at http://tc39.github.io/ecma262/ . It includes additional features and bug fixes compared to ES2015 and ES2016.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. When will it be possible to enable WebAssembly in a public releases of Chrome? What it the time-scale that you expect (as a first guess from top of your head).
    1- One month?
    2- 6 Months?
    3- One year?
    4- Ten years!

    ReplyDelete
    Replies
    1. The reason I ask is that I am implementing a 3D solid design application and I really want to implement it using WebAssembly. But by the time we release, (in ~2 months), will WebAssembly be an option? (Otherwise I have to wait and reimplement it later).

      Delete
    2. Hi Sohail, we're working towards a time when we can turn on WebAssembly by default in public releases, but we don't have an estimate of a particular time-scale at the moment. However, I would suggest investigating the Emscripten toolchain which can compile your C/C++ code to asm.js today. Once WebAssembly is enabled, you will be able to use the same codebase and toolchain with simply a different compile command-line flag to target wasm.

      Delete
  5. Hi Seth, thank you. Good solution, so I will use emcc/em++ for now.

    http://wedesign.live/

    ReplyDelete
  6. Stand immediately, then lower Exoslim down as in case you were achieving to choose some thing up until you experience your hamstrings stretch. this doesn't always have to be all of the manner down. make sure that you operate your hamstrings to drag your self back up as well. For more ==== >>>>>> http://greentheorygarcinia.com/exoslim-garcinia-cambogia/

    ReplyDelete
  7. physical activities like biking, Hydro Muscle Max cross instructor, and so on. make certain you do the proper physical games underneath the remark of a right certified teacher. they'll price you to start with for the training however it'll be well.For more ==== >>>>>> http://supplementsabout.co.uk/hydro-muscle-max/

    ReplyDelete