1# Copyright 2013 the V8 project authors. All rights reserved. 2# Redistribution and use in source and binary forms, with or without 3# modification, are permitted provided that the following conditions are 4# met: 5# 6# * Redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer. 8# * Redistributions in binary form must reproduce the above 9# copyright notice, this list of conditions and the following 10# disclaimer in the documentation and/or other materials provided 11# with the distribution. 12# * Neither the name of Google Inc. nor the names of its 13# contributors may be used to endorse or promote products derived 14# from this software without specific prior written permission. 15# 16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 28# Compile time controlled V8 features. 29 30{ 31 'variables': { 32 'v8_target_arch%': '<(target_arch)', 33 34 'v8_current_cpu%': '<(target_arch)', 35 36 # Emulate GN variables 37 # https://chromium.googlesource.com/chromium/src/build/+/556c524beb09c332698debe1b47b065d5d029cd0/config/BUILDCONFIG.gn#269 38 'conditions': [ 39 ['OS == "win" or OS == "winuwp"', { 40 'is_win': 1, 41 }, { 42 'is_win': 0, 43 }], 44 ['OS == "fuchsia"', { 45 'is_fuchsia': 1, 46 }, { 47 'is_fuchsia': 0, 48 }], 49 ['OS=="android"', { # GYP reverts OS to linux so use `-D OS=android` 50 'is_android': 1, 51 }, { 52 'is_android': 0, 53 }], 54 # flattened (!is_win && !is_fuchsia) because of GYP evaluation order 55 ['not (OS == "win" or OS == "winuwp") and not (OS == "fuchsia")', { 56 'is_posix': 1, 57 }, { 58 'is_posix': 0, 59 }], 60 ['component and "library" in component', { 61 'is_component_build': 1, 62 }, { 63 'is_component_build': 0, 64 }], 65 ['OS == "win" or OS == "mac"', { 66 # Sets -DSYSTEM_INSTRUMENTATION. Enables OS-dependent event tracing 67 'v8_enable_system_instrumentation': 1, 68 }, { 69 'v8_enable_system_instrumentation': 0, 70 }], 71 ['OS=="linux"', { 72 # Sets -dV8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION. 73 # 74 # This flag speeds up the performance of fork/execve on Linux systems for 75 # embedders which use it (like Node.js). It works by marking the pages that 76 # V8 allocates as MADV_DONTFORK. Without MADV_DONTFORK, the Linux kernel 77 # spends a long time manipulating page mappings on fork and exec which the 78 # child process doesn't generally need to access. 79 # 80 # See v8:7381 for more details. 81 'v8_enable_private_mapping_fork_optimization': 1, 82 }, { 83 'v8_enable_private_mapping_fork_optimization': 0, 84 }], 85 ], 86 'is_debug%': 0, 87 88 # Variables from BUILD.gn 89 90 # Set to 1 to enable DCHECKs in release builds. 91 'dcheck_always_on%': 0, 92 93 # For v18.x, disable SLOW_DCHECKs because they don't compile without 94 # the patches in https://bugs.chromium.org/p/v8/issues/detail?id=12887 95 # if used in constexpr, which can happen in other floated patches. 96 'v8_enable_slow_dchecks%': 0, 97 98 # Sets -DV8_ENABLE_FUTURE. 99 'v8_enable_future%': 0, 100 101 # Sets -DVERIFY_HEAP. 102 'v8_enable_verify_heap%': 0, 103 104 # Sets -DVERIFY_PREDICTABLE 105 'v8_enable_verify_predictable%': 0, 106 107 # Enable compiler warnings when using V8_DEPRECATED apis. 108 'v8_deprecation_warnings%': 0, 109 110 # Enable compiler warnings when using V8_DEPRECATE_SOON apis. 111 'v8_imminent_deprecation_warnings%': 0, 112 113 # Allows the embedder to add a custom suffix to the version string. 114 'v8_embedder_string%': '', 115 116 # Sets -dENABLE_DISASSEMBLER. 117 'v8_enable_disassembler%': 0, 118 119 # Sets the number of internal fields on promise objects. 120 'v8_promise_internal_field_count%': 0, 121 122 # Sets -dENABLE_GDB_JIT_INTERFACE. 123 'v8_enable_gdbjit%': 0, 124 125 # Sets -dENABLE_HUGEPAGE 126 'v8_enable_hugepage%': 0, 127 128 # Sets -dENABLE_VTUNE_JIT_INTERFACE. 129 'v8_enable_vtunejit%': 0, 130 131 # Currently set for node by common.gypi, avoiding default because of gyp file bug. 132 # Should be turned on only for debugging. 133 #'v8_enable_handle_zapping%': 0, 134 135 # Enable fast mksnapshot runs. 136 'v8_enable_fast_mksnapshot%': 0, 137 138 # Enable the registration of unwinding info for Windows/x64 and ARM64. 139 'v8_win64_unwinding_info%': 1, 140 141 # Enable code comments for builtins in the snapshot (impacts performance). 142 'v8_enable_snapshot_code_comments%': 0, 143 144 # Enable native counters from the snapshot (impacts performance, sets 145 # -dV8_SNAPSHOT_NATIVE_CODE_COUNTERS). 146 # This option will generate extra code in the snapshot to increment counters, 147 # as per the --native-code-counters flag. 148 'v8_enable_snapshot_native_code_counters%': 0, 149 150 # Enable code-generation-time checking of types in the CodeStubAssembler. 151 'v8_enable_verify_csa%': 0, 152 153 # Enable pointer compression (sets -dV8_COMPRESS_POINTERS). 154 'v8_enable_pointer_compression%': 0, 155 'v8_enable_31bit_smis_on_64bit_arch%': 0, 156 157 # Sets -dV8_SHORT_BUILTIN_CALLS 158 'v8_enable_short_builtin_calls%': 0, 159 160 # Sets -dOBJECT_PRINT. 161 'v8_enable_object_print%': 0, 162 163 # Sets -dV8_TRACE_MAPS. 164 'v8_enable_trace_maps%': 0, 165 166 # Sets -dV8_ENABLE_CHECKS. 167 'v8_enable_v8_checks%': 0, 168 169 # Sets -dV8_TRACE_IGNITION. 170 'v8_enable_trace_ignition%': 0, 171 172 # Sets -dV8_TRACE_FEEDBACK_UPDATES. 173 'v8_enable_trace_feedback_updates%': 0, 174 175 # Sets -dV8_ATOMIC_OBJECT_FIELD_WRITES and turns all field write operations 176 # into relaxed atomic operations. 177 'v8_enable_atomic_object_field_writes%': 1, 178 179 # Has no effect in Node.js. Here for completeness with V8's config. 180 'v8_enable_concurrent_marking%': 1, 181 182 # Enables various testing features. 183 'v8_enable_test_features%': 0, 184 185 # Enable the Maglev compiler. 186 # Sets -dV8_ENABLE_MAGLEV 187 'v8_enable_maglev%': 0, 188 189 # With post mortem support enabled, metadata is embedded into libv8 that 190 # describes various parameters of the VM for use by debuggers. See 191 # tools/gen-postmortem-metadata.py for details. 192 'v8_postmortem_support%': 0, 193 194 # Use Siphash as added protection against hash flooding attacks. 195 'v8_use_siphash%': 0, 196 197 # Use Perfetto (https://perfetto.dev) as the default TracingController. Not 198 # currently implemented. 199 'v8_use_perfetto%': 0, 200 201 # Controls the threshold for on-heap/off-heap Typed Arrays. 202 'v8_typed_array_max_size_in_heap%': 64, 203 204 # Enable sharing read-only space across isolates. 205 # Sets -DV8_SHARED_RO_HEAP. 206 'v8_enable_shared_ro_heap%': 0, 207 208 # Enable lazy source positions by default. 209 'v8_enable_lazy_source_positions%': 1, 210 211 # Enable third party HEAP library 212 'v8_enable_third_party_heap%': 0, 213 214 # Libaries used by third party heap 215 'v8_third_party_heap_libs%': [], 216 217 # Source code used by third party heap 218 'v8_third_party_heap_files%': [], 219 220 # Disable write barriers when GCs are non-incremental and 221 # heap has single generation. 222 'v8_disable_write_barriers%': 0, 223 224 # Redirect allocation in young generation so that there will be 225 # only one single generation. 226 'v8_enable_single_generation%': 0, 227 228 # Use token threaded dispatch for the regular expression interpreter. 229 # Use switch-based dispatch if this is false. 230 'v8_enable_regexp_interpreter_threaded_dispatch%': 1, 231 232 # Disable all snapshot compression. 233 'v8_enable_snapshot_compression%': 0, 234 235 # Enable control-flow integrity features, such as pointer authentication 236 # for ARM64. 237 'v8_control_flow_integrity%': 1, 238 239 # Enable V8 zone compression experimental feature. 240 # Sets -DV8_COMPRESS_ZONES. 241 'v8_enable_zone_compression%': 0, 242 243 # Enable the experimental V8 sandbox. 244 # Sets -DV8_SANDBOX. 245 'v8_enable_sandbox%': 0, 246 247 # Enable external pointer sandboxing. Requires v8_enable_sandbox. 248 # Sets -DV8_SANDBOXED_EXTERNAL_POINRTERS. 249 'v8_enable_sandboxed_external_pointers%': 0, 250 251 # Enable sandboxed pointers. Requires v8_enable_sandbox. 252 # Sets -DV8_SANDBOXED_POINTERS. 253 'v8_enable_sandboxed_pointers%': 0, 254 255 # Experimental feature for collecting per-class zone memory stats. 256 # Requires use_rtti = true 257 'v8_enable_precise_zone_stats%': 0, 258 259 # Experimental feature that uses SwissNameDictionary instead of NameDictionary 260 # as the backing store for all dictionary mode objects. 261 'v8_enable_swiss_name_dictionary%': 0, 262 263 # Experimental feature for tracking constness of properties in non-global 264 # dictionaries. Enabling this also always keeps prototypes in dict mode, 265 # meaning that they are not switched to fast mode. 266 # Sets -DV8_DICT_PROPERTY_CONST_TRACKING 267 'v8_dict_property_const_tracking%': 0, 268 269 # Allow for JS promise hooks (instead of just C++). 270 'v8_enable_javascript_promise_hooks%': 0, 271 272 # Enable allocation folding globally (sets -dV8_ALLOCATION_FOLDING). 273 # When it's disabled, the --turbo-allocation-folding runtime flag will be ignored. 274 'v8_enable_allocation_folding%': 1, 275 276 # Enable runtime verification of heap snapshots produced for devtools. 277 'v8_enable_heap_snapshot_verify%': 0, 278 279 # Enable global allocation site tracking. 280 'v8_allocation_site_tracking%': 1, 281 282 'v8_scriptormodule_legacy_lifetime%': 1, 283 284 # Change code emission and runtime features to be CET shadow-stack compliant 285 # (incomplete and experimental). 286 'v8_enable_cet_shadow_stack%': 0, 287 288 # Variables from v8.gni 289 290 # Enable ECMAScript Internationalization API. Enabling this feature will 291 # add a dependency on the ICU library. 292 'v8_enable_i18n_support%': 1, 293 294 # Lite mode disables a number of performance optimizations to reduce memory 295 # at the cost of performance. 296 # Sets --DV8_LITE_MODE. 297 'v8_enable_lite_mode%': 0, 298 299 # Include support for WebAssembly. If disabled, the 'WebAssembly' global 300 # will not be available, and embedder APIs to generate WebAssembly modules 301 # will fail. 302 'v8_enable_webassembly%': 1, 303 304 # Enable advanced BigInt algorithms, costing about 10-30 KiB binary size 305 # depending on platform. 306 'v8_advanced_bigint_algorithms%': 1 307 }, 308 309 'target_defaults': { 310 'conditions': [ 311 ['v8_embedder_string!=""', { 312 'defines': ['V8_EMBEDDER_STRING="<(v8_embedder_string)"',], 313 }], 314 ['v8_enable_disassembler==1', { 315 'defines': ['ENABLE_DISASSEMBLER',], 316 }], 317 ['v8_promise_internal_field_count!=0', { 318 'defines': ['V8_PROMISE_INTERNAL_FIELD_COUNT=<(v8_promise_internal_field_count)'], 319 }], 320 ['v8_enable_future==1', { 321 'defines': ['V8_ENABLE_FUTURE',], 322 }], 323 ['v8_enable_lite_mode==1', { 324 'defines': ['V8_LITE_MODE',], 325 }], 326 ['v8_enable_gdbjit==1', { 327 'defines': ['ENABLE_GDB_JIT_INTERFACE',], 328 }], 329 ['v8_enable_hugepage==1', { 330 'defines': ['ENABLE_HUGEPAGE',], 331 }], 332 ['v8_enable_private_mapping_fork_optimization==1', { 333 'defines': ['V8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION'], 334 }], 335 ['v8_enable_vtunejit==1', { 336 'defines': ['ENABLE_VTUNE_JIT_INTERFACE',], 337 }], 338 ['v8_enable_pointer_compression==1', { 339 'defines': [ 340 'V8_COMPRESS_POINTERS', 341 'V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE', 342 ], 343 }], 344 ['v8_enable_pointer_compression==1 or v8_enable_31bit_smis_on_64bit_arch==1', { 345 'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH',], 346 }], 347 ['v8_enable_short_builtin_calls==1', { 348 'defines': ['V8_SHORT_BUILTIN_CALLS',], 349 }], 350 ['v8_enable_zone_compression==1', { 351 'defines': ['V8_COMPRESS_ZONES',], 352 }], 353 ['v8_enable_sandbox==1', { 354 'defines': ['V8_SANDBOX',], 355 }], 356 ['v8_enable_sandboxed_pointers==1', { 357 'defines': ['V8_SANDBOXED_POINTERS',], 358 }], 359 ['v8_enable_sandboxed_external_pointers==1', { 360 'defines': ['V8_SANDBOXED_EXTERNAL_POINTERS',], 361 }], 362 ['v8_enable_object_print==1', { 363 'defines': ['OBJECT_PRINT',], 364 }], 365 ['v8_enable_verify_heap==1', { 366 'defines': ['VERIFY_HEAP',], 367 }], 368 ['v8_enable_verify_predictable==1', { 369 'defines': ['VERIFY_PREDICTABLE',], 370 }], 371 ['v8_enable_trace_maps==1', { 372 'defines': ['V8_TRACE_MAPS',], 373 }], 374 ['v8_enable_trace_ignition==1', { 375 'defines': ['V8_TRACE_IGNITION',], 376 }], 377 ['v8_enable_trace_feedback_updates==1', { 378 'defines': ['V8_TRACE_FEEDBACK_UPDATES',], 379 }], 380 ['v8_enable_test_features==1', { 381 'defines': [ 382 'V8_ENABLE_ALLOCATION_TIMEOUT', 383 'V8_ENABLE_FORCE_SLOW_PATH', 384 'V8_ENABLE_DOUBLE_CONST_STORE_CHECK', 385 ], 386 }], 387 ['v8_enable_v8_checks==1', { 388 'defines': ['V8_ENABLE_CHECKS',], 389 }], 390 ['v8_deprecation_warnings==1', { 391 'defines': ['V8_DEPRECATION_WARNINGS',], 392 },{ 393 'defines!': ['V8_DEPRECATION_WARNINGS',], 394 }], 395 ['v8_imminent_deprecation_warnings==1', { 396 'defines': ['V8_IMMINENT_DEPRECATION_WARNINGS',], 397 },{ 398 'defines!': ['V8_IMMINENT_DEPRECATION_WARNINGS',], 399 }], 400 ['v8_enable_i18n_support==1', { 401 'defines': ['V8_INTL_SUPPORT',], 402 }], 403 # Refs: https://github.com/nodejs/node/pull/23801 404 # ['v8_enable_handle_zapping==1', { 405 # 'defines': ['ENABLE_HANDLE_ZAPPING',], 406 # }], 407 ['v8_enable_heap_snapshot_verify==1', { 408 'defines': ['V8_ENABLE_HEAP_SNAPSHOT_VERIFY',], 409 }], 410 ['v8_enable_snapshot_native_code_counters==1', { 411 'defines': ['V8_SNAPSHOT_NATIVE_CODE_COUNTERS',], 412 }], 413 ['v8_enable_single_generation==1', { 414 'defines': ['V8_ENABLE_SINGLE_GENERATION',], 415 }], 416 ['v8_disable_write_barriers==1', { 417 'defines': ['V8_DISABLE_WRITE_BARRIERS',], 418 }], 419 ['v8_enable_third_party_heap==1', { 420 'defines': ['V8_ENABLE_THIRD_PARTY_HEAP',], 421 }], 422 ['v8_enable_atomic_object_field_writes==1', { 423 'defines': ['V8_ATOMIC_OBJECT_FIELD_WRITES',], 424 }], 425 ['v8_enable_lazy_source_positions==1', { 426 'defines': ['V8_ENABLE_LAZY_SOURCE_POSITIONS',], 427 }], 428 ['v8_use_siphash==1', { 429 'defines': ['V8_USE_SIPHASH',], 430 }], 431 ['v8_enable_shared_ro_heap==1', { 432 'defines': ['V8_SHARED_RO_HEAP',], 433 }], 434 ['dcheck_always_on!=0', { 435 'defines': ['DEBUG',], 436 }], 437 ['v8_enable_verify_csa==1', { 438 'defines': ['ENABLE_VERIFY_CSA',], 439 }], 440 ['v8_use_perfetto==1', { 441 'defines': ['V8_USE_PERFETTO',], 442 }], 443 ['v8_win64_unwinding_info==1', { 444 'defines': ['V8_WIN64_UNWINDING_INFO',], 445 }], 446 ['v8_enable_regexp_interpreter_threaded_dispatch==1', { 447 'defines': ['V8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH',], 448 }], 449 ['v8_enable_snapshot_compression==1', { 450 'defines': ['V8_SNAPSHOT_COMPRESSION',], 451 }], 452 ['v8_control_flow_integrity==1', { 453 'defines': ['V8_ENABLE_CONTROL_FLOW_INTEGRITY',], 454 }], 455 ['v8_enable_cet_shadow_stack==1', { 456 'defines': ['V8_ENABLE_CET_SHADOW_STACK',], 457 }], 458 ['v8_enable_precise_zone_stats==1', { 459 'defines': ['V8_ENABLE_PRECISE_ZONE_STATS',], 460 }], 461 ['v8_enable_maglev==1', { 462 'defines': ['V8_ENABLE_MAGLEV',], 463 }], 464 ['v8_enable_swiss_name_dictionary==1', { 465 'defines': ['V8_ENABLE_SWISS_NAME_DICTIONARY',], 466 }], 467 ['v8_enable_system_instrumentation==1', { 468 'defines': ['V8_ENABLE_SYSTEM_INSTRUMENTATION',], 469 }], 470 ['v8_enable_webassembly==1', { 471 'defines': ['V8_ENABLE_WEBASSEMBLY',], 472 }], 473 ['v8_dict_property_const_tracking==1', { 474 'defines': ['V8_DICT_PROPERTY_CONST_TRACKING',], 475 }], 476 ['v8_enable_javascript_promise_hooks==1', { 477 'defines': ['V8_ENABLE_JAVASCRIPT_PROMISE_HOOKS',], 478 }], 479 ['v8_enable_allocation_folding==1', { 480 'defines': ['V8_ALLOCATION_FOLDING',], 481 }], 482 ['v8_allocation_site_tracking==1', { 483 'defines': ['V8_ALLOCATION_SITE_TRACKING',], 484 }], 485 ['v8_scriptormodule_legacy_lifetime==1', { 486 'defines': ['V8_SCRIPTORMODULE_LEGACY_LIFETIME',], 487 }], 488 ['v8_advanced_bigint_algorithms==1', { 489 'defines': ['V8_ADVANCED_BIGINT_ALGORITHMS',], 490 }], 491 ], # conditions 492 'defines': [ 493 'V8_GYP_BUILD', 494 'V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=<(v8_typed_array_max_size_in_heap)', 495 ], # defines 496 }, # target_defaults 497} 498