diff --git a/common.gypi b/common.gypi index 8db2c0dec6ecfe..0f8999f4079994 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.20', + 'v8_embedder_string': '-node.11', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/.bazelrc b/deps/v8/.bazelrc new file mode 100644 index 00000000000000..e0127628ca93aa --- /dev/null +++ b/deps/v8/.bazelrc @@ -0,0 +1,26 @@ +# 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. + +# V8 bazel port only supports clang +build --action_env=BAZEL_COMPILER=clang +build --action_env=CC=clang +build --action_env=CXX=clang++ +build --action_env=PATH + +# V8 debug config +build:debug --compilation_mode=dbg +build:debug --config=v8_enable_debugging_features +build:debug --//:v8_enable_fast_mksnapshot +build:debug --//:v8_enable_backtrace + +# v8_enable_debugging_features flags +build:v8_enable_debugging_features --//:v8_enable_verify_heap +build:v8_enable_debugging_features --//:v8_enable_object_print +build:v8_enable_debugging_features --//:v8_enable_disassembler +build:v8_enable_debugging_features --//:v8_enable_trace_maps +build:v8_enable_debugging_features --//:v8_enable_test_features +build:v8_enable_debugging_features --//:v8_enable_v8_checks +build:v8_enable_debugging_features --//:v8_code_comments +build:v8_enable_debugging_features --//:v8_enable_debug_code +build:v8_enable_debugging_features --//:v8_enable_snapshot_native_code_counters diff --git a/deps/v8/.gitignore b/deps/v8/.gitignore index b340100517a5a4..315f3ae0be65ad 100644 --- a/deps/v8/.gitignore +++ b/deps/v8/.gitignore @@ -51,6 +51,7 @@ /test/benchmarks/data /test/fuzzer/wasm_corpus /test/fuzzer/wasm_corpus.tar.gz +!/test/mjsunit/tools/*.log /test/mozilla/data /test/test262/data /test/test262/harness @@ -111,7 +112,10 @@ turbo*.cfg turbo*.dot turbo*.json v8.ignition_dispatches_table.json - +bazel-bin +bazel-out +bazel-testlogs +bazel-v8 !/third_party/jinja2 !/third_party/markupsafe !/third_party/zlib diff --git a/deps/v8/.mailmap b/deps/v8/.mailmap new file mode 100644 index 00000000000000..7f2e3b9e5e9098 --- /dev/null +++ b/deps/v8/.mailmap @@ -0,0 +1,14 @@ +# 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. + +# People change their names or email addresses for many reasons. This +# list makes sure people’s preferences are respected when using Git +# commands such as `git log` or `git blame`. +# +# See https://git-scm.com/docs/gitmailmap for more information. +# +# Please keep the list sorted. + +Clemens Backes Clemens Hammacher +Timothy Gu diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index 8b0d38adfc4f04..ea786ddea4c085 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -127,6 +127,7 @@ Jay Freeman James Pike James M Snell Javad Amiri +Jesper van den Ende Ji Qiu Jianghua Yang Jiawen Geng @@ -164,6 +165,7 @@ Michael Lutz Michael Mclaughlin Michael Smith Michaël Zasso +Mihir Shah Mike Gilbert Mike Pennisi Mikhail Gusarov @@ -213,6 +215,7 @@ Seo Sanghyeon Shawn Anastasio Shawn Presser Stefan Penner +Stephan Hartmann Stephen Belanger Sylvestre Ledru Taketoshi Aono @@ -229,6 +232,7 @@ Victor Costan Vlad Burlik Vladimir Krivosheev Vladimir Shutoff +Wael Almattar Wei Wu Wenlu Wang Wenyu Zhao @@ -247,6 +251,7 @@ Yuri Iozzelli Zac Hansen Zeynep Cankara Zhao Jiazhong +Zheng Liu Zhongping Wang 柳荣一 Tianping Yang diff --git a/deps/v8/BUILD.bazel b/deps/v8/BUILD.bazel new file mode 100644 index 00000000000000..e0d5ce713852ca --- /dev/null +++ b/deps/v8/BUILD.bazel @@ -0,0 +1,3052 @@ +# 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//:bazel/defs.bzl", + "v8_binary", + "v8_config", + "v8_custom_config", + "v8_raw_flag", + "v8_flag", + "v8_int", + "v8_string", + "v8_library", + "v8_torque", + "v8_mksnapshot", +) + +# ================================================= +# Configuration settings +# ================================================= + +config_setting( + name = "is_debug", + values = { + "compilation_mode": "dbg", + }, +) + +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 +# ================================================= + +# V8 GN flags not currently supported: +# v8_custom_deps +# v8_embed_script +# v8_embedder_string +# v8_promise_internal_field_count +# v8_enable_vtunejit +# v8_enable_vtunetracemark +# v8_enable_fast_torque +# v8_win64_unwinding_info +# v8_enable_31bit_smis_on_64bit_arch +# v8_enable_trace_unoptimized +# v8_enable_trace_ignition +# v8_enable_trace_baseline_exec +# v8_enable_trace_feedback_updates +# v8_enable_atomic_object_field_writes +# v8_enable_atomic_marking_state +# v8_enable_concurrent_marking +# v8_enable_ignition_dispatch_counting +# v8_enable_builtins_profiling +# v8_enable_builtins_profiling_verbose +# v8_builtins_profiling_log_file +# v8_enable_short_builtin_calls +# v8_enable_external_code_space +# v8_postmortem_support +# v8_use_siphash +# v8_no_inline +# v8_os_page_size +# v8_can_use_fpu_instructions +# v8_use_mips_abi_hardfloat +# v8_enable_gdbjit +# v8_untrusted_code_mitigations +# v8_enable_minor_mc +# v8_check_header_includes +# v8_enable_shared_ro_heap +# v8_enable_lazy_source_positions +# v8_enable_third_party_heap +# v8_third_party_heap_files +# v8_disable_write_barriers +# v8_enable_unconditional_write_barriers +# v8_enable_single_generation +# v8_enable_regexp_interpreter_threaded_dispatch +# v8_verify_torque_generation_invariance +# v8_enable_snapshot_compression +# v8_control_flow_integrity +# cppgc_enable_object_names +# cppgc_enable_caged_heap +# cppgc_enable_verify_live_bytes +# cppgc_enable_check_assignments_in_prefinalizers +# cppgc_enable_young_generation +# v8_enable_zone_compression +# v8_enable_heap_sandbox +# v8_enable_precise_zone_stats +# v8_enable_swiss_name_dictionary +# v8_generate_external_defines_header +# v8_dict_property_const_tracking +# v8_enable_map_packing +# v8_allow_javascript_in_promise_hooks +# v8_enable_allocation_folding +# v8_allocation_site_tracking + +v8_string(name = "v8_root", default = ".") + +v8_flag(name = "v8_android_log_stdout") +v8_flag(name = "v8_annotate_torque_ir") + +v8_flag(name = "v8_code_comments") + +v8_flag(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_debug_code") +v8_flag(name = "v8_enable_disassembler") +v8_flag(name = "v8_enable_handle_zapping", default = True) +v8_flag(name = "v8_enable_hugepage") +v8_flag(name = "v8_enable_fast_mksnapshot") +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) +v8_flag(name = "v8_enable_minor_mc", default = True) +v8_flag(name = "v8_enable_object_print") +v8_flag(name = "v8_enable_slow_dchecks") +v8_flag(name = "v8_enable_snapshot_code_comments") +v8_flag(name = "v8_enable_snapshot_native_code_counters") +v8_flag(name = "v8_enable_trace_maps") +v8_flag(name = "v8_enable_v8_checks") +v8_flag(name = "v8_enable_verify_csa") +v8_flag(name = "v8_enable_verify_heap") +v8_flag(name = "v8_enable_verify_predictable") +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) + +# Pointer compression, true by default if x64 or arm64. +v8_raw_flag(name = "v8_enable_pointer_compression") +selects.config_setting_group( + name = "is_v8_enable_pointer_compression", + match_any = [ ":raw_v8_enable_pointer_compression", ":is_x64", ":is_arm64" ], +) +# Pointer cage, true by default if v8_enable_pointer_compression. +v8_flag(name = "v8_enable_pointer_compression_shared_cage", default = True) +# Enable shared cage if v8_enable_pointer_compression +# and v8_enable_pointer_compression_shared_cage. +selects.config_setting_group( + name = "enable_pointer_compression_shared_cage", + match_all = [ + ":is_v8_enable_pointer_compression", + ":is_v8_enable_pointer_compression_shared_cage", + ], +) +# Enable isolated cage if v8_enable_pointer_compression and +# NOT v8_enable_pointer_compression_shared_cage. +selects.config_setting_group( + name = "enable_pointer_compression_isolated_cage", + match_all = [ + ":is_v8_enable_pointer_compression", + ":is_not_v8_enable_pointer_compression_shared_cage", + ], +) + +# Enable -rdynamic. +selects.config_setting_group( + name = "should_add_rdynamic", + match_all = [ ":is_linux", ":is_v8_enable_backtrace" ], +) + +v8_custom_config(name = "default") + +v8_config( + name = "define_flags", + conditional_defines = { + "v8_android_log_stdout": "V8_ANDROID_LOG_STDOUT", + "v8_code_comments": "V8_CODE_COMMENTS", + "v8_deprecation_warnings": "V8_DEPRECATION_WARNINGS", + "v8_imminent_deprecation_warnings": "V8_IMMINENT_DEPRECATION_WARNINGS", + "v8_enable_debug_code": "V8_ENABLE_DEBUG_CODE", + "v8_enable_disassembler": "ENABLE_DISASSEMBLER", + "v8_enable_handle_zapping": "ENABLE_HANDLE_ZAPPING", + "v8_enable_hugepage": "ENABLE_HUGEPAGE", + "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_minor_mc": "ENABLE_MINOR_MC", + "v8_enable_object_print": "OBJECT_PRINT", + "v8_enable_slow_dchecks": "ENABLE_SLOW_DCHECKS", + "v8_enable_snapshot_native_code_counters": + "V8_SNAPSHOT_NATIVE_CODE_COUNTERS", + "v8_enable_trace_maps": "V8_TRACE_MAPS", + "v8_enable_v8_checks": "V8_ENABLE_CHECKS", + "v8_enable_verify_csa": "ENABLE_VERIFY_CSA", + "v8_enable_verify_heap": "VERIFY_HEAP", + "v8_enable_verify_predictable": "VERIFY_PREDICTABLE", + "v8_enable_webassembly": "V8_ENABLE_WEBASSEMBLY", + }, + defines = [ + "GOOGLE3", + "CHROMIUM_ZLIB_NO_CHROMECONF", + "V8_ADVANCED_BIGINT_ALGORITHMS", + "V8_CONCURRENT_MARKING", + ] + select({ + ":is_debug": [ "DEBUG" ], + "//conditions:default": [], + }) + select({ + ":is_ia32": [ "V8_TARGET_ARCH_IA32" ], + ":is_x64": [ "V8_TARGET_ARCH_X64" ], + ":is_arm": [ + "V8_TARGET_ARCH_ARM", + "CAN_USE_ARMV7_INSTRUCTIONS", + "CAN_USE_VFP3_INSTRUCTIONS", + ], + ":is_arm64": [ "V8_TARGET_ARCH_ARM64" ], + }) + select({ + ":is_android": [ + "V8_HAVE_TARGET_OS", + "V8_TARGET_OS_ANDROID", + ], + ":is_linux": [ + "V8_HAVE_TARGET_OS", + "V8_TARGET_OS_LINUX", + ], + ":is_macos": [ + "V8_HAVE_TARGET_OS", + "V8_TARGET_OS_MACOSX", + ], + }) + select({ + ":is_android_x86": [ "DISABLE_UNTRUSTED_CODE_MITIGATIONS" ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_pointer_compression": [ + "V8_COMPRESS_POINTERS", + "V8_31BIT_SMIS_ON_64BIT_ARCH", + ], + "//conditions:default": [], + }) + select({ + ":enable_pointer_compression_shared_cage": [ + "V8_COMPRESS_POINTERS_IN_SHARED_CAGE" + ], + ":enable_pointer_compression_isolated_cage": [ + "V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE" + ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_test_features": [ + "V8_ENABLE_ALLOCATION_TIMEOUT", + "V8_ENABLE_FORCE_SLOW_PATH", + "V8_ENABLE_DOUBLE_CONST_STORE_CHECK", + ], + "//conditions:default": [], + }), + deps = [ ":default" ], +) + +# ================================================= +# File group rules +# ================================================= + +filegroup( + name = "v8_config_headers_files", + srcs = [ + "include/v8-platform.h", + "include/v8config.h", + ], +) + +filegroup( + name = "v8_version_files", + srcs = [ + "include/v8-value-serializer-version.h", + "include/v8-version-string.h", + "include/v8-version.h", + ], +) + +filegroup( + name = "cppgc_headers_files", + srcs = [ + "include/cppgc/allocation.h", + "include/cppgc/common.h", + "include/cppgc/custom-space.h", + "include/cppgc/default-platform.h", + "include/cppgc/ephemeron-pair.h", + "include/cppgc/explicit-management.h", + "include/cppgc/garbage-collected.h", + "include/cppgc/heap-consistency.h", + "include/cppgc/heap-state.h", + "include/cppgc/heap-statistics.h", + "include/cppgc/heap.h", + "include/cppgc/internal/api-constants.h", + "include/cppgc/internal/atomic-entry-flag.h", + "include/cppgc/internal/caged-heap-local-data.h", + "include/cppgc/internal/compiler-specific.h", + "include/cppgc/internal/finalizer-trait.h", + "include/cppgc/internal/gc-info.h", + "include/cppgc/internal/logging.h", + "include/cppgc/internal/name-trait.h", + "include/cppgc/internal/persistent-node.h", + "include/cppgc/internal/pointer-policies.h", + "include/cppgc/internal/prefinalizer-handler.h", + "include/cppgc/internal/write-barrier.h", + "include/cppgc/liveness-broker.h", + "include/cppgc/macros.h", + "include/cppgc/member.h", + "include/cppgc/name-provider.h", + "include/cppgc/object-size-trait.h", + "include/cppgc/persistent.h", + "include/cppgc/platform.h", + "include/cppgc/prefinalizer.h", + "include/cppgc/process-heap-statistics.h", + "include/cppgc/sentinel-pointer.h", + "include/cppgc/source-location.h", + "include/cppgc/trace-trait.h", + "include/cppgc/type-traits.h", + "include/cppgc/visitor.h", + ] +) + +filegroup( + name = "v8_headers_files", + srcs = [ + ":cppgc_headers_files", + ":v8_version_files", + "include/v8-cppgc.h", + "include/v8-fast-api-calls.h", + "include/v8-internal.h", + "include/v8-profiler.h", + "include/v8-util.h", + "include/v8.h", + ], +) + +filegroup( + name = "v8_flags", + srcs = [ + "src/flags/flag-definitions.h", + "src/flags/flags.h", + ] + select({ + "is_v8_enable_webassembly": [ "src/wasm/wasm-feature-flags.h" ], + "//conditions:default": [], + }), +) + +filegroup( + name = "v8_shared_internal_headers", + srcs = [ + "src/common/globals.h", + "testing/gtest/include/gtest/gtest_prod.h", + ] + select({ + "is_v8_enable_webassembly": [ + "src/wasm/wasm-constants.h", + "src/wasm/wasm-limits.h", + ], + "//conditions:default": [], + }), +) + +filegroup( + name = "v8_libbase_files", + srcs = [ + ":v8_flags", + ":v8_config_headers_files", + ":v8_headers_files", + "src/base/vlq.h", + "src/base/address-region.h", + "src/base/atomic-utils.h", + "src/base/atomicops.h", + "src/base/atomicops_internals_atomicword_compat.h", + "src/base/base-export.h", + "src/base/bit-field.h", + "src/base/bits-iterator.h", + "src/base/bits.cc", + "src/base/bits.h", + "src/base/bounded-page-allocator.cc", + "src/base/bounded-page-allocator.h", + "src/base/bounds.h", + "src/base/build_config.h", + "src/base/compiler-specific.h", + "src/base/cpu.cc", + "src/base/cpu.h", + "src/base/debug/stack_trace.cc", + "src/base/debug/stack_trace.h", + "src/base/division-by-constant.cc", + "src/base/division-by-constant.h", + "src/base/enum-set.h", + "src/base/export-template.h", + "src/base/file-utils.cc", + "src/base/file-utils.h", + "src/base/flags.h", + "src/base/free_deleter.h", + "src/base/functional.cc", + "src/base/functional.h", + "src/base/hashmap-entry.h", + "src/base/hashmap.h", + "src/base/ieee754.cc", + "src/base/ieee754.h", + "src/base/immediate-crash.h", + "src/base/iterator.h", + "src/base/lazy-instance.h", + "src/base/logging.cc", + "src/base/logging.h", + "src/base/macros.h", + "src/base/memory.h", + "src/base/numbers/bignum-dtoa.cc", + "src/base/numbers/bignum-dtoa.h", + "src/base/numbers/bignum.cc", + "src/base/numbers/bignum.h", + "src/base/numbers/cached-powers.cc", + "src/base/numbers/cached-powers.h", + "src/base/numbers/diy-fp.cc", + "src/base/numbers/diy-fp.h", + "src/base/numbers/double.h", + "src/base/numbers/dtoa.cc", + "src/base/numbers/dtoa.h", + "src/base/numbers/fast-dtoa.cc", + "src/base/numbers/fast-dtoa.h", + "src/base/numbers/fixed-dtoa.cc", + "src/base/numbers/fixed-dtoa.h", + "src/base/numbers/strtod.cc", + "src/base/numbers/strtod.h", + "src/base/once.cc", + "src/base/once.h", + "src/base/optional.h", + "src/base/overflowing-math.h", + "src/base/page-allocator.cc", + "src/base/page-allocator.h", + "src/base/platform/condition-variable.cc", + "src/base/platform/condition-variable.h", + "src/base/platform/elapsed-timer.h", + "src/base/platform/mutex.cc", + "src/base/platform/mutex.h", + "src/base/platform/platform.h", + "src/base/platform/semaphore.cc", + "src/base/platform/semaphore.h", + "src/base/platform/time.cc", + "src/base/platform/time.h", + "src/base/platform/wrappers.h", + "src/base/region-allocator.cc", + "src/base/region-allocator.h", + "src/base/ring-buffer.h", + "src/base/safe_conversions.h", + "src/base/safe_conversions_arm_impl.h", + "src/base/safe_conversions_impl.h", + "src/base/small-vector.h", + "src/base/strings.cc", + "src/base/strings.h", + "src/base/sys-info.cc", + "src/base/sys-info.h", + "src/base/template-utils.h", + "src/base/timezone-cache.h", + "src/base/threaded-list.h", + "src/base/type-traits.h", + "src/base/utils/random-number-generator.cc", + "src/base/utils/random-number-generator.h", + "src/base/vector.h", + "src/base/v8-fallthrough.h", + "src/base/vlq-base64.cc", + "src/base/vlq-base64.h", + ] + select({ + ":is_posix": [ + "src/base/platform/platform-posix.cc", + "src/base/platform/platform-posix.h", + "src/base/platform/platform-posix-time.cc", + "src/base/platform/platform-posix-time.h", + ], + "//conditions:default": [], + }) + select({ + ":is_linux": [ + "src/base/debug/stack_trace_posix.cc", + "src/base/platform/platform-linux.cc", + ], + "is_android": [ + "src/base/debug/stack_trace_android.cc", + "src/base/platform/platform-linux.cc", + ], + "is_macos": [ + "src/base/debug/stack_trace_posix.cc", + "src/base/platform/platform-macos.cc", + ], + }), +) + +filegroup( + name = "v8_libplatform_files", + srcs = [ + "base/trace_event/common/trace_event_common.h", + "include/libplatform/libplatform.h", + "include/libplatform/libplatform-export.h", + "include/libplatform/v8-tracing.h", + "src/libplatform/default-foreground-task-runner.cc", + "src/libplatform/default-foreground-task-runner.h", + "src/libplatform/default-job.cc", + "src/libplatform/default-job.h", + "src/libplatform/default-platform.cc", + "src/libplatform/default-platform.h", + "src/libplatform/default-worker-threads-task-runner.cc", + "src/libplatform/default-worker-threads-task-runner.h", + "src/libplatform/delayed-task-queue.cc", + "src/libplatform/delayed-task-queue.h", + "src/libplatform/task-queue.cc", + "src/libplatform/task-queue.h", + "src/libplatform/tracing/recorder.h", + "src/libplatform/tracing/trace-buffer.cc", + "src/libplatform/tracing/trace-buffer.h", + "src/libplatform/tracing/trace-config.cc", + "src/libplatform/tracing/trace-object.cc", + "src/libplatform/tracing/trace-writer.cc", + "src/libplatform/tracing/trace-writer.h", + "src/libplatform/tracing/tracing-controller.cc", + "src/libplatform/worker-thread.cc", + "src/libplatform/worker-thread.h", + ], +) + +filegroup( + name = "v8_libsampler_files", + srcs = [ + "src/libsampler/sampler.cc", + "src/libsampler/sampler.h", + ], +) + +filegroup( + name = "torque_runtime_support_files", + srcs = [ "src/torque/runtime-support.h" ], +) + +filegroup( + name = "torque_files", + srcs = [ + "src/builtins/aggregate-error.tq", + "src/builtins/array-at.tq", + "src/builtins/array-copywithin.tq", + "src/builtins/array-every.tq", + "src/builtins/array-filter.tq", + "src/builtins/array-find.tq", + "src/builtins/array-findindex.tq", + "src/builtins/array-foreach.tq", + "src/builtins/array-from.tq", + "src/builtins/array-isarray.tq", + "src/builtins/array-join.tq", + "src/builtins/array-lastindexof.tq", + "src/builtins/array-map.tq", + "src/builtins/array-of.tq", + "src/builtins/array-reduce-right.tq", + "src/builtins/array-reduce.tq", + "src/builtins/array-reverse.tq", + "src/builtins/array-shift.tq", + "src/builtins/array-slice.tq", + "src/builtins/array-some.tq", + "src/builtins/array-splice.tq", + "src/builtins/array-unshift.tq", + "src/builtins/array.tq", + "src/builtins/arraybuffer.tq", + "src/builtins/base.tq", + "src/builtins/boolean.tq", + "src/builtins/builtins-bigint.tq", + "src/builtins/builtins-string.tq", + "src/builtins/cast.tq", + "src/builtins/collections.tq", + "src/builtins/constructor.tq", + "src/builtins/conversion.tq", + "src/builtins/convert.tq", + "src/builtins/console.tq", + "src/builtins/data-view.tq", + "src/builtins/finalization-registry.tq", + "src/builtins/frames.tq", + "src/builtins/frame-arguments.tq", + "src/builtins/function.tq", + "src/builtins/growable-fixed-array.tq", + "src/builtins/ic-callable.tq", + "src/builtins/ic-dynamic-check-maps.tq", + "src/builtins/ic.tq", + "src/builtins/internal-coverage.tq", + "src/builtins/internal.tq", + "src/builtins/iterator.tq", + "src/builtins/math.tq", + "src/builtins/number.tq", + "src/builtins/object-fromentries.tq", + "src/builtins/object.tq", + "src/builtins/promise-abstract-operations.tq", + "src/builtins/promise-all.tq", + "src/builtins/promise-all-element-closure.tq", + "src/builtins/promise-any.tq", + "src/builtins/promise-constructor.tq", + "src/builtins/promise-finally.tq", + "src/builtins/promise-misc.tq", + "src/builtins/promise-race.tq", + "src/builtins/promise-reaction-job.tq", + "src/builtins/promise-resolve.tq", + "src/builtins/promise-then.tq", + "src/builtins/promise-jobs.tq", + "src/builtins/proxy-constructor.tq", + "src/builtins/proxy-delete-property.tq", + "src/builtins/proxy-get-property.tq", + "src/builtins/proxy-get-prototype-of.tq", + "src/builtins/proxy-has-property.tq", + "src/builtins/proxy-is-extensible.tq", + "src/builtins/proxy-prevent-extensions.tq", + "src/builtins/proxy-revocable.tq", + "src/builtins/proxy-revoke.tq", + "src/builtins/proxy-set-property.tq", + "src/builtins/proxy-set-prototype-of.tq", + "src/builtins/proxy.tq", + "src/builtins/reflect.tq", + "src/builtins/regexp-exec.tq", + "src/builtins/regexp-match-all.tq", + "src/builtins/regexp-match.tq", + "src/builtins/regexp-replace.tq", + "src/builtins/regexp-search.tq", + "src/builtins/regexp-source.tq", + "src/builtins/regexp-split.tq", + "src/builtins/regexp-test.tq", + "src/builtins/regexp.tq", + "src/builtins/string-at.tq", + "src/builtins/string-endswith.tq", + "src/builtins/string-html.tq", + "src/builtins/string-includes.tq", + "src/builtins/string-indexof.tq", + "src/builtins/string-iterator.tq", + "src/builtins/string-match-search.tq", + "src/builtins/string-pad.tq", + "src/builtins/string-repeat.tq", + "src/builtins/string-replaceall.tq", + "src/builtins/string-slice.tq", + "src/builtins/string-startswith.tq", + "src/builtins/string-substr.tq", + "src/builtins/string-substring.tq", + "src/builtins/string-trim.tq", + "src/builtins/symbol.tq", + "src/builtins/torque-internal.tq", + "src/builtins/typed-array-at.tq", + "src/builtins/typed-array-createtypedarray.tq", + "src/builtins/typed-array-every.tq", + "src/builtins/typed-array-entries.tq", + "src/builtins/typed-array-filter.tq", + "src/builtins/typed-array-find.tq", + "src/builtins/typed-array-findindex.tq", + "src/builtins/typed-array-foreach.tq", + "src/builtins/typed-array-from.tq", + "src/builtins/typed-array-keys.tq", + "src/builtins/typed-array-of.tq", + "src/builtins/typed-array-reduce.tq", + "src/builtins/typed-array-reduceright.tq", + "src/builtins/typed-array-set.tq", + "src/builtins/typed-array-slice.tq", + "src/builtins/typed-array-some.tq", + "src/builtins/typed-array-sort.tq", + "src/builtins/typed-array-subarray.tq", + "src/builtins/typed-array-values.tq", + "src/builtins/typed-array.tq", + "src/builtins/weak-ref.tq", + "src/ic/handler-configuration.tq", + "src/objects/allocation-site.tq", + "src/objects/api-callbacks.tq", + "src/objects/arguments.tq", + "src/objects/bigint.tq", + "src/objects/cell.tq", + "src/objects/code.tq", + "src/objects/contexts.tq", + "src/objects/data-handler.tq", + "src/objects/debug-objects.tq", + "src/objects/descriptor-array.tq", + "src/objects/embedder-data-array.tq", + "src/objects/feedback-cell.tq", + "src/objects/feedback-vector.tq", + "src/objects/fixed-array.tq", + "src/objects/foreign.tq", + "src/objects/free-space.tq", + "src/objects/heap-number.tq", + "src/objects/heap-object.tq", + "src/objects/js-array-buffer.tq", + "src/objects/js-array.tq", + "src/objects/js-collection-iterator.tq", + "src/objects/js-collection.tq", + "src/objects/js-function.tq", + "src/objects/js-generator.tq", + "src/objects/js-objects.tq", + "src/objects/js-promise.tq", + "src/objects/js-proxy.tq", + "src/objects/js-regexp-string-iterator.tq", + "src/objects/js-regexp.tq", + "src/objects/js-weak-refs.tq", + "src/objects/literal-objects.tq", + "src/objects/map.tq", + "src/objects/megadom-handler.tq", + "src/objects/microtask.tq", + "src/objects/module.tq", + "src/objects/name.tq", + "src/objects/oddball.tq", + "src/objects/ordered-hash-table.tq", + "src/objects/primitive-heap-object.tq", + "src/objects/promise.tq", + "src/objects/property-array.tq", + "src/objects/property-cell.tq", + "src/objects/property-descriptor-object.tq", + "src/objects/prototype-info.tq", + "src/objects/regexp-match-info.tq", + "src/objects/scope-info.tq", + "src/objects/script.tq", + "src/objects/shared-function-info.tq", + "src/objects/source-text-module.tq", + "src/objects/stack-frame-info.tq", + "src/objects/string.tq", + "src/objects/struct.tq", + "src/objects/swiss-hash-table-helpers.tq", + "src/objects/swiss-name-dictionary.tq", + "src/objects/synthetic-module.tq", + "src/objects/template-objects.tq", + "src/objects/templates.tq", + "src/objects/torque-defined-classes.tq", + "test/torque/test-torque.tq", + "third_party/v8/builtins/array-sort.tq", + ] + select({ + ":is_v8_enable_webassembly": [ + "src/builtins/wasm.tq", + "src/debug/debug-wasm-objects.tq", + "src/wasm/wasm-objects.tq", + ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_i18n_support": [ + "src/objects/intl-objects.tq", + "src/objects/js-break-iterator.tq", + "src/objects/js-collator.tq", + "src/objects/js-date-time-format.tq", + "src/objects/js-display-names.tq", + "src/objects/js-list-format.tq", + "src/objects/js-locale.tq", + "src/objects/js-number-format.tq", + "src/objects/js-plural-rules.tq", + "src/objects/js-relative-time-format.tq", + "src/objects/js-segment-iterator.tq", + "src/objects/js-segmenter.tq", + "src/objects/js-segments.tq", + ], + "//conditions:default": [], + }) +) + +filegroup( + name = "torque_base_files", + srcs = [ + "src/torque/ast.h", + "src/torque/cc-generator.cc", + "src/torque/cc-generator.h", + "src/torque/cfg.cc", + "src/torque/cfg.h", + "src/torque/class-debug-reader-generator.cc", + "src/torque/constants.h", + "src/torque/contextual.h", + "src/torque/cpp-builder.cc", + "src/torque/cpp-builder.h", + "src/torque/csa-generator.cc", + "src/torque/csa-generator.h", + "src/torque/declarable.cc", + "src/torque/declarable.h", + "src/torque/declaration-visitor.cc", + "src/torque/declaration-visitor.h", + "src/torque/declarations.cc", + "src/torque/declarations.h", + "src/torque/earley-parser.cc", + "src/torque/earley-parser.h", + "src/torque/global-context.cc", + "src/torque/global-context.h", + "src/torque/implementation-visitor.cc", + "src/torque/implementation-visitor.h", + "src/torque/instance-type-generator.cc", + "src/torque/instructions.cc", + "src/torque/instructions.h", + "src/torque/parameter-difference.h", + "src/torque/server-data.cc", + "src/torque/server-data.h", + "src/torque/source-positions.cc", + "src/torque/source-positions.h", + "src/torque/torque-code-generator.cc", + "src/torque/torque-code-generator.h", + "src/torque/torque-compiler.cc", + "src/torque/torque-compiler.h", + "src/torque/torque-parser.cc", + "src/torque/torque-parser.h", + "src/torque/type-inference.cc", + "src/torque/type-inference.h", + "src/torque/type-oracle.cc", + "src/torque/type-oracle.h", + "src/torque/type-visitor.cc", + "src/torque/type-visitor.h", + "src/torque/types.cc", + "src/torque/types.h", + "src/torque/utils.cc", + "src/torque/utils.h", + ], +) + +filegroup( + name = "v8_base_without_compiler_files", + srcs = [ + ":cppgc_base_files", + ":v8_cppgc_shared_files", + ":v8_bigint", + ":generated_bytecode_builtins_list", + "base/trace_event/common/trace_event_common.h", + "include/cppgc/common.h", + "include/v8-inspector-protocol.h", + "include/v8-inspector.h", + "include/v8-metrics.h", + "include/v8-unwinder-state.h", + "include/v8-wasm-trap-handler-posix.h", + "src/api/api-arguments-inl.h", + "src/api/api-arguments.cc", + "src/api/api-arguments.h", + "src/api/api-inl.h", + "src/api/api-macros.h", + "src/api/api-macros-undef.h", + "src/api/api-natives.cc", + "src/api/api-natives.h", + "src/api/api.cc", + "src/api/api.h", + "src/ast/ast-function-literal-id-reindexer.cc", + "src/ast/ast-function-literal-id-reindexer.h", + "src/ast/ast-source-ranges.h", + "src/ast/ast-traversal-visitor.h", + "src/ast/ast-value-factory.cc", + "src/ast/ast-value-factory.h", + "src/ast/ast.cc", + "src/ast/ast.h", + "src/ast/modules.cc", + "src/ast/modules.h", + "src/ast/prettyprinter.cc", + "src/ast/prettyprinter.h", + "src/ast/scopes.cc", + "src/ast/scopes.h", + "src/ast/source-range-ast-visitor.cc", + "src/ast/source-range-ast-visitor.h", + "src/ast/variables.cc", + "src/ast/variables.h", + "src/baseline/baseline-assembler-inl.h", + "src/baseline/baseline-assembler.h", + "src/baseline/baseline-compiler.cc", + "src/baseline/baseline-compiler.h", + "src/baseline/baseline.cc", + "src/baseline/baseline.h", + "src/baseline/baseline-batch-compiler.h", + "src/baseline/baseline-batch-compiler.cc", + "src/baseline/bytecode-offset-iterator.h", + "src/baseline/bytecode-offset-iterator.cc", + "src/builtins/accessors.cc", + "src/builtins/accessors.h", + "src/builtins/builtins-api.cc", + "src/builtins/builtins-array.cc", + "src/builtins/builtins-arraybuffer.cc", + "src/builtins/builtins-async-module.cc", + "src/builtins/builtins-bigint.cc", + "src/builtins/builtins-callsite.cc", + "src/builtins/builtins-collections.cc", + "src/builtins/builtins-console.cc", + "src/builtins/builtins-constructor.h", + "src/builtins/builtins-dataview.cc", + "src/builtins/builtins-date.cc", + "src/builtins/builtins-definitions.h", + "src/builtins/builtins-descriptors.h", + "src/builtins/builtins-error.cc", + "src/builtins/builtins-function.cc", + "src/builtins/builtins-global.cc", + "src/builtins/builtins-internal.cc", + "src/builtins/builtins-json.cc", + "src/builtins/builtins-number.cc", + "src/builtins/builtins-object.cc", + "src/builtins/builtins-promise.h", + "src/builtins/builtins-reflect.cc", + "src/builtins/builtins-regexp.cc", + "src/builtins/builtins-sharedarraybuffer.cc", + "src/builtins/builtins-string.cc", + "src/builtins/builtins-symbol.cc", + "src/builtins/builtins-trace.cc", + "src/builtins/builtins-typed-array.cc", + "src/builtins/builtins-utils-inl.h", + "src/builtins/builtins-utils.h", + "src/builtins/builtins-weak-refs.cc", + "src/builtins/builtins.cc", + "src/builtins/builtins.h", + "src/builtins/constants-table-builder.cc", + "src/builtins/constants-table-builder.h", + "src/builtins/profile-data-reader.h", + "src/codegen/aligned-slot-allocator.h", + "src/codegen/aligned-slot-allocator.cc", + "src/codegen/assembler-arch.h", + "src/codegen/assembler-inl.h", + "src/codegen/assembler.cc", + "src/codegen/assembler.h", + "src/codegen/bailout-reason.cc", + "src/codegen/bailout-reason.h", + "src/codegen/callable.h", + "src/codegen/code-comments.cc", + "src/codegen/code-comments.h", + "src/codegen/code-desc.cc", + "src/codegen/code-desc.h", + "src/codegen/code-factory.cc", + "src/codegen/code-factory.h", + "src/codegen/code-reference.cc", + "src/codegen/code-reference.h", + "src/codegen/compilation-cache.cc", + "src/codegen/compilation-cache.h", + "src/codegen/compiler.cc", + "src/codegen/compiler.h", + "src/codegen/constant-pool.cc", + "src/codegen/constant-pool.h", + "src/codegen/constants-arch.h", + "src/codegen/cpu-features.h", + "src/codegen/external-reference-encoder.cc", + "src/codegen/external-reference-encoder.h", + "src/codegen/external-reference-table.cc", + "src/codegen/external-reference-table.h", + "src/codegen/external-reference.cc", + "src/codegen/external-reference.h", + "src/codegen/flush-instruction-cache.cc", + "src/codegen/flush-instruction-cache.h", + "src/codegen/handler-table.cc", + "src/codegen/handler-table.h", + "src/codegen/interface-descriptors.cc", + "src/codegen/interface-descriptors-inl.h", + "src/codegen/interface-descriptors.h", + "src/codegen/label.h", + "src/codegen/machine-type.cc", + "src/codegen/machine-type.h", + "src/codegen/macro-assembler-inl.h", + "src/codegen/macro-assembler.h", + "src/codegen/optimized-compilation-info.cc", + "src/codegen/optimized-compilation-info.h", + "src/codegen/pending-optimization-table.cc", + "src/codegen/pending-optimization-table.h", + "src/codegen/register-arch.h", + "src/codegen/register-configuration.cc", + "src/codegen/register-configuration.h", + "src/codegen/register.h", + "src/codegen/reglist.h", + "src/codegen/reloc-info.cc", + "src/codegen/reloc-info.h", + "src/codegen/safepoint-table.cc", + "src/codegen/safepoint-table.h", + "src/codegen/signature.h", + "src/codegen/source-position-table.cc", + "src/codegen/source-position-table.h", + "src/codegen/source-position.cc", + "src/codegen/source-position.h", + "src/codegen/string-constants.cc", + "src/codegen/string-constants.h", + "src/codegen/tick-counter.cc", + "src/codegen/tick-counter.h", + "src/codegen/tnode.cc", + "src/codegen/tnode.h", + "src/codegen/turbo-assembler.cc", + "src/codegen/turbo-assembler.h", + "src/codegen/unoptimized-compilation-info.cc", + "src/codegen/unoptimized-compilation-info.h", + "src/common/assert-scope.cc", + "src/common/assert-scope.h", + "src/common/checks.h", + "src/common/external-pointer-inl.h", + "src/common/external-pointer.h", + "src/common/message-template.h", + "src/common/ptr-compr-inl.h", + "src/common/ptr-compr.h", + "src/compiler-dispatcher/compiler-dispatcher.cc", + "src/compiler-dispatcher/compiler-dispatcher.h", + "src/compiler-dispatcher/optimizing-compile-dispatcher.cc", + "src/compiler-dispatcher/optimizing-compile-dispatcher.h", + "src/date/date.cc", + "src/date/date.h", + "src/date/dateparser-inl.h", + "src/date/dateparser.cc", + "src/date/dateparser.h", + "src/debug/debug-coverage.cc", + "src/debug/debug-coverage.h", + "src/debug/debug-evaluate.cc", + "src/debug/debug-evaluate.h", + "src/debug/debug-frames.cc", + "src/debug/debug-frames.h", + "src/debug/debug-interface.cc", + "src/debug/debug-interface.h", + "src/debug/debug-property-iterator.cc", + "src/debug/debug-property-iterator.h", + "src/debug/debug-scope-iterator.cc", + "src/debug/debug-scope-iterator.h", + "src/debug/debug-scopes.cc", + "src/debug/debug-scopes.h", + "src/debug/debug-stack-trace-iterator.cc", + "src/debug/debug-stack-trace-iterator.h", + "src/debug/debug-type-profile.cc", + "src/debug/debug-type-profile.h", + "src/debug/debug.cc", + "src/debug/debug.h", + "src/debug/interface-types.h", + "src/debug/liveedit.cc", + "src/debug/liveedit.h", + "src/deoptimizer/deoptimize-reason.cc", + "src/deoptimizer/deoptimize-reason.h", + "src/deoptimizer/deoptimized-frame-info.cc", + "src/deoptimizer/deoptimized-frame-info.h", + "src/deoptimizer/deoptimizer.cc", + "src/deoptimizer/deoptimizer.h", + "src/deoptimizer/frame-description.h", + "src/deoptimizer/materialized-object-store.cc", + "src/deoptimizer/materialized-object-store.h", + "src/deoptimizer/translated-state.cc", + "src/deoptimizer/translated-state.h", + "src/deoptimizer/translation-array.cc", + "src/deoptimizer/translation-array.h", + "src/deoptimizer/translation-opcode.h", + "src/diagnostics/basic-block-profiler.cc", + "src/diagnostics/basic-block-profiler.h", + "src/diagnostics/code-tracer.h", + "src/diagnostics/compilation-statistics.cc", + "src/diagnostics/compilation-statistics.h", + "src/diagnostics/disasm.h", + "src/diagnostics/disassembler.cc", + "src/diagnostics/disassembler.h", + "src/diagnostics/eh-frame.cc", + "src/diagnostics/eh-frame.h", + "src/diagnostics/gdb-jit.cc", + "src/diagnostics/gdb-jit.h", + "src/diagnostics/objects-debug.cc", + "src/diagnostics/objects-printer.cc", + "src/diagnostics/perf-jit.cc", + "src/diagnostics/perf-jit.h", + "src/diagnostics/unwinder.cc", + "src/diagnostics/unwinder.h", + "src/execution/arguments-inl.h", + "src/execution/arguments.cc", + "src/execution/arguments.h", + "src/execution/execution.cc", + "src/execution/execution.h", + "src/execution/external-pointer-table.cc", + "src/execution/external-pointer-table.h", + "src/execution/frame-constants.h", + "src/execution/frames-inl.h", + "src/execution/frames.cc", + "src/execution/frames.h", + "src/execution/futex-emulation.cc", + "src/execution/futex-emulation.h", + "src/execution/interrupts-scope.cc", + "src/execution/interrupts-scope.h", + "src/execution/isolate-data.h", + "src/execution/isolate-inl.h", + "src/execution/isolate-utils.h", + "src/execution/isolate-utils-inl.h", + "src/snapshot/embedded/platform-embedded-file-writer-base.h", + "src/snapshot/embedded/embedded-file-writer.h", + "src/execution/isolate.cc", + "src/execution/isolate.h", + "src/execution/local-isolate-inl.h", + "src/execution/local-isolate.cc", + "src/execution/local-isolate.h", + "src/execution/messages.cc", + "src/execution/messages.h", + "src/execution/microtask-queue.cc", + "src/execution/microtask-queue.h", + "src/execution/pointer-authentication.h", + "src/execution/protectors-inl.h", + "src/execution/protectors.cc", + "src/execution/protectors.h", + "src/execution/runtime-profiler.cc", + "src/execution/runtime-profiler.h", + "src/execution/shared-mutex-guard-if-off-thread.h", + "src/execution/simulator-base.cc", + "src/execution/simulator-base.h", + "src/execution/simulator.h", + "src/execution/stack-guard.cc", + "src/execution/stack-guard.h", + "src/execution/thread-id.cc", + "src/execution/thread-id.h", + "src/execution/thread-local-top.cc", + "src/execution/thread-local-top.h", + "src/execution/v8threads.cc", + "src/execution/v8threads.h", + "src/execution/vm-state-inl.h", + "src/execution/vm-state.h", + "src/extensions/cputracemark-extension.cc", + "src/extensions/cputracemark-extension.h", + "src/extensions/externalize-string-extension.cc", + "src/extensions/externalize-string-extension.h", + "src/extensions/gc-extension.cc", + "src/extensions/gc-extension.h", + "src/extensions/ignition-statistics-extension.cc", + "src/extensions/ignition-statistics-extension.h", + "src/extensions/statistics-extension.cc", + "src/extensions/statistics-extension.h", + "src/extensions/trigger-failure-extension.cc", + "src/extensions/trigger-failure-extension.h", + "src/flags/flag-definitions.h", + "src/flags/flags.cc", + "src/flags/flags.h", + "src/handles/global-handles.cc", + "src/handles/global-handles.h", + "src/handles/handles-inl.h", + "src/handles/handles.cc", + "src/handles/handles.h", + "src/handles/local-handles-inl.h", + "src/handles/local-handles.cc", + "src/handles/local-handles.h", + "src/handles/maybe-handles-inl.h", + "src/handles/maybe-handles.h", + "src/handles/persistent-handles.cc", + "src/handles/persistent-handles.h", + "src/heap/allocation-observer.cc", + "src/heap/allocation-observer.h", + "src/heap/allocation-stats.h", + "src/heap/array-buffer-sweeper.cc", + "src/heap/array-buffer-sweeper.h", + "src/heap/barrier.h", + "src/heap/base-space.cc", + "src/heap/base-space.h", + "src/heap/basic-memory-chunk.cc", + "src/heap/basic-memory-chunk.h", + "src/heap/code-object-registry.cc", + "src/heap/code-object-registry.h", + "src/heap/code-range.h", + "src/heap/code-range.cc", + "src/heap/code-stats.cc", + "src/heap/code-stats.h", + "src/heap/collection-barrier.cc", + "src/heap/collection-barrier.h", + "src/heap/combined-heap.cc", + "src/heap/combined-heap.h", + "src/heap/concurrent-allocator-inl.h", + "src/heap/concurrent-allocator.cc", + "src/heap/concurrent-allocator.h", + "src/heap/concurrent-marking.cc", + "src/heap/concurrent-marking.h", + "src/heap/cppgc-js/cpp-heap.cc", + "src/heap/cppgc-js/cpp-heap.h", + "src/heap/cppgc-js/cpp-snapshot.cc", + "src/heap/cppgc-js/cpp-snapshot.h", + "src/heap/cppgc-js/unified-heap-marking-state.h", + "src/heap/cppgc-js/unified-heap-marking-verifier.cc", + "src/heap/cppgc-js/unified-heap-marking-verifier.h", + "src/heap/cppgc-js/unified-heap-marking-visitor.cc", + "src/heap/cppgc-js/unified-heap-marking-visitor.h", + "src/heap/embedder-tracing.cc", + "src/heap/embedder-tracing.h", + "src/heap/factory-base.cc", + "src/heap/factory-base.h", + "src/heap/factory-base-inl.h", + "src/heap/factory-inl.h", + "src/heap/factory.cc", + "src/heap/factory.h", + "src/heap/finalization-registry-cleanup-task.cc", + "src/heap/finalization-registry-cleanup-task.h", + "src/heap/free-list-inl.h", + "src/heap/free-list.cc", + "src/heap/free-list.h", + "src/heap/gc-idle-time-handler.cc", + "src/heap/gc-idle-time-handler.h", + "src/heap/gc-tracer.cc", + "src/heap/gc-tracer.h", + "src/heap/heap-controller.cc", + "src/heap/heap-controller.h", + "src/heap/heap-inl.h", + "src/heap/heap-write-barrier-inl.h", + "src/heap/heap-write-barrier.cc", + "src/heap/heap-write-barrier.h", + "src/heap/heap.cc", + "src/heap/heap.h", + "src/heap/incremental-marking-inl.h", + "src/heap/incremental-marking-job.cc", + "src/heap/incremental-marking-job.h", + "src/heap/incremental-marking.cc", + "src/heap/incremental-marking.h", + "src/heap/index-generator.cc", + "src/heap/index-generator.h", + "src/heap/invalidated-slots-inl.h", + "src/heap/invalidated-slots.cc", + "src/heap/invalidated-slots.h", + "src/heap/large-spaces.cc", + "src/heap/large-spaces.h", + "src/heap/list.h", + "src/heap/local-allocator-inl.h", + "src/heap/local-allocator.h", + "src/heap/local-factory.cc", + "src/heap/local-factory.h", + "src/heap/local-factory-inl.h", + "src/heap/local-heap-inl.h", + "src/heap/local-heap.cc", + "src/heap/local-heap.h", + "src/heap/mark-compact-inl.h", + "src/heap/mark-compact.cc", + "src/heap/mark-compact.h", + "src/heap/marking-barrier.cc", + "src/heap/marking-barrier.h", + "src/heap/marking-barrier-inl.h", + "src/heap/marking-visitor-inl.h", + "src/heap/marking-visitor.h", + "src/heap/marking-worklist-inl.h", + "src/heap/marking-worklist.cc", + "src/heap/marking-worklist.h", + "src/heap/marking.cc", + "src/heap/marking.h", + "src/heap/memory-allocator.cc", + "src/heap/memory-allocator.h", + "src/heap/memory-chunk-inl.h", + "src/heap/memory-chunk-layout.cc", + "src/heap/memory-chunk-layout.h", + "src/heap/memory-chunk.cc", + "src/heap/memory-chunk.h", + "src/heap/memory-measurement-inl.h", + "src/heap/memory-measurement.cc", + "src/heap/memory-measurement.h", + "src/heap/memory-reducer.cc", + "src/heap/memory-reducer.h", + "src/heap/new-spaces-inl.h", + "src/heap/new-spaces.cc", + "src/heap/new-spaces.h", + "src/heap/object-stats.cc", + "src/heap/object-stats.h", + "src/heap/objects-visiting-inl.h", + "src/heap/objects-visiting.cc", + "src/heap/objects-visiting.h", + "src/heap/paged-spaces-inl.h", + "src/heap/paged-spaces.cc", + "src/heap/paged-spaces.h", + "src/heap/parallel-work-item.h", + "src/heap/parked-scope.h", + "src/heap/read-only-heap-inl.h", + "src/heap/read-only-heap.cc", + "src/heap/read-only-heap.h", + "src/heap/read-only-spaces.cc", + "src/heap/read-only-spaces.h", + "src/heap/remembered-set-inl.h", + "src/heap/remembered-set.h", + "src/heap/safepoint.cc", + "src/heap/safepoint.h", + "src/heap/scavenge-job.cc", + "src/heap/scavenge-job.h", + "src/heap/scavenger-inl.h", + "src/heap/scavenger.cc", + "src/heap/scavenger.h", + "src/heap/slot-set.cc", + "src/heap/slot-set.h", + "src/heap/spaces-inl.h", + "src/heap/spaces.cc", + "src/heap/spaces.h", + "src/heap/stress-marking-observer.cc", + "src/heap/stress-marking-observer.h", + "src/heap/stress-scavenge-observer.cc", + "src/heap/stress-scavenge-observer.h", + "src/heap/sweeper.cc", + "src/heap/sweeper.h", + "src/heap/weak-object-worklists.cc", + "src/heap/weak-object-worklists.h", + "src/heap/worklist.h", + "src/ic/call-optimization.cc", + "src/ic/call-optimization.h", + "src/ic/handler-configuration-inl.h", + "src/ic/handler-configuration.cc", + "src/ic/handler-configuration.h", + "src/ic/ic-inl.h", + "src/ic/ic-stats.cc", + "src/ic/ic-stats.h", + "src/ic/ic.cc", + "src/ic/ic.h", + "src/ic/stub-cache.cc", + "src/ic/stub-cache.h", + "src/init/bootstrapper.cc", + "src/init/bootstrapper.h", + "src/init/heap-symbols.h", + "src/init/icu_util.cc", + "src/init/icu_util.h", + "src/init/isolate-allocator.cc", + "src/init/isolate-allocator.h", + "src/init/setup-isolate.h", + "src/init/startup-data-util.cc", + "src/init/startup-data-util.h", + "src/init/v8.cc", + "src/init/v8.h", + "src/interpreter/block-coverage-builder.h", + "src/interpreter/bytecode-array-builder.cc", + "src/interpreter/bytecode-array-builder.h", + "src/interpreter/bytecode-array-iterator.cc", + "src/interpreter/bytecode-array-iterator.h", + "src/interpreter/bytecode-array-random-iterator.cc", + "src/interpreter/bytecode-array-random-iterator.h", + "src/interpreter/bytecode-array-writer.cc", + "src/interpreter/bytecode-array-writer.h", + "src/interpreter/bytecode-decoder.cc", + "src/interpreter/bytecode-decoder.h", + "src/interpreter/bytecode-flags.cc", + "src/interpreter/bytecode-flags.h", + "src/interpreter/bytecode-generator.cc", + "src/interpreter/bytecode-generator.h", + "src/interpreter/bytecode-jump-table.h", + "src/interpreter/bytecode-label.cc", + "src/interpreter/bytecode-label.h", + "src/interpreter/bytecode-node.cc", + "src/interpreter/bytecode-node.h", + "src/interpreter/bytecode-operands.cc", + "src/interpreter/bytecode-operands.h", + "src/interpreter/bytecode-register-allocator.h", + "src/interpreter/bytecode-register-optimizer.cc", + "src/interpreter/bytecode-register-optimizer.h", + "src/interpreter/bytecode-register.cc", + "src/interpreter/bytecode-register.h", + "src/interpreter/bytecode-source-info.cc", + "src/interpreter/bytecode-source-info.h", + "src/interpreter/bytecode-traits.h", + "src/interpreter/bytecodes.cc", + "src/interpreter/bytecodes.h", + "src/interpreter/constant-array-builder.cc", + "src/interpreter/constant-array-builder.h", + "src/interpreter/control-flow-builders.cc", + "src/interpreter/control-flow-builders.h", + "src/interpreter/handler-table-builder.cc", + "src/interpreter/handler-table-builder.h", + "src/interpreter/interpreter-generator.h", + "src/interpreter/interpreter-intrinsics.cc", + "src/interpreter/interpreter-intrinsics.h", + "src/interpreter/interpreter.cc", + "src/interpreter/interpreter.h", + "src/json/json-parser.cc", + "src/json/json-parser.h", + "src/json/json-stringifier.cc", + "src/json/json-stringifier.h", + "src/logging/code-events.h", + "src/logging/counters-definitions.h", + "src/logging/counters.cc", + "src/logging/counters.h", + "src/logging/local-logger.cc", + "src/logging/local-logger.h", + "src/logging/log-inl.h", + "src/logging/log-utils.cc", + "src/logging/log-utils.h", + "src/logging/log.cc", + "src/logging/log.h", + "src/logging/metrics.cc", + "src/logging/metrics.h", + "src/logging/tracing-flags.cc", + "src/logging/tracing-flags.h", + "src/logging/runtime-call-stats.h", + "src/logging/runtime-call-stats-scope.h", + "src/numbers/conversions-inl.h", + "src/numbers/conversions.cc", + "src/numbers/conversions.h", + "src/numbers/hash-seed-inl.h", + "src/numbers/math-random.cc", + "src/numbers/math-random.h", + "src/objects/all-objects-inl.h", + "src/objects/allocation-site-inl.h", + "src/objects/allocation-site-scopes-inl.h", + "src/objects/allocation-site-scopes.h", + "src/objects/allocation-site.h", + "src/objects/api-callbacks-inl.h", + "src/objects/api-callbacks.h", + "src/objects/arguments-inl.h", + "src/objects/arguments.h", + "src/objects/backing-store.cc", + "src/objects/backing-store.h", + "src/objects/bigint-inl.h", + "src/objects/bigint.cc", + "src/objects/bigint.h", + "src/objects/cell-inl.h", + "src/objects/cell.h", + "src/objects/code-inl.h", + "src/objects/code-kind.cc", + "src/objects/code-kind.h", + "src/objects/code.cc", + "src/objects/code.h", + "src/objects/compilation-cache-table-inl.h", + "src/objects/compilation-cache-table.cc", + "src/objects/compilation-cache-table.h", + "src/objects/compressed-slots-inl.h", + "src/objects/compressed-slots.h", + "src/objects/contexts-inl.h", + "src/objects/contexts.cc", + "src/objects/contexts.h", + "src/objects/data-handler-inl.h", + "src/objects/data-handler.h", + "src/objects/debug-objects-inl.h", + "src/objects/debug-objects.cc", + "src/objects/debug-objects.h", + "src/objects/descriptor-array-inl.h", + "src/objects/descriptor-array.h", + "src/objects/dictionary-inl.h", + "src/objects/dictionary.h", + "src/objects/elements-inl.h", + "src/objects/elements-kind.cc", + "src/objects/elements-kind.h", + "src/objects/elements.cc", + "src/objects/elements.h", + "src/objects/embedder-data-array-inl.h", + "src/objects/embedder-data-array.cc", + "src/objects/embedder-data-array.h", + "src/objects/embedder-data-slot-inl.h", + "src/objects/embedder-data-slot.h", + "src/objects/feedback-cell-inl.h", + "src/objects/feedback-cell.h", + "src/objects/feedback-vector-inl.h", + "src/objects/feedback-vector.cc", + "src/objects/feedback-vector.h", + "src/objects/field-index-inl.h", + "src/objects/field-index.h", + "src/objects/field-type.cc", + "src/objects/field-type.h", + "src/objects/fixed-array-inl.h", + "src/objects/fixed-array.h", + "src/objects/foreign-inl.h", + "src/objects/foreign.h", + "src/objects/free-space-inl.h", + "src/objects/free-space.h", + "src/objects/function-kind.h", + "src/objects/function-syntax-kind.h", + "src/objects/hash-table-inl.h", + "src/objects/hash-table.h", + "src/objects/heap-number-inl.h", + "src/objects/heap-number.h", + "src/objects/heap-object-inl.h", + "src/objects/heap-object.h", + "src/objects/instance-type-inl.h", + "src/objects/instance-type.h", + "src/objects/internal-index.h", + "src/objects/js-array-buffer-inl.h", + "src/objects/js-array-buffer.cc", + "src/objects/js-array-buffer.h", + "src/objects/js-array-inl.h", + "src/objects/js-array.h", + "src/objects/js-collection-inl.h", + "src/objects/js-collection-iterator.h", + "src/objects/js-collection-iterator-inl.h", + "src/objects/js-collection.h", + "src/objects/js-function-inl.h", + "src/objects/js-function.cc", + "src/objects/js-function.h", + "src/objects/js-generator-inl.h", + "src/objects/js-generator.h", + "src/objects/js-objects-inl.h", + "src/objects/js-objects.cc", + "src/objects/js-objects.h", + "src/objects/js-promise-inl.h", + "src/objects/js-promise.h", + "src/objects/js-proxy-inl.h", + "src/objects/js-proxy.h", + "src/objects/js-regexp-inl.h", + "src/objects/js-regexp-string-iterator-inl.h", + "src/objects/js-regexp-string-iterator.h", + "src/objects/js-regexp.cc", + "src/objects/js-regexp.h", + "src/objects/js-weak-refs.h", + "src/objects/js-weak-refs-inl.h", + "src/objects/keys.cc", + "src/objects/keys.h", + "src/objects/literal-objects-inl.h", + "src/objects/literal-objects.cc", + "src/objects/literal-objects.h", + "src/objects/lookup-cache-inl.h", + "src/objects/lookup-cache.cc", + "src/objects/lookup-cache.h", + "src/objects/lookup-inl.h", + "src/objects/lookup.cc", + "src/objects/lookup.h", + "src/objects/managed.cc", + "src/objects/managed.h", + "src/objects/map-inl.h", + "src/objects/map-updater.cc", + "src/objects/map-updater.h", + "src/objects/map.cc", + "src/objects/map.h", + "src/objects/maybe-object-inl.h", + "src/objects/maybe-object.h", + "src/objects/megadom-handler-inl.h", + "src/objects/megadom-handler.h", + "src/objects/microtask-inl.h", + "src/objects/microtask.h", + "src/objects/module-inl.h", + "src/objects/module.cc", + "src/objects/module.h", + "src/objects/name-inl.h", + "src/objects/name.h", + "src/objects/object-list-macros.h", + "src/objects/object-macros-undef.h", + "src/objects/object-macros.h", + "src/objects/object-type.cc", + "src/objects/object-type.h", + "src/objects/objects-body-descriptors-inl.h", + "src/objects/objects-body-descriptors.h", + "src/objects/objects-inl.h", + "src/objects/objects.cc", + "src/objects/objects.h", + "src/objects/objects-definitions.h", + "src/objects/oddball-inl.h", + "src/objects/oddball.h", + "src/objects/ordered-hash-table-inl.h", + "src/objects/ordered-hash-table.cc", + "src/objects/ordered-hash-table.h", + "src/objects/osr-optimized-code-cache-inl.h", + "src/objects/osr-optimized-code-cache.cc", + "src/objects/osr-optimized-code-cache.h", + "src/objects/primitive-heap-object-inl.h", + "src/objects/primitive-heap-object.h", + "src/objects/promise-inl.h", + "src/objects/promise.h", + "src/objects/property-array-inl.h", + "src/objects/property-array.h", + "src/objects/property-cell-inl.h", + "src/objects/property-cell.h", + "src/objects/property-descriptor-object-inl.h", + "src/objects/property-descriptor-object.h", + "src/objects/property-descriptor.cc", + "src/objects/property-descriptor.h", + "src/objects/property-details.h", + "src/objects/property.cc", + "src/objects/property.h", + "src/objects/prototype-info-inl.h", + "src/objects/prototype-info.h", + "src/objects/prototype.h", + "src/objects/prototype-inl.h", + "src/objects/regexp-match-info.h", + "src/objects/scope-info-inl.h", + "src/objects/scope-info.cc", + "src/objects/scope-info.h", + "src/objects/script-inl.h", + "src/objects/script.h", + "src/objects/shared-function-info-inl.h", + "src/objects/shared-function-info.cc", + "src/objects/shared-function-info.h", + "src/objects/slots-atomic-inl.h", + "src/objects/slots-inl.h", + "src/objects/slots.h", + "src/objects/smi-inl.h", + "src/objects/smi.h", + "src/objects/source-text-module.cc", + "src/objects/source-text-module.h", + "src/objects/source-text-module-inl.h", + "src/objects/stack-frame-info-inl.h", + "src/objects/stack-frame-info.cc", + "src/objects/stack-frame-info.h", + "src/objects/string-comparator.cc", + "src/objects/string-comparator.h", + "src/objects/string-inl.h", + "src/objects/string-set-inl.h", + "src/objects/string-set.h", + "src/objects/string-table-inl.h", + "src/objects/string-table.cc", + "src/objects/string-table.h", + "src/objects/string.cc", + "src/objects/string.h", + "src/objects/struct-inl.h", + "src/objects/struct.h", + "src/objects/swiss-hash-table-helpers.h", + "src/objects/swiss-name-dictionary-inl.h", + "src/objects/swiss-name-dictionary.cc", + "src/objects/swiss-name-dictionary.h", + "src/objects/synthetic-module-inl.h", + "src/objects/synthetic-module.cc", + "src/objects/synthetic-module.h", + "src/objects/tagged-field-inl.h", + "src/objects/tagged-field.h", + "src/objects/tagged-impl-inl.h", + "src/objects/tagged-impl.cc", + "src/objects/tagged-impl.h", + "src/objects/tagged-index.h", + "src/objects/tagged-value-inl.h", + "src/objects/tagged-value.h", + "src/objects/template-objects-inl.h", + "src/objects/template-objects.cc", + "src/objects/template-objects.h", + "src/objects/templates-inl.h", + "src/objects/templates.cc", + "src/objects/templates.h", + "src/objects/torque-defined-classes-inl.h", + "src/objects/torque-defined-classes.h", + "src/objects/transitions-inl.h", + "src/objects/transitions.cc", + "src/objects/transitions.h", + "src/objects/type-hints.cc", + "src/objects/type-hints.h", + "src/objects/value-serializer.cc", + "src/objects/value-serializer.h", + "src/objects/visitors.cc", + "src/objects/visitors.h", + "src/parsing/expression-scope.h", + "src/parsing/func-name-inferrer.cc", + "src/parsing/func-name-inferrer.h", + "src/parsing/import-assertions.cc", + "src/parsing/import-assertions.h", + "src/parsing/keywords-gen.h", + "src/parsing/literal-buffer.cc", + "src/parsing/literal-buffer.h", + "src/parsing/parse-info.cc", + "src/parsing/parse-info.h", + "src/parsing/parser-base.h", + "src/parsing/parser.cc", + "src/parsing/parser.h", + "src/parsing/parsing.cc", + "src/parsing/parsing.h", + "src/parsing/pending-compilation-error-handler.cc", + "src/parsing/pending-compilation-error-handler.h", + "src/parsing/preparse-data-impl.h", + "src/parsing/preparse-data.cc", + "src/parsing/preparse-data.h", + "src/parsing/preparser-logger.h", + "src/parsing/preparser.cc", + "src/parsing/preparser.h", + "src/parsing/rewriter.cc", + "src/parsing/rewriter.h", + "src/parsing/scanner-character-streams.cc", + "src/parsing/scanner-character-streams.h", + "src/parsing/scanner.cc", + "src/parsing/scanner.h", + "src/parsing/scanner-inl.h", + "src/parsing/token.cc", + "src/parsing/token.h", + "src/profiler/allocation-tracker.cc", + "src/profiler/allocation-tracker.h", + "src/profiler/circular-queue-inl.h", + "src/profiler/circular-queue.h", + "src/profiler/cpu-profiler-inl.h", + "src/profiler/cpu-profiler.cc", + "src/profiler/cpu-profiler.h", + "src/profiler/heap-profiler.cc", + "src/profiler/heap-profiler.h", + "src/profiler/heap-snapshot-generator-inl.h", + "src/profiler/heap-snapshot-generator.cc", + "src/profiler/heap-snapshot-generator.h", + "src/profiler/profile-generator-inl.h", + "src/profiler/profile-generator.cc", + "src/profiler/profile-generator.h", + "src/profiler/profiler-listener.cc", + "src/profiler/profiler-listener.h", + "src/profiler/profiler-stats.cc", + "src/profiler/profiler-stats.h", + "src/profiler/sampling-heap-profiler.cc", + "src/profiler/sampling-heap-profiler.h", + "src/profiler/strings-storage.cc", + "src/profiler/strings-storage.h", + "src/profiler/symbolizer.cc", + "src/profiler/symbolizer.h", + "src/profiler/tick-sample.cc", + "src/profiler/tick-sample.h", + "src/profiler/tracing-cpu-profiler.cc", + "src/profiler/tracing-cpu-profiler.h", + "src/profiler/weak-code-registry.h", + "src/profiler/weak-code-registry.cc", + "src/regexp/experimental/experimental-bytecode.cc", + "src/regexp/experimental/experimental-bytecode.h", + "src/regexp/experimental/experimental-compiler.cc", + "src/regexp/experimental/experimental-compiler.h", + "src/regexp/experimental/experimental-interpreter.cc", + "src/regexp/experimental/experimental-interpreter.h", + "src/regexp/experimental/experimental.cc", + "src/regexp/experimental/experimental.h", + "src/regexp/property-sequences.cc", + "src/regexp/property-sequences.h", + "src/regexp/regexp-ast.cc", + "src/regexp/regexp-ast.h", + "src/regexp/regexp-bytecode-generator-inl.h", + "src/regexp/regexp-bytecode-generator.cc", + "src/regexp/regexp-bytecode-generator.h", + "src/regexp/regexp-bytecode-peephole.cc", + "src/regexp/regexp-bytecode-peephole.h", + "src/regexp/regexp-bytecodes.cc", + "src/regexp/regexp-bytecodes.h", + "src/regexp/regexp-compiler-tonode.cc", + "src/regexp/regexp-compiler.cc", + "src/regexp/regexp-compiler.h", + "src/regexp/regexp-dotprinter.cc", + "src/regexp/regexp-dotprinter.h", + "src/regexp/regexp-error.cc", + "src/regexp/regexp-error.h", + "src/regexp/regexp-interpreter.cc", + "src/regexp/regexp-interpreter.h", + "src/regexp/regexp-macro-assembler-arch.h", + "src/regexp/regexp-macro-assembler-tracer.cc", + "src/regexp/regexp-macro-assembler-tracer.h", + "src/regexp/regexp-macro-assembler.cc", + "src/regexp/regexp-macro-assembler.h", + "src/regexp/regexp-nodes.h", + "src/regexp/regexp-parser.cc", + "src/regexp/regexp-parser.h", + "src/regexp/regexp-stack.cc", + "src/regexp/regexp-stack.h", + "src/regexp/regexp-utils.cc", + "src/regexp/regexp-utils.h", + "src/regexp/regexp.cc", + "src/regexp/regexp.h", + "src/regexp/special-case.h", + "src/roots/roots-inl.h", + "src/roots/roots.cc", + "src/roots/roots.h", + "src/runtime/runtime-array.cc", + "src/runtime/runtime-atomics.cc", + "src/runtime/runtime-bigint.cc", + "src/runtime/runtime-classes.cc", + "src/runtime/runtime-collections.cc", + "src/runtime/runtime-compiler.cc", + "src/runtime/runtime-date.cc", + "src/runtime/runtime-debug.cc", + "src/runtime/runtime-forin.cc", + "src/runtime/runtime-function.cc", + "src/runtime/runtime-futex.cc", + "src/runtime/runtime-generator.cc", + "src/runtime/runtime-internal.cc", + "src/runtime/runtime-literals.cc", + "src/runtime/runtime-module.cc", + "src/runtime/runtime-numbers.cc", + "src/runtime/runtime-object.cc", + "src/runtime/runtime-operators.cc", + "src/runtime/runtime-promise.cc", + "src/runtime/runtime-proxy.cc", + "src/runtime/runtime-regexp.cc", + "src/runtime/runtime-scopes.cc", + "src/runtime/runtime-strings.cc", + "src/runtime/runtime-symbol.cc", + "src/runtime/runtime-test.cc", + "src/runtime/runtime-trace.cc", + "src/runtime/runtime-typedarray.cc", + "src/runtime/runtime-utils.h", + "src/runtime/runtime-weak-refs.cc", + "src/runtime/runtime.cc", + "src/runtime/runtime.h", + "src/base/sanitizer/asan.h", + "src/base/sanitizer/lsan-page-allocator.cc", + "src/base/sanitizer/lsan-page-allocator.h", + "src/base/sanitizer/msan.h", + "src/snapshot/code-serializer.cc", + "src/snapshot/code-serializer.h", + "src/snapshot/context-deserializer.cc", + "src/snapshot/context-deserializer.h", + "src/snapshot/context-serializer.cc", + "src/snapshot/context-serializer.h", + "src/snapshot/deserializer.cc", + "src/snapshot/deserializer.h", + "src/snapshot/embedded/embedded-data.cc", + "src/snapshot/embedded/embedded-data.h", + "src/snapshot/embedded/embedded-file-writer-interface.h", + "src/snapshot/object-deserializer.cc", + "src/snapshot/object-deserializer.h", + "src/snapshot/read-only-deserializer.cc", + "src/snapshot/read-only-deserializer.h", + "src/snapshot/read-only-serializer.cc", + "src/snapshot/read-only-serializer.h", + "src/snapshot/references.h", + "src/snapshot/roots-serializer.cc", + "src/snapshot/roots-serializer.h", + "src/snapshot/serializer-deserializer.cc", + "src/snapshot/serializer-deserializer.h", + "src/snapshot/serializer.cc", + "src/snapshot/serializer.h", + "src/snapshot/snapshot-compression.cc", + "src/snapshot/snapshot-compression.h", + "src/snapshot/snapshot-data.cc", + "src/snapshot/snapshot-data.h", + "src/snapshot/snapshot-source-sink.cc", + "src/snapshot/snapshot-source-sink.h", + "src/snapshot/snapshot-utils.cc", + "src/snapshot/snapshot-utils.h", + "src/snapshot/snapshot.cc", + "src/snapshot/snapshot.h", + "src/snapshot/startup-deserializer.cc", + "src/snapshot/startup-deserializer.h", + "src/snapshot/startup-serializer.cc", + "src/snapshot/startup-serializer.h", + "src/strings/char-predicates-inl.h", + "src/strings/char-predicates.h", + "src/strings/string-builder-inl.h", + "src/strings/string-builder.cc", + "src/strings/string-case.cc", + "src/strings/string-case.h", + "src/strings/string-hasher-inl.h", + "src/strings/string-hasher.h", + "src/strings/string-search.h", + "src/strings/string-stream.cc", + "src/strings/string-stream.h", + "src/strings/unicode-decoder.cc", + "src/strings/unicode-decoder.h", + "src/strings/unicode-inl.h", + "src/strings/unicode.cc", + "src/strings/unicode.h", + "src/strings/uri.cc", + "src/strings/uri.h", + "src/tasks/cancelable-task.cc", + "src/tasks/cancelable-task.h", + "src/tasks/operations-barrier.cc", + "src/tasks/operations-barrier.h", + "src/tasks/task-utils.cc", + "src/tasks/task-utils.h", + "src/torque/runtime-macro-shims.h", + "src/third_party/siphash/halfsiphash.cc", + "src/third_party/siphash/halfsiphash.h", + "src/third_party/utf8-decoder/utf8-decoder.h", + "src/tracing/trace-event.cc", + "src/tracing/trace-event.h", + "src/tracing/traced-value.cc", + "src/tracing/traced-value.h", + "src/tracing/tracing-category-observer.cc", + "src/tracing/tracing-category-observer.h", + "src/trap-handler/handler-inside.cc", + "src/trap-handler/handler-inside-posix.h", + "src/trap-handler/handler-outside.cc", + "src/trap-handler/handler-shared.cc", + "src/trap-handler/trap-handler-internal.h", + "src/trap-handler/trap-handler.h", + "src/utils/address-map.cc", + "src/utils/address-map.h", + "src/utils/allocation.cc", + "src/utils/allocation.h", + "src/utils/bit-vector.cc", + "src/utils/bit-vector.h", + "src/utils/boxed-float.h", + "src/utils/detachable-vector.cc", + "src/utils/detachable-vector.h", + "src/utils/identity-map.cc", + "src/utils/identity-map.h", + "src/utils/locked-queue-inl.h", + "src/utils/locked-queue.h", + "src/utils/memcopy.cc", + "src/utils/memcopy.h", + "src/utils/ostreams.cc", + "src/utils/ostreams.h", + "src/utils/pointer-with-payload.h", + "src/utils/scoped-list.h", + "src/utils/utils-inl.h", + "src/utils/utils.cc", + "src/utils/utils.h", + "src/utils/version.cc", + "src/utils/version.h", + "src/web-snapshot/web-snapshot.h", + "src/web-snapshot/web-snapshot.cc", + "src/zone/accounting-allocator.cc", + "src/zone/accounting-allocator.h", + "src/zone/compressed-zone-ptr.h", + "src/zone/type-stats.cc", + "src/zone/type-stats.h", + "src/zone/zone-allocator.h", + "src/zone/zone-chunk-list.h", + "src/zone/zone-compression.h", + "src/zone/zone-containers.h", + "src/zone/zone-handle-set.h", + "src/zone/zone-hashmap.h", + "src/zone/zone-list-inl.h", + "src/zone/zone-list.h", + "src/zone/zone-segment.cc", + "src/zone/zone-segment.h", + "src/zone/zone-type-traits.h", + "src/zone/zone-utils.h", + "src/zone/zone.cc", + "src/zone/zone.h", + "src/asmjs/asm-js.h", + "src/execution/pointer-authentication-dummy.h", + "src/heap/third-party/heap-api.h", + "src/heap/third-party/heap-api-stub.cc", + ] + select({ + ":is_ia32": [ + "src/baseline/ia32/baseline-assembler-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.cc", + "src/codegen/ia32/cpu-ia32.cc", + "src/codegen/ia32/assembler-ia32-inl.h", + "src/codegen/ia32/assembler-ia32.cc", + "src/codegen/ia32/assembler-ia32.h", + "src/codegen/ia32/constants-ia32.h", + "src/codegen/ia32/interface-descriptors-ia32-inl.h", + "src/codegen/ia32/sse-instr.h", + "src/codegen/ia32/macro-assembler-ia32.cc", + "src/codegen/ia32/macro-assembler-ia32.h", + "src/codegen/ia32/register-ia32.h", + "src/compiler/backend/ia32/code-generator-ia32.cc", + "src/compiler/backend/ia32/instruction-codes-ia32.h", + "src/compiler/backend/ia32/instruction-scheduler-ia32.cc", + "src/compiler/backend/ia32/instruction-selector-ia32.cc", + "src/deoptimizer/ia32/deoptimizer-ia32.cc", + "src/diagnostics/ia32/disasm-ia32.cc", + "src/diagnostics/ia32/unwinder-ia32.cc", + "src/execution/ia32/frame-constants-ia32.cc", + "src/execution/ia32/frame-constants-ia32.h", + "src/regexp/ia32/regexp-macro-assembler-ia32.cc", + "src/regexp/ia32/regexp-macro-assembler-ia32.h", + "src/third_party/valgrind/valgrind.h", + "src/wasm/baseline/ia32/liftoff-assembler-ia32.h", + ], + ":is_x64": [ + "src/baseline/x64/baseline-assembler-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.cc", + "src/codegen/x64/cpu-x64.cc", + "src/codegen/x64/assembler-x64-inl.h", + "src/codegen/x64/assembler-x64.cc", + "src/codegen/x64/assembler-x64.h", + "src/codegen/x64/constants-x64.h", + "src/codegen/x64/fma-instr.h", + "src/codegen/x64/interface-descriptors-x64-inl.h", + "src/codegen/x64/sse-instr.h", + "src/codegen/x64/macro-assembler-x64.cc", + "src/codegen/x64/macro-assembler-x64.h", + "src/codegen/x64/register-x64.h", + "src/compiler/backend/x64/code-generator-x64.cc", + "src/compiler/backend/x64/instruction-codes-x64.h", + "src/compiler/backend/x64/instruction-scheduler-x64.cc", + "src/compiler/backend/x64/instruction-selector-x64.cc", + "src/compiler/backend/x64/unwinding-info-writer-x64.cc", + "src/compiler/backend/x64/unwinding-info-writer-x64.h", + "src/deoptimizer/x64/deoptimizer-x64.cc", + "src/diagnostics/x64/disasm-x64.cc", + "src/diagnostics/x64/eh-frame-x64.cc", + "src/diagnostics/x64/unwinder-x64.cc", + "src/execution/x64/frame-constants-x64.cc", + "src/execution/x64/frame-constants-x64.h", + "src/regexp/x64/regexp-macro-assembler-x64.cc", + "src/regexp/x64/regexp-macro-assembler-x64.h", + "src/third_party/valgrind/valgrind.h", + "src/wasm/baseline/x64/liftoff-assembler-x64.h", + ], + "is_arm": [ + "src/baseline/arm/baseline-assembler-arm-inl.h", + "src/baseline/arm/baseline-compiler-arm-inl.h", + "src/codegen/arm/assembler-arm-inl.h", + "src/codegen/arm/assembler-arm.cc", + "src/codegen/arm/assembler-arm.h", + "src/codegen/arm/constants-arm.cc", + "src/codegen/arm/constants-arm.h", + "src/codegen/arm/cpu-arm.cc", + "src/codegen/arm/interface-descriptors-arm-inl.h", + "src/codegen/arm/macro-assembler-arm.cc", + "src/codegen/arm/macro-assembler-arm.h", + "src/codegen/arm/register-arm.h", + "src/compiler/backend/arm/code-generator-arm.cc", + "src/compiler/backend/arm/instruction-codes-arm.h", + "src/compiler/backend/arm/instruction-scheduler-arm.cc", + "src/compiler/backend/arm/instruction-selector-arm.cc", + "src/compiler/backend/arm/unwinding-info-writer-arm.cc", + "src/compiler/backend/arm/unwinding-info-writer-arm.h", + "src/deoptimizer/arm/deoptimizer-arm.cc", + "src/diagnostics/arm/disasm-arm.cc", + "src/diagnostics/arm/eh-frame-arm.cc", + "src/diagnostics/arm/unwinder-arm.cc", + "src/execution/arm/frame-constants-arm.cc", + "src/execution/arm/frame-constants-arm.h", + "src/execution/arm/simulator-arm.cc", + "src/execution/arm/simulator-arm.h", + "src/regexp/arm/regexp-macro-assembler-arm.cc", + "src/regexp/arm/regexp-macro-assembler-arm.h", + "src/wasm/baseline/arm/liftoff-assembler-arm.h", + ], + ":is_arm64": [ + "src/baseline/arm64/baseline-assembler-arm64-inl.h", + "src/baseline/arm64/baseline-compiler-arm64-inl.h", + "src/codegen/arm64/assembler-arm64-inl.h", + "src/codegen/arm64/assembler-arm64.cc", + "src/codegen/arm64/assembler-arm64.h", + "src/codegen/arm64/constants-arm64.h", + "src/codegen/arm64/cpu-arm64.cc", + "src/codegen/arm64/decoder-arm64-inl.h", + "src/codegen/arm64/decoder-arm64.cc", + "src/codegen/arm64/decoder-arm64.h", + "src/codegen/arm64/interface-descriptors-arm64-inl.h", + "src/codegen/arm64/instructions-arm64-constants.cc", + "src/codegen/arm64/instructions-arm64.cc", + "src/codegen/arm64/instructions-arm64.h", + "src/codegen/arm64/macro-assembler-arm64-inl.h", + "src/codegen/arm64/macro-assembler-arm64.cc", + "src/codegen/arm64/macro-assembler-arm64.h", + "src/codegen/arm64/register-arm64.cc", + "src/codegen/arm64/register-arm64.h", + "src/codegen/arm64/utils-arm64.cc", + "src/codegen/arm64/utils-arm64.h", + "src/compiler/backend/arm64/code-generator-arm64.cc", + "src/compiler/backend/arm64/instruction-codes-arm64.h", + "src/compiler/backend/arm64/instruction-scheduler-arm64.cc", + "src/compiler/backend/arm64/instruction-selector-arm64.cc", + "src/compiler/backend/arm64/unwinding-info-writer-arm64.cc", + "src/compiler/backend/arm64/unwinding-info-writer-arm64.h", + "src/deoptimizer/arm64/deoptimizer-arm64.cc", + "src/diagnostics/arm64/disasm-arm64.cc", + "src/diagnostics/arm64/disasm-arm64.h", + "src/diagnostics/arm64/eh-frame-arm64.cc", + "src/diagnostics/arm64/unwinder-arm64.cc", + "src/execution/arm64/frame-constants-arm64.cc", + "src/execution/arm64/frame-constants-arm64.h", + "src/execution/arm64/pointer-auth-arm64.cc", + "src/execution/arm64/simulator-arm64.cc", + "src/execution/arm64/simulator-arm64.h", + "src/execution/arm64/simulator-logic-arm64.cc", + "src/regexp/arm64/regexp-macro-assembler-arm64.cc", + "src/regexp/arm64/regexp-macro-assembler-arm64.h", + "src/wasm/baseline/arm64/liftoff-assembler-arm64.h", + ], + }) + select({ + ":is_linux_x64_or_macos_x64": [ + "src/trap-handler/handler-inside-posix.cc", + "src/trap-handler/handler-outside-posix.cc", + ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_webassembly": [ + "src/asmjs/asm-js.cc", + "src/asmjs/asm-names.h", + "src/asmjs/asm-parser.cc", + "src/asmjs/asm-parser.h", + "src/asmjs/asm-scanner.cc", + "src/asmjs/asm-scanner.h", + "src/asmjs/asm-types.cc", + "src/asmjs/asm-types.h", + "src/compiler/int64-lowering.h", + "src/compiler/wasm-compiler.h", + "src/debug/debug-wasm-objects.cc", + "src/debug/debug-wasm-objects.h", + "src/debug/debug-wasm-objects-inl.h", + "src/runtime/runtime-test-wasm.cc", + "src/runtime/runtime-wasm.cc", + "src/wasm/baseline/liftoff-assembler.cc", + "src/wasm/baseline/liftoff-assembler-defs.h", + "src/wasm/baseline/liftoff-assembler.h", + "src/wasm/baseline/liftoff-compiler.cc", + "src/wasm/baseline/liftoff-compiler.h", + "src/wasm/baseline/liftoff-register.h", + "src/wasm/branch-hint-map.h", + "src/wasm/code-space-access.cc", + "src/wasm/code-space-access.h", + "src/wasm/compilation-environment.h", + "src/wasm/decoder.h", + "src/wasm/function-body-decoder.cc", + "src/wasm/function-body-decoder.h", + "src/wasm/function-body-decoder-impl.h", + "src/wasm/function-compiler.cc", + "src/wasm/function-compiler.h", + "src/wasm/graph-builder-interface.cc", + "src/wasm/graph-builder-interface.h", + "src/wasm/init-expr-interface.cc", + "src/wasm/init-expr-interface.h", + "src/wasm/jump-table-assembler.cc", + "src/wasm/jump-table-assembler.h", + "src/wasm/leb-helper.h", + "src/wasm/local-decl-encoder.cc", + "src/wasm/local-decl-encoder.h", + "src/wasm/memory-protection-key.cc", + "src/wasm/memory-protection-key.h", + "src/wasm/memory-tracing.cc", + "src/wasm/memory-tracing.h", + "src/wasm/module-compiler.cc", + "src/wasm/module-compiler.h", + "src/wasm/module-decoder.cc", + "src/wasm/module-decoder.h", + "src/wasm/module-instantiate.cc", + "src/wasm/module-instantiate.h", + "src/wasm/object-access.h", + "src/wasm/signature-map.cc", + "src/wasm/signature-map.h", + "src/wasm/simd-shuffle.cc", + "src/wasm/simd-shuffle.h", + "src/wasm/streaming-decoder.cc", + "src/wasm/streaming-decoder.h", + "src/wasm/struct-types.h", + "src/wasm/sync-streaming-decoder.cc", + "src/wasm/value-type.cc", + "src/wasm/value-type.h", + "src/wasm/wasm-arguments.h", + "src/wasm/wasm-code-manager.cc", + "src/wasm/wasm-code-manager.h", + "src/wasm/wasm-debug.cc", + "src/wasm/wasm-debug.h", + "src/wasm/wasm-engine.cc", + "src/wasm/wasm-engine.h", + "src/wasm/wasm-external-refs.cc", + "src/wasm/wasm-external-refs.h", + "src/wasm/wasm-features.cc", + "src/wasm/wasm-features.h", + "src/wasm/wasm-import-wrapper-cache.cc", + "src/wasm/wasm-import-wrapper-cache.h", + "src/wasm/wasm-init-expr.cc", + "src/wasm/wasm-init-expr.h", + "src/wasm/wasm-js.cc", + "src/wasm/wasm-js.h", + "src/wasm/wasm-linkage.h", + "src/wasm/wasm-module-builder.cc", + "src/wasm/wasm-module-builder.h", + "src/wasm/wasm-module.cc", + "src/wasm/wasm-module.h", + "src/wasm/wasm-module-sourcemap.cc", + "src/wasm/wasm-module-sourcemap.h", + "src/wasm/wasm-objects.cc", + "src/wasm/wasm-objects.h", + "src/wasm/wasm-objects-inl.h", + "src/wasm/wasm-opcodes.cc", + "src/wasm/wasm-opcodes.h", + "src/wasm/wasm-opcodes-inl.h", + "src/wasm/wasm-result.cc", + "src/wasm/wasm-result.h", + "src/wasm/wasm-serialization.cc", + "src/wasm/wasm-serialization.h", + "src/wasm/wasm-subtyping.cc", + "src/wasm/wasm-subtyping.h", + "src/wasm/wasm-tier.h", + "src/wasm/wasm-value.h", + ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_i18n_support": [ + "src/builtins/builtins-intl.cc", + "src/builtins/builtins-intl-gen.cc", + "src/objects/intl-objects.cc", + "src/objects/intl-objects.h", + "src/objects/js-break-iterator.cc", + "src/objects/js-break-iterator.h", + "src/objects/js-break-iterator-inl.h", + "src/objects/js-collator.cc", + "src/objects/js-collator.h", + "src/objects/js-collator-inl.h", + "src/objects/js-date-time-format.cc", + "src/objects/js-date-time-format.h", + "src/objects/js-date-time-format-inl.h", + "src/objects/js-display-names.cc", + "src/objects/js-display-names.h", + "src/objects/js-display-names-inl.h", + "src/objects/js-list-format.cc", + "src/objects/js-list-format.h", + "src/objects/js-list-format-inl.h", + "src/objects/js-locale.cc", + "src/objects/js-locale.h", + "src/objects/js-locale-inl.h", + "src/objects/js-number-format.cc", + "src/objects/js-number-format.h", + "src/objects/js-number-format-inl.h", + "src/objects/js-plural-rules.cc", + "src/objects/js-plural-rules.h", + "src/objects/js-plural-rules-inl.h", + "src/objects/js-relative-time-format.cc", + "src/objects/js-relative-time-format.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.h", + "src/objects/js-segment-iterator-inl.h", + "src/objects/js-segments.cc", + "src/objects/js-segments.h", + "src/objects/js-segments-inl.h", + "src/runtime/runtime-intl.cc", + "src/strings/char-predicates.cc", + ], + "//conditions:default": [], + }), +) + +filegroup( + name = "v8_compiler_files", + srcs = [ + "src/builtins/profile-data-reader.h", + "src/compiler/access-builder.cc", + "src/compiler/access-builder.h", + "src/compiler/access-info.cc", + "src/compiler/access-info.h", + "src/compiler/add-type-assertions-reducer.cc", + "src/compiler/add-type-assertions-reducer.h", + "src/compiler/all-nodes.cc", + "src/compiler/all-nodes.h", + "src/compiler/allocation-builder.h", + "src/compiler/allocation-builder-inl.h", + "src/compiler/backend/code-generator.cc", + "src/compiler/backend/code-generator.h", + "src/compiler/backend/code-generator-impl.h", + "src/compiler/backend/frame-elider.cc", + "src/compiler/backend/frame-elider.h", + "src/compiler/backend/gap-resolver.cc", + "src/compiler/backend/gap-resolver.h", + "src/compiler/backend/instruction.cc", + "src/compiler/backend/instruction.h", + "src/compiler/backend/instruction-codes.h", + "src/compiler/backend/instruction-scheduler.cc", + "src/compiler/backend/instruction-scheduler.h", + "src/compiler/backend/instruction-selector.cc", + "src/compiler/backend/instruction-selector.h", + "src/compiler/backend/instruction-selector-impl.h", + "src/compiler/backend/jump-threading.cc", + "src/compiler/backend/jump-threading.h", + "src/compiler/backend/mid-tier-register-allocator.cc", + "src/compiler/backend/mid-tier-register-allocator.h", + "src/compiler/backend/move-optimizer.cc", + "src/compiler/backend/move-optimizer.h", + "src/compiler/backend/register-allocation.h", + "src/compiler/backend/register-allocator.cc", + "src/compiler/backend/register-allocator.h", + "src/compiler/backend/register-allocator-verifier.cc", + "src/compiler/backend/register-allocator-verifier.h", + "src/compiler/backend/spill-placer.cc", + "src/compiler/backend/spill-placer.h", + "src/compiler/backend/unwinding-info-writer.h", + "src/compiler/basic-block-instrumentor.cc", + "src/compiler/basic-block-instrumentor.h", + "src/compiler/branch-elimination.cc", + "src/compiler/branch-elimination.h", + "src/compiler/bytecode-analysis.cc", + "src/compiler/bytecode-analysis.h", + "src/compiler/bytecode-graph-builder.cc", + "src/compiler/bytecode-graph-builder.h", + "src/compiler/bytecode-liveness-map.cc", + "src/compiler/bytecode-liveness-map.h", + "src/compiler/c-linkage.cc", + "src/compiler/checkpoint-elimination.cc", + "src/compiler/checkpoint-elimination.h", + "src/compiler/code-assembler.cc", + "src/compiler/code-assembler.h", + "src/compiler/common-node-cache.cc", + "src/compiler/common-node-cache.h", + "src/compiler/common-operator.cc", + "src/compiler/common-operator.h", + "src/compiler/common-operator-reducer.cc", + "src/compiler/common-operator-reducer.h", + "src/compiler/compilation-dependencies.cc", + "src/compiler/compilation-dependencies.h", + "src/compiler/compilation-dependency.h", + "src/compiler/compiler-source-position-table.cc", + "src/compiler/compiler-source-position-table.h", + "src/compiler/constant-folding-reducer.cc", + "src/compiler/constant-folding-reducer.h", + "src/compiler/control-equivalence.cc", + "src/compiler/control-equivalence.h", + "src/compiler/control-flow-optimizer.cc", + "src/compiler/control-flow-optimizer.h", + "src/compiler/csa-load-elimination.cc", + "src/compiler/csa-load-elimination.h", + "src/compiler/dead-code-elimination.cc", + "src/compiler/dead-code-elimination.h", + "src/compiler/decompression-optimizer.cc", + "src/compiler/decompression-optimizer.h", + "src/compiler/diamond.h", + "src/compiler/effect-control-linearizer.cc", + "src/compiler/effect-control-linearizer.h", + "src/compiler/escape-analysis.cc", + "src/compiler/escape-analysis.h", + "src/compiler/escape-analysis-reducer.cc", + "src/compiler/escape-analysis-reducer.h", + "src/compiler/fast-api-calls.cc", + "src/compiler/fast-api-calls.h", + "src/compiler/feedback-source.cc", + "src/compiler/feedback-source.h", + "src/compiler/frame.cc", + "src/compiler/frame.h", + "src/compiler/frame-states.cc", + "src/compiler/frame-states.h", + "src/compiler/functional-list.h", + "src/compiler/globals.h", + "src/compiler/graph.cc", + "src/compiler/graph.h", + "src/compiler/graph-assembler.cc", + "src/compiler/graph-assembler.h", + "src/compiler/graph-reducer.cc", + "src/compiler/graph-reducer.h", + "src/compiler/graph-trimmer.cc", + "src/compiler/graph-trimmer.h", + "src/compiler/graph-visualizer.cc", + "src/compiler/graph-visualizer.h", + "src/compiler/graph-zone-traits.h", + "src/compiler/heap-refs.cc", + "src/compiler/heap-refs.h", + "src/compiler/js-call-reducer.cc", + "src/compiler/js-call-reducer.h", + "src/compiler/js-context-specialization.cc", + "src/compiler/js-context-specialization.h", + "src/compiler/js-create-lowering.cc", + "src/compiler/js-create-lowering.h", + "src/compiler/js-generic-lowering.cc", + "src/compiler/js-generic-lowering.h", + "src/compiler/js-graph.cc", + "src/compiler/js-graph.h", + "src/compiler/js-heap-broker.cc", + "src/compiler/js-heap-broker.h", + "src/compiler/js-heap-copy-reducer.cc", + "src/compiler/js-heap-copy-reducer.h", + "src/compiler/js-inlining.cc", + "src/compiler/js-inlining.h", + "src/compiler/js-inlining-heuristic.cc", + "src/compiler/js-inlining-heuristic.h", + "src/compiler/js-intrinsic-lowering.cc", + "src/compiler/js-intrinsic-lowering.h", + "src/compiler/js-native-context-specialization.cc", + "src/compiler/js-native-context-specialization.h", + "src/compiler/js-operator.cc", + "src/compiler/js-operator.h", + "src/compiler/js-type-hint-lowering.cc", + "src/compiler/js-type-hint-lowering.h", + "src/compiler/js-typed-lowering.cc", + "src/compiler/js-typed-lowering.h", + "src/compiler/linkage.cc", + "src/compiler/linkage.h", + "src/compiler/load-elimination.cc", + "src/compiler/load-elimination.h", + "src/compiler/loop-analysis.cc", + "src/compiler/loop-analysis.h", + "src/compiler/loop-peeling.cc", + "src/compiler/loop-peeling.h", + "src/compiler/loop-unrolling.cc", + "src/compiler/loop-unrolling.h", + "src/compiler/loop-variable-optimizer.cc", + "src/compiler/loop-variable-optimizer.h", + "src/compiler/machine-graph.cc", + "src/compiler/machine-graph.h", + "src/compiler/machine-graph-verifier.cc", + "src/compiler/machine-graph-verifier.h", + "src/compiler/machine-operator.cc", + "src/compiler/machine-operator.h", + "src/compiler/machine-operator-reducer.cc", + "src/compiler/machine-operator-reducer.h", + "src/compiler/map-inference.cc", + "src/compiler/map-inference.h", + "src/compiler/memory-lowering.cc", + "src/compiler/memory-lowering.h", + "src/compiler/memory-optimizer.cc", + "src/compiler/memory-optimizer.h", + "src/compiler/node.cc", + "src/compiler/node.h", + "src/compiler/node-aux-data.h", + "src/compiler/node-cache.h", + "src/compiler/node-marker.cc", + "src/compiler/node-marker.h", + "src/compiler/node-matchers.cc", + "src/compiler/node-matchers.h", + "src/compiler/node-observer.cc", + "src/compiler/node-observer.h", + "src/compiler/node-origin-table.cc", + "src/compiler/node-origin-table.h", + "src/compiler/node-properties.cc", + "src/compiler/node-properties.h", + "src/compiler/opcodes.cc", + "src/compiler/opcodes.h", + "src/compiler/operation-typer.cc", + "src/compiler/operation-typer.h", + "src/compiler/operator.cc", + "src/compiler/operator.h", + "src/compiler/operator-properties.cc", + "src/compiler/operator-properties.h", + "src/compiler/osr.cc", + "src/compiler/osr.h", + "src/compiler/per-isolate-compiler-cache.h", + "src/compiler/persistent-map.h", + "src/compiler/pipeline.cc", + "src/compiler/pipeline.h", + "src/compiler/pipeline-statistics.cc", + "src/compiler/pipeline-statistics.h", + "src/compiler/processed-feedback.h", + "src/compiler/property-access-builder.cc", + "src/compiler/property-access-builder.h", + "src/compiler/raw-machine-assembler.cc", + "src/compiler/raw-machine-assembler.h", + "src/compiler/redundancy-elimination.cc", + "src/compiler/redundancy-elimination.h", + "src/compiler/refs-map.cc", + "src/compiler/refs-map.h", + "src/compiler/representation-change.cc", + "src/compiler/representation-change.h", + "src/compiler/schedule.cc", + "src/compiler/schedule.h", + "src/compiler/scheduler.cc", + "src/compiler/scheduler.h", + "src/compiler/select-lowering.cc", + "src/compiler/select-lowering.h", + "src/compiler/serializer-for-background-compilation.cc", + "src/compiler/serializer-for-background-compilation.h", + "src/compiler/serializer-hints.h", + "src/compiler/simplified-lowering.cc", + "src/compiler/simplified-lowering.h", + "src/compiler/simplified-operator.cc", + "src/compiler/simplified-operator.h", + "src/compiler/simplified-operator-reducer.cc", + "src/compiler/simplified-operator-reducer.h", + "src/compiler/state-values-utils.cc", + "src/compiler/state-values-utils.h", + "src/compiler/store-store-elimination.cc", + "src/compiler/store-store-elimination.h", + "src/compiler/type-cache.cc", + "src/compiler/type-cache.h", + "src/compiler/type-narrowing-reducer.cc", + "src/compiler/type-narrowing-reducer.h", + "src/compiler/typed-optimization.cc", + "src/compiler/typed-optimization.h", + "src/compiler/typer.cc", + "src/compiler/typer.h", + "src/compiler/types.cc", + "src/compiler/types.h", + "src/compiler/value-numbering-reducer.cc", + "src/compiler/value-numbering-reducer.h", + "src/compiler/verifier.cc", + "src/compiler/verifier.h", + "src/compiler/write-barrier-kind.h", + "src/compiler/zone-stats.cc", + "src/compiler/zone-stats.h", + ] + select({ + ":is_v8_enable_webassembly": [ + "src/compiler/int64-lowering.cc", + "src/compiler/wasm-compiler.cc", + ], + "//conditions:default": [], + }), +) + + + +filegroup( + name = "v8_initializers_files", + srcs = [ + "src/builtins/builtins-array-gen.cc", + "src/builtins/builtins-array-gen.h", + "src/builtins/builtins-async-function-gen.cc", + "src/builtins/builtins-async-gen.cc", + "src/builtins/builtins-async-gen.h", + "src/builtins/builtins-async-generator-gen.cc", + "src/builtins/builtins-async-iterator-gen.cc", + "src/builtins/builtins-bigint-gen.cc", + "src/builtins/builtins-bigint-gen.h", + "src/builtins/builtins-call-gen.cc", + "src/builtins/builtins-call-gen.h", + "src/builtins/builtins-collections-gen.cc", + "src/builtins/builtins-collections-gen.h", + "src/builtins/builtins-constructor-gen.cc", + "src/builtins/builtins-constructor-gen.h", + "src/builtins/builtins-constructor.h", + "src/builtins/builtins-conversion-gen.cc", + "src/builtins/builtins-data-view-gen.h", + "src/builtins/builtins-date-gen.cc", + "src/builtins/builtins-generator-gen.cc", + "src/builtins/builtins-global-gen.cc", + "src/builtins/builtins-handler-gen.cc", + "src/builtins/builtins-ic-gen.cc", + "src/builtins/builtins-internal-gen.cc", + "src/builtins/builtins-interpreter-gen.cc", + "src/builtins/builtins-iterator-gen.cc", + "src/builtins/builtins-iterator-gen.h", + "src/builtins/builtins-lazy-gen.cc", + "src/builtins/builtins-lazy-gen.h", + "src/builtins/builtins-microtask-queue-gen.cc", + "src/builtins/builtins-number-gen.cc", + "src/builtins/builtins-object-gen.cc", + "src/builtins/builtins-promise-gen.cc", + "src/builtins/builtins-promise-gen.h", + "src/builtins/builtins-proxy-gen.cc", + "src/builtins/builtins-proxy-gen.h", + "src/builtins/builtins-regexp-gen.cc", + "src/builtins/builtins-regexp-gen.h", + "src/builtins/builtins-sharedarraybuffer-gen.cc", + "src/builtins/builtins-string-gen.cc", + "src/builtins/builtins-string-gen.h", + "src/builtins/builtins-typed-array-gen.cc", + "src/builtins/builtins-typed-array-gen.h", + "src/builtins/builtins-utils-gen.h", + "src/builtins/growable-fixed-array-gen.cc", + "src/builtins/growable-fixed-array-gen.h", + "src/builtins/profile-data-reader.cc", + "src/builtins/profile-data-reader.h", + "src/builtins/setup-builtins-internal.cc", + "src/builtins/torque-csa-header-includes.h", + "src/codegen/code-stub-assembler.cc", + "src/codegen/code-stub-assembler.h", + "src/heap/setup-heap-internal.cc", + "src/ic/accessor-assembler.cc", + "src/ic/accessor-assembler.h", + "src/ic/binary-op-assembler.cc", + "src/ic/binary-op-assembler.h", + "src/ic/keyed-store-generic.cc", + "src/ic/keyed-store-generic.h", + "src/ic/unary-op-assembler.cc", + "src/ic/unary-op-assembler.h", + "src/interpreter/interpreter-assembler.cc", + "src/interpreter/interpreter-assembler.h", + "src/interpreter/interpreter-generator.cc", + "src/interpreter/interpreter-generator.h", + "src/interpreter/interpreter-intrinsics-generator.cc", + "src/interpreter/interpreter-intrinsics-generator.h", + ] + select({ + ":is_ia32": ["src/builtins/ia32/builtins-ia32.cc"], + ":is_x64": ["src/builtins/x64/builtins-x64.cc"], + ":is_arm" : ["src/builtins/arm/builtins-arm.cc"], + ":is_arm64": ["src/builtins/arm64/builtins-arm64.cc"], + }) + select({ + ":is_v8_enable_webassembly": [ + "src/builtins/builtins-wasm-gen.cc", + "src/builtins/builtins-wasm-gen.h", + ], + "//conditions:default": [], + }), +) + +filegroup( + name = "cppgc_base_files", + srcs = [ + "src/heap/cppgc/allocation.cc", + "src/heap/cppgc/compaction-worklists.cc", + "src/heap/cppgc/compaction-worklists.h", + "src/heap/cppgc/compactor.cc", + "src/heap/cppgc/compactor.h", + "src/heap/cppgc/concurrent-marker.cc", + "src/heap/cppgc/concurrent-marker.h", + "src/heap/cppgc/default-platform.cc", + "src/heap/cppgc/explicit-management.cc", + "src/heap/cppgc/free-list.cc", + "src/heap/cppgc/free-list.h", + "src/heap/cppgc/garbage-collector.h", + "src/heap/cppgc/gc-info.cc", + "src/heap/cppgc/gc-info-table.cc", + "src/heap/cppgc/gc-info-table.h", + "src/heap/cppgc/gc-invoker.cc", + "src/heap/cppgc/gc-invoker.h", + "src/heap/cppgc/heap.cc", + "src/heap/cppgc/heap.h", + "src/heap/cppgc/heap-base.cc", + "src/heap/cppgc/heap-base.h", + "src/heap/cppgc/heap-consistency.cc", + "src/heap/cppgc/heap-growing.cc", + "src/heap/cppgc/heap-growing.h", + "src/heap/cppgc/heap-object-header.cc", + "src/heap/cppgc/heap-object-header.h", + "src/heap/cppgc/heap-page.cc", + "src/heap/cppgc/heap-page.h", + "src/heap/cppgc/heap-space.cc", + "src/heap/cppgc/heap-space.h", + "src/heap/cppgc/heap-state.cc", + "src/heap/cppgc/heap-statistics-collector.cc", + "src/heap/cppgc/heap-statistics-collector.h", + "src/heap/cppgc/heap-visitor.h", + "src/heap/cppgc/incremental-marking-schedule.cc", + "src/heap/cppgc/incremental-marking-schedule.h", + "src/heap/cppgc/liveness-broker.cc", + "src/heap/cppgc/liveness-broker.h", + "src/heap/cppgc/logging.cc", + "src/heap/cppgc/marker.cc", + "src/heap/cppgc/marker.h", + "src/heap/cppgc/marking-state.cc", + "src/heap/cppgc/marking-state.h", + "src/heap/cppgc/marking-verifier.cc", + "src/heap/cppgc/marking-verifier.h", + "src/heap/cppgc/marking-visitor.cc", + "src/heap/cppgc/marking-visitor.h", + "src/heap/cppgc/marking-worklists.cc", + "src/heap/cppgc/marking-worklists.h", + "src/heap/cppgc/memory.h", + "src/heap/cppgc/metric-recorder.h", + "src/heap/cppgc/name-trait.cc", + "src/heap/cppgc/object-allocator.cc", + "src/heap/cppgc/object-allocator.h", + "src/heap/cppgc/object-poisoner.h", + "src/heap/cppgc/object-size-trait.cc", + "src/heap/cppgc/object-start-bitmap.h", + "src/heap/cppgc/object-view.h", + "src/heap/cppgc/page-memory.cc", + "src/heap/cppgc/page-memory.h", + "src/heap/cppgc/persistent-node.cc", + "src/heap/cppgc/platform.cc", + "src/heap/cppgc/pointer-policies.cc", + "src/heap/cppgc/prefinalizer-handler.cc", + "src/heap/cppgc/prefinalizer-handler.h", + "src/heap/cppgc/process-heap.cc", + "src/heap/cppgc/process-heap.h", + "src/heap/cppgc/process-heap-statistics.cc", + "src/heap/cppgc/process-heap-statistics.h", + "src/heap/cppgc/raw-heap.cc", + "src/heap/cppgc/raw-heap.h", + "src/heap/cppgc/source-location.cc", + "src/heap/cppgc/stats-collector.cc", + "src/heap/cppgc/stats-collector.h", + "src/heap/cppgc/sweeper.cc", + "src/heap/cppgc/sweeper.h", + "src/heap/cppgc/task-handle.h", + "src/heap/cppgc/trace-event.h", + "src/heap/cppgc/trace-trait.cc", + "src/heap/cppgc/virtual-memory.cc", + "src/heap/cppgc/virtual-memory.h", + "src/heap/cppgc/visitor.cc", + "src/heap/cppgc/visitor.h", + "src/heap/cppgc/write-barrier.cc", + "src/heap/cppgc/write-barrier.h", + ], +) + +filegroup( + name = "v8_cppgc_shared_files", + srcs = [ + "src/heap/base/stack.cc", + "src/heap/base/stack.h", + "src/heap/base/worklist.cc", + "src/heap/base/worklist.h", + "src/heap/cppgc/globals.h", + ] + select({ + ":is_ia32": ["src/heap/base/asm/ia32/push_registers_asm.cc"], + ":is_x64": ["src/heap/base/asm/x64/push_registers_asm.cc"], + ":is_arm" : ["src/heap/base/asm/arm/push_registers_asm.cc"], + ":is_arm64": ["src/heap/base/asm/arm64/push_registers_asm.cc"], + }), +) + +filegroup( + name = "v8_bigint", + srcs = [ + "src/bigint/bigint-internal.cc", + "src/bigint/bigint-internal.h", + "src/bigint/bigint.h", + "src/bigint/digit-arithmetic.h", + "src/bigint/div-burnikel.cc", + "src/bigint/div-helpers.cc", + "src/bigint/div-helpers.h", + "src/bigint/div-schoolbook.cc", + "src/bigint/mul-fft.cc", + "src/bigint/mul-karatsuba.cc", + "src/bigint/mul-schoolbook.cc", + "src/bigint/mul-toom.cc", + "src/bigint/tostring.cc", + "src/bigint/util.h", + "src/bigint/vector-arithmetic.cc", + "src/bigint/vector-arithmetic.h", + ], +) + +filegroup( + name = "mksnapshot_files", + srcs = [ + "src/snapshot/embedded/embedded-empty.cc", + "src/snapshot/embedded/embedded-file-writer.cc", + "src/snapshot/embedded/embedded-file-writer.h", + "src/snapshot/embedded/platform-embedded-file-writer-aix.cc", + "src/snapshot/embedded/platform-embedded-file-writer-aix.h", + "src/snapshot/embedded/platform-embedded-file-writer-base.cc", + "src/snapshot/embedded/platform-embedded-file-writer-base.h", + "src/snapshot/embedded/platform-embedded-file-writer-generic.cc", + "src/snapshot/embedded/platform-embedded-file-writer-generic.h", + "src/snapshot/embedded/platform-embedded-file-writer-mac.cc", + "src/snapshot/embedded/platform-embedded-file-writer-mac.h", + "src/snapshot/embedded/platform-embedded-file-writer-win.cc", + "src/snapshot/embedded/platform-embedded-file-writer-win.h", + "src/snapshot/mksnapshot.cc", + "src/snapshot/snapshot-empty.cc", + "src/init/setup-isolate-full.cc", + ] +) + +filegroup( + name = "v8_inspector_files", + srcs = [ + "src/inspector/custom-preview.cc", + "src/inspector/custom-preview.h", + "src/inspector/injected-script.cc", + "src/inspector/injected-script.h", + "src/inspector/inspected-context.cc", + "src/inspector/inspected-context.h", + "src/inspector/remote-object-id.cc", + "src/inspector/remote-object-id.h", + "src/inspector/search-util.cc", + "src/inspector/search-util.h", + "src/inspector/string-16.cc", + "src/inspector/string-16.h", + "src/inspector/string-util.cc", + "src/inspector/string-util.h", + "src/inspector/test-interface.cc", + "src/inspector/test-interface.h", + "src/inspector/v8-console.cc", + "src/inspector/v8-console.h", + "src/inspector/v8-console-agent-impl.cc", + "src/inspector/v8-console-agent-impl.h", + "src/inspector/v8-console-message.cc", + "src/inspector/v8-console-message.h", + "src/inspector/v8-debugger.cc", + "src/inspector/v8-debugger.h", + "src/inspector/v8-debugger-agent-impl.cc", + "src/inspector/v8-debugger-agent-impl.h", + "src/inspector/v8-debugger-script.cc", + "src/inspector/v8-debugger-script.h", + "src/inspector/v8-heap-profiler-agent-impl.cc", + "src/inspector/v8-heap-profiler-agent-impl.h", + "src/inspector/v8-inspector-impl.cc", + "src/inspector/v8-inspector-impl.h", + "src/inspector/v8-inspector-session-impl.cc", + "src/inspector/v8-inspector-session-impl.h", + "src/inspector/v8-profiler-agent-impl.cc", + "src/inspector/v8-profiler-agent-impl.h", + "src/inspector/v8-regex.cc", + "src/inspector/v8-regex.h", + "src/inspector/v8-runtime-agent-impl.cc", + "src/inspector/v8-runtime-agent-impl.h", + "src/inspector/v8-schema-agent-impl.cc", + "src/inspector/v8-schema-agent-impl.h", + "src/inspector/v8-stack-trace-impl.cc", + "src/inspector/v8-stack-trace-impl.h", + "src/inspector/v8-string-conversions.cc", + "src/inspector/v8-string-conversions.h", + "src/inspector/v8-value-utils.cc", + "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.h", + ":crdtp_platform_files", + ":generated_inspector_files", + ], +) + +filegroup( + name = "crdtp_platform_files", + srcs = [ + "third_party/inspector_protocol/crdtp/json_platform.h", + "third_party/inspector_protocol/crdtp/json_platform_v8.cc", + ":crdtp_files", + ], +) + +filegroup( + name = "crdtp_files", + srcs = [ + "third_party/inspector_protocol/crdtp/cbor.cc", + "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.h", + "third_party/inspector_protocol/crdtp/error_support.cc", + "third_party/inspector_protocol/crdtp/error_support.h", + "third_party/inspector_protocol/crdtp/export.h", + "third_party/inspector_protocol/crdtp/find_by_first.h", + "third_party/inspector_protocol/crdtp/frontend_channel.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.h", + "third_party/inspector_protocol/crdtp/parser_handler.h", + "third_party/inspector_protocol/crdtp/serializable.cc", + "third_party/inspector_protocol/crdtp/serializable.h", + "third_party/inspector_protocol/crdtp/serializer_traits.h", + "third_party/inspector_protocol/crdtp/span.cc", + "third_party/inspector_protocol/crdtp/span.h", + "third_party/inspector_protocol/crdtp/status.cc", + "third_party/inspector_protocol/crdtp/status.h", + ], +) + +filegroup( + name = "snapshot_files", + srcs = [ + "src/init/setup-isolate-deserialize.cc", + # TODO(victorgomes): Create a flag to select pregenerated snapshots. + ":generated_snapshot_files", + ] +) + +filegroup( + name = "wee8_files", + srcs = [ + "src/wasm/c-api.cc", + "src/wasm/c-api.h", + "third_party/wasm-api/wasm.h", + "third_party/wasm-api/wasm.hh", + ] +) + +# ================================================= +# Generated files +# ================================================= + +# TODO(victorgomes): Add support to tools/debug_helper, +# which needs class-debug-readers and debug-macros. +v8_torque( + name = "generated_torque_files", + srcs = [":torque_files"], + extras = [ + "bit-fields.h", + "builtin-definitions.h", + # "class-debug-readers.cc", + # "class-debug-readers.h", + "class-forward-declarations.h", + "class-verifiers.cc", + "class-verifiers.h", + "csa-types.h", + # "debug-macros.cc", + # "debug-macros.h", + "enum-verifiers.cc", + "exported-macros-assembler.cc", + "exported-macros-assembler.h", + "factory.cc", + "factory.inc", + "field-offsets.h", + "instance-types.h", + "interface-descriptors.inc", + "objects-body-descriptors-inl.inc", + "objects-printer.cc", + ], + args = select({ + ":is_v8_annotate_torque_ir": [ "-annotate-ir" ], + "//conditions:default": [], + }) + select({ + ":is_32bits": [ "-m32" ], + "//conditions:default": [], + }), +) + +genrule( + name = "generated_inspector_files", + srcs = [ "include/js_protocol.pdl" ], + outs = [ + "include/inspector/Debugger.h", + "include/inspector/Runtime.h", + "include/inspector/Schema.h", + "src/inspector/protocol/Forward.h", + "src/inspector/protocol/Protocol.cpp", + "src/inspector/protocol/Protocol.h", + "src/inspector/protocol/Console.cpp", + "src/inspector/protocol/Console.h", + "src/inspector/protocol/Debugger.cpp", + "src/inspector/protocol/Debugger.h", + "src/inspector/protocol/HeapProfiler.cpp", + "src/inspector/protocol/HeapProfiler.h", + "src/inspector/protocol/Profiler.cpp", + "src/inspector/protocol/Profiler.h", + "src/inspector/protocol/Runtime.cpp", + "src/inspector/protocol/Runtime.h", + "src/inspector/protocol/Schema.cpp", + "src/inspector/protocol/Schema.h", + ], + message = "Generating inspector files", + cmd = "bazel/generate-inspector-files.sh $(@D)", + local = 1, +) + +genrule( + name = "generated_bytecode_builtins_list", + srcs = [], + outs = ["builtins-generated/bytecodes-builtins-list.h"], + cmd = "$(location :bytecode_builtins_list_generator) $@", + tools = [":bytecode_builtins_list_generator"], +) + +genrule( + name = "generated_regexp_special_case", + srcs = [], + outs = ["src/regexp/special-case.cc"], + cmd = "$(location :regexp_special_case_generator) $@", + tools = [":regexp_special_case_generator"], +) + +v8_mksnapshot( + name = "generated_snapshot_files", + args = select({ + ":is_v8_enable_verify_heap": [ "--verify-heap" ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_fast_mksnapshot": [ + "--no-turbo-rewrite-far-jumps", + "--no-turbo-verify-allocation", + ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_snapshot_code_comments": [ "--code-comments" ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_snapshot_native_code_counters": [ + "--native-code-counters" + ], + "//conditions:default": [ "--no-native-code-counters" ], + }) +) + +# ================================================= +# Libraries rules +# ================================================= + +v8_library( + name = "v8_libbase", + srcs = [ + ":v8_shared_internal_headers", + ":v8_libbase_files", + ], +) + +v8_library( + name = "v8_libshared", + srcs = [ + ":generated_torque_files", + ":torque_runtime_support_files", + ":v8_base_without_compiler_files", + ":v8_compiler_files", + ":v8_initializers_files", + ":v8_libplatform_files", + ":v8_libsampler_files", + ":v8_shared_internal_headers", + ] + select({ + ":is_v8_enable_i18n_support": [ ":generated_regexp_special_case" ], + "//conditions:default": [], + }), + deps = [ + ":v8_libbase", + "@zlib", + ] + select({ + ":is_v8_enable_i18n_support": [ "@icu" ], + "//conditions:default": [], + }), +) + +v8_library( + name = "v8", + srcs = [ + ":snapshot_files", + ":v8_inspector_files", + ], + deps = [ ":v8_libshared" ], +) + +# TODO(victorgomes): Check if v8_enable_webassembly is true. +v8_library( + name = "wee8", + srcs = [ ":wee8_files" ], + deps = [ ":v8" ], +) + +# ================================================= +# Binary rules +# ================================================= + +v8_binary( + name = "bytecode_builtins_list_generator", + srcs = [ + "src/builtins/generate-bytecodes-builtins-list.cc", + "src/interpreter/bytecode-operands.cc", + "src/interpreter/bytecode-operands.h", + "src/interpreter/bytecode-traits.h", + "src/interpreter/bytecodes.cc", + "src/interpreter/bytecodes.h", + ], + deps = [ "v8_libbase" ], +) + +v8_binary( + name = "regexp_special_case_generator", + srcs = [ + ":v8_shared_internal_headers", + ":v8_libbase_files", + "src/regexp/special-case.h", + "src/regexp/gen-regexp-special-case.cc", + ], + deps = [ "@icu" ], +) + +v8_binary( + name = "torque", + srcs = [ + ":torque_base_files", + "src/torque/torque.cc", + ], + copts = [ "-fexceptions" ], + features = [ "-use_header_modules" ], + deps = [ "v8_libbase" ], +) + +v8_binary( + name = "mksnapshot", + srcs = [ ":mksnapshot_files" ], + deps = [ ":v8_libshared" ], + linkopts = select({ + "is_android": [ "-llog" ], + "//conditions:default": [], + }), +) + +v8_binary( + name = "d8", + 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", + ], + deps = [ ":v8" ], +) diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index 5e3045bfdc1d80..17bab98e8faba5 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -79,6 +79,9 @@ declare_args() { # Sets -dENABLE_VTUNE_TRACEMARK. v8_enable_vtunetracemark = false + # Sets -dENABLE_HUGEPAGE + v8_enable_hugepage = false + # Sets -dENABLE_HANDLE_ZAPPING. v8_enable_handle_zapping = is_debug @@ -150,6 +153,15 @@ declare_args() { # v8_enable_concurrent_marking_state. See the default setting code below. v8_enable_concurrent_marking = true + # Sets -dV8_IGNITION_DISPATCH_COUNTING. + # Enables counting frequencies of bytecode dispatches. After building in this + # configuration, subsequent runs of d8 can output frequencies for each pair + # of (current, next) bytecode instructions executed if you specify + # --trace-ignition-dispatches-output-file, or can generate a JS object with + # those frequencies if you run with --expose-ignition-statistics and call the + # extension function getIgnitionDispatchCounters(). + v8_enable_ignition_dispatch_counting = false + # Runs mksnapshot with --turbo-profiling. After building in this # configuration, any subsequent run of d8 will output information about usage # of basic blocks in builtins. @@ -184,6 +196,11 @@ declare_args() { # Sets -dV8_SHORT_BUILTIN_CALLS v8_enable_short_builtin_calls = "" + # Enable support for external code range relative to the pointer compression + # cage. + # Sets -dV8_EXTERNAL_CODE_SPACE + v8_enable_external_code_space = "" + # With post mortem support enabled, metadata is embedded into libv8 that # describes various parameters of the VM for use by debuggers. See # tools/gen-postmortem-metadata.py for details. @@ -213,11 +230,8 @@ declare_args() { # Enable mitigations for executing untrusted code. # Disabled by default on ia32 due to conflicting requirements with embedded - # builtins. Enabled by default on Android since it doesn't support - # site-isolation in Chrome and on simulator builds which test code generation - # on these platforms. - v8_untrusted_code_mitigations = - v8_current_cpu != "x86" && (is_android || target_is_simulator) + # builtins. + v8_untrusted_code_mitigations = false # Enable minor mark compact. v8_enable_minor_mc = true @@ -283,6 +297,10 @@ declare_args() { # TODO(v8:11785): Enable by default when running with the verifier. cppgc_enable_verify_live_bytes = false + # Enable assignment checks for Members/Persistents during prefinalizer invocations. + # TODO(v8:11749): Enable by default after fixing any existing issues in Blink. + cppgc_enable_check_assignments_in_prefinalizers = false + # Enable young generation in cppgc. cppgc_enable_young_generation = false @@ -317,6 +335,13 @@ declare_args() { # Allow for JS promise hooks (instead of just C++). v8_allow_javascript_in_promise_hooks = false + + # Enable allocation folding globally (sets -dV8_ALLOCATION_FOLDING). + # When it's disabled, the --turbo-allocation-folding runtime flag will be ignored. + v8_enable_allocation_folding = true + + # Enable global allocation site tracking. + v8_allocation_site_tracking = true } # Derived defaults. @@ -371,6 +396,9 @@ if (v8_enable_short_builtin_calls == "") { v8_enable_short_builtin_calls = v8_current_cpu == "x64" || (!is_android && v8_current_cpu == "arm64") } +if (v8_enable_external_code_space == "") { + v8_enable_external_code_space = false +} if (v8_enable_single_generation == "") { v8_enable_single_generation = v8_disable_write_barriers } @@ -386,6 +414,10 @@ if (v8_enable_third_party_heap) { v8_enable_shared_ro_heap = false v8_enable_pointer_compression = false v8_enable_pointer_compression_shared_cage = false + v8_enable_allocation_folding = false +} +if (v8_enable_single_generation) { + v8_allocation_site_tracking = false } assert(!v8_enable_concurrent_marking || v8_enable_atomic_object_field_writes, "Concurrent marking requires atomic object field writes.") @@ -448,13 +480,17 @@ assert(!v8_use_multi_snapshots || !v8_control_flow_integrity, assert(!v8_enable_heap_sandbox || v8_enable_pointer_compression, "V8 Heap Sandbox requires pointer compression") +assert(!v8_enable_heap_sandbox || !v8_enable_external_code_space, + "V8 Heap Sandbox is not compatible with external code space YET") + assert( !v8_enable_pointer_compression_shared_cage || v8_enable_pointer_compression, "Can't share a pointer compression cage if pointers aren't compressed") -assert(!v8_enable_pointer_compression_shared_cage || v8_current_cpu == "x64" || - v8_current_cpu == "arm64", - "Sharing a pointer compression cage is only supported on x64 and arm64") +assert( + !v8_enable_pointer_compression_shared_cage || v8_current_cpu == "x64" || + v8_current_cpu == "arm64" || v8_current_cpu == "riscv64", + "Sharing a pointer compression cage is only supported on x64,arm64 and riscv64") assert(!v8_enable_unconditional_write_barriers || !v8_disable_write_barriers, "Write barriers can't be both enabled and disabled") @@ -605,6 +641,7 @@ external_v8_defines = [ "V8_NO_ARGUMENTS_ADAPTOR", "V8_USE_PERFETTO", "V8_MAP_PACKING", + "V8_IS_TSAN", ] enabled_external_v8_defines = [] @@ -641,6 +678,9 @@ if (v8_use_perfetto) { if (v8_enable_map_packing) { enabled_external_v8_defines += [ "V8_MAP_PACKING" ] } +if (is_tsan) { + enabled_external_v8_defines += [ "V8_IS_TSAN" ] +} disabled_external_v8_defines = external_v8_defines - enabled_external_v8_defines @@ -711,6 +751,10 @@ config("features") { defines += [ "CPPGC_VERIFY_LIVE_BYTES" ] } + if (cppgc_enable_check_assignments_in_prefinalizers) { + defines += [ "CPPGC_CHECK_ASSIGNMENTS_IN_PREFINALIZERS" ] + } + if (v8_embedder_string != "") { defines += [ "V8_EMBEDDER_STRING=\"$v8_embedder_string\"" ] } @@ -743,6 +787,9 @@ config("features") { if (v8_enable_vtunetracemark) { defines += [ "ENABLE_VTUNE_TRACEMARK" ] } + if (v8_enable_hugepage) { + defines += [ "ENABLE_HUGEPAGE" ] + } if (v8_enable_minor_mc) { defines += [ "ENABLE_MINOR_MC" ] } @@ -805,6 +852,9 @@ config("features") { if (v8_enable_atomic_marking_state) { defines += [ "V8_ATOMIC_MARKING_STATE" ] } + if (v8_enable_ignition_dispatch_counting) { + defines += [ "V8_IGNITION_DISPATCH_COUNTING" ] + } if (v8_enable_lazy_source_positions) { defines += [ "V8_ENABLE_LAZY_SOURCE_POSITIONS" ] } @@ -841,6 +891,9 @@ config("features") { if (v8_enable_short_builtin_calls) { defines += [ "V8_SHORT_BUILTIN_CALLS" ] } + if (v8_enable_external_code_space) { + defines += [ "V8_EXTERNAL_CODE_SPACE" ] + } if (v8_enable_swiss_name_dictionary) { defines += [ "V8_ENABLE_SWISS_NAME_DICTIONARY" ] } @@ -859,6 +912,12 @@ config("features") { if (v8_allow_javascript_in_promise_hooks) { defines += [ "V8_ALLOW_JAVASCRIPT_IN_PROMISE_HOOKS" ] } + if (v8_enable_allocation_folding) { + defines += [ "V8_ALLOCATION_FOLDING" ] + } + if (v8_allocation_site_tracking) { + defines += [ "V8_ALLOCATION_SITE_TRACKING" ] + } } config("toolchain") { @@ -2350,8 +2409,8 @@ v8_header_set("v8_internal_headers") { "src/ast/variables.h", "src/baseline/baseline-assembler-inl.h", "src/baseline/baseline-assembler.h", + "src/baseline/baseline-batch-compiler.h", "src/baseline/baseline-compiler.h", - "src/baseline/baseline-osr-inl.h", "src/baseline/baseline.h", "src/baseline/bytecode-offset-iterator.h", "src/builtins/accessors.h", @@ -2458,6 +2517,7 @@ v8_header_set("v8_internal_headers") { "src/compiler/effect-control-linearizer.h", "src/compiler/escape-analysis-reducer.h", "src/compiler/escape-analysis.h", + "src/compiler/fast-api-calls.h", "src/compiler/feedback-source.h", "src/compiler/frame-states.h", "src/compiler/frame.h", @@ -2753,21 +2813,13 @@ v8_header_set("v8_internal_headers") { "src/logging/log-utils.h", "src/logging/log.h", "src/logging/metrics.h", + "src/logging/runtime-call-stats-scope.h", "src/logging/runtime-call-stats.h", "src/logging/tracing-flags.h", - "src/numbers/bignum-dtoa.h", - "src/numbers/bignum.h", - "src/numbers/cached-powers.h", "src/numbers/conversions-inl.h", "src/numbers/conversions.h", - "src/numbers/diy-fp.h", - "src/numbers/double.h", - "src/numbers/dtoa.h", - "src/numbers/fast-dtoa.h", - "src/numbers/fixed-dtoa.h", "src/numbers/hash-seed-inl.h", "src/numbers/math-random.h", - "src/numbers/strtod.h", "src/objects/all-objects-inl.h", "src/objects/allocation-site-inl.h", "src/objects/allocation-site-scopes-inl.h", @@ -2879,6 +2931,7 @@ v8_header_set("v8_internal_headers") { "src/objects/object-list-macros.h", "src/objects/object-macros-undef.h", "src/objects/object-macros.h", + "src/objects/object-type.h", "src/objects/objects-body-descriptors-inl.h", "src/objects/objects-body-descriptors.h", "src/objects/objects-inl.h", @@ -3057,8 +3110,6 @@ v8_header_set("v8_internal_headers") { "src/tracing/trace-event.h", "src/tracing/traced-value.h", "src/tracing/tracing-category-observer.h", - "src/trap-handler/trap-handler-internal.h", - "src/trap-handler/trap-handler.h", "src/utils/address-map.h", "src/utils/allocation.h", "src/utils/bit-vector.h", @@ -3073,7 +3124,6 @@ v8_header_set("v8_internal_headers") { "src/utils/scoped-list.h", "src/utils/utils-inl.h", "src/utils/utils.h", - "src/utils/vector.h", "src/utils/version.h", "src/zone/accounting-allocator.h", "src/zone/compressed-zone-ptr.h", @@ -3106,6 +3156,8 @@ v8_header_set("v8_internal_headers") { "src/compiler/wasm-compiler.h", "src/debug/debug-wasm-objects-inl.h", "src/debug/debug-wasm-objects.h", + "src/trap-handler/trap-handler-internal.h", + "src/trap-handler/trap-handler.h", "src/wasm/baseline/liftoff-assembler-defs.h", "src/wasm/baseline/liftoff-assembler.h", "src/wasm/baseline/liftoff-compiler.h", @@ -3117,6 +3169,7 @@ v8_header_set("v8_internal_headers") { "src/wasm/function-body-decoder.h", "src/wasm/function-compiler.h", "src/wasm/graph-builder-interface.h", + "src/wasm/init-expr-interface.h", "src/wasm/jump-table-assembler.h", "src/wasm/leb-helper.h", "src/wasm/local-decl-encoder.h", @@ -3156,6 +3209,12 @@ v8_header_set("v8_internal_headers") { ] } + if (!v8_enable_third_party_heap) { + sources += filter_include(v8_third_party_heap_files, [ "*.h" ]) + } else { + sources += [ "src/heap/third-party/heap-api.h" ] + } + if (v8_enable_i18n_support) { sources += [ "src/objects/intl-objects.h", @@ -3248,16 +3307,19 @@ v8_header_set("v8_internal_headers") { "src/wasm/baseline/x64/liftoff-assembler-x64.h", ] - # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both - # based on Darwin and thus POSIX-compliant to a similar degree. - if (is_linux || is_chromeos || is_mac || is_ios || target_os == "freebsd") { - sources += [ "src/trap-handler/handler-inside-posix.h" ] - } if (is_win) { - sources += [ - "src/diagnostics/unwinding-info-win64.h", - "src/trap-handler/handler-inside-win.h", - ] + sources += [ "src/diagnostics/unwinding-info-win64.h" ] + } + + if (v8_enable_webassembly) { + # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both + # based on Darwin and thus POSIX-compliant to a similar degree. + if (is_linux || is_chromeos || is_mac || is_ios || + target_os == "freebsd") { + sources += [ "src/trap-handler/handler-inside-posix.h" ] + } else if (is_win) { + sources += [ "src/trap-handler/handler-inside-win.h" ] + } } } else if (v8_current_cpu == "arm") { sources += [ ### gcmole(arch:arm) ### @@ -3302,7 +3364,7 @@ v8_header_set("v8_internal_headers") { if (v8_control_flow_integrity) { sources += [ "src/execution/arm64/pointer-authentication-arm64.h" ] } - if (current_cpu == "arm64" && is_mac) { + if (v8_enable_webassembly && current_cpu == "arm64" && is_mac) { sources += [ "src/trap-handler/handler-inside-posix.h" ] } if (is_win) { @@ -3456,6 +3518,7 @@ v8_compiler_sources = [ "src/compiler/effect-control-linearizer.cc", "src/compiler/escape-analysis-reducer.cc", "src/compiler/escape-analysis.cc", + "src/compiler/fast-api-calls.cc", "src/compiler/feedback-source.cc", "src/compiler/frame-states.cc", "src/compiler/frame.cc", @@ -3630,6 +3693,7 @@ v8_source_set("v8_base_without_compiler") { "src/ast/scopes.cc", "src/ast/source-range-ast-visitor.cc", "src/ast/variables.cc", + "src/baseline/baseline-batch-compiler.cc", "src/baseline/baseline-compiler.cc", "src/baseline/baseline.cc", "src/baseline/bytecode-offset-iterator.cc", @@ -3845,16 +3909,8 @@ v8_source_set("v8_base_without_compiler") { "src/logging/metrics.cc", "src/logging/runtime-call-stats.cc", "src/logging/tracing-flags.cc", - "src/numbers/bignum-dtoa.cc", - "src/numbers/bignum.cc", - "src/numbers/cached-powers.cc", "src/numbers/conversions.cc", - "src/numbers/diy-fp.cc", - "src/numbers/dtoa.cc", - "src/numbers/fast-dtoa.cc", - "src/numbers/fixed-dtoa.cc", "src/numbers/math-random.cc", - "src/numbers/strtod.cc", "src/objects/backing-store.cc", "src/objects/bigint.cc", "src/objects/code-kind.cc", @@ -3892,6 +3948,7 @@ v8_source_set("v8_base_without_compiler") { "src/objects/map-updater.cc", "src/objects/map.cc", "src/objects/module.cc", + "src/objects/object-type.cc", "src/objects/objects.cc", "src/objects/ordered-hash-table.cc", "src/objects/osr-optimized-code-cache.cc", @@ -3908,6 +3965,7 @@ v8_source_set("v8_base_without_compiler") { "src/objects/synthetic-module.cc", "src/objects/tagged-impl.cc", "src/objects/template-objects.cc", + "src/objects/templates.cc", "src/objects/transitions.cc", "src/objects/type-hints.cc", "src/objects/value-serializer.cc", @@ -4021,9 +4079,6 @@ v8_source_set("v8_base_without_compiler") { "src/tracing/trace-event.cc", "src/tracing/traced-value.cc", "src/tracing/tracing-category-observer.cc", - "src/trap-handler/handler-inside.cc", - "src/trap-handler/handler-outside.cc", - "src/trap-handler/handler-shared.cc", "src/utils/address-map.cc", "src/utils/allocation.cc", "src/utils/bit-vector.cc", @@ -4050,11 +4105,16 @@ v8_source_set("v8_base_without_compiler") { "src/debug/debug-wasm-objects.cc", "src/runtime/runtime-test-wasm.cc", "src/runtime/runtime-wasm.cc", + "src/trap-handler/handler-inside.cc", + "src/trap-handler/handler-outside.cc", + "src/trap-handler/handler-shared.cc", "src/wasm/baseline/liftoff-assembler.cc", "src/wasm/baseline/liftoff-compiler.cc", + "src/wasm/code-space-access.cc", "src/wasm/function-body-decoder.cc", "src/wasm/function-compiler.cc", "src/wasm/graph-builder-interface.cc", + "src/wasm/init-expr-interface.cc", "src/wasm/jump-table-assembler.cc", "src/wasm/local-decl-encoder.cc", "src/wasm/memory-protection-key.cc", @@ -4088,12 +4148,9 @@ v8_source_set("v8_base_without_compiler") { } if (v8_enable_third_party_heap) { - sources += v8_third_party_heap_files + sources += filter_exclude(v8_third_party_heap_files, [ "*.h" ]) } else { - sources += [ - "src/heap/third-party/heap-api-stub.cc", - "src/heap/third-party/heap-api.h", - ] + sources += [ "src/heap/third-party/heap-api-stub.cc" ] } if (v8_enable_conservative_stack_scanning) { @@ -4146,20 +4203,25 @@ v8_source_set("v8_base_without_compiler") { "src/regexp/x64/regexp-macro-assembler-x64.cc", ] - # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both - # based on Darwin and thus POSIX-compliant to a similar degree. - if (is_linux || is_chromeos || is_mac || is_ios || target_os == "freebsd") { - sources += [ - "src/trap-handler/handler-inside-posix.cc", - "src/trap-handler/handler-outside-posix.cc", - ] - } if (is_win) { - sources += [ - "src/diagnostics/unwinding-info-win64.cc", - "src/trap-handler/handler-inside-win.cc", - "src/trap-handler/handler-outside-win.cc", - ] + sources += [ "src/diagnostics/unwinding-info-win64.cc" ] + } + + if (v8_enable_webassembly) { + # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both + # based on Darwin and thus POSIX-compliant to a similar degree. + if (is_linux || is_chromeos || is_mac || is_ios || + target_os == "freebsd") { + sources += [ + "src/trap-handler/handler-inside-posix.cc", + "src/trap-handler/handler-outside-posix.cc", + ] + } else if (is_win) { + sources += [ + "src/trap-handler/handler-inside-win.cc", + "src/trap-handler/handler-outside-win.cc", + ] + } } } else if (v8_current_cpu == "arm") { sources += [ ### gcmole(arch:arm) ### @@ -4203,7 +4265,7 @@ v8_source_set("v8_base_without_compiler") { "src/execution/arm64/simulator-logic-arm64.cc", "src/regexp/arm64/regexp-macro-assembler-arm64.cc", ] - if (current_cpu == "arm64" && is_mac) { + if (v8_enable_webassembly && current_cpu == "arm64" && is_mac) { sources += [ "src/trap-handler/handler-inside-posix.cc", "src/trap-handler/handler-outside-posix.cc", @@ -4447,6 +4509,8 @@ v8_source_set("torque_base") { "src/torque/class-debug-reader-generator.cc", "src/torque/constants.h", "src/torque/contextual.h", + "src/torque/cpp-builder.cc", + "src/torque/cpp-builder.h", "src/torque/csa-generator.cc", "src/torque/csa-generator.h", "src/torque/declarable.cc", @@ -4597,6 +4661,23 @@ v8_component("v8_libbase") { "src/base/logging.h", "src/base/macros.h", "src/base/memory.h", + "src/base/numbers/bignum-dtoa.cc", + "src/base/numbers/bignum-dtoa.h", + "src/base/numbers/bignum.cc", + "src/base/numbers/bignum.h", + "src/base/numbers/cached-powers.cc", + "src/base/numbers/cached-powers.h", + "src/base/numbers/diy-fp.cc", + "src/base/numbers/diy-fp.h", + "src/base/numbers/double.h", + "src/base/numbers/dtoa.cc", + "src/base/numbers/dtoa.h", + "src/base/numbers/fast-dtoa.cc", + "src/base/numbers/fast-dtoa.h", + "src/base/numbers/fixed-dtoa.cc", + "src/base/numbers/fixed-dtoa.h", + "src/base/numbers/strtod.cc", + "src/base/numbers/strtod.h", "src/base/once.cc", "src/base/once.h", "src/base/optional.h", @@ -4626,6 +4707,8 @@ v8_component("v8_libbase") { "src/base/sanitizer/lsan.h", "src/base/sanitizer/msan.h", "src/base/small-vector.h", + "src/base/strings.cc", + "src/base/strings.h", "src/base/sys-info.cc", "src/base/sys-info.h", "src/base/template-utils.h", @@ -4633,6 +4716,7 @@ v8_component("v8_libbase") { "src/base/type-traits.h", "src/base/utils/random-number-generator.cc", "src/base/utils/random-number-generator.h", + "src/base/vector.h", "src/base/vlq-base64.cc", "src/base/vlq-base64.h", "src/base/vlq.h", @@ -4869,11 +4953,27 @@ v8_source_set("v8_bigint") { "src/bigint/bigint-internal.h", "src/bigint/bigint.h", "src/bigint/digit-arithmetic.h", + "src/bigint/div-burnikel.cc", + "src/bigint/div-helpers.cc", + "src/bigint/div-helpers.h", + "src/bigint/div-schoolbook.cc", + "src/bigint/mul-karatsuba.cc", "src/bigint/mul-schoolbook.cc", + "src/bigint/tostring.cc", + "src/bigint/util.h", "src/bigint/vector-arithmetic.cc", "src/bigint/vector-arithmetic.h", ] + if (v8_advanced_bigint_algorithms) { + sources += [ + "src/bigint/mul-fft.cc", + "src/bigint/mul-toom.cc", + ] + + defines = [ "V8_ADVANCED_BIGINT_ALGORITHMS" ] + } + configs = [ ":internal_config" ] } @@ -4962,6 +5062,10 @@ v8_header_set("cppgc_headers") { "include/cppgc/process-heap-statistics.h", "include/cppgc/sentinel-pointer.h", "include/cppgc/source-location.h", + + # TODO(v8:11952): Remove the testing header here once depending on both, + # //v8:v8 and //v8:v8_for_testing does not result in ODR violations. + "include/cppgc/testing.h", "include/cppgc/trace-trait.h", "include/cppgc/type-traits.h", "include/cppgc/visitor.h", @@ -5058,6 +5162,10 @@ v8_source_set("cppgc_base") { "src/heap/cppgc/sweeper.cc", "src/heap/cppgc/sweeper.h", "src/heap/cppgc/task-handle.h", + + # TODO(v8:11952): Remove the testing header here once depending on both, + # //v8:v8 and //v8:v8_for_testing does not result in ODR violations. + "src/heap/cppgc/testing.cc", "src/heap/cppgc/trace-event.h", "src/heap/cppgc/trace-trait.cc", "src/heap/cppgc/virtual-memory.cc", @@ -5094,22 +5202,6 @@ v8_source_set("cppgc_base") { } } -v8_source_set("cppgc_base_for_testing") { - visibility = [ ":*" ] - - sources = [ - "include/cppgc/testing.h", - "src/heap/cppgc/testing.cc", - ] - - configs = [ - ":internal_config", - ":cppgc_base_config", - ] - - public_deps = [ ":cppgc_base" ] -} - if (v8_check_header_includes) { # This file will be generated by tools/generate-header-include-checks.py # if the "check_v8_header_includes" gclient variable is set. @@ -5491,7 +5583,6 @@ if (is_component_build) { sources = [ "src/utils/v8dll-main.cc" ] public_deps = [ - ":cppgc_base_for_testing", ":torque_base", ":torque_ls_base", ":v8_base", @@ -5520,10 +5611,7 @@ if (is_component_build) { v8_component("cppgc_for_testing") { testonly = true - public_deps = [ - ":cppgc_base", - ":cppgc_base_for_testing", - ] + public_deps = [ ":cppgc_base" ] configs = [] public_configs = [ ":external_config" ] @@ -5552,7 +5640,6 @@ if (is_component_build) { testonly = true public_deps = [ - ":cppgc_base_for_testing", ":torque_base", ":torque_ls_base", ":v8_base", @@ -5577,10 +5664,7 @@ if (is_component_build) { group("cppgc_for_testing") { testonly = true - public_deps = [ - ":cppgc_base", - ":cppgc_base_for_testing", - ] + public_deps = [ ":cppgc_base" ] public_configs = [ ":external_config" ] } diff --git a/deps/v8/COMMON_OWNERS b/deps/v8/COMMON_OWNERS index 8072df037bf0c5..69222f9843c3d6 100644 --- a/deps/v8/COMMON_OWNERS +++ b/deps/v8/COMMON_OWNERS @@ -35,7 +35,6 @@ solanes@chromium.org syg@chromium.org szuend@chromium.org thibaudm@chromium.org -ulan@chromium.org vahl@chromium.org verwaest@chromium.org victorgomes@chromium.org diff --git a/deps/v8/DEPS b/deps/v8/DEPS index d3de2c5ddc9eaf..b1e297b106f44c 100644 --- a/deps/v8/DEPS +++ b/deps/v8/DEPS @@ -41,13 +41,18 @@ vars = { 'android_url': 'https://android.googlesource.com', 'download_gcmole': False, 'download_jsfunfuzz': False, + 'download_prebuilt_bazel': False, 'check_v8_header_includes': False, + 'checkout_reclient': False, + + # reclient CIPD package version + 'reclient_version': 're_client_version:0.33.0.3e223d5', # GN CIPD package version. - 'gn_version': 'git_revision:39a87c0b36310bdf06b692c098f199a0d97fc810', + 'gn_version': 'git_revision:24e2f7df92641de0351a96096fb2c490b2436bb8', # luci-go CIPD package version. - 'luci_go': 'git_revision:22d464e2f8f3bd2bd33f69fe819326d63f881008', + 'luci_go': 'git_revision:8b8a9a6040ca6debd30694a71a99a1eac97d72fd', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_build-tools_version @@ -84,16 +89,12 @@ vars = { } deps = { + 'base/trace_event/common': + Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + 'd5bb24e5d9802c8c917fcaa4375d5239a586c168', 'build': - Var('chromium_url') + '/chromium/src/build.git' + '@' + '4036cf1b17581f5668b487a25e252d56e0321a7f', - 'third_party/depot_tools': - Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '6b0a611c2c692684f94c0c3629f793feebd16b39', - 'third_party/icu': - Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'f022e298b4f4a782486bb6d5ce6589c998b51fe2', - 'third_party/instrumented_libraries': - Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + '4ae2535e8e894c3cd81d46aacdaf151b5df30709', + Var('chromium_url') + '/chromium/src/build.git' + '@' + '2d999384c270a340f592cce0a0fb3f8f94c15290', 'buildtools': - Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '20b1d0fc13ebaa263a1248f08814f523a86e6bed', + Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '2500c1d8f3a20a66a7cbafe3f69079a2edb742dd', 'buildtools/clang_format/script': Var('chromium_url') + '/external/github.com/llvm/llvm-project/clang/tools/clang-format.git' + '@' + '99803d74e35962f63a775f29477882afd4d57d94', 'buildtools/linux64': { @@ -117,11 +118,11 @@ deps = { 'condition': 'host_os == "mac"', }, 'buildtools/third_party/libc++/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + '8fa87946779682841e21e2da977eccfb6cb3bded', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + '79a2e924d96e2fc1e4b937c42efd08898fa472d7', 'buildtools/third_party/libc++abi/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + '767de317f97343db64af048e3d198ab8b10fee5d', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + '6803464b0f46df0a51862347d39e0791b59cf568', 'buildtools/third_party/libunwind/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + '7846d256355e40273f7cc192c8f5893e8665a1f9', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + 'a5feaf61658af4453e282142a76aeb6f9c045311', 'buildtools/win': { 'packages': [ { @@ -132,14 +133,50 @@ deps = { 'dep_type': 'cipd', 'condition': 'host_os == "win"', }, - 'base/trace_event/common': - Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + 'd5bb24e5d9802c8c917fcaa4375d5239a586c168', + 'buildtools/reclient': { + 'packages': [ + { + 'package': 'infra/rbe/client/${{platform}}', + 'version': Var('reclient_version'), + } + ], + 'dep_type': 'cipd', + 'condition': '(host_os == "linux" or host_os == "win") and checkout_reclient', + }, + 'test/benchmarks/data': + Var('chromium_url') + '/v8/deps/third_party/benchmarks.git' + '@' + '05d7188267b4560491ff9155c5ee13e207ecd65f', + 'test/mozilla/data': + Var('chromium_url') + '/v8/deps/third_party/mozilla-tests.git' + '@' + 'f6c578a10ea707b1a8ab0b88943fe5115ce2b9be', + 'test/test262/data': + Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + 'ebb6c34fa5dd76a6bea01c54ed7b182596492176', + 'test/test262/harness': + Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '278bcfaed0dcaa13936831fb1769d15e7c1e3b2b', + 'third_party/aemu-linux-x64': { + 'packages': [ + { + 'package': 'fuchsia/third_party/aemu/linux-amd64', + 'version': 'm4sM10idq7LeFHXpoLKLBtaOZsQzuj63Usa3Cl9af1YC' + }, + ], + 'condition': 'host_os == "linux" and checkout_fuchsia', + 'dep_type': 'cipd', + }, + 'third_party/aemu-mac-x64': { + 'packages': [ + { + 'package': 'fuchsia/third_party/aemu/mac-amd64', + 'version': 'T9bWxf8aUC5TwCFgPxpuW29Mfy-7Z9xCfXB9QO8MfU0C' + }, + ], + 'condition': 'host_os == "mac" and checkout_fuchsia', + 'dep_type': 'cipd', + }, 'third_party/android_ndk': { 'url': Var('chromium_url') + '/android_ndk.git' + '@' + '401019bf85744311b26c88ced255cd53401af8b7', 'condition': 'checkout_android', }, 'third_party/android_platform': { - 'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + 'fdaa5e5b9f6384c3011ca8479d672e47528f743f', + 'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + 'b291e88d8e3e6774d6d46151e11dc3189ddeeb09', 'condition': 'checkout_android', }, 'third_party/android_sdk/public': { @@ -181,36 +218,46 @@ deps = { 'dep_type': 'cipd', }, 'third_party/catapult': { - 'url': Var('chromium_url') + '/catapult.git' + '@' + 'c1e1d559b46476584ec0eb1d83bd7f43fa5a1b36', + 'url': Var('chromium_url') + '/catapult.git' + '@' + '2814ff3716a8512518bee705a0f91425ce06b27b', 'condition': 'checkout_android', }, 'third_party/colorama/src': { 'url': Var('chromium_url') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8', 'condition': 'checkout_android', }, + 'third_party/depot_tools': + Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + 'a806594b95a39141fdbf1f359087a44ffb2deaaf', 'third_party/fuchsia-sdk': { - 'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-sdk.git' + '@' + 'efa46583d89ea8c97523281d9f52a0d96472114d', + 'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-sdk.git' + '@' + '18896843130c33372c455c153ad07d2217bd2085', 'condition': 'checkout_fuchsia', }, - 'third_party/googletest/src': - Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '23ef29555ef4789f555f1ba8c51b4c52975f0907', 'third_party/google_benchmark/src': { - 'url': Var('chromium_url') + '/external/github.com/google/benchmark.git' + '@' + '7d0d9061d83b663ce05d9de5da3d5865a3845b79', + 'url': Var('chromium_url') + '/external/github.com/google/benchmark.git' + '@' + 'e451e50e9b8af453f076dec10bd6890847f1624e', + }, + 'third_party/googletest/src': + Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '4ec4cd23f486bf70efcc5d2caa40f24368f752e3', + 'third_party/icu': + Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'b9dfc58bf9b02ea0365509244aca13841322feb0', + 'third_party/instrumented_libraries': + Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + '4ae2535e8e894c3cd81d46aacdaf151b5df30709', + 'third_party/ittapi': { + # Force checkout ittapi libraries to pass v8 header includes check on + # bots that has check_v8_header_includes enabled. + 'url': Var('chromium_url') + '/external/github.com/intel/ittapi' + '@' + 'b4ae0122ba749163096058b4f1bb065bf4a7de94', + 'condition': "checkout_ittapi or check_v8_header_includes", }, 'third_party/jinja2': - Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + '11b6b3e5971d760bd2d310f77643f55a818a6d25', + Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + '7c54c1f227727e0c4c1d3dc19dd71cd601a2db95', + 'third_party/jsoncpp/source': + Var('chromium_url') + '/external/github.com/open-source-parsers/jsoncpp.git'+ '@' + '9059f5cad030ba11d37818847443a53918c327b1', + 'third_party/logdog/logdog': + Var('chromium_url') + '/infra/luci/luci-py/client/libs/logdog' + '@' + '794d09a24c10401953880c253d0c7e267234ab75', 'third_party/markupsafe': - Var('chromium_url') + '/chromium/src/third_party/markupsafe.git' + '@' + '0944e71f4b2cb9a871bcbe353f95e889b64a611a', - 'tools/swarming_client': - Var('chromium_url') + '/infra/luci/client-py.git' + '@' + 'a32a1607f6093d338f756c7e7c7b4333b0c50c9c', - 'test/benchmarks/data': - Var('chromium_url') + '/v8/deps/third_party/benchmarks.git' + '@' + '05d7188267b4560491ff9155c5ee13e207ecd65f', - 'test/mozilla/data': - Var('chromium_url') + '/v8/deps/third_party/mozilla-tests.git' + '@' + 'f6c578a10ea707b1a8ab0b88943fe5115ce2b9be', - 'test/test262/data': - Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + '6d353a4436747e2de8820efac27ae5ef7e601b60', - 'test/test262/harness': - Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '278bcfaed0dcaa13936831fb1769d15e7c1e3b2b', + Var('chromium_url') + '/chromium/src/third_party/markupsafe.git' + '@' + '1b882ef6372b58bfd55a3285f37ed801be9137cd', + 'third_party/perfetto': + Var('android_url') + '/platform/external/perfetto.git' + '@' + 'aa4385bc5997ecad4c633885e1b331b1115012fb', + 'third_party/protobuf': + Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + '6a59a2ad1f61d9696092f79b6d74368b4d7970a3', 'third_party/qemu-linux-x64': { 'packages': [ { @@ -231,28 +278,24 @@ deps = { 'condition': 'host_os == "mac" and checkout_fuchsia', 'dep_type': 'cipd', }, - 'third_party/aemu-linux-x64': { - 'packages': [ - { - 'package': 'fuchsia/third_party/aemu/linux-amd64', - 'version': '-Sz2gSN_5yVSHDlitjxUlmZpHuz-F2kFDW6TnmggCZoC' - }, - ], - 'condition': 'host_os == "linux" and checkout_fuchsia', - 'dep_type': 'cipd', - }, - 'third_party/aemu-mac-x64': { - 'packages': [ - { - 'package': 'fuchsia/third_party/aemu/mac-amd64', - 'version': 'T9bWxf8aUC5TwCFgPxpuW29Mfy-7Z9xCfXB9QO8MfU0C' - }, - ], - 'condition': 'host_os == "mac" and checkout_fuchsia', - 'dep_type': 'cipd', + 'third_party/requests': { + 'url': Var('chromium_url') + '/external/github.com/kennethreitz/requests.git' + '@' + '2c2138e811487b13020eb331482fb991fd399d4e', + 'condition': 'checkout_android', }, + 'third_party/zlib': + Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + 'dfbc590f5855bc2765256a743cad0abc56330a30', 'tools/clang': - Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'a38f01b956e091d5e698d2af484c81cd4e9a2a2d', + Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '9d0a403e85d25b5b0d3016a342d4b83b12941fd5', + 'tools/clang/dsymutil': { + 'packages': [ + { + 'package': 'chromium/llvm-build-tools/dsymutil', + 'version': 'M56jPzDv1620Rnm__jTMYS62Zi8rxHVq7yw0qeBFEgkC', + } + ], + 'condition': 'checkout_mac', + 'dep_type': 'cipd', + }, 'tools/luci-go': { 'packages': [ { @@ -271,34 +314,8 @@ deps = { 'condition': 'host_cpu != "s390" and host_os != "aix"', 'dep_type': 'cipd', }, - 'tools/clang/dsymutil': { - 'packages': [ - { - 'package': 'chromium/llvm-build-tools/dsymutil', - 'version': 'M56jPzDv1620Rnm__jTMYS62Zi8rxHVq7yw0qeBFEgkC', - } - ], - 'condition': 'checkout_mac', - 'dep_type': 'cipd', - }, - 'third_party/perfetto': - Var('android_url') + '/platform/external/perfetto.git' + '@' + 'aa4385bc5997ecad4c633885e1b331b1115012fb', - 'third_party/protobuf': - Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + '6a59a2ad1f61d9696092f79b6d74368b4d7970a3', - 'third_party/zlib': - Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '5b8d433953beb2a75a755ba321a3076b95f7cdb9', - 'third_party/jsoncpp/source': - Var('chromium_url') + '/external/github.com/open-source-parsers/jsoncpp.git'+ '@' + '9059f5cad030ba11d37818847443a53918c327b1', - 'third_party/ittapi': { - # Force checkout ittapi libraries to pass v8 header includes check on - # bots that has check_v8_header_includes enabled. - 'url': Var('chromium_url') + '/external/github.com/intel/ittapi' + '@' + 'b4ae0122ba749163096058b4f1bb065bf4a7de94', - 'condition': "checkout_ittapi or check_v8_header_includes", - }, - 'third_party/requests': { - 'url': Var('chromium_url') + '/external/github.com/kennethreitz/requests.git' + '@' + '2c2138e811487b13020eb331482fb991fd399d4e', - 'condition': 'checkout_android', - }, + 'tools/swarming_client': + Var('chromium_url') + '/infra/luci/client-py.git' + '@' + 'a32a1607f6093d338f756c7e7c7b4333b0c50c9c', } include_rules = [ @@ -340,6 +357,17 @@ hooks = [ 'tools/get_landmines.py', ], }, + { + 'name': 'bazel', + 'pattern': '.', + 'condition': 'download_prebuilt_bazel', + 'action': [ 'download_from_google_storage', + '--bucket', 'chromium-v8-prebuilt-bazel/linux', + '--no_resume', + '-s', 'tools/bazel/bazel.sha1', + '--platform=linux*', + ], + }, # Pull clang-format binaries using checked-in hashes. { 'name': 'clang_format_win', @@ -538,17 +566,6 @@ hooks = [ '--boot-images={checkout_fuchsia_boot_images}', ], }, - { - # Mac doesn't use lld so it's not included in the default clang bundle - # there. However, lld is need in Fuchsia cross builds, so - # download it there. - # Should run after the clang hook. - 'name': 'lld/mac', - 'pattern': '.', - 'condition': 'host_os == "mac" and checkout_fuchsia', - 'action': ['python', 'tools/clang/scripts/update.py', - '--package=lld_mac'], - }, { # Mac does not have llvm-objdump, download it for cross builds in Fuchsia. 'name': 'llvm-objdump', diff --git a/deps/v8/OWNERS b/deps/v8/OWNERS index 2ad1949b515935..6f0ac017208f5c 100644 --- a/deps/v8/OWNERS +++ b/deps/v8/OWNERS @@ -10,9 +10,13 @@ per-file .git-blame-ignore-revs=file:INFRA_OWNERS per-file .gitattributes=file:INFRA_OWNERS per-file .gitignore=file:INFRA_OWNERS per-file .gn=file:INFRA_OWNERS +per-file .mailmap=file:COMMON_OWNERS per-file .vpython=file:INFRA_OWNERS per-file .ycm_extra_conf.py=file:INFRA_OWNERS +per-file .bazelrc=file:COMMON_OWNERS +per-file BUILD.bazel=file:COMMON_OWNERS per-file BUILD.gn=file:COMMON_OWNERS +per-file WORKSPACE=file:COMMON_OWNERS per-file DEPS=file:INFRA_OWNERS # For Test262 rolls. per-file DEPS=mathias@chromium.org diff --git a/deps/v8/WATCHLISTS b/deps/v8/WATCHLISTS index c54f15ad797078..f691d88e921606 100644 --- a/deps/v8/WATCHLISTS +++ b/deps/v8/WATCHLISTS @@ -97,7 +97,13 @@ }, 'regexp': { 'filepath': 'src/.*regexp', - } + }, + 'bazel': { + 'filepath': 'BUILD.gn' \ + '|BUILD.bazel' \ + '|WORKSPACE' \ + '|bazel/' + }, }, 'WATCHLISTS': { @@ -156,5 +162,8 @@ 'jgruber+watch@chromium.org', 'pthier+watch@chromium.org' ], + 'bazel' : [ + 'victorgomes+watch@chromium.org' + ], }, } diff --git a/deps/v8/WORKSPACE b/deps/v8/WORKSPACE new file mode 100644 index 00000000000000..289902f68d857f --- /dev/null +++ b/deps/v8/WORKSPACE @@ -0,0 +1,29 @@ +# 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. + +workspace(name = "v8") + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +http_archive( + name = "bazel_skylib", + urls = [ + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", + ], + sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c", +) +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") +bazel_skylib_workspace() + +new_local_repository( + name = "zlib", + path = "third_party/zlib", + build_file = "bazel/BUILD.zlib", +) + +new_local_repository( + name = "icu", + path = "third_party/icu", + build_file = "bazel/BUILD.icu", +) diff --git a/deps/v8/bazel/BUILD.icu b/deps/v8/bazel/BUILD.icu new file mode 100644 index 00000000000000..fd651d513ddf89 --- /dev/null +++ b/deps/v8/bazel/BUILD.icu @@ -0,0 +1,76 @@ +# 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. + +filegroup( + name = "icudata", + srcs = [ "common/icudtl.dat" ] +) + +cc_library( + name = "icuuc", + srcs = glob([ + "source/common/**/*.h", + "source/common/**/*.cpp" + ]), + defines = [ + "U_COMMON_IMPLEMENTATION", + "U_ICUDATAENTRY_IN_COMMON", + "HAVE_DLOPEN=0", + "UCONFIG_ONLY_HTML_CONVERSION=1", + "U_CHARSET_IS_UTF8=1", + "U_USING_ICU_NAMESPACE=0", + "U_ENABLE_DYLOAD=0", + "USE_CHROMIUM_ICU=1", + "U_ENABLE_TRACING=1", + "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", + ], + includes = [ + "source/common", + "source/i18n", + ], + tags = ["requires-rtti"], + data = [ ":icudata" ], + alwayslink = 1, +) + +cc_library( + name = "icui18n", + srcs = glob([ + "source/i18n/**/*.h", + "source/i18n/**/*.cpp" + ]), + defines = [ + "U_I18N_IMPLEMENTATION", + ], + deps = [ ":icuuc" ], + alwayslink = 1, +) + +cc_library( + name = "icu", + hdrs = glob([ + "source/common/unicode/*.h", + "source/i18n/unicode/*.h", + ]), + srcs = [ + "source/stubdata/stubdata.cpp", + ], + include_prefix = "third_party/icu", + deps = [ + ":icuuc", + ":icui18n" + ], + visibility = ["//visibility:public"], + alwayslink = 1, +) diff --git a/deps/v8/bazel/BUILD.zlib b/deps/v8/bazel/BUILD.zlib new file mode 100644 index 00000000000000..0c97b325a34c51 --- /dev/null +++ b/deps/v8/bazel/BUILD.zlib @@ -0,0 +1,52 @@ +# 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. + +cc_library( + name = "zlib", + srcs = [ + "adler32.c", + "chromeconf.h", + "compress.c", + "contrib/optimizations/insert_string.h", + "cpu_features.c", + "cpu_features.h", + "crc32.c", + "crc32.h", + "deflate.c", + "deflate.h", + "gzclose.c", + "gzguts.h", + "gzlib.c", + "gzread.c", + "gzwrite.c", + "infback.c", + "inffast.c", + "inffast.h", + "inffixed.h", + "inflate.c", + "inflate.h", + "inftrees.c", + "inftrees.h", + "trees.c", + "trees.h", + "uncompr.c", + "zconf.h", + "zlib.h", + "zutil.c", + "zutil.h", + "google/compression_utils_portable.h", + "google/compression_utils_portable.cc", + ], + hdrs = [ + "zlib.h", + "google/compression_utils_portable.h", + ], + include_prefix = "third_party/zlib", + defines = [ + "CHROMIUM_ZLIB_NO_CHROMECONF", + "HAVE_HIDDEN", + "CPU_NO_SIMD", + ], + visibility = ["//visibility:public"], +) diff --git a/deps/v8/bazel/OWNERS b/deps/v8/bazel/OWNERS new file mode 100644 index 00000000000000..8636f621c416b4 --- /dev/null +++ b/deps/v8/bazel/OWNERS @@ -0,0 +1,5 @@ +# Google3 V8 owners +ahaas@chromium.org +cbruni@chromium.org +delphick@chromium.org +victorgomes@chromium.org diff --git a/deps/v8/bazel/defs.bzl b/deps/v8/bazel/defs.bzl new file mode 100644 index 00000000000000..fbd1830ecb1e35 --- /dev/null +++ b/deps/v8/bazel/defs.bzl @@ -0,0 +1,239 @@ +# 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. + +FlagInfo = provider(fields = ["value"]) + +def _options_impl(ctx): + return FlagInfo(value = ctx.build_setting_value) + +_create_option_flag = rule( + implementation = _options_impl, + build_setting = config.bool(flag = True), +) + +_create_option_string = rule( + implementation = _options_impl, + build_setting = config.string(flag = True), +) + +_create_option_int = rule( + implementation = _options_impl, + 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"}) + native.config_setting(name = "is_not_" + name, flag_values = {name: "False"}) + +def v8_string(name, default = ""): + _create_option_string(name = name, build_setting_default = default) + +def v8_int(name, default = 0): + _create_option_int(name = name, build_setting_default = default) + +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)) + 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"), + } +) + +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) + context = cc_common.create_compilation_context( + defines = depset( + defs, + transitive = [dep[CcInfo].compilation_context.defines for dep in ctx.attr.deps], + ), + headers = depset( + hdrs, + transitive = [dep[CcInfo].compilation_context.headers for dep in ctx.attr.deps], + ), + ) + return [CcInfo(compilation_context = context)] + +v8_config = rule( + implementation = _config_impl, + attrs = { + "conditional_defines": attr.label_keyed_string_dict(), + "defines": attr.string_list(), + "deps": attr.label_list(), + "hdrs": attr.label_list(allow_files = True), + }, +) + +def _default_args(configs): + 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 .", + ], + includes = ["include"], + linkopts = [ + "-pthread" + ] + select({ + ":is_macos": [], + "//conditions:default": [ "-Wl,--no-as-needed -ldl" ], + }) + select({ + ":should_add_rdynamic": [ "-rdynamic" ], + "//conditions:default": [], + }), + ) + +def v8_binary( + name, + srcs, + configs = [], + deps = [], + includes = [], + copts = [], + linkopts = [], + **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 + ) + +def v8_library( + name, + srcs, + configs = [], + deps = [], + includes = [], + copts = [], + linkopts = [], + **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 + ) + +def _torque_impl(ctx): + v8root = ctx.attr.v8root[FlagInfo].value + # Arguments + args = [] + args += ctx.attr.args + args.append("-o") + args.append(ctx.bin_dir.path + "/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 + 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] + ctx.actions.run( + outputs = outs, + inputs = ctx.files.srcs, + arguments = args, + executable = ctx.executable.tool, + progress_message = "Generating Torque files", + ) + return [DefaultInfo(files = depset(outs))] + +v8_torque = rule( + implementation = _torque_impl, + attrs = { + "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", + ), + "args": attr.string_list(), + "v8root": attr.label(default = ":v8_root"), + }, +) + +def _mksnapshot(ctx): + outs = [ + ctx.actions.declare_file("snapshot.cc"), + ctx.actions.declare_file("embedded.S"), + ] + ctx.actions.run( + outputs = outs, + inputs = [], + arguments = [ + "--embedded_variant=Default", + "--startup_src", outs[0].path, + "--embedded_src", outs[1].path, + ] + ctx.attr.args, + executable = ctx.executable.tool, + progress_message = "Running mksnapshot" + ) + return [DefaultInfo(files = depset(outs))] + + +v8_mksnapshot = rule( + implementation = _mksnapshot, + attrs = { + "args": attr.string_list(), + "tool": attr.label( + default = ":mksnapshot", + allow_files = True, + executable = True, + cfg = "host", + ), + } +) diff --git a/deps/v8/bazel/generate-inspector-files.sh b/deps/v8/bazel/generate-inspector-files.sh new file mode 100755 index 00000000000000..7fd4ab2a564a4e --- /dev/null +++ b/deps/v8/bazel/generate-inspector-files.sh @@ -0,0 +1,19 @@ +# 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. + +BAZEL_OUT=$1 + +# Create a default GN output folder +gn gen out/inspector + +# Generate inspector files +autoninja -C out/inspector src/inspector:inspector + +# Create directories in bazel output folder +mkdir -p $BAZEL_OUT/include/inspector +mkdir -p $BAZEL_OUT/src/inspector/protocol + +# Copy generated files to bazel output folder +cp out/inspector/gen/include/inspector/* $BAZEL_OUT/include/inspector/ +cp out/inspector/gen/src/inspector/protocol/* $BAZEL_OUT/src/inspector/protocol/ diff --git a/deps/v8/gni/v8.gni b/deps/v8/gni/v8.gni index 8741e86c087069..a3346517978b32 100644 --- a/deps/v8/gni/v8.gni +++ b/deps/v8/gni/v8.gni @@ -87,6 +87,10 @@ declare_args() { v8_enable_google_benchmark = false cppgc_is_standalone = false + + # Enable advanced BigInt algorithms, costing about 10-30 KB binary size + # depending on platform. Disabled on Android to save binary size. + v8_advanced_bigint_algorithms = !is_android } if (v8_use_external_startup_data == "") { diff --git a/deps/v8/include/OWNERS b/deps/v8/include/OWNERS index 7d538da1aa6642..d85849d52a1219 100644 --- a/deps/v8/include/OWNERS +++ b/deps/v8/include/OWNERS @@ -2,7 +2,6 @@ adamk@chromium.org cbruni@chromium.org leszeks@chromium.org mlippautz@chromium.org -ulan@chromium.org verwaest@chromium.org yangguo@chromium.org diff --git a/deps/v8/include/cppgc/allocation.h b/deps/v8/include/cppgc/allocation.h index 7a803cf2cc43b3..b06d9d70206409 100644 --- a/deps/v8/include/cppgc/allocation.h +++ b/deps/v8/include/cppgc/allocation.h @@ -5,25 +5,20 @@ #ifndef INCLUDE_CPPGC_ALLOCATION_H_ #define INCLUDE_CPPGC_ALLOCATION_H_ -#include - #include +#include +#include +#include #include #include "cppgc/custom-space.h" -#include "cppgc/garbage-collected.h" #include "cppgc/internal/api-constants.h" #include "cppgc/internal/gc-info.h" +#include "cppgc/type-traits.h" +#include "v8config.h" // NOLINT(build/include_directory) namespace cppgc { -template -class MakeGarbageCollectedTraitBase; - -namespace internal { -class ObjectAllocator; -} // namespace internal - /** * AllocationHandle is used to allocate garbage-collected objects. */ diff --git a/deps/v8/include/cppgc/heap-statistics.h b/deps/v8/include/cppgc/heap-statistics.h index 2fe6e1ae58abbb..8e626596e5b07b 100644 --- a/deps/v8/include/cppgc/heap-statistics.h +++ b/deps/v8/include/cppgc/heap-statistics.h @@ -5,7 +5,8 @@ #ifndef INCLUDE_CPPGC_HEAP_STATISTICS_H_ #define INCLUDE_CPPGC_HEAP_STATISTICS_H_ -#include +#include +#include #include #include @@ -30,19 +31,17 @@ struct HeapStatistics final { }; /** - * Statistics of object types. For each type the statistics record its name, - * how many objects of that type were allocated, and the overall size used by - * these objects. + * Object statistics for a single type. */ - struct ObjectStatistics { - /** Number of distinct types in the heap. */ - size_t num_types = 0; - /** Name of each type in the heap. */ - std::vector type_name; - /** Number of allocated objects per each type. */ - std::vector type_count; - /** Overall size of allocated objects per each type. */ - std::vector type_bytes; + struct ObjectStatsEntry { + /** + * Number of allocated bytes. + */ + size_t allocated_bytes; + /** + * Number of allocated objects. + */ + size_t object_count; }; /** @@ -50,10 +49,15 @@ struct HeapStatistics final { * allocated memory size and overall used memory size for the page. */ struct PageStatistics { - /** Overall amount of memory allocated for the page. */ - size_t physical_size_bytes = 0; + /** Overall committed amount of memory for the page. */ + size_t committed_size_bytes = 0; + /** Resident amount of memory held by the page. */ + size_t resident_size_bytes = 0; /** Amount of memory actually used on the page. */ size_t used_size_bytes = 0; + /** Statistics for object allocated on the page. Filled only when + * NameProvider::HideInternalNames() is false. */ + std::vector object_statistics; }; /** @@ -80,29 +84,35 @@ struct HeapStatistics final { struct SpaceStatistics { /** The space name */ std::string name; - /** Overall amount of memory allocated for the space. */ - size_t physical_size_bytes = 0; + /** Overall committed amount of memory for the heap. */ + size_t committed_size_bytes = 0; + /** Resident amount of memory held by the heap. */ + size_t resident_size_bytes = 0; /** Amount of memory actually used on the space. */ size_t used_size_bytes = 0; /** Statistics for each of the pages in the space. */ std::vector page_stats; /** Statistics for the freelist of the space. */ FreeListStatistics free_list_stats; - /** Statistics for object allocated on the space. Filled only when - * NameProvider::HideInternalNames() is false. */ - ObjectStatistics object_stats; }; - /** Overall amount of memory allocated for the heap. */ - size_t physical_size_bytes = 0; + /** Overall committed amount of memory for the heap. */ + size_t committed_size_bytes = 0; + /** Resident amount of memory help by the heap. */ + size_t resident_size_bytes = 0; /** Amount of memory actually used on the heap. */ size_t used_size_bytes = 0; /** Detail level of this HeapStatistics. */ DetailLevel detail_level; /** Statistics for each of the spaces in the heap. Filled only when - * detail_level is kDetailed. */ + * `detail_level` is `DetailLevel::kDetailed`. */ std::vector space_stats; + + /** + * Vector of `cppgc::GarbageCollected` type names. + */ + std::vector type_names; }; } // namespace cppgc diff --git a/deps/v8/include/cppgc/heap.h b/deps/v8/include/cppgc/heap.h index fd0512f1f18e16..136c4fb44d08ab 100644 --- a/deps/v8/include/cppgc/heap.h +++ b/deps/v8/include/cppgc/heap.h @@ -5,6 +5,8 @@ #ifndef INCLUDE_CPPGC_HEAP_H_ #define INCLUDE_CPPGC_HEAP_H_ +#include +#include #include #include diff --git a/deps/v8/include/cppgc/internal/api-constants.h b/deps/v8/include/cppgc/internal/api-constants.h index a70f00710c8b8a..7253a47089352c 100644 --- a/deps/v8/include/cppgc/internal/api-constants.h +++ b/deps/v8/include/cppgc/internal/api-constants.h @@ -5,8 +5,8 @@ #ifndef INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_ #define INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_ -#include -#include +#include +#include #include "v8config.h" // NOLINT(build/include_directory) diff --git a/deps/v8/include/cppgc/internal/gc-info.h b/deps/v8/include/cppgc/internal/gc-info.h index b9074b1ad5d1b9..0830b194909fb8 100644 --- a/deps/v8/include/cppgc/internal/gc-info.h +++ b/deps/v8/include/cppgc/internal/gc-info.h @@ -7,6 +7,7 @@ #include #include +#include #include "cppgc/internal/finalizer-trait.h" #include "cppgc/internal/name-trait.h" diff --git a/deps/v8/include/cppgc/internal/name-trait.h b/deps/v8/include/cppgc/internal/name-trait.h index ae99d41c0d76f9..2e2da1eab4a225 100644 --- a/deps/v8/include/cppgc/internal/name-trait.h +++ b/deps/v8/include/cppgc/internal/name-trait.h @@ -73,7 +73,7 @@ class NameTrait final : public NameTraitBase { private: static HeapObjectName GetNameFor(const NameProvider* name_provider) { - return {name_provider->GetName(), false}; + return {name_provider->GetHumanReadableName(), false}; } static HeapObjectName GetNameFor(...) { @@ -91,7 +91,7 @@ class NameTrait final : public NameTraitBase { static const HeapObjectName leaky_name = GetNameFromTypeSignature(PRETTY_FUNCTION_VALUE); - return leaky_name; + return {leaky_name, false}; #undef PRETTY_FUNCTION_VALUE diff --git a/deps/v8/include/cppgc/internal/pointer-policies.h b/deps/v8/include/cppgc/internal/pointer-policies.h index e09b86199f46b3..cdf0bb693d6996 100644 --- a/deps/v8/include/cppgc/internal/pointer-policies.h +++ b/deps/v8/include/cppgc/internal/pointer-policies.h @@ -82,7 +82,7 @@ class V8_EXPORT EnabledCheckingPolicy { class DisabledCheckingPolicy { protected: - void CheckPointer(const void* raw) {} + void CheckPointer(const void*) {} }; #if V8_ENABLE_CHECKS @@ -92,6 +92,10 @@ using DefaultPersistentCheckingPolicy = EnabledCheckingPolicy; using DefaultMemberCheckingPolicy = DisabledCheckingPolicy; using DefaultPersistentCheckingPolicy = DisabledCheckingPolicy; #endif +// For CT(W)P neither marking information (for value), nor objectstart bitmap +// (for slot) are guaranteed to be present because there's no synchonization +// between heaps after marking. +using DefaultCrossThreadPersistentCheckingPolicy = DisabledCheckingPolicy; class KeepLocationPolicy { public: @@ -154,7 +158,7 @@ struct WeakCrossThreadPersistentPolicy { // Forward declarations setting up the default policies. template + typename CheckingPolicy = DefaultCrossThreadPersistentCheckingPolicy> class BasicCrossThreadPersistent; template +#include + #include "cppgc/heap-state.h" #include "cppgc/internal/api-constants.h" #include "cppgc/internal/atomic-entry-flag.h" @@ -22,8 +25,11 @@ class HeapHandle; namespace internal { +#if defined(CPPGC_CAGED_HEAP) class WriteBarrierTypeForCagedHeapPolicy; +#else // !CPPGC_CAGED_HEAP class WriteBarrierTypeForNonCagedHeapPolicy; +#endif // !CPPGC_CAGED_HEAP class V8_EXPORT WriteBarrier final { public: diff --git a/deps/v8/include/cppgc/macros.h b/deps/v8/include/cppgc/macros.h index 70ab44c65759f1..030f397e3df15c 100644 --- a/deps/v8/include/cppgc/macros.h +++ b/deps/v8/include/cppgc/macros.h @@ -5,7 +5,7 @@ #ifndef INCLUDE_CPPGC_MACROS_H_ #define INCLUDE_CPPGC_MACROS_H_ -#include +#include #include "cppgc/internal/compiler-specific.h" diff --git a/deps/v8/include/cppgc/member.h b/deps/v8/include/cppgc/member.h index 16aed060226ea3..d0bf414c69d7f5 100644 --- a/deps/v8/include/cppgc/member.h +++ b/deps/v8/include/cppgc/member.h @@ -226,20 +226,20 @@ class BasicMember final : private MemberBase, private CheckingPolicy { template -bool operator==( - BasicMember member1, - BasicMember - member2) { +bool operator==(const BasicMember& member1, + const BasicMember& member2) { return member1.Get() == member2.Get(); } template -bool operator!=( - BasicMember member1, - BasicMember - member2) { +bool operator!=(const BasicMember& member1, + const BasicMember& member2) { return !(member1 == member2); } diff --git a/deps/v8/include/cppgc/name-provider.h b/deps/v8/include/cppgc/name-provider.h index 8b70b8ea5ee89a..224dd4b5d678ec 100644 --- a/deps/v8/include/cppgc/name-provider.h +++ b/deps/v8/include/cppgc/name-provider.h @@ -57,7 +57,7 @@ class V8_EXPORT NameProvider { * * @returns a human readable name for the object. */ - virtual const char* GetName() const = 0; + virtual const char* GetHumanReadableName() const = 0; }; } // namespace cppgc diff --git a/deps/v8/include/cppgc/persistent.h b/deps/v8/include/cppgc/persistent.h index 22cda7c6e8fcb7..03b5e5b06b5e28 100644 --- a/deps/v8/include/cppgc/persistent.h +++ b/deps/v8/include/cppgc/persistent.h @@ -141,7 +141,7 @@ class BasicPersistent final : public PersistentBase, } // Move assignment. - BasicPersistent& operator=(BasicPersistent&& other) { + BasicPersistent& operator=(BasicPersistent&& other) noexcept { if (this == &other) return *this; Clear(); PersistentBase::operator=(std::move(other)); diff --git a/deps/v8/include/cppgc/platform.h b/deps/v8/include/cppgc/platform.h index 0d7377668cf258..2d933d620dc011 100644 --- a/deps/v8/include/cppgc/platform.h +++ b/deps/v8/include/cppgc/platform.h @@ -5,6 +5,8 @@ #ifndef INCLUDE_CPPGC_PLATFORM_H_ #define INCLUDE_CPPGC_PLATFORM_H_ +#include + #include "v8-platform.h" // NOLINT(build/include_directory) #include "v8config.h" // NOLINT(build/include_directory) diff --git a/deps/v8/include/cppgc/source-location.h b/deps/v8/include/cppgc/source-location.h index 29d69b0a1372e6..da5a5ede520138 100644 --- a/deps/v8/include/cppgc/source-location.h +++ b/deps/v8/include/cppgc/source-location.h @@ -5,6 +5,7 @@ #ifndef INCLUDE_CPPGC_SOURCE_LOCATION_H_ #define INCLUDE_CPPGC_SOURCE_LOCATION_H_ +#include #include #include "v8config.h" // NOLINT(build/include_directory) diff --git a/deps/v8/include/js_protocol.pdl b/deps/v8/include/js_protocol.pdl index 9c0483ae7059c2..63baa3da13b843 100644 --- a/deps/v8/include/js_protocol.pdl +++ b/deps/v8/include/js_protocol.pdl @@ -175,7 +175,7 @@ domain Debugger command enable parameters # The maximum size in bytes of collected scripts (not referenced by other heap objects) - # the debugger can hold. Puts no limit if paramter is omitted. + # the debugger can hold. Puts no limit if parameter is omitted. experimental optional number maxScriptsCacheSize returns # Unique identifier of the debugger. @@ -714,7 +714,7 @@ experimental domain HeapProfiler parameters # If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. optional boolean reportProgress - # If true, a raw snapshot without artifical roots will be generated + # If true, a raw snapshot without artificial roots will be generated optional boolean treatGlobalObjectsAsRoots # If true, numerical values are included in the snapshot optional boolean captureNumericValue @@ -972,13 +972,13 @@ domain Profiler # Reports coverage delta since the last poll (either from an event like this, or from # `takePreciseCoverage` for the current isolate. May only be sent if precise code # coverage has been started. This event can be trigged by the embedder to, for example, - # trigger collection of coverage data immediatelly at a certain point in time. + # trigger collection of coverage data immediately at a certain point in time. experimental event preciseCoverageDeltaUpdate parameters # Monotonically increasing time (in seconds) when the coverage update was taken in the backend. number timestamp # Identifier for distinguishing coverage events. - string occassion + string occasion # Coverage data for the current isolate. array of ScriptCoverage result @@ -1225,7 +1225,7 @@ domain Runtime string origin # Human readable name describing given context. string name - # A system-unique execution context identifier. Unlike the id, this is unique accross + # A system-unique execution context identifier. Unlike the id, this is unique across # multiple processes, so can be reliably used to identify specific context while backend # performs a cross-process navigation. experimental string uniqueId @@ -1254,6 +1254,10 @@ domain Runtime optional RemoteObject exception # Identifier of the context where exception happened. optional ExecutionContextId executionContextId + # Dictionary with entries of meta data that the client associated + # with this exception, such as information about associated network + # requests, etc. + experimental optional object exceptionMetaData # Number of milliseconds since epoch. type Timestamp extends number @@ -1343,6 +1347,8 @@ domain Runtime # Symbolic group name that can be used to release multiple objects. If objectGroup is not # specified and objectId is, objectGroup will be inherited from object. optional string objectGroup + # Whether to throw an exception if side effect cannot be ruled out during evaluation. + experimental optional boolean throwOnSideEffect returns # Call result. RemoteObject result @@ -1422,9 +1428,9 @@ domain Runtime # evaluation and allows unsafe-eval. Defaults to true. experimental optional boolean allowUnsafeEvalBlockedByCSP # An alternative way to specify the execution context to evaluate in. - # Compared to contextId that may be reused accross processes, this is guaranteed to be + # Compared to contextId that may be reused across processes, this is guaranteed to be # system-unique, so it can be used to prevent accidental evaluation of the expression - # in context different than intended (e.g. as a result of navigation accross process + # in context different than intended (e.g. as a result of navigation across process # boundaries). # This is mutually exclusive with `contextId`. experimental optional string uniqueContextId diff --git a/deps/v8/include/v8-fast-api-calls.h b/deps/v8/include/v8-fast-api-calls.h index cda1959c866548..1848800b488683 100644 --- a/deps/v8/include/v8-fast-api-calls.h +++ b/deps/v8/include/v8-fast-api-calls.h @@ -156,6 +156,7 @@ * - float64_t * Currently supported argument types: * - pointer to an embedder type + * - JavaScript array of primitive types * - bool * - int32_t * - uint32_t @@ -176,8 +177,43 @@ * passes NaN values as-is, i.e. doesn't normalize them. * * To be supported types: - * - arrays of C types + * - TypedArrays and ArrayBuffers * - arrays of embedder types + * + * + * The API offers a limited support for function overloads: + * + * \code + * void FastMethod_2Args(int param, bool another_param); + * void FastMethod_3Args(int param, bool another_param, int third_param); + * + * v8::CFunction fast_method_2args_c_func = + * MakeV8CFunction(FastMethod_2Args); + * v8::CFunction fast_method_3args_c_func = + * MakeV8CFunction(FastMethod_3Args); + * const v8::CFunction fast_method_overloads[] = {fast_method_2args_c_func, + * fast_method_3args_c_func}; + * Local method_template = + * v8::FunctionTemplate::NewWithCFunctionOverloads( + * isolate, SlowCallback, data, signature, length, + * constructor_behavior, side_effect_type, + * {fast_method_overloads, 2}); + * \endcode + * + * In this example a single FunctionTemplate is associated to multiple C++ + * functions. The overload resolution is currently only based on the number of + * arguments passed in a call. For example, if this method_template is + * registered with a wrapper JS object as described above, a call with two + * arguments: + * obj.method(42, true); + * will result in a fast call to FastMethod_2Args, while a call with three or + * more arguments: + * obj.method(42, true, 11); + * will result in a fast call to FastMethod_3Args. Instead a call with less than + * two arguments, like: + * obj.method(42); + * would not result in a fast call but would fall back to executing the + * associated SlowCallback. */ #ifndef INCLUDE_V8_FAST_API_CALLS_H_ @@ -217,22 +253,73 @@ class CTypeInfo { // than any valid Type enum. static constexpr Type kCallbackOptionsType = Type(255); + enum class SequenceType : uint8_t { + kScalar, + kIsSequence, // sequence + kIsTypedArray, // TypedArray of T or any ArrayBufferView if T + // is void + kIsArrayBuffer // ArrayBuffer + }; + enum class Flags : uint8_t { kNone = 0, + kAllowSharedBit = 1 << 0, // Must be an ArrayBuffer or TypedArray + kEnforceRangeBit = 1 << 1, // T must be integral + kClampBit = 1 << 2, // T must be integral + kIsRestrictedBit = 1 << 3, // T must be float or double }; - explicit constexpr CTypeInfo(Type type, Flags flags = Flags::kNone) - : type_(type), flags_(flags) {} + explicit constexpr CTypeInfo( + Type type, SequenceType sequence_type = SequenceType::kScalar, + Flags flags = Flags::kNone) + : type_(type), sequence_type_(sequence_type), flags_(flags) {} constexpr Type GetType() const { return type_; } - + constexpr SequenceType GetSequenceType() const { return sequence_type_; } constexpr Flags GetFlags() const { return flags_; } + static constexpr bool IsIntegralType(Type type) { + return type == Type::kInt32 || type == Type::kUint32 || + type == Type::kInt64 || type == Type::kUint64; + } + + static constexpr bool IsFloatingPointType(Type type) { + return type == Type::kFloat32 || type == Type::kFloat64; + } + + static constexpr bool IsPrimitive(Type type) { + return IsIntegralType(type) || IsFloatingPointType(type) || + type == Type::kBool; + } + private: Type type_; + SequenceType sequence_type_; Flags flags_; }; +template +struct FastApiTypedArray { + T* data; // should include the typed array offset applied + size_t length; // length in number of elements +}; + +// Any TypedArray. It uses kTypedArrayBit with base type void +// Overloaded args of ArrayBufferView and TypedArray are not supported +// (for now) because the generic “any” ArrayBufferView doesn’t have its +// own instance type. It could be supported if we specify that +// TypedArray always has precedence over the generic ArrayBufferView, +// but this complicates overload resolution. +struct FastApiArrayBufferView { + void* data; + size_t byte_length; +}; + +struct FastApiArrayBuffer { + void* data; + size_t byte_length; +}; + class V8_EXPORT CFunctionInfo { public: // Construct a struct to hold a CFunction's type information. @@ -284,6 +371,42 @@ class V8_EXPORT CFunction { const void* GetAddress() const { return address_; } const CFunctionInfo* GetTypeInfo() const { return type_info_; } + enum class OverloadResolution { kImpossible, kAtRuntime, kAtCompileTime }; + + // Returns whether an overload between this and the given CFunction can + // be resolved at runtime by the RTTI available for the arguments or at + // compile time for functions with different number of arguments. + OverloadResolution GetOverloadResolution(const CFunction* other) { + // Runtime overload resolution can only deal with functions with the + // same number of arguments. Functions with different arity are handled + // by compile time overload resolution though. + if (ArgumentCount() != other->ArgumentCount()) { + return OverloadResolution::kAtCompileTime; + } + + // The functions can only differ by a single argument position. + int diff_index = -1; + for (unsigned int i = 0; i < ArgumentCount(); ++i) { + if (ArgumentInfo(i).GetSequenceType() != + other->ArgumentInfo(i).GetSequenceType()) { + if (diff_index >= 0) { + return OverloadResolution::kImpossible; + } + diff_index = i; + + // We only support overload resolution between sequence types. + if (ArgumentInfo(i).GetSequenceType() == + CTypeInfo::SequenceType::kScalar || + other->ArgumentInfo(i).GetSequenceType() == + CTypeInfo::SequenceType::kScalar) { + return OverloadResolution::kImpossible; + } + } + } + + return OverloadResolution::kAtRuntime; + } + template static CFunction Make(F* func) { return ArgUnwrap::Make(func); @@ -412,28 +535,91 @@ struct TypeInfoHelper { } \ \ static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::Enum; } \ + static constexpr CTypeInfo::SequenceType SequenceType() { \ + return CTypeInfo::SequenceType::kScalar; \ + } \ }; -#define BASIC_C_TYPES(V) \ - V(void, kVoid) \ - V(bool, kBool) \ - V(int32_t, kInt32) \ - V(uint32_t, kUint32) \ - V(int64_t, kInt64) \ - V(uint64_t, kUint64) \ - V(float, kFloat32) \ - V(double, kFloat64) \ - V(ApiObject, kApiObject) \ - V(v8::Local, kV8Value) \ - V(v8::Local, kV8Value) +template +struct CTypeInfoTraits {}; + +#define DEFINE_TYPE_INFO_TRAITS(CType, Enum) \ + template <> \ + struct CTypeInfoTraits { \ + using ctype = CType; \ + }; + +#define PRIMITIVE_C_TYPES(V) \ + V(bool, kBool) \ + V(int32_t, kInt32) \ + V(uint32_t, kUint32) \ + V(int64_t, kInt64) \ + V(uint64_t, kUint64) \ + V(float, kFloat32) \ + V(double, kFloat64) + +// Same as above, but includes deprecated types for compatibility. +#define ALL_C_TYPES(V) \ + PRIMITIVE_C_TYPES(V) \ + V(void, kVoid) \ + V(v8::Local, kV8Value) \ + V(v8::Local, kV8Value) \ + V(ApiObject, kApiObject) // ApiObject was a temporary solution to wrap the pointer to the v8::Value. // Please use v8::Local in new code for the arguments and // v8::Local for the receiver, as ApiObject will be deprecated. -BASIC_C_TYPES(SPECIALIZE_GET_TYPE_INFO_HELPER_FOR) +ALL_C_TYPES(SPECIALIZE_GET_TYPE_INFO_HELPER_FOR) +PRIMITIVE_C_TYPES(DEFINE_TYPE_INFO_TRAITS) -#undef BASIC_C_TYPES +#undef PRIMITIVE_C_TYPES +#undef ALL_C_TYPES + +#define SPECIALIZE_GET_TYPE_INFO_HELPER_FOR_TA(T, Enum) \ + template <> \ + struct TypeInfoHelper> { \ + static constexpr CTypeInfo::Flags Flags() { \ + return CTypeInfo::Flags::kNone; \ + } \ + \ + static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::Enum; } \ + static constexpr CTypeInfo::SequenceType SequenceType() { \ + return CTypeInfo::SequenceType::kIsTypedArray; \ + } \ + }; + +#define TYPED_ARRAY_C_TYPES(V) \ + V(int32_t, kInt32) \ + V(uint32_t, kUint32) \ + V(int64_t, kInt64) \ + V(uint64_t, kUint64) \ + V(float, kFloat32) \ + V(double, kFloat64) + +TYPED_ARRAY_C_TYPES(SPECIALIZE_GET_TYPE_INFO_HELPER_FOR_TA) + +#undef TYPED_ARRAY_C_TYPES + +template <> +struct TypeInfoHelper> { + static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; } + + static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::kVoid; } + static constexpr CTypeInfo::SequenceType SequenceType() { + return CTypeInfo::SequenceType::kIsSequence; + } +}; + +template <> +struct TypeInfoHelper> { + static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; } + + static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::kUint32; } + static constexpr CTypeInfo::SequenceType SequenceType() { + return CTypeInfo::SequenceType::kIsTypedArray; + } +}; template <> struct TypeInfoHelper { @@ -442,26 +628,63 @@ struct TypeInfoHelper { static constexpr CTypeInfo::Type Type() { return CTypeInfo::kCallbackOptionsType; } + static constexpr CTypeInfo::SequenceType SequenceType() { + return CTypeInfo::SequenceType::kScalar; + } }; +#define STATIC_ASSERT_IMPLIES(COND, ASSERTION, MSG) \ + static_assert(((COND) == 0) || (ASSERTION), MSG) + template class CTypeInfoBuilder { public: using BaseType = T; static constexpr CTypeInfo Build() { - // Get the flags and merge in any additional flags. - uint8_t flags = uint8_t(TypeInfoHelper::Flags()); - int unused[] = {0, (flags |= uint8_t(Flags), 0)...}; - // With C++17, we could use a "..." fold expression over a parameter pack. - // Since we're still using C++14, we have to evaluate an OR expresion while - // constructing an unused list of 0's. This applies the binary operator - // for each value in Flags. - (void)unused; + constexpr CTypeInfo::Flags kFlags = + MergeFlags(TypeInfoHelper::Flags(), Flags...); + constexpr CTypeInfo::Type kType = TypeInfoHelper::Type(); + constexpr CTypeInfo::SequenceType kSequenceType = + TypeInfoHelper::SequenceType(); + + STATIC_ASSERT_IMPLIES( + uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kAllowSharedBit), + (kSequenceType == CTypeInfo::SequenceType::kIsTypedArray || + kSequenceType == CTypeInfo::SequenceType::kIsArrayBuffer), + "kAllowSharedBit is only allowed for TypedArrays and ArrayBuffers."); + STATIC_ASSERT_IMPLIES( + uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kEnforceRangeBit), + CTypeInfo::IsIntegralType(kType), + "kEnforceRangeBit is only allowed for integral types."); + STATIC_ASSERT_IMPLIES( + uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kClampBit), + CTypeInfo::IsIntegralType(kType), + "kClampBit is only allowed for integral types."); + STATIC_ASSERT_IMPLIES( + uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kIsRestrictedBit), + CTypeInfo::IsFloatingPointType(kType), + "kIsRestrictedBit is only allowed for floating point types."); + STATIC_ASSERT_IMPLIES(kSequenceType == CTypeInfo::SequenceType::kIsSequence, + kType == CTypeInfo::Type::kVoid, + "Sequences are only supported from void type."); + STATIC_ASSERT_IMPLIES( + kSequenceType == CTypeInfo::SequenceType::kIsTypedArray, + CTypeInfo::IsPrimitive(kType) || kType == CTypeInfo::Type::kVoid, + "TypedArrays are only supported from primitive types or void."); // Return the same type with the merged flags. - return CTypeInfo(TypeInfoHelper::Type(), CTypeInfo::Flags(flags)); + return CTypeInfo(TypeInfoHelper::Type(), + TypeInfoHelper::SequenceType(), kFlags); + } + + private: + template + static constexpr CTypeInfo::Flags MergeFlags(CTypeInfo::Flags flags, + Rest... rest) { + return CTypeInfo::Flags(uint8_t(flags) | uint8_t(MergeFlags(rest...))); } + static constexpr CTypeInfo::Flags MergeFlags() { return CTypeInfo::Flags(0); } }; template @@ -513,8 +736,9 @@ class CFunctionBuilderWithFunction { Flags...>; }; - // Return a copy of the CFunctionBuilder, but merges the Flags on ArgBuilder - // index N with the new Flags passed in the template parameter pack. + // Return a copy of the CFunctionBuilder, but merges the Flags on + // ArgBuilder index N with the new Flags passed in the template parameter + // pack. template constexpr auto ArgImpl(std::index_sequence) { return CFunctionBuilderWithFunction< @@ -546,6 +770,22 @@ CFunction CFunction::ArgUnwrap::Make(R (*func)(Args...)) { using CFunctionBuilder = internal::CFunctionBuilder; +/** + * Copies the contents of this JavaScript array to a C++ buffer with + * a given max_length. A CTypeInfo is passed as an argument, + * instructing different rules for conversion (e.g. restricted float/double). + * The element type T of the destination array must match the C type + * corresponding to the CTypeInfo (specified by CTypeInfoTraits). + * If the array length is larger than max_length or the array is of + * unsupported type, the operation will fail, returning false. Generally, an + * array which contains objects, undefined, null or anything not convertible + * to the requested destination type, is considered unsupported. The operation + * returns true on success. `type_info` will be used for conversions. + */ +template +bool CopyAndConvertArrayToCppBuffer(Local src, T* dst, + uint32_t max_length); + } // namespace v8 #endif // INCLUDE_V8_FAST_API_CALLS_H_ diff --git a/deps/v8/include/v8-inspector.h b/deps/v8/include/v8-inspector.h index 852b39d7252295..0c19104a3774ab 100644 --- a/deps/v8/include/v8-inspector.h +++ b/deps/v8/include/v8-inspector.h @@ -170,7 +170,7 @@ class V8_EXPORT V8InspectorSession { v8::Local*, std::unique_ptr* objectGroup) = 0; virtual void releaseObjectGroup(StringView) = 0; - virtual void triggerPreciseCoverageDeltaUpdate(StringView occassion) = 0; + virtual void triggerPreciseCoverageDeltaUpdate(StringView occasion) = 0; }; class V8_EXPORT V8InspectorClient { @@ -301,6 +301,10 @@ class V8_EXPORT V8Inspector { int scriptId) = 0; virtual void exceptionRevoked(v8::Local, unsigned exceptionId, StringView message) = 0; + virtual bool associateExceptionData(v8::Local, + v8::Local exception, + v8::Local key, + v8::Local value) = 0; // Connection. class V8_EXPORT Channel { diff --git a/deps/v8/include/v8-internal.h b/deps/v8/include/v8-internal.h index 5f0177182b598f..85471960006a08 100644 --- a/deps/v8/include/v8-internal.h +++ b/deps/v8/include/v8-internal.h @@ -145,6 +145,7 @@ enum ExternalPointerTag : uint64_t { kForeignForeignAddressTag = 0x01f7000000000000, // 0b000000111110111 kNativeContextMicrotaskQueueTag = 0x01fb000000000000, // 0b000000111111011 kEmbedderDataSlotPayloadTag = 0x01fd000000000000, // 0b000000111111101 + kCodeEntryPointTag = 0x01fe000000000000, // 0b000000111111110 }; constexpr uint64_t kExternalPointerTagMask = 0xffff000000000000; diff --git a/deps/v8/include/v8-metrics.h b/deps/v8/include/v8-metrics.h index 0217f40d63a629..498ee25f6d25c3 100644 --- a/deps/v8/include/v8-metrics.h +++ b/deps/v8/include/v8-metrics.h @@ -49,11 +49,19 @@ struct GarbageCollectionFullMainThreadIncrementalMark { int64_t cpp_wall_clock_duration_in_us = -1; }; +struct GarbageCollectionFullMainThreadBatchedIncrementalMark { + std::vector events; +}; + struct GarbageCollectionFullMainThreadIncrementalSweep { int64_t wall_clock_duration_in_us = -1; int64_t cpp_wall_clock_duration_in_us = -1; }; +struct GarbageCollectionFullMainThreadBatchedIncrementalSweep { + std::vector events; +}; + struct GarbageCollectionYoungCycle { int64_t total_wall_clock_duration_in_us = -1; int64_t main_thread_wall_clock_duration_in_us = -1; @@ -69,6 +77,7 @@ struct WasmModuleDecoded { size_t module_size_in_bytes = 0; size_t function_count = 0; int64_t wall_clock_duration_in_us = -1; + int64_t cpu_duration_in_us = -1; }; struct WasmModuleCompiled { @@ -81,6 +90,7 @@ struct WasmModuleCompiled { size_t code_size_in_bytes = 0; size_t liftoff_bailout_count = 0; int64_t wall_clock_duration_in_us = -1; + int64_t cpu_duration_in_us = -1; }; struct WasmModuleInstantiated { @@ -94,20 +104,23 @@ struct WasmModuleTieredUp { bool lazy = false; size_t code_size_in_bytes = 0; int64_t wall_clock_duration_in_us = -1; + int64_t cpu_duration_in_us = -1; }; struct WasmModulesPerIsolate { size_t count = 0; }; -#define V8_MAIN_THREAD_METRICS_EVENTS(V) \ - V(GarbageCollectionFullCycle) \ - V(GarbageCollectionFullMainThreadIncrementalMark) \ - V(GarbageCollectionFullMainThreadIncrementalSweep) \ - V(GarbageCollectionYoungCycle) \ - V(WasmModuleDecoded) \ - V(WasmModuleCompiled) \ - V(WasmModuleInstantiated) \ +#define V8_MAIN_THREAD_METRICS_EVENTS(V) \ + V(GarbageCollectionFullCycle) \ + V(GarbageCollectionFullMainThreadIncrementalMark) \ + V(GarbageCollectionFullMainThreadBatchedIncrementalMark) \ + V(GarbageCollectionFullMainThreadIncrementalSweep) \ + V(GarbageCollectionFullMainThreadBatchedIncrementalSweep) \ + V(GarbageCollectionYoungCycle) \ + V(WasmModuleDecoded) \ + V(WasmModuleCompiled) \ + V(WasmModuleInstantiated) \ V(WasmModuleTieredUp) #define V8_THREAD_SAFE_METRICS_EVENTS(V) V(WasmModulesPerIsolate) diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 1cf4d7e28448ce..213d8805b86087 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -9,9 +9,9 @@ // NOTE these macros are used by some of the tool scripts and the build // system so their names cannot be changed without changing the scripts. #define V8_MAJOR_VERSION 9 -#define V8_MINOR_VERSION 2 -#define V8_BUILD_NUMBER 230 -#define V8_PATCH_LEVEL 21 +#define V8_MINOR_VERSION 3 +#define V8_BUILD_NUMBER 345 +#define V8_PATCH_LEVEL 16 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 101e3c8accfa07..796daba1fb06f5 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -50,6 +50,7 @@ class CFunction; class CallHandlerHelper; class Context; class CppHeap; +class CTypeInfo; class Data; class Date; class EscapableHandleScope; @@ -885,6 +886,8 @@ class TracedReferenceBase { std::memory_order_relaxed); } + V8_EXPORT void CheckValue() const; + // val_ points to a GlobalHandles node. internal::Address* val_ = nullptr; @@ -926,8 +929,18 @@ class BasicTracedReference : public TracedReferenceBase { const_cast&>(*this)); } - T* operator->() const { return reinterpret_cast(val_); } - T* operator*() const { return reinterpret_cast(val_); } + T* operator->() const { +#ifdef V8_ENABLE_CHECKS + CheckValue(); +#endif // V8_ENABLE_CHECKS + return reinterpret_cast(val_); + } + T* operator*() const { +#ifdef V8_ENABLE_CHECKS + CheckValue(); +#endif // V8_ENABLE_CHECKS + return reinterpret_cast(val_); + } private: enum DestructionMode { kWithDestructor, kWithoutDestructor }; @@ -4427,6 +4440,7 @@ class V8_EXPORT Array : public Object { static Local New(Isolate* isolate, Local* elements, size_t length); V8_INLINE static Array* Cast(Value* obj); + private: Array(); static void CheckCast(Value* obj); @@ -4913,6 +4927,12 @@ class V8_EXPORT Promise : public Object { */ void MarkAsHandled(); + /** + * Marks this promise as silent to prevent pausing the debugger when the + * promise is rejected. + */ + void MarkAsSilent(); + V8_INLINE static Promise* Cast(Value* obj); static const int kEmbedderFieldCount = V8_PROMISE_INTERNAL_FIELD_COUNT; @@ -8811,7 +8831,7 @@ class V8_EXPORT Isolate { kDateToLocaleTimeString = 68, kAttemptOverrideReadOnlyOnPrototypeSloppy = 69, kAttemptOverrideReadOnlyOnPrototypeStrict = 70, - kOptimizedFunctionWithOneShotBytecode = 71, + kOptimizedFunctionWithOneShotBytecode = 71, // Unused. kRegExpMatchIsTrueishOnNonJSRegExp = 72, kRegExpMatchIsFalseishOnJSRegExp = 73, kDateGetTimezoneOffset = 74, // Unused. @@ -8913,6 +8933,14 @@ class V8_EXPORT Isolate { */ static Isolate* GetCurrent(); + /** + * Returns the entered isolate for the current thread or NULL in + * case there is no current isolate. + * + * No checks are performed by this method. + */ + static Isolate* TryGetCurrent(); + /** * Clears the set of objects held strongly by the heap. This set of * objects are originally built when a WeakRef is created or @@ -8979,6 +9007,13 @@ class V8_EXPORT Isolate { */ void MemoryPressureNotification(MemoryPressureLevel level); + /** + * Drop non-essential caches. Should only be called from testing code. + * The method can potentially block for a long time and does not necessarily + * trigger GC. + */ + void ClearCachesForTesting(); + /** * Methods below this point require holding a lock (using Locker) in * a multi-threaded environment. diff --git a/deps/v8/infra/mb/mb_config.pyl b/deps/v8/infra/mb/mb_config.pyl index 9c0c933cda7d12..aaeda39f1c73b5 100644 --- a/deps/v8/infra/mb/mb_config.pyl +++ b/deps/v8/infra/mb/mb_config.pyl @@ -62,8 +62,10 @@ 'V8 Linux - verify csa': 'release_x86_verify_csa', # Linux64. 'V8 Linux64 - builder': 'release_x64', + 'V8 Linux64 - builder (reclient)': 'release_x64_reclient', 'V8 Linux64 - debug builder': 'debug_x64', 'V8 Linux64 - dict tracking - debug - builder': 'debug_x64_dict_tracking_trybot', + 'V8 Linux64 - external code space - debug - builder': 'debug_x64_external_code_space', 'V8 Linux64 - custom snapshot - debug builder': 'debug_x64_custom', 'V8 Linux64 - heap sandbox - debug - builder': 'debug_x64_heap_sandbox', 'V8 Linux64 - internal snapshot': 'release_x64_internal', @@ -213,6 +215,7 @@ 'release_simulate_arm64_pointer_compression', 'v8_linux64_dbg_ng': 'debug_x64_trybot', 'v8_linux64_dict_tracking_dbg_ng': 'debug_x64_dict_tracking_trybot', + 'v8_linux64_external_code_space_dbg_ng': 'debug_x64_external_code_space', 'v8_linux64_gc_stress_custom_snapshot_dbg_ng': 'debug_x64_trybot_custom', 'v8_linux64_gcc_compile_dbg': 'debug_x64_gcc', 'v8_linux64_gcov_coverage': 'release_x64_gcc_coverage', @@ -475,8 +478,7 @@ 'release_bot', 'x64', 'cfi_clusterfuzz'], 'release_x64_fuzzilli': [ 'release_bot', 'x64', 'dcheck_always_on', 'v8_enable_slow_dchecks', - 'v8_verify_heap', 'v8_verify_csa', 'v8_enable_verify_predictable', - 'fuzzilli'], + 'v8_verify_heap', 'v8_verify_csa', 'fuzzilli'], 'release_x64_msvc': [ 'release_bot_no_goma', 'x64', 'minimal_symbols', 'msvc'], 'release_x64_correctness_fuzzer' : [ @@ -499,6 +501,8 @@ 'v8_disable_pointer_compression'], 'release_x64_pointer_compression_without_dchecks': [ 'release_bot', 'x64', 'v8_disable_pointer_compression'], + 'release_x64_reclient': [ + 'release_bot_reclient', 'x64'], 'release_x64_trybot': [ 'release_trybot', 'x64'], 'release_x64_test_features_trybot': [ @@ -537,6 +541,8 @@ 'x64', 'asan'], 'debug_x64_custom': [ 'debug_bot', 'x64', 'v8_snapshot_custom'], + 'debug_x64_external_code_space': [ + 'debug_bot', 'x64', 'external_code_space'], 'debug_x64_fuchsia': [ 'debug_bot', 'x64', 'fuchsia'], 'debug_x64_gcc': [ @@ -692,6 +698,10 @@ 'gn_args': 'chrome_pgo_phase=0', }, + 'external_code_space': { + 'gn_args': 'v8_enable_external_code_space=true', + }, + 'fuchsia': { 'gn_args': 'target_os="fuchsia"', }, @@ -764,6 +774,10 @@ 'gn_args': 'v8_use_perfetto=true', }, + 'reclient': { + 'gn_args': 'use_rbe=true', + }, + 'release': { 'gn_args': 'is_debug=false', }, @@ -776,6 +790,10 @@ 'mixins': ['release', 'static', 'no_goma'], }, + 'release_bot_reclient': { + 'mixins': ['release', 'static', 'no_goma', 'reclient'], + }, + 'release_trybot': { 'mixins': ['release_bot', 'minimal_symbols', 'dcheck_always_on'], }, diff --git a/deps/v8/infra/testing/builders.pyl b/deps/v8/infra/testing/builders.pyl index 8fe8872ed9b0fa..d40e4ed9e7a167 100644 --- a/deps/v8/infra/testing/builders.pyl +++ b/deps/v8/infra/testing/builders.pyl @@ -77,7 +77,7 @@ {'name': 'mozilla'}, {'name': 'mozilla', 'variant': 'extra'}, {'name': 'test262', 'variant': 'default', 'shards': 2}, - {'name': 'test262', 'variant': 'extra', 'shards': 3}, + {'name': 'test262', 'variant': 'extra', 'shards': 5}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, # Noavx. @@ -347,7 +347,7 @@ {'name': 'mozilla'}, {'name': 'mozilla', 'variant': 'extra'}, {'name': 'test262', 'variant': 'default'}, - {'name': 'test262', 'variant': 'extra', 'shards': 3}, + {'name': 'test262', 'variant': 'extra', 'shards': 5}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, {'name': 'v8testing', 'variant': 'minor_mc'}, @@ -366,6 +366,15 @@ {'name': 'v8testing', 'shards': 3}, ], }, + 'v8_linux64_external_code_space_dbg_ng_triggered': { + 'swarming_dimensions' : { + 'cpu': 'x86-64-avx2', + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'v8testing', 'shards': 3}, + ], + }, 'v8_linux64_fuzzilli_ng_triggered': { 'swarming_dimensions' : { 'os': 'Ubuntu-18.04', @@ -504,13 +513,13 @@ 'os': 'Ubuntu-18.04', }, 'tests': [ - {'name': 'benchmarks'}, - {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default', 'shards': 3}, - {'name': 'v8testing', 'shards': 5}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, - {'name': 'v8testing', 'variant': 'slow_path'}, - {'name': 'v8testing', 'variant': 'stress_concurrent_allocation'}, + {'name': 'benchmarks', 'shards': 2}, + {'name': 'mozilla', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 5}, + {'name': 'v8testing', 'shards': 6}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 5}, + {'name': 'v8testing', 'variant': 'slow_path', 'shards': 2}, + {'name': 'v8testing', 'variant': 'stress_concurrent_allocation', 'shards': 2}, ], }, 'v8_linux64_tsan_no_cm_rel_ng_triggered': { @@ -528,7 +537,7 @@ 'test_args': ['--extra-flags=--future'], 'shards': 6, }, - {'name': 'v8testing', 'variant': 'stress_concurrent_inlining'}, + {'name': 'v8testing', 'variant': 'stress_concurrent_inlining', 'shards': 2}, ], }, 'v8_linux64_tsan_isolates_rel_ng_triggered': { @@ -752,7 +761,7 @@ 'swarming_dimensions' : { 'cpu': 'arm64', 'os': 'Mac-11', - 'pool': 'chromium.tests.mac-arm64', + 'pool': 'chromium.tests', }, 'tests': [ {'name': 'v8testing'}, @@ -762,7 +771,7 @@ 'swarming_dimensions' : { 'cpu': 'arm64', 'os': 'Mac-11', - 'pool': 'chromium.tests.mac-arm64', + 'pool': 'chromium.tests', }, 'tests': [ {'name': 'v8testing'}, @@ -772,7 +781,7 @@ 'swarming_dimensions' : { 'cpu': 'arm64', 'os': 'Mac-11', - 'pool': 'chromium.tests.mac-arm64', + 'pool': 'chromium.tests', }, 'tests': [ {'name': 'v8testing'}, @@ -935,7 +944,7 @@ {'name': 'optimize_for_size'}, {'name': 'test262', 'shards': 6}, {'name': 'test262', 'variant': 'code_serializer', 'shards': 2}, - {'name': 'test262', 'variant': 'extra', 'shards': 3}, + {'name': 'test262', 'variant': 'extra', 'shards': 5}, {'name': 'v8testing', 'shards': 3}, { 'name': 'v8testing', @@ -1023,7 +1032,7 @@ 'os': 'Ubuntu-18.04', }, 'tests': [ - {'name': 'v8testing', 'variant': 'default', 'shards': 4}, + {'name': 'v8testing', 'variant': 'default', 'shards': 6}, ], }, 'V8 Linux - gc stress': { @@ -1168,7 +1177,7 @@ {'name': 'mozilla', 'variant': 'extra'}, {'name': 'optimize_for_size'}, {'name': 'test262', 'shards': 5}, - {'name': 'test262', 'variant': 'extra', 'shards': 3}, + {'name': 'test262', 'variant': 'extra', 'shards': 5}, {'name': 'v8testing', 'shards': 2}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, {'name': 'v8testing', 'variant': 'minor_mc'}, @@ -1252,6 +1261,15 @@ {'name': 'v8testing', 'shards': 3}, ], }, + 'V8 Linux64 - external code space - debug': { + 'swarming_dimensions' : { + 'cpu': 'x86-64-avx2', + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'v8testing', 'shards': 3}, + ], + }, 'V8 Linux64 - fyi': { 'swarming_dimensions' : { 'os': 'Ubuntu-18.04', @@ -1350,13 +1368,13 @@ 'os': 'Ubuntu-18.04', }, 'tests': [ - {'name': 'benchmarks'}, - {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default', 'shards': 3}, - {'name': 'v8testing', 'shards': 5}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, - {'name': 'v8testing', 'variant': 'slow_path', 'shards': 1}, - {'name': 'v8testing', 'variant': 'stress_concurrent_allocation', 'shards': 1}, + {'name': 'benchmarks', 'shards': 2}, + {'name': 'mozilla', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 5}, + {'name': 'v8testing', 'shards': 6}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 5}, + {'name': 'v8testing', 'variant': 'slow_path', 'shards': 2}, + {'name': 'v8testing', 'variant': 'stress_concurrent_allocation', 'shards': 2}, ], }, 'V8 Linux64 TSAN - stress-incremental-marking': { @@ -1372,16 +1390,18 @@ { 'name': 'benchmarks', 'test_args': ['--extra-flags=--stress-incremental-marking'], + 'shards': 2, }, { 'name': 'mozilla', 'test_args': ['--extra-flags=--stress-incremental-marking'], + 'shards': 2, }, { 'name': 'test262', 'variant': 'default', 'test_args': ['--extra-flags=--stress-incremental-marking'], - 'shards': 4, + 'shards': 5, }, { 'name': 'v8testing', @@ -1413,7 +1433,7 @@ 'test_args': ['--extra-flags=--future'], 'shards': 6, }, - {'name': 'v8testing', 'variant': 'stress_concurrent_inlining'}, + {'name': 'v8testing', 'variant': 'stress_concurrent_inlining', 'shards': 2}, ], }, 'V8 Linux64 UBSan': { @@ -1473,7 +1493,7 @@ 'swarming_dimensions' : { 'os': 'Mac-11', 'cpu': 'arm64', - 'pool': 'chromium.tests.mac-arm64', + 'pool': 'chromium.tests', }, 'swarming_task_attrs': { 'expiration': 14400, @@ -1489,7 +1509,7 @@ 'swarming_dimensions' : { 'os': 'Mac-11', 'cpu': 'arm64', - 'pool': 'chromium.tests.mac-arm64', + 'pool': 'chromium.tests', }, 'swarming_task_attrs': { 'expiration': 14400, diff --git a/deps/v8/src/DEPS b/deps/v8/src/DEPS index 3c5dca663f61e2..0a5e3b8480b84c 100644 --- a/deps/v8/src/DEPS +++ b/deps/v8/src/DEPS @@ -5,7 +5,7 @@ include_rules = [ "+src/asmjs/asm-js.h", "-src/baseline", "+src/baseline/baseline.h", - "+src/baseline/baseline-osr-inl.h", + "+src/baseline/baseline-batch-compiler.h", "+src/baseline/bytecode-offset-iterator.h", "-src/bigint", "+src/bigint/bigint.h", @@ -72,6 +72,9 @@ specific_include_rules = { "+include/libplatform/v8-tracing.h", "+perfetto/tracing.h" ], + "d8-platforms\.cc": [ + "+include/libplatform/libplatform.h", + ], "builtins-trace\.cc": [ "+protos/perfetto", ], diff --git a/deps/v8/src/api/api-arguments-inl.h b/deps/v8/src/api/api-arguments-inl.h index 4edd0dad29d9da..f6825e592225ec 100644 --- a/deps/v8/src/api/api-arguments-inl.h +++ b/deps/v8/src/api/api-arguments-inl.h @@ -6,11 +6,10 @@ #define V8_API_API_ARGUMENTS_INL_H_ #include "src/api/api-arguments.h" - #include "src/api/api-inl.h" #include "src/debug/debug.h" #include "src/execution/vm-state-inl.h" -#include "src/logging/counters.h" +#include "src/logging/runtime-call-stats-scope.h" #include "src/objects/api-callbacks.h" #include "src/objects/slots-inl.h" #include "src/tracing/trace-event.h" diff --git a/deps/v8/src/api/api-inl.h b/deps/v8/src/api/api-inl.h index 84b9b288bb09e3..9bd266395e18f6 100644 --- a/deps/v8/src/api/api-inl.h +++ b/deps/v8/src/api/api-inl.h @@ -5,10 +5,12 @@ #ifndef V8_API_API_INL_H_ #define V8_API_API_INL_H_ +#include "include/v8-fast-api-calls.h" #include "src/api/api.h" #include "src/execution/interrupts-scope.h" #include "src/execution/microtask-queue.h" #include "src/handles/handles-inl.h" +#include "src/heap/heap-inl.h" #include "src/objects/foreign-inl.h" #include "src/objects/js-weak-refs.h" #include "src/objects/objects-inl.h" @@ -239,6 +241,58 @@ inline bool IsExecutionTerminatingCheck(i::Isolate* isolate) { return false; } +template +void CopySmiElementsToTypedBuffer(T* dst, uint32_t length, + i::FixedArray elements) { + for (uint32_t i = 0; i < length; ++i) { + double value = elements.get(static_cast(i)).Number(); + // TODO(mslekova): Avoid converting back-and-forth when possible, e.g + // avoid int->double->int conversions to boost performance. + dst[i] = i::ConvertDouble(value); + } +} + +template +void CopyDoubleElementsToTypedBuffer(T* dst, uint32_t length, + i::FixedDoubleArray elements) { + for (uint32_t i = 0; i < length; ++i) { + double value = elements.get_scalar(static_cast(i)); + // TODO(mslekova): There are certain cases, e.g. double->double, in which + // we could do a memcpy directly. + dst[i] = i::ConvertDouble(value); + } +} + +template +bool CopyAndConvertArrayToCppBuffer(Local src, T* dst, + uint32_t max_length) { + static_assert( + std::is_same< + T, typename i::CTypeInfoTraitsGetType()>::ctype>::value, + "Type mismatch between the expected CTypeInfo::Type and the destination " + "array"); + + uint32_t length = src->Length(); + if (length > max_length) { + return false; + } + + i::DisallowGarbageCollection no_gc; + i::JSArray obj = *reinterpret_cast(*src); + + i::FixedArrayBase elements = obj.elements(); + if (obj.HasSmiElements()) { + CopySmiElementsToTypedBuffer(dst, length, i::FixedArray::cast(elements)); + return true; + } else if (obj.HasDoubleElements()) { + CopyDoubleElementsToTypedBuffer(dst, length, + i::FixedDoubleArray::cast(elements)); + return true; + } else { + return false; + } +} + namespace internal { Handle HandleScopeImplementer::LastEnteredContext() { diff --git a/deps/v8/src/api/api-natives.cc b/deps/v8/src/api/api-natives.cc index 46d54f6f5872ae..985f5956a82e6b 100644 --- a/deps/v8/src/api/api-natives.cc +++ b/deps/v8/src/api/api-natives.cc @@ -7,6 +7,8 @@ #include "src/api/api-inl.h" #include "src/common/message-template.h" #include "src/execution/isolate-inl.h" +#include "src/heap/heap-inl.h" +#include "src/logging/runtime-call-stats-scope.h" #include "src/objects/api-callbacks.h" #include "src/objects/hash-table-inl.h" #include "src/objects/lookup.h" @@ -109,7 +111,7 @@ MaybeHandle DefineDataProperty(Isolate* isolate, ASSIGN_RETURN_ON_EXCEPTION(isolate, value, Instantiate(isolate, prop_data, name), Object); - LookupIterator::Key key(isolate, name); + PropertyKey key(isolate, name); LookupIterator it(isolate, object, key, LookupIterator::OWN_SKIP_INTERCEPTOR); #ifdef DEBUG diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index 031d4244f7f80b..e49ede0d7cf400 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -25,6 +25,7 @@ #include "src/base/platform/time.h" #include "src/base/safe_conversions.h" #include "src/base/utils/random-number-generator.h" +#include "src/baseline/baseline-batch-compiler.h" #include "src/builtins/accessors.h" #include "src/builtins/builtins-utils.h" #include "src/codegen/compiler.h" @@ -58,6 +59,7 @@ #include "src/json/json-stringifier.h" #include "src/logging/counters.h" #include "src/logging/metrics.h" +#include "src/logging/runtime-call-stats-scope.h" #include "src/logging/tracing-flags.h" #include "src/numbers/conversions-inl.h" #include "src/objects/api-callbacks.h" @@ -107,11 +109,11 @@ #include "src/strings/string-hasher.h" #include "src/strings/unicode-inl.h" #include "src/tracing/trace-event.h" -#include "src/trap-handler/trap-handler.h" #include "src/utils/detachable-vector.h" #include "src/utils/version.h" #if V8_ENABLE_WEBASSEMBLY +#include "src/trap-handler/trap-handler.h" #include "src/wasm/streaming-decoder.h" #include "src/wasm/value-type.h" #include "src/wasm/wasm-engine.h" @@ -409,6 +411,8 @@ SnapshotCreator::SnapshotCreator(Isolate* isolate, internal_isolate->InitWithoutSnapshot(); } data_ = data; + // Disable batch compilation during snapshot creation. + internal_isolate->baseline_batch_compiler()->set_enabled(false); } SnapshotCreator::SnapshotCreator(const intptr_t* external_references, @@ -1220,7 +1224,9 @@ static Local FunctionTemplateNew( bool do_not_cache, v8::Local cached_property_name = v8::Local(), SideEffectType side_effect_type = SideEffectType::kHasSideEffect, - const MemorySpan& c_function_overloads = {}) { + const MemorySpan& c_function_overloads = {}, + uint8_t instance_type = 0, uint8_t allowed_receiver_range_start = 0, + uint8_t allowed_receiver_range_end = 0) { i::Handle struct_obj = isolate->factory()->NewStruct( i::FUNCTION_TEMPLATE_INFO_TYPE, i::AllocationType::kOld); i::Handle obj = @@ -1242,6 +1248,9 @@ static Local FunctionTemplateNew( ? i::ReadOnlyRoots(isolate).the_hole_value() : *Utils::OpenHandle(*cached_property_name)); if (behavior == ConstructorBehavior::kThrow) raw.set_remove_prototype(true); + raw.SetInstanceType(instance_type); + raw.set_allowed_receiver_range_start(allowed_receiver_range_start); + raw.set_allowed_receiver_range_end(allowed_receiver_range_end); } if (callback != nullptr) { Utils::ToLocal(obj)->SetCallHandlerV8_92(callback, data, side_effect_type, @@ -1263,7 +1272,8 @@ Local FunctionTemplate::New( i_isolate, callback, data, signature, length, behavior, false, Local(), side_effect_type, c_function ? MemorySpan{c_function, 1} - : MemorySpan{}); + : MemorySpan{}, + 0, 0, 0); } Local FunctionTemplate::NewWithCFunctionOverloads( @@ -1271,6 +1281,15 @@ Local FunctionTemplate::NewWithCFunctionOverloads( v8::Local signature, int length, ConstructorBehavior behavior, SideEffectType side_effect_type, const MemorySpan& c_function_overloads) { + // TODO(mslekova): Once runtime overload resolution between sequences is + // supported, check that if (c_function_overloads.size() == 2), then + // c_function_overloads.data()[0]. + // CanResolveOverload(c_function_overloads.data()[1]). We won't support + // the case where the size is greater than 2 for runtime resolution, until + // we've added support for ArrayBuffers and ArrayBufferViews. OTOH the + // overloads list might contain more than 2 functions with different arity, + // the resolution between which is available at compile time. + i::Isolate* i_isolate = reinterpret_cast(isolate); LOG_API(i_isolate, FunctionTemplate, New); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); @@ -3253,7 +3272,8 @@ ValueDeserializer::Delegate::GetSharedArrayBufferFromId(Isolate* v8_isolate, } struct ValueDeserializer::PrivateData { - PrivateData(i::Isolate* i, i::Vector data, Delegate* delegate) + PrivateData(i::Isolate* i, base::Vector data, + Delegate* delegate) : isolate(i), deserializer(i, data, delegate) {} i::Isolate* isolate; i::ValueDeserializer deserializer; @@ -3270,10 +3290,11 @@ ValueDeserializer::ValueDeserializer(Isolate* isolate, const uint8_t* data, if (base::IsValueInRangeForNumericType(size)) { private_ = new PrivateData( reinterpret_cast(isolate), - i::Vector(data, static_cast(size)), delegate); + base::Vector(data, static_cast(size)), delegate); } else { - private_ = new PrivateData(reinterpret_cast(isolate), - i::Vector(nullptr, 0), nullptr); + private_ = + new PrivateData(reinterpret_cast(isolate), + base::Vector(nullptr, 0), nullptr); private_->has_aborted = true; } } @@ -4118,7 +4139,7 @@ Maybe v8::Object::CreateDataProperty(v8::Local context, i::Handle key_obj = Utils::OpenHandle(*key); i::Handle value_obj = Utils::OpenHandle(*value); - i::LookupIterator::Key lookup_key(isolate, key_obj); + i::PropertyKey lookup_key(isolate, key_obj); i::LookupIterator it(isolate, self, lookup_key, i::LookupIterator::OWN); if (self->IsJSProxy()) { ENTER_V8(isolate, context, Object, CreateDataProperty, Nothing(), @@ -4794,7 +4815,7 @@ MaybeLocal v8::Object::GetRealNamedPropertyInPrototypeChain( if (iter.IsAtEnd()) return MaybeLocal(); i::Handle proto = i::PrototypeIterator::GetCurrent(iter); - i::LookupIterator::Key lookup_key(isolate, key_obj); + i::PropertyKey lookup_key(isolate, key_obj); i::LookupIterator it(isolate, self, lookup_key, proto, i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); Local result; @@ -4818,7 +4839,7 @@ v8::Object::GetRealNamedPropertyAttributesInPrototypeChain( if (iter.IsAtEnd()) return Nothing(); i::Handle proto = i::PrototypeIterator::GetCurrent(iter); - i::LookupIterator::Key lookup_key(isolate, key_obj); + i::PropertyKey lookup_key(isolate, key_obj); i::LookupIterator it(isolate, self, lookup_key, proto, i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); Maybe result = @@ -4835,7 +4856,7 @@ MaybeLocal v8::Object::GetRealNamedProperty(Local context, PREPARE_FOR_EXECUTION(context, Object, GetRealNamedProperty, Value); i::Handle self = Utils::OpenHandle(this); i::Handle key_obj = Utils::OpenHandle(*key); - i::LookupIterator::Key lookup_key(isolate, key_obj); + i::PropertyKey lookup_key(isolate, key_obj); i::LookupIterator it(isolate, self, lookup_key, self, i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); Local result; @@ -4852,7 +4873,7 @@ Maybe v8::Object::GetRealNamedPropertyAttributes( Nothing(), i::HandleScope); i::Handle self = Utils::OpenHandle(this); i::Handle key_obj = Utils::OpenHandle(*key); - i::LookupIterator::Key lookup_key(isolate, key_obj); + i::PropertyKey lookup_key(isolate, key_obj); i::LookupIterator it(isolate, self, lookup_key, self, i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); auto result = i::JSReceiver::GetPropertyAttributes(&it); @@ -5117,7 +5138,8 @@ Local Function::GetDisplayName() const { } auto func = i::Handle::cast(self); i::Handle property_name = - isolate->factory()->InternalizeString(i::StaticCharVector("displayName")); + isolate->factory()->InternalizeString( + base::StaticCharVector("displayName")); i::Handle value = i::JSReceiver::GetDataProperty(func, property_name); if (value->IsString()) { @@ -5374,7 +5396,7 @@ namespace { // units until the buffer capacity is reached, would be exceeded by the next // unit, or all code units have been written out. template -static int WriteUtf8Impl(i::Vector string, char* write_start, +static int WriteUtf8Impl(base::Vector string, char* write_start, int write_capacity, int options, int* utf16_chars_read_out) { bool write_null = !(options & v8::String::NO_NULL_TERMINATION); @@ -5406,7 +5428,7 @@ static int WriteUtf8Impl(i::Vector string, char* write_start, for (int i = read_index; i < up_to; i++) char_mask |= read_start[i]; if ((char_mask & 0x80) == 0) { int copy_length = up_to - read_index; - base::Memcpy(current_write, read_start + read_index, copy_length); + memcpy(current_write, read_start + read_index, copy_length); current_write += copy_length; read_index = up_to; } else { @@ -5885,8 +5907,9 @@ bool TryHandleWebAssemblyTrapPosix(int sig_code, siginfo_t* info, // code rather than the wasm code, so the trap handler cannot find the landing // pad and lets the process crash. Therefore, only enable trap handlers if // the host and target arch are the same. -#if (V8_TARGET_ARCH_X64 && !V8_OS_ANDROID) || \ - (V8_HOST_ARCH_ARM64 && V8_TARGET_ARCH_ARM64 && V8_OS_MACOSX) +#if V8_ENABLE_WEBASSEMBLY && \ + ((V8_TARGET_ARCH_X64 && !V8_OS_ANDROID) || \ + (V8_HOST_ARCH_ARM64 && V8_TARGET_ARCH_ARM64 && V8_OS_MACOSX)) return i::trap_handler::TryHandleSignal(sig_code, info, context); #else return false; @@ -5901,15 +5924,20 @@ bool V8::TryHandleSignal(int signum, void* info, void* context) { #if V8_OS_WIN bool TryHandleWebAssemblyTrapWindows(EXCEPTION_POINTERS* exception) { -#if V8_TARGET_ARCH_X64 +#if V8_ENABLE_WEBASSEMBLY && V8_TARGET_ARCH_X64 return i::trap_handler::TryHandleWasmTrap(exception); -#endif +#else return false; +#endif } #endif bool V8::EnableWebAssemblyTrapHandler(bool use_v8_signal_handler) { +#if V8_ENABLE_WEBASSEMBLY return v8::internal::trap_handler::EnableTrapHandler(use_v8_signal_handler); +#else + return false; +#endif } #if defined(V8_OS_WIN) @@ -6148,7 +6176,7 @@ Local NewContext( // TODO(jkummerow): This is for crbug.com/713699. Remove it if it doesn't // fail. // Sanity-check that the isolate is initialized and usable. - CHECK(isolate->builtins()->builtin(i::Builtins::kIllegal).IsCode()); + CHECK(isolate->builtins()->code(i::Builtin::kIllegal).IsCode()); TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.NewContext"); LOG_API(isolate, Context, New); @@ -6254,7 +6282,7 @@ v8::Local Context::Global() { i::Handle context = Utils::OpenHandle(this); i::Isolate* isolate = context->GetIsolate(); i::Handle global(context->global_proxy(), isolate); - // TODO(dcarney): This should always return the global proxy + // TODO(chromium:324812): This should always return the global proxy // but can't presently as calls to GetProtoype will return the wrong result. if (i::Handle::cast(global)->IsDetachedFrom( context->global_object())) { @@ -6545,7 +6573,7 @@ inline int StringLength(const uint16_t* string) { V8_WARN_UNUSED_RESULT inline i::MaybeHandle NewString(i::Factory* factory, NewStringType type, - i::Vector string) { + base::Vector string) { if (type == NewStringType::kInternalized) { return factory->InternalizeUtf8String(string); } @@ -6555,7 +6583,7 @@ inline i::MaybeHandle NewString(i::Factory* factory, V8_WARN_UNUSED_RESULT inline i::MaybeHandle NewString(i::Factory* factory, NewStringType type, - i::Vector string) { + base::Vector string) { if (type == NewStringType::kInternalized) { return factory->InternalizeString(string); } @@ -6563,9 +6591,9 @@ inline i::MaybeHandle NewString(i::Factory* factory, } V8_WARN_UNUSED_RESULT -inline i::MaybeHandle NewString(i::Factory* factory, - NewStringType type, - i::Vector string) { +inline i::MaybeHandle NewString( + i::Factory* factory, NewStringType type, + base::Vector string) { if (type == NewStringType::kInternalized) { return factory->InternalizeString(string); } @@ -6591,7 +6619,7 @@ STATIC_ASSERT(v8::String::kMaxLength == i::String::kMaxLength); if (length < 0) length = StringLength(data); \ i::Handle handle_result = \ NewString(i_isolate->factory(), type, \ - i::Vector(data, length)) \ + base::Vector(data, length)) \ .ToHandleChecked(); \ result = Utils::ToLocal(handle_result); \ } @@ -6604,7 +6632,7 @@ Local String::NewFromUtf8Literal(Isolate* isolate, const char* literal, LOG_API(i_isolate, String, NewFromUtf8Literal); i::Handle handle_result = NewString(i_isolate->factory(), type, - i::Vector(literal, length)) + base::Vector(literal, length)) .ToHandleChecked(); return Utils::ToLocal(handle_result); } @@ -7044,7 +7072,7 @@ MaybeLocal v8::RegExp::NewWithBacktrackLimit( Local v8::RegExp::GetSource() const { i::Handle obj = Utils::OpenHandle(this); return Utils::ToLocal( - i::Handle(obj->Pattern(), obj->GetIsolate())); + i::Handle(obj->EscapedPattern(), obj->GetIsolate())); } // Assert that the static flags cast in GetFlags is valid. @@ -7497,6 +7525,11 @@ void Promise::MarkAsHandled() { js_promise->set_has_handler(true); } +void Promise::MarkAsSilent() { + i::Handle js_promise = Utils::OpenHandle(this); + js_promise->set_is_silent(true); +} + Local Proxy::GetTarget() { i::Handle self = Utils::OpenHandle(this); i::Handle target(self->target(), self->GetIsolate()); @@ -7555,7 +7588,7 @@ OwnedBuffer CompiledWasmModule::Serialize() { MemorySpan CompiledWasmModule::GetWireBytesRef() { #if V8_ENABLE_WEBASSEMBLY - i::Vector bytes_vec = native_module_->wire_bytes(); + base::Vector bytes_vec = native_module_->wire_bytes(); return {bytes_vec.begin(), bytes_vec.size()}; #else UNREACHABLE(); @@ -7592,9 +7625,9 @@ MaybeLocal WasmModuleObject::FromCompiledModule( #if V8_ENABLE_WEBASSEMBLY i::Isolate* i_isolate = reinterpret_cast(isolate); i::Handle module_object = - i_isolate->wasm_engine()->ImportNativeModule( + i::wasm::GetWasmEngine()->ImportNativeModule( i_isolate, compiled_module.native_module_, - i::VectorOf(compiled_module.source_url())); + base::VectorOf(compiled_module.source_url())); return Local::Cast( Utils::ToLocal(i::Handle::cast(module_object))); #else @@ -7623,7 +7656,7 @@ void* v8::ArrayBuffer::Allocator::Reallocate(void* data, size_t old_length, reinterpret_cast(AllocateUninitialized(new_length)); if (new_data == nullptr) return nullptr; size_t bytes_to_copy = std::min(old_length, new_length); - base::Memcpy(new_data, data, bytes_to_copy); + memcpy(new_data, data, bytes_to_copy); if (new_length > bytes_to_copy) { memset(new_data + bytes_to_copy, 0, new_length - bytes_to_copy); } @@ -7930,7 +7963,7 @@ size_t v8::ArrayBufferView::CopyContents(void* dest, size_t byte_length) { isolate); source = reinterpret_cast(typed_array->DataPtr()); } - base::Memcpy(dest, source + byte_offset, bytes_to_copy); + memcpy(dest, source + byte_offset, bytes_to_copy); } return bytes_to_copy; } @@ -8555,7 +8588,7 @@ void Isolate::RequestInterrupt(InterruptCallback callback, void* data) { bool Isolate::HasPendingBackgroundTasks() { #if V8_ENABLE_WEBASSEMBLY i::Isolate* isolate = reinterpret_cast(this); - return isolate->wasm_engine()->HasRunningCompileJob(isolate); + return i::wasm::GetWasmEngine()->HasRunningCompileJob(isolate); #else return false; #endif // V8_ENABLE_WEBASSEMBLY @@ -8582,6 +8615,11 @@ Isolate* Isolate::GetCurrent() { return reinterpret_cast(isolate); } +Isolate* Isolate::TryGetCurrent() { + i::Isolate* isolate = i::Isolate::TryGetCurrent(); + return reinterpret_cast(isolate); +} + // static Isolate* Isolate::Allocate() { return reinterpret_cast(i::Isolate::New()); @@ -8610,23 +8648,6 @@ void Isolate::Initialize(Isolate* isolate, } else { i_isolate->set_snapshot_blob(i::Snapshot::DefaultSnapshotBlob()); } - auto code_event_handler = params.code_event_handler; -#ifdef ENABLE_GDB_JIT_INTERFACE - if (code_event_handler == nullptr && i::FLAG_gdbjit) { - code_event_handler = i::GDBJITInterface::EventHandler; - } -#endif // ENABLE_GDB_JIT_INTERFACE -#if defined(V8_OS_WIN) && defined(V8_ENABLE_SYSTEM_INSTRUMENTATION) - if (code_event_handler == nullptr && i::FLAG_enable_system_instrumentation) { - code_event_handler = i::ETWJITInterface::EventHandler; - } -#endif // defined(V8_OS_WIN) - - if (code_event_handler) { - i_isolate->InitializeLoggingAndCounters(); - i_isolate->logger()->SetCodeEventHandler(kJitCodeEventDefault, - code_event_handler); - } if (params.counter_lookup_callback) { isolate->SetCounterFunction(params.counter_lookup_callback); } @@ -8651,22 +8672,40 @@ void Isolate::Initialize(Isolate* isolate, } // TODO(jochen): Once we got rid of Isolate::Current(), we can remove this. Isolate::Scope isolate_scope(isolate); + if (i_isolate->snapshot_blob() == nullptr) { + FATAL( + "V8 snapshot blob was not set during initialization. This can mean " + "that the snapshot blob file is corrupted or missing."); + } if (!i::Snapshot::Initialize(i_isolate)) { // If snapshot data was provided and we failed to deserialize it must // have been corrupted. - if (i_isolate->snapshot_blob() != nullptr) { - FATAL( - "Failed to deserialize the V8 snapshot blob. This can mean that the " - "snapshot blob file is corrupted or missing."); + FATAL( + "Failed to deserialize the V8 snapshot blob. This can mean that the " + "snapshot blob file is corrupted or missing."); + } + + { + // Set up code event handlers. Needs to be after i::Snapshot::Initialize + // because that is where we add the isolate to WasmEngine. + auto code_event_handler = params.code_event_handler; +#ifdef ENABLE_GDB_JIT_INTERFACE + if (code_event_handler == nullptr && i::FLAG_gdbjit) { + code_event_handler = i::GDBJITInterface::EventHandler; } - base::ElapsedTimer timer; - if (i::FLAG_profile_deserialization) timer.Start(); - i_isolate->InitWithoutSnapshot(); - if (i::FLAG_profile_deserialization) { - double ms = timer.Elapsed().InMillisecondsF(); - i::PrintF("[Initializing isolate from scratch took %0.3f ms]\n", ms); +#endif // ENABLE_GDB_JIT_INTERFACE +#if defined(V8_OS_WIN) && defined(V8_ENABLE_SYSTEM_INSTRUMENTATION) + if (code_event_handler == nullptr && + i::FLAG_enable_system_instrumentation) { + code_event_handler = i::ETWJITInterface::EventHandler; + } +#endif // defined(V8_OS_WIN) + + if (code_event_handler) { + isolate->SetJitCodeEventHandler(kJitCodeEventDefault, code_event_handler); } } + i_isolate->set_only_terminate_in_safe_scope( params.only_terminate_in_safe_scope); i_isolate->set_embedder_wrapper_type_index( @@ -8880,7 +8919,12 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { heap_statistics->malloced_memory_ = isolate->allocator()->GetCurrentMemoryUsage() + isolate->string_table()->GetCurrentMemoryUsage(); - heap_statistics->external_memory_ = isolate->heap()->backing_store_bytes(); + // On 32-bit systems backing_store_bytes() might overflow size_t temporarily + // due to concurrent array buffer sweeping. + heap_statistics->external_memory_ = + isolate->heap()->backing_store_bytes() < SIZE_MAX + ? static_cast(isolate->heap()->backing_store_bytes()) + : SIZE_MAX; heap_statistics->peak_malloced_memory_ = isolate->allocator()->GetMaxMemoryUsage(); heap_statistics->number_of_native_contexts_ = heap->NumberOfNativeContexts(); @@ -8890,9 +8934,9 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { #if V8_ENABLE_WEBASSEMBLY heap_statistics->malloced_memory_ += - isolate->wasm_engine()->allocator()->GetCurrentMemoryUsage(); + i::wasm::GetWasmEngine()->allocator()->GetCurrentMemoryUsage(); heap_statistics->peak_malloced_memory_ += - isolate->wasm_engine()->allocator()->GetMaxMemoryUsage(); + i::wasm::GetWasmEngine()->allocator()->GetMaxMemoryUsage(); #endif // V8_ENABLE_WEBASSEMBLY } @@ -9170,7 +9214,7 @@ void Isolate::SetAddHistogramSampleFunction( void Isolate::SetMetricsRecorder( const std::shared_ptr& metrics_recorder) { i::Isolate* isolate = reinterpret_cast(this); - isolate->metrics_recorder()->SetRecorder(isolate, metrics_recorder); + isolate->metrics_recorder()->SetEmbedderRecorder(isolate, metrics_recorder); } void Isolate::SetAddCrashKeyCallback(AddCrashKeyCallback callback) { @@ -9206,7 +9250,7 @@ int Isolate::ContextDisposedNotification(bool dependant_context) { // of that context. // A handle scope for the native context. i::HandleScope handle_scope(isolate); - isolate->wasm_engine()->DeleteCompileJobsOnContext( + i::wasm::GetWasmEngine()->DeleteCompileJobsOnContext( isolate->native_context()); } } @@ -9234,6 +9278,12 @@ void Isolate::MemoryPressureNotification(MemoryPressureLevel level) { isolate->heap()->MemoryPressureNotification(level, on_isolate_thread); } +void Isolate::ClearCachesForTesting() { + i::Isolate* isolate = reinterpret_cast(this); + isolate->AbortConcurrentOptimization(i::BlockingBehavior::kBlock); + isolate->ClearSerializerData(); +} + void Isolate::EnableMemorySavingsMode() { i::Isolate* isolate = reinterpret_cast(this); isolate->EnableMemorySavingsMode(); @@ -9297,10 +9347,10 @@ JSEntryStubs Isolate::GetJSEntryStubs() { JSEntryStubs entry_stubs; i::Isolate* isolate = reinterpret_cast(this); - std::array, 3> stubs = { - {{i::Builtins::kJSEntry, &entry_stubs.js_entry_stub}, - {i::Builtins::kJSConstructEntry, &entry_stubs.js_construct_entry_stub}, - {i::Builtins::kJSRunMicrotasksEntry, + std::array, 3> stubs = { + {{i::Builtin::kJSEntry, &entry_stubs.js_entry_stub}, + {i::Builtin::kJSConstructEntry, &entry_stubs.js_construct_entry_stub}, + {i::Builtin::kJSRunMicrotasksEntry, &entry_stubs.js_run_microtasks_entry_stub}}}; for (auto& pair : stubs) { i::Code js_entry = isolate->heap()->builtin(pair.first); @@ -9962,8 +10012,6 @@ const char* CodeEvent::GetCodeEventTypeName(CodeEventType code_event_type) { } // The execution should never pass here UNREACHABLE(); - // NOTE(mmarchini): Workaround to fix a compiler failure on GCC 4.9 - return "Unknown"; } CodeEventHandler::CodeEventHandler(Isolate* isolate) { @@ -10012,7 +10060,6 @@ Local HeapGraphEdge::GetName() const { default: UNREACHABLE(); } - return v8::Undefined(reinterpret_cast(isolate)); } const HeapGraphNode* HeapGraphEdge::GetFromNode() const { @@ -10294,6 +10341,14 @@ void EmbedderHeapTracer::ResetHandleInNonTracingGC( UNREACHABLE(); } +void TracedReferenceBase::CheckValue() const { +#ifdef V8_HOST_ARCH_64_BIT + if (!val_) return; + + CHECK_NE(internal::kGlobalHandleZapValue, *reinterpret_cast(val_)); +#endif // V8_HOST_ARCH_64_BIT +} + CFunction::CFunction(const void* address, const CFunctionInfo* type_info) : address_(address), type_info_(type_info) { CHECK_NOT_NULL(address_); @@ -10554,6 +10609,49 @@ void InvokeFinalizationRegistryCleanupFromTask( } } +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +int32_t ConvertDouble(double d) { + return internal::DoubleToInt32(d); +} + +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +uint32_t ConvertDouble(double d) { + return internal::DoubleToUint32(d); +} + +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +float ConvertDouble(double d) { + return internal::DoubleToFloat32(d); +} + +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +double ConvertDouble(double d) { + return d; +} + +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +int64_t ConvertDouble(double d) { + return internal::DoubleToWebIDLInt64(d); +} + +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +uint64_t ConvertDouble(double d) { + return internal::DoubleToWebIDLUint64(d); +} + +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +bool ConvertDouble(double d) { + // Implements https://tc39.es/ecma262/#sec-toboolean. + return !std::isnan(d) && d != 0; +} + // Undefine macros for jumbo build. #undef SET_FIELD_WRAPPED #undef NEW_STRING diff --git a/deps/v8/src/api/api.h b/deps/v8/src/api/api.h index efb25c0e01b163..7d2a0c3e9cfb95 100644 --- a/deps/v8/src/api/api.h +++ b/deps/v8/src/api/api.h @@ -536,6 +536,10 @@ void InvokeFinalizationRegistryCleanupFromTask( Handle finalization_registry, Handle callback); +template +EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) +T ConvertDouble(double d); + } // namespace internal } // namespace v8 diff --git a/deps/v8/src/asmjs/asm-js.cc b/deps/v8/src/asmjs/asm-js.cc index 2aecd86b692447..28b44bf088b1e7 100644 --- a/deps/v8/src/asmjs/asm-js.cc +++ b/deps/v8/src/asmjs/asm-js.cc @@ -9,6 +9,7 @@ #include "src/ast/ast.h" #include "src/base/optional.h" #include "src/base/platform/elapsed-timer.h" +#include "src/base/vector.h" #include "src/codegen/compiler.h" #include "src/codegen/unoptimized-compilation-info.h" #include "src/common/assert-scope.h" @@ -23,8 +24,6 @@ #include "src/parsing/parse-info.h" #include "src/parsing/scanner-character-streams.h" #include "src/parsing/scanner.h" -#include "src/utils/vector.h" - #include "src/wasm/wasm-engine.h" #include "src/wasm/wasm-js.h" #include "src/wasm/wasm-limits.h" @@ -42,7 +41,7 @@ namespace { Handle StdlibMathMember(Isolate* isolate, Handle stdlib, Handle name) { Handle math_name( - isolate->factory()->InternalizeString(StaticCharVector("Math"))); + isolate->factory()->InternalizeString(base::StaticCharVector("Math"))); Handle math = JSReceiver::GetDataProperty(stdlib, math_name); if (!math->IsJSReceiver()) return isolate->factory()->undefined_value(); Handle math_receiver = Handle::cast(math); @@ -68,40 +67,40 @@ bool AreStdlibMembersValid(Isolate* isolate, Handle stdlib, #define STDLIB_MATH_FUNC(fname, FName, ignore1, ignore2) \ if (members.contains(wasm::AsmJsParser::StandardMember::kMath##FName)) { \ members.Remove(wasm::AsmJsParser::StandardMember::kMath##FName); \ - Handle name( \ - isolate->factory()->InternalizeString(StaticCharVector(#fname))); \ + Handle name(isolate->factory()->InternalizeString( \ + base::StaticCharVector(#fname))); \ Handle value = StdlibMathMember(isolate, stdlib, name); \ if (!value->IsJSFunction()) return false; \ SharedFunctionInfo shared = Handle::cast(value)->shared(); \ if (!shared.HasBuiltinId() || \ - shared.builtin_id() != Builtins::kMath##FName) { \ + shared.builtin_id() != Builtin::kMath##FName) { \ return false; \ } \ DCHECK_EQ(shared.GetCode(), \ - isolate->builtins()->builtin(Builtins::kMath##FName)); \ + isolate->builtins()->code(Builtin::kMath##FName)); \ } STDLIB_MATH_FUNCTION_LIST(STDLIB_MATH_FUNC) #undef STDLIB_MATH_FUNC #define STDLIB_MATH_CONST(cname, const_value) \ if (members.contains(wasm::AsmJsParser::StandardMember::kMath##cname)) { \ members.Remove(wasm::AsmJsParser::StandardMember::kMath##cname); \ - Handle name( \ - isolate->factory()->InternalizeString(StaticCharVector(#cname))); \ + Handle name(isolate->factory()->InternalizeString( \ + base::StaticCharVector(#cname))); \ Handle value = StdlibMathMember(isolate, stdlib, name); \ if (!value->IsNumber() || value->Number() != const_value) return false; \ } STDLIB_MATH_VALUE_LIST(STDLIB_MATH_CONST) #undef STDLIB_MATH_CONST -#define STDLIB_ARRAY_TYPE(fname, FName) \ - if (members.contains(wasm::AsmJsParser::StandardMember::k##FName)) { \ - members.Remove(wasm::AsmJsParser::StandardMember::k##FName); \ - *is_typed_array = true; \ - Handle name( \ - isolate->factory()->InternalizeString(StaticCharVector(#FName))); \ - Handle value = JSReceiver::GetDataProperty(stdlib, name); \ - if (!value->IsJSFunction()) return false; \ - Handle func = Handle::cast(value); \ - if (!func.is_identical_to(isolate->fname())) return false; \ +#define STDLIB_ARRAY_TYPE(fname, FName) \ + if (members.contains(wasm::AsmJsParser::StandardMember::k##FName)) { \ + members.Remove(wasm::AsmJsParser::StandardMember::k##FName); \ + *is_typed_array = true; \ + Handle name(isolate->factory()->InternalizeString( \ + base::StaticCharVector(#FName))); \ + Handle value = JSReceiver::GetDataProperty(stdlib, name); \ + if (!value->IsJSFunction()) return false; \ + Handle func = Handle::cast(value); \ + if (!func.is_identical_to(isolate->fname())) return false; \ } STDLIB_ARRAY_TYPE(int8_array_fun, Int8Array) STDLIB_ARRAY_TYPE(uint8_array_fun, Uint8Array) @@ -117,7 +116,7 @@ bool AreStdlibMembersValid(Isolate* isolate, Handle stdlib, return true; } -void Report(Handle +
@@ -19,6 +31,8 @@

Code Panel

+

Properties

+

Disassembly


     

Source Code

diff --git a/deps/v8/tools/system-analyzer/view/code-panel.mjs b/deps/v8/tools/system-analyzer/view/code-panel.mjs index 34e4ad300e441e..793b31cde7db15 100644 --- a/deps/v8/tools/system-analyzer/view/code-panel.mjs +++ b/deps/v8/tools/system-analyzer/view/code-panel.mjs @@ -1,11 +1,14 @@ // Copyright 2020 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. -import {IcLogEntry} from '../log/ic.mjs'; -import {MapLogEntry} from '../log/map.mjs'; +import {SelectRelatedEvent} from './events.mjs'; +import {CollapsableElement, DOM, formatBytes, formatMicroSeconds} from './helper.mjs'; -import {FocusEvent, SelectionEvent, ToolTipEvent} from './events.mjs'; -import {CollapsableElement, delay, DOM, formatBytes, formatMicroSeconds} from './helper.mjs'; +const kRegisters = ['rsp', 'rbp', 'rax', 'rbx', 'rcx', 'rdx', 'rsi', 'rdi']; +// Add Interpreter and x64 registers +for (let i = 0; i < 14; i++) { + kRegisters.push(`r${i}`); +} DOM.defineCustomElement('view/code-panel', (templateText) => @@ -16,6 +19,11 @@ DOM.defineCustomElement('view/code-panel', constructor() { super(templateText); + this._codeSelectNode = this.$('#codeSelect'); + this._disassemblyNode = this.$('#disassembly'); + this._sourceNode = this.$('#sourceCode'); + this._registerSelector = new RegisterSelector(this._disassemblyNode); + this._codeSelectNode.onchange = this._handleSelectCode.bind(this); this.$('#selectedRelatedButton').onclick = this._handleSelectRelated.bind(this) @@ -34,27 +42,52 @@ DOM.defineCustomElement('view/code-panel', set entry(entry) { this._entry = entry; + if (entry !== undefined) { + this.$('#properties').propertyDict = { + '__this__': entry, + functionName: entry.functionName, + size: formatBytes(entry.size), + creationTime: formatMicroSeconds(entry.time / 1000), + sourcePosition: entry.sourcePosition, + script: entry.script, + type: entry.type, + kind: entry.kindName, + variants: entry.variants.length > 1 ? entry.variants : undefined, + }; + } else { + this.$('#properties').propertyDict = {}; + } this.requestUpdate(); } - get _disassemblyNode() { - return this.$('#disassembly'); - } - - get _sourceNode() { - return this.$('#sourceCode'); - } - - get _codeSelectNode() { - return this.$('#codeSelect'); - } - _update() { this._updateSelect(); - this._disassemblyNode.innerText = this._entry?.disassemble ?? ''; + this._formatDisassembly(); this._sourceNode.innerText = this._entry?.source ?? ''; } + _formatDisassembly() { + if (!this._entry?.code) { + this._disassemblyNode.innerText = ''; + return; + } + const rawCode = this._entry?.code; + try { + this._disassemblyNode.innerText = rawCode; + let formattedCode = this._disassemblyNode.innerHTML; + for (let register of kRegisters) { + const button = `${register}` + formattedCode = formattedCode.replaceAll(register, button); + } + // Let's replace the base-address since it doesn't add any value. + // TODO + this._disassemblyNode.innerHTML = formattedCode; + } catch (e) { + console.error(e); + this._disassemblyNode.innerText = rawCode; + } + } + _updateSelect() { const select = this._codeSelectNode; if (select.data === this._selectedEntries) return; @@ -64,13 +97,19 @@ DOM.defineCustomElement('view/code-panel', this._selectedEntries.slice().sort((a, b) => a.time - b.time); for (const code of this._selectedEntries) { const option = DOM.element('option'); - option.text = - `${code.name}(...) t=${formatMicroSeconds(code.time)} size=${ - formatBytes(code.size)} script=${code.script?.toString()}`; + option.text = this._entrySummary(code); option.data = code; select.add(option); } } + _entrySummary(code) { + if (code.isBuiltinKind) { + return `${code.functionName}(...) t=${ + formatMicroSeconds(code.time)} size=${formatBytes(code.size)}`; + } + return `${code.functionName}(...) t=${formatMicroSeconds(code.time)} size=${ + formatBytes(code.size)} script=${code.script?.toString()}`; + } _handleSelectCode() { this.entry = this._codeSelectNode.selectedOptions[0].data; @@ -80,4 +119,37 @@ DOM.defineCustomElement('view/code-panel', if (!this._entry) return; this.dispatchEvent(new SelectRelatedEvent(this._entry)); } -}); \ No newline at end of file +}); + +class RegisterSelector { + _currentRegister; + constructor(node) { + this._node = node; + this._node.onmousemove = this._handleDisassemblyMouseMove.bind(this); + } + + _handleDisassemblyMouseMove(event) { + const target = event.target; + if (!target.classList.contains('register')) { + this._clear(); + return; + }; + this._select(target.innerText); + } + + _clear() { + if (this._currentRegister == undefined) return; + for (let node of this._node.querySelectorAll('.register')) { + node.classList.remove('selected'); + } + } + + _select(register) { + if (register == this._currentRegister) return; + this._clear(); + this._currentRegister = register; + for (let node of this._node.querySelectorAll(`.register.${register}`)) { + node.classList.add('selected'); + } + } +} \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/events.mjs b/deps/v8/tools/system-analyzer/view/events.mjs index 4204973f8f2027..f91fd6ffe82e58 100644 --- a/deps/v8/tools/system-analyzer/view/events.mjs +++ b/deps/v8/tools/system-analyzer/view/events.mjs @@ -76,10 +76,10 @@ export class ToolTipEvent extends AppEvent { constructor(content, positionOrTargetNode) { super(ToolTipEvent.name); - this._content = content; - if (!positionOrTargetNode && !node) { + if (!positionOrTargetNode) { throw Error('Either provide a valid position or targetNode'); } + this._content = content; this._positionOrTargetNode = positionOrTargetNode; } diff --git a/deps/v8/tools/system-analyzer/view/helper.mjs b/deps/v8/tools/system-analyzer/view/helper.mjs index 44da06ced4dfdc..a3d250091d7788 100644 --- a/deps/v8/tools/system-analyzer/view/helper.mjs +++ b/deps/v8/tools/system-analyzer/view/helper.mjs @@ -17,6 +17,7 @@ export class CSSColor { this._cache.set(name, color); return color; } + static reset() { this._cache.clear(); } @@ -82,7 +83,7 @@ export class CSSColor { return this.list[index % this.list.length]; } - static darken(hexColorString, amount = -40) { + static darken(hexColorString, amount = -50) { if (hexColorString[0] !== '#') { throw new Error(`Unsupported color: ${hexColorString}`); } @@ -122,13 +123,45 @@ export class CSSColor { } export class DOM { - static element(type, classes) { + static element(type, options) { const node = document.createElement(type); - if (classes === undefined) return node; + if (options !== undefined) { + if (typeof options === 'string') { + // Old behaviour: options = class string + node.className = options; + } else if (Array.isArray(options)) { + // Old behaviour: options = class array + DOM.addClasses(node, options); + } else { + // New behaviour: options = attribute dict + for (const [key, value] of Object.entries(options)) { + if (key == 'className') { + node.className = value; + } else if (key == 'classList') { + node.classList = value; + } else if (key == 'textContent') { + node.textContent = value; + } else if (key == 'children') { + for (const child of value) { + node.appendChild(child); + } + } else { + node.setAttribute(key, value); + } + } + } + } + return node; + } + + static addClasses(node, classes) { + const classList = node.classList; if (typeof classes === 'string') { - node.className = classes; + classList.add(classes); } else { - classes.forEach(cls => node.classList.add(cls)); + for (let i = 0; i < classes.length; i++) { + classList.add(classes[i]); + } } return node; } @@ -137,20 +170,27 @@ export class DOM { return document.createTextNode(string); } - static div(classes) { - return this.element('div', classes); + static button(label, clickHandler) { + const button = DOM.element('button'); + button.innerText = label; + button.onclick = clickHandler; + return button; + } + + static div(options) { + return this.element('div', options); } - static span(classes) { - return this.element('span', classes); + static span(options) { + return this.element('span', options); } - static table(classes) { - return this.element('table', classes); + static table(options) { + return this.element('table', options); } - static tbody(classes) { - return this.element('tbody', classes); + static tbody(options) { + return this.element('tbody', options); } static td(textOrNode, className) { @@ -174,8 +214,17 @@ export class DOM { range.deleteContents(); } - static defineCustomElement(path, generator) { - let name = path.substring(path.lastIndexOf('/') + 1, path.length); + static defineCustomElement( + path, nameOrGenerator, maybeGenerator = undefined) { + let generator = nameOrGenerator; + let name = nameOrGenerator; + if (typeof nameOrGenerator == 'function') { + console.assert(maybeGenerator === undefined); + name = path.substring(path.lastIndexOf('/') + 1, path.length); + } else { + console.assert(typeof nameOrGenerator == 'string'); + generator = maybeGenerator; + } path = path + '-template.html'; fetch(path) .then(stream => stream.text()) @@ -185,6 +234,27 @@ export class DOM { } } +const SVGNamespace = 'http://www.w3.org/2000/svg'; +export class SVG { + static element(type, classes) { + const node = document.createElementNS(SVGNamespace, type); + if (classes !== undefined) DOM.addClasses(node, classes); + return node; + } + + static svg(classes) { + return this.element('svg', classes); + } + + static rect(classes) { + return this.element('rect', classes); + } + + static g(classes) { + return this.element('g', classes); + } +} + export function $(id) { return document.querySelector(id) } @@ -233,31 +303,42 @@ export class CollapsableElement extends V8CustomElement { constructor(templateText) { super(templateText); this._hasPendingUpdate = false; - this._closer.onclick = _ => this.tryUpdateOnVisibilityChange(); + this._closer.onclick = _ => this._requestUpdateIfVisible(); } get _closer() { return this.$('#closer'); } - _contentIsVisible() { + get _contentIsVisible() { return !this._closer.checked; } + hide() { + if (this._contentIsVisible) { + this._closer.checked = true; + this._requestUpdateIfVisible(); + } + this.scrollIntoView(); + } + + show() { + if (!this._contentIsVisible) { + this._closer.checked = false; + this._requestUpdateIfVisible(); + } + this.scrollIntoView(); + } + requestUpdate(useAnimation = false) { // A pending update will be resolved later, no need to try again. if (this._hasPendingUpdate) return; this._hasPendingUpdate = true; - this.requestUpdateIfVisible(useAnimation); - } - - tryUpdateOnVisibilityChange() { - if (!this._hasPendingUpdate) return; - this.requestUpdateIfVisible(true); + this._requestUpdateIfVisible(useAnimation); } - requestUpdateIfVisible(useAnimation) { - if (!this._contentIsVisible()) return; + _requestUpdateIfVisible(useAnimation = true) { + if (!this._contentIsVisible) return; return super.requestUpdate(useAnimation); } @@ -267,6 +348,43 @@ export class CollapsableElement extends V8CustomElement { } } +export class ExpandableText { + constructor(node, string, limit = 200) { + this._node = node; + this._string = string; + this._delta = limit / 2; + this._start = 0; + this._end = string.length; + this._button = this._createExpandButton(); + this.expand(); + } + + _createExpandButton() { + const button = DOM.element('button'); + button.innerText = '...'; + button.onclick = (e) => { + e.stopImmediatePropagation(); + this.expand() + }; + return button; + } + + expand() { + DOM.removeAllChildren(this._node); + this._start = this._start + this._delta; + this._end = this._end - this._delta; + if (this._start >= this._end) { + this._node.innerText = this._string; + this._button.onclick = undefined; + return; + } + this._node.appendChild(DOM.text(this._string.substring(0, this._start))); + this._node.appendChild(this._button); + this._node.appendChild( + DOM.text(this._string.substring(this._end, this._string.length))); + } +} + export class Chunked { constructor(iterable, limit) { this._iterator = iterable[Symbol.iterator](); @@ -340,8 +458,8 @@ export function gradientStopsFromGroups( const stops = []; for (let group of groups) { const color = colorFn(group.key); - increment += group.count; - let height = (increment / totalLength * kMaxHeight) | 0; + increment += group.length; + const height = (increment / totalLength * kMaxHeight) | 0; stops.push(`${color} ${lastHeight}${kUnit} ${height}${kUnit}`) lastHeight = height; } diff --git a/deps/v8/tools/system-analyzer/view/list-panel.mjs b/deps/v8/tools/system-analyzer/view/list-panel.mjs index bc3b2f89d58392..495aaae0591197 100644 --- a/deps/v8/tools/system-analyzer/view/list-panel.mjs +++ b/deps/v8/tools/system-analyzer/view/list-panel.mjs @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {Script, SourcePosition} from '../../profile.mjs'; -import {LogEntry} from '../log/log.mjs'; +import {App} from '../index.mjs' import {FocusEvent, ToolTipEvent} from './events.mjs'; import {groupBy, LazyTable} from './helper.mjs'; @@ -128,8 +127,7 @@ DOM.defineCustomElement('view/list-panel', _logEntryMouseOverHandler(e) { const group = e.currentTarget.group; - this.dispatchEvent( - new ToolTipEvent(group.key.toStringLong(), e.currentTarget)); + this.dispatchEvent(new ToolTipEvent(group.key, e.currentTarget)); } _handleDetailsClick(event) { @@ -178,7 +176,7 @@ DOM.defineCustomElement('view/list-panel', _render(groups, table) { let last; new LazyTable(table, groups, group => { - if (last && last.count < group.count) { + if (last && last.count < group.length) { console.log(last, group); } last = group; @@ -187,9 +185,9 @@ DOM.defineCustomElement('view/list-panel', const details = tr.appendChild(DOM.td('', 'toggle')); details.onclick = this._detailsClickHandler; tr.appendChild(DOM.td(`${group.percent.toFixed(2)}%`, 'percentage')); - tr.appendChild(DOM.td(group.count, 'count')); - const valueTd = tr.appendChild(DOM.td(`${group.key}`, 'key')); - if (this._isClickable(group.key)) { + tr.appendChild(DOM.td(group.length, 'count')); + const valueTd = tr.appendChild(DOM.td(group.key?.toString(), 'key')); + if (App.isClickable(group.key)) { tr.onclick = this._logEntryClickHandler; tr.onmouseover = this._logEntryMouseOverHandler; valueTd.classList.add('clickable'); @@ -197,12 +195,4 @@ DOM.defineCustomElement('view/list-panel', return tr; }, 10); } - - _isClickable(object) { - if (typeof object !== 'object') return false; - if (object instanceof LogEntry) return true; - if (object instanceof SourcePosition) return true; - if (object instanceof Script) return true; - return false; - } }); diff --git a/deps/v8/tools/system-analyzer/view/log-file-reader-template.html b/deps/v8/tools/system-analyzer/view/log-file-reader-template.html index 478e08129c70fd..68403300e30b8f 100644 --- a/deps/v8/tools/system-analyzer/view/log-file-reader-template.html +++ b/deps/v8/tools/system-analyzer/view/log-file-reader-template.html @@ -14,15 +14,14 @@ transition: all 0.5s ease-in-out; background-color: var(--surface-color); } - + #fileReader:hover { background-color: var(--primary-color); color: var(--on-primary-color); } .done #fileReader{ - height: 20px; - line-height: 20px; + display: none; } .fail #fileReader { @@ -51,6 +50,7 @@ height: 100%; background-color: var(--file-reader-background-color); } + #spinner { position: absolute; width: 100px; @@ -64,6 +64,10 @@ animation: spin 1s ease-in-out infinite; } + #label { + user-select: none; + } + @keyframes spin { 0% { transform: rotate(0deg); diff --git a/deps/v8/tools/system-analyzer/view/log-file-reader.mjs b/deps/v8/tools/system-analyzer/view/log-file-reader.mjs index fd935f2f836353..5edb90d2fca567 100644 --- a/deps/v8/tools/system-analyzer/view/log-file-reader.mjs +++ b/deps/v8/tools/system-analyzer/view/log-file-reader.mjs @@ -1,6 +1,7 @@ // Copyright 2020 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. +import {delay} from '../helper.mjs'; import {DOM, V8CustomElement} from './helper.mjs'; DOM.defineCustomElement('view/log-file-reader', @@ -65,20 +66,45 @@ DOM.defineCustomElement('view/log-file-reader', } this.fileReader.blur(); this.root.className = 'loading'; - const reader = new FileReader(); - reader.onload = (e) => this.handleFileLoad(e, file); // Delay the loading a bit to allow for CSS animations to happen. - setTimeout(() => reader.readAsText(file), 0); + window.requestAnimationFrame(() => this.asyncReadFile(file)); } - handleFileLoad(e, file) { - const chunk = e.target.result; + async asyncReadFile(file) { + const decoder = globalThis.TextDecoderStream; + if (decoder) { + await this._streamFile(file, decoder); + } else { + await this._readFullFile(file); + } this._updateLabel(`Finished loading '${file.name}'.`); - this.dispatchEvent(new CustomEvent('fileuploadend', { + this.dispatchEvent( + new CustomEvent('fileuploadend', {bubbles: true, composed: true})); + this.root.className = 'done'; + } + + async _readFullFile(file) { + const text = await file.text(); + this._handleFileChunk(text) + } + + async _streamFile(file, decoder) { + const stream = file.stream().pipeThrough(new decoder()); + const reader = stream.getReader(); + let chunk, readerDone; + do { + const readResult = await reader.read(); + chunk = readResult.value; + readerDone = readResult.done; + if (chunk) this._handleFileChunk(chunk); + } while (!readerDone); + } + + _handleFileChunk(chunk) { + this.dispatchEvent(new CustomEvent('fileuploadchunk', { bubbles: true, composed: true, detail: chunk, })); - this.root.className = 'done'; } }); diff --git a/deps/v8/tools/system-analyzer/view/map-panel/map-details-template.html b/deps/v8/tools/system-analyzer/view/map-panel/map-details-template.html index b109d4c8ac7bbb..83cdd059ac113b 100644 --- a/deps/v8/tools/system-analyzer/view/map-panel/map-details-template.html +++ b/deps/v8/tools/system-analyzer/view/map-panel/map-details-template.html @@ -15,5 +15,5 @@ white-space: pre; } -
+
diff --git a/deps/v8/tools/system-analyzer/view/map-panel/map-details.mjs b/deps/v8/tools/system-analyzer/view/map-panel/map-details.mjs index a8ea27e2e4e147..505c24cf8d352f 100644 --- a/deps/v8/tools/system-analyzer/view/map-panel/map-details.mjs +++ b/deps/v8/tools/system-analyzer/view/map-panel/map-details.mjs @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import {FocusEvent} from '../events.mjs'; +import {ExpandableText} from '../helper.mjs'; import {DOM, V8CustomElement} from '../helper.mjs'; DOM.defineCustomElement( @@ -11,15 +12,14 @@ DOM.defineCustomElement( constructor() { super(templateText); - this._filePositionNode.onclick = e => this._handleFilePositionClick(e); } get _mapDetails() { return this.$('#mapDetails'); } - get _filePositionNode() { - return this.$('#filePositionNode'); + get _mapProperties() { + return this.$('#mapProperties'); } set map(map) { @@ -29,19 +29,32 @@ DOM.defineCustomElement( } _update() { - let details = ''; - let clickableDetails = ''; + this._mapProperties.innerText = ''; if (this._map) { - clickableDetails = `ID: ${this._map.id}`; - clickableDetails += `\nSource location: ${this._map.filePosition}`; - details = this._map.description; + let clickableDetailsTable = DOM.table('properties'); + + { + const row = clickableDetailsTable.insertRow(); + row.insertCell().innerText = 'ID'; + row.insertCell().innerText = `${this._map.id}`; + } + { + const row = clickableDetailsTable.insertRow(); + row.insertCell().innerText = 'Source location'; + const sourceLocation = row.insertCell(); + new ExpandableText(sourceLocation, `${this._map.sourcePosition}`); + sourceLocation.className = 'clickable'; + sourceLocation.onclick = e => this._handleSourcePositionClick(e); + } + + this._mapProperties.appendChild(clickableDetailsTable); + this._mapDetails.innerText = this._map.description; + } else { + this._mapDetails.innerText = ''; } - this._filePositionNode.innerText = clickableDetails; - this._filePositionNode.classList.add('clickable'); - this._mapDetails.innerText = details; } - _handleFilePositionClick(event) { + _handleSourcePositionClick(event) { this.dispatchEvent(new FocusEvent(this._map.sourcePosition)); } }); diff --git a/deps/v8/tools/system-analyzer/view/map-panel/map-transitions.mjs b/deps/v8/tools/system-analyzer/view/map-panel/map-transitions.mjs index fbe78f91563ce7..95d6b0371f6cd8 100644 --- a/deps/v8/tools/system-analyzer/view/map-panel/map-transitions.mjs +++ b/deps/v8/tools/system-analyzer/view/map-panel/map-transitions.mjs @@ -5,177 +5,177 @@ import {FocusEvent, SelectRelatedEvent, ToolTipEvent} from '../events.mjs'; import {CSSColor} from '../helper.mjs'; import {DOM, V8CustomElement} from '../helper.mjs'; -DOM.defineCustomElement( - './view/map-panel/map-transitions', - (templateText) => class MapTransitions extends V8CustomElement { - _timeline; - _map; - _edgeToColor = new Map(); - _selectedLogEntries; - _displayedMapsInTree; - _toggleSubtreeHandler = this._handleToggleSubtree.bind(this); - _mapClickHandler = this._handleMapClick.bind(this); - _mapDoubleClickHandler = this._handleMapDoubleClick.bind(this); - _mouseoverMapHandler = this._handleMouseoverMap.bind(this); - - constructor() { - super(templateText); - this.currentNode = this.transitionView; - } - - get transitionView() { - return this.$('#transitionView'); - } - - set timeline(timeline) { - this._timeline = timeline; - this._edgeToColor.clear(); - timeline.getBreakdown().forEach(breakdown => { - this._edgeToColor.set(breakdown.key, CSSColor.at(breakdown.id)); - }); - } - - set selectedLogEntries(list) { - this._selectedLogEntries = list; - this.requestUpdate(); - } - - _update() { - this.transitionView.style.display = 'none'; - DOM.removeAllChildren(this.transitionView); - if (this._selectedLogEntries.length == 0) return; - this._displayedMapsInTree = new Set(); - // Limit view to 200 maps for performance reasons. - this._selectedLogEntries.slice(0, 200).forEach( - (map) => this._addMapAndParentTransitions(map)); - this._displayedMapsInTree = undefined; - this.transitionView.style.display = ''; - } - - _addMapAndParentTransitions(map) { - if (map === undefined) return; - if (this._displayedMapsInTree.has(map)) return; - this._displayedMapsInTree.add(map); - this.currentNode = this.transitionView; - let parents = map.getParents(); - if (parents.length > 0) { - this._addTransitionTo(parents.pop()); - parents.reverse().forEach((each) => this._addTransitionTo(each)); - } - let mapNode = this._addSubtransitions(map); - // Mark and show the selected map. - mapNode.classList.add('selected'); - if (this.selectedMap == map) { - setTimeout( - () => mapNode.scrollIntoView({ - behavior: 'smooth', - block: 'nearest', - inline: 'nearest', - }), - 1); - } - } - - _addSubtransitions(map) { - let mapNode = this._addTransitionTo(map); - // Draw outgoing linear transition line. - let current = map; - while (current.children.length == 1) { - current = current.children[0].to; - this._addTransitionTo(current); - } - return mapNode; - } - - _addTransitionEdge(map) { - let classes = ['transitionEdge']; - let edge = DOM.div(classes); - edge.style.backgroundColor = this._edgeToColor.get(map.edge.type); - let labelNode = DOM.div('transitionLabel'); - labelNode.innerText = map.edge.toString(); - edge.appendChild(labelNode); - return edge; - } - - _addTransitionTo(map) { - // transition[ transitions[ transition[...], transition[...], ...]]; - this._displayedMapsInTree?.add(map); - let transition = DOM.div('transition'); - if (map.isDeprecated()) transition.classList.add('deprecated'); - if (map.edge) { - transition.appendChild(this._addTransitionEdge(map)); - } - let mapNode = this._addMapNode(map); - transition.appendChild(mapNode); - - let subtree = DOM.div('transitions'); - transition.appendChild(subtree); - - this.currentNode.appendChild(transition); - this.currentNode = subtree; - - return mapNode; - } - - _addMapNode(map) { - let node = DOM.div('map'); - if (map.edge) - node.style.backgroundColor = this._edgeToColor.get(map.edge.type); - node.map = map; - node.onclick = this._mapClickHandler - node.ondblclick = this._mapDoubleClickHandler - node.onmouseover = this._mouseoverMapHandler - if (map.children.length > 1) { - node.innerText = map.children.length; - const showSubtree = DOM.div('showSubtransitions'); - showSubtree.onclick = this._toggleSubtreeHandler - node.appendChild(showSubtree); - } - else if (map.children.length == 0) { - node.innerHTML = '●'; - } - this.currentNode.appendChild(node); - return node; - } - - _handleMapClick(event) { - const map = event.currentTarget.map; - this.dispatchEvent(new FocusEvent(map)); - } - - _handleMapDoubleClick(event) { - this.dispatchEvent(new SelectRelatedEvent(event.currentTarget.map)); - } - - _handleMouseoverMap(event) { - this.dispatchEvent(new ToolTipEvent( - event.currentTarget.map.toStringLong(), event.currentTarget)); - } - - _handleToggleSubtree(event) { - event.preventDefault(); - const node = event.currentTarget.parentElement; - let map = node.map; - event.target.classList.toggle('opened'); - let transitionsNode = node.parentElement.querySelector('.transitions'); - let subtransitionNodes = transitionsNode.children; - if (subtransitionNodes.length <= 1) { - // Add subtransitions except the one that's already shown. - let visibleTransitionMap = subtransitionNodes.length == 1 ? - transitionsNode.querySelector('.map').map : - undefined; - map.children.forEach((edge) => { - if (edge.to != visibleTransitionMap) { - this.currentNode = transitionsNode; - this._addSubtransitions(edge.to); - } - }); - } else { - // remove all but the first (currently selected) subtransition - for (let i = subtransitionNodes.length - 1; i > 0; i--) { - transitionsNode.removeChild(subtransitionNodes[i]); - } +DOM.defineCustomElement('./view/map-panel/map-transitions', + (templateText) => + class MapTransitions extends V8CustomElement { + _timeline; + _map; + _edgeToColor = new Map(); + _selectedLogEntries; + _displayedMapsInTree; + _toggleSubtreeHandler = this._handleToggleSubtree.bind(this); + _mapClickHandler = this._handleMapClick.bind(this); + _mapDoubleClickHandler = this._handleMapDoubleClick.bind(this); + _mouseoverMapHandler = this._handleMouseoverMap.bind(this); + + constructor() { + super(templateText); + this.currentNode = this.transitionView; + } + + get transitionView() { + return this.$('#transitionView'); + } + + set timeline(timeline) { + this._timeline = timeline; + this._edgeToColor.clear(); + timeline.getBreakdown().forEach(breakdown => { + this._edgeToColor.set(breakdown.key, CSSColor.at(breakdown.id)); + }); + } + + set selectedLogEntries(list) { + this._selectedLogEntries = list; + this.requestUpdate(); + } + + _update() { + this.transitionView.style.display = 'none'; + DOM.removeAllChildren(this.transitionView); + if (this._selectedLogEntries.length == 0) return; + this._displayedMapsInTree = new Set(); + // Limit view to 200 maps for performance reasons. + this._selectedLogEntries.slice(0, 200).forEach( + (map) => this._addMapAndParentTransitions(map)); + this._displayedMapsInTree = undefined; + this.transitionView.style.display = ''; + } + + _addMapAndParentTransitions(map) { + if (map === undefined) return; + if (this._displayedMapsInTree.has(map)) return; + this._displayedMapsInTree.add(map); + this.currentNode = this.transitionView; + let parents = map.getParents(); + if (parents.length > 0) { + this._addTransitionTo(parents.pop()); + parents.reverse().forEach((each) => this._addTransitionTo(each)); + } + let mapNode = this._addSubtransitions(map); + // Mark and show the selected map. + mapNode.classList.add('selected'); + if (this.selectedMap == map) { + setTimeout( + () => mapNode.scrollIntoView({ + behavior: 'smooth', + block: 'nearest', + inline: 'nearest', + }), + 1); + } + } + + _addSubtransitions(map) { + let mapNode = this._addTransitionTo(map); + // Draw outgoing linear transition line. + let current = map; + while (current.children.length == 1) { + current = current.children[0].to; + this._addTransitionTo(current); + } + return mapNode; + } + + _addTransitionEdge(map) { + let classes = ['transitionEdge']; + let edge = DOM.div(classes); + edge.style.backgroundColor = this._edgeToColor.get(map.edge.type); + let labelNode = DOM.div('transitionLabel'); + labelNode.innerText = map.edge.toString(); + edge.appendChild(labelNode); + return edge; + } + + _addTransitionTo(map) { + // transition[ transitions[ transition[...], transition[...], ...]]; + this._displayedMapsInTree?.add(map); + let transition = DOM.div('transition'); + if (map.isDeprecated()) transition.classList.add('deprecated'); + if (map.edge) { + transition.appendChild(this._addTransitionEdge(map)); + } + let mapNode = this._addMapNode(map); + transition.appendChild(mapNode); + + let subtree = DOM.div('transitions'); + transition.appendChild(subtree); + + this.currentNode.appendChild(transition); + this.currentNode = subtree; + + return mapNode; + } + + _addMapNode(map) { + let node = DOM.div('map'); + if (map.edge) + node.style.backgroundColor = this._edgeToColor.get(map.edge.type); + node.map = map; + node.onclick = this._mapClickHandler + node.ondblclick = this._mapDoubleClickHandler + node.onmouseover = this._mouseoverMapHandler + if (map.children.length > 1) { + node.innerText = map.children.length; + const showSubtree = DOM.div('showSubtransitions'); + showSubtree.onclick = this._toggleSubtreeHandler + node.appendChild(showSubtree); + } + else if (map.children.length == 0) { + node.innerHTML = '●'; + } + this.currentNode.appendChild(node); + return node; + } + + _handleMapClick(event) { + const map = event.currentTarget.map; + this.dispatchEvent(new FocusEvent(map)); + } + + _handleMapDoubleClick(event) { + this.dispatchEvent(new SelectRelatedEvent(event.currentTarget.map)); + } + + _handleMouseoverMap(event) { + this.dispatchEvent( + new ToolTipEvent(event.currentTarget.map, event.currentTarget)); + } + + _handleToggleSubtree(event) { + event.stopImmediatePropagation(); + const node = event.currentTarget.parentElement; + const map = node.map; + event.target.classList.toggle('opened'); + const transitionsNode = node.parentElement.querySelector('.transitions'); + const subtransitionNodes = transitionsNode.children; + if (subtransitionNodes.length <= 1) { + // Add subtransitions except the one that's already shown. + let visibleTransitionMap = subtransitionNodes.length == 1 ? + transitionsNode.querySelector('.map').map : + undefined; + map.children.forEach((edge) => { + if (edge.to != visibleTransitionMap) { + this.currentNode = transitionsNode; + this._addSubtransitions(edge.to); } - return false; + }); + } else { + // remove all but the first (currently selected) subtransition + for (let i = subtransitionNodes.length - 1; i > 0; i--) { + transitionsNode.removeChild(subtransitionNodes[i]); } - }); + } + return false; + } +}); diff --git a/deps/v8/tools/system-analyzer/view/property-link-table-template.html b/deps/v8/tools/system-analyzer/view/property-link-table-template.html new file mode 100644 index 00000000000000..85f2cdc178caae --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/property-link-table-template.html @@ -0,0 +1,39 @@ + + + + + + + +
+
+
\ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/property-link-table.mjs b/deps/v8/tools/system-analyzer/view/property-link-table.mjs new file mode 100644 index 00000000000000..d2e2dce60bdb92 --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/property-link-table.mjs @@ -0,0 +1,122 @@ +// 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. + +import {App} from '../index.mjs' +import {FocusEvent} from './events.mjs'; +import {DOM, ExpandableText, V8CustomElement} from './helper.mjs'; + +DOM.defineCustomElement( + 'view/property-link-table', + template => class PropertyLinkTable extends V8CustomElement { + _instance; + _propertyDict; + _instanceLinkButtons = false; + _logEntryClickHandler = this._handleLogEntryClick.bind(this); + _logEntryRelatedHandler = this._handleLogEntryRelated.bind(this); + _arrayValueSelectHandler = this._handleArrayValueSelect.bind(this); + + constructor() { + super(template); + } + + set instanceLinkButtons(newValue) { + this._instanceLinkButtons = newValue; + } + + set propertyDict(propertyDict) { + if (this._propertyDict === propertyDict) return; + this._propertyDict = propertyDict; + this.requestUpdate(); + } + + _update() { + this._fragment = new DocumentFragment(); + this._table = DOM.table('properties'); + for (let key in this._propertyDict) { + const value = this._propertyDict[key]; + this._addKeyValue(key, value); + } + this._addFooter(); + this._fragment.appendChild(this._table); + + const newContent = DOM.div(); + newContent.appendChild(this._fragment); + this.$('#content').replaceWith(newContent); + newContent.id = 'content'; + this._fragment = undefined; + } + + _addKeyValue(key, value) { + if (key == 'title') { + this._addTitle(value); + return; + } + if (key == '__this__') { + this._instance = value; + return; + } + const row = this._table.insertRow(); + row.insertCell().innerText = key; + const cell = row.insertCell(); + if (value == undefined) return; + if (Array.isArray(value)) { + cell.appendChild(this._addArrayValue(value)); + return; + } + if (App.isClickable(value)) { + cell.className = 'clickable'; + cell.onclick = this._logEntryClickHandler; + cell.data = value; + } + new ExpandableText(cell, value.toString()); + } + + _addArrayValue(array) { + if (array.length == 0) { + return DOM.text('empty'); + } else if (array.length > 200) { + return DOM.text(`${array.length} items`); + } + const select = DOM.element('select'); + select.onchange = this._arrayValueSelectHandler; + for (let value of array) { + const option = DOM.element('option'); + option.innerText = value.toString(); + option.data = value; + select.add(option); + } + return select; + } + + _addTitle(value) { + const title = DOM.element('h3'); + title.innerText = value; + this._fragment.appendChild(title); + } + + _addFooter() { + if (this._instance === undefined) return; + if (!this._instanceLinkButtons) return; + const td = this._table.createTFoot().insertRow().insertCell(); + td.colSpan = 2; + let showButton = + td.appendChild(DOM.button('Show', this._logEntryClickHandler)); + showButton.data = this._instance; + let showRelatedButton = td.appendChild( + DOM.button('Show Related', this._logEntryRelatedClickHandler)); + showRelatedButton.data = this._instance; + } + + _handleArrayValueSelect(event) { + const logEntry = event.currentTarget.selectedOptions[0].data; + this.dispatchEvent(new FocusEvent(logEntry)); + } + _handleLogEntryClick(event) { + this.dispatchEvent(new FocusEvent(event.currentTarget.data)); + } + + _handleLogEntryRelated(event) { + this.dispatchEvent(new SelectRelatedEvent(event.currentTarget.data)); + } + }); diff --git a/deps/v8/tools/system-analyzer/view/script-panel-template.html b/deps/v8/tools/system-analyzer/view/script-panel-template.html index ab5c3f95f35279..de3150366a5f6b 100644 --- a/deps/v8/tools/system-analyzer/view/script-panel-template.html +++ b/deps/v8/tools/system-analyzer/view/script-panel-template.html @@ -10,10 +10,6 @@ font-family: Consolas, monospace; } - .scriptNode:before { - counter-reset: sourceLineCounter; - } - .scriptNode span { counter-increment: sourceLineCounter 1; text-indent: -3.5em; diff --git a/deps/v8/tools/system-analyzer/view/script-panel.mjs b/deps/v8/tools/system-analyzer/view/script-panel.mjs index 6f5befcc16073b..23b4c03ec5b145 100644 --- a/deps/v8/tools/system-analyzer/view/script-panel.mjs +++ b/deps/v8/tools/system-analyzer/view/script-panel.mjs @@ -1,17 +1,21 @@ // Copyright 2020 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. -import {groupBy} from '../helper.mjs'; +import {defer, groupBy} from '../helper.mjs'; import {App} from '../index.mjs' import {SelectRelatedEvent, ToolTipEvent} from './events.mjs'; import {CollapsableElement, CSSColor, delay, DOM, formatBytes, gradientStopsFromGroups} from './helper.mjs'; +// A source mapping proxy for source maps that don't have CORS headers. +// TODO(leszeks): Make this configurable. +const sourceMapFetchPrefix = 'http://localhost:8080/'; + DOM.defineCustomElement('view/script-panel', (templateText) => class SourcePanel extends CollapsableElement { _selectedSourcePositions = []; - _sourcePositionsToMarkNodes = []; + _sourcePositionsToMarkNodesPromise = Promise.resolve([]); _scripts = []; _script; @@ -34,8 +38,13 @@ DOM.defineCustomElement('view/script-panel', set script(script) { if (this._script === script) return; this._script = script; - this._renderSourcePanel(); - this._updateScriptDropdownSelection(); + script.ensureSourceMapCalculated(sourceMapFetchPrefix); + this._sourcePositionsToMarkNodesPromise = defer(); + this.requestUpdate(); + } + + set focusedSourcePositions(sourcePositions) { + this.selectedSourcePositions = sourcePositions; } set selectedSourcePositions(sourcePositions) { @@ -45,10 +54,6 @@ DOM.defineCustomElement('view/script-panel', this._focusSelectedMarkers(); } - set focusedSourcePositions(sourcePositions) { - this.selectedSourcePositions = sourcePositions; - } - set scripts(scripts) { this._scripts = scripts; this._initializeScriptDropdown(); @@ -58,8 +63,13 @@ DOM.defineCustomElement('view/script-panel', return this.$('#script-dropdown'); } + _update() { + this._renderSourcePanel(); + this._updateScriptDropdownSelection(); + } + _initializeScriptDropdown() { - this._scripts.sort((a, b) => a.name.localeCompare(b.name)); + this._scripts.sort((a, b) => a.name?.localeCompare(b.name) ?? 0); let select = this.scriptDropdown; select.options.length = 0; for (const script of this._scripts) { @@ -70,6 +80,7 @@ DOM.defineCustomElement('view/script-panel', select.add(option); } } + _updateScriptDropdownSelection() { this.scriptDropdown.selectedIndex = this._script ? this._scripts.indexOf(this._script) : -1; @@ -77,15 +88,19 @@ DOM.defineCustomElement('view/script-panel', async _renderSourcePanel() { let scriptNode; - if (this._script) { + const script = this._script; + if (script) { await delay(1); + if (script != this._script) return; const builder = new LineBuilder(this, this._script); - scriptNode = builder.createScriptNode(); - this._sourcePositionsToMarkNodes = builder.sourcePositionToMarkers; + scriptNode = await builder.createScriptNode(this._script.startLine); + if (script != this._script) return; + this._sourcePositionsToMarkNodesPromise.resolve( + builder.sourcePositionToMarkers); } else { scriptNode = DOM.div(); this._selectedMarkNodes = undefined; - this._sourcePositionsToMarkNodes = new Map(); + this._sourcePositionsToMarkNodesPromise.resolve(new Map()); } const oldScriptNode = this.script.childNodes[1]; this.script.replaceChild(scriptNode, oldScriptNode); @@ -93,22 +108,24 @@ DOM.defineCustomElement('view/script-panel', async _focusSelectedMarkers() { await delay(100); + const sourcePositionsToMarkNodes = + await this._sourcePositionsToMarkNodesPromise; // Remove all marked nodes. - for (let markNode of this._sourcePositionsToMarkNodes.values()) { + for (let markNode of sourcePositionsToMarkNodes.values()) { markNode.className = ''; } for (let sourcePosition of this._selectedSourcePositions) { if (sourcePosition.script !== this._script) continue; - this._sourcePositionsToMarkNodes.get(sourcePosition).className = 'marked'; + sourcePositionsToMarkNodes.get(sourcePosition).className = 'marked'; } - this._scrollToFirstSourcePosition() + this._scrollToFirstSourcePosition(sourcePositionsToMarkNodes) } - _scrollToFirstSourcePosition() { + _scrollToFirstSourcePosition(sourcePositionsToMarkNodes) { const sourcePosition = this._selectedSourcePositions.find( each => each.script === this._script); if (!sourcePosition) return; - const markNode = this._sourcePositionsToMarkNodes.get(sourcePosition); + const markNode = sourcePositionsToMarkNodes.get(sourcePosition); markNode.scrollIntoView( {behavior: 'auto', block: 'center', inline: 'center'}); } @@ -130,19 +147,59 @@ DOM.defineCustomElement('view/script-panel', } handleSourcePositionMouseOver(e) { - const entries = e.target.sourcePosition.entries; + const sourcePosition = e.target.sourcePosition; + const entries = sourcePosition.entries; let text = groupBy(entries, each => each.constructor, true) .map(group => { - let text = `${group.key.name}: ${group.count}\n` + let text = `${group.key.name}: ${group.length}\n` text += groupBy(group.entries, each => each.type, true) .map(group => { - return ` - ${group.key}: ${group.count}`; + return ` - ${group.key}: ${group.length}`; }) .join('\n'); return text; }) .join('\n'); - this.dispatchEvent(new ToolTipEvent(text, e.target)); + + let sourceMapContent; + switch (this._script.sourceMapState) { + case 'loaded': { + const originalPosition = sourcePosition.originalPosition; + if (originalPosition.source === null) { + sourceMapContent = + DOM.element('i', {textContent: 'no source mapping for location'}); + } else { + sourceMapContent = DOM.element('a', { + href: `${originalPosition.source}`, + target: '_blank', + textContent: `${originalPosition.source}:${originalPosition.line}:${ + originalPosition.column}` + }); + } + break; + } + case 'loading': + sourceMapContent = + DOM.element('i', {textContent: 'source map still loading...'}); + break; + case 'failed': + sourceMapContent = + DOM.element('i', {textContent: 'source map failed to load'}); + break; + case 'none': + sourceMapContent = DOM.element('i', {textContent: 'no source map'}); + break; + default: + break; + } + + const toolTipContent = DOM.div({ + children: [ + DOM.element('pre', {className: 'textContent', textContent: text}), + sourceMapContent + ] + }); + this.dispatchEvent(new ToolTipEvent(toolTipContent, e.target)); } }); @@ -180,9 +237,9 @@ class SourcePositionIterator { } } -function* lineIterator(source) { +function* lineIterator(source, startLine) { let current = 0; - let line = 1; + let line = startLine; while (current < source.length) { const next = source.indexOf('\n', current); if (next === -1) break; @@ -209,37 +266,42 @@ class LineBuilder { _script; _clickHandler; _mouseoverHandler; - _sourcePositions; _sourcePositionToMarkers = new Map(); constructor(panel, script) { this._script = script; this._clickHandler = panel.handleSourcePositionClick.bind(panel); this._mouseoverHandler = panel.handleSourcePositionMouseOver.bind(panel); - // TODO: sort on script finalization. - script.sourcePositions.sort((a, b) => { - if (a.line === b.line) return a.column - b.column; - return a.line - b.line; - }); - this._sourcePositions = new SourcePositionIterator(script.sourcePositions); } get sourcePositionToMarkers() { return this._sourcePositionToMarkers; } - createScriptNode() { + async createScriptNode(startLine) { const scriptNode = DOM.div('scriptNode'); - for (let [lineIndex, line] of lineIterator(this._script.source)) { - scriptNode.appendChild(this._createLineNode(lineIndex, line)); + + // TODO: sort on script finalization. + this._script.sourcePositions.sort((a, b) => { + if (a.line === b.line) return a.column - b.column; + return a.line - b.line; + }); + + const sourcePositionsIterator = + new SourcePositionIterator(this._script.sourcePositions); + scriptNode.style.counterReset = `sourceLineCounter ${startLine - 1}`; + for (let [lineIndex, line] of lineIterator( + this._script.source, startLine)) { + scriptNode.appendChild( + this._createLineNode(sourcePositionsIterator, lineIndex, line)); } return scriptNode; } - _createLineNode(lineIndex, line) { + _createLineNode(sourcePositionsIterator, lineIndex, line) { const lineNode = DOM.span(); let columnIndex = 0; - for (const sourcePosition of this._sourcePositions.forLine(lineIndex)) { + for (const sourcePosition of sourcePositionsIterator.forLine(lineIndex)) { const nextColumnIndex = sourcePosition.column - 1; lineNode.appendChild(document.createTextNode( line.substring(columnIndex, nextColumnIndex))); @@ -263,10 +325,14 @@ class LineBuilder { marker.onmouseover = this._mouseoverHandler; const entries = sourcePosition.entries; - const stops = gradientStopsFromGroups( - entries.length, '%', groupBy(entries, entry => entry.constructor), - type => LineBuilder.colorMap.get(type)); - marker.style.backgroundImage = `linear-gradient(0deg,${stops.join(',')})` + const groups = groupBy(entries, entry => entry.constructor); + if (groups.length > 1) { + const stops = gradientStopsFromGroups( + entries.length, '%', groups, type => LineBuilder.colorMap.get(type)); + marker.style.backgroundImage = `linear-gradient(0deg,${stops.join(',')})` + } else { + marker.style.backgroundColor = LineBuilder.colorMap.get(groups[0].key) + } return marker; } diff --git a/deps/v8/tools/system-analyzer/view/timeline-panel-template.html b/deps/v8/tools/system-analyzer/view/timeline-panel-template.html index da0ce26380907c..6367e7e1aba3f8 100644 --- a/deps/v8/tools/system-analyzer/view/timeline-panel-template.html +++ b/deps/v8/tools/system-analyzer/view/timeline-panel-template.html @@ -18,10 +18,26 @@ width: 30px; background-color: var(--border-color); } + .titleButtons { + float: right; + } + .titleButtons button { + border-radius: 20px; + width: 20px; + height: 20px; + font-weight: bold; + line-height: 11px; + }
-

Timeline Panel

+

+ Timeline Panel +
+ + +
+

diff --git a/deps/v8/tools/system-analyzer/view/timeline-panel.mjs b/deps/v8/tools/system-analyzer/view/timeline-panel.mjs index 331db401e96db9..35d8f028931974 100644 --- a/deps/v8/tools/system-analyzer/view/timeline-panel.mjs +++ b/deps/v8/tools/system-analyzer/view/timeline-panel.mjs @@ -3,6 +3,9 @@ // found in the LICENSE file. import './timeline/timeline-track.mjs'; +import './timeline/timeline-track-map.mjs'; +import './timeline/timeline-track-tick.mjs'; +import './timeline/timeline-track-timer.mjs'; import {SynchronizeSelectionEvent} from './events.mjs'; import {DOM, V8CustomElement} from './helper.mjs'; @@ -16,11 +19,15 @@ DOM.defineCustomElement( this.addEventListener( SynchronizeSelectionEvent.name, e => this.handleSelectionSyncronization(e)); + this.$('#zoomIn').onclick = () => this.nofChunks *= 1.5; + this.$('#zoomOut').onclick = () => this.nofChunks /= 1.5; } set nofChunks(count) { + const time = this.currentTime for (const track of this.timelineTracks) { track.nofChunks = count; + track.currentTime = time; } } @@ -28,13 +35,16 @@ DOM.defineCustomElement( return this.timelineTracks[0].nofChunks; } + get currentTime() { + return this.timelineTracks[0].currentTime; + } + get timelineTracks() { return this.$('slot').assignedNodes().filter( node => node.nodeType === Node.ELEMENT_NODE); } handleTrackScroll(event) { - // TODO(zcankara) add forEachTrack helper method for (const track of this.timelineTracks) { track.scrollLeft = event.detail; } diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-base.mjs b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-base.mjs new file mode 100644 index 00000000000000..4faa8fc3aa8702 --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-base.mjs @@ -0,0 +1,621 @@ +// Copyright 2020 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. + +import {delay} from '../../helper.mjs'; +import {kChunkHeight, kChunkVisualWidth, kChunkWidth} from '../../log/map.mjs'; +import {SelectionEvent, SelectTimeEvent, SynchronizeSelectionEvent, ToolTipEvent,} from '../events.mjs'; +import {CSSColor, DOM, formatDurationMicros, SVG, V8CustomElement} from '../helper.mjs'; + +export const kTimelineHeight = 200; + +export class TimelineTrackBase extends V8CustomElement { + _timeline; + _nofChunks = 500; + _chunks = []; + _selectedEntry; + _focusedEntry; + _timeToPixel; + _timeStartPixelOffset; + _legend; + _lastContentWidth = 0; + + _cachedTimelineBoundingClientRect; + _cachedTimelineScrollLeft; + + constructor(templateText) { + super(templateText); + this._selectionHandler = new SelectionHandler(this); + this._legend = new Legend(this.$('#legendTable')); + this._legend.onFilter = (type) => this._handleFilterTimeline(); + + this.timelineChunks = this.$('#timelineChunks'); + this.timelineSamples = this.$('#timelineSamples'); + this.timelineNode = this.$('#timeline'); + this.toolTipTargetNode = this.$('#toolTipTarget'); + this.hitPanelNode = this.$('#hitPanel'); + this.timelineAnnotationsNode = this.$('#timelineAnnotations'); + this.timelineMarkersNode = this.$('#timelineMarkers'); + this._scalableContentNode = this.$('#scalableContent'); + + this.timelineNode.addEventListener( + 'scroll', e => this._handleTimelineScroll(e)); + this.hitPanelNode.onclick = this._handleClick.bind(this); + this.hitPanelNode.ondblclick = this._handleDoubleClick.bind(this); + this.hitPanelNode.onmousemove = this._handleMouseMove.bind(this); + window.addEventListener('resize', () => this._resetCachedDimensions()); + this.isLocked = false; + } + + static get observedAttributes() { + return ['title']; + } + + attributeChangedCallback(name, oldValue, newValue) { + if (name == 'title') { + this.$('#title').innerHTML = newValue; + } + } + + _handleFilterTimeline(type) { + this._updateChunks(); + } + + set data(timeline) { + this._timeline = timeline; + this._legend.timeline = timeline; + this.$('.content').style.display = timeline.isEmpty() ? 'none' : 'relative'; + this._updateChunks(); + } + + set timeSelection(selection) { + this._selectionHandler.timeSelection = selection; + this.updateSelection(); + } + + updateSelection() { + this._selectionHandler.update(); + this._legend.update(); + } + + get _timelineBoundingClientRect() { + if (this._cachedTimelineBoundingClientRect === undefined) { + this._cachedTimelineBoundingClientRect = + this.timelineNode.getBoundingClientRect(); + } + return this._cachedTimelineBoundingClientRect; + } + + get _timelineScrollLeft() { + if (this._cachedTimelineScrollLeft === undefined) { + this._cachedTimelineScrollLeft = this.timelineNode.scrollLeft; + } + return this._cachedTimelineScrollLeft; + } + + _resetCachedDimensions() { + this._cachedTimelineBoundingClientRect = undefined; + this._cachedTimelineScrollLeft = undefined; + } + + // Maps the clicked x position to the x position on timeline + positionOnTimeline(pagePosX) { + let rect = this._timelineBoundingClientRect; + let posClickedX = pagePosX - rect.left + this._timelineScrollLeft; + return posClickedX; + } + + positionToTime(pagePosX) { + return this.relativePositionToTime(this.positionOnTimeline(pagePosX)); + } + + relativePositionToTime(timelineRelativeX) { + const timelineAbsoluteX = timelineRelativeX + this._timeStartPixelOffset; + return (timelineAbsoluteX / this._timeToPixel) | 0; + } + + timeToPosition(time) { + let relativePosX = time * this._timeToPixel; + relativePosX -= this._timeStartPixelOffset; + return relativePosX; + } + + set nofChunks(count) { + this._nofChunks = count | 0; + this._updateChunks(); + } + + get nofChunks() { + return this._nofChunks; + } + + _updateChunks() { + this._chunks = undefined; + this._updateDimensions(); + this.requestUpdate(); + } + + get chunks() { + return this._chunks; + } + + set selectedEntry(value) { + this._selectedEntry = value; + this.drawAnnotations(value); + } + + get selectedEntry() { + return this._selectedEntry; + } + + set scrollLeft(offset) { + this.timelineNode.scrollLeft = offset; + this._cachedTimelineScrollLeft = offset; + } + + handleEntryTypeDoubleClick(e) { + this.dispatchEvent(new SelectionEvent(e.target.parentNode.entries)); + } + + timelineIndicatorMove(offset) { + this.timelineNode.scrollLeft += offset; + this._cachedTimelineScrollLeft = undefined; + } + + _handleTimelineScroll(e) { + let scrollLeft = e.currentTarget.scrollLeft; + this._cachedTimelineScrollLeft = scrollLeft; + this.dispatchEvent(new CustomEvent( + 'scrolltrack', {bubbles: true, composed: true, detail: scrollLeft})); + } + + _updateDimensions() { + const centerOffset = this._timelineBoundingClientRect.width / 2; + const time = + this.relativePositionToTime(this._timelineScrollLeft + centerOffset); + const start = this._timeline.startTime; + const width = this._nofChunks * kChunkWidth; + this._lastContentWidth = parseInt(this.timelineMarkersNode.style.width); + this._timeToPixel = width / this._timeline.duration(); + this._timeStartPixelOffset = start * this._timeToPixel; + this.timelineChunks.style.width = `${width}px`; + this.timelineMarkersNode.style.width = `${width}px`; + this.timelineAnnotationsNode.style.width = `${width}px`; + this.hitPanelNode.style.width = `${width}px`; + this._drawMarkers(); + this._selectionHandler.update(); + this._scaleContent(width); + this._cachedTimelineScrollLeft = this.timelineNode.scrollLeft = + this.timeToPosition(time) - centerOffset; + } + + _scaleContent(currentWidth) { + if (!this._lastContentWidth) return; + const ratio = currentWidth / this._lastContentWidth; + this._scalableContentNode.style.transform = `scale(${ratio}, 1)`; + } + + _adjustHeight(height) { + const dataHeight = Math.max(height, 200); + const viewHeight = Math.min(dataHeight, 400); + this.style.setProperty('--data-height', dataHeight + 'px'); + this.style.setProperty('--view-height', viewHeight + 'px'); + this.timelineNode.style.overflowY = + (height > kTimelineHeight) ? 'scroll' : 'hidden'; + } + + _update() { + this._legend.update(); + this._drawContent(); + this._drawAnnotations(this.selectedEntry); + this._resetCachedDimensions(); + } + + async _drawContent() { + await delay(5); + if (this._timeline.isEmpty()) return; + if (this.chunks?.length != this.nofChunks) { + this._chunks = + this._timeline.chunks(this.nofChunks, this._legend.filterPredicate); + console.assert(this._chunks.length == this._nofChunks); + } + const chunks = this.chunks; + const max = chunks.max(each => each.size()); + let buffer = ''; + for (let i = 0; i < chunks.length; i++) { + const chunk = chunks[i]; + const height = (chunk.size() / max * kChunkHeight); + chunk.height = height; + if (chunk.isEmpty()) continue; + buffer += ''; + buffer += this._drawChunk(i, chunk); + buffer += '' + } + this._scalableContentNode.innerHTML = buffer; + this._scalableContentNode.style.transform = 'scale(1, 1)'; + } + + _drawChunk(chunkIndex, chunk) { + const groups = chunk.getBreakdown(event => event.type); + let buffer = ''; + const kHeight = chunk.height; + let lastHeight = kTimelineHeight; + for (let i = 0; i < groups.length; i++) { + const group = groups[i]; + if (group.length == 0) break; + const height = (group.length / chunk.size() * kHeight) | 0; + lastHeight -= height; + const color = this._legend.colorForType(group.key); + buffer += `` + } + return buffer; + } + + _drawMarkers() { + // Put a time marker roughly every 20 chunks. + const expected = this._timeline.duration() / this._nofChunks * 20; + let interval = (10 ** Math.floor(Math.log10(expected))); + let correction = Math.log10(expected / interval); + correction = (correction < 0.33) ? 1 : (correction < 0.75) ? 2.5 : 5; + interval *= correction; + + const start = this._timeline.startTime; + let time = start; + let buffer = ''; + while (time < this._timeline.endTime) { + const delta = time - start; + const text = `${(delta / 1000) | 0} ms`; + const x = (delta * this._timeToPixel) | 0; + buffer += `${text}` + buffer += + `` + time += interval; + } + this.timelineMarkersNode.innerHTML = buffer; + } + + _drawAnnotations(logEntry, time) { + if (!this._focusedEntry) return; + this._drawEntryMark(this._focusedEntry); + } + + _drawEntryMark(entry) { + const [x, y] = this._positionForEntry(entry); + const color = this._legend.colorForType(entry.type); + const mark = + ``; + this.timelineAnnotationsNode.innerHTML = mark; + } + + _handleUnlockedMouseEvent(event) { + this._focusedEntry = this._getEntryForEvent(event); + if (!this._focusedEntry) return false; + this._updateToolTip(event); + const time = this.positionToTime(event.pageX); + this._drawAnnotations(this._focusedEntry, time); + } + + _updateToolTip(event) { + if (!this._focusedEntry) return false; + this.dispatchEvent( + new ToolTipEvent(this._focusedEntry, this.toolTipTargetNode)); + event.stopImmediatePropagation(); + } + + _handleClick(event) { + if (event.button !== 0) return; + if (event.target === this.timelineChunks) return; + this.isLocked = !this.isLocked; + // Do this unconditionally since we want the tooltip to be update to the + // latest locked state. + this._handleUnlockedMouseEvent(event); + return false; + } + + _handleDoubleClick(event) { + if (event.button !== 0) return; + this._selectionHandler.clearSelection(); + const time = this.positionToTime(event.pageX); + const chunk = this._getChunkForEvent(event) + if (!chunk) return; + event.stopImmediatePropagation(); + this.dispatchEvent(new SelectTimeEvent(chunk.start, chunk.end)); + return false; + } + + _handleMouseMove(event) { + if (event.button !== 0) return; + if (this._selectionHandler.isSelecting) return false; + if (this.isLocked && this._focusedEntry) { + this._updateToolTip(event); + return false; + } + this._handleUnlockedMouseEvent(event); + } + + _getChunkForEvent(event) { + const time = this.positionToTime(event.pageX); + return this._chunkForTime(time); + } + + _chunkForTime(time) { + const chunkIndex = ((time - this._timeline.startTime) / + this._timeline.duration() * this._nofChunks) | + 0; + return this.chunks[chunkIndex]; + } + + _positionForEntry(entry) { + const chunk = this._chunkForTime(entry.time); + if (chunk === undefined) return [-1, -1]; + const xFrom = (chunk.index * kChunkWidth + kChunkVisualWidth / 2) | 0; + const yFrom = kTimelineHeight - chunk.yOffset(entry) | 0; + return [xFrom, yFrom]; + } + + _getEntryForEvent(event) { + const chunk = this._getChunkForEvent(event); + if (chunk?.isEmpty() ?? true) return false; + const relativeIndex = Math.round( + (kTimelineHeight - event.layerY) / chunk.height * (chunk.size() - 1)); + if (relativeIndex > chunk.size()) return false; + const logEntry = chunk.at(relativeIndex); + const style = this.toolTipTargetNode.style; + style.left = `${chunk.index * kChunkWidth}px`; + style.top = `${kTimelineHeight - chunk.height}px`; + style.height = `${chunk.height}px`; + style.width = `${kChunkVisualWidth}px`; + return logEntry; + } +}; + +class SelectionHandler { + // TODO turn into static field once Safari supports it. + static get SELECTION_OFFSET() { + return 10 + }; + + _timeSelection = {start: -1, end: Infinity}; + _selectionOriginTime = -1; + + constructor(timeline) { + this._timeline = timeline; + this._timelineNode.addEventListener( + 'mousedown', e => this._handleTimeSelectionMouseDown(e)); + this._timelineNode.addEventListener( + 'mouseup', e => this._handleTimeSelectionMouseUp(e)); + this._timelineNode.addEventListener( + 'mousemove', e => this._handleTimeSelectionMouseMove(e)); + } + + update() { + if (!this.hasSelection) { + this._selectionNode.style.display = 'none'; + return; + } + this._selectionNode.style.display = 'inherit'; + const startPosition = this.timeToPosition(this._timeSelection.start); + const endPosition = this.timeToPosition(this._timeSelection.end); + this._leftHandleNode.style.left = startPosition + 'px'; + this._rightHandleNode.style.left = endPosition + 'px'; + const delta = endPosition - startPosition; + const selectionNode = this._selectionBackgroundNode; + selectionNode.style.left = startPosition + 'px'; + selectionNode.style.width = delta + 'px'; + } + + set timeSelection(selection) { + this._timeSelection.start = selection.start; + this._timeSelection.end = selection.end; + } + + clearSelection() { + this._timeline.dispatchEvent(new SelectTimeEvent()); + } + + timeToPosition(posX) { + return this._timeline.timeToPosition(posX); + } + + positionToTime(posX) { + return this._timeline.positionToTime(posX); + } + + get isSelecting() { + return this._selectionOriginTime >= 0; + } + + get hasSelection() { + return this._timeSelection.start >= 0 && + this._timeSelection.end != Infinity; + } + + get _timelineNode() { + return this._timeline.$('#timeline'); + } + + get _selectionNode() { + return this._timeline.$('#selection'); + } + + get _selectionBackgroundNode() { + return this._timeline.$('#selectionBackground'); + } + + get _leftHandleNode() { + return this._timeline.$('#leftHandle'); + } + + get _rightHandleNode() { + return this._timeline.$('#rightHandle'); + } + + get _leftHandlePosX() { + return this._leftHandleNode.getBoundingClientRect().x; + } + + get _rightHandlePosX() { + return this._rightHandleNode.getBoundingClientRect().x; + } + + _isOnLeftHandle(posX) { + return Math.abs(this._leftHandlePosX - posX) <= + SelectionHandler.SELECTION_OFFSET; + } + + _isOnRightHandle(posX) { + return Math.abs(this._rightHandlePosX - posX) <= + SelectionHandler.SELECTION_OFFSET; + } + + _handleTimeSelectionMouseDown(event) { + if (event.button !== 0) return; + let xPosition = event.clientX + // Update origin time in case we click on a handle. + if (this._isOnLeftHandle(xPosition)) { + xPosition = this._rightHandlePosX; + } + else if (this._isOnRightHandle(xPosition)) { + xPosition = this._leftHandlePosX; + } + this._selectionOriginTime = this.positionToTime(xPosition); + } + + _handleTimeSelectionMouseMove(event) { + if (event.button !== 0) return; + if (!this.isSelecting) return; + const currentTime = this.positionToTime(event.clientX); + this._timeline.dispatchEvent(new SynchronizeSelectionEvent( + Math.min(this._selectionOriginTime, currentTime), + Math.max(this._selectionOriginTime, currentTime))); + } + + _handleTimeSelectionMouseUp(event) { + if (event.button !== 0) return; + this._selectionOriginTime = -1; + if (this._timeSelection.start === -1) return; + const delta = this._timeSelection.end - this._timeSelection.start; + if (delta <= 1 || isNaN(delta)) return; + this._timeline.dispatchEvent(new SelectTimeEvent( + this._timeSelection.start, this._timeSelection.end)); + } +} + +class Legend { + _timeline; + _typesFilters = new Map(); + _typeClickHandler = this._handleTypeClick.bind(this); + _filterPredicate = this.filter.bind(this); + onFilter = () => {}; + + constructor(table) { + this._table = table; + this._enableDuration = false; + } + + set timeline(timeline) { + this._timeline = timeline; + const groups = timeline.getBreakdown(); + this._typesFilters = new Map(groups.map(each => [each.key, true])); + this._colors = + new Map(groups.map(each => [each.key, CSSColor.at(each.id)])); + } + + get selection() { + return this._timeline.selectionOrSelf; + } + + get filterPredicate() { + for (let visible of this._typesFilters.values()) { + if (!visible) return this._filterPredicate; + } + return undefined; + } + + colorForType(type) { + let color = this._colors.get(type); + if (color === undefined) { + color = CSSColor.at(this._colors.size); + this._colors.set(type, color); + } + return color; + } + + filter(logEntry) { + return this._typesFilters.get(logEntry.type); + } + + update() { + const tbody = DOM.tbody(); + const missingTypes = new Set(this._typesFilters.keys()); + this._checkDurationField(); + this.selection.getBreakdown(undefined, this._enableDuration) + .forEach(group => { + tbody.appendChild(this._addTypeRow(group)); + missingTypes.delete(group.key); + }); + missingTypes.forEach(key => tbody.appendChild(this._row('', key, 0, '0%'))); + if (this._timeline.selection) { + tbody.appendChild( + this._row('', 'Selection', this.selection.length, '100%')); + } + tbody.appendChild(this._row('', 'All', this._timeline.length, '')); + this._table.tBodies[0].replaceWith(tbody); + } + + _checkDurationField() { + if (this._enableDuration) return; + const example = this.selection.at(0); + if (!example || !('duration' in example)) return; + this._enableDuration = true; + this._table.tHead.appendChild(DOM.td('Duration')); + this._table.tHead.appendChild(DOM.td('')); + } + + _row(colorNode, type, count, countPercent, duration, durationPercent) { + const row = DOM.tr(); + row.appendChild(DOM.td(colorNode)); + const typeCell = row.appendChild(DOM.td(type)); + typeCell.setAttribute('title', type); + row.appendChild(DOM.td(count.toString())); + row.appendChild(DOM.td(countPercent)); + if (this._enableDuration) { + row.appendChild(DOM.td(formatDurationMicros(duration ?? 0))); + row.appendChild(DOM.td(durationPercent ?? '0%')); + } + return row + } + + _addTypeRow(group) { + const color = this.colorForType(group.key); + const colorDiv = DOM.div('colorbox'); + if (this._typesFilters.get(group.key)) { + colorDiv.style.backgroundColor = color; + } else { + colorDiv.style.borderColor = color; + colorDiv.style.backgroundColor = CSSColor.backgroundImage; + } + let duration = 0; + if (this._enableDuration) { + const entries = group.entries; + for (let i = 0; i < entries.length; i++) { + duration += entries[i].duration; + } + } + let countPercent = + `${(group.length / this.selection.length * 100).toFixed(1)}%`; + const row = this._row( + colorDiv, group.key, group.length, countPercent, duration, ''); + row.className = 'clickable'; + row.onclick = this._typeClickHandler; + row.data = group.key; + return row; + } + + _handleTypeClick(e) { + const type = e.currentTarget.data; + this._typesFilters.set(type, !this._typesFilters.get(type)); + this.onFilter(type); + } +} diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-map.mjs b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-map.mjs new file mode 100644 index 00000000000000..639acc03123bb7 --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-map.mjs @@ -0,0 +1,138 @@ +// 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. + +import {kChunkVisualWidth, MapLogEntry} from '../../log/map.mjs'; +import {CSSColor, DOM} from '../helper.mjs'; + +import {TimelineTrackBase} from './timeline-track-base.mjs' + +DOM.defineCustomElement('view/timeline/timeline-track', 'timeline-track-map', + (templateText) => + class TimelineTrackMap extends TimelineTrackBase { + constructor() { + super(templateText); + } + + getMapStyle(map) { + return map.edge && map.edge.from ? CSSColor.onBackgroundColor : + CSSColor.onPrimaryColor; + } + + markMap(map) { + const [x, y] = map.position(this.chunks); + const strokeColor = this.getMapStyle(map); + return `` + } + + markSelectedMap(map) { + const [x, y] = map.position(this.chunks); + const strokeColor = this.getMapStyle(map); + return `` + } + + _drawAnnotations(logEntry, time) { + if (!(logEntry instanceof MapLogEntry)) return; + if (!logEntry.edge) { + this.timelineAnnotationsNode.innerHTML = ''; + return; + } + // Draw the trace of maps in reverse order to make sure the outgoing + // transitions of previous maps aren't drawn over. + const kOpaque = 1.0; + let stack = []; + let current = logEntry; + while (current !== undefined) { + stack.push(current); + current = current.parent; + } + + // Draw outgoing refs as fuzzy background. Skip the last map entry. + let buffer = ''; + let nofEdges = 0; + const kMaxOutgoingEdges = 100; + for (let i = stack.length - 2; i >= 0; i--) { + const map = stack[i].parent; + nofEdges += map.children.length; + if (nofEdges > kMaxOutgoingEdges) break; + buffer += this.drawOutgoingEdges(map, 0.4, 1); + } + + // Draw main connection. + let labelOffset = 15; + let xPrev = 0; + for (let i = stack.length - 1; i >= 0; i--) { + let map = stack[i]; + if (map.edge) { + const [xTo, data] = this.drawEdge(map.edge, kOpaque, labelOffset); + buffer += data; + if (xTo == xPrev) { + labelOffset += 10; + } else { + labelOffset = 15 + } + xPrev = xTo; + } + buffer += this.markMap(map); + } + + buffer += this.drawOutgoingEdges(logEntry, 0.9, 3); + // Mark selected map + buffer += this.markSelectedMap(logEntry); + this.timelineAnnotationsNode.innerHTML = buffer; + } + + drawEdge(edge, opacity, labelOffset = 20) { + let buffer = ''; + if (!edge.from || !edge.to) return [-1, buffer]; + const [xFrom, yFrom] = edge.from.position(this.chunks); + const [xTo, yTo] = edge.to.position(this.chunks); + const sameChunk = xTo == xFrom; + if (sameChunk) labelOffset += 10; + const color = this._legend.colorForType(edge.type); + const offsetX = 20; + const midX = xFrom + (xTo - xFrom) / 2; + const midY = (yFrom + yTo) / 2 - 100; + if (!sameChunk) { + if (opacity == 1.0) { + buffer += `` + } + buffer += `` + } else { + if (opacity == 1.0) { + buffer += ``; + } + buffer += ``; + } + if (opacity == 1.0) { + const centerX = sameChunk ? xTo : ((xFrom / 2 + midX + xTo / 2) / 2) | 0; + const centerY = sameChunk ? yTo : ((yFrom / 2 + midY + yTo / 2) / 2) | 0; + const centerYTo = centerY - labelOffset; + buffer += ``; + buffer += `${ + edge.toString()}`; + } + return [xTo, buffer]; + } + + drawOutgoingEdges(map, opacity = 1.0, max = 10, depth = 0) { + let buffer = ''; + if (!map || depth >= max) return buffer; + const limit = Math.min(map.children.length, 100) + for (let i = 0; i < limit; i++) { + const edge = map.children[i]; + const [xTo, data] = this.drawEdge(edge, opacity); + buffer += data; + buffer += this.drawOutgoingEdges(edge.to, opacity * 0.5, max, depth + 1); + } + return buffer; + } +}) \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-stacked-base.mjs b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-stacked-base.mjs new file mode 100644 index 00000000000000..24b389b95965d5 --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-stacked-base.mjs @@ -0,0 +1,144 @@ +// 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. + +import {delay} from '../../helper.mjs'; +import {Timeline} from '../../timeline.mjs'; +import {SelectTimeEvent} from '../events.mjs'; +import {CSSColor, DOM, SVG} from '../helper.mjs'; + +import {TimelineTrackBase} from './timeline-track-base.mjs' + +const kItemHeight = 8; + +export class TimelineTrackStackedBase extends TimelineTrackBase { + _originalContentWidth = 0; + _drawableItems = new Timeline(); + + _updateChunks() { + // We don't need to update the chunks here. + this._updateDimensions(); + this.requestUpdate(); + } + + set data(timeline) { + super.data = timeline; + this._contentWidth = 0; + this._prepareDrawableItems(); + } + + _handleDoubleClick(event) { + if (event.button !== 0) return; + this._selectionHandler.clearSelection(); + const item = this._getDrawableItemForEvent(event); + if (item === undefined) return; + event.stopImmediatePropagation(); + this.dispatchEvent(new SelectTimeEvent(item.startTime, item.endTime)); + return false; + } + + _getStackDepthForEvent(event) { + return Math.floor(event.layerY / kItemHeight) - 1; + } + + _getDrawableItemForEvent(event) { + const depth = this._getStackDepthForEvent(event); + const time = this.positionToTime(event.pageX); + const index = this._drawableItems.find(time); + for (let i = index - 1; i > 0; i--) { + const item = this._drawableItems.at(i); + if (item.depth != depth) continue; + if (item.endTime < time) continue; + return item; + } + return undefined; + } + + _drawableItemToLogEntry(item) { + return item; + } + + _getEntryForEvent(event) { + const item = this._getDrawableItemForEvent(event); + const logEntry = this._drawableItemToLogEntry(item); + if (item === undefined) return undefined; + const style = this.toolTipTargetNode.style; + style.left = `${event.layerX}px`; + style.top = `${(item.depth + 1) * kItemHeight}px`; + style.height = `${kItemHeight}px` + return logEntry; + } + + _prepareDrawableItems() { + // Subclass responsibility. + } + + _adjustStackDepth(maxDepth) { + // Account for empty top line + maxDepth++; + this._adjustHeight(maxDepth * kItemHeight); + } + + _scaleContent(currentWidth) { + if (this._originalContentWidth == 0) return; + // Instead of repainting just scale the content. + const ratio = currentWidth / this._originalContentWidth; + this._scalableContentNode.style.transform = `scale(${ratio}, 1)`; + this.style.setProperty('--txt-scale', `scale(${1 / ratio}, 1)`); + } + + async _drawContent() { + if (this._originalContentWidth > 0) return; + this._originalContentWidth = parseInt(this.timelineMarkersNode.style.width); + this._scalableContentNode.innerHTML = ''; + let buffer = ''; + const add = async () => { + const svg = SVG.svg(); + svg.innerHTML = buffer; + this._scalableContentNode.appendChild(svg); + buffer = ''; + await delay(50); + }; + const items = this._drawableItems.values; + for (let i = 0; i < items.length; i++) { + if ((i % 3000) == 0) await add(); + buffer += this._drawItem(items[i], i); + } + add(); + } + + _drawItem(item, i, outline = false) { + const x = this.timeToPosition(item.time); + const y = (item.depth + 1) * kItemHeight; + let width = item.duration * this._timeToPixel; + if (outline) { + return ``; + } + let color = this._legend.colorForType(item.type); + if (i % 2 == 1) { + color = CSSColor.darken(color, 20); + } + return ``; + } + + _drawItemText(item) { + const type = item.type; + const kHeight = 9; + const x = this.timeToPosition(item.time); + const y = item.depth * (kHeight + 1); + let width = item.duration * this._timeToPixel; + width -= width * 0.1; + + let buffer = ''; + if (width < 15 || type == 'Other') return buffer; + const rawName = item.entry.getName(); + if (rawName.length == 0) return buffer; + const kChartWidth = 5; + const maxChars = Math.floor(width / kChartWidth) + const text = rawName.substr(0, maxChars); + buffer += `${text}` + return buffer; + } +} \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-template.html b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-template.html index bcab2d53490595..911476360656d2 100644 --- a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-template.html +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-template.html @@ -6,61 +6,37 @@ +
@@ -180,23 +206,29 @@

-
+
-
Frequency
-
- + + + + + +
+ +
+ - + diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-tick.mjs b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-tick.mjs new file mode 100644 index 00000000000000..502504beb485f4 --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-tick.mjs @@ -0,0 +1,201 @@ +// 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. + +import {delay} from '../../helper.mjs'; +import {TickLogEntry} from '../../log/tick.mjs'; +import {Timeline} from '../../timeline.mjs'; +import {DOM, SVG} from '../helper.mjs'; + +import {TimelineTrackStackedBase} from './timeline-track-stacked-base.mjs' + +class Flame { + constructor(time, logEntry, depth) { + this._time = time; + this._logEntry = logEntry; + this.depth = depth; + this._duration = -1; + this.parent = undefined; + this.children = []; + } + + static add(time, logEntry, stack, flames) { + const depth = stack.length; + const newFlame = new Flame(time, logEntry, depth) + if (depth > 0) { + const parent = stack[depth - 1]; + newFlame.parent = parent; + parent.children.push(newFlame); + } + flames.push(newFlame); + stack.push(newFlame); + } + + stop(time) { + if (this._duration !== -1) throw new Error('Already stopped'); + this._duration = time - this._time + } + + get time() { + return this._time; + } + + get logEntry() { + return this._logEntry; + } + + get startTime() { + return this._time; + } + + get endTime() { + return this._time + this._duration; + } + + get duration() { + return this._duration; + } + + get type() { + return TickLogEntry.extractCodeEntryType(this._logEntry?.entry); + } +} + +DOM.defineCustomElement( + 'view/timeline/timeline-track', 'timeline-track-tick', + (templateText) => class TimelineTrackTick extends TimelineTrackStackedBase { + constructor() { + super(templateText); + this._annotations = new Annotations(this); + } + + _prepareDrawableItems() { + const tmpFlames = []; + // flameStack = [bottom, ..., top]; + const flameStack = []; + const ticks = this._timeline.values; + let maxDepth = 0; + + for (let tickIndex = 0; tickIndex < ticks.length; tickIndex++) { + const tick = ticks[tickIndex]; + const tickStack = tick.stack; + maxDepth = Math.max(maxDepth, tickStack.length); + // tick.stack = [top, .... , bottom]; + for (let stackIndex = tickStack.length - 1; stackIndex >= 0; + stackIndex--) { + const codeEntry = tickStack[stackIndex]; + // codeEntry is either a CodeEntry or a raw pc. + const logEntry = codeEntry?.logEntry; + const flameStackIndex = tickStack.length - stackIndex - 1; + if (flameStackIndex < flameStack.length) { + if (flameStack[flameStackIndex].logEntry === logEntry) continue; + for (let k = flameStackIndex; k < flameStack.length; k++) { + flameStack[k].stop(tick.time); + } + flameStack.length = flameStackIndex; + } + Flame.add(tick.time, logEntry, flameStack, tmpFlames); + } + if (tickStack.length < flameStack.length) { + for (let k = tickStack.length; k < flameStack.length; k++) { + flameStack[k].stop(tick.time); + } + flameStack.length = tickStack.length; + } + } + const lastTime = ticks[ticks.length - 1].time; + for (let k = 0; k < flameStack.length; k++) { + flameStack[k].stop(lastTime); + } + this._drawableItems = new Timeline(Flame, tmpFlames); + this._annotations.flames = this._drawableItems; + this._adjustStackDepth(maxDepth); + } + + _drawAnnotations(logEntry, time) { + if (time === undefined) { + time = this.relativePositionToTime(this._timelineScrollLeft); + } + this._annotations.update(logEntry, time); + } + + _drawableItemToLogEntry(flame) { + const logEntry = flame?.logEntry; + if (logEntry === undefined || typeof logEntry == 'number') + return undefined; + return logEntry; + } + }) + +class Annotations { + _flames; + _logEntry; + _buffer; + + constructor(track) { + this._track = track; + } + + set flames(flames) { + this._flames = flames; + } + + get _node() { + return this._track.timelineAnnotationsNode; + } + + async update(logEntry, time) { + if (this._logEntry == logEntry) return; + this._logEntry = logEntry; + this._node.innerHTML = ''; + if (logEntry === undefined) return; + this._buffer = ''; + const start = this._flames.find(time); + let offset = 0; + // Draw annotations gradually outwards starting form the given time. + let deadline = performance.now() + 500; + for (let range = 0; range < this._flames.length; range += 10000) { + this._markFlames(start - range, start - offset); + this._markFlames(start + offset, start + range); + offset = range; + if ((navigator?.scheduling?.isInputPending({includeContinuous: true}) ?? + false) || + performance.now() >= deadline) { + // Yield if we have to handle an input event, or we're out of time. + await delay(50); + // Abort if we started another update asynchronously. + if (this._logEntry != logEntry) return; + + deadline = performance.now() + 500; + } + this._drawBuffer(); + } + this._drawBuffer(); + } + + _markFlames(start, end) { + const rawFlames = this._flames.values; + if (start < 0) start = 0; + if (end > rawFlames.length) end = rawFlames.length; + const logEntry = this._logEntry; + // Also compare against the function, if any. + const func = logEntry.entry?.func; + for (let i = start; i < end; i++) { + const flame = rawFlames[i]; + if (!flame.entry) continue; + if (flame.entry.logEntry !== logEntry && + (!func || flame.entry.func !== func)) { + continue; + } + this._buffer += this._track.drawFlame(flame, i, true); + } + } + + _drawBuffer() { + if (this._buffer.length == 0) return; + const svg = SVG.svg(); + svg.innerHTML = this._buffer; + this._node.appendChild(svg); + this._buffer = ''; + } +} \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-timer.mjs b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-timer.mjs new file mode 100644 index 00000000000000..62ee07aff7d2d7 --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-timer.mjs @@ -0,0 +1,41 @@ +// 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. + +import {CSSColor, DOM, SVG, V8CustomElement} from '../helper.mjs'; + +import {TimelineTrackBase} from './timeline-track-base.mjs' +import {TimelineTrackStackedBase} from './timeline-track-stacked-base.mjs' + +DOM.defineCustomElement( + 'view/timeline/timeline-track', 'timeline-track-timer', + (templateText) => + class TimelineTrackTimer extends TimelineTrackStackedBase { + constructor() { + super(templateText); + } + + _prepareDrawableItems() { + const stack = []; + let maxDepth = 0; + for (let i = 0; i < this._timeline.length; i++) { + const timer = this._timeline.at(i); + let insertDepth = -1; + for (let depth = 0; depth < stack.length; depth++) { + const pendingTimer = stack[depth]; + if (pendingTimer === undefined) { + if (insertDepth === -1) insertDepth = depth; + } else if (pendingTimer.endTime <= timer.startTime) { + stack[depth] == undefined; + if (insertDepth === -1) insertDepth = depth; + } + } + if (insertDepth === -1) insertDepth = stack.length; + stack[insertDepth] = timer; + timer.depth = insertDepth; + maxDepth = Math.max(maxDepth, insertDepth); + } + this._drawableItems = this._timeline; + this._adjustStackDepth(maxDepth++); + } + }); \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track.mjs b/deps/v8/tools/system-analyzer/view/timeline/timeline-track.mjs index 6f05b772d81c1b..8952afc182f2af 100644 --- a/deps/v8/tools/system-analyzer/view/timeline/timeline-track.mjs +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track.mjs @@ -1,605 +1,15 @@ -// Copyright 2020 the V8 project authors. All rights reserved. +// 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. -import {kChunkHeight, kChunkWidth} from '../../log/map.mjs'; -import {MapLogEntry} from '../../log/map.mjs'; -import {FocusEvent, SelectionEvent, SelectTimeEvent, SynchronizeSelectionEvent, ToolTipEvent,} from '../events.mjs'; -import {CSSColor, DOM, gradientStopsFromGroups, V8CustomElement} from '../helper.mjs'; +import {CSSColor, DOM, SVG, V8CustomElement} from '../helper.mjs'; -DOM.defineCustomElement('view/timeline/timeline-track', - (templateText) => - class TimelineTrack extends V8CustomElement { - _timeline; - _nofChunks = 400; - _chunks; - _selectedEntry; - _timeToPixel; - _timeStartOffset; - _legend; +import {TimelineTrackBase} from './timeline-track-base.mjs' - _chunkMouseMoveHandler = this._handleChunkMouseMove.bind(this); - _chunkClickHandler = this._handleChunkClick.bind(this); - _chunkDoubleClickHandler = this._handleChunkDoubleClick.bind(this); - - constructor() { - super(templateText); - this._selectionHandler = new SelectionHandler(this); - this._legend = new Legend(this.$('#legendTable')); - this._legend.onFilter = (type) => this._handleFilterTimeline(); - this.timelineNode.addEventListener( - 'scroll', e => this._handleTimelineScroll(e)); - this.timelineNode.ondblclick = (e) => - this._selectionHandler.clearSelection(); - this.isLocked = false; - } - - static get observedAttributes() { - return ['title']; - } - - attributeChangedCallback(name, oldValue, newValue) { - if (name == 'title') { - this.$('#title').innerHTML = newValue; - } - } - - _handleFilterTimeline(type) { - this._updateChunks(); - } - - set data(timeline) { - this._timeline = timeline; - this._legend.timeline = timeline; - this.$('.content').style.display = timeline.isEmpty() ? 'none' : 'relative'; - this._updateChunks(); - } - - set timeSelection(selection) { - this._selectionHandler.timeSelection = selection; - this.updateSelection(); - } - - updateSelection() { - this._selectionHandler.update(); - this._legend.update(); - } - - // Maps the clicked x position to the x position on timeline canvas - positionOnTimeline(posX) { - let rect = this.timelineNode.getBoundingClientRect(); - let posClickedX = posX - rect.left + this.timelineNode.scrollLeft; - return posClickedX; - } - - positionToTime(posX) { - let posTimelineX = this.positionOnTimeline(posX) + this._timeStartOffset; - return posTimelineX / this._timeToPixel; - } - - timeToPosition(time) { - let posX = time * this._timeToPixel; - posX -= this._timeStartOffset; - return posX; - } - - get timelineCanvas() { - return this.$('#timelineCanvas'); - } - - get timelineChunks() { - return this.$('#timelineChunks'); - } - - get timelineNode() { - return this.$('#timeline'); - } - - _update() { - this._updateTimeline(); - this._legend.update(); - } - - set nofChunks(count) { - this._nofChunks = count; - this._updateChunks(); - } - - get nofChunks() { - return this._nofChunks; - } - - _updateChunks() { - this._chunks = - this._timeline.chunks(this.nofChunks, this._legend.filterPredicate); - this.requestUpdate(); - } - - get chunks() { - return this._chunks; - } - - set selectedEntry(value) { - this._selectedEntry = value; - if (value.edge) this.redraw(); - } - - get selectedEntry() { - return this._selectedEntry; - } - - set scrollLeft(offset) { - this.timelineNode.scrollLeft = offset; - } - - handleEntryTypeDoubleClick(e) { - this.dispatchEvent(new SelectionEvent(e.target.parentNode.entries)); - } - - timelineIndicatorMove(offset) { - this.timelineNode.scrollLeft += offset; - } - - _handleTimelineScroll(e) { - let horizontal = e.currentTarget.scrollLeft; - this.dispatchEvent(new CustomEvent( - 'scrolltrack', {bubbles: true, composed: true, detail: horizontal})); - } - - _createBackgroundImage(chunk) { - const stops = gradientStopsFromGroups( - chunk.length, chunk.height, chunk.getBreakdown(event => event.type), - type => this._legend.colorForType(type)); - return `linear-gradient(0deg,${stops.join(',')})`; - } - - _updateTimeline() { - const reusableNodes = Array.from(this.timelineChunks.childNodes).reverse(); - let fragment = new DocumentFragment(); - let chunks = this.chunks; - let max = chunks.max(each => each.size()); - let start = this._timeline.startTime; - let end = this._timeline.endTime; - let duration = end - start; - this._timeToPixel = chunks.length * kChunkWidth / duration; - this._timeStartOffset = start * this._timeToPixel; - for (let i = 0; i < chunks.length; i++) { - let chunk = chunks[i]; - let height = (chunk.size() / max * kChunkHeight); - chunk.height = height; - if (chunk.isEmpty()) continue; - let node = reusableNodes[reusableNodes.length - 1]; - let reusedNode = false; - if (node?.className == 'chunk') { - reusableNodes.pop(); - reusedNode = true; - } else { - node = DOM.div('chunk'); - node.onmousemove = this._chunkMouseMoveHandler; - node.onclick = this._chunkClickHandler; - node.ondblclick = this._chunkDoubleClickHandler; - } - const style = node.style; - style.left = `${i * kChunkWidth}px`; - style.height = `${height | 0}px`; - style.backgroundImage = this._createBackgroundImage(chunk); - node.chunk = chunk; - if (!reusedNode) fragment.appendChild(node); - } - - // Put a time marker roughly every 20 chunks. - let expected = duration / chunks.length * 20; - let interval = (10 ** Math.floor(Math.log10(expected))); - let correction = Math.log10(expected / interval); - correction = (correction < 0.33) ? 1 : (correction < 0.75) ? 2.5 : 5; - interval *= correction; - - let time = start; - while (time < end) { - let timeNode = DOM.div('timestamp'); - timeNode.innerText = `${((time - start) / 1000) | 0} ms`; - timeNode.style.left = `${((time - start) * this._timeToPixel) | 0}px`; - fragment.appendChild(timeNode); - time += interval; - } - - // Remove superfluos nodes lazily, for Chrome this is a very expensive - // operation. - if (reusableNodes.length > 0) { - for (const node of reusableNodes) { - node.style.display = 'none'; +DOM.defineCustomElement( + 'view/timeline/timeline-track', + (templateText) => class TimelineTrack extends TimelineTrackBase { + constructor() { + super(templateText); } - setTimeout(() => { - const range = document.createRange(); - const first = reusableNodes[reusableNodes.length - 1]; - const last = reusableNodes[0]; - range.setStartBefore(first); - range.setEndAfter(last); - range.deleteContents(); - }, 100); - } - this.timelineChunks.appendChild(fragment); - this.redraw(); - } - - _handleChunkMouseMove(event) { - if (this.isLocked) return false; - if (this._selectionHandler.isSelecting) return false; - let chunk = event.target.chunk; - if (!chunk) return; - if (chunk.isEmpty()) return; - // topmost map (at chunk.height) == map #0. - let relativeIndex = Math.round( - event.layerY / event.target.offsetHeight * (chunk.size() - 1)); - let logEntry = chunk.at(relativeIndex); - this.dispatchEvent(new FocusEvent(logEntry)); - this.dispatchEvent(new ToolTipEvent(logEntry.toStringLong(), event.target)); - } - - _handleChunkClick(event) { - this.isLocked = !this.isLocked; - } - - _handleChunkDoubleClick(event) { - let chunk = event.target.chunk; - if (!chunk) return; - event.stopPropagation(); - this.dispatchEvent(new SelectTimeEvent(chunk.start, chunk.end)); - } - - redraw() { - window.requestAnimationFrame(() => this._redraw()); - } - - _redraw() { - if (!(this._timeline.at(0) instanceof MapLogEntry)) return; - let canvas = this.timelineCanvas; - let width = (this.chunks.length + 1) * kChunkWidth; - if (width > 32767) width = 32767; - canvas.width = width; - canvas.height = kChunkHeight; - let ctx = canvas.getContext('2d'); - ctx.clearRect(0, 0, canvas.width, kChunkHeight); - if (!this.selectedEntry || !this.selectedEntry.edge) return; - this.drawEdges(ctx); - } - - setMapStyle(map, ctx) { - ctx.fillStyle = map.edge && map.edge.from ? CSSColor.onBackgroundColor : - CSSColor.onPrimaryColor; - } - - setEdgeStyle(edge, ctx) { - let color = this._legend.colorForType(edge.type); - ctx.strokeStyle = color; - ctx.fillStyle = color; - } - - markMap(ctx, map) { - let [x, y] = map.position(this.chunks); - ctx.beginPath(); - this.setMapStyle(map, ctx); - ctx.arc(x, y, 3, 0, 2 * Math.PI); - ctx.fill(); - ctx.beginPath(); - ctx.fillStyle = CSSColor.onBackgroundColor; - ctx.arc(x, y, 2, 0, 2 * Math.PI); - ctx.fill(); - } - - markSelectedMap(ctx, map) { - let [x, y] = map.position(this.chunks); - ctx.beginPath(); - this.setMapStyle(map, ctx); - ctx.arc(x, y, 6, 0, 2 * Math.PI); - ctx.strokeStyle = CSSColor.onBackgroundColor; - ctx.stroke(); - } - - drawEdges(ctx) { - // Draw the trace of maps in reverse order to make sure the outgoing - // transitions of previous maps aren't drawn over. - const kMaxOutgoingEdges = 100; - let nofEdges = 0; - let stack = []; - let current = this.selectedEntry; - while (current && nofEdges < kMaxOutgoingEdges) { - nofEdges += current.children.length; - stack.push(current); - current = current.parent(); - } - ctx.save(); - this.drawOutgoingEdges(ctx, this.selectedEntry, 3); - ctx.restore(); - - let labelOffset = 15; - let xPrev = 0; - while (current = stack.pop()) { - if (current.edge) { - this.setEdgeStyle(current.edge, ctx); - let [xTo, yTo] = this.drawEdge(ctx, current.edge, true, labelOffset); - if (xTo == xPrev) { - labelOffset += 8; - } else { - labelOffset = 15 - } - xPrev = xTo; - } - this.markMap(ctx, current); - current = current.parent(); - ctx.save(); - // this.drawOutgoingEdges(ctx, current, 1); - ctx.restore(); - } - // Mark selected map - this.markSelectedMap(ctx, this.selectedEntry); - } - - drawEdge(ctx, edge, showLabel = true, labelOffset = 20) { - if (!edge.from || !edge.to) return [-1, -1]; - let [xFrom, yFrom] = edge.from.position(this.chunks); - let [xTo, yTo] = edge.to.position(this.chunks); - let sameChunk = xTo == xFrom; - if (sameChunk) labelOffset += 8; - - ctx.beginPath(); - ctx.moveTo(xFrom, yFrom); - let offsetX = 20; - let offsetY = 20; - let midX = xFrom + (xTo - xFrom) / 2; - let midY = (yFrom + yTo) / 2 - 100; - if (!sameChunk) { - ctx.quadraticCurveTo(midX, midY, xTo, yTo); - } else { - ctx.lineTo(xTo, yTo); - } - if (!showLabel) { - ctx.stroke(); - } else { - let centerX, centerY; - if (!sameChunk) { - centerX = (xFrom / 2 + midX + xTo / 2) / 2; - centerY = (yFrom / 2 + midY + yTo / 2) / 2; - } else { - centerX = xTo; - centerY = yTo; - } - ctx.moveTo(centerX, centerY); - ctx.lineTo(centerX + offsetX, centerY - labelOffset); - ctx.stroke(); - ctx.textAlign = 'left'; - ctx.fillStyle = this._legend.colorForType(edge.type); - ctx.fillText( - edge.toString(), centerX + offsetX + 2, centerY - labelOffset); - } - return [xTo, yTo]; - } - - drawOutgoingEdges(ctx, map, max = 10, depth = 0) { - if (!map) return; - if (depth >= max) return; - ctx.globalAlpha = 0.5 - depth * (0.3 / max); - ctx.strokeStyle = CSSColor.timelineBackgroundColor; - const limit = Math.min(map.children.length, 100) - for (let i = 0; i < limit; i++) { - let edge = map.children[i]; - this.drawEdge(ctx, edge, true); - this.drawOutgoingEdges(ctx, edge.to, max, depth + 1); - } - } -}); - -class SelectionHandler { - // TODO turn into static field once Safari supports it. - static get SELECTION_OFFSET() { - return 10 - }; - - _timeSelection = {start: -1, end: Infinity}; - _selectionOriginTime = -1; - - constructor(timeline) { - this._timeline = timeline; - this._timelineNode.addEventListener( - 'mousedown', e => this._handleTimeSelectionMouseDown(e)); - this._timelineNode.addEventListener( - 'mouseup', e => this._handleTimeSelectionMouseUp(e)); - this._timelineNode.addEventListener( - 'mousemove', e => this._handleTimeSelectionMouseMove(e)); - } - - update() { - if (!this.hasSelection) { - this._selectionNode.style.display = 'none'; - return; - } - this._selectionNode.style.display = 'inherit'; - const startPosition = this.timeToPosition(this._timeSelection.start); - const endPosition = this.timeToPosition(this._timeSelection.end); - this._leftHandleNode.style.left = startPosition + 'px'; - this._rightHandleNode.style.left = endPosition + 'px'; - const delta = endPosition - startPosition; - const selectionNode = this._selectionBackgroundNode; - selectionNode.style.left = startPosition + 'px'; - selectionNode.style.width = delta + 'px'; - } - - set timeSelection(selection) { - this._timeSelection.start = selection.start; - this._timeSelection.end = selection.end; - } - - clearSelection() { - this._timeline.dispatchEvent(new SelectTimeEvent()); - } - - timeToPosition(posX) { - return this._timeline.timeToPosition(posX); - } - - positionToTime(posX) { - return this._timeline.positionToTime(posX); - } - - get isSelecting() { - return this._selectionOriginTime >= 0; - } - - get hasSelection() { - return this._timeSelection.start >= 0 && - this._timeSelection.end != Infinity; - } - - get _timelineNode() { - return this._timeline.$('#timeline'); - } - - get _selectionNode() { - return this._timeline.$('#selection'); - } - - get _selectionBackgroundNode() { - return this._timeline.$('#selectionBackground'); - } - - get _leftHandleNode() { - return this._timeline.$('#leftHandle'); - } - - get _rightHandleNode() { - return this._timeline.$('#rightHandle'); - } - - get _leftHandlePosX() { - return this._leftHandleNode.getBoundingClientRect().x; - } - - get _rightHandlePosX() { - return this._rightHandleNode.getBoundingClientRect().x; - } - - _isOnLeftHandle(posX) { - return Math.abs(this._leftHandlePosX - posX) <= - SelectionHandler.SELECTION_OFFSET; - } - - _isOnRightHandle(posX) { - return Math.abs(this._rightHandlePosX - posX) <= - SelectionHandler.SELECTION_OFFSET; - } - - _handleTimeSelectionMouseDown(e) { - let xPosition = e.clientX - // Update origin time in case we click on a handle. - if (this._isOnLeftHandle(xPosition)) { - xPosition = this._rightHandlePosX; - } - else if (this._isOnRightHandle(xPosition)) { - xPosition = this._leftHandlePosX; - } - this._selectionOriginTime = this.positionToTime(xPosition); - } - - _handleTimeSelectionMouseMove(e) { - if (!this.isSelecting) return; - const currentTime = this.positionToTime(e.clientX); - this._timeline.dispatchEvent(new SynchronizeSelectionEvent( - Math.min(this._selectionOriginTime, currentTime), - Math.max(this._selectionOriginTime, currentTime))); - } - - _handleTimeSelectionMouseUp(e) { - this._selectionOriginTime = -1; - const delta = this._timeSelection.end - this._timeSelection.start; - if (delta <= 1 || isNaN(delta)) return; - this._timeline.dispatchEvent(new SelectTimeEvent( - this._timeSelection.start, this._timeSelection.end)); - } -} - -class Legend { - _timeline; - _typesFilters = new Map(); - _typeClickHandler = this._handleTypeClick.bind(this); - _filterPredicate = this.filter.bind(this); - onFilter = () => {}; - - constructor(table) { - this._table = table; - } - - set timeline(timeline) { - this._timeline = timeline; - const groups = timeline.getBreakdown(); - this._typesFilters = new Map(groups.map(each => [each.key, true])); - this._colors = - new Map(groups.map(each => [each.key, CSSColor.at(each.id)])); - } - - get selection() { - return this._timeline.selectionOrSelf; - } - - get filterPredicate() { - for (let visible of this._typesFilters.values()) { - if (!visible) return this._filterPredicate; - } - return undefined; - } - - colorForType(type) { - return this._colors.get(type); - } - - filter(logEntry) { - return this._typesFilters.get(logEntry.type); - } - - update() { - const tbody = DOM.tbody(); - const missingTypes = new Set(this._typesFilters.keys()); - this.selection.getBreakdown().forEach(group => { - tbody.appendChild(this._addTypeRow(group)); - missingTypes.delete(group.key); - }); - missingTypes.forEach(key => tbody.appendChild(this._row('', key, 0, '0%'))); - if (this._timeline.selection) { - tbody.appendChild( - this._row('', 'Selection', this.selection.length, '100%')); - } - tbody.appendChild(this._row('', 'All', this._timeline.length, '')); - this._table.tBodies[0].replaceWith(tbody); - } - - _row(color, type, count, percent) { - const row = DOM.tr(); - row.appendChild(DOM.td(color)); - row.appendChild(DOM.td(type)); - row.appendChild(DOM.td(count.toString())); - row.appendChild(DOM.td(percent)); - return row - } - - _addTypeRow(group) { - const color = this.colorForType(group.key); - const colorDiv = DOM.div('colorbox'); - if (this._typesFilters.get(group.key)) { - colorDiv.style.backgroundColor = color; - } else { - colorDiv.style.borderColor = color; - colorDiv.style.backgroundColor = CSSColor.backgroundImage; - } - let percent = `${(group.count / this.selection.length * 100).toFixed(1)}%`; - const row = this._row(colorDiv, group.key, group.count, percent); - row.className = 'clickable'; - row.onclick = this._typeClickHandler; - row.data = group.key; - return row; - } - - _handleTypeClick(e) { - const type = e.currentTarget.data; - this._typesFilters.set(type, !this._typesFilters.get(type)); - this.onFilter(type); - } -} \ No newline at end of file + }) \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/tool-tip-template.html b/deps/v8/tools/system-analyzer/view/tool-tip-template.html index dc56997825f6de..78fcca920a3cb7 100644 --- a/deps/v8/tools/system-analyzer/view/tool-tip-template.html +++ b/deps/v8/tools/system-analyzer/view/tool-tip-template.html @@ -11,14 +11,21 @@ } #content { - background-color: var(--surface-color); + background-color: rgba(var(--surface-color-rgb), 0.8); border: 3px var(--primary-color) solid; border-radius: 10px; + padding: 10px; + width: auto; min-width: 100px; + max-width: 400px; min-height: 100px; - padding: 10px; + max-height: 400px; + overflow: auto; box-shadow: 0px 0px 10px rgba(0,0,0,0.5); - width: auto; + } + + #content > h3 { + margin-top: 0; } .textContent { @@ -32,9 +39,10 @@ #body { display: none; position: absolute; + z-index: 99999; --tip-offset: 10px; --tip-width: 10px; - --tip-height: 15px; + --tip-height: 40px; } #body.top { @@ -50,33 +58,56 @@ left: calc(var(--tip-offset) * -1 - var(--tip-width)); } - .tip { + .tip, .tipThin { width: 0; height: 0; border-style: solid; position: absolute; - border-width: var(--tip-height) var(--tip-width) 0 var(--tip-width); border-color: var(--primary-color) transparent transparent transparent; pointer-events: none; } - + .tip { + border-width: var(--tip-width) var(--tip-width) 0 var(--tip-width); + } + .tipThin { + border-width: var(--tip-height) 4px 2px 4px; + bottom: -30px; + left: -4px; + } + /* Tip positioning modifiers */ .top > .tip { + bottom: calc(var(--tip-width) * -1); + } + .top > .tipThin { bottom: calc(var(--tip-height) * -1); } .bottom > .tip { + top: calc(var(--tip-width) * -1); + transform: scaleY(-1); + } + .bottom > .tipThin { top: calc(var(--tip-height) * -1); transform: scaleY(-1); } .left > .tip { right: var(--tip-offset); } + .left > .tipThin { + right: var(--tip-offset); + } .right > .tip { left: var(--tip-offset); } + .right > .tipThin { + left: var(--tip-offset); + }
+ +
+
+
-
diff --git a/deps/v8/tools/system-analyzer/view/tool-tip.mjs b/deps/v8/tools/system-analyzer/view/tool-tip.mjs index a01ee1bdbf6d38..5be98ae2147a84 100644 --- a/deps/v8/tools/system-analyzer/view/tool-tip.mjs +++ b/deps/v8/tools/system-analyzer/view/tool-tip.mjs @@ -9,6 +9,7 @@ DOM.defineCustomElement( _targetNode; _content; _isHidden = true; + constructor() { super(templateText); this._intersectionObserver = new IntersectionObserver((entries) => { @@ -19,7 +20,15 @@ DOM.defineCustomElement( this.requestUpdate(true); } }); - document.addEventListener('click', (e) => this.hide()); + document.addEventListener('click', (event) => { + // Only hide the tooltip if we click anywhere outside of it. + let target = event.target; + while (target) { + if (target == this) return; + target = target.parentNode; + } + this.hide() + }); } _update() { @@ -28,9 +37,7 @@ DOM.defineCustomElement( rect.x += rect.width / 2; let atRight = this._useRight(rect.x); let atBottom = this._useBottom(rect.y); - if (atBottom) { - rect.y += rect.height; - } + if (atBottom) rect.y += rect.height; this._setPosition(rect, atRight, atBottom); this.requestUpdate(true); } @@ -46,10 +53,11 @@ DOM.defineCustomElement( set targetNode(targetNode) { this._intersectionObserver.disconnect(); this._targetNode = targetNode; - if (targetNode) { + if (targetNode === undefined) return; + if (!(targetNode instanceof SVGElement)) { this._intersectionObserver.observe(targetNode); - this.requestUpdate(true); } + this.requestUpdate(true); } set position(position) { @@ -82,14 +90,27 @@ DOM.defineCustomElement( if (typeof content === 'string') { this.contentNode.innerHTML = content; this.contentNode.className = 'textContent'; + } else if (content?.nodeType && content?.nodeName) { + this._setContentNode(content); } else { - const newContent = DOM.div(); - newContent.appendChild(content); - this.contentNode.replaceWith(newContent); - newContent.id = 'content'; + if (this.contentNode.firstChild?.localName == 'property-link-table') { + this.contentNode.firstChild.propertyDict = content; + } else { + const node = DOM.element('property-link-table'); + node.instanceLinkButtons = true; + node.propertyDict = content; + this._setContentNode(node); + } } } + _setContentNode(content) { + const newContent = DOM.div(); + newContent.appendChild(content); + this.contentNode.replaceWith(newContent); + newContent.id = 'content'; + } + hide() { this._isHidden = true; this.bodyNode.style.display = 'none'; diff --git a/deps/v8/tools/testrunner/base_runner.py b/deps/v8/tools/testrunner/base_runner.py index 739a109a0c5346..cf5854c32ca3de 100644 --- a/deps/v8/tools/testrunner/base_runner.py +++ b/deps/v8/tools/testrunner/base_runner.py @@ -284,6 +284,11 @@ def execute(self, sys_args=None): # this less cryptic by printing it ourselves. print(' '.join(sys.argv)) + # TODO(machenbach): Print used Python version until we have switched to + # Python3 everywhere. + print('Running with:') + print(sys.version) + # Kill stray processes from previous tasks on swarming. util.kill_processes_linux() @@ -661,6 +666,12 @@ def _get_statusfile_variables(self, options): self.build_config.arch == 'mipsel': no_simd_hardware = not simd_mips + # S390 hosts without VEF1 do not support Simd. + if self.build_config.arch == 's390x' and \ + not self.build_config.simulator_run and \ + not utils.IsS390SimdSupported(): + no_simd_hardware = True + # Ppc64 processors earlier than POWER9 do not support Simd instructions if self.build_config.arch == 'ppc64' and \ not self.build_config.simulator_run and \ @@ -738,7 +749,7 @@ def _timeout_scalefactor(self, options): if self.build_config.predictable: factor *= 4 if self.build_config.tsan: - factor *= 1.5 + factor *= 2 if self.build_config.use_sanitizer: factor *= 1.5 if self.build_config.is_full_debug: diff --git a/deps/v8/tools/testrunner/local/statusfile.py b/deps/v8/tools/testrunner/local/statusfile.py index b6f97cd5641935..48b92869599a5e 100644 --- a/deps/v8/tools/testrunner/local/statusfile.py +++ b/deps/v8/tools/testrunner/local/statusfile.py @@ -46,6 +46,7 @@ FAIL_SLOPPY = "FAIL_SLOPPY" # Modifiers +HEAVY = "HEAVY" SKIP = "SKIP" SLOW = "SLOW" NO_VARIANTS = "NO_VARIANTS" @@ -54,8 +55,8 @@ ALWAYS = "ALWAYS" KEYWORDS = {} -for key in [SKIP, FAIL, PASS, CRASH, SLOW, FAIL_OK, NO_VARIANTS, FAIL_SLOPPY, - ALWAYS, FAIL_PHASE_ONLY]: +for key in [SKIP, FAIL, PASS, CRASH, HEAVY, SLOW, FAIL_OK, NO_VARIANTS, + FAIL_SLOPPY, ALWAYS, FAIL_PHASE_ONLY]: KEYWORDS[key] = key # Support arches, modes to be written as keywords instead of strings. diff --git a/deps/v8/tools/testrunner/local/utils.py b/deps/v8/tools/testrunner/local/utils.py index 94429a9fde9e45..05d1ef7d5e94f6 100644 --- a/deps/v8/tools/testrunner/local/utils.py +++ b/deps/v8/tools/testrunner/local/utils.py @@ -97,6 +97,18 @@ def GuessOS(): return None +# Check if Vector Enhancement Facility 1 is available on the +# host S390 machine. This facility is required for supporting Simd on V8. +def IsS390SimdSupported(): + import subprocess + cpuinfo = subprocess.check_output("cat /proc/cpuinfo", shell=True) + cpuinfo_list = cpuinfo.strip().decode("utf-8").splitlines() + facilities = "".join(x for x in cpuinfo_list if x.startswith("facilities")) + facilities_list = facilities.split(" ") + # Having bit 135 set indicates VEF1 is available. + return "135" in facilities_list + + # Returns power processor version, taking compatibility mode into account. # (Power9 running in Power8 compatibility mode returns 8) # Only useful if arch is ppc64 diff --git a/deps/v8/tools/testrunner/local/variants.py b/deps/v8/tools/testrunner/local/variants.py index e214de05404d74..1d39f6951ddfd5 100644 --- a/deps/v8/tools/testrunner/local/variants.py +++ b/deps/v8/tools/testrunner/local/variants.py @@ -16,7 +16,7 @@ "concurrent_inlining": [["--concurrent-inlining"]], "jitless": [["--jitless"]], "sparkplug": [["--sparkplug"]], - "always_sparkplug": [[ "--always-sparkplug" ]], + "always_sparkplug": [[ "--always-sparkplug", "--sparkplug"]], "minor_mc": [["--minor-mc"]], "no_lfa": [["--no-lazy-feedback-allocation"]], # No optimization means disable all optimizations. OptimizeFunctionOnNextCall @@ -30,7 +30,8 @@ "stress": [["--stress-opt", "--no-liftoff", "--stress-lazy-source-positions", "--no-wasm-generic-wrapper"]], "stress_concurrent_allocation": [["--stress-concurrent-allocation"]], - "stress_concurrent_inlining": [["--stress-concurrent-inlining"]], + "stress_concurrent_inlining": [["--stress-concurrent-inlining", + "--concurrent-inlining"]], "stress_js_bg_compile_wasm_code_gc": [["--stress-background-compile", "--stress-wasm-code-gc"]], "stress_incremental_marking": [["--stress-incremental-marking"]], @@ -40,7 +41,7 @@ "trusted": [["--no-untrusted-code-mitigations"]], "no_wasm_traps": [["--no-wasm-trap-handler"]], "turboprop": [["--turboprop"]], - "turboprop_as_toptier": [["--turboprop-as-toptier"]], + "turboprop_as_toptier": [["--turboprop-as-toptier", "--turboprop"]], "instruction_scheduling": [["--turbo-instruction-scheduling"]], "stress_instruction_scheduling": [["--turbo-stress-instruction-scheduling"]], "top_level_await": [["--harmony-top-level-await"]], @@ -51,33 +52,26 @@ # variant. This depends on the flags specified in ALL_VARIANT_FLAGS and on the # implications defined in flag-definitions.h. INCOMPATIBLE_FLAGS_PER_VARIANT = { - "assert_types": ["--no-assert-types"], "jitless": ["--opt", "--always-opt", "--liftoff", "--track-field-types", "--validate-asm", "--sparkplug", "--always-sparkplug"], - "no_wasm_traps": ["--wasm-trap-handler"], - "nooptimization": ["--opt", "--always-opt", "--no-liftoff", - "--wasm-tier-up"], + "nooptimization": ["--always-opt"], "slow_path": ["--no-force-slow-path"], "stress_concurrent_allocation": ["--single-threaded-gc", "--predictable"], - "stress_concurrent_inlining": ["--single-threaded", "--predictable", - "--no-concurrent-inlining"], - "concurrent_inlining": ["--no-concurrent-inlining"], - "stress_incremental_marking": ["--no-stress-incremental-marking"], - "stress_js_bg_compile_wasm_code_gc": ["--no-stress-background-compile"], - "stress": ["--no-stress-opt", "--always-opt", "--no-always-opt", "--liftoff", + "stress_concurrent_inlining": ["--single-threaded", "--predictable"], + # The fast API tests initialize an embedder object that never needs to be + # serialized to the snapshot, so we don't have a + # SerializeInternalFieldsCallback for it, so they are incompatible with + # stress_snapshot. + "stress_snapshot": [["--turbo-fast-api-calls"]], + "stress": ["--always-opt", "--no-always-opt", "--max-inlined-bytecode-size=*", "--max-inlined-bytecode-size-cumulative=*", "--stress-inline", - "--wasm-generic-wrapper"], - "sparkplug": ["--jitless", "--no-sparkplug" ], - "always_sparkplug": ["--jitless", "--no-sparkplug", "--no-always-sparkplug"], - "turboprop": ["--interrupt-budget=*", "--no-turboprop"], - "turboprop_as_toptier": ["--interrupt-budget=*", "--no-turboprop", - "--no-turboprop-as-toptier"], + "--liftoff-only"], + "sparkplug": ["--jitless"], + "always_sparkplug": ["--jitless"], "code_serializer": ["--cache=after-execute", "--cache=full-code-cache", "--cache=none"], - "no_local_heaps": ["--concurrent-inlining", "--turboprop"], - "experimental_regexp": ["--no-enable-experimental-regexp-engine", - "--no-default-to-experimental-regexp-engine"], + "experimental_regexp": ["--no-enable-experimental-regexp-engine"], # There is a negative implication: --perf-prof disables # --wasm-write-protect-code-memory. "wasm_write_protect_code": ["--perf-prof"], @@ -89,12 +83,13 @@ # The conflicts might be directly contradictory flags or be caused by the # implications defined in flag-definitions.h. INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE = { - "lite_mode": ["--no-lazy-feedback-allocation", "--max-semi-space-size=*"] + "lite_mode": ["--no-lazy-feedback-allocation", "--max-semi-space-size=*", + "--stress-concurrent-inlining"] + INCOMPATIBLE_FLAGS_PER_VARIANT["jitless"], - "predictable": ["--liftoff", "--parallel-compile-tasks", + "predictable": ["--parallel-compile-tasks", "--concurrent-recompilation", - "--wasm-num-compilation-tasks=*", - "--stress-concurrent-allocation"], + "--stress-concurrent-allocation", + "--stress-concurrent-inlining"], } # Flags that lead to a contradiction when a certain extra-flag is present. @@ -103,20 +98,13 @@ # The conflicts might be directly contradictory flags or be caused by the # implications defined in flag-definitions.h. INCOMPATIBLE_FLAGS_PER_EXTRA_FLAG = { - "--concurrent-inlining": - INCOMPATIBLE_FLAGS_PER_VARIANT["concurrent_inlining"], - "--concurrent-recompilation": ["--no-concurrent-recompilation", "--predictable"], - "--enable-armv8": ["--no-enable-armv8"], + "--concurrent-recompilation": ["--predictable"], "--gc-interval=*": ["--gc-interval=*"], - "--no-enable-sse3": ["--enable-sse3"], - "--no-enable-ssse3": ["--enable-ssse3"], - "--no-enable-sse4-1": ["--enable-sse4-1"], "--optimize-for-size": ["--max-semi-space-size=*"], - "--stress_concurrent_allocation": ["--single-threaded-gc", "--predictable"], + "--stress_concurrent_allocation": + INCOMPATIBLE_FLAGS_PER_VARIANT["stress_concurrent_allocation"], "--stress-concurrent-inlining": INCOMPATIBLE_FLAGS_PER_VARIANT["stress_concurrent_inlining"], - "--stress-flush-bytecode": ["--no-stress-flush-bytecode"], - "--stress-incremental-marking": INCOMPATIBLE_FLAGS_PER_VARIANT["stress_incremental_marking"], } SLOW_VARIANTS = set([ diff --git a/deps/v8/tools/testrunner/objects/testcase.py b/deps/v8/tools/testrunner/objects/testcase.py index e037f996797256..a1f1754b22a47c 100644 --- a/deps/v8/tools/testrunner/objects/testcase.py +++ b/deps/v8/tools/testrunner/objects/testcase.py @@ -34,6 +34,7 @@ from ..local import command from ..local import statusfile from ..local import utils +from ..local.variants import ALL_VARIANT_FLAGS from ..local.variants import INCOMPATIBLE_FLAGS_PER_VARIANT from ..local.variants import INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE from ..local.variants import INCOMPATIBLE_FLAGS_PER_EXTRA_FLAG @@ -46,8 +47,9 @@ RESOURCES_PATTERN = re.compile(r"//\s+Resources:(.*)") # Pattern to auto-detect files to push on Android for statements like: # load("path/to/file.js") +# d8.file.execute("path/to/file.js") LOAD_PATTERN = re.compile( - r"(?:load|readbuffer|read)\((?:'|\")([^'\"]+)(?:'|\")\)") + r"(?:execute|load|readbuffer|read)\((?:'|\")([^'\"]+)(?:'|\")\)") # Pattern to auto-detect files to push on Android for statements like: # import foobar from "path/to/file.js" # import {foo, bar} from "path/to/file.js" @@ -166,9 +168,30 @@ def allow_timeouts(self): @property def expected_outcomes(self): + def is_flag(maybe_flag): + return maybe_flag.startswith("--") # Best-effort heuristic. + + # Filter to flags, e.g.: ["--foo", "3", "--bar"] -> ["--foo", "--bar"]. + def filter_flags(normalized_flags): + return [f for f in normalized_flags if is_flag(f)]; + def normalize_flag(flag): return flag.replace("_", "-").replace("--no-", "--no") + def normalize_flags(flags): + return [normalize_flag(flag) for flag in filter_flags(flags)] + + # Note this can get it wrong if the flag name starts with the characters + # "--no" where "no" is part of the flag name, e.g. "--nobodys-perfect". + # In that case the negation "--bodys-perfect" would be returned. This is + # a weakness we accept and hope to never run into. + def negate_flag(normalized_flag): + return ("--" + normalized_flag[4:] if normalized_flag.startswith("--no") + else "--no" + normalized_flag[2:]) + + def negate_flags(normalized_flags): + return [negate_flag(flag) for flag in normalized_flags] + def has_flag(conflicting_flag, flags): conflicting_flag = normalize_flag(conflicting_flag) if conflicting_flag in flags: @@ -191,18 +214,31 @@ def check_flags(incompatible_flags, actual_flags, rule): file_specific_flags = (self._get_source_flags() + self._get_suite_flags() + self._get_statusfile_flags()) - file_specific_flags = [normalize_flag(flag) for flag in file_specific_flags] - extra_flags = [normalize_flag(flag) for flag in self._get_extra_flags()] - + file_specific_flags = normalize_flags(file_specific_flags) + extra_flags = normalize_flags(self._get_extra_flags()) + + # Contradiction: flags contains both a flag --foo and its negation + # --no-foo. + if self.variant in ALL_VARIANT_FLAGS: + for flags in ALL_VARIANT_FLAGS[self.variant]: + all_flags = (file_specific_flags + extra_flags + + normalize_flags(flags)) + check_flags(negate_flags(all_flags), all_flags, "Flag negations") + + # Contradiction: flags specified through the "Flags:" annotation are + # incompatible with the variant. if self.variant in INCOMPATIBLE_FLAGS_PER_VARIANT: check_flags(INCOMPATIBLE_FLAGS_PER_VARIANT[self.variant], file_specific_flags, "INCOMPATIBLE_FLAGS_PER_VARIANT[\""+self.variant+"\"]") + # Contradiction: flags specified through the "Flags:" annotation are + # incompatible with the build. for variable, incompatible_flags in INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE.items(): if self.suite.statusfile.variables[variable]: check_flags(incompatible_flags, file_specific_flags, "INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE[\""+variable+"\"]") + # Contradiction: flags passed through --extra-flags are incompatible. for extra_flag, incompatible_flags in INCOMPATIBLE_FLAGS_PER_EXTRA_FLAG.items(): if has_flag(extra_flag, extra_flags): check_flags(incompatible_flags, file_specific_flags, @@ -214,9 +250,13 @@ def do_skip(self): return (statusfile.SKIP in self._statusfile_outcomes and not self.suite.test_config.run_skipped) + @property + def is_heavy(self): + return statusfile.HEAVY in self._statusfile_outcomes + @property def is_slow(self): - return statusfile.SLOW in self._statusfile_outcomes + return self.is_heavy or statusfile.SLOW in self._statusfile_outcomes @property def is_fail_ok(self): diff --git a/deps/v8/tools/testrunner/standard_runner.py b/deps/v8/tools/testrunner/standard_runner.py index 94c25766824b79..5b901b8a530cfb 100755 --- a/deps/v8/tools/testrunner/standard_runner.py +++ b/deps/v8/tools/testrunner/standard_runner.py @@ -25,6 +25,7 @@ from testrunner.testproc.filter import StatusFileFilterProc, NameFilterProc from testrunner.testproc.loader import LoadProc from testrunner.testproc.seed import SeedProc +from testrunner.testproc.sequence import SequenceProc from testrunner.testproc.variant import VariantProc @@ -122,6 +123,8 @@ def _add_parser_options(self, parser): 'generation.') # Extra features. + parser.add_option('--max-heavy-tests', default=1, type='int', + help='Maximum number of heavy tests run in parallel') parser.add_option('--time', help='Print timing information after running', default=False, action='store_true') @@ -282,6 +285,10 @@ def _get_statusfile_variables(self, options): }) return variables + def _create_sequence_proc(self, options): + """Create processor for sequencing heavy tests on swarming.""" + return SequenceProc(options.max_heavy_tests) if options.swarming else None + def _do_execute(self, tests, args, options): jobs = options.j @@ -306,6 +313,7 @@ def _do_execute(self, tests, args, options): self._create_predictable_filter(), self._create_shard_proc(options), self._create_seed_proc(options), + self._create_sequence_proc(options), sigproc, ] + indicators + [ results, diff --git a/deps/v8/tools/testrunner/testproc/progress.py b/deps/v8/tools/testrunner/testproc/progress.py index 634ef7c2f2e3c0..ec97ab226f9d19 100644 --- a/deps/v8/tools/testrunner/testproc/progress.py +++ b/deps/v8/tools/testrunner/testproc/progress.py @@ -18,15 +18,13 @@ from ..local import junit_output -def print_failure_header(test): +def print_failure_header(test, is_flaky=False): + text = [str(test)] if test.output_proc.negative: - negative_marker = '[negative] ' - else: - negative_marker = '' - print("=== %(label)s %(negative)s===" % { - 'label': test, - 'negative': negative_marker, - }) + text.append('[negative]') + if is_flaky: + text.append('(flaky)') + print('=== %s ===' % ' '.join(text)) class ResultsTracker(base.TestProcObserver): @@ -75,13 +73,18 @@ def __init__(self): def _on_result_for(self, test, result): # TODO(majeski): Support for dummy/grouped results if result.has_unexpected_output: - self._failed.append((test, result)) + self._failed.append((test, result, False)) + elif result.is_rerun: + # Print only the first result of a flaky failure that was rerun. + self._failed.append((test, result.results[0], True)) def finished(self): crashed = 0 + flaky = 0 print() - for test, result in self._failed: - print_failure_header(test) + for test, result, is_flaky in self._failed: + flaky += int(is_flaky) + print_failure_header(test, is_flaky=is_flaky) if result.output.stderr: print("--- stderr ---") print(result.output.stderr.strip()) @@ -102,9 +105,11 @@ def finished(self): else: print() print("===") - print("=== %i tests failed" % len(self._failed)) + print("=== %d tests failed" % len(self._failed)) + if flaky > 0: + print("=== %d tests were flaky" % flaky) if crashed > 0: - print("=== %i tests CRASHED" % crashed) + print("=== %d tests CRASHED" % crashed) print("===") @@ -130,6 +135,17 @@ def print(self, prefix, test): print('%s: %ss' % (prefix, test)) sys.stdout.flush() + +def format_result_status(result): + if result.has_unexpected_output: + if result.output.HasCrashed(): + return 'CRASH' + else: + return 'FAIL' + else: + return 'PASS' + + class VerboseProgressIndicator(SimpleProgressIndicator): def __init__(self): super(VerboseProgressIndicator, self).__init__() @@ -142,13 +158,10 @@ def _print(self, text): def _message(self, test, result): # TODO(majeski): Support for dummy/grouped results - if result.has_unexpected_output: - if result.output.HasCrashed(): - outcome = 'CRASH' - else: - outcome = 'FAIL' + if result.is_rerun: + outcome = ' '.join(format_result_status(r) for r in result.results) else: - outcome = 'pass' + outcome = format_result_status(result) return '%s %s: %s' % ( test, test.variant or 'default', outcome) diff --git a/deps/v8/tools/testrunner/testproc/sequence.py b/deps/v8/tools/testrunner/testproc/sequence.py new file mode 100644 index 00000000000000..4509a4abf998ec --- /dev/null +++ b/deps/v8/tools/testrunner/testproc/sequence.py @@ -0,0 +1,59 @@ +# 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. + +from collections import deque + +from . import base + + +class SequenceProc(base.TestProc): + """Processor ensuring heavy tests are sent sequentially into the execution + pipeline. + + The class keeps track of the number of tests in the pipeline marked heavy + and permits only a configurable amount. An excess amount is queued and sent + as soon as other heavy tests return. + """ + def __init__(self, max_heavy): + """Initialize the processor. + + Args: + max_heavy: The maximum number of heavy tests that will be sent further + down the pipeline simultaneously. + """ + super(SequenceProc, self).__init__() + assert max_heavy > 0 + self.max_heavy = max_heavy + self.n_heavy = 0 + self.buffer = deque() + + def next_test(self, test): + if test.is_heavy: + if self.n_heavy < self.max_heavy: + # Enough space to send more heavy tests. Check if the test is not + # filtered otherwise. + used = self._send_test(test) + if used: + self.n_heavy += 1 + return used + else: + # Too many tests in the pipeline. Buffer the test and indicate that + # this test didn't end up in the execution queue (i.e. test loader + # will try to send more tests). + self.buffer.append(test) + return False + else: + return self._send_test(test) + + def result_for(self, test, result): + if test.is_heavy: + # A heavy test finished computing. Try to send one from the buffer. + self.n_heavy -= 1 + while self.buffer: + next_test = self.buffer.popleft() + if self._send_test(next_test): + self.n_heavy += 1 + break + + self._send_result(test, result) diff --git a/deps/v8/tools/testrunner/testproc/sequence_unittest.py b/deps/v8/tools/testrunner/testproc/sequence_unittest.py new file mode 100644 index 00000000000000..8a0edc36bbcb68 --- /dev/null +++ b/deps/v8/tools/testrunner/testproc/sequence_unittest.py @@ -0,0 +1,162 @@ +#!/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. + +""" +Test integrating the sequence processor into a simple test pipeline. +""" + +import os +import sys +import unittest + +# Needed because the test runner contains relative imports. +TOOLS_PATH = os.path.dirname(os.path.dirname(os.path.dirname( + os.path.abspath(__file__)))) +sys.path.append(TOOLS_PATH) + +from testrunner.testproc import base +from testrunner.testproc.loader import LoadProc +from testrunner.testproc.sequence import SequenceProc + + +class FakeExecutionProc(base.TestProc): + """Simulates the pipeline sink consuming and running the tests. + + Test execution is simulated for each test by calling run(). + """ + def __init__(self): + super(FakeExecutionProc, self).__init__() + self.tests = [] + + def next_test(self, test): + self.tests.append(test) + return True + + def run(self): + test = self.tests.pop() + self._send_result(test, test.n) + + +class FakeResultObserver(base.TestProcObserver): + """Observer to track all results sent back through the pipeline.""" + def __init__(self): + super(FakeResultObserver, self).__init__() + self.tests = set([]) + + def _on_result_for(self, test, result): + self.tests.add(test.n) + + +class FakeTest(object): + """Simple test representation to differentiate light/heavy tests.""" + def __init__(self, n, is_heavy): + self.n = n + self.is_heavy = is_heavy + self.keep_output = False + + +class TestSequenceProc(unittest.TestCase): + def _test(self, tests, batch_size, max_heavy): + # Set up a simple processing pipeline: + # Loader -> observe results -> sequencer -> execution. + loader = LoadProc(iter(tests)) + results = FakeResultObserver() + sequence_proc = SequenceProc(max_heavy) + execution = FakeExecutionProc() + loader.connect_to(results) + results.connect_to(sequence_proc) + sequence_proc.connect_to(execution) + + # Fill the execution queue (with the number of tests potentially + # executed in parallel). + loader.load_initial_tests(batch_size) + + # Simulate the execution test by test. + while execution.tests: + # Assert the invariant of maximum heavy tests executed simultaneously. + self.assertLessEqual( + sum(int(test.is_heavy) for test in execution.tests), max_heavy) + + # As in the real pipeline, running a test and returning its result + # will add another test into the pipeline. + execution.run() + + # Ensure that all tests are processed and deliver results. + self.assertEqual(set(test.n for test in tests), results.tests) + + def test_wrong_usage(self): + self.assertRaises(lambda: SequenceProc(0)) + + def test_no_tests(self): + self._test([], 1, 1) + + def test_large_batch_light(self): + self._test([ + FakeTest(0, False), + FakeTest(1, False), + FakeTest(2, False), + ], 4, 1) + + def test_small_batch_light(self): + self._test([ + FakeTest(0, False), + FakeTest(1, False), + FakeTest(2, False), + ], 2, 1) + + def test_large_batch_heavy(self): + self._test([ + FakeTest(0, True), + FakeTest(1, True), + FakeTest(2, True), + ], 4, 1) + + def test_small_batch_heavy(self): + self._test([ + FakeTest(0, True), + FakeTest(1, True), + FakeTest(2, True), + ], 2, 1) + + def test_large_batch_mixed(self): + self._test([ + FakeTest(0, True), + FakeTest(1, False), + FakeTest(2, True), + FakeTest(3, False), + ], 4, 1) + + def test_small_batch_mixed(self): + self._test([ + FakeTest(0, True), + FakeTest(1, False), + FakeTest(2, True), + FakeTest(3, False), + ], 2, 1) + + def test_large_batch_more_heavy(self): + self._test([ + FakeTest(0, True), + FakeTest(1, True), + FakeTest(2, True), + FakeTest(3, False), + FakeTest(4, True), + FakeTest(5, True), + FakeTest(6, False), + ], 4, 2) + + def test_small_batch_more_heavy(self): + self._test([ + FakeTest(0, True), + FakeTest(1, True), + FakeTest(2, True), + FakeTest(3, False), + FakeTest(4, True), + FakeTest(5, True), + FakeTest(6, False), + ], 2, 2) + +if __name__ == '__main__': + unittest.main() diff --git a/deps/v8/tools/testrunner/testproc/variant.py b/deps/v8/tools/testrunner/testproc/variant.py index 0164ad88452b47..be3484fb0fef68 100644 --- a/deps/v8/tools/testrunner/testproc/variant.py +++ b/deps/v8/tools/testrunner/testproc/variant.py @@ -42,8 +42,11 @@ def _next_test(self, test): return self._try_send_new_subtest(test, gen) def _result_for(self, test, subtest, result): - gen = self._next_variant[test.procid] - if not self._try_send_new_subtest(test, gen): + # The generator might have been removed after cycling through all subtests + # below. If some of the subtests are heavy, they get buffered and return + # their results later. + gen = self._next_variant.get(test.procid) + if not gen or not self._try_send_new_subtest(test, gen): self._send_result(test, None) def _try_send_new_subtest(self, test, variants_gen): diff --git a/deps/v8/tools/testrunner/trycatch_loader.js b/deps/v8/tools/testrunner/trycatch_loader.js index 737c8e45dbe202..28e2ba217e628f 100644 --- a/deps/v8/tools/testrunner/trycatch_loader.js +++ b/deps/v8/tools/testrunner/trycatch_loader.js @@ -19,7 +19,7 @@ var tests = arguments.slice(separator + 1) var preambleString = "" for (let jstest of preamble) { - preambleString += "load(\"" + jstest + "\");" + preambleString += "d8.file.execute(\"" + jstest + "\");" } for (let jstest of tests) { @@ -30,7 +30,7 @@ for (let jstest of tests) { (function () { let realm = Realm.create(); try { - Realm.eval(realm, preambleString + "load(\"" + jstest + "\");"); + Realm.eval(realm, preambleString + "d8.file.execute(\"" + jstest + "\");"); } catch (err) { // ignore all errors } diff --git a/deps/v8/tools/tick-processor.html b/deps/v8/tools/tick-processor.html index ecb794ec949c5b..97aaa2df5f5612 100644 --- a/deps/v8/tools/tick-processor.html +++ b/deps/v8/tools/tick-processor.html @@ -44,7 +44,7 @@
Type CountPercent