| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ | |||
| 8 | 8 | # will be used to populate process.config.variables. | |
| 9 | 9 | ||
| 10 | 10 | import argparse | |
| 11 | + import json | ||
| 11 | 12 | import re | |
| 12 | 13 | import os | |
| 13 | 14 | import subprocess | |
@@ -16,26 +17,6 @@ | |||
| 16 | 17 | sys.path.append(os.path.dirname(__file__)) | |
| 17 | 18 | import getnapibuildversion | |
| 18 | 19 | ||
| 19 | - # The defines bellow must include all things from the external_v8_defines list | ||
| 20 | - # in v8/BUILD.gn. | ||
| 21 | - # TODO(zcbenz): Import from v8_features.json once this change gets into Node: | ||
| 22 | - # https://chromium-review.googlesource.com/c/v8/v8/+/5040612 | ||
| 23 | - V8_FEATURE_DEFINES = { | ||
| 24 | - 'v8_enable_v8_checks': 'V8_ENABLE_CHECKS', | ||
| 25 | - 'v8_enable_pointer_compression': 'V8_COMPRESS_POINTERS', | ||
| 26 | - 'v8_enable_pointer_compression_shared_cage': 'V8_COMPRESS_POINTERS_IN_SHARED_CAGE', | ||
| 27 | - 'v8_enable_31bit_smis_on_64bit_arch': 'V8_31BIT_SMIS_ON_64BIT_ARCH', | ||
| 28 | - 'v8_enable_zone_compression': 'V8_COMPRESS_ZONES', | ||
| 29 | - 'v8_enable_sandbox': 'V8_ENABLE_SANDBOX', | ||
| 30 | - 'v8_deprecation_warnings': 'V8_DEPRECATION_WARNINGS', | ||
| 31 | - 'v8_imminent_deprecation_warnings': 'V8_IMMINENT_DEPRECATION_WARNINGS', | ||
| 32 | - 'v8_use_perfetto': 'V8_USE_PERFETTO', | ||
| 33 | - 'v8_enable_map_packing': 'V8_MAP_PACKING', | ||
| 34 | - 'tsan': 'V8_IS_TSAN', | ||
| 35 | - 'v8_enable_conservative_stack_scanning': 'V8_ENABLE_CONSERVATIVE_STACK_SCANNING', | ||
| 36 | - 'v8_enable_direct_local': 'V8_ENABLE_DIRECT_LOCAL', | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | 20 | # Regex used for parsing results of "gn args". | |
| 40 | 21 | GN_RE = re.compile(r'(\w+)\s+=\s+(.*?)$', re.MULTILINE) | |
| 41 | 22 | ||
@@ -60,15 +41,11 @@ def get_gn_config(out_dir): | |||
| 60 | 41 | return config | |
| 61 | 42 | ||
| 62 | 43 | def get_v8_config(out_dir, node_gn_path): | |
| 63 | - # For args that have default values in V8's GN configurations, we can not rely | ||
| 64 | - # on the values printed by "gn args", because most of them would be empty | ||
| 65 | - # strings, and the actual value would depend on the logics in v8/BUILD.gn. | ||
| 66 | - # So we print out the defines and deduce the feature from them instead. | ||
| 67 | - node_defines = subprocess.check_output( | ||
| 68 | - [GN, 'desc', '-C', out_dir, node_gn_path + ":libnode", 'defines']).decode().split('\n') | ||
| 69 | - v8_config = {} | ||
| 70 | - for feature, define in V8_FEATURE_DEFINES.items(): | ||
| 71 | - v8_config[feature] = bool_to_number(define in node_defines) | ||
| 44 | + with open(os.path.join(out_dir, 'v8_features.json')) as f: | ||
| 45 | + v8_config = json.load(f) | ||
| 46 | + for key, value in v8_config.items(): | ||
| 47 | + if isinstance(value, bool): | ||
| 48 | + v8_config[key] = bool_to_number(value) | ||
| 72 | 49 | return v8_config | |
| 73 | 50 | ||
| 74 | 51 | def translate_config(out_dir, config, v8_config): | |
@@ -90,8 +67,6 @@ def translate_config(out_dir, config, v8_config): | |||
| 90 | 67 | 'node_use_openssl': config['node_use_openssl'], | |
| 91 | 68 | 'node_use_node_code_cache': config['node_use_node_code_cache'], | |
| 92 | 69 | 'node_use_node_snapshot': config['node_use_node_snapshot'], | |
| 93 | - 'v8_enable_i18n_support': | ||
| 94 | - bool_string_to_number(config['v8_enable_i18n_support']), | ||
| 95 | 70 | 'v8_enable_inspector': # this is actually a node misnomer | |
| 96 | 71 | bool_string_to_number(config['node_enable_inspector']), | |
| 97 | 72 | 'shlib_suffix': 'dylib' if sys.platform == 'darwin' else 'so', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -261,6 +261,7 @@ template("node_gn_build") { | |||
| 261 | 261 | } | |
| 262 | 262 | ||
| 263 | 263 | action("generate_config_gypi") { | |
| 264 | + deps = [ "$node_v8_path:v8_generate_features_json" ] | ||
| 264 | 265 | script = "tools/generate_config_gypi.py" | |
| 265 | 266 | outputs = [ "$target_gen_dir/config.gypi" ] | |
| 266 | 267 | depfile = "$target_gen_dir/$target_name.d" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments