nodejs-23.6.0-add-v8-jit-fine-grained-options.patch 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. diff '--color=auto' -urp node-v23.6.0.orig/configure.py node-v23.6.0/configure.py
  2. --- node-v23.6.0.orig/configure.py 2025-01-14 18:07:23.098388811 -0800
  3. +++ node-v23.6.0/configure.py 2025-01-14 18:09:33.349529083 -0800
  4. @@ -939,9 +939,9 @@ parser.add_argument('--v8-with-dchecks',
  5. default=False,
  6. help='compile V8 with debug checks and runtime debugging features enabled')
  7. -parser.add_argument('--v8-lite-mode',
  8. +parser.add_argument('--v8-enable-lite-mode',
  9. action='store_true',
  10. - dest='v8_lite_mode',
  11. + dest='v8_enable_lite_mode',
  12. default=False,
  13. help='compile V8 in lite mode for constrained environments (lowers V8 '+
  14. 'memory footprint, but also implies no just-in-time compilation ' +
  15. @@ -966,13 +966,29 @@ parser.add_argument('--v8-enable-hugepag
  16. help='Enable V8 transparent hugepage support. This feature is only '+
  17. 'available on Linux platform.')
  18. -maglev_enabled_by_default_help = f"(Maglev is enabled by default on {','.join(maglev_enabled_architectures)})"
  19. +parser.add_argument('--v8-enable-turbofan',
  20. + action='store_true',
  21. + dest='v8_enable_turbofan',
  22. + default=None,
  23. + help="Enable V8's turbofan tier.")
  24. +
  25. +parser.add_argument('--v8-enable-sparkplug',
  26. + action='store_true',
  27. + dest='v8_enable_sparkplug',
  28. + default=None,
  29. + help="Enable V8's sparkplug tier.")
  30. +
  31. +parser.add_argument('--v8-enable-maglev',
  32. + action='store_true',
  33. + dest='v8_enable_maglev',
  34. + default=None,
  35. + help="Enable V8's Maglev tier.")
  36. -parser.add_argument('--v8-disable-maglev',
  37. +parser.add_argument('--v8-enable-drumbrake',
  38. action='store_true',
  39. - dest='v8_disable_maglev',
  40. + dest='v8_enable_drumbrake',
  41. default=None,
  42. - help=f"Disable V8's Maglev compiler. {maglev_enabled_by_default_help}")
  43. + help="Enable V8's drumbrake security hardening for WebAssembly.")
  44. parser.add_argument('--v8-enable-short-builtin-calls',
  45. action='store_true',
  46. @@ -1695,9 +1717,10 @@ def configure_library(lib, output, pkgna
  47. def configure_v8(o, configs):
  48. set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0)
  49. - o['variables']['v8_enable_webassembly'] = 0 if options.v8_lite_mode else 1
  50. + o['variables']['v8_enable_webassembly'] = 0 if options.v8_enable_lite_mode else 1
  51. + o['variables']['v8_enable_drumbrake'] = 1 if options.v8_enable_drumbrake else 0
  52. o['variables']['v8_enable_javascript_promise_hooks'] = 1
  53. - o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0
  54. + o['variables']['v8_enable_lite_mode'] = 1 if options.v8_enable_lite_mode else 0
  55. o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0
  56. o['variables']['v8_optimized_debug'] = 0 if options.v8_non_optimized_debug else 1
  57. o['variables']['dcheck_always_on'] = 1 if options.v8_with_dchecks else 0
  58. @@ -1705,12 +1728,21 @@ def configure_v8(o, configs):
  59. o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables.
  60. o['variables']['v8_promise_internal_field_count'] = 1 # Add internal field to promises for async hooks.
  61. o['variables']['v8_use_siphash'] = 0 if options.without_siphash else 1
  62. - o['variables']['v8_enable_maglev'] = B(not options.v8_disable_maglev and
  63. - o['variables']['target_arch'] in maglev_enabled_architectures)
  64. + o['variables']['v8_enable_turbofan'] = 1 if options.v8_enable_turbofan else 0
  65. + o['variables']['v8_enable_sparkplug'] = 1 if options.v8_enable_sparkplug else 0
  66. + o['variables']['v8_enable_maglev'] = 1 if options.v8_enable_maglev else 0
  67. + if not o['variables']['target_arch'] in maglev_enabled_architectures:
  68. + o['variables']['v8_enable_maglev'] = 0
  69. o['variables']['v8_enable_pointer_compression'] = 1 if options.enable_pointer_compression else 0
  70. if options.enable_v8_sandbox and not options.enable_pointer_compression:
  71. raise Exception(
  72. '--experimental-enable-v8-sandbox needs --experimental-enable-pointer-compression')
  73. + if options.v8_enable_lite_mode:
  74. + o['variables']['v8_enable_webassembly'] = 0
  75. + o['variables']['v8_enable_turbofan'] = 0
  76. + o['variables']['v8_enable_sparkplug'] = 0
  77. + o['variables']['v8_enable_maglev'] = 0
  78. + o['variables']['v8_enable_gdbjit'] = 0
  79. o['variables']['v8_enable_sandbox'] = 1 if options.enable_v8_sandbox else 0
  80. o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0
  81. o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression or options.disable_shared_ro_heap else 1