What’s new in Google’s V8 JavaScript engine Version 7

The V8 Version 7.4 beta lays the groundwork for possible future iOS support

What’s new in Google’s V8 JavaScript engine
Deavmi (CC BY-SA 3.0)

The beta V8 Version 7.4 is now available, with the potential to expand the engine’s footprint to platforms such as Apple iOS. V8 is Google’s open source JavaScript and WebAssembly engine for the Chrome browser. It is a staple in both the Chrome browser and the Node.js JavaScript runtime.

Where to download Google V8

You can the download the production version of Google V8 from the Chromium V8 repo.

Future version: What’s new in V8 Version 7.4

With the production version due in April 2019, Google V8 beta 7.4 has the following new features:

  • JIT-less V8, in which JavaScript execution is supported without allocating executable memory at runtime. This could allow expansion of V8 onto platforms such as Apple iOS, smart TVs, and game consoles. The default configuration of V8 has relied on the ability to allocate and modify executable memory at runtime. But there are situations where it can be desirable to run the engine without allocating executable memory, such as platforms that have prohibited write access to nonexecutable memory for nonprivileged applications, including iOS. Also, disallowing writes to executable memory reduces the attack surface of the application for exploits. With the JIT-less mode, V8 switches to an interpreter-only mode for JavaScript; WebAssembly currently does not support this mode. JIT-less mode does come with a performance penalty, however.
  • WebAssembly Threads/Atomics are now enabled on non-Android OSes. This move unlocks the use of multiple cores via WebAssembly, enabling new, computation-heavy uses on the web.
  • To improve performance, Version 7.4 skips arguments adaption in some cases, reducing call overhead by 60 percent.
  • Performance has been improved for calling into native accessors, which are DOM accessors.
  • Preparser performance was improved by removing a deduplication involving property names. Additionally, a performance issue was fixed that involved custom UTF-8 decoding used by the source stream.
  • To reduce memory overhead, support has been implemented for flushing compiled bytecode from functions during garbage collection if they have not been executed recently.
  • To support private class fields, Developers can mark a field as private by prepending it with the # prefix.

Where to download the V8 7.4 beta

You can download the V8 beta from Google’s Chromium Git repo.

Current version: What’s new in V8 Version 7.3

New features in V8 7.3 include:

  • The --async-stack-traces flag is turned on by default.
  • Zero-cost async stack traces make it easier to diagnose problems in production with asynchronous code; the stack property usually sent to log files and services now provides more insight into problems.
  • A faster await, with the --harmony-await-optimization flag turned on by default. This is a prerequisite for --async-stack-traces.
  • Quicker startup for WebAssembly via optimizations. For most workloads, compilation is improved by 15 percent to 25 percent.
  • JavaScript features such as fromEntries(), an API to perform the inverse of Object.entries, and String.prototype.Matchall, an API to make it easier toapply global or sticky regular expressions to a string and iterating through all matches.

Current version: What’s new in Google V8 Version 7.2

January 2019’s Version 7.2 of V8 improves JavaScript parsing, the WebAssembly binary format, and memory.

To improve parsing speed, V8 Version 7.2 includes what Google calls the engine’s fastest-ever JavaScript parser, resulting in quicker page loading and more-responsive pages. Since V8 Version 7.0, desktop parsing speed has improved about 30 percent, Google says.

For memory, embedded built-ins that save memory by sharing generated code across multiple isolates are now supported and enabled by default on the IA32 architecture.

For WebAssembly, V8 7.2 has code-generation improvements, including the enablement of node splitting in the optimizing compiler’s scheduler and loop rotation in the back end. Also, wrapper caching has been improved and custom wrappers introduced to reduce overhead when calling imported JavaScript math functions.

Design changes to the register allocator improve performance for code patterns that will appear in a later release. Also, trap handlers in Version 7.2 improve throughput of WebAssembly code. They are implemented on Windows, MacOS, and Linux. In Chromium, they are enabled on Linux, with MacOs and Windows to follow when stability is confirmed. Plans also call for them to be available on Android.

Other new features in V8 7.2 include:

  • Spread elements performance has been improved when these occur at the front of the array literal.
  • A faster async/await implementation is enabled by default. The change may be merged into the official ECMAScript specification.
  • Zero-coast async stack traces enrich the stack property with asynchronous call frames. This capability is available behind the --async-stack-traces command-line flag.
  • Support for public class fields, which expands the JavaScript syntax for simplification.
  • The ListFormat proposal, for localizing formatting of lists.
  • stringify now outputs escape sequences for lone surrogates, making the output valid Unicode.

Previous version: What’s new in Google V8 Version 7.1

November 2018’s Version 7.1 of V8 features improvements in memory and performance along with enhancements for both JavaScript and the WebAssembly binary format. For memory, bytecodes for the interpreter now are embedded into the binary, saving about 200KB on average per isolate. To improve performance, the escape analysis in the TurboFan compiler is enhanced to handle local function contexts for higher order functions, when variables from the surrounding context escape to a local closure. With escape analysis, scalar replacement is performed for objects local to an optimization unit.

Other new features in V8 Version 7.1:

  • For JavaScript, the RelativeTimeformat API featured in the upgrade allows localized formatting of relative times, such as “yesterday,” without sacrificing performance. Also, version 7.1 supports the GlobalThis proposal, providing a universal mechanism to access the global object even in strict functions or modules, regardless of the platform.
  • For WebAssembly bytecode format, postMessage is supported for modules. This behavior is scoped to web workers and is not extended to cross-process scenarios.

Previous version: What’s new in Google V8 Version 7.0

