build,src,tools: adapt build config for V8 13.3

Refs: 1c9f59c80f
Refs: b1c5eba50a
Refs: b3054f77d6
Refs: f81e87ee5c
Refs: dc0e305223
Refs: 41d42cec13
PR-URL: https://github.com/nodejs/node/pull/58070
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
Michaël Zasso 2024-12-19 08:22:32 +01:00
parent bd198ea8cd
commit cff3fa5f03
No known key found for this signature in database
GPG Key ID: 770F7A9A5AE15600
10 changed files with 33 additions and 38 deletions

View File

@ -640,12 +640,6 @@ parser.add_argument('--experimental-enable-pointer-compression',
default=None,
help='[Experimental] Enable V8 pointer compression (limits max heap to 4GB and breaks ABI compatibility)')
parser.add_argument('--disable-shared-readonly-heap',
action='store_true',
dest='disable_shared_ro_heap',
default=None,
help='Disable the shared read-only heap feature in V8')
parser.add_argument('--v8-options',
action='store',
dest='v8_options',
@ -1720,7 +1714,6 @@ def configure_v8(o, configs):
o['variables']['v8_enable_pointer_compression'] = 1 if options.enable_pointer_compression else 0
o['variables']['v8_enable_sandbox'] = 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.disable_shared_ro_heap else 1
o['variables']['v8_enable_extensible_ro_snapshot'] = 0
o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)

View File

@ -100,9 +100,6 @@
'NODE_USE_V8_PLATFORM=0',
],
}],
[ 'v8_enable_shared_ro_heap==1', {
'defines': ['NODE_V8_SHARED_RO_HEAP',],
}],
[ 'node_tag!=""', {
'defines': [ 'NODE_TAG="<(node_tag)"' ],
}],

View File

@ -352,11 +352,7 @@ EmbedderSnapshotData::EmbedderSnapshotData(const SnapshotData* impl,
: impl_(impl), owns_impl_(owns_impl) {}
bool EmbedderSnapshotData::CanUseCustomSnapshotPerIsolate() {
#ifdef NODE_V8_SHARED_RO_HEAP
return false;
#else
return true;
#endif
}
} // namespace node

View File

@ -312,17 +312,15 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
SnapshotBuilder::InitializeIsolateParams(snapshot_data, params);
}
#ifdef NODE_V8_SHARED_RO_HEAP
{
// In shared-readonly-heap mode, V8 requires all snapshots used for
// creating Isolates to be identical. This isn't really memory-safe
// Because it uses a shared readonly-heap, V8 requires all snapshots used
// for creating Isolates to be identical. This isn't really memory-safe
// but also otherwise just doesn't work, and the only real alternative
// is disabling shared-readonly-heap mode altogether.
static Isolate::CreateParams first_params = *params;
params->snapshot_blob = first_params.snapshot_blob;
params->external_references = first_params.external_references;
}
#endif
// Register the isolate on the platform before the isolate gets initialized,
// so that the isolate can access the platform during initialization.

View File

