Skip to content

Commit 904e645

Browse files
kvakilUlisesGascon
authored andcommitted
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: #50690 PR-URL: #50692 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent aea7fe5 commit 904e645

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

configure.py

+7
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,12 @@
812812
help='Enable V8 transparent hugepage support. This feature is only '+
813813
'available on Linux platform.')
814814

815+
parser.add_argument('--v8-enable-maglev',
816+
action='store_true',
817+
dest='v8_enable_maglev',
818+
default=None,
819+
help='Enable V8 Maglev compiler. Not available on all platforms.')
820+
815821
parser.add_argument('--v8-enable-short-builtin-calls',
816822
action='store_true',
817823
dest='v8_enable_short_builtin_calls',
@@ -1494,6 +1500,7 @@ def configure_v8(o):
14941500
o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables.
14951501
o['variables']['v8_promise_internal_field_count'] = 1 # Add internal field to promises for async hooks.
14961502
o['variables']['v8_use_siphash'] = 0 if options.without_siphash else 1
1503+
o['variables']['v8_enable_maglev'] = 1 if options.v8_enable_maglev else 0
14971504
o['variables']['v8_enable_pointer_compression'] = 1 if options.enable_pointer_compression else 0
14981505
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0
14991506
o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression or options.disable_shared_ro_heap else 1

tools/v8_gypfiles/v8.gyp

+12-2
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,11 @@
546546
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_maglev.*?sources \\+= ")',
547547
],
548548
'conditions': [
549+
['v8_target_arch=="arm"', {
550+
'sources': [
551+
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_maglev.*?v8_current_cpu == \\"arm\\".*?sources \\+= ")',
552+
],
553+
}],
549554
['v8_target_arch=="arm64"', {
550555
'sources': [
551556
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_maglev.*?v8_current_cpu == \\"arm64\\".*?sources \\+= ")',
@@ -891,14 +896,19 @@
891896
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_maglev.*?sources \\+= ")',
892897
],
893898
'conditions': [
899+
['v8_target_arch=="arm"', {
900+
'sources': [
901+
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"arm\\".*?sources \\+= ")',
902+
],
903+
}],
894904
['v8_target_arch=="arm64"', {
895905
'sources': [
896-
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"arm64\\".*?sources \\+= ")',
906+
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"arm64\\".*?sources \\+= ")',
897907
],
898908
}],
899909
['v8_target_arch=="x64"', {
900910
'sources': [
901-
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"x64\\".*?sources \\+= ")',
911+
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"x64\\".*?sources \\+= ")',
902912
],
903913
}],
904914
],

0 commit comments

Comments
 (0)