diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-02-04 17:20:24 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-02-12 08:15:25 +0000 |
commit | 8fa0776f1f79e91fc9c0b9c1ba11a0a29c05196b (patch) | |
tree | 788d8d7549712682703a0310ca4a0f0860d4802b /chromium/v8/bazel | |
parent | 606d85f2a5386472314d39923da28c70c60dc8e7 (diff) | |
download | qtwebengine-chromium-8fa0776f1f79e91fc9c0b9c1ba11a0a29c05196b.tar.gz |
BASELINE: Update Chromium to 98.0.4758.90
Change-Id: Ib7c41539bf8a8e0376bd639f27d68294de90f3c8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/v8/bazel')
-rw-r--r-- | chromium/v8/bazel/BUILD.icu | 69 | ||||
-rw-r--r-- | chromium/v8/bazel/BUILD.zlib | 8 | ||||
-rw-r--r-- | chromium/v8/bazel/config/BUILD.bazel | 174 | ||||
-rw-r--r-- | chromium/v8/bazel/config/v8-target-cpu.bzl | 61 | ||||
-rw-r--r-- | chromium/v8/bazel/defs.bzl | 329 | ||||
-rw-r--r-- | chromium/v8/bazel/generate-inspector-files.cmd | 24 | ||||
-rw-r--r-- | chromium/v8/bazel/v8-non-pointer-compression.bzl | 59 |
7 files changed, 635 insertions, 89 deletions
diff --git a/chromium/v8/bazel/BUILD.icu b/chromium/v8/bazel/BUILD.icu index fd651d513dd..662e11ec03a 100644 --- a/chromium/v8/bazel/BUILD.icu +++ b/chromium/v8/bazel/BUILD.icu @@ -26,15 +26,29 @@ cc_library( "U_ENABLE_RESOURCE_TRACING=0", "UNISTR_FROM_STRING_EXPLICIT=", "UNISTR_FROM_CHAR_EXPLICIT=", - "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE", - ], - copts = [ - "-Wno-unused-function", - "-Wno-parentheses", - "-Wno-unused-function", - "-Wno-unused-variable", - "-Wno-deprecated-declarations", - ], + ] + select({ + "@platforms//os:windows": [ + "U_STATIC_IMPLEMENTATION", + "UNICODE", + "_UNICODE", + ], + "//conditions:default": [], + }), + copts = select({ + "@platforms//os:windows": [ + "/wd4005", # Macro redefinition. + "/wd4068", # Unknown pragmas. + "/wd4267", # Conversion from size_t on 64-bits. + "/utf-8", # ICU source files are in UTF-8. + ], + "//conditions:default": [ + "-Wno-unused-function", + "-Wno-parentheses", + "-Wno-unused-function", + "-Wno-unused-variable", + "-Wno-deprecated-declarations", + ], + }), includes = [ "source/common", "source/i18n", @@ -50,9 +64,25 @@ cc_library( "source/i18n/**/*.h", "source/i18n/**/*.cpp" ]), + copts = select({ + "@platforms//os:windows": [ + "/wd4005", # Macro redefinition. + "/wd4068", # Unknown pragmas. + "/wd4267", # Conversion from size_t on 64-bits. + "/utf-8", # ICU source files are in UTF-8. + ], + "//conditions:default": [], + }), defines = [ "U_I18N_IMPLEMENTATION", - ], + ] + select({ + "@platforms//os:windows": [ + "U_STATIC_IMPLEMENTATION", + "UNICODE", + "_UNICODE", + ], + "//conditions:default": [], + }), deps = [ ":icuuc" ], alwayslink = 1, ) @@ -66,6 +96,25 @@ cc_library( srcs = [ "source/stubdata/stubdata.cpp", ], + copts = select({ + "@platforms//os:windows": [ + "/wd4005", # Macro redefinition. + "/wd4068", # Unknown pragmas. + "/wd4267", # Conversion from size_t on 64-bits. + "/utf-8", # ICU source files are in UTF-8. + ], + "//conditions:default": [], + }), + defines = [ + "U_I18N_IMPLEMENTATION", + ] + select({ + "@platforms//os:windows": [ + "U_STATIC_IMPLEMENTATION", + "UNICODE", + "_UNICODE", + ], + "//conditions:default": [], + }), include_prefix = "third_party/icu", deps = [ ":icuuc", diff --git a/chromium/v8/bazel/BUILD.zlib b/chromium/v8/bazel/BUILD.zlib index 0c97b325a34..140f761fbb8 100644 --- a/chromium/v8/bazel/BUILD.zlib +++ b/chromium/v8/bazel/BUILD.zlib @@ -45,8 +45,12 @@ cc_library( include_prefix = "third_party/zlib", defines = [ "CHROMIUM_ZLIB_NO_CHROMECONF", - "HAVE_HIDDEN", "CPU_NO_SIMD", - ], + ] + select({ + "@platforms//os:windows": [], + "//conditions:default": [ + "HAVE_HIDDEN", + ], + }), visibility = ["//visibility:public"], ) diff --git a/chromium/v8/bazel/config/BUILD.bazel b/chromium/v8/bazel/config/BUILD.bazel new file mode 100644 index 00000000000..78a1b5debda --- /dev/null +++ b/chromium/v8/bazel/config/BUILD.bazel @@ -0,0 +1,174 @@ +# 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. + +load("@bazel_skylib//lib:selects.bzl", "selects") +load( + ":v8-target-cpu.bzl", + "v8_configure_target_cpu", + "v8_target_cpu", +) + +package( + default_visibility = [ + "//visibility:public", + ], +) + +config_setting( + name = "platform_cpu_x64", + constraint_values = ["@platforms//cpu:x86_64"], +) + +config_setting( + name = "platform_cpu_ia32", + constraint_values = ["@platforms//cpu:x86_32"], +) + +config_setting( + name = "platform_cpu_arm64", + constraint_values = ["@platforms//cpu:arm"], +) + +config_setting( + name = "platform_cpu_arm", + constraint_values = ["@platforms//cpu:arm"], +) + +v8_target_cpu( + name = "v8_target_cpu", + build_setting_default = "none", +) + +config_setting( + name = "v8_host_target_is_none", + flag_values = { + ":v8_target_cpu": "none", + }, +) + +v8_configure_target_cpu( + name = "x64", + matching_configs = [":platform_cpu_x64"], +) + +v8_configure_target_cpu( + name = "ia32", + matching_configs = [":platform_cpu_ia32"], +) + +v8_configure_target_cpu( + name = "arm", + matching_configs = [":platform_cpu_arm64"], +) + +v8_configure_target_cpu( + name = "arm64", + matching_configs = [":platform_cpu_arm"], +) + +selects.config_setting_group( + name = "v8_target_is_32_bits", + match_any = [ + ":v8_target_ia32", + ":v8_target_arm", + ], +) + +# Running arm64 simulator on x64 host. +selects.config_setting_group( + name = "v8_arm64_simulator", + match_all = [ + ":v8_target_arm64", + ":is_x64", + ], +) + +config_setting( + name = "is_linux", + constraint_values = ["@platforms//os:linux"], +) + +config_setting( + name = "is_android", + constraint_values = ["@platforms//os:android"], +) + +config_setting( + name = "is_macos", + constraint_values = ["@platforms//os:macos"], +) + +config_setting( + name = "is_windows", + constraint_values = ["@platforms//os:windows"], +) + +selects.config_setting_group( + name = "is_64bit", + match_any = [ + ":v8_target_arm64", + ":is_x64", + ":is_arm64", + ], +) + +selects.config_setting_group( + name = "is_windows_64bit", + match_all = [ + ":is_64bit", + ":is_windows", + ], +) + +selects.config_setting_group( + name = "is_posix", + match_any = [ + ":is_linux", + ":is_android", + ":is_macos", + ], +) + +selects.config_setting_group( + name = "is_posix_x64", + match_all = [ + ":is_posix", + ":is_x64", + ] +) + +selects.config_setting_group( + name = "is_inline_asm_x64", + match_all = [":is_posix", ":is_x64"], +) + +selects.config_setting_group( + name = "is_inline_asm_ia32", + match_all = [":is_posix", ":is_ia32"], +) + +selects.config_setting_group( + name = "is_inline_asm_arm64", + match_all = [":is_posix", ":is_arm64"], +) + +selects.config_setting_group( + name = "is_inline_asm_arm", + match_all = [":is_posix", ":is_arm"], +) + +selects.config_setting_group( + name = "is_msvc_asm_x64", + match_all = [":is_windows", ":is_x64"], +) + +selects.config_setting_group( + name = "is_msvc_asm_ia32", + match_all = [":is_windows", ":is_ia32"], +) + +selects.config_setting_group( + name = "is_msvc_asm_arm64", + match_all = [":is_windows", ":is_arm64"], +) diff --git a/chromium/v8/bazel/config/v8-target-cpu.bzl b/chromium/v8/bazel/config/v8-target-cpu.bzl new file mode 100644 index 00000000000..2d5d241ebf4 --- /dev/null +++ b/chromium/v8/bazel/config/v8-target-cpu.bzl @@ -0,0 +1,61 @@ +# 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. + +"""Build rules to choose the v8 target architecture.""" + +load("@bazel_skylib//lib:selects.bzl", "selects") + +V8CpuTypeInfo = provider( + doc = "A singleton provider that specifies the V8 target CPU type", + fields = { + "value": "The V8 Target CPU selected.", + }, +) + +def _host_target_cpu_impl(ctx): + allowed_values = ["arm", "arm64", "ia32", "x64", "none"] + cpu_type = ctx.build_setting_value + if cpu_type in allowed_values: + return V8CpuTypeInfo(value = cpu_type) + else: + fail("Error setting " + str(ctx.label) + ": invalid v8 target cpu '" + + cpu_type + "'. Allowed values are " + str(allowed_values)) + +v8_target_cpu = rule( + implementation = _host_target_cpu_impl, + build_setting = config.string(flag = True), + doc = "CPU that V8 will generate code for.", +) + +def v8_configure_target_cpu(name, matching_configs): + selects.config_setting_group( + name = "is_" + name, + match_any = matching_configs, + ) + + # If v8_target_cpu flag is set to 'name' + native.config_setting( + name = "v8_host_target_is_" + name, + flag_values = { + ":v8_target_cpu": name, + }, + ) + + # Default target if no v8_host_target flag is set. + selects.config_setting_group( + name = "v8_target_is_" + name, + match_all = [ + ":v8_host_target_is_none", + ":is_" + name, + ], + ) + + # Select either the default target or the flag. + selects.config_setting_group( + name = "v8_target_" + name, + match_any = [ + ":v8_host_target_is_" + name, + ":v8_target_is_" + name, + ], + ) diff --git a/chromium/v8/bazel/defs.bzl b/chromium/v8/bazel/defs.bzl index 58fd53ed607..fc428ba16cd 100644 --- a/chromium/v8/bazel/defs.bzl +++ b/chromium/v8/bazel/defs.bzl @@ -22,10 +22,6 @@ _create_option_int = rule( build_setting = config.int(flag = True), ) -def v8_raw_flag(name, default = False): - _create_option_flag(name = name, build_setting_default = default) - native.config_setting(name = "raw_" + name, flag_values = {name: "True"}) - def v8_flag(name, default = False): _create_option_flag(name = name, build_setting_default = default) native.config_setting(name = "is_" + name, flag_values = {name: "True"}) @@ -40,28 +36,30 @@ def v8_int(name, default = 0): def _custom_config_impl(ctx): defs = [] defs.append("V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=" + - str(ctx.attr._v8_typed_array_max_size_in_heap[FlagInfo].value)) + str(ctx.attr._v8_typed_array_max_size_in_heap[FlagInfo].value)) context = cc_common.create_compilation_context(defines = depset(defs)) return [CcInfo(compilation_context = context)] v8_custom_config = rule( implementation = _custom_config_impl, attrs = { - "_v8_typed_array_max_size_in_heap": - attr.label(default = ":v8_typed_array_max_size_in_heap"), - } + "_v8_typed_array_max_size_in_heap": attr.label(default = ":v8_typed_array_max_size_in_heap"), + }, ) def _config_impl(ctx): hdrs = [] + # Add headers for h in ctx.attr.hdrs: hdrs += h[DefaultInfo].files.to_list() defs = [] + # Add conditional_defines for f, d in ctx.attr.conditional_defines.items(): if f[FlagInfo].value: defs.append(d) + # Add defines for d in ctx.attr.defines: defs.append(d) @@ -87,157 +85,325 @@ v8_config = rule( }, ) -def _default_args(configs): +def _default_args(): return struct( - deps = configs + [":define_flags"], - copts = [ - "-fPIC", - "-Werror", - "-Wextra", - "-Wno-builtin-assume-aligned-alignment", - "-Wno-unused-parameter", - "-Wno-implicit-int-float-conversion", - "-Wno-deprecated-copy", - "-Wno-non-virtual-dtor", - "-std=c++17", - "-isystem .", - ], + deps = [":define_flags"], + defines = select({ + "@config//:is_windows": [ + "UNICODE", + "_UNICODE", + "_CRT_RAND_S", + "_WIN32_WINNT=0x0602", # Override bazel default to Windows 8 + ], + "//conditions:default": [], + }), + copts = select({ + "@config//:is_posix": [ + "-fPIC", + "-Werror", + "-Wextra", + "-Wno-bitwise-instead-of-logical", + "-Wno-builtin-assume-aligned-alignment", + "-Wno-unused-parameter", + "-Wno-implicit-int-float-conversion", + "-Wno-deprecated-copy", + "-Wno-non-virtual-dtor", + "-std=c++17", + "-isystem .", + ], + "//conditions:default": [], + }), includes = ["include"], - linkopts = [ - "-pthread" - ] + select({ - ":is_macos": [], - "//conditions:default": [ "-Wl,--no-as-needed -ldl" ], + linkopts = select({ + "@config//:is_windows": [ + "Winmm.lib", + "DbgHelp.lib", + "Advapi32.lib", + ], + "@config//:is_macos": ["-pthread"], + "//conditions:default": ["-Wl,--no-as-needed -ldl -pthread"], }) + select({ - ":should_add_rdynamic": [ "-rdynamic" ], + ":should_add_rdynamic": ["-rdynamic"], "//conditions:default": [], }), ) +ENABLE_I18N_SUPPORT_DEFINES = [ + "-DV8_INTL_SUPPORT", + "-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC", + # src/regexp/regexp-compiler-tonode.cc uses an unsafe ICU method and + # access a character implicitly. + "-DUNISTR_FROM_CHAR_EXPLICIT=", +] + +def _should_emit_noicu_and_icu(noicu_srcs, noicu_deps, icu_srcs, icu_deps): + return noicu_srcs != [] or noicu_deps != [] or icu_srcs != [] or icu_deps != [] + +# buildifier: disable=function-docstring def v8_binary( name, srcs, - configs = [], deps = [], includes = [], copts = [], linkopts = [], + noicu_srcs = [], + noicu_deps = [], + icu_srcs = [], + icu_deps = [], **kwargs): - default = _default_args(configs) - native.cc_binary( - name = name, - srcs = srcs, - deps = deps + default.deps, - includes = includes + default.includes, - copts = copts + default.copts, - linkopts = linkopts + default.linkopts, - **kwargs - ) + default = _default_args() + if _should_emit_noicu_and_icu(noicu_srcs, noicu_deps, icu_srcs, icu_deps): + native.cc_binary( + name = "noicu/" + name, + srcs = srcs + noicu_srcs, + deps = deps + noicu_deps + default.deps, + includes = includes + default.includes, + copts = copts + default.copts, + linkopts = linkopts + default.linkopts, + **kwargs + ) + native.cc_binary( + name = "icu/" + name, + srcs = srcs + icu_srcs, + deps = deps + icu_deps + default.deps, + includes = includes + default.includes, + copts = copts + default.copts + ENABLE_I18N_SUPPORT_DEFINES, + linkopts = linkopts + default.linkopts, + **kwargs + ) + else: + native.cc_binary( + name = name, + srcs = srcs, + deps = deps + default.deps, + includes = includes + default.includes, + copts = copts + default.copts, + linkopts = linkopts + default.linkopts, + **kwargs + ) +# buildifier: disable=function-docstring def v8_library( name, srcs, - configs = [], deps = [], includes = [], copts = [], linkopts = [], + noicu_srcs = [], + noicu_deps = [], + icu_srcs = [], + icu_deps = [], **kwargs): - default = _default_args(configs) - native.cc_library( - name = name, - srcs = srcs, - deps = deps + default.deps, - includes = includes + default.includes, - copts = copts + default.copts, - linkopts = linkopts + default.linkopts, - alwayslink = 1, - **kwargs - ) + default = _default_args() + if _should_emit_noicu_and_icu(noicu_srcs, noicu_deps, icu_srcs, icu_deps): + native.cc_library( + name = name + "_noicu", + srcs = srcs + noicu_srcs, + deps = deps + noicu_deps + default.deps, + includes = includes + default.includes, + copts = copts + default.copts, + linkopts = linkopts + default.linkopts, + alwayslink = 1, + linkstatic = 1, + **kwargs + ) + # Alias target used because of cc_library bug in bazel on windows + # https://github.com/bazelbuild/bazel/issues/14237 + # TODO(victorgomes): Remove alias once bug is fixed + native.alias( + name = "noicu/" + name, + actual = name + "_noicu", + ) + native.cc_library( + name = name + "_icu", + srcs = srcs + icu_srcs, + deps = deps + icu_deps + default.deps, + includes = includes + default.includes, + copts = copts + default.copts + ENABLE_I18N_SUPPORT_DEFINES, + linkopts = linkopts + default.linkopts, + alwayslink = 1, + linkstatic = 1, + **kwargs + ) + # Alias target used because of cc_library bug in bazel on windows + # https://github.com/bazelbuild/bazel/issues/14237 + # TODO(victorgomes): Remove alias once bug is fixed + native.alias( + name = "icu/" + name, + actual = name + "_icu", + ) + else: + native.cc_library( + name = name, + srcs = srcs, + deps = deps + default.deps, + includes = includes + default.includes, + copts = copts + default.copts, + linkopts = linkopts + default.linkopts, + alwayslink = 1, + linkstatic = 1, + **kwargs + ) def _torque_impl(ctx): - v8root = ctx.attr.v8root[FlagInfo].value + v8root = "." + prefix = ctx.attr.prefix + # Arguments args = [] args += ctx.attr.args args.append("-o") - args.append(ctx.bin_dir.path + "/torque-generated") + args.append(ctx.bin_dir.path + "/" + v8root + "/" + ctx.attr.prefix + "/torque-generated") args.append("-strip-v8-root") args.append("-v8-root") args.append(v8root) + # Sources args += [f.path for f in ctx.files.srcs] + # Generate/declare output files outs = [] for src in ctx.files.srcs: root, period, ext = src.path.rpartition(".") + # Strip v8root if root[:len(v8root)] == v8root: root = root[len(v8root):] - file = "torque-generated/" + root + file = ctx.attr.prefix + "/torque-generated/" + root outs.append(ctx.actions.declare_file(file + "-tq-csa.cc")) outs.append(ctx.actions.declare_file(file + "-tq-csa.h")) outs.append(ctx.actions.declare_file(file + "-tq-inl.inc")) outs.append(ctx.actions.declare_file(file + "-tq.inc")) outs.append(ctx.actions.declare_file(file + "-tq.cc")) - outs += [ctx.actions.declare_file("torque-generated/" + f) for f in ctx.attr.extras] + outs += [ctx.actions.declare_file(ctx.attr.prefix + "/torque-generated/" + f) for f in ctx.attr.extras] ctx.actions.run( outputs = outs, inputs = ctx.files.srcs, arguments = args, executable = ctx.executable.tool, + mnemonic = "GenTorque", progress_message = "Generating Torque files", ) return [DefaultInfo(files = depset(outs))] -v8_torque = rule( +_v8_torque = rule( implementation = _torque_impl, + # cfg = v8_target_cpu_transition, attrs = { + "prefix": attr.string(mandatory = True), "srcs": attr.label_list(allow_files = True, mandatory = True), "extras": attr.string_list(), "tool": attr.label( - default = ":torque", allow_files = True, executable = True, - cfg = "host", + cfg = "exec", ), "args": attr.string_list(), "v8root": attr.label(default = ":v8_root"), }, ) +def v8_torque(name, noicu_srcs, icu_srcs, args, extras): + _v8_torque( + name = "noicu/" + name, + prefix = "noicu", + srcs = noicu_srcs, + args = args, + extras = extras, + tool = select({ + "@config//:v8_target_is_32_bits": ":torque_non_pointer_compression", + "//conditions:default": ":torque", + }), + ) + _v8_torque( + name = "icu/" + name, + prefix = "icu", + srcs = icu_srcs, + args = args, + extras = extras, + tool = select({ + "@config//:v8_target_is_32_bits": ":torque_non_pointer_compression", + "//conditions:default": ":torque", + }), + ) + +def _v8_target_cpu_transition_impl(settings, attr): + mapping = { + "haswell": "x64", + "k8": "x64", + "x86_64": "x64", + "darwin_x86_64": "x64", + "x86": "ia32", + "ppc": "ppc64", + "arm64-v8a": "arm64", + "arm": "arm64", + "armeabi-v7a": "arm32", + } + v8_target_cpu = mapping[settings["//command_line_option:cpu"]] + return {"@config//:v8_target_cpu": v8_target_cpu} + +# Set the v8_target_cpu to be the correct architecture given the cpu specified +# on the command line. +v8_target_cpu_transition = transition( + implementation = _v8_target_cpu_transition_impl, + inputs = ["//command_line_option:cpu"], + outputs = ["@config//:v8_target_cpu"], +) + def _mksnapshot(ctx): outs = [ - ctx.actions.declare_file("snapshot.cc"), - ctx.actions.declare_file("embedded.S"), + ctx.actions.declare_file(ctx.attr.prefix + "/snapshot.cc"), + ctx.actions.declare_file(ctx.attr.prefix + "/embedded.S"), ] ctx.actions.run( outputs = outs, inputs = [], arguments = [ "--embedded_variant=Default", - "--startup_src", outs[0].path, - "--embedded_src", outs[1].path, + "--startup_src", + outs[0].path, + "--embedded_src", + outs[1].path, ] + ctx.attr.args, executable = ctx.executable.tool, - progress_message = "Running mksnapshot" + progress_message = "Running mksnapshot", ) return [DefaultInfo(files = depset(outs))] - -v8_mksnapshot = rule( +_v8_mksnapshot = rule( implementation = _mksnapshot, attrs = { "args": attr.string_list(), "tool": attr.label( - default = ":mksnapshot", + mandatory = True, allow_files = True, executable = True, - cfg = "host", + cfg = "exec", ), - } + "_allowlist_function_transition": attr.label( + default = "@bazel_tools//tools/allowlists/function_transition_allowlist", + ), + "prefix": attr.string(mandatory = True), + }, + cfg = v8_target_cpu_transition, ) +def v8_mksnapshot(name, args): + _v8_mksnapshot( + name = "noicu/" + name, + args = args, + prefix = "noicu", + tool = ":noicu/mksnapshot", + ) + _v8_mksnapshot( + name = "icu/" + name, + args = args, + prefix = "icu", + tool = ":icu/mksnapshot", + ) + def _quote(val): if val[0] == '"' and val[-1] == '"': fail("String", val, "already quoted") @@ -255,11 +421,8 @@ def _json(kv_pairs): content += "}\n" return content -# TODO(victorgomes): Create a rule (instead of a macro), that can -# dynamically populate the build config. -def v8_build_config(name): - cpu = _quote("x64") - content = _json([ +def build_config_content(cpu, icu): + return _json([ ("current_cpu", cpu), ("dcheck_always_on", "false"), ("is_android", "false"), @@ -275,10 +438,11 @@ def v8_build_config(name): ("is_ubsan_vptr", "false"), ("target_cpu", cpu), ("v8_current_cpu", cpu), + ("v8_dict_property_const_tracking", "false"), ("v8_enable_atomic_marking_state", "false"), ("v8_enable_atomic_object_field_writes", "false"), ("v8_enable_concurrent_marking", "false"), - ("v8_enable_i18n_support", "true"), + ("v8_enable_i18n_support", icu), ("v8_enable_verify_predictable", "false"), ("v8_enable_verify_csa", "false"), ("v8_enable_lite_mode", "false"), @@ -289,10 +453,21 @@ def v8_build_config(name): ("v8_enable_webassembly", "false"), ("v8_control_flow_integrity", "false"), ("v8_enable_single_generation", "false"), + ("v8_enable_virtual_memory_cage", "false"), ("v8_target_cpu", cpu), ]) + +# TODO(victorgomes): Create a rule (instead of a macro), that can +# dynamically populate the build config. +def v8_build_config(name): + cpu = _quote("x64") + native.genrule( + name = "noicu/" + name, + outs = ["noicu/" + name + ".json"], + cmd = "echo '" + build_config_content(cpu, "false") + "' > \"$@\"", + ) native.genrule( - name = name, - outs = [name + ".json"], - cmd = "echo '" + content + "' > \"$@\"", + name = "icu/" + name, + outs = ["icu/" + name + ".json"], + cmd = "echo '" + build_config_content(cpu, "true") + "' > \"$@\"", ) diff --git a/chromium/v8/bazel/generate-inspector-files.cmd b/chromium/v8/bazel/generate-inspector-files.cmd new file mode 100644 index 00000000000..202dd81d7cf --- /dev/null +++ b/chromium/v8/bazel/generate-inspector-files.cmd @@ -0,0 +1,24 @@ +REM Copyright 2021 the V8 project authors. All rights reserved. +REM Use of this source code is governed by a BSD-style license that can be +REM found in the LICENSE file. + +set BAZEL_OUT=%1 + +REM Bazel nukes all env vars, and we need the following for gn to work +set DEPOT_TOOLS_WIN_TOOLCHAIN=0 +set ProgramFiles(x86)=C:\Program Files (x86) +set windir=C:\Windows + +REM Create a default GN output folder +cmd.exe /S /E:ON /V:ON /D /c gn gen out/inspector + +REM Generate inspector files +cmd.exe /S /E:ON /V:ON /D /c autoninja -C out/inspector gen/src/inspector/protocol/Forward.h + +REM Create directories in bazel output folder +MKDIR -p %BAZEL_OUT%\include\inspector +MKDIR -p %BAZEL_OUT%\src\inspector\protocol + +REM Copy generated files to bazel output folder +COPY out\inspector\gen\include\inspector\* %BAZEL_OUT%\include\inspector\ +COPY out\inspector\gen\src\inspector\protocol\* %BAZEL_OUT%\src\inspector\protocol\
\ No newline at end of file diff --git a/chromium/v8/bazel/v8-non-pointer-compression.bzl b/chromium/v8/bazel/v8-non-pointer-compression.bzl new file mode 100644 index 00000000000..4f1c6bc0033 --- /dev/null +++ b/chromium/v8/bazel/v8-non-pointer-compression.bzl @@ -0,0 +1,59 @@ +def _v8_disable_pointer_compression(settings, attr): + return { + "//third_party/v8/HEAD:v8_enable_pointer_compression": "False", + } + +v8_disable_pointer_compression = transition( + implementation = _v8_disable_pointer_compression, + inputs = [], + outputs = ["//third_party/v8/HEAD:v8_enable_pointer_compression"], +) + +# The implementation of transition_rule: all this does is copy the +# cc_binary's output to its own output and propagate its runfiles +# and executable to use for "$ bazel run". +# +# This makes transition_rule as close to a pure wrapper of cc_binary +# as possible. +def _v8_binary_non_pointer_compression(ctx): + binary = ctx.attr.binary[0] + outfile = ctx.actions.declare_file(ctx.label.name) + cc_binary_outfile = binary[DefaultInfo].files.to_list()[0] + + ctx.actions.run_shell( + inputs = [cc_binary_outfile], + outputs = [outfile], + command = "cp %s %s" % (cc_binary_outfile.path, outfile.path), + ) + return [ + DefaultInfo( + executable = outfile, + data_runfiles = binary[DefaultInfo].data_runfiles, + ), + ] + +# The purpose of this rule is to transition to a config where v8_target_cpu is +# set to the appropriate architecture, which will remain in place through exec +# transitions, so mksnapshot can for instance build on x64 but for arm64. +v8_binary_non_pointer_compression = rule( + implementation = _v8_binary_non_pointer_compression, + attrs = { + # This is the cc_binary whose deps will select() on that feature. + # Note specificaly how it's configured with v8_target_cpu_transition, which + # ensures that setting propagates down the graph. + "binary": attr.label(cfg = v8_disable_pointer_compression), + # This is a stock Bazel requirement for any rule that uses Starlark + # transitions. It's okay to copy the below verbatim for all such rules. + # + # The purpose of this requirement is to give the ability to restrict + # which packages can invoke these rules, since Starlark transitions + # make much larger graphs possible that can have memory and performance + # consequences for your build. The whitelist defaults to "everything". + # But you can redefine it more strictly if you feel that's prudent. + "_allowlist_function_transition": attr.label( + default = "//tools/allowlists/function_transition_allowlist", + ), + }, + # Making this executable means it works with "$ bazel run". + executable = True, +) |