From 5b73da02e563c9cefb8c40e3ecfcdf7113e5e4e2 Mon Sep 17 00:00:00 2001 From: Keyhan Vakil Date: Sun, 12 Nov 2023 22:48:53 +0000 Subject: [PATCH] build: add configuration flag to enable Maglev This adds a configuration flag to enable V8's Maglev compiler. Unfortunately compilation fails unless you have clang-14+ or gcc-13+, but I sent a patch for that upstream. Other than that, it builds and all tests pass locally on my x86-64 Linux machine. The gn scraper regexes were broken preventing the compilation from linking. Fix them. As a drive-by, also add additional conditionals for compilation on 32-bit arm. Refs: https://github.com/nodejs/node/issues/50690 PR-URL: https://github.com/nodejs/node/pull/50692 Reviewed-By: Ben Noordhuis Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- configure.py | 7 +++++++ tools/v8_gypfiles/v8.gyp | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py index be95decd566..ff08312b680 100755 --- a/configure.py +++ b/configure.py @@ -812,6 +812,12 @@ parser.add_argument('--v8-enable-hugepage', help='Enable V8 transparent hugepage support. This feature is only '+ 'available on Linux platform.') +parser.add_argument('--v8-enable-maglev', + action='store_true', + dest='v8_enable_maglev', + default=None, + help='Enable V8 Maglev compiler. Not available on all platforms.') + parser.add_argument('--v8-enable-short-builtin-calls', action='store_true', dest='v8_enable_short_builtin_calls', @@ -1494,6 +1500,7 @@ def configure_v8(o): o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables. o['variables']['v8_promise_internal_field_count'] = 1 # Add internal field to promises for async hooks. o['variables']['v8_use_siphash'] = 0 if options.without_siphash else 1 + o['variables']['v8_enable_maglev'] = 1 if options.v8_enable_maglev else 0 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 or options.disable_shared_ro_heap else 1 diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 45323919348..4d69a59fcbc 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -552,6 +552,11 @@ '