diff options
author | Michaël Zasso <targos@protonmail.com> | 2021-03-12 08:24:20 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-03-15 15:54:50 +0100 |
commit | 732ad99e47bae5deffa3a22d2ebe5500284106f0 (patch) | |
tree | 759a6b072accf188f03c74a84e8256fe92f1925c /deps/v8/gni | |
parent | 802b3e7cf9a5074a72bec75cf1c46758b81e04b1 (diff) | |
download | node-new-732ad99e47bae5deffa3a22d2ebe5500284106f0.tar.gz |
deps: update V8 to 9.0.257.11
PR-URL: https://github.com/nodejs/node/pull/37587
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/gni')
-rw-r--r-- | deps/v8/gni/proto_library.gni | 191 | ||||
-rwxr-xr-x | deps/v8/gni/protoc.py | 51 | ||||
-rw-r--r-- | deps/v8/gni/snapshot_toolchain.gni | 3 | ||||
-rw-r--r-- | deps/v8/gni/v8.gni | 18 |
4 files changed, 185 insertions, 78 deletions
diff --git a/deps/v8/gni/proto_library.gni b/deps/v8/gni/proto_library.gni index 0b72d7b8a4..583057e0a5 100644 --- a/deps/v8/gni/proto_library.gni +++ b/deps/v8/gni/proto_library.gni @@ -7,16 +7,16 @@ import("//build_overrides/build.gni") # This file should not be pulled in chromium builds. assert(!build_with_chromium) +if (host_os == "win") { + _host_executable_suffix = ".exe" +} else { + _host_executable_suffix = "" +} + template("proto_library") { assert(defined(invoker.sources)) proto_sources = invoker.sources - if (host_os == "win") { - host_executable_suffix = ".exe" - } else { - host_executable_suffix = "" - } - # All the proto imports should be relative to the project root. proto_in_dir = "//" if (defined(invoker.proto_in_dir)) { @@ -32,6 +32,11 @@ template("proto_library") { # generate_python = true. assert(defined(invoker.generate_python) && !invoker.generate_python) + import_dirs = [] + if (defined(invoker.import_dirs)) { + import_dirs = invoker.import_dirs + } + # If false will not generate the default .pb.{cc,h} files. Used for custom # codegen plugins. generate_cc = true @@ -48,7 +53,7 @@ template("proto_library") { plugin_host_label = invoker.generator_plugin_label + "($host_toolchain)" plugin_path = get_label_info(plugin_host_label, "root_out_dir") + "/" + - get_label_info(plugin_host_label, "name") + host_executable_suffix + get_label_info(plugin_host_label, "name") + _host_executable_suffix generate_with_plugin = true } else if (defined(invoker.generator_plugin_script)) { plugin_path = invoker.generator_plugin_script @@ -68,14 +73,19 @@ template("proto_library") { } } - cc_out_dir = "$root_gen_dir/" + proto_out_dir - rel_cc_out_dir = rebase_path(cc_out_dir, root_build_dir) + out_dir = "$root_gen_dir/" + proto_out_dir + rel_out_dir = rebase_path(out_dir, root_build_dir) + + # Prevent unused errors when generating descriptor only. + if (generate_descriptor != "") { + not_needed([ "rel_out_dir" ]) + } protos = rebase_path(proto_sources, proto_in_dir) protogens = [] if (generate_descriptor != "") { - protogens += [ "$root_gen_dir/" + generate_descriptor ] + protogens += [ "$out_dir/${generate_descriptor}" ] } foreach(proto, protos) { @@ -83,44 +93,64 @@ template("proto_library") { proto_name = get_path_info(proto, "name") proto_path = proto_dir + "/" + proto_name + # Prevent unused errors when generating descriptor only. + if (generate_descriptor != "") { + not_needed([ "proto_path" ]) + } + if (generate_cc) { protogens += [ - "$cc_out_dir/$proto_path.pb.h", - "$cc_out_dir/$proto_path.pb.cc", + "$out_dir/$proto_path.pb.h", + "$out_dir/$proto_path.pb.cc", ] } if (generate_with_plugin) { foreach(suffix, generator_plugin_suffixes) { - protogens += [ "$cc_out_dir/${proto_path}${suffix}" ] + protogens += [ "$out_dir/${proto_path}${suffix}" ] } } } config_name = "${target_name}_config" - action_name = "${target_name}_gen" - source_set_name = target_name + if (generate_descriptor == "") { + action_name = "${target_name}_gen" + source_set_name = target_name + } else { + action_name = target_name + } config(config_name) { - include_dirs = [ cc_out_dir ] + include_dirs = [ out_dir ] } # The XXX_gen action that generates the .pb.{cc,h} files. action(action_name) { - visibility = [ ":$source_set_name" ] - script = "//build/gn_run_binary.py" + if (generate_descriptor == "") { + visibility = [ ":$source_set_name" ] + } sources = proto_sources outputs = get_path_info(protogens, "abspath") protoc_label = "//:protoc($host_toolchain)" protoc_path = get_label_info(protoc_label, "root_out_dir") + "/protoc" + - host_executable_suffix + _host_executable_suffix + protoc_rebased_path = "./" + rebase_path(protoc_path, root_build_dir) + script = "//gni/protoc.py" args = [ # Path should be rebased because |root_build_dir| for current toolchain # may be different from |root_out_dir| of protoc built on host toolchain. - "./" + rebase_path(protoc_path, root_build_dir), + protoc_rebased_path, "--proto_path", rebase_path(proto_in_dir, root_build_dir), ] + + foreach(path, import_dirs) { + args += [ + "--proto_path", + rebase_path(path, root_build_dir), + ] + } + if (generate_cc) { cc_generator_options_ = "" if (defined(invoker.cc_generator_options)) { @@ -128,30 +158,27 @@ template("proto_library") { } args += [ "--cpp_out", - cc_generator_options_ + rel_cc_out_dir, + cc_generator_options_ + rel_out_dir, ] } if (generate_descriptor != "") { + depfile = "$out_dir/$generate_descriptor.d" args += [ "--include_imports", "--descriptor_set_out", - rebase_path("$root_gen_dir/" + generate_descriptor, root_build_dir), + rebase_path("$out_dir/$generate_descriptor", root_build_dir), + "--dependency_out", + rebase_path(depfile, root_build_dir), ] } - if (defined(invoker.import_dirs)) { - foreach(path, invoker.import_dirs) { - args += [ "--import-dir=" + rebase_path(path, root_build_dir) ] - } - } - if (generate_with_plugin) { plugin_path_rebased = rebase_path(plugin_path, root_build_dir) plugin_out_args = "" if (defined(invoker.generator_plugin_options)) { plugin_out_args += invoker.generator_plugin_options } - plugin_out_args += ":$rel_cc_out_dir" + plugin_out_args += ":$rel_out_dir" args += [ "--plugin=protoc-gen-plugin=$plugin_path_rebased", @@ -162,8 +189,15 @@ template("proto_library") { args += rebase_path(proto_sources, root_build_dir) inputs = [ protoc_path ] - deps = [ protoc_label ] + + # TODO(hjd): Avoid adding to deps here this. + # When we generate BUILD files we need find the transitive proto, + # dependencies, so also add link_deps to actual deps so they show up + # in gn desc. + if (defined(invoker.link_deps)) { + deps += invoker.link_deps + } if (generate_with_plugin) { inputs += [ plugin_path ] if (defined(plugin_host_label)) { @@ -172,61 +206,64 @@ template("proto_library") { } } - if (defined(invoker.proto_deps)) { - deps += invoker.proto_deps - } if (defined(invoker.deps)) { deps += invoker.deps } - } # action "${target_name}_gen" + } # action(action_name) # The source_set that builds the generated .pb.cc files. - source_set(target_name) { - forward_variables_from(invoker, - [ - "defines", - "include_dirs", - "public_configs", - "testonly", - "visibility", - ]) - - sources = get_target_outputs(":$action_name") - - # configs -= [ "//gn/standalone:extra_warnings" ] - if (defined(invoker.extra_configs)) { - configs += invoker.extra_configs - } + if (generate_descriptor == "") { + source_set(source_set_name) { + forward_variables_from(invoker, + [ + "defines", + "include_dirs", + "public_configs", + "testonly", + "visibility", + ]) + + sources = get_target_outputs(":$action_name") + + if (defined(invoker.extra_configs)) { + configs += invoker.extra_configs + } - if (!defined(invoker.public_configs)) { - public_configs = [] - } + if (!defined(invoker.public_configs)) { + public_configs = [] + } - public_configs += [ "//:protobuf_gen_config" ] + public_configs += [ + "//:protobuf_gen_config", + ":$config_name", + ] - propagate_imports_configs = !defined(invoker.propagate_imports_configs) || - invoker.propagate_imports_configs - if (propagate_imports_configs) { - public_configs += [ ":$config_name" ] - } else { - # Embedder handles include directory propagation to dependents. - configs += [ ":$config_name" ] - } + # By default, propagate the config for |include_dirs| to dependent + # targets, so that public imports can be resolved to corresponding header + # files. In some cases, the embedder target handles include directory + # propagation itself, e.g. via a common config. + propagate_imports_configs = !defined(invoker.propagate_imports_configs) || + invoker.propagate_imports_configs + if (propagate_imports_configs) { + public_configs += [ ":$config_name" ] + } else { + configs += [ ":$config_name" ] + } - # Use protobuf_full only for tests. - if (defined(invoker.use_protobuf_full) && - invoker.use_protobuf_full == true) { - deps = [ "//:protobuf_full" ] - } else { - deps = [ "//:protobuf_lite" ] - } + # Use protobuf_full only for tests. + if (defined(invoker.use_protobuf_full) && + invoker.use_protobuf_full == true) { + deps = [ "//:protobuf_full" ] + } else if (generate_cc) { + deps = [ "//:protobuf_lite" ] + } else { + deps = [] + } - deps += [ ":$action_name" ] - if (defined(invoker.deps)) { - deps += invoker.deps - } - if (defined(invoker.link_deps)) { - deps += invoker.link_deps - } - } # source_set(target_name) + deps += [ ":$action_name" ] + if (defined(invoker.deps)) { + deps += invoker.deps + } + } # source_set(source_set_name) + } } # template diff --git a/deps/v8/gni/protoc.py b/deps/v8/gni/protoc.py new file mode 100755 index 0000000000..dc8920009d --- /dev/null +++ b/deps/v8/gni/protoc.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# Copyright 2021 the V8 project authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +"""Script to wrap protoc execution. + +This script exists to work-around the bad depfile generation by protoc when +generating descriptors.""" + +from __future__ import print_function +import argparse +import os +import sys +import subprocess +import tempfile +import uuid + +from codecs import open + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--descriptor_set_out', default=None) + parser.add_argument('--dependency_out', default=None) + parser.add_argument('protoc') + args, remaining = parser.parse_known_args() + + if args.dependency_out and args.descriptor_set_out: + tmp_path = os.path.join(tempfile.gettempdir(), str(uuid.uuid4())) + custom = [ + '--descriptor_set_out', args.descriptor_set_out, '--dependency_out', + tmp_path + ] + try: + cmd = [args.protoc] + custom + remaining + subprocess.check_call(cmd) + with open(tmp_path, 'rb') as tmp_rd: + dependency_data = tmp_rd.read().decode('utf-8') + finally: + if os.path.exists(tmp_path): + os.unlink(tmp_path) + + with open(args.dependency_out, 'w', encoding='utf-8') as f: + f.write(args.descriptor_set_out + ":") + f.write(dependency_data) + else: + subprocess.check_call(sys.argv[1:]) + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/deps/v8/gni/snapshot_toolchain.gni b/deps/v8/gni/snapshot_toolchain.gni index b5fb1823b3..53963a048b 100644 --- a/deps/v8/gni/snapshot_toolchain.gni +++ b/deps/v8/gni/snapshot_toolchain.gni @@ -79,7 +79,8 @@ if (v8_snapshot_toolchain == "") { if (v8_current_cpu == "x64" || v8_current_cpu == "x86") { _cpus = v8_current_cpu - } else if (v8_current_cpu == "arm64" || v8_current_cpu == "mips64el") { + } else if (v8_current_cpu == "arm64" || v8_current_cpu == "mips64el" || + v8_current_cpu == "riscv64") { if (is_win && v8_current_cpu == "arm64") { # set _cpus to blank for Windows ARM64 so host_toolchain could be # selected as snapshot toolchain later. diff --git a/deps/v8/gni/v8.gni b/deps/v8/gni/v8.gni index 5651a178c2..9325baf996 100644 --- a/deps/v8/gni/v8.gni +++ b/deps/v8/gni/v8.gni @@ -64,6 +64,17 @@ declare_args() { # Enable WebAssembly debugging via GDB-remote protocol. v8_enable_wasm_gdb_remote_debugging = false + # Lite mode disables a number of performance optimizations to reduce memory + # at the cost of performance. + # Sets -DV8_LITE_MODE. + v8_enable_lite_mode = false + + # Include support for WebAssembly. If disabled, the 'WebAssembly' global + # will not be available, and embedder APIs to generate WebAssembly modules + # will fail. Also, asm.js will not be translated to WebAssembly and will be + # executed as standard JavaScript instead. + v8_enable_webassembly = "" + # Add fuzzilli fuzzer support. v8_fuzzilli = false @@ -98,6 +109,13 @@ if (build_with_chromium && use_perfetto_client_library) { v8_use_perfetto = true } +# WebAssembly is enabled by default, except in lite mode. +if (v8_enable_webassembly == "") { + v8_enable_webassembly = !v8_enable_lite_mode +} +assert(!(v8_enable_webassembly && v8_enable_lite_mode), + "Webassembly is not available in lite mode.") + # Points to // in v8 stand-alone or to //v8/ in chromium. We need absolute # paths for all configs in templates as they are shared in different # subdirectories. |