Tuesday, March 15, 2016

V8 Release 5.0

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.0, which will remain in beta until we release a stable build in conjunction with Chrome 50 Stable. Here’s a highlight of the new developer-facing features in this version of V8.

Note: The version number 5.0 does not carry semantic significance or mark a major release (as opposed to a minor release).


Improved ECMAScript 2015 (ES6) support

V8 5.0 contains a number of ES2015 features related to regular expression (regex) matching.

RegExp Unicode flag

The RegExp Unicode flag, u, switches on a new Unicode mode for regular expression matching. The Unicode flag treats patterns and regex strings as a series of Unicode codepoints. It also exposes new syntax for Unicode codepoint escapes.
/😊{2}/.test('😊😊');
// false

/😊{2}/u.test('😊😊');
// true

/\u{76}\u{38}/u.test('v8');
// true

/\u{1F60A}/u.test('😊');
// true

The u flag also makes the . operator (also known as the single character matcher) match any Unicode symbol rather than just the characters in the Basic Multilingual Plane (BMP).
var string = 'the 🅛 train';

/the\s.\strain/.test(string);
// false

/the\s.\strain/u.test(string);
// true 

RegExp customization hooks

ES2015 includes hooks for RegExp subclasses to change the semantics of matching. Subclasses can override methods named Symbol.match, Symbol.replace, Symbol.search and Symbol.split in order to change how RegExp subclasses behave with respect to String.prototype.match and similar methods.

Performance improvements in ES2015 and ES5 features

Release 5.0 also brings a few notable performance improvements to already implemented ES2015 and ES5 features.

The implementation of rest parameters is 8-10x faster than that of the previous release, making it more efficient to gather large numbers of arguments into a single array after a function call. Object.keys(), useful for iterating over an object’s enumerable properties in the same order returned by for..in, is now approximately 2x faster.

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.0 -t branch-heads/5.0' to experiment with the new features in V8 5.0. Alternatively you can subscribe to Chrome's Beta channel and try the new features out yourself soon.

Posted by the V8 team

10 comments:

  1. Great work, thank you for your efforts!

    ReplyDelete
  2. ...someone's from wburg! ;)

    ReplyDelete
  3. Last I remember the ES6 feature coverage was 91%. What is the new percentage coverage of ES6 features?

    ReplyDelete
    Replies
    1. If you are referring to Kangax coverage it is 93 % with 5.0. If you mean test262 it is around 97 %. You can try out the latter by compiling the website for yourself or use a 2 month old test suite from http://v8.github.io/test262/website/default.html.

      Delete
  4. > Note: The version number 5.0 does not carry semantic significance or mark a major release (as opposed to a minor release).

    What is the point of the 5.0 release over another 4.x release then?

    ReplyDelete
    Replies
    1. 5.0 is the V8 version used in Chrome 50. This makes mapping easier for us.

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. this has surfaced a strange bug with the isClass method inside angular js 1.55, the regex used to test if a function is a class works the first time then fails the 2nd time
    Not sure where to raise the issue but it appears to be a chrome bug as it worked before and when trying to debug the angular code, some times the rx tests true and sometimes false on the same check

    ReplyDelete
    Replies
    1. Please create a bug report with repro at https://bugs.chromium.org/p/v8/issues/entry?template=Defect%20report%20from%20user.

      Delete