October 2018’s V8 Version 7.0 previews WebAssembly threads, which provide a primitive for parallel computation. To use threads in the Chrome browser, which uses V8, developers can enable it via chrome://flags/#enable-webassembly-threads or sign up for an Origin Trial, for experimenting with new web features. WebAssembly, aka Wasm, enables compilation of code written in different languages to run on the web.

Other new features in V8 7.0 include:

  • For JavaScript, the description property is added to prototype, providing a more-ergonomic way to access the description. Also, Array.prototype.sort becomes stable in Version 7.0.
  • Extension of embedded built-ins, which save memory by sharing generated code across multiple isolates. V8 Version 6.9 enabled built-ins on the X64 architecture while Version 7.0 extends them to the remaining platforms except IA-32.

Previous version: What’s new in Google V8 Version 6.9

September 2018’s V8 Version 6.9 focuses on memory and performance improvements for Google’s JavaScript engine.

For memory savings, Version 6.9 offers embedded built-ins for x64-based computers. These are functions shared by all isolates and embedded onto the binary itself instead of being copied onto the JavaScript heap, thus existing in memory only once regardless of how many isolates are running. V8’s designers have seen an average 9 percent reduction of the heap size across the top 10,000 websites on x64 computers. Support for other platforms will follow in later releases.

For performance, V8 Version 6.9 reduces Mark-Compact garbage collection pause times by improving WeakMap processing. Concurrent and incremental marking now can process WeakMaps. Previously, this work was done in the final atomic pause of Mark-Compact garbage collection. The garbage collection now also does more work in parallel to lower pause times.

For performance, DataView methods have been reimplemented in V8 Torque, sparing a costly call to C++ compared to the previous runtime implementation. Also, calls to DataView methods now are inlined when compiling JavaScript into the TurboFan optimizing compiler. This provides better peak performance for hot code.

V8 Version 6.9 also includes Liftoff, a baseline compiler for the WebAssembly portable code format. It is enabled by default and intended to reduce startup times for WebAssembly-based apps by generating code as quickly as possible. Code itself quality is a secondary priority for Liftoff, with code eventually to be recompiled by V8’s TurboFan compiler.

Liftoff was developed to address an issue in which the back end of the compilation process for TurboFan consumed a lot of time and memory, reducing performance of the WebAssembly code. Liftoff avoids the time and memory overhead of intermediate representation, generating machine code in a single pass over the bytecode of a WebAssembly function. Liftoff and Turbofan give V8 two compilation tiers, with Liftoff a baseline compiler for fast startup and TurboFan providing optimization for performance.

Google also plans to further improve startup time, cut memory consumption, and bring benefits of Liftoff to more users. These plans involve ports to ARM processors, for use on mobile devices. Liftoff currently works only on Intel 32- and 64-bit platforms. Other improvements under consideration include:

  • Implementing dynamic tier-up for mobile devices, to accommodate lower memory volumes on these devices. Experiments are proceeding with a combination of lazy compilation with Liftoff and dynamic tier-up of hot functions in TurboFan.
  • Improving Liftoff code generation performance and improving the  generated code as well.

Previous version: What’s new in V8 Version 6.8

Google V8 Version 6.8, released in July 2018, focuses on performance and memory usage.

Performance has been boosted by array destructuring improvements. The optimizing compiler had not been generating ideal code for array destructuring, so the builders of V8 blocked escape analysis to eliminate temporary allocation, which made array destructuring with a temporary array as fast as a sequence of assignments.

A new implementation of Object.assign improves performance, via implementation of a fast path for JavaScript.

Performance for TypedArrays has been increased in instances when sorting is done using a comparison function.

Other new features in V8 Version 6.8 include:

  • To improve execution speed with the WebAssembly portable code format, developers can use trap-based bounds checking, a memory-management optimization, on Linux x64 platforms.
  • Memory consumption of SFIs (SharedFunctionInfo) has been reduced, via compression and removal of unnecessary fields.
  • Also to improve memory capabilities, a dependency on SFIs has been broken in which SFIs were unnecessarily kept alive, which had led to the risk of memory leaks.

Previous version: What’s new in V8 Version 6.7

Google’s V8 JavaScriptengine is getting enhancements for language features and security with the Version 6.7 branch, which is now in production release.

The V8 6.7 engine has BigInt support enabled by default. Expected in a future version of ECMAScriptBigInts serve as a numeric primitive in JavaScript to represent integers with arbitrary precision. With BigInt, it is possible to perform integer arithmetic without overflowing. BigInt could serve as the basis of an eventual BigDecimal implementation, useful for representing sums of money with decimal precision.

Also featured in V8 6.7 are more mitigations for side-channel vulnerabilities, intended to prevent information leaks to untrusted code for JavaScript and WebAssembly.

Previous version: What’s new in V8 Version 6.6

Version 6.6 of Google’s V8 JavaScript engine focuses on JavaScript language features and code-caching capabilities.

For JavaScript, Function.prototype.toString() returns exact slices of source code text, including whitespace and comments. V8 Version 6.6 also implements String.prototype.trimStart() and String.prototype.trimEnd(). This capability had been available through nonstandard trimLeft() and trimRight() methods, which remain as aliases of the new methods to enable backward compatibility.

Additionally, line and paragraph separator symbols can be used in string literals, thus matching JSON. Previously, these had been treated as line terminators in string literals and their usage resulted in a SyntaxError exception.

The Array.prototype.values method gives arrays the same iteration interface as the ECMAScript 2015 Map and Set collections. These can be interacted over by keys, values, or entries by calling the same-named method. This change could be incompatible with existing JavaScript code; developers who find odd or broken behavior on a website can try to disable this feature via chrome://flags/#enable-array-prototype-values.

In another JavaScript programming improvement, the catch clause of try statements can be used without a parameter, which is useful if there is no need for an exception object in the code handling the exception.

1 2 Page 1
Page 1 of 2