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 <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
Michaël Zasso 2022-04-24 08:29:13 +02:00 committed by GitHub
parent 5ad47a0c2a
commit daae938f32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 4 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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',],
}],

View File

@ -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',