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 7.5, which is in beta until its release in coordination with Chrome 75 Stable in several weeks. V8 v7.5 is filled with all sorts of developer-facing goodies. This post provides a preview of some of the highlights in anticipation of the release.
In case you want to use a similar feature in your V8 embedding, please take inspiration from Chromium’s implementation.
Bulk memory operations
The bulk memory proposal adds new instructions to WebAssembly for updating large regions of memory or tables.
memory.copy copies data from one region to another, even if the regions are overlapping (like C’s
memory.fill fills a region with a given byte (like C’s
memset). Similar to
table.copy copies from one region of a table to another, even if the regions are overlapping.
(memory.copy (i32.const 0) (i32.const 1000) (i32.const 500))
(memory.fill (i32.const 100) (i32.const 123) (i32.const 1000))
(table.copy (i32.const 15) (i32.const 5) (i32.const 10))
The proposal also provides a way to copy a constant region into linear memory or a table. To do so, we first need to define a “passive” segment. Unlike “active” segments, these segments are not initialized during module instantiation. Instead they can be copied into a memory or table region using the
(data $hello passive "Hello WebAssembly")
(memory.init (i32.const 10) (i32.const 0) (i32.const 5))
(memory.init (i32.const 1000) (i32.const 6) (i32.const 11))
Large numeric literals are difficult for the human eye to parse quickly, especially when there are lots of repeating digits:
Now it’s easier to tell that the first number is a trillion, and the second number is in the order of 1 billion.
Numeric separators help improve readability for all kinds of numeric literals:
Script streaming directly from network
As of Chrome 75, V8 can stream scripts directly from network into the streaming parser, without waiting for the Chrome main thread.
In Chrome 75, we connect the network “data pipe” directly to V8, allowing us to read network data directly during streaming parsing, skipping the dependency on the main thread.
This allows us to finish streaming compiles earlier, improving the loading time of pages using streaming compilation, as well as reducing the number of concurrent (but stalled) streaming parse tasks, which reduces memory consumption.
git log branch-heads/7.4..branch-heads/7.5 include/v8.h to get a list of the API changes.
Developers with an active V8 checkout can use
git checkout -b 7.5 -t branch-heads/7.5 to experiment with the new features in V8 v7.5. Alternatively you can subscribe to Chrome’s Beta channel and try the new features out yourself soon.