From 4050b0d64f2a5b92b54a2de346f301a60d8553ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sun, 24 Apr 2022 08:29:13 +0200 Subject: [PATCH] build: enable V8's shared read-only heap It is what V8's build config does by default. PR-URL: https://github.com/nodejs/node/pull/42809 Reviewed-By: James M Snell Reviewed-By: Joyee Cheung --- configure.py | 1 + test/parallel/test-worker-nearheaplimit-deadlock.js | 8 ++++---- tools/v8_gypfiles/features.gypi | 7 +++++++ tools/v8_gypfiles/v8.gyp | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/configure.py b/configure.py index ba118ef8db2718..699f09d195718f 100755 --- a/configure.py +++ b/configure.py @@ -1458,6 +1458,7 @@ def configure_v8(o): o['variables']['v8_use_siphash'] = 0 if options.without_siphash else 1 o['variables']['v8_enable_pointer_compression'] = 1 if options.enable_pointer_compression else 0 o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0 + o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression else 1 o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0 o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform) o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8) diff --git a/test/parallel/test-worker-nearheaplimit-deadlock.js b/test/parallel/test-worker-nearheaplimit-deadlock.js index cf4c0d972c8719..b22c86b211611f 100644 --- a/test/parallel/test-worker-nearheaplimit-deadlock.js +++ b/test/parallel/test-worker-nearheaplimit-deadlock.js @@ -1,3 +1,7 @@ +// Flags: --no-node-snapshot +// With node snapshot the OOM can occur during the deserialization of the +// context, so disable it since we want the OOM to occur during the creation of +// the message port. 'use strict'; const common = require('../common'); const assert = require('assert'); @@ -11,10 +15,6 @@ if (!process.env.HAS_STARTED_WORKER) { maxYoungGenerationSizeMb: 0, maxOldGenerationSizeMb: 0 }, - // With node snapshot the OOM can occur during the deserialization of - // the context, so disable it since we want the OOM to occur during - // the creation of the message port. - execArgv: [ ...process.execArgv, '--no-node-snapshot'] }; const worker = new Worker(__filename, opts); diff --git a/tools/v8_gypfiles/features.gypi b/tools/v8_gypfiles/features.gypi index 2936f7181f364e..5aa7c3fb4d2927 100644 --- a/tools/v8_gypfiles/features.gypi +++ b/tools/v8_gypfiles/features.gypi @@ -179,6 +179,10 @@ # Controls the threshold for on-heap/off-heap Typed Arrays. 'v8_typed_array_max_size_in_heap%': 64, + # Enable sharing read-only space across isolates. + # Sets -DV8_SHARED_RO_HEAP. + 'v8_enable_shared_ro_heap%': 0, + # Enable lazy source positions by default. 'v8_enable_lazy_source_positions%': 1, @@ -396,6 +400,9 @@ ['v8_use_siphash==1', { 'defines': ['V8_USE_SIPHASH',], }], + ['v8_enable_shared_ro_heap==1', { + 'defines': ['V8_SHARED_RO_HEAP',], + }], ['dcheck_always_on!=0', { 'defines': ['DEBUG',], }], diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index d9cab2b5eaffbc..55f963693347c8 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -1757,6 +1757,7 @@ 'v8_enable_verify_csa=<(v8_enable_verify_csa)', 'v8_enable_lite_mode=<(v8_enable_lite_mode)', 'v8_enable_pointer_compression=<(v8_enable_pointer_compression)', + 'v8_enable_shared_ro_heap=<(v8_enable_shared_ro_heap)', 'v8_enable_webassembly=<(v8_enable_webassembly)', # Not available in gyp. 'v8_control_flow_integrity=0',