Skip to content

Commit d95b0e3

Browse files
committed
build: speed up compilation of some V8 files
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
1 parent 639c096 commit d95b0e3

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tools/v8_gypfiles/v8.gyp

+27
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,32 @@
253253
'<(V8_ROOT)/src/init/setup-isolate-full.cc',
254254
],
255255
}, # v8_init
256+
{
257+
# This target is used to work around a GCC issue that causes the
258+
# compilation to take several minutes when using -O2 or -O3.
259+
# This is fixed in GCC 13.
260+
'target_name': 'v8_initializers_slow',
261+
'type': 'static_library',
262+
'toolsets': ['host', 'target'],
263+
'dependencies': [
264+
'run_torque',
265+
],
266+
'cflags!': ['-O3'],
267+
'cflags': ['-O1'],
268+
'sources': [
269+
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/js-to-wasm-tq-csa.h',
270+
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/js-to-wasm-tq-csa.cc',
271+
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/wasm-to-js-tq-csa.h',
272+
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/wasm-to-js-tq-csa.cc',
273+
],
274+
}, # v8_initializers_slow
256275
{
257276
'target_name': 'v8_initializers',
258277
'type': 'static_library',
259278
'toolsets': ['host', 'target'],
260279
'dependencies': [
261280
'torque_generated_initializers',
281+
'v8_initializers_slow',
262282
'v8_base_without_compiler',
263283
'v8_shared_internal_headers',
264284
'v8_pch',
@@ -267,6 +287,13 @@
267287
'<(SHARED_INTERMEDIATE_DIR)',
268288
'<(generate_bytecode_output_root)',
269289
],
290+
# Compiled by v8_initializers_slow target.
291+
'sources!': [
292+
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/js-to-wasm-tq-csa.h',
293+
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/js-to-wasm-tq-csa.cc',
294+
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/wasm-to-js-tq-csa.h',
295+
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/src/builtins/wasm-to-js-tq-csa.cc',
296+
],
270297
'sources': [
271298
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_initializers.*?sources = ")',
272299
],

0 commit comments

Comments
 (0)