0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00

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 <info@bnoordhuis.nl>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Keyhan Vakil 2023-11-12 22:48:53 +00:00
parent 4cfc188f87
commit 5b73da02e5
2 changed files with 19 additions and 2 deletions

View File

@ -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

View File

@ -552,6 +552,11 @@
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_maglev.*?sources \\+= ")',
],
'conditions': [
['v8_target_arch=="arm"', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_maglev.*?v8_current_cpu == \\"arm\\".*?sources \\+= ")',
],
}],
['v8_target_arch=="arm64"', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_maglev.*?v8_current_cpu == \\"arm64\\".*?sources \\+= ")',
@ -885,14 +890,19 @@
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_maglev.*?sources \\+= ")',
],
'conditions': [
['v8_target_arch=="arm"', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"arm\\".*?sources \\+= ")',
],
}],
['v8_target_arch=="arm64"', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"arm64\\".*?sources \\+= ")',
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"arm64\\".*?sources \\+= ")',
],
}],
['v8_target_arch=="x64"', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"x64\\".*?sources \\+= ")',
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"x64\\".*?sources \\+= ")',
],
}],
],