@ -828,15 +828,9 @@ Environment::Environment(IsolateData* isolate_data,
thread_id_(thread_id.id == static_cast<uint64_t>(-1)
? AllocateEnvironmentThreadId().id
: thread_id.id) {
constexpr bool is_shared_ro_heap =
#ifdef NODE_V8_SHARED_RO_HEAP
true;
#else
false;
#endif
if (is_shared_ro_heap && !is_main_thread()) {
// If this is a Worker thread and we are in shared-readonly-heap mode,
// we can always safely use the parent's Isolate's code cache.
if (!is_main_thread()) {
// If this is a Worker thread, we can always safely use the parent's
// Isolate's code cache because of the shared read-only heap.
CHECK_NOT_NULL(isolate_data->worker_context());
builtin_loader()->CopySourceAndCodeCacheReferenceFrom(
isolate_data->worker_context()->env()->builtin_loader());

View File

@ -543,8 +543,8 @@ class EmbedderSnapshotData {
void ToFile(FILE* out) const;
std::vector<char> ToBlob() const;
// Returns whether custom snapshots can be used. Currently, this means
// that V8 was configured without the shared-readonly-heap feature.
// Returns whether custom snapshots can be used. Currently, this always
// returns false since V8 enforces shared readonly-heap.
static bool CanUseCustomSnapshotPerIsolate();
EmbedderSnapshotData(const EmbedderSnapshotData&) = delete;

View File

@ -11,6 +11,9 @@
'include_dirs': [
'<(ABSEIL_ROOT)',
],
'xcode_settings': {
'OTHER_LDFLAGS': ['-framework CoreFoundation'],
},
},
'include_dirs': [
'<(ABSEIL_ROOT)',

View File

@ -134,6 +134,9 @@
# Enable fast mksnapshot runs.
'v8_enable_fast_mksnapshot%': 0,
# Enable using multiple threads to build builtins in mksnapshot.
'v8_enable_concurrent_mksnapshot%': 1,
# Enable the registration of unwinding info for Windows/x64 and ARM64.
'v8_win64_unwinding_info%': 1,
@ -209,10 +212,6 @@
# 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,
@ -437,9 +436,6 @@
['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

@ -119,7 +119,6 @@
'<(inspector_protocol_path)/crdtp/find_by_first.h',
'<(inspector_protocol_path)/crdtp/json.cc',
'<(inspector_protocol_path)/crdtp/json.h',
'<(inspector_protocol_path)/crdtp/maybe.h',
'<(inspector_protocol_path)/crdtp/parser_handler.h',
'<(inspector_protocol_path)/crdtp/protocol_core.cc',
'<(inspector_protocol_path)/crdtp/protocol_core.h',

View File

@ -451,6 +451,15 @@
'mksnapshot_flags': ['--code-comments'],
},
}],
['v8_enable_concurrent_mksnapshot == 1', {
'variables': {
'mksnapshot_flags': [
'--concurrent-builtin-generation',
# Use all the cores for concurrent builtin generation.
'--concurrent-turbofan-max-threads=0',
],
},
}],
['v8_enable_snapshot_native_code_counters', {
'variables': {
'mksnapshot_flags': ['--native-code-counters'],
@ -481,6 +490,7 @@
'v8_compiler_for_mksnapshot',
'v8_initializers',
'v8_libplatform',
'abseil.gyp:abseil',
]
}, {
'dependencies': [
@ -493,6 +503,7 @@
'v8_compiler_for_mksnapshot',
'v8_initializers',
'v8_libplatform',
'abseil.gyp:abseil',
]
}],
['OS=="win" and clang==1', {
@ -1317,6 +1328,7 @@
'dependencies': [
'v8_shared_internal_headers',
'v8_libbase',
'abseil.gyp:abseil',
],
'defines!': [
'_HAS_EXCEPTIONS=0',
@ -1370,6 +1382,7 @@
'dependencies': [
'v8_headers',
'abseil.gyp:abseil',
],
'conditions': [
@ -1618,6 +1631,7 @@
'toolsets': ['host', 'target'],
'dependencies': [
'v8_libbase',
'abseil.gyp:abseil',
],
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_libplatform.*?sources = ")',
@ -1688,7 +1702,8 @@
'BUILDING_V8_SHARED=1',
],
'dependencies': [
"v8_libbase",
'v8_libbase',
'abseil.gyp:abseil',
# "build/win:default_exe_manifest",
],
'sources': [
@ -1751,6 +1766,7 @@
'type': 'executable',
'dependencies': [
'torque_base',
'abseil.gyp:abseil',
# "build/win:default_exe_manifest",
],
'conditions': [
@ -1826,6 +1842,7 @@
'v8_libbase',
# "build/win:default_exe_manifest",
'v8_maybe_icu',
'abseil.gyp:abseil',
],
'conditions': [
['want_separate_host_toolset', {
@ -2074,6 +2091,8 @@
'<(V8_ROOT)/src/objects/abstract-code-inl.h',
'<(V8_ROOT)/src/objects/instruction-stream.h',
'<(V8_ROOT)/src/objects/instruction-stream-inl.h',
'<(V8_ROOT)/src/objects/casting.h',
'<(V8_ROOT)/src/objects/casting-inl.h',
'<(V8_ROOT)/src/objects/code.h',
'<(V8_ROOT)/src/objects/code-inl.h',
'<(V8_ROOT)/src/objects/data-handler.h',