• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 embedded builtins.
113    'v8_enable_embedded_builtins%': 1,
114
115    # Enable the registration of unwinding info for Windows/x64 and ARM64.
116    'v8_win64_unwinding_info%': 1,
117
118    # Enable code comments for builtins in the snapshot (impacts performance).
119    'v8_enable_snapshot_code_comments%': 0,
120
121    # Enable native counters from the snapshot (impacts performance, sets
122    # -dV8_SNAPSHOT_NATIVE_CODE_COUNTERS).
123    # This option will generate extra code in the snapshot to increment counters,
124    # as per the --native-code-counters flag.
125    'v8_enable_snapshot_native_code_counters%': 0,
126
127    # Enable code-generation-time checking of types in the CodeStubAssembler.
128    'v8_enable_verify_csa%': 0,
129
130    # Enable pointer compression (sets -dV8_COMPRESS_POINTERS).
131    'v8_enable_pointer_compression%': 0,
132    'v8_enable_31bit_smis_on_64bit_arch%': 0,
133
134    # Sets -dOBJECT_PRINT.
135    'v8_enable_object_print%': 0,
136
137    # Sets -dV8_TRACE_MAPS.
138    'v8_enable_trace_maps%': 0,
139
140    # Sets -dV8_ENABLE_CHECKS.
141    'v8_enable_v8_checks%': 0,
142
143    # Sets -dV8_TRACE_IGNITION.
144    'v8_enable_trace_ignition%': 0,
145
146    # Sets -dV8_TRACE_FEEDBACK_UPDATES.
147    'v8_enable_trace_feedback_updates%': 0,
148
149    # Sets -dV8_CONCURRENT_MARKING
150    'v8_enable_concurrent_marking%': 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    # Disable write barriers when GCs are non-incremental and
188    # heap has single generation.
189    'v8_disable_write_barriers%': 0,
190
191    # Redirect allocation in young generation so that there will be
192    # only one single generation.
193    'v8_enable_single_generation%': 0,
194
195    # Use token threaded dispatch for the regular expression interpreter.
196    # Use switch-based dispatch if this is false.
197    'v8_enable_regexp_interpreter_threaded_dispatch%': 1,
198
199    # Variables from v8.gni
200
201    # Enable the snapshot feature, for fast context creation.
202    # http://v8project.blogspot.com/2015/09/custom-startup-snapshots.html
203    'v8_use_snapshot%': 1,
204
205    # Enable ECMAScript Internationalization API. Enabling this feature will
206    # add a dependency on the ICU library.
207    'v8_enable_i18n_support%': 1,
208  },
209
210  'target_defaults': {
211    'conditions': [
212      ['v8_embedder_string!=""', {
213        'defines': ['V8_EMBEDDER_STRING="<(v8_embedder_string)"',],
214      }],
215      ['v8_enable_disassembler==1', {
216        'defines': ['ENABLE_DISASSEMBLER',],
217      }],
218      ['v8_promise_internal_field_count!=0', {
219        'defines': ['V8_PROMISE_INTERNAL_FIELD_COUNT=<(v8_promise_internal_field_count)'],
220      }],
221      ['v8_enable_raw_heap_snapshots==1', {
222        'defines': ['V8_ENABLE_RAW_HEAP_SNAPSHOTS',],
223      }],
224      ['v8_enable_future==1', {
225        'defines': ['V8_ENABLE_FUTURE',],
226      }],
227      ['v8_enable_lite_mode==1', {
228        'defines': [
229          'V8_LITE_MODE',
230          'V8_JITLESS_MODE',
231        ],
232      }],
233      ['v8_enable_gdbjit==1', {
234        'defines': ['ENABLE_GDB_JIT_INTERFACE',],
235      }],
236      ['v8_enable_minor_mc==1', {
237        'defines': ['ENABLE_MINOR_MC',],
238      }],
239      ['v8_enable_pointer_compression==1', {
240        'defines': ['V8_COMPRESS_POINTERS',],
241      }],
242      ['v8_enable_pointer_compression==1 or v8_enable_31bit_smis_on_64bit_arch==1', {
243        'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH',],
244      }],
245      ['v8_enable_object_print==1', {
246        'defines': ['OBJECT_PRINT',],
247      }],
248      ['v8_enable_verify_heap==1', {
249        'defines': ['VERIFY_HEAP',],
250      }],
251      ['v8_enable_verify_predictable==1', {
252        'defines': ['VERIFY_PREDICTABLE',],
253      }],
254      ['v8_enable_trace_maps==1', {
255        'defines': ['V8_TRACE_MAPS',],
256      }],
257      ['v8_enable_trace_ignition==1', {
258        'defines': ['V8_TRACE_IGNITION',],
259      }],
260      ['v8_enable_trace_feedback_updates==1', {
261        'defines': ['V8_TRACE_FEEDBACK_UPDATES',],
262      }],
263      ['v8_enable_test_features==1', {
264        'defines': [
265          'V8_ENABLE_ALLOCATION_TIMEOUT',
266          'V8_ENABLE_FORCE_SLOW_PATH',
267          'V8_ENABLE_DOUBLE_CONST_STORE_CHECK',
268        ],
269      }],
270      ['v8_enable_v8_checks==1', {
271        'defines': ['V8_ENABLE_CHECKS',],
272      }],
273      ['v8_deprecation_warnings==1', {
274        'defines': ['V8_DEPRECATION_WARNINGS',],
275      },{
276        'defines!': ['V8_DEPRECATION_WARNINGS',],
277      }],
278      ['v8_imminent_deprecation_warnings==1', {
279        'defines': ['V8_IMMINENT_DEPRECATION_WARNINGS',],
280      },{
281        'defines!': ['V8_IMMINENT_DEPRECATION_WARNINGS',],
282      }],
283      ['v8_enable_i18n_support==1', {
284        'defines': ['V8_INTL_SUPPORT',],
285      }],
286      # Refs: https://github.com/nodejs/node/pull/23801
287      # ['v8_enable_handle_zapping==1', {
288      #  'defines': ['ENABLE_HANDLE_ZAPPING',],
289      # }],
290      ['v8_use_snapshot==1', {
291        'defines': ['V8_USE_SNAPSHOT',],
292        'conditions': [
293          ['v8_enable_snapshot_native_code_counters==1', {
294            'defines': ['V8_SNAPSHOT_NATIVE_CODE_COUNTERS',],
295          }],
296        ],
297      }],
298      ['v8_enable_single_generation==1', {
299        'defines': ['V8_ENABLE_SINGLE_GENERATION',],
300      }],
301      ['v8_disable_write_barriers==1', {
302        'defines': ['V8_DISABLE_WRITE_BARRIERS',],
303      }],
304      ['v8_enable_concurrent_marking==1', {
305        'defines': ['V8_CONCURRENT_MARKING',],
306      }],
307      ['v8_enable_lazy_source_positions==1', {
308        'defines': ['V8_ENABLE_LAZY_SOURCE_POSITIONS',],
309      }],
310      ['v8_check_microtasks_scopes_consistency==1', {
311        'defines': ['V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY',],
312      }],
313      ['v8_enable_embedded_builtins==1', {
314        'defines': ['V8_EMBEDDED_BUILTINS',],
315      }],
316      ['v8_use_siphash==1', {
317        'defines': ['V8_USE_SIPHASH',],
318      }],
319      ['dcheck_always_on!=0', {
320        'defines': ['DEBUG',],
321      }],
322      ['v8_enable_verify_csa==1', {
323        'defines': ['ENABLE_VERIFY_CSA',],
324      }],
325      ['v8_untrusted_code_mitigations==0', {
326        'defines': ['DISABLE_UNTRUSTED_CODE_MITIGATIONS',],
327      }],
328      ['v8_use_perfetto==1', {
329        'defines': ['V8_USE_PERFETTO',],
330      }],
331      ['v8_win64_unwinding_info==1', {
332        'defines': ['V8_WIN64_UNWINDING_INFO',],
333      }],
334      ['v8_enable_regexp_interpreter_threaded_dispatch==1', {
335        'defines': ['V8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH',],
336      }],
337    ],  # conditions
338    'defines': [
339      'V8_GYP_BUILD',
340      'V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=<(v8_typed_array_max_size_in_heap)',
341    ],  # defines
342  },  # target_defaults
343}
344