Commit 715d5a3a authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[bazel] Upstream BUILD and create config pkg

- Upstream changes made by BUILD and defs.bzl
- Creates a new config package, since configurations targets
  are different between bazel and blaze
- Runs buildifier in all files

No-Try: true
Change-Id: I65a1bc94a76b79eb26a348baf11eef4249be9552
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3250637Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77597}
parent 392078fb
...@@ -9,18 +9,14 @@ load( ...@@ -9,18 +9,14 @@ load(
"v8_build_config", "v8_build_config",
"v8_config", "v8_config",
"v8_custom_config", "v8_custom_config",
"v8_raw_flag",
"v8_flag", "v8_flag",
"v8_int", "v8_int",
"v8_string",
"v8_library", "v8_library",
"v8_torque",
"v8_mksnapshot", "v8_mksnapshot",
"v8_string",
"v8_torque",
) )
load(":bazel/v8-non-pointer-compression.bzl", "v8_binary_non_pointer_compression")
# =================================================
# Configuration settings
# =================================================
config_setting( config_setting(
name = "is_debug", name = "is_debug",
...@@ -29,93 +25,6 @@ config_setting( ...@@ -29,93 +25,6 @@ config_setting(
}, },
) )
config_setting(
name = "is_k8",
values = {"cpu": "k8"},
)
config_setting(
name = "is_darwin",
values = {"cpu": "darwin"},
)
selects.config_setting_group(
name = "is_x64",
match_any = [":is_k8", ":is_darwin"],
)
config_setting(
name = "is_arm64",
values = {
"host_cpu": "k8",
"cpu": "arm",
},
)
config_setting(
name = "is_ia32",
values = {
"host_cpu": "k8",
"cpu": "x86",
},
)
config_setting(
name = "is_arm",
values = {
"host_cpu": "k8",
"cpu": "armeabi-v7a",
},
)
selects.config_setting_group(
name = "is_32bits",
match_any = [":is_ia32", ":is_arm"],
)
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"],
)
selects.config_setting_group(
name = "is_posix",
match_any = [":is_linux", ":is_android", ":is_macos"],
)
config_setting(
name = "is_linux_x64",
constraint_values = ["@platforms//os:linux"],
values = {"cpu": "k8"},
)
config_setting(
name = "is_macos_x64",
constraint_values = ["@platforms//os:macos"],
values = {"cpu": "darwin"},
)
selects.config_setting_group(
name = "is_linux_x64_or_macos_x64",
match_any = [":is_linux_x64", ":is_macos_x64"],
)
config_setting(
name = "is_android_x86",
constraint_values = ["@platforms//os:android"],
values = {"cpu": "x86"},
)
# ================================================= # =================================================
# Flags # Flags
# ================================================= # =================================================
...@@ -165,6 +74,7 @@ config_setting( ...@@ -165,6 +74,7 @@ config_setting(
# v8_control_flow_integrity # v8_control_flow_integrity
# v8_enable_virtual_memory_cage # v8_enable_virtual_memory_cage
# cppgc_enable_caged_heap # cppgc_enable_caged_heap
# cppgc_enable_check_assignments_in_prefinalizers
# cppgc_enable_object_names # cppgc_enable_object_names
# cppgc_enable_verify_heap # cppgc_enable_verify_heap
# cppgc_enable_young_generation # cppgc_enable_young_generation
...@@ -179,48 +89,147 @@ config_setting( ...@@ -179,48 +89,147 @@ config_setting(
# v8_enable_allocation_folding # v8_enable_allocation_folding
# v8_allocation_site_tracking # v8_allocation_site_tracking
v8_string(name = "v8_root", default = ".") v8_string(
name = "v8_root",
default = "third_party/v8/HEAD",
)
v8_flag(name = "v8_android_log_stdout") v8_flag(name = "v8_android_log_stdout")
v8_flag(name = "v8_annotate_torque_ir") v8_flag(name = "v8_annotate_torque_ir")
v8_flag(name = "v8_code_comments") v8_flag(name = "v8_code_comments")
v8_flag(name = "v8_deprecation_warnings", default = True) v8_flag(
v8_flag(name = "v8_imminent_deprecation_warnings", default = True) name = "v8_deprecation_warnings",
default = True,
)
v8_flag(
name = "v8_imminent_deprecation_warnings",
default = True,
)
v8_flag(name = "v8_enable_backtrace") v8_flag(name = "v8_enable_backtrace")
v8_flag(name = "v8_enable_debug_code") v8_flag(name = "v8_enable_debug_code")
v8_flag(name = "v8_enable_disassembler") v8_flag(name = "v8_enable_disassembler")
v8_flag(name = "v8_enable_handle_zapping", default = True)
v8_flag(
name = "v8_enable_handle_zapping",
default = True,
)
v8_flag(name = "v8_enable_hugepage") v8_flag(name = "v8_enable_hugepage")
v8_flag(name = "v8_enable_fast_mksnapshot") v8_flag(name = "v8_enable_fast_mksnapshot")
v8_flag(name = "v8_enable_future") v8_flag(name = "v8_enable_future")
v8_flag(name = "v8_enable_i18n_support", default = True)
v8_flag(name = "v8_enable_lazy_source_positions", default = True) # NOTE: Transitions are not recommended in library targets:
v8_flag(name = "v8_enable_minor_mc", default = True) # https://groups.google.com/a/google.com/g/c-toolchain-team/c/W4nmWonD0ow/m/rLGyIL4YIQAJ
# Therefore we create multiple targets with and without ICU, instead of
# implementing the flag v8_enable_i18n_support.
v8_flag(
name = "v8_enable_lazy_source_positions",
default = True,
)
v8_flag(
name = "v8_enable_minor_mc",
default = True,
)
v8_flag(name = "v8_enable_object_print") v8_flag(name = "v8_enable_object_print")
v8_flag(name = "v8_enable_slow_dchecks") v8_flag(name = "v8_enable_slow_dchecks")
v8_flag(name = "v8_enable_snapshot_code_comments") v8_flag(name = "v8_enable_snapshot_code_comments")
v8_flag(name = "v8_enable_snapshot_native_code_counters") v8_flag(name = "v8_enable_snapshot_native_code_counters")
v8_flag(name = "v8_enable_trace_maps") v8_flag(name = "v8_enable_trace_maps")
v8_flag(name = "v8_enable_v8_checks") v8_flag(name = "v8_enable_v8_checks")
v8_flag(name = "v8_enable_verify_csa") v8_flag(name = "v8_enable_verify_csa")
v8_flag(name = "v8_enable_verify_heap") v8_flag(name = "v8_enable_verify_heap")
v8_flag(name = "v8_enable_verify_predictable") v8_flag(name = "v8_enable_verify_predictable")
v8_flag(name = "v8_enable_test_features") v8_flag(name = "v8_enable_test_features")
v8_flag(name = "v8_enable_webassembly", default = True)
v8_int(name = "v8_typed_array_max_size_in_heap", default = 64) v8_flag(
name = "v8_enable_webassembly",
default = True,
)
v8_int(
name = "v8_typed_array_max_size_in_heap",
default = 64,
)
# We use a string flag to create a 3 value-logic.
# If no explicit value for v8_enable_pointer_compression, we set it to 'none'.
v8_string(
name = "v8_enable_pointer_compression",
default = "none",
)
# Default setting for v8_enable_pointer_compression.
config_setting(
name = "v8_enable_pointer_compression_is_none",
flag_values = {
":v8_enable_pointer_compression": "none",
},
)
# Explicity defined v8_enable_pointer_compression.
config_setting(
name = "v8_enable_pointer_compression_is_true",
flag_values = {
":v8_enable_pointer_compression": "True",
},
)
# Default setting for v8_enable_pointer_compression when target is x64.
selects.config_setting_group(
name = "v8_target_x64_default_pointer_compression",
match_all = [
":v8_enable_pointer_compression_is_none",
"@config//:v8_target_x64",
],
)
# Pointer compression, true by default if x64 or arm64. # Default setting for v8_enable_pointer_compression when target is arm64.
v8_raw_flag(name = "v8_enable_pointer_compression") selects.config_setting_group(
name = "v8_target_arm64_default_pointer_compression",
match_all = [
":v8_enable_pointer_compression_is_none",
"@config//:v8_target_arm64",
],
)
# v8_enable_pointer_compression is valid whenever it is explicitly defined
# or we have the default settings for targets x64 and arm64.
selects.config_setting_group( selects.config_setting_group(
name = "is_v8_enable_pointer_compression", name = "is_v8_enable_pointer_compression",
match_any = [ ":raw_v8_enable_pointer_compression", ":is_x64", ":is_arm64" ], match_any = [
":v8_enable_pointer_compression_is_true",
":v8_target_x64_default_pointer_compression",
":v8_target_arm64_default_pointer_compression",
],
) )
# Pointer cage, true by default if v8_enable_pointer_compression. # Pointer cage, true by default if v8_enable_pointer_compression.
v8_flag(name = "v8_enable_pointer_compression_shared_cage", default = True) v8_flag(
name = "v8_enable_pointer_compression_shared_cage",
default = True,
)
# Enable shared cage if v8_enable_pointer_compression # Enable shared cage if v8_enable_pointer_compression
# and v8_enable_pointer_compression_shared_cage. # and v8_enable_pointer_compression_shared_cage.
selects.config_setting_group( selects.config_setting_group(
...@@ -230,6 +239,7 @@ selects.config_setting_group( ...@@ -230,6 +239,7 @@ selects.config_setting_group(
":is_v8_enable_pointer_compression_shared_cage", ":is_v8_enable_pointer_compression_shared_cage",
], ],
) )
# Enable isolated cage if v8_enable_pointer_compression and # Enable isolated cage if v8_enable_pointer_compression and
# NOT v8_enable_pointer_compression_shared_cage. # NOT v8_enable_pointer_compression_shared_cage.
selects.config_setting_group( selects.config_setting_group(
...@@ -243,7 +253,10 @@ selects.config_setting_group( ...@@ -243,7 +253,10 @@ selects.config_setting_group(
# Enable -rdynamic. # Enable -rdynamic.
selects.config_setting_group( selects.config_setting_group(
name = "should_add_rdynamic", name = "should_add_rdynamic",
match_all = [ ":is_linux", ":is_v8_enable_backtrace" ], match_all = [
"@config//:is_linux",
":is_v8_enable_backtrace",
],
) )
v8_custom_config(name = "default") v8_custom_config(name = "default")
...@@ -260,13 +273,11 @@ v8_config( ...@@ -260,13 +273,11 @@ v8_config(
"v8_enable_handle_zapping": "ENABLE_HANDLE_ZAPPING", "v8_enable_handle_zapping": "ENABLE_HANDLE_ZAPPING",
"v8_enable_hugepage": "ENABLE_HUGEPAGE", "v8_enable_hugepage": "ENABLE_HUGEPAGE",
"v8_enable_future": "V8_ENABLE_FUTURE", "v8_enable_future": "V8_ENABLE_FUTURE",
"v8_enable_i18n_support": "V8_INTL_SUPPORT",
"v8_enable_lazy_source_positions": "V8_ENABLE_LAZY_SOURCE_POSITIONS", "v8_enable_lazy_source_positions": "V8_ENABLE_LAZY_SOURCE_POSITIONS",
"v8_enable_minor_mc": "ENABLE_MINOR_MC", "v8_enable_minor_mc": "ENABLE_MINOR_MC",
"v8_enable_object_print": "OBJECT_PRINT", "v8_enable_object_print": "OBJECT_PRINT",
"v8_enable_slow_dchecks": "ENABLE_SLOW_DCHECKS", "v8_enable_slow_dchecks": "ENABLE_SLOW_DCHECKS",
"v8_enable_snapshot_native_code_counters": "v8_enable_snapshot_native_code_counters": "V8_SNAPSHOT_NATIVE_CODE_COUNTERS",
"V8_SNAPSHOT_NATIVE_CODE_COUNTERS",
"v8_enable_trace_maps": "V8_TRACE_MAPS", "v8_enable_trace_maps": "V8_TRACE_MAPS",
"v8_enable_v8_checks": "V8_ENABLE_CHECKS", "v8_enable_v8_checks": "V8_ENABLE_CHECKS",
"v8_enable_verify_csa": "ENABLE_VERIFY_CSA", "v8_enable_verify_csa": "ENABLE_VERIFY_CSA",
...@@ -277,30 +288,37 @@ v8_config( ...@@ -277,30 +288,37 @@ v8_config(
defines = [ defines = [
"GOOGLE3", "GOOGLE3",
"CHROMIUM_ZLIB_NO_CHROMECONF", "CHROMIUM_ZLIB_NO_CHROMECONF",
"ENABLE_DEBUGGER_SUPPORT",
"V8_ADVANCED_BIGINT_ALGORITHMS", "V8_ADVANCED_BIGINT_ALGORITHMS",
"V8_CONCURRENT_MARKING", "V8_CONCURRENT_MARKING",
] + select({ ] + select({
":is_debug": [ "DEBUG" ], ":is_debug": [
"DEBUG",
"V8_ENABLE_CHECKS",
],
"//conditions:default": [], "//conditions:default": [],
}) + select({ }) + select(
":is_ia32": [ "V8_TARGET_ARCH_IA32" ], {
":is_x64": [ "V8_TARGET_ARCH_X64" ], "@config//:v8_target_ia32": ["V8_TARGET_ARCH_IA32"],
":is_arm": [ "@config//:v8_target_x64": ["V8_TARGET_ARCH_X64"],
"@config//:v8_target_arm": [
"V8_TARGET_ARCH_ARM", "V8_TARGET_ARCH_ARM",
"CAN_USE_ARMV7_INSTRUCTIONS", "CAN_USE_ARMV7_INSTRUCTIONS",
"CAN_USE_VFP3_INSTRUCTIONS", "CAN_USE_VFP3_INSTRUCTIONS",
], ],
":is_arm64": [ "V8_TARGET_ARCH_ARM64" ], "@config//:v8_target_arm64": ["V8_TARGET_ARCH_ARM64"],
}) + select({ },
":is_android": [ no_match_error = "Please specify a target cpu supported by v8",
) + select({
"@config//:is_android": [
"V8_HAVE_TARGET_OS", "V8_HAVE_TARGET_OS",
"V8_TARGET_OS_ANDROID", "V8_TARGET_OS_ANDROID",
], ],
":is_linux": [ "@config//:is_linux": [
"V8_HAVE_TARGET_OS", "V8_HAVE_TARGET_OS",
"V8_TARGET_OS_LINUX", "V8_TARGET_OS_LINUX",
], ],
":is_macos": [ "@config//:is_macos": [
"V8_HAVE_TARGET_OS", "V8_HAVE_TARGET_OS",
"V8_TARGET_OS_MACOSX", "V8_TARGET_OS_MACOSX",
], ],
...@@ -312,10 +330,10 @@ v8_config( ...@@ -312,10 +330,10 @@ v8_config(
"//conditions:default": [], "//conditions:default": [],
}) + select({ }) + select({
":enable_pointer_compression_shared_cage": [ ":enable_pointer_compression_shared_cage": [
"V8_COMPRESS_POINTERS_IN_SHARED_CAGE" "V8_COMPRESS_POINTERS_IN_SHARED_CAGE",
], ],
":enable_pointer_compression_isolated_cage": [ ":enable_pointer_compression_isolated_cage": [
"V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE" "V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE",
], ],
"//conditions:default": [], "//conditions:default": [],
}) + select({ }) + select({
...@@ -326,7 +344,7 @@ v8_config( ...@@ -326,7 +344,7 @@ v8_config(
], ],
"//conditions:default": [], "//conditions:default": [],
}), }),
deps = [ ":default" ], deps = [":default"],
) )
# ================================================= # =================================================
...@@ -345,8 +363,8 @@ filegroup( ...@@ -345,8 +363,8 @@ filegroup(
name = "v8_version_files", name = "v8_version_files",
srcs = [ srcs = [
"include/v8-value-serializer-version.h", "include/v8-value-serializer-version.h",
"include/v8-version-string.h",
"include/v8-version.h", "include/v8-version.h",
"include/v8-version-string.h",
], ],
) )
...@@ -361,10 +379,10 @@ filegroup( ...@@ -361,10 +379,10 @@ filegroup(
"include/cppgc/ephemeron-pair.h", "include/cppgc/ephemeron-pair.h",
"include/cppgc/explicit-management.h", "include/cppgc/explicit-management.h",
"include/cppgc/garbage-collected.h", "include/cppgc/garbage-collected.h",
"include/cppgc/heap.h",
"include/cppgc/heap-consistency.h", "include/cppgc/heap-consistency.h",
"include/cppgc/heap-state.h", "include/cppgc/heap-state.h",
"include/cppgc/heap-statistics.h", "include/cppgc/heap-statistics.h",
"include/cppgc/heap.h",
"include/cppgc/internal/api-constants.h", "include/cppgc/internal/api-constants.h",
"include/cppgc/internal/atomic-entry-flag.h", "include/cppgc/internal/atomic-entry-flag.h",
"include/cppgc/internal/caged-heap-local-data.h", "include/cppgc/internal/caged-heap-local-data.h",
...@@ -391,14 +409,13 @@ filegroup( ...@@ -391,14 +409,13 @@ filegroup(
"include/cppgc/trace-trait.h", "include/cppgc/trace-trait.h",
"include/cppgc/type-traits.h", "include/cppgc/type-traits.h",
"include/cppgc/visitor.h", "include/cppgc/visitor.h",
] ],
) )
filegroup( filegroup(
name = "v8_headers_files", name = "v8_headers_files",
srcs = [ srcs = [
":cppgc_headers_files", "include/v8.h",
":v8_version_files",
"include/v8-array-buffer.h", "include/v8-array-buffer.h",
"include/v8-callbacks.h", "include/v8-callbacks.h",
"include/v8-container.h", "include/v8-container.h",
...@@ -424,12 +441,12 @@ filegroup( ...@@ -424,12 +441,12 @@ filegroup(
"include/v8-maybe.h", "include/v8-maybe.h",
"include/v8-memory-span.h", "include/v8-memory-span.h",
"include/v8-message.h", "include/v8-message.h",
"include/v8-microtask-queue.h",
"include/v8-microtask.h", "include/v8-microtask.h",
"include/v8-microtask-queue.h",
"include/v8-object.h", "include/v8-object.h",
"include/v8-persistent-handle.h", "include/v8-persistent-handle.h",
"include/v8-primitive-object.h",
"include/v8-primitive.h", "include/v8-primitive.h",
"include/v8-primitive-object.h",
"include/v8-profiler.h", "include/v8-profiler.h",
"include/v8-promise.h", "include/v8-promise.h",
"include/v8-proxy.h", "include/v8-proxy.h",
...@@ -442,11 +459,12 @@ filegroup( ...@@ -442,11 +459,12 @@ filegroup(
"include/v8-typed-array.h", "include/v8-typed-array.h",
"include/v8-unwinder.h", "include/v8-unwinder.h",
"include/v8-util.h", "include/v8-util.h",
"include/v8-value-serializer.h",
"include/v8-value.h", "include/v8-value.h",
"include/v8-value-serializer.h",
"include/v8-wasm.h", "include/v8-wasm.h",
"include/v8-weak-callback-info.h", "include/v8-weak-callback-info.h",
"include/v8.h", ":cppgc_headers_files",
":v8_version_files",
], ],
) )
...@@ -456,7 +474,7 @@ filegroup( ...@@ -456,7 +474,7 @@ filegroup(
"src/flags/flag-definitions.h", "src/flags/flag-definitions.h",
"src/flags/flags.h", "src/flags/flags.h",
] + select({ ] + select({
"is_v8_enable_webassembly": [ "src/wasm/wasm-feature-flags.h" ], "is_v8_enable_webassembly": ["src/wasm/wasm-feature-flags.h"],
"//conditions:default": [], "//conditions:default": [],
}), }),
) )
...@@ -577,7 +595,7 @@ filegroup( ...@@ -577,7 +595,7 @@ filegroup(
"src/base/vlq-base64.cc", "src/base/vlq-base64.cc",
"src/base/vlq-base64.h", "src/base/vlq-base64.h",
] + select({ ] + select({
":is_posix": [ "@config//:is_posix": [
"src/base/platform/platform-posix.cc", "src/base/platform/platform-posix.cc",
"src/base/platform/platform-posix.h", "src/base/platform/platform-posix.h",
"src/base/platform/platform-posix-time.cc", "src/base/platform/platform-posix-time.cc",
...@@ -585,15 +603,15 @@ filegroup( ...@@ -585,15 +603,15 @@ filegroup(
], ],
"//conditions:default": [], "//conditions:default": [],
}) + select({ }) + select({
":is_linux": [ "@config//:is_linux": [
"src/base/debug/stack_trace_posix.cc", "src/base/debug/stack_trace_posix.cc",
"src/base/platform/platform-linux.cc", "src/base/platform/platform-linux.cc",
], ],
"is_android": [ "@config//:is_android": [
"src/base/debug/stack_trace_android.cc", "src/base/debug/stack_trace_android.cc",
"src/base/platform/platform-linux.cc", "src/base/platform/platform-linux.cc",
], ],
"is_macos": [ "@config//:is_macos": [
"src/base/debug/stack_trace_posix.cc", "src/base/debug/stack_trace_posix.cc",
"src/base/platform/platform-macos.cc", "src/base/platform/platform-macos.cc",
], ],
...@@ -643,11 +661,11 @@ filegroup( ...@@ -643,11 +661,11 @@ filegroup(
filegroup( filegroup(
name = "torque_runtime_support_files", name = "torque_runtime_support_files",
srcs = [ "src/torque/runtime-support.h" ], srcs = ["src/torque/runtime-support.h"],
) )
filegroup( filegroup(
name = "torque_files", name = "noicu/torque_files",
srcs = [ srcs = [
"src/builtins/aggregate-error.tq", "src/builtins/aggregate-error.tq",
"src/builtins/array-at.tq", "src/builtins/array-at.tq",
...@@ -846,8 +864,12 @@ filegroup( ...@@ -846,8 +864,12 @@ filegroup(
"src/wasm/wasm-objects.tq", "src/wasm/wasm-objects.tq",
], ],
"//conditions:default": [], "//conditions:default": [],
}) + select({ }),
":is_v8_enable_i18n_support": [ )
filegroup(
name = "icu/torque_files",
srcs = [
"src/objects/intl-objects.tq", "src/objects/intl-objects.tq",
"src/objects/js-break-iterator.tq", "src/objects/js-break-iterator.tq",
"src/objects/js-collator.tq", "src/objects/js-collator.tq",
...@@ -861,9 +883,8 @@ filegroup( ...@@ -861,9 +883,8 @@ filegroup(
"src/objects/js-segment-iterator.tq", "src/objects/js-segment-iterator.tq",
"src/objects/js-segmenter.tq", "src/objects/js-segmenter.tq",
"src/objects/js-segments.tq", "src/objects/js-segments.tq",
":noicu/torque_files",
], ],
"//conditions:default": [],
})
) )
filegroup( filegroup(
...@@ -1858,17 +1879,17 @@ filegroup( ...@@ -1858,17 +1879,17 @@ filegroup(
"src/runtime/runtime-weak-refs.cc", "src/runtime/runtime-weak-refs.cc",
"src/runtime/runtime.cc", "src/runtime/runtime.cc",
"src/runtime/runtime.h", "src/runtime/runtime.h",
"src/security/external-pointer-table.cc",
"src/security/vm-cage.cc",
"src/security/external-pointer-inl.h",
"src/security/external-pointer-table.h",
"src/security/external-pointer.h",
"src/security/vm-cage.h",
"src/base/sanitizer/asan.h", "src/base/sanitizer/asan.h",
"src/base/sanitizer/lsan-page-allocator.cc", "src/base/sanitizer/lsan-page-allocator.cc",
"src/base/sanitizer/lsan-page-allocator.h", "src/base/sanitizer/lsan-page-allocator.h",
"src/base/sanitizer/msan.h", "src/base/sanitizer/msan.h",
"src/base/sanitizer/tsan.h", "src/base/sanitizer/tsan.h",
"src/security/external-pointer-table.cc",
"src/security/external-pointer-table.h",
"src/security/external-pointer-inl.h",
"src/security/external-pointer.h",
"src/security/vm-cage.cc",
"src/security/vm-cage.h",
"src/snapshot/code-serializer.cc", "src/snapshot/code-serializer.cc",
"src/snapshot/code-serializer.h", "src/snapshot/code-serializer.h",
"src/snapshot/context-deserializer.cc", "src/snapshot/context-deserializer.cc",
...@@ -1892,10 +1913,16 @@ filegroup( ...@@ -1892,10 +1913,16 @@ filegroup(
"src/snapshot/serializer-deserializer.cc", "src/snapshot/serializer-deserializer.cc",
"src/snapshot/serializer-deserializer.h", "src/snapshot/serializer-deserializer.h",
"src/snapshot/serializer.cc", "src/snapshot/serializer.cc",
"src/snapshot/serializer.h",
"src/snapshot/serializer-inl.h", "src/snapshot/serializer-inl.h",
"src/snapshot/serializer.h",
"src/snapshot/shared-heap-deserializer.h",
"src/snapshot/shared-heap-deserializer.cc",
"src/snapshot/shared-heap-serializer.h",
"src/snapshot/shared-heap-serializer.cc",
"src/snapshot/snapshot-compression.cc", "src/snapshot/snapshot-compression.cc",
"src/snapshot/snapshot-compression.h", "src/snapshot/snapshot-compression.h",
"third_party/zlib/google/compression_utils_portable.h",
"third_party/zlib/google/compression_utils_portable.cc",
"src/snapshot/snapshot-data.cc", "src/snapshot/snapshot-data.cc",
"src/snapshot/snapshot-data.h", "src/snapshot/snapshot-data.h",
"src/snapshot/snapshot-source-sink.cc", "src/snapshot/snapshot-source-sink.cc",
...@@ -1904,10 +1931,6 @@ filegroup( ...@@ -1904,10 +1931,6 @@ filegroup(
"src/snapshot/snapshot-utils.h", "src/snapshot/snapshot-utils.h",
"src/snapshot/snapshot.cc", "src/snapshot/snapshot.cc",
"src/snapshot/snapshot.h", "src/snapshot/snapshot.h",
"src/snapshot/shared-heap-deserializer.cc",
"src/snapshot/shared-heap-deserializer.h",
"src/snapshot/shared-heap-serializer.cc",
"src/snapshot/shared-heap-serializer.h",
"src/snapshot/startup-deserializer.cc", "src/snapshot/startup-deserializer.cc",
"src/snapshot/startup-deserializer.h", "src/snapshot/startup-deserializer.h",
"src/snapshot/startup-serializer.cc", "src/snapshot/startup-serializer.cc",
...@@ -2002,7 +2025,7 @@ filegroup( ...@@ -2002,7 +2025,7 @@ filegroup(
"src/heap/third-party/heap-api.h", "src/heap/third-party/heap-api.h",
"src/heap/third-party/heap-api-stub.cc", "src/heap/third-party/heap-api-stub.cc",
] + select({ ] + select({
":is_ia32": [ "@config//:v8_target_ia32": [
"src/baseline/ia32/baseline-assembler-ia32-inl.h", "src/baseline/ia32/baseline-assembler-ia32-inl.h",
"src/baseline/ia32/baseline-compiler-ia32-inl.h", "src/baseline/ia32/baseline-compiler-ia32-inl.h",
"src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.h", "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.h",
...@@ -2028,10 +2051,9 @@ filegroup( ...@@ -2028,10 +2051,9 @@ filegroup(
"src/execution/ia32/frame-constants-ia32.h", "src/execution/ia32/frame-constants-ia32.h",
"src/regexp/ia32/regexp-macro-assembler-ia32.cc", "src/regexp/ia32/regexp-macro-assembler-ia32.cc",
"src/regexp/ia32/regexp-macro-assembler-ia32.h", "src/regexp/ia32/regexp-macro-assembler-ia32.h",
"src/third_party/valgrind/valgrind.h",
"src/wasm/baseline/ia32/liftoff-assembler-ia32.h", "src/wasm/baseline/ia32/liftoff-assembler-ia32.h",
], ],
":is_x64": [ "@config//:v8_target_x64": [
"src/baseline/x64/baseline-assembler-x64-inl.h", "src/baseline/x64/baseline-assembler-x64-inl.h",
"src/baseline/x64/baseline-compiler-x64-inl.h", "src/baseline/x64/baseline-compiler-x64-inl.h",
"src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.h", "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.h",
...@@ -2061,10 +2083,9 @@ filegroup( ...@@ -2061,10 +2083,9 @@ filegroup(
"src/execution/x64/frame-constants-x64.h", "src/execution/x64/frame-constants-x64.h",
"src/regexp/x64/regexp-macro-assembler-x64.cc", "src/regexp/x64/regexp-macro-assembler-x64.cc",
"src/regexp/x64/regexp-macro-assembler-x64.h", "src/regexp/x64/regexp-macro-assembler-x64.h",
"src/third_party/valgrind/valgrind.h",
"src/wasm/baseline/x64/liftoff-assembler-x64.h", "src/wasm/baseline/x64/liftoff-assembler-x64.h",
], ],
"is_arm": [ "@config//:v8_target_arm": [
"src/baseline/arm/baseline-assembler-arm-inl.h", "src/baseline/arm/baseline-assembler-arm-inl.h",
"src/baseline/arm/baseline-compiler-arm-inl.h", "src/baseline/arm/baseline-compiler-arm-inl.h",
"src/codegen/arm/assembler-arm-inl.h", "src/codegen/arm/assembler-arm-inl.h",
...@@ -2095,7 +2116,7 @@ filegroup( ...@@ -2095,7 +2116,7 @@ filegroup(
"src/regexp/arm/regexp-macro-assembler-arm.h", "src/regexp/arm/regexp-macro-assembler-arm.h",
"src/wasm/baseline/arm/liftoff-assembler-arm.h", "src/wasm/baseline/arm/liftoff-assembler-arm.h",
], ],
":is_arm64": [ "@config//:v8_target_arm64": [
"src/baseline/arm64/baseline-assembler-arm64-inl.h", "src/baseline/arm64/baseline-assembler-arm64-inl.h",
"src/baseline/arm64/baseline-compiler-arm64-inl.h", "src/baseline/arm64/baseline-compiler-arm64-inl.h",
"src/codegen/arm64/assembler-arm64-inl.h", "src/codegen/arm64/assembler-arm64-inl.h",
...@@ -2139,11 +2160,18 @@ filegroup( ...@@ -2139,11 +2160,18 @@ filegroup(
"src/wasm/baseline/arm64/liftoff-assembler-arm64.h", "src/wasm/baseline/arm64/liftoff-assembler-arm64.h",
], ],
}) + select({ }) + select({
":is_linux_x64_or_macos_x64": [ # Only for x64 builds and for arm64 with x64 host simulator.
"@config//:is_x64": [
"src/trap-handler/handler-inside-posix.cc", "src/trap-handler/handler-inside-posix.cc",
"src/trap-handler/handler-outside-posix.cc", "src/trap-handler/handler-outside-posix.cc",
], ],
"//conditions:default": [], "//conditions:default": [],
}) + select({
"@config//:v8_arm64_simulator": [
"src/trap-handler/trap-handler-simulator.h",
"src/trap-handler/handler-outside-simulator.cc",
],
"//conditions:default": [],
}) + select({ }) + select({
":is_v8_enable_webassembly": [ ":is_v8_enable_webassembly": [
"src/asmjs/asm-js.cc", "src/asmjs/asm-js.cc",
...@@ -2250,8 +2278,12 @@ filegroup( ...@@ -2250,8 +2278,12 @@ filegroup(
"src/wasm/wasm-value.h", "src/wasm/wasm-value.h",
], ],
"//conditions:default": [], "//conditions:default": [],
}) + select({ }),
":is_v8_enable_i18n_support": [ )
filegroup(
name = "icu/v8_base_without_compiler_files",
srcs = [
"src/builtins/builtins-intl.cc", "src/builtins/builtins-intl.cc",
"src/builtins/builtins-intl-gen.cc", "src/builtins/builtins-intl-gen.cc",
"src/objects/intl-objects.cc", "src/objects/intl-objects.cc",
...@@ -2283,21 +2315,18 @@ filegroup( ...@@ -2283,21 +2315,18 @@ filegroup(
"src/objects/js-relative-time-format.cc", "src/objects/js-relative-time-format.cc",
"src/objects/js-relative-time-format.h", "src/objects/js-relative-time-format.h",
"src/objects/js-relative-time-format-inl.h", "src/objects/js-relative-time-format-inl.h",
"src/objects/js-segmenter.cc",
"src/objects/js-segmenter.h",
"src/objects/js-segmenter-inl.h",
"src/objects/js-segment-iterator.cc", "src/objects/js-segment-iterator.cc",
"src/objects/js-segment-iterator.h", "src/objects/js-segment-iterator.h",
"src/objects/js-segment-iterator-inl.h", "src/objects/js-segment-iterator-inl.h",
"src/objects/js-segmenter.cc",
"src/objects/js-segmenter.h",
"src/objects/js-segmenter-inl.h",
"src/objects/js-segments.cc", "src/objects/js-segments.cc",
"src/objects/js-segments.h", "src/objects/js-segments.h",
"src/objects/js-segments-inl.h", "src/objects/js-segments-inl.h",
"src/runtime/runtime-intl.cc", "src/runtime/runtime-intl.cc",
"src/strings/char-predicates.cc", "src/strings/char-predicates.cc",
], ],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
) )
filegroup( filegroup(
...@@ -2549,8 +2578,6 @@ filegroup( ...@@ -2549,8 +2578,6 @@ filegroup(
}), }),
) )
filegroup( filegroup(
name = "v8_initializers_files", name = "v8_initializers_files",
srcs = [ srcs = [
...@@ -2622,10 +2649,10 @@ filegroup( ...@@ -2622,10 +2649,10 @@ filegroup(
"src/interpreter/interpreter-intrinsics-generator.cc", "src/interpreter/interpreter-intrinsics-generator.cc",
"src/interpreter/interpreter-intrinsics-generator.h", "src/interpreter/interpreter-intrinsics-generator.h",
] + select({ ] + select({
":is_ia32": ["src/builtins/ia32/builtins-ia32.cc"], "@config//:v8_target_ia32": ["src/builtins/ia32/builtins-ia32.cc"],
":is_x64": ["src/builtins/x64/builtins-x64.cc"], "@config//:v8_target_x64": ["src/builtins/x64/builtins-x64.cc"],
":is_arm" : ["src/builtins/arm/builtins-arm.cc"], "@config//:v8_target_arm": ["src/builtins/arm/builtins-arm.cc"],
":is_arm64": ["src/builtins/arm64/builtins-arm64.cc"], "@config//:v8_target_arm64": ["src/builtins/arm64/builtins-arm64.cc"],
}) + select({ }) + select({
":is_v8_enable_webassembly": [ ":is_v8_enable_webassembly": [
"src/builtins/builtins-wasm-gen.cc", "src/builtins/builtins-wasm-gen.cc",
...@@ -2738,19 +2765,22 @@ filegroup( ...@@ -2738,19 +2765,22 @@ filegroup(
"src/heap/base/worklist.h", "src/heap/base/worklist.h",
"src/heap/cppgc/globals.h", "src/heap/cppgc/globals.h",
] + select({ ] + select({
":is_ia32": ["src/heap/base/asm/ia32/push_registers_asm.cc"], # Note these cannot be v8_target_is_* selects because these contain
":is_x64": ["src/heap/base/asm/x64/push_registers_asm.cc"], # inline assembly that runs inside the executable. Since these are
":is_arm" : ["src/heap/base/asm/arm/push_registers_asm.cc"], # linked directly into mksnapshot, they must use the actual target cpu.
":is_arm64": ["src/heap/base/asm/arm64/push_registers_asm.cc"], "@config//:is_ia32": ["src/heap/base/asm/ia32/push_registers_asm.cc"],
"@config//:is_x64": ["src/heap/base/asm/x64/push_registers_asm.cc"],
"@config//:is_arm": ["src/heap/base/asm/arm/push_registers_asm.cc"],
"@config//:is_arm64": ["src/heap/base/asm/arm64/push_registers_asm.cc"],
}), }),
) )
filegroup( filegroup(
name = "v8_bigint", name = "v8_bigint",
srcs = [ srcs = [
"src/bigint/bigint.h",
"src/bigint/bigint-internal.cc", "src/bigint/bigint-internal.cc",
"src/bigint/bigint-internal.h", "src/bigint/bigint-internal.h",
"src/bigint/bigint.h",
"src/bigint/bitwise.cc", "src/bigint/bitwise.cc",
"src/bigint/digit-arithmetic.h", "src/bigint/digit-arithmetic.h",
"src/bigint/div-barrett.cc", "src/bigint/div-barrett.cc",
...@@ -2773,6 +2803,7 @@ filegroup( ...@@ -2773,6 +2803,7 @@ filegroup(
filegroup( filegroup(
name = "mksnapshot_files", name = "mksnapshot_files",
srcs = [ srcs = [
"src/init/setup-isolate-full.cc",
"src/snapshot/embedded/embedded-empty.cc", "src/snapshot/embedded/embedded-empty.cc",
"src/snapshot/embedded/embedded-file-writer.cc", "src/snapshot/embedded/embedded-file-writer.cc",
"src/snapshot/embedded/embedded-file-writer.h", "src/snapshot/embedded/embedded-file-writer.h",
...@@ -2788,8 +2819,7 @@ filegroup( ...@@ -2788,8 +2819,7 @@ filegroup(
"src/snapshot/embedded/platform-embedded-file-writer-win.h", "src/snapshot/embedded/platform-embedded-file-writer-win.h",
"src/snapshot/mksnapshot.cc", "src/snapshot/mksnapshot.cc",
"src/snapshot/snapshot-empty.cc", "src/snapshot/snapshot-empty.cc",
"src/init/setup-isolate-full.cc", ],
]
) )
filegroup( filegroup(
...@@ -2821,6 +2851,8 @@ filegroup( ...@@ -2821,6 +2851,8 @@ filegroup(
"src/inspector/v8-debugger.h", "src/inspector/v8-debugger.h",
"src/inspector/v8-debugger-agent-impl.cc", "src/inspector/v8-debugger-agent-impl.cc",
"src/inspector/v8-debugger-agent-impl.h", "src/inspector/v8-debugger-agent-impl.h",
"src/inspector/v8-debugger-id.cc",
"src/inspector/v8-debugger-id.h",
"src/inspector/v8-debugger-script.cc", "src/inspector/v8-debugger-script.cc",
"src/inspector/v8-debugger-script.h", "src/inspector/v8-debugger-script.h",
"src/inspector/v8-heap-profiler-agent-impl.cc", "src/inspector/v8-heap-profiler-agent-impl.cc",
...@@ -2843,8 +2875,6 @@ filegroup( ...@@ -2843,8 +2875,6 @@ filegroup(
"src/inspector/v8-string-conversions.h", "src/inspector/v8-string-conversions.h",
"src/inspector/v8-value-utils.cc", "src/inspector/v8-value-utils.cc",
"src/inspector/v8-value-utils.h", "src/inspector/v8-value-utils.h",
"src/inspector/v8-debugger-id.h",
"src/inspector/v8-debugger-id.cc",
"src/inspector/value-mirror.cc", "src/inspector/value-mirror.cc",
"src/inspector/value-mirror.h", "src/inspector/value-mirror.h",
":crdtp_platform_files", ":crdtp_platform_files",
...@@ -2866,7 +2896,6 @@ filegroup( ...@@ -2866,7 +2896,6 @@ filegroup(
srcs = [ srcs = [
"third_party/inspector_protocol/crdtp/cbor.cc", "third_party/inspector_protocol/crdtp/cbor.cc",
"third_party/inspector_protocol/crdtp/cbor.h", "third_party/inspector_protocol/crdtp/cbor.h",
"third_party/inspector_protocol/crdtp/maybe.h",
"third_party/inspector_protocol/crdtp/dispatch.cc", "third_party/inspector_protocol/crdtp/dispatch.cc",
"third_party/inspector_protocol/crdtp/dispatch.h", "third_party/inspector_protocol/crdtp/dispatch.h",
"third_party/inspector_protocol/crdtp/error_support.cc", "third_party/inspector_protocol/crdtp/error_support.cc",
...@@ -2875,11 +2904,12 @@ filegroup( ...@@ -2875,11 +2904,12 @@ filegroup(
"third_party/inspector_protocol/crdtp/find_by_first.h", "third_party/inspector_protocol/crdtp/find_by_first.h",
"third_party/inspector_protocol/crdtp/frontend_channel.h", "third_party/inspector_protocol/crdtp/frontend_channel.h",
"third_party/inspector_protocol/crdtp/glue.h", "third_party/inspector_protocol/crdtp/glue.h",
"third_party/inspector_protocol/crdtp/protocol_core.h",
"third_party/inspector_protocol/crdtp/protocol_core.cc",
"third_party/inspector_protocol/crdtp/json.cc", "third_party/inspector_protocol/crdtp/json.cc",
"third_party/inspector_protocol/crdtp/json.h", "third_party/inspector_protocol/crdtp/json.h",
"third_party/inspector_protocol/crdtp/maybe.h",
"third_party/inspector_protocol/crdtp/parser_handler.h", "third_party/inspector_protocol/crdtp/parser_handler.h",
"third_party/inspector_protocol/crdtp/protocol_core.cc",
"third_party/inspector_protocol/crdtp/protocol_core.h",
"third_party/inspector_protocol/crdtp/serializable.cc", "third_party/inspector_protocol/crdtp/serializable.cc",
"third_party/inspector_protocol/crdtp/serializable.h", "third_party/inspector_protocol/crdtp/serializable.h",
"third_party/inspector_protocol/crdtp/serializer_traits.h", "third_party/inspector_protocol/crdtp/serializer_traits.h",
...@@ -2891,12 +2921,39 @@ filegroup( ...@@ -2891,12 +2921,39 @@ filegroup(
) )
filegroup( filegroup(
name = "snapshot_files", name = "noicu/snapshot_files",
srcs = [
"src/init/setup-isolate-deserialize.cc",
] + select({
"@config//:v8_target_arm": [
"google3/snapshots/arm/noicu/embedded.S",
"google3/snapshots/arm/noicu/snapshot.cc",
],
"@config//:v8_target_ia32": [
"google3/snapshots/ia32/noicu/embedded.S",
"google3/snapshots/ia32/noicu/snapshot.cc",
],
"@config//:v8_target_arm64": [":noicu/generated_snapshot_files"],
"@config//:v8_target_x64": [":noicu/generated_snapshot_files"],
}),
)
filegroup(
name = "icu/snapshot_files",
srcs = [ srcs = [
"src/init/setup-isolate-deserialize.cc", "src/init/setup-isolate-deserialize.cc",
# TODO(victorgomes): Create a flag to select pregenerated snapshots. ] + select({
":generated_snapshot_files", "@config//:v8_target_arm": [
] "google3/snapshots/arm/icu/embedded.S",
"google3/snapshots/arm/icu/snapshot.cc",
],
"@config//:v8_target_ia32": [
"google3/snapshots/ia32/icu/embedded.S",
"google3/snapshots/ia32/icu/snapshot.cc",
],
"@config//:v8_target_arm64": [":icu/generated_snapshot_files"],
"@config//:v8_target_x64": [":icu/generated_snapshot_files"],
}),
) )
filegroup( filegroup(
...@@ -2906,7 +2963,7 @@ filegroup( ...@@ -2906,7 +2963,7 @@ filegroup(
"src/wasm/c-api.h", "src/wasm/c-api.h",
"third_party/wasm-api/wasm.h", "third_party/wasm-api/wasm.h",
"third_party/wasm-api/wasm.hh", "third_party/wasm-api/wasm.hh",
] ],
) )
# ================================================= # =================================================
...@@ -2917,7 +2974,13 @@ filegroup( ...@@ -2917,7 +2974,13 @@ filegroup(
# which needs class-debug-readers and debug-macros. # which needs class-debug-readers and debug-macros.
v8_torque( v8_torque(
name = "generated_torque_files", name = "generated_torque_files",
srcs = [":torque_files"], args = select({
":is_v8_annotate_torque_ir": ["-annotate-ir"],
"//conditions:default": [],
}) + select({
"@config//:v8_target_is_32_bits": ["-m32"],
"//conditions:default": [],
}),
extras = [ extras = [
"bit-fields.h", "bit-fields.h",
"builtin-definitions.h", "builtin-definitions.h",
...@@ -2940,18 +3003,13 @@ v8_torque( ...@@ -2940,18 +3003,13 @@ v8_torque(
"objects-printer.cc", "objects-printer.cc",
"visitor-lists.h", "visitor-lists.h",
], ],
args = select({ icu_srcs = [":icu/torque_files"],
":is_v8_annotate_torque_ir": [ "-annotate-ir" ], noicu_srcs = [":noicu/torque_files"],
"//conditions:default": [],
}) + select({
":is_32bits": [ "-m32" ],
"//conditions:default": [],
}),
) )
genrule( genrule(
name = "generated_inspector_files", name = "generated_inspector_files",
srcs = [ "include/js_protocol.pdl" ], srcs = ["include/js_protocol.pdl"],
outs = [ outs = [
"include/inspector/Debugger.h", "include/inspector/Debugger.h",
"include/inspector/Runtime.h", "include/inspector/Runtime.h",
...@@ -2972,9 +3030,38 @@ genrule( ...@@ -2972,9 +3030,38 @@ genrule(
"src/inspector/protocol/Schema.cpp", "src/inspector/protocol/Schema.cpp",
"src/inspector/protocol/Schema.h", "src/inspector/protocol/Schema.h",
], ],
message = "Generating inspector files",
cmd = "bazel/generate-inspector-files.sh $(@D)", cmd = "bazel/generate-inspector-files.sh $(@D)",
local = 1, local = 1,
message = "Generating inspector files",
)
filegroup(
name = "v8_common_libshared_files",
srcs = [
":torque_runtime_support_files",
":v8_compiler_files",
":v8_initializers_files",
":v8_libplatform_files",
":v8_libsampler_files",
":v8_shared_internal_headers",
],
)
filegroup(
name = "d8_files",
srcs = [
"src/d8/async-hooks-wrapper.cc",
"src/d8/async-hooks-wrapper.h",
"src/d8/d8.cc",
"src/d8/d8.h",
"src/d8/d8-console.cc",
"src/d8/d8-console.h",
"src/d8/d8-js.cc",
"src/d8/d8-platforms.cc",
"src/d8/d8-platforms.h",
"src/d8/d8-posix.cc",
"src/d8/d8-test.cc",
],
) )
genrule( genrule(
...@@ -2996,7 +3083,7 @@ genrule( ...@@ -2996,7 +3083,7 @@ genrule(
v8_mksnapshot( v8_mksnapshot(
name = "generated_snapshot_files", name = "generated_snapshot_files",
args = select({ args = select({
":is_v8_enable_verify_heap": [ "--verify-heap" ], ":is_v8_enable_verify_heap": ["--verify-heap"],
"//conditions:default": [], "//conditions:default": [],
}) + select({ }) + select({
":is_v8_enable_fast_mksnapshot": [ ":is_v8_enable_fast_mksnapshot": [
...@@ -3005,30 +3092,38 @@ v8_mksnapshot( ...@@ -3005,30 +3092,38 @@ v8_mksnapshot(
], ],
"//conditions:default": [], "//conditions:default": [],
}) + select({ }) + select({
":is_v8_enable_snapshot_code_comments": [ "--code-comments" ], ":is_v8_enable_snapshot_code_comments": ["--code-comments"],
"//conditions:default": [], "//conditions:default": [],
}) + select({ }) + select({
":is_v8_enable_snapshot_native_code_counters": [ ":is_v8_enable_snapshot_native_code_counters": [
"--native-code-counters" "--native-code-counters",
], ],
"//conditions:default": [ "--no-native-code-counters" ], "//conditions:default": ["--no-native-code-counters"],
}) }),
) )
# ================================================= # =================================================
# Libraries rules # Libraries rules
# ================================================= # =================================================
# NOTE: This allow headers to be accessed without the icu/noicu prefixes.
cc_library( cc_library(
name = "torque_base", name = "icu/generated_torque_headers",
hdrs = [":icu/generated_torque_files"],
strip_include_prefix = "icu",
)
cc_library(
name = "noicu/generated_torque_headers",
hdrs = [":noicu/generated_torque_files"],
strip_include_prefix = "noicu",
)
v8_library(
name = "v8_libbase",
srcs = [ srcs = [
":torque_base_files", ":v8_libbase_files",
], ":v8_shared_internal_headers",
copts = ["-fexceptions"],
features = ["-use_header_modules"],
visibility = ["//visibility:public"],
deps = [
":torque_base_headers",
":v8_libbase",
], ],
) )
...@@ -3043,52 +3138,71 @@ cc_library( ...@@ -3043,52 +3138,71 @@ cc_library(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
v8_library( cc_library(
name = "v8_libbase", name = "torque_base",
srcs = [ srcs = [
":v8_shared_internal_headers", ":torque_base_files",
":v8_libbase_files", ],
copts = ["-fexceptions"],
features = ["-use_header_modules"],
visibility = ["//visibility:public"],
deps = [
":torque_base_headers",
":v8_libbase",
], ],
) )
v8_library( v8_library(
name = "v8_libshared", name = "v8_libshared",
srcs = [ srcs = [
":generated_torque_files",
":torque_runtime_support_files",
":v8_base_without_compiler_files", ":v8_base_without_compiler_files",
":v8_compiler_files", ":v8_common_libshared_files",
":v8_initializers_files", ],
":v8_libplatform_files", icu_deps = [
":v8_libsampler_files", ":icu/generated_torque_headers",
":v8_shared_internal_headers", "@icu",
] + select({ ],
":is_v8_enable_i18n_support": [ ":generated_regexp_special_case" ], icu_srcs = [
"//conditions:default": [], ":generated_regexp_special_case",
}), ":icu/generated_torque_files",
":icu/v8_base_without_compiler_files",
],
noicu_deps = [
":noicu/generated_torque_headers",
],
noicu_srcs = [
":noicu/generated_torque_files",
],
deps = [ deps = [
":v8_libbase", ":v8_libbase",
"@zlib", "@zlib",
] + select({ ],
":is_v8_enable_i18n_support": [ "@icu" ],
"//conditions:default": [],
}),
) )
v8_library( v8_library(
name = "v8", name = "v8",
srcs = [ srcs = [":v8_inspector_files"],
":snapshot_files", icu_deps = [":icu/v8_libshared"],
":v8_inspector_files", icu_srcs = [":icu/snapshot_files"],
], noicu_deps = [":noicu/v8_libshared"],
deps = [ ":v8_libshared" ], noicu_srcs = [":noicu/snapshot_files"],
) )
# TODO(victorgomes): Check if v8_enable_webassembly is true. # TODO(victorgomes): Check if v8_enable_webassembly is true.
v8_library( v8_library(
name = "wee8", name = "wee8",
srcs = [ ":wee8_files" ], srcs = [":wee8_files"],
deps = [ ":v8" ], deps = [":noicu/v8"],
)
alias(
name = "core_lib_noicu",
actual = "noicu/v8",
)
alias(
name = "core_lib_icu",
actual = "icu/v8",
) )
# ================================================= # =================================================
...@@ -3105,57 +3219,71 @@ v8_binary( ...@@ -3105,57 +3219,71 @@ v8_binary(
"src/interpreter/bytecodes.cc", "src/interpreter/bytecodes.cc",
"src/interpreter/bytecodes.h", "src/interpreter/bytecodes.h",
], ],
deps = [ "v8_libbase" ], deps = ["v8_libbase"],
) )
v8_binary( v8_binary(
name = "regexp_special_case_generator", name = "regexp_special_case_generator",
srcs = [ srcs = [
":v8_shared_internal_headers",
":v8_libbase_files",
"src/regexp/special-case.h",
"src/regexp/gen-regexp-special-case.cc", "src/regexp/gen-regexp-special-case.cc",
"src/regexp/special-case.h",
":v8_libbase_files",
":v8_shared_internal_headers",
],
defines = [
"V8_INTL_SUPPORT",
"ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC",
# src/regexp/regexp-compiler-tonode.cc uses an unsafe ICU method and
# access a character implicitly.
"UNISTR_FROM_CHAR_EXPLICIT=",
],
deps = [
"@icu",
], ],
deps = [ "@icu" ],
) )
v8_binary( v8_binary(
name = "torque", name = "torque",
srcs = [ srcs = [
":torque_base_files",
"src/torque/torque.cc", "src/torque/torque.cc",
":torque_base_files",
], ],
copts = [ "-fexceptions" ], copts = ["-fexceptions"],
features = [ "-use_header_modules" ], features = ["-use_header_modules"],
deps = [ "v8_libbase" ], linkopts = select({
"@config//:is_android": ["-llog"],
"//conditions:default": [],
}),
deps = ["v8_libbase"],
) )
v8_binary( v8_binary(
name = "mksnapshot", name = "mksnapshot",
srcs = [ ":mksnapshot_files" ], srcs = [":mksnapshot_files"],
deps = [ ":v8_libshared" ], icu_deps = [":icu/v8_libshared"],
linkopts = select({ linkopts = select({
"is_android": [ "-llog" ], "@config//:is_android": ["-llog"],
"//conditions:default": [], "//conditions:default": [],
}), }),
noicu_deps = [":noicu/v8_libshared"],
) )
v8_binary( v8_binary(
name = "d8", name = "d8",
srcs = [ srcs = [":d8_files"],
"src/d8/async-hooks-wrapper.cc", icu_deps = [":icu/v8"],
"src/d8/async-hooks-wrapper.h", noicu_deps = [":noicu/v8"],
"src/d8/d8.cc", )
"src/d8/d8.h",
"src/d8/d8-console.cc", alias(
"src/d8/d8-console.h", name = "d8",
"src/d8/d8-js.cc", actual = ":icu/d8",
"src/d8/d8-platforms.cc", )
"src/d8/d8-platforms.h",
"src/d8/d8-posix.cc", # This target forces torque to be compiled without pointer compression.
"src/d8/d8-test.cc", v8_binary_non_pointer_compression(
], name = "torque_non_pointer_compression",
deps = [ ":v8" ], binary = "torque",
) )
# ================================================= # =================================================
...@@ -3166,9 +3294,39 @@ v8_build_config( ...@@ -3166,9 +3294,39 @@ v8_build_config(
name = "v8_build_config", name = "v8_build_config",
) )
# Runs mjunit with d8. # Runs mjsunit with d8.
py_test(
name = "noicu/mjsunit",
size = "medium",
srcs = [
"test/mjsunit/testcfg.py",
"tools/predictable_wrapper.py",
"tools/run-tests.py",
] + glob(["tools/testrunner/**/*.py"]),
args = [
"--no-sorting",
"--nopresubmit",
"--variant=google3_noicu",
"--outdir noicu",
"--verbose",
"mjsunit",
],
data = [
"//testing/pybase",
":noicu/v8_build_config",
":noicu/d8",
"test",
] + glob(["test/**"]) + glob(["tools/**/*.js"]) + glob(["tools/**/*.mjs"]),
main = "tools/run-tests.py",
python_version = "PY3",
tags = [
# Disable sanitizers, as they don't work in general in V8.
"nosan",
],
)
py_test( py_test(
name = "mjsunit", name = "icu/mjsunit",
size = "medium", size = "medium",
srcs = [ srcs = [
"test/mjsunit/testcfg.py", "test/mjsunit/testcfg.py",
...@@ -3178,19 +3336,19 @@ py_test( ...@@ -3178,19 +3336,19 @@ py_test(
args = [ args = [
"--no-sorting", "--no-sorting",
"--nopresubmit", "--nopresubmit",
# TODO(victorgomes): Create a flag to pass the variant in the cmdline. "--variant=google3_icu",
"--variant=default", "--outdir icu",
"--outdir bazel-bin", "--verbose",
"mjsunit", "mjsunit",
], ],
data = [ data = [
":v8_build_config", "//testing/pybase",
":d8", ":icu/v8_build_config",
":icu/d8",
"test", "test",
] + glob(["test/**"]) + glob(["tools/**/*.js"]) + glob(["tools/**/*.mjs"]), ] + glob(["test/**"]) + glob(["tools/**/*.js"]) + glob(["tools/**/*.mjs"]),
main = "tools/run-tests.py", main = "tools/run-tests.py",
# TODO(victorgomes): Move this to PY3. python_version = "PY3",
python_version = "PY2",
tags = [ tags = [
# Disable sanitizers, as they don't work in general in V8. # Disable sanitizers, as they don't work in general in V8.
"nosan", "nosan",
......
...@@ -16,6 +16,12 @@ http_archive( ...@@ -16,6 +16,12 @@ http_archive(
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace() bazel_skylib_workspace()
new_local_repository(
name = "config",
path = "bazel/config",
build_file = "bazel/config/BUILD.bazel",
)
new_local_repository( new_local_repository(
name = "zlib", name = "zlib",
path = "third_party/zlib", path = "third_party/zlib",
......
...@@ -26,7 +26,6 @@ cc_library( ...@@ -26,7 +26,6 @@ cc_library(
"U_ENABLE_RESOURCE_TRACING=0", "U_ENABLE_RESOURCE_TRACING=0",
"UNISTR_FROM_STRING_EXPLICIT=", "UNISTR_FROM_STRING_EXPLICIT=",
"UNISTR_FROM_CHAR_EXPLICIT=", "UNISTR_FROM_CHAR_EXPLICIT=",
"ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
], ],
copts = [ copts = [
"-Wno-unused-function", "-Wno-unused-function",
......
# 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"],
)
selects.config_setting_group(
name = "is_posix",
match_any = [
":is_linux",
":is_android",
":is_macos",
],
)
# 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,
],
)
...@@ -22,10 +22,6 @@ _create_option_int = rule( ...@@ -22,10 +22,6 @@ _create_option_int = rule(
build_setting = config.int(flag = True), 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): def v8_flag(name, default = False):
_create_option_flag(name = name, build_setting_default = default) _create_option_flag(name = name, build_setting_default = default)
native.config_setting(name = "is_" + name, flag_values = {name: "True"}) native.config_setting(name = "is_" + name, flag_values = {name: "True"})
...@@ -47,21 +43,23 @@ def _custom_config_impl(ctx): ...@@ -47,21 +43,23 @@ def _custom_config_impl(ctx):
v8_custom_config = rule( v8_custom_config = rule(
implementation = _custom_config_impl, implementation = _custom_config_impl,
attrs = { attrs = {
"_v8_typed_array_max_size_in_heap": "_v8_typed_array_max_size_in_heap": attr.label(default = ":v8_typed_array_max_size_in_heap"),
attr.label(default = ":v8_typed_array_max_size_in_heap"), },
}
) )
def _config_impl(ctx): def _config_impl(ctx):
hdrs = [] hdrs = []
# Add headers # Add headers
for h in ctx.attr.hdrs: for h in ctx.attr.hdrs:
hdrs += h[DefaultInfo].files.to_list() hdrs += h[DefaultInfo].files.to_list()
defs = [] defs = []
# Add conditional_defines # Add conditional_defines
for f, d in ctx.attr.conditional_defines.items(): for f, d in ctx.attr.conditional_defines.items():
if f[FlagInfo].value: if f[FlagInfo].value:
defs.append(d) defs.append(d)
# Add defines # Add defines
for d in ctx.attr.defines: for d in ctx.attr.defines:
defs.append(d) defs.append(d)
...@@ -87,9 +85,9 @@ v8_config = rule( ...@@ -87,9 +85,9 @@ v8_config = rule(
}, },
) )
def _default_args(configs): def _default_args():
return struct( return struct(
deps = configs + [":define_flags"], deps = [":define_flags"],
copts = [ copts = [
"-fPIC", "-fPIC",
"-Werror", "-Werror",
...@@ -105,26 +103,61 @@ def _default_args(configs): ...@@ -105,26 +103,61 @@ def _default_args(configs):
], ],
includes = ["include"], includes = ["include"],
linkopts = [ linkopts = [
"-pthread" "-pthread",
] + select({ ] + select({
":is_macos": [], "@v8//bazel/config:is_macos": [],
"//conditions:default": [ "-Wl,--no-as-needed -ldl" ], "//conditions:default": ["-Wl,--no-as-needed -ldl"],
}) + select({ }) + select({
":should_add_rdynamic": [ "-rdynamic" ], ":should_add_rdynamic": ["-rdynamic"],
"//conditions:default": [], "//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( def v8_binary(
name, name,
srcs, srcs,
configs = [],
deps = [], deps = [],
includes = [], includes = [],
copts = [], copts = [],
linkopts = [], linkopts = [],
noicu_srcs = [],
noicu_deps = [],
icu_srcs = [],
icu_deps = [],
**kwargs): **kwargs):
default = _default_args(configs) 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( native.cc_binary(
name = name, name = name,
srcs = srcs, srcs = srcs,
...@@ -135,16 +168,42 @@ def v8_binary( ...@@ -135,16 +168,42 @@ def v8_binary(
**kwargs **kwargs
) )
# buildifier: disable=function-docstring
def v8_library( def v8_library(
name, name,
srcs, srcs,
configs = [],
deps = [], deps = [],
includes = [], includes = [],
copts = [], copts = [],
linkopts = [], linkopts = [],
noicu_srcs = [],
noicu_deps = [],
icu_srcs = [],
icu_deps = [],
**kwargs): **kwargs):
default = _default_args(configs) default = _default_args()
if _should_emit_noicu_and_icu(noicu_srcs, noicu_deps, icu_srcs, icu_deps):
native.cc_library(
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,
alwayslink = 1,
**kwargs
)
native.cc_library(
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,
alwayslink = 1,
**kwargs
)
else:
native.cc_library( native.cc_library(
name = name, name = name,
srcs = srcs, srcs = srcs,
...@@ -157,88 +216,135 @@ def v8_library( ...@@ -157,88 +216,135 @@ def v8_library(
) )
def _torque_impl(ctx): def _torque_impl(ctx):
v8root = ctx.attr.v8root[FlagInfo].value v8root = "."
prefix = ctx.attr.prefix
# Arguments # Arguments
args = [] args = []
args += ctx.attr.args args += ctx.attr.args
args.append("-o") 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("-strip-v8-root")
args.append("-v8-root") args.append("-v8-root")
args.append(v8root) args.append(v8root)
# Sources # Sources
args += [f.path for f in ctx.files.srcs] args += [f.path for f in ctx.files.srcs]
# Generate/declare output files # Generate/declare output files
outs = [] outs = []
for src in ctx.files.srcs: for src in ctx.files.srcs:
root, period, ext = src.path.rpartition(".") root, period, ext = src.path.rpartition(".")
# Strip v8root # Strip v8root
if root[:len(v8root)] == v8root: if root[:len(v8root)] == v8root:
root = root[len(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.cc"))
outs.append(ctx.actions.declare_file(file + "-tq-csa.h")) 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-inl.inc"))
outs.append(ctx.actions.declare_file(file + "-tq.inc")) outs.append(ctx.actions.declare_file(file + "-tq.inc"))
outs.append(ctx.actions.declare_file(file + "-tq.cc")) 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( ctx.actions.run(
outputs = outs, outputs = outs,
inputs = ctx.files.srcs, inputs = ctx.files.srcs,
arguments = args, arguments = args,
executable = ctx.executable.tool, executable = ctx.executable.tool,
mnemonic = "GenTorque",
progress_message = "Generating Torque files", progress_message = "Generating Torque files",
) )
return [DefaultInfo(files = depset(outs))] return [DefaultInfo(files = depset(outs))]
v8_torque = rule( _v8_torque = rule(
implementation = _torque_impl, implementation = _torque_impl,
# cfg = v8_target_cpu_transition,
attrs = { attrs = {
"prefix": attr.string(mandatory = True),
"srcs": attr.label_list(allow_files = True, mandatory = True), "srcs": attr.label_list(allow_files = True, mandatory = True),
"extras": attr.string_list(), "extras": attr.string_list(),
"tool": attr.label( "tool": attr.label(
default = ":torque",
allow_files = True, allow_files = True,
executable = True, executable = True,
cfg = "host", cfg = "exec",
), ),
"args": attr.string_list(), "args": attr.string_list(),
"v8root": attr.label(default = ":v8_root"), "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 _mksnapshot(ctx): def _mksnapshot(ctx):
outs = [ outs = [
ctx.actions.declare_file("snapshot.cc"), ctx.actions.declare_file(ctx.attr.prefix + "/snapshot.cc"),
ctx.actions.declare_file("embedded.S"), ctx.actions.declare_file(ctx.attr.prefix + "/embedded.S"),
] ]
ctx.actions.run( ctx.actions.run(
outputs = outs, outputs = outs,
inputs = [], inputs = [],
arguments = [ arguments = [
"--embedded_variant=Default", "--embedded_variant=Default",
"--startup_src", outs[0].path, "--startup_src",
"--embedded_src", outs[1].path, outs[0].path,
"--embedded_src",
outs[1].path,
] + ctx.attr.args, ] + ctx.attr.args,
executable = ctx.executable.tool, executable = ctx.executable.tool,
progress_message = "Running mksnapshot" progress_message = "Running mksnapshot",
) )
return [DefaultInfo(files = depset(outs))] return [DefaultInfo(files = depset(outs))]
_v8_mksnapshot = rule(
v8_mksnapshot = rule(
implementation = _mksnapshot, implementation = _mksnapshot,
attrs = { attrs = {
"args": attr.string_list(), "args": attr.string_list(),
"tool": attr.label( "tool": attr.label(
default = ":mksnapshot", mandatory = True,
allow_files = True, allow_files = True,
executable = True, executable = True,
cfg = "host", cfg = "exec",
), ),
} "prefix": attr.string(mandatory = True),
},
) )
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): def _quote(val):
if val[0] == '"' and val[-1] == '"': if val[0] == '"' and val[-1] == '"':
fail("String", val, "already quoted") fail("String", val, "already quoted")
...@@ -256,11 +362,8 @@ def _json(kv_pairs): ...@@ -256,11 +362,8 @@ def _json(kv_pairs):
content += "}\n" content += "}\n"
return content return content
# TODO(victorgomes): Create a rule (instead of a macro), that can def build_config_content(cpu, icu):
# dynamically populate the build config. return _json([
def v8_build_config(name):
cpu = _quote("x64")
content = _json([
("current_cpu", cpu), ("current_cpu", cpu),
("dcheck_always_on", "false"), ("dcheck_always_on", "false"),
("is_android", "false"), ("is_android", "false"),
...@@ -276,10 +379,11 @@ def v8_build_config(name): ...@@ -276,10 +379,11 @@ def v8_build_config(name):
("is_ubsan_vptr", "false"), ("is_ubsan_vptr", "false"),
("target_cpu", cpu), ("target_cpu", cpu),
("v8_current_cpu", cpu), ("v8_current_cpu", cpu),
("v8_dict_property_const_tracking", "false"),
("v8_enable_atomic_marking_state", "false"), ("v8_enable_atomic_marking_state", "false"),
("v8_enable_atomic_object_field_writes", "false"), ("v8_enable_atomic_object_field_writes", "false"),
("v8_enable_concurrent_marking", "false"), ("v8_enable_concurrent_marking", "false"),
("v8_enable_i18n_support", "true"), ("v8_enable_i18n_support", icu),
("v8_enable_verify_predictable", "false"), ("v8_enable_verify_predictable", "false"),
("v8_enable_verify_csa", "false"), ("v8_enable_verify_csa", "false"),
("v8_enable_lite_mode", "false"), ("v8_enable_lite_mode", "false"),
...@@ -290,10 +394,21 @@ def v8_build_config(name): ...@@ -290,10 +394,21 @@ def v8_build_config(name):
("v8_enable_webassembly", "false"), ("v8_enable_webassembly", "false"),
("v8_control_flow_integrity", "false"), ("v8_control_flow_integrity", "false"),
("v8_enable_single_generation", "false"), ("v8_enable_single_generation", "false"),
("v8_enable_virtual_memory_cage", "false"),
("v8_target_cpu", cpu), ("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( native.genrule(
name = name, name = "noicu/" + name,
outs = [name + ".json"], outs = ["noicu/" + name + ".json"],
cmd = "echo '" + content + "' > \"$@\"", cmd = "echo '" + build_config_content(cpu, "false") + "' > \"$@\"",
)
native.genrule(
name = "icu/" + name,
outs = ["icu/" + name + ".json"],
cmd = "echo '" + build_config_content(cpu, "true") + "' > \"$@\"",
) )
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,
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment