Skip to content

Commit 12605e8

Browse files
kvakilRafaelGSS
authored andcommittedNov 29, 2023
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 <info@bnoordhuis.nl> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent c3eee59 commit 12605e8

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
@@ -552,6 +552,11 @@
552552
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_maglev.*?sources \\+= ")',
553553
],
554554
'conditions': [
555+
['v8_target_arch=="arm"', {
556+
'sources': [
557+
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_maglev.*?v8_current_cpu == \\"arm\\".*?sources \\+= ")',
558+
],
559+
}],
555560
['v8_target_arch=="arm64"', {
556561
'sources': [
557562
'<!@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 @@
885890
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_maglev.*?sources \\+= ")',
886891
],
887892
'conditions': [
893+
['v8_target_arch=="arm"', {
894+
'sources': [
895+
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"arm\\".*?sources \\+= ")',
896+
],
897+
}],
888898
['v8_target_arch=="arm64"', {
889899
'sources': [
890-
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"arm64\\".*?sources \\+= ")',
900+
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"arm64\\".*?sources \\+= ")',
891901
],
892902
}],
893903
['v8_target_arch=="x64"', {
894904
'sources': [
895-
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"x64\\".*?sources \\+= ")',
905+
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_maglev.*?v8_current_cpu == \\"x64\\".*?sources \\+= ")',
896906
],
897907
}],
898908
],

0 commit comments

Comments
 (0)
Please sign in to comment.