[译] V8 release v7.5

栏目: 后端 · 前端 · 发布时间: 6年前

内容简介:原文地址原文作者 Dan Elphick每六周我们会在发布的过程中创建一个新的V8分支,每个版本都是在Chrome Beta里程碑之前立即从V8的Git master checkout 出来的。今天我们很高兴地宣布我们最新的分支 V8 7.5,它将在几周内与Chrome 75稳定版协同发布。V8 v7.5充满了各种面向开发人员的好东西,这篇文章提供了预期发布的一些亮点的预览。

原文地址 https://v8.dev/blog/v8-release-75

原文作者 Dan Elphick

每六周我们会在发布的过程中创建一个新的V8分支,每个版本都是在Chrome Beta里程碑之前立即从V8的Git master checkout 出来的。今天我们很高兴地宣布我们最新的分支 V8 7.5,它将在几周内与Chrome 75稳定版协同发布。V8 v7.5充满了各种面向开发人员的好东西,这篇文章提供了预期发布的一些亮点的预览。

WebAssembly

Implicit caching

我们计划在 Chrome 75 中推出 WebAssembly 编译工作的Implicit caching,这意味着第二次访问同一页面的用户不需要编译已经看过的 WebAssembly 模块,而是从缓存加载它们,它的工作原理与 Chromium’s JavaScript code-cache 类似。

Bulk memory operations

为 WebAssembly 添加了一个新的指令用于更新大内存。

memory.copy 可以将数据从一个区域复制到另一个区域(类似 C 的memmove),memory.fill 可以填充给定区域的数据,(类似 C 的 memset),与 memory.copy 类似 table.copy 也可以将数据从一个区域复制到另一个区域。

;; Copy 500 bytes from source 1000 to destination 0.
(memory.copy (i32.const 0) (i32.const 1000) (i32.const 500))

;; Fill 1000 bytes starting at 100 with the value `123`.
(memory.fill (i32.const 100) (i32.const 123) (i32.const 1000))

;; Copy 10 table elements from source 5 to destination 15.
(table.copy (i32.const 15) (i32.const 5) (i32.const 10))

该提议还提供了将常量区域复制到线性存储器或表中的方法。为此我们需要先定义一个 “passive” segment,与 "active" segment 不同的是,这些segment在模块实例化期间不会初始化。相反,可以使用memory.init和table.init指令将它们复制到内存或表区域中。

;; Define a passive data segment.
(data $hello passive "Hello WebAssembly")

;; Copy "Hello" into memory at address 10.
(memory.init (i32.const 10) (i32.const 0) (i32.const 5))

;; Copy "WebAssembly" into memory at address 1000.
(memory.init (i32.const 1000) (i32.const 6) (i32.const 11))

Numeric separators in JavaScript

人眼难以快速解析大型数字文字,尤其是当有大量重复数字时:

1000000000000
   1019436871.42

为了提高可读性,新的JavaScript语言功能使下划线成为数字文字中的分隔符。因此,现在可以重写以上内容以将数字分组为千分之一,例如:

1_000_000_000_000
    1_019_436_871.42

数字分隔符有助于提高各种数字文字的可读性:

// A decimal integer literal with its digits grouped per thousand:
1_000_000_000_000
// A decimal literal with its digits grouped per thousand:
1_000_000.220_720
// A binary integer literal with its bits grouped per octet:
0b01010110_00111000
// A binary integer literal with its bits grouped per nibble:
0b0101_0110_0011_1000
// A hexadecimal integer literal with its digits grouped by byte:
0x40_76_38_6A_73
// A BigInt literal with its digits grouped per thousand:
4_642_473_943_484_686_707n

Performance

Script streaming directly from network

从Chrome 75开始,V8可以直接从网络将stream scripts传输到streaming parser,而无需等待Chrome主线程。

虽然之前的Chrome版本具有 streaming parsing 和 compilation,但由于历史原因,从网络传入的脚本源数据始终必须首先进入 Chrome 主线程,然后再转发到streamer。这意味着 streaming parser 通常会等待已经从网络到达的数据,但尚未转发到流式任务,因为它被主线程上发生的其他事情阻止(例如HTML解析,布局或其他JavaScript执行)。

[译] V8 release v7.5

在Chrome 75中,我们将网络“数据管道”直接连接到V8,允许我们在流解析期间直接读取网络数据,跳过对主线程的依赖。

[译] V8 release v7.5

这使我们能够更早地完成 streaming compiles,改善使用 streaming compilation 的页面加载时间,以及减少并发(但停滞)streaming parse tasks 的数量,从而减少内存消耗。

V8 API

可以使用 git log branch-heads/7.4..branch-heads/7.5 include/v8.h 获取 API 更改列表。


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Nature of Code

The Nature of Code

Daniel Shiffman / The Nature of Code / 2012-12-13 / GBP 19.95

How can we capture the unpredictable evolutionary and emergent properties of nature in software? How can understanding the mathematical principles behind our physical world help us to create digital w......一起来看看 《The Nature of Code》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

在线进制转换器
在线进制转换器

各进制数互转换器

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具