From c15e338d8797b117d780c76a38578bd0c8ac8d08 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 21 Dec 2023 13:34:07 +0100 Subject: [PATCH 1/2] lib: fix use of `--frozen-intrinsics` with `--jitless` --- lib/internal/freeze_intrinsics.js | 21 +++++++++++++-------- test/parallel/test-freeze-intrinsics.js | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/internal/freeze_intrinsics.js b/lib/internal/freeze_intrinsics.js index 2017b8f66e84c0..a12854f3312be4 100644 --- a/lib/internal/freeze_intrinsics.js +++ b/lib/internal/freeze_intrinsics.js @@ -220,13 +220,6 @@ module.exports = function() { // Other APIs / Web Compatibility Console.prototype, - WebAssembly.Module.prototype, - WebAssembly.Instance.prototype, - WebAssembly.Table.prototype, - WebAssembly.Memory.prototype, - WebAssembly.CompileError.prototype, - WebAssembly.LinkError.prototype, - WebAssembly.RuntimeError.prototype, ]; const intrinsics = [ // 10.2.4.1 ThrowTypeError @@ -349,7 +342,6 @@ module.exports = function() { setInterval, setTimeout, console, - WebAssembly, ]; if (typeof SharedArrayBuffer !== 'undefined') { // 25.2 @@ -357,6 +349,19 @@ module.exports = function() { ArrayPrototypePush(intrinsics, SharedArrayBuffer); } + if (typeof WebAssembly !== 'undefined') { // 25.2 + ArrayPrototypePush(intrinsicPrototypes, + WebAssembly.Module.prototype, + WebAssembly.Instance.prototype, + WebAssembly.Table.prototype, + WebAssembly.Memory.prototype, + WebAssembly.CompileError.prototype, + WebAssembly.LinkError.prototype, + WebAssembly.RuntimeError.prototype, + ); + ArrayPrototypePush(intrinsics, WebAssembly); + } + if (typeof Intl !== 'undefined') { ArrayPrototypePush(intrinsicPrototypes, Intl.Collator.prototype, diff --git a/test/parallel/test-freeze-intrinsics.js b/test/parallel/test-freeze-intrinsics.js index 4e20346a9deda8..b3a2503d1d5b40 100644 --- a/test/parallel/test-freeze-intrinsics.js +++ b/test/parallel/test-freeze-intrinsics.js @@ -1,4 +1,4 @@ -// Flags: --frozen-intrinsics +// Flags: --frozen-intrinsics --jitless 'use strict'; require('../common'); const assert = require('assert'); From a7d624daaae47219a1c2a30aaa08319fadd68c8d Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 21 Dec 2023 14:03:15 +0100 Subject: [PATCH 2/2] Update lib/internal/freeze_intrinsics.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michaƫl Zasso --- lib/internal/freeze_intrinsics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/freeze_intrinsics.js b/lib/internal/freeze_intrinsics.js index a12854f3312be4..275d04f7f9891e 100644 --- a/lib/internal/freeze_intrinsics.js +++ b/lib/internal/freeze_intrinsics.js @@ -349,7 +349,7 @@ module.exports = function() { ArrayPrototypePush(intrinsics, SharedArrayBuffer); } - if (typeof WebAssembly !== 'undefined') { // 25.2 + if (typeof WebAssembly !== 'undefined') { ArrayPrototypePush(intrinsicPrototypes, WebAssembly.Module.prototype, WebAssembly.Instance.prototype,