Skip to content

Commit

Permalink
tools: update V8 gypfiles for 13.3
Browse files Browse the repository at this point in the history
  • Loading branch information
targos authored and nodejs-github-bot committed Dec 19, 2024
1 parent 0d3172c commit b31db09
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 38 deletions.
7 changes: 0 additions & 7 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,12 +612,6 @@
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',
Expand Down Expand Up @@ -1661,7 +1655,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)
Expand Down
3 changes: 0 additions & 3 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,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)"' ],
}],
Expand Down
4 changes: 0 additions & 4 deletions src/api/embed_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,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
6 changes: 2 additions & 4 deletions src/api/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -308,17 +308,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.
Expand Down
12 changes: 3 additions & 9 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -820,15 +820,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());
Expand Down
4 changes: 2 additions & 2 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,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;
Expand Down
10 changes: 3 additions & 7 deletions tools/v8_gypfiles/features.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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,

Expand Down Expand Up @@ -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',],
}, {
Expand Down
1 change: 0 additions & 1 deletion tools/v8_gypfiles/inspector.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
24 changes: 23 additions & 1 deletion tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -481,6 +490,7 @@
'v8_compiler_for_mksnapshot',
'v8_initializers',
'v8_libplatform',
'v8_abseil',
]
}, {
'dependencies': [
Expand All @@ -493,6 +503,7 @@
'v8_compiler_for_mksnapshot',
'v8_initializers',
'v8_libplatform',
'v8_abseil',
]
}],
['OS=="win" and clang==1', {
Expand Down Expand Up @@ -1259,6 +1270,7 @@
'dependencies': [
'v8_shared_internal_headers',
'v8_libbase',
'v8_abseil',
],
'defines!': [
'_HAS_EXCEPTIONS=0',
Expand Down Expand Up @@ -1312,6 +1324,7 @@

'dependencies': [
'v8_headers',
'v8_abseil',
],

'conditions': [
Expand Down Expand Up @@ -1560,6 +1573,7 @@
'toolsets': ['host', 'target'],
'dependencies': [
'v8_libbase',
'v8_abseil',
],
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_libplatform.*?sources = ")',
Expand Down Expand Up @@ -1630,7 +1644,8 @@
'BUILDING_V8_SHARED=1',
],
'dependencies': [
"v8_libbase",
'v8_libbase',
'v8_abseil',
# "build/win:default_exe_manifest",
],
'sources': [
Expand Down Expand Up @@ -1693,6 +1708,7 @@
'type': 'executable',
'dependencies': [
'torque_base',
'v8_abseil',
# "build/win:default_exe_manifest",
],
'conditions': [
Expand Down Expand Up @@ -1768,6 +1784,7 @@
'v8_libbase',
# "build/win:default_exe_manifest",
'v8_maybe_icu',
'v8_abseil',
],
'conditions': [
['want_separate_host_toolset', {
Expand Down Expand Up @@ -2016,6 +2033,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',
Expand Down Expand Up @@ -2181,6 +2200,9 @@
'include_dirs': [
'<(ABSEIL_ROOT)',
],
'xcode_settings': {
'OTHER_LDFLAGS': ['-framework CoreFoundation'],
},
},
'include_dirs': [
'<(ABSEIL_ROOT)',
Expand Down

0 comments on commit b31db09

Please sign in to comment.