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 ], 66 'is_debug%': 0, 67 68 # Variables from BUILD.gn 69 70 # Set to 1 to enable DCHECKs in release builds. 71 'dcheck_always_on%': 0, 72 73 # Sets -DV8_ENABLE_FUTURE. 74 'v8_enable_future%': 0, 75 76 # Lite mode disables a number of performance optimizations to reduce memory 77 # at the cost of performance. 78 # Sets --DV8_LITE_MODE. 79 'v8_enable_lite_mode%': 0, 80 81 # Sets -DVERIFY_HEAP. 82 'v8_enable_verify_heap%': 0, 83 84 # Sets -DVERIFY_PREDICTABLE 85 'v8_enable_verify_predictable%': 0, 86 87 # Enable compiler warnings when using V8_DEPRECATED apis. 88 'v8_deprecation_warnings%': 0, 89 90 # Enable compiler warnings when using V8_DEPRECATE_SOON apis. 91 'v8_imminent_deprecation_warnings%': 0, 92 93 # Allows the embedder to add a custom suffix to the version string. 94 'v8_embedder_string%': '', 95 96 # Sets -dENABLE_DISASSEMBLER. 97 'v8_enable_disassembler%': 0, 98 99 # Sets the number of internal fields on promise objects. 100 'v8_promise_internal_field_count%': 0, 101 102 # Sets -dENABLE_GDB_JIT_INTERFACE. 103 'v8_enable_gdbjit%': 0, 104 105 # Currently set for node by common.gypi, avoiding default because of gyp file bug. 106 # Should be turned on only for debugging. 107 #'v8_enable_handle_zapping%': 0, 108 109 # Enable fast mksnapshot runs. 110 'v8_enable_fast_mksnapshot%': 0, 111 112 # Enable the registration of unwinding info for Windows/x64 and ARM64. 113 'v8_win64_unwinding_info%': 1, 114 115 # Enable code comments for builtins in the snapshot (impacts performance). 116 'v8_enable_snapshot_code_comments%': 0, 117 118 # Enable native counters from the snapshot (impacts performance, sets 119 # -dV8_SNAPSHOT_NATIVE_CODE_COUNTERS). 120 # This option will generate extra code in the snapshot to increment counters, 121 # as per the --native-code-counters flag. 122 'v8_enable_snapshot_native_code_counters%': 0, 123 124 # Enable code-generation-time checking of types in the CodeStubAssembler. 125 'v8_enable_verify_csa%': 0, 126 127 # Enable pointer compression (sets -dV8_COMPRESS_POINTERS). 128 'v8_enable_pointer_compression%': 0, 129 'v8_enable_31bit_smis_on_64bit_arch%': 0, 130 131 # Sets -dOBJECT_PRINT. 132 'v8_enable_object_print%': 0, 133 134 # Sets -dV8_TRACE_MAPS. 135 'v8_enable_trace_maps%': 0, 136 137 # Sets -dV8_ENABLE_CHECKS. 138 'v8_enable_v8_checks%': 0, 139 140 # Sets -dV8_TRACE_IGNITION. 141 'v8_enable_trace_ignition%': 0, 142 143 # Sets -dV8_TRACE_FEEDBACK_UPDATES. 144 'v8_enable_trace_feedback_updates%': 0, 145 146 # Sets -dV8_CONCURRENT_MARKING 147 'v8_enable_concurrent_marking%': 1, 148 149 # Sets -dV8_ARRAY_BUFFER_EXTENSION 150 'v8_enable_array_buffer_extension%': 1, 151 152 # Enables various testing features. 153 'v8_enable_test_features%': 0, 154 155 # Enables raw heap snapshots containing internals. Used for debugging memory 156 # on platform and embedder level. 157 'v8_enable_raw_heap_snapshots%': 0, 158 159 # With post mortem support enabled, metadata is embedded into libv8 that 160 # describes various parameters of the VM for use by debuggers. See 161 # tools/gen-postmortem-metadata.py for details. 162 'v8_postmortem_support%': 0, 163 164 # Use Siphash as added protection against hash flooding attacks. 165 'v8_use_siphash%': 0, 166 167 # Use Perfetto (https://perfetto.dev) as the default TracingController. Not 168 # currently implemented. 169 'v8_use_perfetto%': 0, 170 171 # Controls the threshold for on-heap/off-heap Typed Arrays. 172 'v8_typed_array_max_size_in_heap%': 64, 173 174 # Temporary flag to allow embedders to update their microtasks scopes 175 # while rolling in a new version of V8. 176 'v8_check_microtasks_scopes_consistency%': 0, 177 178 # Enable mitigations for executing untrusted code. 179 'v8_untrusted_code_mitigations%': 1, 180 181 # Enable minor mark compact. 182 'v8_enable_minor_mc%': 1, 183 184 # Enable lazy source positions by default. 185 'v8_enable_lazy_source_positions%': 1, 186 187 # Enable third party HEAP library 188 'v8_enable_third_party_heap%': 0, 189 190 # Libaries used by third party heap 191 'v8_third_party_heap_libs%': [], 192 193 # Source code used by third party heap 194 'v8_third_party_heap_files%': [], 195 196 # Disable write barriers when GCs are non-incremental and 197 # heap has single generation. 198 'v8_disable_write_barriers%': 0, 199 200 # Redirect allocation in young generation so that there will be 201 # only one single generation. 202 'v8_enable_single_generation%': 0, 203 204 # Use token threaded dispatch for the regular expression interpreter. 205 # Use switch-based dispatch if this is false. 206 'v8_enable_regexp_interpreter_threaded_dispatch%': 1, 207 208 # Disable all snapshot compression. 209 'v8_enable_snapshot_compression%': 1, 210 211 # Enable control-flow integrity features, such as pointer authentication 212 # for ARM64. 213 'v8_control_flow_integrity%': 0, 214 215 # Experimental support for native context independent code. 216 # https://crbug.com/v8/8888 217 'v8_enable_nci_code%': 0, 218 219 # Variables from v8.gni 220 221 # Enable ECMAScript Internationalization API. Enabling this feature will 222 # add a dependency on the ICU library. 223 'v8_enable_i18n_support%': 1, 224 }, 225 226 'target_defaults': { 227 'conditions': [ 228 ['v8_embedder_string!=""', { 229 'defines': ['V8_EMBEDDER_STRING="<(v8_embedder_string)"',], 230 }], 231 ['v8_enable_disassembler==1', { 232 'defines': ['ENABLE_DISASSEMBLER',], 233 }], 234 ['v8_promise_internal_field_count!=0', { 235 'defines': ['V8_PROMISE_INTERNAL_FIELD_COUNT=<(v8_promise_internal_field_count)'], 236 }], 237 ['v8_enable_raw_heap_snapshots==1', { 238 'defines': ['V8_ENABLE_RAW_HEAP_SNAPSHOTS',], 239 }], 240 ['v8_enable_future==1', { 241 'defines': ['V8_ENABLE_FUTURE',], 242 }], 243 ['v8_enable_lite_mode==1', { 244 'defines': ['V8_LITE_MODE',], 245 }], 246 ['v8_enable_gdbjit==1', { 247 'defines': ['ENABLE_GDB_JIT_INTERFACE',], 248 }], 249 ['v8_enable_minor_mc==1', { 250 'defines': ['ENABLE_MINOR_MC',], 251 }], 252 ['v8_enable_pointer_compression==1', { 253 'defines': ['V8_COMPRESS_POINTERS',], 254 }], 255 ['v8_enable_pointer_compression==1 or v8_enable_31bit_smis_on_64bit_arch==1', { 256 'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH',], 257 }], 258 ['v8_enable_object_print==1', { 259 'defines': ['OBJECT_PRINT',], 260 }], 261 ['v8_enable_verify_heap==1', { 262 'defines': ['VERIFY_HEAP',], 263 }], 264 ['v8_enable_verify_predictable==1', { 265 'defines': ['VERIFY_PREDICTABLE',], 266 }], 267 ['v8_enable_trace_maps==1', { 268 'defines': ['V8_TRACE_MAPS',], 269 }], 270 ['v8_enable_trace_ignition==1', { 271 'defines': ['V8_TRACE_IGNITION',], 272 }], 273 ['v8_enable_trace_feedback_updates==1', { 274 'defines': ['V8_TRACE_FEEDBACK_UPDATES',], 275 }], 276 ['v8_enable_test_features==1', { 277 'defines': [ 278 'V8_ENABLE_ALLOCATION_TIMEOUT', 279 'V8_ENABLE_FORCE_SLOW_PATH', 280 'V8_ENABLE_DOUBLE_CONST_STORE_CHECK', 281 ], 282 }], 283 ['v8_enable_v8_checks==1', { 284 'defines': ['V8_ENABLE_CHECKS',], 285 }], 286 ['v8_deprecation_warnings==1', { 287 'defines': ['V8_DEPRECATION_WARNINGS',], 288 },{ 289 'defines!': ['V8_DEPRECATION_WARNINGS',], 290 }], 291 ['v8_imminent_deprecation_warnings==1', { 292 'defines': ['V8_IMMINENT_DEPRECATION_WARNINGS',], 293 },{ 294 'defines!': ['V8_IMMINENT_DEPRECATION_WARNINGS',], 295 }], 296 ['v8_enable_i18n_support==1', { 297 'defines': ['V8_INTL_SUPPORT',], 298 }], 299 # Refs: https://github.com/nodejs/node/pull/23801 300 # ['v8_enable_handle_zapping==1', { 301 # 'defines': ['ENABLE_HANDLE_ZAPPING',], 302 # }], 303 ['v8_enable_snapshot_native_code_counters==1', { 304 'defines': ['V8_SNAPSHOT_NATIVE_CODE_COUNTERS',], 305 }], 306 ['v8_enable_single_generation==1', { 307 'defines': ['V8_ENABLE_SINGLE_GENERATION',], 308 }], 309 ['v8_disable_write_barriers==1', { 310 'defines': ['V8_DISABLE_WRITE_BARRIERS',], 311 }], 312 ['v8_enable_third_party_heap==1', { 313 'defines': ['V8_ENABLE_THIRD_PARTY_HEAP',], 314 }], 315 ['v8_enable_concurrent_marking==1', { 316 'defines': ['V8_CONCURRENT_MARKING',], 317 }], 318 ['v8_enable_array_buffer_extension==1', { 319 'defines': ['V8_ARRAY_BUFFER_EXTENSION',], 320 }], 321 ['v8_enable_lazy_source_positions==1', { 322 'defines': ['V8_ENABLE_LAZY_SOURCE_POSITIONS',], 323 }], 324 ['v8_check_microtasks_scopes_consistency==1', { 325 'defines': ['V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY',], 326 }], 327 ['v8_use_siphash==1', { 328 'defines': ['V8_USE_SIPHASH',], 329 }], 330 ['dcheck_always_on!=0', { 331 'defines': ['DEBUG',], 332 }], 333 ['v8_enable_verify_csa==1', { 334 'defines': ['ENABLE_VERIFY_CSA',], 335 }], 336 ['v8_untrusted_code_mitigations==0', { 337 'defines': ['DISABLE_UNTRUSTED_CODE_MITIGATIONS',], 338 }], 339 ['v8_use_perfetto==1', { 340 'defines': ['V8_USE_PERFETTO',], 341 }], 342 ['v8_win64_unwinding_info==1', { 343 'defines': ['V8_WIN64_UNWINDING_INFO',], 344 }], 345 ['v8_enable_regexp_interpreter_threaded_dispatch==1', { 346 'defines': ['V8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH',], 347 }], 348 ['v8_enable_snapshot_compression==1', { 349 'defines': ['V8_SNAPSHOT_COMPRESSION',], 350 }], 351 ['v8_control_flow_integrity==1', { 352 'defines': ['V8_ENABLE_CONTROL_FLOW_INTEGRITY',], 353 }], 354 ['v8_enable_nci_code==1', { 355 'defines': ['V8_ENABLE_NCI_CODE',], 356 }], 357 ], # conditions 358 'defines': [ 359 'V8_GYP_BUILD', 360 'V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=<(v8_typed_array_max_size_in_heap)', 361 ], # defines 362 }, # target_defaults 363} 364