- V8 Release V9.2
- Author: Ingvar Stepanyan
- Translation from: The Gold Project
- This article is permalink: github.com/xitu/gold-m…
- Translator: finalwhy
- Proofreader: Z
V8 v9.2 release
Every six weeks, we create a new branch for V8 as part of our release schedule. Each release creates a branch from V8’s Master prior to the Milestone Chrome Beta. Today we are pleased to announce our latest branch, V8 V9.2, which is currently in beta and will be released in a few weeks along with the stable release of Chrome 92. V8 V9.2 has many new features for developers. This article provides a preview of some of the highlights of this release.
JavaScript
at
methods
The new AT method can now be used in arrays, TypedArray, and strings. When a negative number is passed in, it will reverse index indexable elements. When a positive value is passed in, it behaves the same as a direct property access.
Shared pointer compression cage
V8 supports pointer compression on 64-bit platforms, including X64 and ARM64. This is done by splitting the 64-bit length pointer into two segments. The higher 32 bits are considered the cardinality, and the lower 32 bits are considered the index of that cardinality.
|----- 32 bits -----|----- 32 bits -----|
Pointer: |________base_______|_______index_______|
Copy the code
Currently, the Isolate ( V8 Bindings Design ISOLATE, Context, World, Frame) performs all memory allocations in a GC heap within a 4GB virtual memory “cage”. This ensures that all Pointers have the same high 32 bit base address. Since the base address remains the same, only the 32-bit index needs to be passed in the 64-bit pointer because the full pointer address can be calculated by “base + index”.
In V9.2, the default behavior changed to all isolates in a process sharing the same 4GB virtual memory cage. This is done to prototype the experimental shared memory functionality in JS. Each worker thread has its own Isolate. Therefore, each 4GB virtual memory cage is independent of each other. Pointers cannot be passed between the memory cages of the Isolate because they do not share the same base address. This change also has the added benefit of reducing virtual memory stress at startup time.
This change is a tradeoff against V8’s total heap memory size limit, which limits the heap memory used by all threads in the same process to 4GB. This limitation is unfriendly to server-side workers that generate multiple threads per process, as it can run out of virtual memory faster. The embeder can disable the sharing of pointer compression cages using the GN parameter v8_enable_POinter_compression_shared_cage = false.
V8 API
Use git log branch-heads/9.1.. Get a complete list of API changes for branch-heads/9.2 include/v8.h.
For developers with active V8 accounts, git Checkout -B 9.2-t branch-heads/9.2 can be used to try out the new features of V8 V9.2. You can also subscribe to Chrome’s Beta channel to try out the new features.
If you find any errors in the translation or other areas that need improvement, you are welcome to revise and PR the translation in the Gold Translation program, and you can also get corresponding bonus points. The permanent link to this article at the beginning of this article is the MarkDown link to this article on GitHub.
Diggings translation project is a community for translating quality Internet technical articles from diggings English sharing articles. The content covers the fields of Android, iOS, front end, back end, blockchain, products, design, artificial intelligence and so on. For more high-quality translations, please keep paying attention to The Translation Project, official weibo and zhihu column.