1# Copyright 2012 the V8 project authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4{
5  'variables': {
6    'V8_ROOT': '../../deps/v8',
7    'v8_code': 1,
8    'v8_random_seed%': 314159265,
9    'v8_vector_stores%': 0,
10    'v8_embed_script%': "",
11    'mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)mksnapshot<(EXECUTABLE_SUFFIX)',
12    'v8_os_page_size%': 0,
13    'generate_bytecode_output_root': '<(SHARED_INTERMEDIATE_DIR)/generate-bytecode-output-root',
14    'generate_bytecode_builtins_list_output': '<(generate_bytecode_output_root)/builtins-generated/bytecodes-builtins-list.h',
15    'torque_files': ['<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "torque_files = ")'],
16    # Torque and V8 expect the files to be named relative to V8's root.
17    'torque_files_without_v8_root': ['<!@pymod_do_main(ForEachReplace "<@(V8_ROOT)/" "" <@(torque_files))'],
18    'torque_files_replaced': ['<!@pymod_do_main(ForEachReplace ".tq" "-tq" <@(torque_files_without_v8_root))'],
19    'torque_outputs_csa_cc': ['<!@pymod_do_main(ForEachFormat "<(SHARED_INTERMEDIATE_DIR)/torque-generated/%s-csa.cc" <@(torque_files_replaced))'],
20    'torque_outputs_csa_h': ['<!@pymod_do_main(ForEachFormat "<(SHARED_INTERMEDIATE_DIR)/torque-generated/%s-csa.h" <@(torque_files_replaced))'],
21    'torque_outputs_inl_inc': ['<!@pymod_do_main(ForEachFormat "<(SHARED_INTERMEDIATE_DIR)/torque-generated/%s-inl.inc" <@(torque_files_replaced))'],
22    'torque_outputs_cc': ['<!@pymod_do_main(ForEachFormat "<(SHARED_INTERMEDIATE_DIR)/torque-generated/%s.cc" <@(torque_files_replaced))'],
23    'torque_outputs_inc': ['<!@pymod_do_main(ForEachFormat "<(SHARED_INTERMEDIATE_DIR)/torque-generated/%s.inc" <@(torque_files_replaced))'],
24    'v8_compiler_sources': ['<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_compiler_sources = ")'],
25    'conditions': [
26      ['v8_enable_i18n_support==1', {
27        'torque_files': [
28          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "torque_files =.*?v8_enable_i18n_support.*?torque_files \\+= ")',
29        ],
30      }],
31      ['v8_enable_webassembly==1', {
32        'torque_files': [
33          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "torque_files =.*?v8_enable_webassembly.*?torque_files \\+= ")',
34        ],
35        'v8_compiler_sources': [
36          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_compiler_sources =.*?v8_enable_webassembly.*?v8_compiler_sources \\+= ")',
37        ],
38      }],
39    ],
40  },
41  'includes': ['toolchain.gypi', 'features.gypi'],
42  'target_defaults': {
43    'msvs_settings': {
44      'VCCLCompilerTool': {
45        'AdditionalOptions': ['/utf-8']
46      }
47    },
48  },
49  'targets': [
50    {
51      'target_name': 'run_torque',
52      'type': 'none',
53      'toolsets': ['host', 'target'],
54      'conditions': [
55        ['want_separate_host_toolset', {
56          'dependencies': ['torque#host'],
57        }, {
58          'dependencies': ['torque#target'],
59        }],
60      ],
61      'hard_dependency': 1,
62      'direct_dependent_settings': {
63        'include_dirs': [
64          '<(SHARED_INTERMEDIATE_DIR)',
65        ],
66      },
67      'actions': [
68        {
69          'action_name': 'run_torque_action',
70          'inputs': [  # Order matters.
71            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)',
72            '<@(torque_files)',
73          ],
74          'outputs': [
75            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/bit-fields.h",
76            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/builtin-definitions.h",
77            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-debug-readers.cc",
78            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-debug-readers.h",
79            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-forward-declarations.h",
80            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-verifiers.cc",
81            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-verifiers.h",
82            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/csa-types.h",
83            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/debug-macros.cc",
84            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/debug-macros.h",
85            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/enum-verifiers.cc",
86            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/exported-macros-assembler.cc",
87            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/exported-macros-assembler.h",
88            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/factory.cc",
89            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/factory.inc",
90            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/instance-types.h",
91            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/interface-descriptors.inc",
92            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/objects-body-descriptors-inl.inc",
93            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/objects-printer.cc",
94            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/visitor-lists.h",
95            '<@(torque_outputs_csa_cc)',
96            '<@(torque_outputs_csa_h)',
97            '<@(torque_outputs_inl_inc)',
98            '<@(torque_outputs_cc)',
99            '<@(torque_outputs_inc)',
100          ],
101          'action': [
102            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)',
103            '-o', '<(SHARED_INTERMEDIATE_DIR)/torque-generated',
104            '-v8-root', '<(V8_ROOT)',
105            '<@(torque_files_without_v8_root)',
106          ],
107        },
108      ],
109    },  # run_torque
110    {
111      'target_name': 'v8_maybe_icu',
112      'type': 'none',
113      'toolsets': ['host', 'target'],
114      'hard_dependency': 1,
115      'conditions': [
116        ['v8_enable_i18n_support==1', {
117          'dependencies': [
118            '<(icu_gyp_path):icui18n',
119            '<(icu_gyp_path):icuuc',
120          ],
121          'export_dependent_settings': [
122            '<(icu_gyp_path):icui18n',
123            '<(icu_gyp_path):icuuc',
124          ],
125        }],
126      ],
127    },  # v8_maybe_icu
128    {
129      'target_name': 'torque_runtime_support',
130      'type': 'none',
131      'toolsets': ['host', 'target'],
132      'direct_dependent_settings': {
133        'sources': [
134          '<(V8_ROOT)/src/torque/runtime-support.h',
135        ],
136      },
137    },  # torque_runtime_support
138    {
139      'target_name': 'torque_generated_initializers',
140      'type': 'none',
141      'toolsets': ['host', 'target'],
142      'hard_dependency': 1,
143      'dependencies': [
144        'generate_bytecode_builtins_list',
145        'run_torque',
146        'v8_base_without_compiler',
147        'torque_runtime_support',
148        'v8_maybe_icu',
149      ],
150      'direct_dependent_settings': {
151        'sources': [
152          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/csa-types.h',
153          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/enum-verifiers.cc',
154          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/exported-macros-assembler.cc',
155          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/exported-macros-assembler.h',
156          '<@(torque_outputs_csa_cc)',
157          '<@(torque_outputs_csa_h)',
158        ],
159      }
160    },  # torque_generated_initializers
161    {
162      'target_name': 'torque_generated_definitions',
163      'type': 'none',
164      'toolsets': ['host', 'target'],
165      'hard_dependency': 1,
166      'dependencies': [
167        'generate_bytecode_builtins_list',
168        'run_torque',
169        'v8_internal_headers',
170        'v8_libbase',
171        'v8_maybe_icu',
172      ],
173      'direct_dependent_settings': {
174        'sources': [
175          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-forward-declarations.h',
176          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-verifiers.cc',
177          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-verifiers.h',
178          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/factory.cc',
179          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/objects-printer.cc',
180          '<@(torque_outputs_inl_inc)',
181          '<@(torque_outputs_cc)',
182          '<@(torque_outputs_inc)',
183        ],
184        'include_dirs': [
185          '<(SHARED_INTERMEDIATE_DIR)',
186        ],
187      },
188    },  # torque_generated_definitions
189    {
190      'target_name': 'generate_bytecode_builtins_list',
191      'type': 'none',
192      'hard_dependency': 1,
193      'toolsets': ['host', 'target'],
194      'conditions': [
195        ['want_separate_host_toolset', {
196          'dependencies': ['bytecode_builtins_list_generator#host'],
197        }, {
198          'dependencies': ['bytecode_builtins_list_generator#target'],
199        }],
200      ],
201      'direct_dependent_settings': {
202        'sources': [
203          '<(generate_bytecode_builtins_list_output)',
204        ],
205        'include_dirs': [
206          '<(generate_bytecode_output_root)',
207          '<(SHARED_INTERMEDIATE_DIR)',
208        ],
209      },
210      'actions': [
211        {
212          'action_name': 'generate_bytecode_builtins_list_action',
213          'inputs': [
214            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)',
215          ],
216          'outputs': [
217            '<(generate_bytecode_builtins_list_output)',
218          ],
219          'action': [
220            '<(python)',
221            '<(V8_ROOT)/tools/run.py',
222            '<@(_inputs)',
223            '<@(_outputs)',
224          ],
225        },
226      ],
227    },  # generate_bytecode_builtins_list
228    {
229      'target_name': 'v8_init',
230      'type': 'static_library',
231      'toolsets': ['host', 'target'],
232      'dependencies': [
233        'generate_bytecode_builtins_list',
234        'run_torque',
235        'v8_base_without_compiler',
236        'v8_initializers',
237        'v8_maybe_icu',
238      ],
239      'sources': [
240        '<(V8_ROOT)/src/init/setup-isolate-full.cc',
241      ],
242    },  # v8_init
243    {
244      'target_name': 'v8_initializers',
245      'type': 'static_library',
246      'toolsets': ['host', 'target'],
247      'dependencies': [
248        'torque_generated_initializers',
249        'v8_base_without_compiler',
250        'v8_shared_internal_headers',
251      ],
252      'include_dirs': [
253        '<(SHARED_INTERMEDIATE_DIR)',
254        '<(generate_bytecode_output_root)',
255      ],
256      'sources': [
257        '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_initializers.*?sources = ")',
258      ],
259      'conditions': [
260        ['v8_enable_webassembly==1', {
261          'sources': [
262            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_initializers.*?v8_enable_webassembly.*?sources \\+= ")',
263          ],
264        }],
265        ['v8_target_arch=="ia32"', {
266          'sources': [
267            '<(V8_ROOT)/src/builtins/ia32/builtins-ia32.cc',
268          ],
269        }],
270        ['v8_target_arch=="x64"', {
271          'sources': [
272            '<(V8_ROOT)/src/builtins/x64/builtins-x64.cc',
273          ],
274        }],
275        ['v8_target_arch=="arm"', {
276          'sources': [
277            '<(V8_ROOT)/src/builtins/arm/builtins-arm.cc',
278          ],
279        }],
280        ['v8_target_arch=="arm64"', {
281          'sources': [
282            '<(V8_ROOT)/src/builtins/arm64/builtins-arm64.cc',
283          ],
284        }],
285        ['v8_target_arch=="mips" or v8_target_arch=="mipsel"', {
286          'sources': [
287            '<(V8_ROOT)/src/builtins/mips/builtins-mips.cc',
288          ],
289        }],
290        ['v8_target_arch=="riscv64" or v8_target_arch=="riscv64"', {
291          'sources': [
292            '<(V8_ROOT)/src/builtins/riscv64/builtins-riscv64.cc',
293          ],
294        }],        
295        ['v8_target_arch=="loong64" or v8_target_arch=="loong64"', {
296          'sources': [
297            '<(V8_ROOT)/src/builtins/loong64/builtins-loong64.cc',
298          ],
299        }],        
300        ['v8_target_arch=="mips64" or v8_target_arch=="mips64el"', {
301          'sources': [
302            '<(V8_ROOT)/src/builtins/mips64/builtins-mips64.cc',
303          ],
304        }],
305        ['v8_target_arch=="ppc"', {
306          'sources': [
307            '<(V8_ROOT)/src/builtins/ppc/builtins-ppc.cc',
308          ],
309        }],
310        ['v8_target_arch=="ppc64"', {
311          'sources': [
312            '<(V8_ROOT)/src/builtins/ppc/builtins-ppc.cc',
313          ],
314        }],
315        ['v8_target_arch=="s390x"', {
316          'sources': [
317            '<(V8_ROOT)/src/builtins/s390/builtins-s390.cc',
318          ],
319        }],
320        ['v8_enable_i18n_support==1', {
321          'dependencies': [
322            '<(icu_gyp_path):icui18n',
323            '<(icu_gyp_path):icuuc',
324          ],
325        }, {
326           'sources!': [
327             '<(V8_ROOT)/src/builtins/builtins-intl-gen.cc',
328           ],
329         }],
330        ['OS=="win"', {
331          'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
332          'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
333          'sources': [
334            '<(_msvs_precompiled_header)',
335            '<(_msvs_precompiled_source)',
336          ],
337        }],
338      ],
339    },  # v8_initializers
340    {
341      'target_name': 'v8_snapshot',
342      'type': 'static_library',
343      'toolsets': ['target'],
344      'conditions': [
345        ['v8_control_flow_integrity==1', {
346          'sources': [
347            '<(V8_ROOT)/src/deoptimizer/deoptimizer-cfi-builtins.cc',
348          ],
349        }],
350        ['want_separate_host_toolset', {
351          'conditions': [
352            ['v8_target_arch=="arm64"', {
353              'msvs_enable_marmasm': 1,
354            }]
355          ],
356          'dependencies': [
357            'generate_bytecode_builtins_list',
358            'run_torque',
359            'mksnapshot#host',
360            'v8_maybe_icu',
361            # [GYP] added explicitly, instead of inheriting from the other deps
362            'v8_base_without_compiler',
363            'v8_compiler_for_mksnapshot',
364            'v8_initializers',
365            'v8_libplatform',
366          ]
367        }, {
368          'dependencies': [
369            'generate_bytecode_builtins_list',
370            'run_torque',
371            'mksnapshot',
372            'v8_maybe_icu',
373            # [GYP] added explicitly, instead of inheriting from the other deps
374            'v8_base_without_compiler',
375            'v8_compiler_for_mksnapshot',
376            'v8_initializers',
377            'v8_libplatform',
378          ]
379        }],
380      ],
381      'include_dirs': [
382        '<(SHARED_INTERMEDIATE_DIR)',
383        '<(generate_bytecode_output_root)',
384      ],
385      'sources': [
386        '<(V8_ROOT)/src/init/setup-isolate-deserialize.cc',
387      ],
388      'xcode_settings': {
389        # V8 7.4 over macOS10.11 compatibility
390        # Refs: https://github.com/nodejs/node/pull/26685
391        'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
392      },
393      'actions': [
394        {
395          'action_name': 'run_mksnapshot',
396          'message': 'generating: >@(_outputs)',
397          'variables': {
398            'mksnapshot_flags': [
399              '--turbo_instruction_scheduling',
400              # In cross builds, the snapshot may be generated for both the host and
401              # target toolchains.  The same host binary is used to generate both, so
402              # mksnapshot needs to know which target OS to use at runtime.  It's weird,
403              # but the target OS is really <(OS).
404              '--target_os=<(OS)',
405              '--target_arch=<(v8_target_arch)',
406              '--startup_src', '<(INTERMEDIATE_DIR)/snapshot.cc',
407              '--embedded_variant', 'Default',
408              '--embedded_src', '<(INTERMEDIATE_DIR)/embedded.S',
409            ],
410          },
411          'inputs': [
412            '<(mksnapshot_exec)',
413          ],
414          'outputs': [
415            '<(INTERMEDIATE_DIR)/snapshot.cc',
416            '<(INTERMEDIATE_DIR)/embedded.S',
417          ],
418          'process_outputs_as_sources': 1,
419          'conditions': [
420            ['v8_random_seed', {
421              'variables': {
422                'mksnapshot_flags': ['--random-seed', '<(v8_random_seed)'],
423              },
424            }],
425            ['v8_os_page_size', {
426              'variables': {
427                'mksnapshot_flags': ['--v8_os_page_size', '<(v8_os_page_size)'],
428              },
429            }],
430            ['v8_embed_script != ""', {
431              'inputs': ['<(v8_embed_script)'],
432              'variables': {
433                'mksnapshot_flags': ['<(v8_embed_script)'],
434              },
435            }],
436            ['v8_enable_snapshot_code_comments', {
437              'variables': {
438                'mksnapshot_flags': ['--code-comments'],
439              },
440            }],
441            ['v8_enable_snapshot_native_code_counters', {
442              'variables': {
443                'mksnapshot_flags': ['--native-code-counters'],
444              },
445            }, {
446               # --native-code-counters is the default in debug mode so make sure we can
447               # unset it.
448               'variables': {
449                 'mksnapshot_flags': ['--no-native-code-counters'],
450               },
451             }],
452          ],
453          'action': [
454            '>@(_inputs)',
455            '>@(mksnapshot_flags)',
456          ],
457        },
458      ],
459    },  # v8_snapshot
460    {
461      'target_name': 'v8_version',
462      'type': 'none',
463      'toolsets': ['host', 'target'],
464      'direct_dependent_settings': {
465        'sources': [
466          '<(V8_ROOT)/include/v8-value-serializer-version.h',
467          '<(V8_ROOT)/include/v8-version-string.h',
468          '<(V8_ROOT)/include/v8-version.h',
469        ],
470      },
471    },  # v8_version
472    {
473      'target_name': 'v8_config_headers',
474      'type': 'none',
475      'toolsets': ['host', 'target'],
476      'direct_dependent_settings': {
477        'sources': [
478          '<(V8_ROOT)/include/v8-platform.h',
479          '<(V8_ROOT)/include/v8config.h',
480        ],
481      },
482    },  # v8_config_headers
483    {
484      'target_name': 'v8_headers',
485      'type': 'none',
486      'toolsets': ['host', 'target'],
487      'dependencies': [
488        'v8_config_headers',
489        'v8_heap_base_headers',
490        'v8_version',
491      ],
492      'direct_dependent_settings': {
493        'sources': [
494          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_headers\\".*?sources = ")',
495
496          '<(V8_ROOT)/include/v8-wasm-trap-handler-posix.h',
497          '<(V8_ROOT)/include/v8-wasm-trap-handler-win.h',
498        ],
499      },
500    },  # v8_headers
501    {
502      'target_name': 'v8_shared_internal_headers',
503      'type': 'none',
504      'toolsets': ['host', 'target'],
505      'dependencies': [
506        'v8_headers',
507        'v8_libbase',
508      ],
509      'direct_dependent_settings': {
510        'sources': [
511          '<(V8_ROOT)/src/common/globals.h',
512          '<(V8_ROOT)/src/wasm/wasm-constants.h',
513          '<(V8_ROOT)/src/wasm/wasm-limits.h',
514        ],
515      },
516    },  # v8_shared_internal_headers
517    {
518      'target_name': 'v8_flags',
519      'type': 'none',
520      'toolsets': ['host', 'target'],
521      'dependencies': [
522        'v8_shared_internal_headers',
523      ],
524      'direct_dependent_settings': {
525        'sources': [
526          '<(V8_ROOT)/src/flags/flag-definitions.h',
527          '<(V8_ROOT)/src/flags/flags.h',
528        ],
529      },
530    },  # v8_flags
531    {
532      'target_name': 'v8_internal_headers',
533      'type': 'none',
534      'toolsets': ['host', 'target'],
535      'dependencies': [
536        'torque_runtime_support',
537        'v8_flags',
538        'v8_headers',
539        'v8_maybe_icu',
540        'v8_shared_internal_headers',
541        'v8_heap_base_headers',
542        'generate_bytecode_builtins_list',
543        'run_torque',
544        'v8_libbase',
545      ],
546      'direct_dependent_settings': {
547        'sources': [
548          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?sources = ")',
549        ],
550        'conditions': [
551          ['v8_enable_maglev==1', {
552            'sources': [
553              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_maglev.*?sources \\+= ")',
554            ],
555          }],
556          ['v8_enable_webassembly==1', {
557            'sources': [
558              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_webassembly.*?sources \\+= ")',
559            ],
560          }],
561          ['v8_enable_i18n_support==1', {
562            'sources': [
563              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_i18n_support.*?sources \\+= ")',
564            ],
565          }],
566          ['v8_control_flow_integrity==0', {
567            'sources': [
568              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?!v8_control_flow_integrity.*?sources \\+= ")',
569            ],
570          }],
571          ['v8_enable_heap_snapshot_verify==1', {
572            'sources': [
573              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_heap_snapshot_verify.*?sources \\+= ")',
574            ],
575          }],
576          ['v8_target_arch=="ia32"', {
577            'sources': [
578              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"x86\\".*?sources \\+= ")',
579            ],
580          }],
581          ['v8_target_arch=="x64"', {
582            'sources': [
583              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"x64\\".*?sources \\+= ")',
584            ],
585            'conditions': [
586              ['OS=="win"', {
587                'sources': [
588                  '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"x64\\".*?is_win.*?sources \\+= ")',
589                ],
590              }],
591              ['v8_enable_webassembly==1', {
592                'conditions': [
593                  ['OS=="linux" or OS=="mac" or OS=="ios" or OS=="freebsd"', {
594                    'sources': [
595                      '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"x64\\".*?v8_enable_webassembly.*?is_linux.*?sources \\+= ")',
596                    ],
597                  }],
598                  ['OS=="win"', {
599                    'sources': [
600                      '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"x64\\".*?v8_enable_webassembly.*?is_win.*?sources \\+= ")',
601                    ],
602                  }],
603                ],
604              }],
605            ],
606          }],
607          ['v8_target_arch=="arm"', {
608            'sources': [
609              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"arm\\".*?sources \\+= ")',
610            ],
611          }],
612          ['v8_target_arch=="arm64"', {
613            'sources': [
614              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"arm64\\".*?sources \\+= ")',
615            ],
616            'conditions': [
617              ['v8_control_flow_integrity==1', {
618                'sources': [
619                  '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"arm64\\".*?v8_control_flow_integrity.*?sources \\+= ")',
620                ],
621              }],
622              ['v8_enable_webassembly==1', {
623                'conditions': [
624                  ['OS=="mac" or (_toolset=="host" and host_arch=="x64" and OS=="linux")', {
625                    'sources': [
626                      '<(V8_ROOT)/src/trap-handler/handler-inside-posix.h',
627                    ],
628                  }],
629                  # TODO(targos): Replace False with OS=="win" if handler-outside-simulator.cc becomes compatible with MSVC.
630                  ['_toolset=="host" and host_arch=="x64" and (OS=="linux" or OS=="mac" or False)', {
631                    'sources': [
632                      '<(V8_ROOT)/src/trap-handler/trap-handler-simulator.h',
633                    ],
634                  }],
635                ],
636              }],
637              ['OS=="win"', {
638                'sources': [
639                  '<(V8_ROOT)/src/diagnostics/unwinding-info-win64.h',
640                ],
641              }],
642            ],
643          }],
644          ['v8_target_arch=="mips" or v8_target_arch=="mipsel"', {
645            'sources': [
646              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"mips\\".*?sources \\+= ")',
647            ],
648          }],
649          ['v8_target_arch=="mips64" or v8_target_arch=="mips64el"', {
650            'sources': [
651              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"mips64\\".*?sources \\+= ")',
652            ],
653          }],
654          ['v8_target_arch=="ppc"', {
655            'sources': [
656              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"ppc\\".*?sources \\+= ")',
657            ],
658          }],
659          ['v8_target_arch=="ppc64"', {
660            'sources': [
661              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"ppc64\\".*?sources \\+= ")',
662            ],
663          }],
664          ['v8_target_arch=="s390x"', {
665            'sources': [
666              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"s390\\".*?sources \\+= ")',
667            ],
668          }],
669          ['v8_target_arch=="riscv64"', {
670            'sources': [
671              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"riscv64\\".*?sources \\+= ")',
672            ],
673          }],
674          ['v8_target_arch=="loong64"', {
675            'sources': [
676              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"loong64\\".*?sources \\+= ")',
677            ],
678          }],
679        ],
680      },
681    },  # v8_internal_headers
682    {
683      'target_name': 'v8_compiler_opt',
684      'type': 'static_library',
685      'toolsets': ['host', 'target'],
686      'dependencies': [
687        'generate_bytecode_builtins_list',
688        'run_torque',
689        'v8_maybe_icu',
690        'v8_base_without_compiler',
691        'v8_internal_headers',
692        'v8_libbase',
693        'v8_shared_internal_headers',
694      ],
695      'sources': ['<@(v8_compiler_sources)'],
696      'conditions': [
697        ['OS=="win"', {
698          'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
699          'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
700          'sources': [
701            '<(_msvs_precompiled_header)',
702            '<(_msvs_precompiled_source)',
703          ],
704        }],
705      ],
706    },  # v8_compiler_opt
707    {
708      'target_name': 'v8_compiler',
709      'type': 'static_library',
710      'toolsets': ['host', 'target'],
711      'dependencies': [
712        'generate_bytecode_builtins_list',
713        'run_torque',
714        'v8_internal_headers',
715        'v8_maybe_icu',
716        'v8_base_without_compiler',
717        'v8_libbase',
718        'v8_shared_internal_headers',
719      ],
720      'sources': ['<@(v8_compiler_sources)'],
721      'conditions': [
722        ['OS=="win"', {
723          'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
724          'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
725          'sources': [
726            '<(_msvs_precompiled_header)',
727            '<(_msvs_precompiled_source)',
728          ],
729        }],
730      ],
731    },  # v8_compiler
732    {
733      'target_name': 'v8_compiler_for_mksnapshot',
734      'type': 'none',
735      'toolsets': ['host', 'target'],
736      'hard_dependency': 1,
737      'dependencies': [
738        'generate_bytecode_builtins_list',
739        'run_torque',
740        'v8_maybe_icu',
741      ],
742      'conditions': [
743        ['is_component_build and not v8_optimized_debug and v8_enable_fast_mksnapshot', {
744          'dependencies': [
745            'v8_compiler_opt',
746          ],
747          'export_dependent_settings': [
748            'v8_compiler_opt',
749          ],
750        }, {
751           'dependencies': [
752             'v8_compiler',
753           ],
754           'export_dependent_settings': [
755             'v8_compiler',
756           ],
757         }],
758      ],
759    },  # v8_compiler_for_mksnapshot
760    {
761      'target_name': 'v8_base_without_compiler',
762      'type': 'static_library',
763      'toolsets': ['host', 'target'],
764      'dependencies': [
765        'torque_generated_definitions',
766        'v8_bigint',
767        'v8_headers',
768        'v8_heap_base',
769        'v8_libbase',
770        'v8_shared_internal_headers',
771        'v8_version',
772        'cppgc_base',
773        'generate_bytecode_builtins_list',
774        'run_torque',
775        'v8_internal_headers',
776        'v8_maybe_icu',
777        'v8_zlib',
778      ],
779      'includes': ['inspector.gypi'],
780      'direct_dependent_settings': {
781        'include_dirs': [
782          '<(generate_bytecode_output_root)',
783          '<(SHARED_INTERMEDIATE_DIR)',
784        ],
785      },
786      'sources': [
787        '<(generate_bytecode_builtins_list_output)',
788
789        '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?sources = ")',
790
791        '<@(inspector_all_sources)',
792      ],
793      'conditions': [
794        ['v8_enable_third_party_heap==1', {
795          # TODO(targos): add values from v8_third_party_heap_files to sources
796        }, {
797          'sources': [
798            '<(V8_ROOT)/src/heap/third-party/heap-api-stub.cc',
799          ],
800        }],
801        ['v8_enable_maglev==1', {
802          'sources': [
803            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_enable_maglev.*?sources \\+= ")',
804          ],
805        }],
806        ['v8_enable_webassembly==1', {
807          'sources': [
808            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_enable_webassembly.*?sources \\+= ")',
809          ],
810        }],
811        ['v8_enable_heap_snapshot_verify==1', {
812          'sources': [
813            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_enable_heap_snapshot_verify.*?sources \\+= ")',
814          ],
815        }],
816        ['v8_target_arch=="ia32"', {
817          'sources': [
818            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"x86.*?sources \\+= ")',
819          ],
820        }],
821        ['v8_target_arch=="x64"', {
822          'sources': [
823            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"x64\\".*?sources \\+= ")',
824          ],
825          'conditions': [
826            ['OS=="win"', {
827              'sources': [
828                '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"x64\\".*?is_win.*?sources \\+= ")',
829              ],
830            }],
831            ['v8_enable_webassembly==1', {
832              'conditions': [
833                ['OS=="linux" or OS=="mac" or OS=="ios" or OS=="freebsd"', {
834                  'sources': [
835                    '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"x64\\".*?v8_enable_webassembly.*?is_linux.*?sources \\+= ")',
836                  ],
837                }],
838                ['OS=="win"', {
839                  'sources': [
840                    '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"x64\\".*?v8_enable_webassembly.*?is_win.*?sources \\+= ")',
841                  ],
842                }],
843              ],
844            }],
845          ],
846        }],
847        ['v8_target_arch=="arm"', {
848          'sources': [
849            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"arm\\".*?sources \\+= ")',
850          ],
851        }],
852        ['v8_target_arch=="arm64"', {
853          'sources': [
854            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"arm64\\".*?sources \\+= ")',
855          ],
856          'conditions': [
857            ['v8_enable_webassembly==1', {
858              'conditions': [
859                ['OS=="mac" or OS=="ios" or '
860                 '(_toolset=="host" and host_arch=="x64" and (host_os=="linux" or host_os=="mac"))', {
861                  'sources': [
862                    '<(V8_ROOT)/src/trap-handler/handler-inside-posix.cc',
863                    '<(V8_ROOT)/src/trap-handler/handler-outside-posix.cc',
864                  ],
865                }],
866                # TODO(targos): Replace False with OS=="win" if handler-outside-simulator.cc becomes compatible with MSVC.
867                ['_toolset=="host" and host_arch=="x64" and False', {
868                  'sources': [
869                    '<(V8_ROOT)/src/trap-handler/handler-inside-win.cc',
870                    '<(V8_ROOT)/src/trap-handler/handler-outside-win.cc',
871                  ],
872                }],
873                # TODO(targos): Replace False with OS=="win" if handler-outside-simulator.cc becomes compatible with MSVC.
874                ['_toolset=="host" and host_arch=="x64" and '
875                 '(host_os=="linux" or host_os=="mac" or False)', {
876                  'sources': [
877                    '<(V8_ROOT)/src/trap-handler/handler-outside-simulator.cc',
878                  ],
879                }],
880              ],
881            }],
882            ['OS=="win"', {
883              'sources': [
884                '<(V8_ROOT)/src/diagnostics/unwinding-info-win64.cc',
885              ],
886            }],
887          ],
888        }],
889        ['v8_target_arch=="mips" or v8_target_arch=="mipsel"', {
890          'sources': [
891            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"mips\\".*?sources \\+= ")',
892          ],
893        }],
894        ['v8_target_arch=="mips64" or v8_target_arch=="mips64el"', {
895          'sources': [
896            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"mips64\\".*?sources \\+= ")',
897          ],
898        }],
899        ['v8_target_arch=="ppc"', {
900          'sources': [
901            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"ppc\\".*?sources \\+= ")',
902          ],
903        }],
904        ['v8_target_arch=="ppc64"', {
905          'sources': [
906            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"ppc64\\".*?sources \\+= ")',
907          ],
908        }],
909        ['v8_target_arch=="s390x"', {
910          'sources': [
911            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"s390\\".*?sources \\+= ")',
912          ],
913        }],
914        ['v8_target_arch=="riscv64"', {
915          'sources': [
916            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"riscv64\\".*?sources \\+= ")',
917          ],
918        }],        
919        ['v8_target_arch=="loong64"', {
920          'sources': [
921            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"loong64\\".*?sources \\+= ")',
922          ],
923        }],        
924        ['OS=="win"', {
925          'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
926          'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
927          'sources': [
928            '<(_msvs_precompiled_header)',
929            '<(_msvs_precompiled_source)',
930          ],
931          # This will prevent V8's .cc files conflicting with the inspector's
932          # .cpp files in the same shard.
933          'msvs_settings': {
934            'VCCLCompilerTool': {
935              'ObjectFile': '$(IntDir)%(Extension)\\',
936            },
937          },
938          'conditions': [
939            ['v8_enable_system_instrumentation==1', {
940              'sources': [
941                '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?is_win.*?v8_enable_system_instrumentation.*?sources \\+= ")',
942              ],
943            }],
944          ],
945        }],
946        ['component=="shared_library"', {
947          'defines': [
948            'BUILDING_V8_SHARED',
949          ],
950        }],
951        ['v8_enable_i18n_support==1', {
952          'dependencies': [
953            'run_gen-regexp-special-case',
954          ],
955          'sources': [
956            '<(SHARED_INTERMEDIATE_DIR)/src/regexp/special-case.cc',
957          ],
958          'conditions': [
959            ['icu_use_data_file_flag', {
960              'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE'],
961            }, {
962               'conditions': [
963                 ['OS=="win"', {
964                   'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_SHARED'],
965                 }, {
966                    'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC'],
967                  }],
968               ],
969             }],
970            ['OS=="win"', {
971              'dependencies': [
972                '<(icu_gyp_path):icudata#target',
973              ],
974            }],
975          ],
976        }, {  # v8_enable_i18n_support==0
977           'sources!': [
978             '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_enable_i18n_support.*?sources -= ")',
979           ],
980         }],
981        ['v8_postmortem_support', {
982          'dependencies': ['postmortem-metadata#target'],
983        }],
984        ['v8_enable_third_party_heap', {
985          # TODO(targos): add values from v8_third_party_heap_libs to link_settings.libraries
986        }],
987        # Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library
988        # to implement atomic memory access
989        #['v8_current_cpu in ["mips", "mipsel", "mips64", "mips64el", "ppc", "arm", "riscv64", "loong64"]', {
990        #  'link_settings': {
991        #    'libraries': ['-latomic', ],
992        #  },
993        #}],
994      ],
995    },  # v8_base_without_compiler
996    {
997      'target_name': 'v8_base',
998      'type': 'none',
999      'toolsets': ['host', 'target'],
1000      'dependencies': [
1001        'v8_base_without_compiler',
1002        'v8_compiler',
1003      ],
1004    },  # v8_base
1005    {
1006      'target_name': 'torque_base',
1007      'type': 'static_library',
1008      'toolsets': ['host', 'target'],
1009      'sources': [
1010        '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"torque_base.*?sources = ")',
1011      ],
1012      'dependencies': [
1013        'v8_shared_internal_headers',
1014        'v8_libbase',
1015      ],
1016      'defines!': [
1017        '_HAS_EXCEPTIONS=0',
1018        'BUILDING_V8_SHARED=1',
1019      ],
1020      'cflags_cc!': ['-fno-exceptions'],
1021      'cflags_cc': ['-fexceptions'],
1022      'xcode_settings': {
1023        'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',  # -fexceptions
1024      },
1025      'msvs_settings': {
1026        'VCCLCompilerTool': {
1027          'RuntimeTypeInfo': 'true',
1028          'ExceptionHandling': 1,
1029        },
1030      },
1031    },  # torque_base
1032    {
1033      'target_name': 'torque_ls_base',
1034      'type': 'static_library',
1035      'toolsets': ['host', 'target'],
1036      'sources': [
1037        '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"torque_ls_base.*?sources = ")',
1038      ],
1039      'dependencies': [
1040        'torque_base',
1041      ],
1042      'defines!': [
1043        '_HAS_EXCEPTIONS=0',
1044        'BUILDING_V8_SHARED=1',
1045      ],
1046      'cflags_cc!': ['-fno-exceptions'],
1047      'cflags_cc': ['-fexceptions'],
1048      'xcode_settings': {
1049        'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',  # -fexceptions
1050      },
1051      'msvs_settings': {
1052        'VCCLCompilerTool': {
1053          'RuntimeTypeInfo': 'true',
1054          'ExceptionHandling': 1,
1055        },
1056      },
1057    },  # torque_ls_base
1058    {
1059      'target_name': 'v8_libbase',
1060      'type': 'static_library',
1061      'toolsets': ['host', 'target'],
1062      'sources': [
1063        '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_libbase.*?sources = ")',
1064      ],
1065
1066      'dependencies': [
1067        'v8_headers',
1068      ],
1069
1070      'conditions': [
1071        ['is_component_build', {
1072          'defines': ["BUILDING_V8_BASE_SHARED"],
1073        }],
1074        ['is_posix or is_fuchsia', {
1075          'sources': [
1076            '<(V8_ROOT)/src/base/platform/platform-posix.cc',
1077            '<(V8_ROOT)/src/base/platform/platform-posix.h',
1078          ],
1079          'conditions': [
1080            ['OS != "aix" and OS != "os400" and OS != "solaris"', {
1081              'sources': [
1082                '<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
1083                '<(V8_ROOT)/src/base/platform/platform-posix-time.h',
1084              ],
1085            }],
1086          ],
1087        }],
1088        ['OS=="linux"', {
1089          'sources': [
1090            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1091            '<(V8_ROOT)/src/base/platform/platform-linux.cc',
1092          ],
1093          'link_settings': {
1094            'libraries': [
1095              '-ldl',
1096              '-lrt'
1097            ],
1098          },
1099        }],
1100        ['OS in "aix os400"', {
1101          'variables': {
1102            # Used to differentiate `AIX` and `OS400`(IBM i).
1103            'aix_variant_name': '<!(uname -s)',
1104          },
1105          'sources': [
1106            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1107            '<(V8_ROOT)/src/base/platform/platform-aix.cc',
1108          ],
1109          'conditions': [
1110            [ '"<(aix_variant_name)"=="AIX"', { # It is `AIX`
1111              'link_settings': {
1112                'libraries': [
1113                  '-ldl',
1114                  '-lrt'
1115                ],
1116              },
1117            }],
1118          ],
1119        }],
1120        ['is_android', {
1121          'sources': [
1122            '<(V8_ROOT)/src/base/platform/platform-posix.cc',
1123            '<(V8_ROOT)/src/base/platform/platform-posix.h',
1124            '<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
1125            '<(V8_ROOT)/src/base/platform/platform-posix-time.h',
1126          ],
1127          'link_settings': {
1128            'target_conditions': [
1129              ['_toolset=="host" and host_os=="linux"', {
1130                'libraries': [
1131                  '-ldl',
1132                  '-lrt'
1133                ],
1134              }],
1135            ],
1136          },
1137          'target_conditions': [
1138            ['_toolset=="host"', {
1139              'sources': [
1140                '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1141                '<(V8_ROOT)/src/base/platform/platform-linux.cc',
1142              ],
1143            }, {
1144              'sources': [
1145                '<(V8_ROOT)/src/base/debug/stack_trace_android.cc',
1146                '<(V8_ROOT)/src/base/platform/platform-linux.cc',
1147              ],
1148            }],
1149          ],
1150        }],
1151        ['is_fuchsia', {
1152          'sources': [
1153            '<(V8_ROOT)/src/base/debug/stack_trace_fuchsia.cc',
1154            '<(V8_ROOT)/src/base/platform/platform-fuchsia.cc',
1155          ]
1156        }],
1157        ['OS == "mac" or (_toolset=="host" and host_os=="mac")', {
1158          'sources': [
1159            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1160            '<(V8_ROOT)/src/base/platform/platform-darwin.cc',
1161            '<(V8_ROOT)/src/base/platform/platform-macos.cc',
1162          ]
1163        }],
1164        ['OS == "ios"', {
1165          'sources': [
1166            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1167            '<(V8_ROOT)/src/base/platform/platform-darwin.cc',
1168          ]
1169        }],
1170        ['is_win', {
1171          'sources': [
1172            '<(V8_ROOT)/src/base/debug/stack_trace_win.cc',
1173            '<(V8_ROOT)/src/base/platform/platform-win32.cc',
1174            '<(V8_ROOT)/src/base/win32-headers.h',
1175          ],
1176          'defines': ['_CRT_RAND_S'], # for rand_s()
1177          'direct_dependent_settings': {
1178            'msvs_settings': {
1179              'VCLinkerTool': {
1180                'AdditionalDependencies': [
1181                  'dbghelp.lib',
1182                  'winmm.lib',
1183                  'ws2_32.lib'
1184                ]
1185              }
1186            },
1187            'conditions': [
1188              ['v8_enable_system_instrumentation==1', {
1189                'msvs_settings': {
1190                  'VCLinkerTool': {
1191                    'AdditionalDependencies': [
1192                      'advapi32.lib',
1193                    ],
1194                  },
1195                },
1196              }],
1197            ],
1198          },
1199        }],
1200        ['target_arch == "mips" or OS == "mips64"', {
1201          # here just for 'BUILD.gn' sync
1202          # 'data': [
1203          #   '<(V8_ROOT)/tools/mips_toolchain/sysroot/usr/lib/',
1204          #   '<(V8_ROOT)/tools/mips_toolchain/sysroot/usr/lib/',
1205          # ],
1206        }],
1207        # end of conditions from 'BUILD.gn'
1208
1209        # Node.js validated
1210        ['OS=="solaris"', {
1211          'link_settings': {
1212            'libraries': [
1213              '-lnsl',
1214              '-lrt',
1215            ]
1216          },
1217          'sources': [
1218            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1219            '<(V8_ROOT)/src/base/platform/platform-solaris.cc',
1220          ],
1221        }],
1222
1223        # YMMV with the following conditions
1224        ['OS=="qnx"', {
1225          'link_settings': {
1226            'target_conditions': [
1227              ['_toolset=="host" and host_os=="linux"', {
1228                'libraries': [
1229                  '-lrt'
1230                ],
1231              }],
1232              ['_toolset=="target"', {
1233                'libraries': [
1234                  '-lbacktrace'
1235                ],
1236              }],
1237            ],
1238          },
1239          'sources': [
1240            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1241            '<(V8_ROOT)/src/base/platform/platform-posix.h',
1242            '<(V8_ROOT)/src/base/platform/platform-posix.cc',
1243            '<(V8_ROOT)/src/base/platform/platform-posix-time.h',
1244            '<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
1245            '<(V8_ROOT)/src/base/qnx-math.h'
1246          ],
1247          'target_conditions': [
1248            ['_toolset=="host" and host_os=="linux"', {
1249              'sources': [
1250                '<(V8_ROOT)/src/base/platform/platform-linux.cc'
1251              ],
1252            }],
1253            ['_toolset=="host" and host_os=="mac"', {
1254              'sources': [
1255                '<(V8_ROOT)/src/base/platform/platform-macos.cc'
1256              ],
1257            }],
1258            ['_toolset=="target"', {
1259              'sources': [
1260                '<(V8_ROOT)/src/base/platform/platform-qnx.cc'
1261              ],
1262            }],
1263          ],
1264        },
1265         ],
1266        ['OS=="freebsd"', {
1267          'link_settings': {
1268            'libraries': [
1269              '-L/usr/local/lib -lexecinfo',
1270            ]
1271          },
1272          'sources': [
1273            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1274            '<(V8_ROOT)/src/base/platform/platform-freebsd.cc',
1275            '<(V8_ROOT)/src/base/platform/platform-posix.h',
1276            '<(V8_ROOT)/src/base/platform/platform-posix.cc',
1277            '<(V8_ROOT)/src/base/platform/platform-posix-time.h',
1278            '<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
1279          ],
1280        }
1281         ],
1282        ['OS=="openbsd"', {
1283          'link_settings': {
1284            'libraries': [
1285              '-L/usr/local/lib -lexecinfo',
1286            ]
1287          },
1288          'sources': [
1289            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1290            '<(V8_ROOT)/src/base/platform/platform-openbsd.cc',
1291            '<(V8_ROOT)/src/base/platform/platform-posix.h',
1292            '<(V8_ROOT)/src/base/platform/platform-posix.cc',
1293            '<(V8_ROOT)/src/base/platform/platform-posix-time.h',
1294            '<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
1295          ],
1296        }
1297         ],
1298        ['OS=="netbsd"', {
1299          'link_settings': {
1300            'libraries': [
1301              '-L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lexecinfo',
1302            ]
1303          },
1304          'sources': [
1305            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1306            '<(V8_ROOT)/src/base/platform/platform-openbsd.cc',
1307            '<(V8_ROOT)/src/base/platform/platform-posix.h',
1308            '<(V8_ROOT)/src/base/platform/platform-posix.cc',
1309            '<(V8_ROOT)/src/base/platform/platform-posix-time.h',
1310            '<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
1311          ],
1312        }
1313         ],
1314      ],
1315    },  # v8_libbase
1316    {
1317      'target_name': 'v8_libplatform',
1318      'type': 'static_library',
1319      'toolsets': ['host', 'target'],
1320      'dependencies': [
1321        'v8_libbase',
1322      ],
1323      'sources': [
1324        '<(V8_ROOT)/base/trace_event/common/trace_event_common.h',
1325        '<(V8_ROOT)/include/libplatform/libplatform-export.h',
1326        '<(V8_ROOT)/include/libplatform/libplatform.h',
1327        '<(V8_ROOT)/include/libplatform/v8-tracing.h',
1328        '<(V8_ROOT)/src/libplatform/default-foreground-task-runner.cc',
1329        '<(V8_ROOT)/src/libplatform/default-foreground-task-runner.h',
1330        '<(V8_ROOT)/src/libplatform/default-job.cc',
1331        '<(V8_ROOT)/src/libplatform/default-job.h',
1332        '<(V8_ROOT)/src/libplatform/default-platform.cc',
1333        '<(V8_ROOT)/src/libplatform/default-platform.h',
1334        '<(V8_ROOT)/src/libplatform/default-worker-threads-task-runner.cc',
1335        '<(V8_ROOT)/src/libplatform/default-worker-threads-task-runner.h',
1336        '<(V8_ROOT)/src/libplatform/delayed-task-queue.cc',
1337        '<(V8_ROOT)/src/libplatform/delayed-task-queue.h',
1338        '<(V8_ROOT)/src/libplatform/task-queue.cc',
1339        '<(V8_ROOT)/src/libplatform/task-queue.h',
1340        '<(V8_ROOT)/src/libplatform/tracing/trace-buffer.cc',
1341        '<(V8_ROOT)/src/libplatform/tracing/trace-buffer.h',
1342        '<(V8_ROOT)/src/libplatform/tracing/trace-config.cc',
1343        '<(V8_ROOT)/src/libplatform/tracing/trace-object.cc',
1344        '<(V8_ROOT)/src/libplatform/tracing/trace-writer.cc',
1345        '<(V8_ROOT)/src/libplatform/tracing/trace-writer.h',
1346        '<(V8_ROOT)/src/libplatform/tracing/tracing-controller.cc',
1347        '<(V8_ROOT)/src/libplatform/worker-thread.cc',
1348        '<(V8_ROOT)/src/libplatform/worker-thread.h',
1349      ],
1350      'conditions': [
1351        ['component=="shared_library"', {
1352          'direct_dependent_settings': {
1353            'defines': ['USING_V8_PLATFORM_SHARED'],
1354          },
1355          'defines': ['BUILDING_V8_PLATFORM_SHARED'],
1356        }],
1357        ['v8_use_perfetto==1', {
1358          'sources!': [
1359            '<(V8_ROOT)/base/trace_event/common/trace_event_common.h',
1360            '<(V8_ROOT)/src/libplatform/tracing/trace-buffer.cc',
1361            '<(V8_ROOT)/src/libplatform/tracing/trace-buffer.h',
1362            '<(V8_ROOT)/src/libplatform/tracing/trace-object.cc',
1363            '<(V8_ROOT)/src/libplatform/tracing/trace-writer.cc',
1364            '<(V8_ROOT)/src/libplatform/tracing/trace-writer.h',
1365          ],
1366          'sources': [
1367            '<(V8_ROOT)/src/libplatform/tracing/trace-event-listener.cc',
1368            '<(V8_ROOT)/src/libplatform/tracing/trace-event-listener.h',
1369          ],
1370          'dependencies': [
1371            '<(V8_ROOT)/third_party/perfetto:libperfetto',
1372            '<(V8_ROOT)/third_party/perfetto/protos/perfetto/trace:lite',
1373          ],
1374        }],
1375        ['v8_enable_system_instrumentation==1 and is_win', {
1376          'sources': [
1377            '<(V8_ROOT)/src/libplatform/tracing/recorder.h',
1378            '<(V8_ROOT)/src/libplatform/tracing/recorder-win.cc',
1379          ],
1380        }],
1381        ['v8_enable_system_instrumentation==1 and OS=="mac"', {
1382          'sources': [
1383            '<(V8_ROOT)/src/libplatform/tracing/recorder.h',
1384            '<(V8_ROOT)/src/libplatform/tracing/recorder-mac.cc',
1385          ],
1386        }],
1387      ],
1388      'direct_dependent_settings': {
1389        'include_dirs': [
1390          '<(V8_ROOT)/include',
1391        ],
1392      },
1393    },  # v8_libplatform
1394    {
1395      'target_name': 'v8_libsampler',
1396      'type': 'static_library',
1397      'toolsets': ['host', 'target'],
1398      'dependencies': [
1399        'v8_libbase',
1400      ],
1401      'sources': [
1402        '<(V8_ROOT)/src/libsampler/sampler.cc',
1403        '<(V8_ROOT)/src/libsampler/sampler.h'
1404      ],
1405    },  # v8_libsampler
1406    {
1407      'target_name': 'bytecode_builtins_list_generator',
1408      'type': 'executable',
1409      'conditions': [
1410        ['want_separate_host_toolset', {
1411          'toolsets': ['host'],
1412        }],
1413        # Avoid excessive LTO
1414        ['enable_lto=="true"', {
1415          'ldflags': [ '-fno-lto' ],
1416        }],
1417      ],
1418      'defines!': [
1419        'BUILDING_V8_SHARED=1',
1420      ],
1421      'dependencies': [
1422        "v8_libbase",
1423        # "build/win:default_exe_manifest",
1424      ],
1425      'sources': [
1426        "<(V8_ROOT)/src/builtins/generate-bytecodes-builtins-list.cc",
1427        "<(V8_ROOT)/src/interpreter/bytecode-operands.cc",
1428        "<(V8_ROOT)/src/interpreter/bytecode-operands.h",
1429        "<(V8_ROOT)/src/interpreter/bytecode-traits.h",
1430        "<(V8_ROOT)/src/interpreter/bytecodes.cc",
1431        "<(V8_ROOT)/src/interpreter/bytecodes.h",
1432      ],
1433    },  # bytecode_builtins_list_generator
1434    {
1435      'target_name': 'mksnapshot',
1436      'type': 'executable',
1437      'dependencies': [
1438        'v8_base_without_compiler',
1439        'v8_compiler_for_mksnapshot',
1440        'v8_init',
1441        'v8_libbase',
1442        'v8_libplatform',
1443        'v8_maybe_icu',
1444        # "build/win:default_exe_manifest",
1445      ],
1446      'sources': [
1447        '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"mksnapshot.*?sources = ")',
1448      ],
1449      'conditions': [
1450        ['want_separate_host_toolset', {
1451          'toolsets': ['host'],
1452        }],
1453        ['OS=="win"', {
1454          'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
1455          'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
1456          'sources': [
1457            '<(_msvs_precompiled_header)',
1458            '<(_msvs_precompiled_source)',
1459          ],
1460        }],
1461        # Avoid excessive LTO
1462        ['enable_lto=="true"', {
1463          'ldflags': [ '-fno-lto' ],
1464        }],
1465        ['v8_control_flow_integrity==1', {
1466          'sources': [
1467            '<(V8_ROOT)/src/deoptimizer/deoptimizer-cfi-empty.cc',
1468          ],
1469        }],
1470      ],
1471    },  # mksnapshot
1472    {
1473      'target_name': 'torque',
1474      'type': 'executable',
1475      'dependencies': [
1476        'torque_base',
1477        # "build/win:default_exe_manifest",
1478      ],
1479      'conditions': [
1480        ['want_separate_host_toolset', {
1481          'toolsets': ['host'],
1482        }],
1483        # Avoid excessive LTO
1484        ['enable_lto=="true"', {
1485          'ldflags': [ '-fno-lto' ],
1486        }],
1487      ],
1488      'defines!': [
1489        '_HAS_EXCEPTIONS=0',
1490        'BUILDING_V8_SHARED=1',
1491      ],
1492      'cflags_cc!': ['-fno-exceptions'],
1493      'cflags_cc': ['-fexceptions'],
1494      'xcode_settings': {
1495        'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',  # -fexceptions
1496      },
1497      'msvs_settings': {
1498        'VCCLCompilerTool': {
1499          'RuntimeTypeInfo': 'true',
1500          'ExceptionHandling': 1,
1501        },
1502        'VCLinkerTool': {
1503          'AdditionalDependencies': [
1504            'dbghelp.lib',
1505            'winmm.lib',
1506            'ws2_32.lib'
1507          ]
1508        }
1509      },
1510      'sources': [
1511        "<(V8_ROOT)/src/torque/torque.cc",
1512      ],
1513    },  # torque
1514    {
1515      'target_name': 'torque-language-server',
1516      'type': 'executable',
1517      'conditions': [
1518        ['want_separate_host_toolset', {
1519          'toolsets': ['host'],
1520        }],
1521        # Avoid excessive LTO
1522        ['enable_lto=="true"', {
1523          'ldflags': [ '-fno-lto' ],
1524        }],
1525      ],
1526      'dependencies': [
1527        'torque_base',
1528        'torque_ls_base',
1529        # "build/win:default_exe_manifest",
1530      ],
1531      'defines!': [
1532        '_HAS_EXCEPTIONS=0',
1533        'BUILDING_V8_SHARED=1',
1534      ],
1535      'msvs_settings': {
1536        'VCCLCompilerTool': {
1537          'RuntimeTypeInfo': 'true',
1538          'ExceptionHandling': 1,
1539        },
1540      },
1541      'sources': [
1542        "<(V8_ROOT)/src/torque/ls/torque-language-server.cc",
1543      ],
1544    },  # torque-language-server
1545    {
1546      'target_name': 'gen-regexp-special-case',
1547      'type': 'executable',
1548      'dependencies': [
1549        'v8_libbase',
1550        # "build/win:default_exe_manifest",
1551        'v8_maybe_icu',
1552      ],
1553      'conditions': [
1554        ['want_separate_host_toolset', {
1555          'toolsets': ['host'],
1556        }],
1557        # Avoid excessive LTO
1558        ['enable_lto=="true"', {
1559          'ldflags': [ '-fno-lto' ],
1560        }],
1561      ],
1562      'sources': [
1563        "<(V8_ROOT)/src/regexp/gen-regexp-special-case.cc",
1564        "<(V8_ROOT)/src/regexp/special-case.h",
1565      ],
1566    },  # gen-regexp-special-case
1567    {
1568      'target_name': 'run_gen-regexp-special-case',
1569      'type': 'none',
1570      'toolsets': ['host', 'target'],
1571      'conditions': [
1572        ['want_separate_host_toolset', {
1573          'dependencies': ['gen-regexp-special-case#host'],
1574        }, {
1575          'dependencies': ['gen-regexp-special-case#target'],
1576        }],
1577        # Avoid excessive LTO
1578        ['enable_lto=="true"', {
1579          'ldflags': [ '-fno-lto' ],
1580        }],
1581      ],
1582      'actions': [
1583        {
1584          'action_name': 'run_gen-regexp-special-case_action',
1585          'inputs': [
1586            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)',
1587          ],
1588          'outputs': [
1589            '<(SHARED_INTERMEDIATE_DIR)/src/regexp/special-case.cc',
1590          ],
1591          'action': [
1592            '<(python)',
1593            '<(V8_ROOT)/tools/run.py',
1594            '<@(_inputs)',
1595            '<@(_outputs)',
1596          ],
1597        },
1598      ],
1599    },  # run_gen-regexp-special-case
1600    {
1601      'target_name': 'v8_heap_base_headers',
1602      'type': 'none',
1603      'toolsets': ['host', 'target'],
1604      'direct_dependent_settings': {
1605        'sources': [
1606          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_source_set.\\"v8_heap_base_headers.*?sources = ")',
1607        ],
1608      },
1609    },  # v8_heap_base_headers
1610    {
1611      'target_name': 'cppgc_base',
1612      'type': 'none',
1613      'toolsets': ['host', 'target'],
1614      'direct_dependent_settings': {
1615        'sources': [
1616          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_source_set.\\"cppgc_base.*?sources = ")',
1617        ],
1618      },
1619    },  # cppgc_base
1620    {
1621      'target_name': 'v8_bigint',
1622      'type': 'none',
1623      'toolsets': ['host', 'target'],
1624      'direct_dependent_settings': {
1625        'sources': [
1626          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_source_set.\\"v8_bigint.*?sources = ")',
1627        ],
1628        'conditions': [
1629          ['v8_advanced_bigint_algorithms==1', {
1630            'sources': [
1631              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_source_set.\\"v8_bigint.*?v8_advanced_bigint_algorithms.*?sources \\+= ")',
1632            ],
1633          }],
1634        ],
1635      },
1636    },  # v8_bigint
1637    {
1638      'target_name': 'v8_heap_base',
1639      'type': 'none',
1640      'toolsets': ['host', 'target'],
1641      'direct_dependent_settings': {
1642        'sources': [
1643          '<(V8_ROOT)/src/heap/base/active-system-pages.cc',
1644          '<(V8_ROOT)/src/heap/base/stack.cc',
1645          '<(V8_ROOT)/src/heap/base/worklist.cc',
1646        ],
1647        'conditions': [
1648          ['enable_lto=="true"', {
1649            'cflags_cc': [ '-fno-lto' ],
1650          }],
1651          ['clang or OS!="win"', {
1652            'conditions': [
1653              ['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
1654                'sources': [
1655                  '<(V8_ROOT)/src/heap/base/asm/x64/push_registers_asm.cc',
1656                ],
1657              }],
1658              ['_toolset == "host" and host_arch == "ia32" or _toolset == "target" and target_arch=="ia32"', {
1659                'sources': [
1660                  '<(V8_ROOT)/src/heap/base/asm/ia32/push_registers_asm.cc',
1661                ],
1662              }],
1663              ['_toolset == "host" and host_arch == "arm" or _toolset == "target" and target_arch=="arm"', {
1664                'sources': [
1665                  '<(V8_ROOT)/src/heap/base/asm/arm/push_registers_asm.cc',
1666                ],
1667              }],
1668              ['_toolset == "host" and host_arch == "arm64" or _toolset == "target" and target_arch=="arm64"', {
1669                'sources': [
1670                  '<(V8_ROOT)/src/heap/base/asm/arm64/push_registers_asm.cc',
1671                ],
1672              }],
1673              ['_toolset == "host" and host_arch == "ppc64" or _toolset == "target" and target_arch=="ppc64"', {
1674                'sources': [
1675                  '<(V8_ROOT)/src/heap/base/asm/ppc/push_registers_asm.cc',
1676                ],
1677              }],
1678              ['_toolset == "host" and host_arch == "s390x" or _toolset == "target" and target_arch=="s390x"', {
1679                'sources': [
1680                  '<(V8_ROOT)/src/heap/base/asm/s390/push_registers_asm.cc',
1681                ],
1682              }],
1683              ['_toolset == "host" and host_arch == "mips" or _toolset == "target" and target_arch=="mips" or _toolset == "host" and host_arch == "mipsel" or _toolset == "target" and target_arch=="mipsel"', {
1684                'sources': [
1685                  '<(V8_ROOT)/src/heap/base/asm/mips/push_registers_asm.cc',
1686                ],
1687              }],
1688              ['_toolset == "host" and host_arch == "mips64" or _toolset == "target" and target_arch=="mips64" or _toolset == "host" and host_arch == "mips64el" or _toolset == "target" and target_arch=="mips64el"', {
1689                'sources': [
1690                  '<(V8_ROOT)/src/heap/base/asm/mips64/push_registers_asm.cc',
1691                ],
1692              }],
1693              ['_toolset == "host" and host_arch == "riscv64" or _toolset == "target" and target_arch=="riscv64"', {
1694                'sources': [
1695                  '<(V8_ROOT)/src/heap/base/asm/riscv64/push_registers_asm.cc',
1696                ],
1697              }],
1698              ['_toolset == "host" and host_arch == "loong64" or _toolset == "target" and target_arch=="loong64"', {
1699                'sources': [
1700                  '<(V8_ROOT)/src/heap/base/asm/loong64/push_registers_asm.cc',
1701                ],
1702              }],
1703            ]
1704          }],
1705          ['OS=="win"', {
1706            'conditions': [
1707              ['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
1708                'sources': [
1709                  '<(V8_ROOT)/src/heap/base/asm/x64/push_registers_masm.S',
1710                ],
1711              }],
1712              ['_toolset == "host" and host_arch == "ia32" or _toolset == "target" and target_arch=="ia32"', {
1713                'sources': [
1714                  '<(V8_ROOT)/src/heap/base/asm/ia32/push_registers_masm.S',
1715                ],
1716              }],
1717              ['_toolset == "host" and host_arch == "arm64" or _toolset == "target" and target_arch=="arm64"', {
1718                'sources': [
1719                  '<(V8_ROOT)/src/heap/base/asm/arm64/push_registers_masm.S',
1720                ],
1721              }],
1722            ],
1723          }],
1724        ],
1725      },
1726    },  # v8_heap_base
1727
1728    ###############################################################################
1729    # Public targets
1730    #
1731
1732    {
1733      'target_name': 'v8',
1734      'hard_dependency': 1,
1735      'toolsets': ['target'],
1736      'dependencies': [
1737        'v8_snapshot',
1738      ],
1739      'conditions': [
1740        ['component=="shared_library"', {
1741          'type': '<(component)',
1742          'sources': [
1743            # Note: on non-Windows we still build this file so that gyp
1744            # has some sources to link into the component.
1745            '<(V8_ROOT)/src/utils/v8dll-main.cc',
1746          ],
1747          'defines': [
1748            'BUILDING_V8_SHARED',
1749          ],
1750          'direct_dependent_settings': {
1751            'defines': [
1752              'USING_V8_SHARED',
1753            ],
1754          },
1755          'conditions': [
1756            ['OS=="mac"', {
1757              'xcode_settings': {
1758                'OTHER_LDFLAGS': ['-dynamiclib', '-all_load']
1759              },
1760            }],
1761            ['soname_version!=""', {
1762              'product_extension': 'so.<(soname_version)',
1763            }],
1764          ],
1765        },
1766         {
1767           'type': 'static_library',
1768         }],
1769      ],
1770      'direct_dependent_settings': {
1771        'include_dirs': [
1772          '<(V8_ROOT)/include',
1773        ],
1774      },
1775      'actions': [
1776        {
1777          'action_name': 'v8_dump_build_config',
1778          'inputs': [
1779            '<(V8_ROOT)/tools/testrunner/utils/dump_build_config_gyp.py',
1780          ],
1781          'outputs': [
1782            '<(PRODUCT_DIR)/v8_build_config.json',
1783          ],
1784          'variables': {
1785            'v8_dump_build_config_args': [
1786              '<(PRODUCT_DIR)/v8_build_config.json',
1787              'current_cpu=<(v8_current_cpu)',
1788              'dcheck_always_on=<(dcheck_always_on)',
1789              'is_android=<(is_android)',
1790              'is_asan=<(asan)',
1791              'is_cfi=<(cfi_vptr)',
1792              'is_clang=<(clang)',
1793              'is_component_build=<(component)',
1794              'is_debug=<(CONFIGURATION_NAME)',
1795              # Not available in gyp.
1796              'is_full_debug=0',
1797              # Not available in gyp.
1798              'is_gcov_coverage=0',
1799              'is_msan=<(msan)',
1800              'is_tsan=<(tsan)',
1801              # Not available in gyp.
1802              'is_ubsan_vptr=0',
1803              'target_cpu=<(target_arch)',
1804              'v8_current_cpu=<(v8_current_cpu)',
1805              'v8_enable_atomic_object_field_writes=<(v8_enable_atomic_object_field_writes)',
1806              'v8_enable_concurrent_marking=<(v8_enable_concurrent_marking)',
1807              'v8_enable_i18n_support=<(v8_enable_i18n_support)',
1808              'v8_enable_verify_predictable=<(v8_enable_verify_predictable)',
1809              'v8_enable_verify_csa=<(v8_enable_verify_csa)',
1810              'v8_enable_lite_mode=<(v8_enable_lite_mode)',
1811              'v8_enable_pointer_compression=<(v8_enable_pointer_compression)',
1812              'v8_enable_shared_ro_heap=<(v8_enable_shared_ro_heap)',
1813              'v8_enable_webassembly=<(v8_enable_webassembly)',
1814              # Not available in gyp.
1815              'v8_control_flow_integrity=0',
1816              'v8_target_cpu=<(v8_target_arch)',
1817            ]
1818          },
1819          'conditions': [
1820            ['v8_target_arch=="mips" or v8_target_arch=="mipsel" \
1821              or v8_target_arch=="mips64" or v8_target_arch=="mips64el"', {
1822              'v8_dump_build_config_args': [
1823                'mips_arch_variant=<(mips_arch_variant)',
1824                'mips_use_msa=<(mips_use_msa)',
1825              ],
1826            }],
1827          ],
1828          'action': [
1829            '<(python)', '<(V8_ROOT)/tools/testrunner/utils/dump_build_config_gyp.py',
1830            '<@(v8_dump_build_config_args)',
1831          ],
1832        },
1833      ],
1834    },  # v8
1835    # missing a bunch of fuzzer targets
1836
1837    ###############################################################################
1838    # Protobuf targets, used only when building outside of chromium.
1839    #
1840
1841    {
1842      'target_name': 'postmortem-metadata',
1843      'type': 'none',
1844      'toolsets': ['host', 'target'],
1845      'dependencies': ['run_torque'],
1846      'variables': {
1847        'heapobject_files': [
1848          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/instance-types.h',
1849          '<(V8_ROOT)/src/objects/allocation-site.h',
1850          '<(V8_ROOT)/src/objects/allocation-site-inl.h',
1851          '<(V8_ROOT)/src/objects/cell.h',
1852          '<(V8_ROOT)/src/objects/cell-inl.h',
1853          '<(V8_ROOT)/src/objects/code.h',
1854          '<(V8_ROOT)/src/objects/code-inl.h',
1855          '<(V8_ROOT)/src/objects/data-handler.h',
1856          '<(V8_ROOT)/src/objects/data-handler-inl.h',
1857          '<(V8_ROOT)/src/objects/descriptor-array.h',
1858          '<(V8_ROOT)/src/objects/descriptor-array-inl.h',
1859          '<(V8_ROOT)/src/objects/feedback-cell.h',
1860          '<(V8_ROOT)/src/objects/feedback-cell-inl.h',
1861          '<(V8_ROOT)/src/objects/fixed-array.h',
1862          '<(V8_ROOT)/src/objects/fixed-array-inl.h',
1863          '<(V8_ROOT)/src/objects/heap-number.h',
1864          '<(V8_ROOT)/src/objects/heap-number-inl.h',
1865          '<(V8_ROOT)/src/objects/heap-object.h',
1866          '<(V8_ROOT)/src/objects/heap-object-inl.h',
1867          '<(V8_ROOT)/src/objects/instance-type.h',
1868          '<(V8_ROOT)/src/objects/js-array-buffer.h',
1869          '<(V8_ROOT)/src/objects/js-array-buffer-inl.h',
1870          '<(V8_ROOT)/src/objects/js-array.h',
1871          '<(V8_ROOT)/src/objects/js-array-inl.h',
1872          '<(V8_ROOT)/src/objects/js-function-inl.h',
1873          '<(V8_ROOT)/src/objects/js-function.cc',
1874          '<(V8_ROOT)/src/objects/js-function.h',
1875          '<(V8_ROOT)/src/objects/js-objects.cc',
1876          '<(V8_ROOT)/src/objects/js-objects.h',
1877          '<(V8_ROOT)/src/objects/js-objects-inl.h',
1878          '<(V8_ROOT)/src/objects/js-promise.h',
1879          '<(V8_ROOT)/src/objects/js-promise-inl.h',
1880          '<(V8_ROOT)/src/objects/js-regexp.cc',
1881          '<(V8_ROOT)/src/objects/js-regexp.h',
1882          '<(V8_ROOT)/src/objects/js-regexp-inl.h',
1883          '<(V8_ROOT)/src/objects/js-regexp-string-iterator.h',
1884          '<(V8_ROOT)/src/objects/js-regexp-string-iterator-inl.h',
1885          '<(V8_ROOT)/src/objects/map.cc',
1886          '<(V8_ROOT)/src/objects/map.h',
1887          '<(V8_ROOT)/src/objects/map-inl.h',
1888          '<(V8_ROOT)/src/objects/name.h',
1889          '<(V8_ROOT)/src/objects/name-inl.h',
1890          '<(V8_ROOT)/src/objects/objects.h',
1891          '<(V8_ROOT)/src/objects/objects-inl.h',
1892          '<(V8_ROOT)/src/objects/oddball.h',
1893          '<(V8_ROOT)/src/objects/oddball-inl.h',
1894          '<(V8_ROOT)/src/objects/primitive-heap-object.h',
1895          '<(V8_ROOT)/src/objects/primitive-heap-object-inl.h',
1896          '<(V8_ROOT)/src/objects/scope-info.h',
1897          '<(V8_ROOT)/src/objects/scope-info-inl.h',
1898          '<(V8_ROOT)/src/objects/script.h',
1899          '<(V8_ROOT)/src/objects/script-inl.h',
1900          '<(V8_ROOT)/src/objects/shared-function-info.cc',
1901          '<(V8_ROOT)/src/objects/shared-function-info.h',
1902          '<(V8_ROOT)/src/objects/shared-function-info-inl.h',
1903          '<(V8_ROOT)/src/objects/string.cc',
1904          '<(V8_ROOT)/src/objects/string-comparator.cc',
1905          '<(V8_ROOT)/src/objects/string-comparator.h',
1906          '<(V8_ROOT)/src/objects/string.h',
1907          '<(V8_ROOT)/src/objects/string-inl.h',
1908          '<(V8_ROOT)/src/objects/struct.h',
1909          '<(V8_ROOT)/src/objects/struct-inl.h',
1910        ],
1911      },
1912      'actions': [
1913        {
1914          'action_name': 'gen-postmortem-metadata',
1915          'inputs': [
1916            '<(V8_ROOT)/tools/gen-postmortem-metadata.py',
1917            '<@(heapobject_files)',
1918          ],
1919          'outputs': [
1920            '<(SHARED_INTERMEDIATE_DIR)/debug-support.cc',
1921          ],
1922          'action': [
1923            '<(python)',
1924            '<(V8_ROOT)/tools/gen-postmortem-metadata.py',
1925            '<@(_outputs)',
1926            '<@(heapobject_files)'
1927          ],
1928        },
1929      ],
1930      'direct_dependent_settings': {
1931        'sources': ['<(SHARED_INTERMEDIATE_DIR)/debug-support.cc', ],
1932      },
1933    },  # postmortem-metadata
1934
1935    {
1936      'target_name': 'v8_zlib',
1937      'type': 'static_library',
1938      'toolsets': ['host', 'target'],
1939      'conditions': [
1940        ['OS=="win"', {
1941          'conditions': [
1942            ['"<(target_arch)"=="arm64" and _toolset=="target"', {
1943              'defines': ['CPU_NO_SIMD']
1944            }, {
1945              'defines': ['X86_WINDOWS']
1946            }]
1947          ]
1948        }],
1949      ],
1950      'direct_dependent_settings': {
1951        'include_dirs': [
1952          '<(V8_ROOT)/third_party/zlib',
1953          '<(V8_ROOT)/third_party/zlib/google',
1954        ],
1955      },
1956      'defines': [ 'ZLIB_IMPLEMENTATION' ],
1957      'include_dirs': [
1958        '<(V8_ROOT)/third_party/zlib',
1959        '<(V8_ROOT)/third_party/zlib/google',
1960      ],
1961      'sources': [
1962        '<(V8_ROOT)/third_party/zlib/adler32.c',
1963        '<(V8_ROOT)/third_party/zlib/chromeconf.h',
1964        '<(V8_ROOT)/third_party/zlib/compress.c',
1965        '<(V8_ROOT)/third_party/zlib/contrib/optimizations/insert_string.h',
1966        '<(V8_ROOT)/third_party/zlib/contrib/optimizations/insert_string.h',
1967        '<(V8_ROOT)/third_party/zlib/cpu_features.c',
1968        '<(V8_ROOT)/third_party/zlib/cpu_features.h',
1969        '<(V8_ROOT)/third_party/zlib/crc32.c',
1970        '<(V8_ROOT)/third_party/zlib/crc32.h',
1971        '<(V8_ROOT)/third_party/zlib/deflate.c',
1972        '<(V8_ROOT)/third_party/zlib/deflate.h',
1973        '<(V8_ROOT)/third_party/zlib/gzclose.c',
1974        '<(V8_ROOT)/third_party/zlib/gzguts.h',
1975        '<(V8_ROOT)/third_party/zlib/gzlib.c',
1976        '<(V8_ROOT)/third_party/zlib/gzread.c',
1977        '<(V8_ROOT)/third_party/zlib/gzwrite.c',
1978        '<(V8_ROOT)/third_party/zlib/infback.c',
1979        '<(V8_ROOT)/third_party/zlib/inffast.c',
1980        '<(V8_ROOT)/third_party/zlib/inffast.h',
1981        '<(V8_ROOT)/third_party/zlib/inffixed.h',
1982        '<(V8_ROOT)/third_party/zlib/inflate.c',
1983        '<(V8_ROOT)/third_party/zlib/inflate.h',
1984        '<(V8_ROOT)/third_party/zlib/inftrees.c',
1985        '<(V8_ROOT)/third_party/zlib/inftrees.h',
1986        '<(V8_ROOT)/third_party/zlib/trees.c',
1987        '<(V8_ROOT)/third_party/zlib/trees.h',
1988        '<(V8_ROOT)/third_party/zlib/uncompr.c',
1989        '<(V8_ROOT)/third_party/zlib/zconf.h',
1990        '<(V8_ROOT)/third_party/zlib/zlib.h',
1991        '<(V8_ROOT)/third_party/zlib/zutil.c',
1992        '<(V8_ROOT)/third_party/zlib/zutil.h',
1993        '<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.cc',
1994        '<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.h',
1995      ],
1996    },  # v8_zlib
1997  ],
1998}
1999