未验证 提交 777e1fed 编写于 作者: S Silver Bullet 提交者: GitHub

V8 v9.2 发布 (#8959)

* finish translate

* add translater info

* Update article/2021/v8-release-92.md
Co-authored-by: NZ招锦 <87251415+zenblofe@users.noreply.github.com>

* Update article/2021/v8-release-92.md
Co-authored-by: NZ招锦 <87251415+zenblofe@users.noreply.github.com>

* Update article/2021/v8-release-92.md
Co-authored-by: NZ招锦 <87251415+zenblofe@users.noreply.github.com>

* update file

* update file
Co-authored-by: NZ招锦 <87251415+zenblofe@users.noreply.github.com>
上级 254afefc
> * 原文地址:[V8 release v9.2](https://v8.dev/blog/v8-release-92)
> * 原文作者:[Ingvar Stepanyan](https://twitter.com/RReverser)
> * 译文出自:[掘金翻译计划](https://github.com/xitu/gold-miner)
> * 本文永久链接:[https://github.com/xitu/gold-miner/blob/master/article/2021/v8-release-92.md](https://github.com/xitu/gold-miner/blob/master/article/2021/v8-release-92.md)
> * 译者:
> * 校对者:
> - 原文地址:[V8 release v9.2](https://v8.dev/blog/v8-release-92)
> - 原文作者:[Ingvar Stepanyan](https://twitter.com/RReverser)
> - 译文出自:[掘金翻译计划](https://github.com/xitu/gold-miner)
> - 本文永久链接:[https://github.com/xitu/gold-miner/blob/master/article/2021/v8-release-92.md](https://github.com/xitu/gold-miner/blob/master/article/2021/v8-release-92.md)
> - 译者:[finalwhy](https://github.com/finalwhy)
> - 校对者:[Z招锦](https://github.com/zenblofe)
# V8 release v9.2
# V8 v9.2 发布
Every six weeks, we create a new branch of V8 as part of our [release process](https://v8.dev/docs/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.2](https://chromium.googlesource.com/v8/v8.git/+log/branch-heads/9.2), which is in beta until its release in coordination with Chrome 92 Stable in several weeks. V8 v9.2 is filled with all sorts of developer-facing goodies. This post provides a preview of some of the highlights in anticipation of the release.
每隔六周,我们会为 V8 创建一个新的分支作为 [发布计划](https://v8.dev/docs/release-process) 的一部分。每个版本都在里程碑 Chrome Beta 之前从 V8 的 master 中创建分支。今天我们很荣幸地宣布我们最新的分支:[V8 v9.2](https://chromium.googlesource.com/v8/v8.git/+log/branch-heads/9.2),它目前仍处于测试阶段,会在几周后随着 Chrome 92 的稳定版一起发布。V8 v9.2 新增了很多面向开发者的新特性。这篇文章提供了对于本次发布版本中的一些亮点的预览。
## JavaScript
### `at` method
### `at` 方法
The new `at` method is now available on Arrays, TypedArrays, and Strings. When passed a negative value, it performs relative indexing from the end of the indexable. When passed a positive value, it behaves identically to property access. For example, `[1,2,3].at(-1)` is `3`. See more at [our explainer](https://v8.dev/features/at-method).
新的 `at` 方法现在可以在 `Array``TypedArray`、和 `String` 中使用了。当传入的是一个负数时,它将会反向索引可索引的元素。当传入一个正值时,它的行为和直接进行属性访问相同。
## Shared Pointer Compression Cage
## 共享的指针压缩笼
V8 supports [pointer compression](https://v8.dev/blog/pointer-compression) on 64-bit platforms including x64 and arm64. This is achieved by splitting a 64-bit pointer into two halves. The upper 32-bits can be thought of as a base while the lower 32-bits can be thought of as an index into that base.
V8 在 64 位平台(包括 x64 和 arm64)上支持[指针压缩](https://v8.dev/blog/pointer-compression)。这是通过将 64 位长度指针拆分为两段来实现的。即将高 32 位视为基数,而将低 32 位视为该基数的索引(译者注:即偏移量)。
```
|----- 32 bits -----|----- 32 bits -----|
......@@ -25,17 +25,17 @@ Pointer: |________base_______|_______index_______|
```
Currently, an Isolate performs all allocations in the GC heap within a 4GB virtual memory "cage", which ensures that all pointers have the same upper 32-bit base address. With the base address held constant, 64-bit pointers can be passed around only using the 32-bit index, since the full pointer can be reconstructed.
目前,Isolate(译者注:即一个 V8 运行实例,可参见[V8 bindings 设计 isolate,context,world,frame 之间的关系](https://zhuanlan.zhihu.com/p/54135666)) 在一个 4GB 大小的虚拟内存“笼子”内的 GC 堆中执行所有内存分配,这确保了所有指针具有相同的高 32 位基址。由于基址保持不变,因此 64 位指针在传递时只需要传递 32 位的索引,因为完整的指针地址可以通过「基址+索引」来计算。
With v9.2, the default is changed such that all Isolates within a process share the same 4GB virtual memory cage. This was done in anticipation of prototyping experimental shared memory features in JS. With each worker thread having its own Isolate and therefore its own 4GB virtual memory cage, pointers could not be passed between Isolates with a per-Isolate cage as they did not share the same base address. This change has the additional benefit of reducing virtual memory pressure when spinning up workers.
在 v9.2 中,默认行为变成了进程内的所有 Isolate 共享同一个 4GB 虚拟内存笼。这样做是为了对 JS 中实验性的共享内存功能进行原型设计。由于每个工作线程都有自己的 Isolate,因此各自的 4GB 虚拟内存笼是相互独立的,指针无法在各 Isolate 的内存笼之间传递,因为它们不共享相同的基地址。这项改动还带来了一个额外的提升,即在启动程序时减少了虚拟内存的压力。
The tradeoff of the change is that the total V8 heap size across all threads in a process is capped at a maximum 4GB. This limitation may be undesirable for server workloads that spawn many threads per process, as doing so will run out of virtual memory faster than before. Embedders may turn off sharing of the pointer compression cage with the GN argument `v8_enable_pointer_compression_shared_cage = false`.
这项改动是出于对 V8 总的堆内存大小限制的权衡,V8 将同一个进程中所有线程所使用的堆内存大小限制为 4GB。这种限制对于那些每个进程产生多个线程的服务端工作程序来说是很不友好的,因为这样会更快的耗尽虚拟内存。嵌入器可以使用 GN 参数 `v8_enable_pointer_compression_shared_cage = false` 关闭指针压缩笼的共享。
## V8 API
Please use `git log branch-heads/9.1..branch-heads/9.2 include/v8.h` to get a list of the API changes.
请使用 `git log branch-heads/9.1..branch-heads/9.2 include/v8.h` 获取 API 改动的完整列表。
Developers with an active V8 checkout can use `git checkout -b 9.2 -t branch-heads/9.2` to experiment with the new features in V8 v9.2. Alternatively you can [subscribe to Chrome’s Beta channel](https://www.google.com/chrome/browser/beta.html) and try the new features out yourself soon.
具有一个 V8 活动检出的开发人员可以使用 `git checkout -b 9.2 -t branch-heads/9.2` 来实验 V8 v9.2 中的新功能。你也可以[订阅 Chrome 的 Beta 版频道](https://www.google.com/chrome/browser/beta.html) 以尝鲜新功能。
> 如果发现译文存在错误或其他需要改进的地方,欢迎到 [掘金翻译计划](https://github.com/xitu/gold-miner) 对译文进行修改并 PR,也可获得相应奖励积分。文章开头的 **本文永久链接** 即为本文在 GitHub 上的 MarkDown 链接。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册