V8 release v9.0

Every six weeks, we create a new branch of V8 as part of our release process. Each version is branched from V8’s Git master immediately before a Chrome Beta milestone. Today we’re pleased to announce our newest branch, V8 version 9.0, which is in beta …


This content originally appeared on V8 and was authored by Ingvar Stepanyan, standing inline

Every six weeks, we create a new branch of V8 as part of our release process. Each version is branched from V8’s Git master immediately before a Chrome Beta milestone. Today we’re pleased to announce our newest branch, V8 version 9.0, which is in beta until its release in coordination with Chrome 90 Stable in several weeks. V8 v9.0 is filled with all sorts of developer-facing goodies. This post provides a preview of some of the highlights in anticipation of the release.

JavaScript #

RegExp match indices #

Starting in v9.0, developers may opt into getting an array of the start and end positions of matched capture groups in regular expression matches. This array is available via the .indices property on match objects when the regular expression has the /d flag.

const re = /(a)(b)/d;        // Note the /d flag.
const m = re.exec('ab');
console.log(m.indices[0]); // Index 0 is the whole match.
// → [0, 2]
console.log(m.indices[1]); // Index 1 is the 1st capture group.
// → [0, 1]
console.log(m.indices[2]); // Index 2 is the 2nd capture group.
// → [1, 2]

Please see our explainer for an in-depth dive.

Faster super property access #

Accessing super properties (for example, super.x) has been optimized by using V8’s inline cache system and optimized code generation in TurboFan. With these changes, super property access is now closer to being on par with regular property access, as can be seen from the graphs below.

Compare super property access to regular property access, optimized

Please see the dedicated blog post for more details.

for ( async of disallowed #

A grammar ambiguity was recently discovered and fixed in V8 v9.0.

The token sequence for ( async of now no longer parses.

WebAssembly #

Faster JS-to-Wasm calls #

V8 uses different representations for the parameters of WebAssembly and JavaScript functions. For this reason, when JavaScript calls an exported WebAssembly function, the call goes through a so-called JS-to-Wasm wrapper, responsible for adapting parameters from JavaScript land to WebAssembly land as well as adapting results in the opposite direction.

Unfortunately, this comes with a performance cost, which meant that calls from JavaScript to WebAssembly were not as fast as calls from JavaScript to JavaScript. To minimize this overhead the JS-to-Wasm wrapper can now be inlined at the call site, simplifying the code and removing this extra frame.

Let’s say we have a WebAssembly function to add two double floating point numbers, like this:

double addNumbers(double x, double y) {
return x + y;
}

and say we call that from JavaScript to add some vectors (represented as typed arrays):

const addNumbers = instance.exports.addNumbers;

function vectorSum(len, v1, v2) {
let result = new Float64Array(len);
for (let i = 0; i < len; i++) {
result[i] = addNumbers(v1[i], v2[i]);
}
return result;
}

const N = 100_000_000;
let v1 = new Float64Array(N);
let v2 = new Float64Array(N);
for (let i = 0; i < N; i++) {
v1[i] = Math.random();
v2[i] = Math.random();
}

// Warmup
for (let i = 0; i < 5; i++) {
vectorSum(N, v1, v2);
}

// Measure
console.time();
let result = vectorSum(N, v1, v2);
console.timeEnd();

On this simplified microbenchmark, we see the following improvements:

Microbenchmark comparison

The feature is still experimental and can be enabled through the --turbo-inline-js-wasm-calls flag.

For more details, see the design document.

V8 API #

Please use git log branch-heads/8.9..branch-heads/9.0 include/v8.h to get a list of the API changes.

Developers with an active V8 checkout can use git checkout -b 9.0 -t branch-heads/9.0 to experiment with the new features in V8 v9.0. Alternatively you can subscribe to Chrome’s Beta channel and try the new features out yourself soon.


This content originally appeared on V8 and was authored by Ingvar Stepanyan, standing inline


Print Share Comment Cite Upload Translate Updates
APA

Ingvar Stepanyan, standing inline | Sciencx (2021-03-17T00:00:00+00:00) V8 release v9.0. Retrieved from https://www.scien.cx/2021/03/17/v8-release-v9-0/

MLA
" » V8 release v9.0." Ingvar Stepanyan, standing inline | Sciencx - Wednesday March 17, 2021, https://www.scien.cx/2021/03/17/v8-release-v9-0/
HARVARD
Ingvar Stepanyan, standing inline | Sciencx Wednesday March 17, 2021 » V8 release v9.0., viewed ,<https://www.scien.cx/2021/03/17/v8-release-v9-0/>
VANCOUVER
Ingvar Stepanyan, standing inline | Sciencx - » V8 release v9.0. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/03/17/v8-release-v9-0/
CHICAGO
" » V8 release v9.0." Ingvar Stepanyan, standing inline | Sciencx - Accessed . https://www.scien.cx/2021/03/17/v8-release-v9-0/
IEEE
" » V8 release v9.0." Ingvar Stepanyan, standing inline | Sciencx [Online]. Available: https://www.scien.cx/2021/03/17/v8-release-v9-0/. [Accessed: ]
rf:citation
» V8 release v9.0 | Ingvar Stepanyan, standing inline | Sciencx | https://www.scien.cx/2021/03/17/v8-release-v9-0/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.