Skip to content

Commit

Permalink
build: speed up compilation of some V8 files
Browse files Browse the repository at this point in the history
This introduces a special target to compile some of the
'v8_initializers' files with "-O1" instead of "-O3" to avoid huge
compilation times with GCC versions <13.

Closes: nodejs#52068
  • Loading branch information
targos committed Mar 15, 2024
1 parent 814fa1a commit 10b7ff8
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,41 @@
'<(V8_ROOT)/src/init/setup-isolate-full.cc',
],
}, # v8_init
{
# This target is used to work around a GCC issue that causes the
# compilation to take several minutes when using -O2 or -O3.
# This is fixed in GCC 13.
'target_name': 'v8_initializers_slow',
'type': 'static_library',
'toolsets': ['host', 'target'],
'dependencies': [
'generate_bytecode_builtins_list',
'run_torque',
],
'cflags!': ['-O3'],
'cflags': ['-O1'],
'sources': [
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/js-to-wasm-tq-csa.h',
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/js-to-wasm-tq-csa.cc',
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/wasm-to-js-tq-csa.h',
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/wasm-to-js-tq-csa.cc',
],
'conditions': [
['v8_enable_i18n_support==1', {
'dependencies': [
'<(icu_gyp_path):icui18n',
'<(icu_gyp_path):icuuc',
],
}],
],
}, # v8_initializers_slow
{
'target_name': 'v8_initializers',
'type': 'static_library',
'toolsets': ['host', 'target'],
'dependencies': [
'torque_generated_initializers',
'v8_initializers_slow',
'v8_base_without_compiler',
'v8_shared_internal_headers',
'v8_pch',
Expand All @@ -267,6 +296,13 @@
'<(SHARED_INTERMEDIATE_DIR)',
'<(generate_bytecode_output_root)',
],
# Compiled by v8_initializers_slow target.
'sources!': [
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/js-to-wasm-tq-csa.h',
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/js-to-wasm-tq-csa.cc',
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/wasm-to-js-tq-csa.h',
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/wasm-to-js-tq-csa.cc',
],
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_initializers.*?sources = ")',
],
Expand Down

0 comments on commit 10b7ff8

Please sign in to comment.