diff --git a/common.gypi b/common.gypi index 20acf954bc02d4..b1858065820877 100644 --- a/common.gypi +++ b/common.gypi @@ -38,7 +38,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.10', + 'v8_embedder_string': '-node.13', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/.clang-format b/deps/v8/.clang-format index d655b2039f8848..370034d67bba3a 100644 --- a/deps/v8/.clang-format +++ b/deps/v8/.clang-format @@ -14,6 +14,11 @@ Macros: - CASE_=case - FOR_WITH_HANDLE_SCOPE(isolate, init, loop_var, limit_check, increment)=for(init; loop_var; increment) - WHILE_WITH_HANDLE_SCOPE(isolate, limit_check)=while(limit_check) + # Make clang-format parse conditions in flag implications as expressions, not type definitions. + - DEFINE_IMPLICATION(cond,flag,value)=if(cond) { flag; }; + - DEFINE_WEAK_IMPLICATION(cond,flag,value)=if(cond) { flag; }; + - DEFINE_VALUE_IMPLICATION(cond,flag,value)=if(cond) { flag = value; }; + - DEFINE_WEAK_VALUE_IMPLICATION(cond,flag,value)=if(cond) { flag = value; }; StatementMacros: - DECL_CAST - DECL_VERIFIER diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index 867cc3398e49f6..a21eb007b066f7 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -339,6 +339,7 @@ Zhao Jiazhong Zhao Qin Zhaojun Meng Zheng Liu +Zhongqi Wang Zhongping Wang 柳荣一 Yang Xiang diff --git a/deps/v8/BUILD.bazel b/deps/v8/BUILD.bazel index d49da552c42612..b1a54b2b42cc9c 100644 --- a/deps/v8/BUILD.bazel +++ b/deps/v8/BUILD.bazel @@ -512,7 +512,6 @@ v8_config( "GOOGLE3", "V8_ADVANCED_BIGINT_ALGORITHMS", "V8_CONCURRENT_MARKING", - "V8_ENABLE_LEAPTIERING", "V8_ENABLE_SPARKPLUG", "V8_ENABLE_EXTENSIBLE_RO_SNAPSHOT", "V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA", @@ -523,6 +522,18 @@ v8_config( "V8_ENABLE_CHECKS", ], "//conditions:default": [], + }) + select({ + "@v8//bazel/config:asan_enabled" : [ "V8_USE_ADDRESS_SANITIZER" ], + "//conditions:default": [], + }) + select({ + "@v8//bazel/config:hwasan_enabled" : [ "V8_USE_HWADDRESS_SANITIZER" ], + "//conditions:default": [], + }) + select({ + "@v8//bazel/config:msan_enabled" : [ "V8_USE_MEMORY_SANITIZER" ], + "//conditions:default": [], + }) + select({ + "@v8//bazel/config:ubsan_enabled" : [ "V8_USE_UNDEFINED_BEHAVIOR_SANITIZER" ], + "//conditions:default": [], }) + select( { "@v8//bazel/config:v8_target_ia32": ["V8_TARGET_ARCH_IA32"], @@ -797,6 +808,7 @@ filegroup( "src/base/abort-mode.cc", "src/base/abort-mode.h", "src/base/address-region.h", + "src/base/algorithm.h", "src/base/atomic-utils.h", "src/base/atomicops.h", "src/base/base-export.h", @@ -826,6 +838,7 @@ filegroup( "src/base/file-utils.cc", "src/base/file-utils.h", "src/base/flags.h", + "src/base/float16.h", "src/base/fpu.cc", "src/base/fpu.h", "src/base/functional/bind-internal.h", @@ -843,6 +856,7 @@ filegroup( "src/base/logging.cc", "src/base/logging.h", "src/base/macros.h", + "src/base/memcopy.h", "src/base/memory.h", "src/base/numbers/bignum.cc", "src/base/numbers/bignum.h", @@ -2203,6 +2217,8 @@ filegroup( "src/objects/hole.h", "src/objects/trusted-object.h", "src/objects/trusted-object-inl.h", + "src/objects/trusted-pointer.h", + "src/objects/trusted-pointer-inl.h", "src/objects/option-utils.cc", "src/objects/option-utils.h", "src/objects/ordered-hash-table.cc", @@ -2463,6 +2479,8 @@ filegroup( "src/runtime/runtime-weak-refs.cc", "src/sandbox/bounded-size.h", "src/sandbox/bounded-size-inl.h", + "src/sandbox/bytecode-verifier.h", + "src/sandbox/bytecode-verifier.cc", "src/sandbox/check.h", "src/sandbox/external-pointer.h", "src/sandbox/external-pointer-inl.h", @@ -2583,6 +2601,7 @@ filegroup( "src/tasks/task-utils.cc", "src/tasks/task-utils.h", "src/torque/runtime-macro-shims.h", + "src/tracing/perfetto-sdk.h", "src/tracing/trace-event.cc", "src/tracing/trace-event.h", "src/tracing/trace-event-no-perfetto.h", @@ -2606,7 +2625,6 @@ filegroup( "src/utils/identity-map.h", "src/utils/locked-queue.h", "src/utils/locked-queue-inl.h", - "src/utils/memcopy.cc", "src/utils/memcopy.h", "src/utils/output-stream.cc", "src/utils/output-stream.h", @@ -2923,7 +2941,9 @@ filegroup( "src/maglev/maglev-pipeline-statistics.h", "src/maglev/maglev-post-hoc-optimizations-processors.h", "src/maglev/maglev-pre-regalloc-codegen-processors.h", + "src/maglev/maglev-range.h", "src/maglev/maglev-range-analysis.h", + "src/maglev/maglev-range-verification.h", "src/maglev/maglev-reducer-inl.h", "src/maglev/maglev-reducer.h", "src/maglev/maglev-regalloc-data.h", @@ -2950,6 +2970,7 @@ filegroup( "src/maglev/maglev-phi-representation-selector.cc", "src/maglev/maglev-truncation.cc", "src/maglev/maglev-pipeline-statistics.cc", + "src/maglev/maglev-range-verification.cc", "src/maglev/maglev-regalloc.cc", "src/maglev/maglev.cc", ], @@ -3025,12 +3046,13 @@ filegroup( "src/wasm/code-space-access.h", "src/wasm/compilation-environment.h", "src/wasm/compilation-environment-inl.h", + "src/wasm/compilation-hints-generation.cc", + "src/wasm/compilation-hints-generation.h", "src/wasm/constant-expression.cc", "src/wasm/constant-expression.h", "src/wasm/constant-expression-interface.cc", "src/wasm/constant-expression-interface.h", "src/wasm/decoder.h", - "src/wasm/float16.h", "src/wasm/function-body-decoder.cc", "src/wasm/function-body-decoder.h", "src/wasm/function-body-decoder-impl.h", @@ -3247,8 +3269,8 @@ filegroup( "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/basic-block-call-graph-profiler.cc", + "src/compiler/basic-block-call-graph-profiler.h", "src/compiler/branch-elimination.cc", "src/compiler/branch-elimination.h", "src/compiler/bytecode-analysis.cc", @@ -3502,6 +3524,7 @@ filegroup( "src/compiler/turboshaft/late-load-elimination-reducer.h", "src/compiler/turboshaft/layered-hash-map.h", "src/compiler/turboshaft/load-store-simplification-reducer.h", + "src/compiler/turboshaft/load-store-verification-reducer.h", "src/compiler/turboshaft/loop-finder.cc", "src/compiler/turboshaft/loop-finder.h", "src/compiler/turboshaft/loop-peeling-phase.cc", @@ -3737,7 +3760,10 @@ filegroup( "src/maglev/maglev-ir.h", "src/maglev/maglev-ir-inl.h", "src/maglev/maglev-kna-processor.h", + "src/maglev/maglev-range.h", "src/maglev/maglev-range-analysis.h", + "src/maglev/maglev-range-verification.cc", + "src/maglev/maglev-range-verification.h", "src/maglev/maglev-reducer-inl.h", "src/maglev/maglev-reducer.h", "src/maglev/maglev-register-frame-array.h", diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index 3a51ee81fadd13..1bb7fc93c10480 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -457,7 +457,8 @@ declare_args() { v8_enable_experimental_tsa_builtins = false # Use the encoding of undefined in double values. - v8_enable_undefined_double = false + # Only enabled for fuzzing in V8 Fuzzilli builds + v8_enable_undefined_double = v8_fuzzilli v8_dcheck_always_on = dcheck_always_on @@ -489,6 +490,12 @@ declare_args() { # Use a hard-coded secret value when hashing. v8_use_default_hasher_secret = true + + # add instrumentation for Dumpling differential fuzzing + v8_dumpling = false + + # Enable compilation of riscv32. + v8_riscv_enable_deprecated_riscv32 = false } # Derived defaults. @@ -598,7 +605,7 @@ if (v8_enable_external_code_space == "") { v8_enable_pointer_compression && v8_enable_pointer_compression_shared_cage && (v8_current_cpu == "x64" || v8_current_cpu == "arm64" || - v8_current_cpu == "loong64") + v8_current_cpu == "loong64" || v8_current_cpu == "riscv64") } if (v8_enable_sparkplug == "") { v8_enable_sparkplug = !v8_jitless @@ -978,6 +985,8 @@ external_v8_defines = [ "V8_DEPRECATION_WARNINGS", "V8_IMMINENT_DEPRECATION_WARNINGS", "V8_USE_PERFETTO", + "V8_USE_PERFETTO_JSON_EXPORT", + "V8_USE_PERFETTO_SDK", "V8_MAP_PACKING", "V8_IS_TSAN", "V8_ENABLE_DIRECT_HANDLE", @@ -1026,6 +1035,12 @@ if (v8_imminent_deprecation_warnings) { if (v8_use_perfetto) { enabled_external_v8_defines += [ "V8_USE_PERFETTO" ] } +if (v8_use_perfetto_json_export) { + enabled_external_v8_defines += [ "V8_USE_PERFETTO_JSON_EXPORT" ] +} +if (v8_use_perfetto_sdk) { + enabled_external_v8_defines += [ "V8_USE_PERFETTO_SDK" ] +} if (v8_enable_map_packing) { enabled_external_v8_defines += [ "V8_MAP_PACKING" ] } @@ -1176,8 +1191,7 @@ config("features") { if (v8_enable_pointer_compression) { if (v8_enable_pointer_compression_shared_cage) { defines += [ - # TODO(442942399): Re-enable after bug has been addressed. - # "V8_CONTIGUOUS_COMPRESSED_RO_SPACE", + "V8_CONTIGUOUS_COMPRESSED_RO_SPACE", "V8_CONTIGUOUS_COMPRESSED_RO_SPACE_SIZE_MB=${v8_contiguous_compressed_ro_space_size_mb}", ] } else { @@ -1326,6 +1340,12 @@ config("features") { if (v8_fuzzilli) { defines += [ "V8_FUZZILLI" ] } + if (v8_dumpling) { + defines += [ "V8_DUMPLING" ] + } + if (v8_riscv_enable_deprecated_riscv32) { + defines += [ "V8_RISCV_ENABLE_DEPRECATED_RISCV32" ] + } if (v8_enable_fuzztest) { defines += [ "V8_ENABLE_FUZZTEST" ] } @@ -1459,7 +1479,6 @@ config("features") { if (v8_enable_undefined_double) { defines += [ "V8_ENABLE_UNDEFINED_DOUBLE" ] } - defines += [ "V8_ENABLE_LEAPTIERING" ] if (v8_enable_partition_alloc) { defines += [ "V8_ENABLE_PARTITION_ALLOC" ] } @@ -1589,10 +1608,9 @@ config("toolchain") { } } - # Under simulator build, compiler will not provide __riscv_xlen. Define here if (v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") { if (v8_target_is_simulator) { - defines += [ "_RISCV_TARGET_SIMULATOR" ] + defines += [ "RISCV_TARGET_SIMULATOR" ] } if (riscv_use_rvv || v8_target_is_simulator) { defines += [ "CAN_USE_RVV_INSTRUCTIONS" ] @@ -1607,10 +1625,19 @@ config("toolchain") { if (riscv_use_zbs) { defines += [ "__riscv_zbs" ] } + defines += [ "RISCV_CODE_ALIGNMENT=${riscv_code_alignment}" ] + defines += + [ "RISCV_CONSTANT_POOL_ALIGNMENT=${riscv_constant_pool_alignment}" ] } + if (v8_current_cpu == "riscv64") { defines += [ "V8_TARGET_ARCH_RISCV64" ] - defines += [ "__riscv_xlen=64" ] + + # When building the simulator, the compiler does not provide __riscv_xlen, + # so we explicitly define it here. + if (v8_target_is_simulator) { + defines += [ "__riscv_xlen=64" ] + } if (!is_clang) { cflags += [ "-ffp-contract=off" ] } @@ -1621,7 +1648,12 @@ config("toolchain") { if (v8_current_cpu == "riscv32") { defines += [ "V8_TARGET_ARCH_RISCV32" ] - defines += [ "__riscv_xlen=32" ] + + # When building the simulator, the compiler does not provide __riscv_xlen, + # so we explicitly define it here. + if (v8_target_is_simulator) { + defines += [ "__riscv_xlen=32" ] + } } if (v8_current_cpu == "x86") { @@ -3555,7 +3587,7 @@ v8_header_set("v8_internal_headers") { "src/compiler/backend/register-allocator.h", "src/compiler/backend/spill-placer.h", "src/compiler/backend/unwinding-info-writer.h", - "src/compiler/basic-block-instrumentor.h", + "src/compiler/basic-block-call-graph-profiler.h", "src/compiler/branch-elimination.h", "src/compiler/bytecode-analysis.h", "src/compiler/bytecode-graph-builder.h", @@ -3699,6 +3731,7 @@ v8_header_set("v8_internal_headers") { "src/compiler/turboshaft/late-load-elimination-reducer.h", "src/compiler/turboshaft/layered-hash-map.h", "src/compiler/turboshaft/load-store-simplification-reducer.h", + "src/compiler/turboshaft/load-store-verification-reducer.h", "src/compiler/turboshaft/loop-finder.h", "src/compiler/turboshaft/loop-peeling-phase.h", "src/compiler/turboshaft/loop-peeling-reducer.h", @@ -4250,6 +4283,8 @@ v8_header_set("v8_internal_headers") { "src/objects/transitions.h", "src/objects/trusted-object-inl.h", "src/objects/trusted-object.h", + "src/objects/trusted-pointer-inl.h", + "src/objects/trusted-pointer.h", "src/objects/turbofan-types-inl.h", "src/objects/turbofan-types.h", "src/objects/turboshaft-types-inl.h", @@ -4338,6 +4373,7 @@ v8_header_set("v8_internal_headers") { "src/runtime/runtime.h", "src/sandbox/bounded-size-inl.h", "src/sandbox/bounded-size.h", + "src/sandbox/bytecode-verifier.h", "src/sandbox/check.h", "src/sandbox/code-entrypoint-tag.h", "src/sandbox/code-pointer-inl.h", @@ -4476,6 +4512,7 @@ v8_header_set("v8_internal_headers") { "src/tracing/code-data-source.h", "src/tracing/code-trace-context.h", "src/tracing/perfetto-logger.h", + "src/tracing/perfetto-sdk.h", "src/tracing/perfetto-utils.h", ] } @@ -4519,6 +4556,9 @@ v8_header_set("v8_internal_headers") { "src/maglev/maglev-pipeline-statistics.h", "src/maglev/maglev-post-hoc-optimizations-processors.h", "src/maglev/maglev-pre-regalloc-codegen-processors.h", + "src/maglev/maglev-range-analysis.h", + "src/maglev/maglev-range-verification.h", + "src/maglev/maglev-range.h", "src/maglev/maglev-reducer-inl.h", "src/maglev/maglev-reducer.h", "src/maglev/maglev-regalloc-data.h", @@ -4595,10 +4635,10 @@ v8_header_set("v8_internal_headers") { "src/wasm/code-space-access.h", "src/wasm/compilation-environment-inl.h", "src/wasm/compilation-environment.h", + "src/wasm/compilation-hints-generation.h", "src/wasm/constant-expression-interface.h", "src/wasm/constant-expression.h", "src/wasm/decoder.h", - "src/wasm/float16.h", "src/wasm/function-body-decoder-impl.h", "src/wasm/function-body-decoder.h", "src/wasm/function-compiler.h", @@ -5138,7 +5178,7 @@ v8_compiler_sources = [ "src/compiler/backend/register-allocator-verifier.cc", "src/compiler/backend/register-allocator.cc", "src/compiler/backend/spill-placer.cc", - "src/compiler/basic-block-instrumentor.cc", + "src/compiler/basic-block-call-graph-profiler.cc", "src/compiler/branch-elimination.cc", "src/compiler/bytecode-analysis.cc", "src/compiler/bytecode-graph-builder.cc", @@ -5295,6 +5335,7 @@ if (!v8_enable_maglev) { "src/maglev/maglev-ir.cc", "src/maglev/maglev-known-node-aspects.cc", "src/maglev/maglev-phi-representation-selector.cc", + "src/maglev/maglev-range-verification.cc", "src/maglev/maglev-truncation.cc", ] } @@ -5939,6 +5980,7 @@ v8_source_set("v8_base_without_compiler") { "src/runtime/runtime-typedarray.cc", "src/runtime/runtime-weak-refs.cc", "src/runtime/runtime.cc", + "src/sandbox/bytecode-verifier.cc", "src/sandbox/code-pointer-table.cc", "src/sandbox/cppheap-pointer-table.cc", "src/sandbox/external-pointer-table.cc", @@ -5988,7 +6030,6 @@ v8_source_set("v8_base_without_compiler") { "src/utils/detachable-vector.cc", "src/utils/hex-format.cc", "src/utils/identity-map.cc", - "src/utils/memcopy.cc", "src/utils/ostreams.cc", "src/utils/output-stream.cc", "src/utils/sha-256.cc", @@ -6039,6 +6080,7 @@ v8_source_set("v8_base_without_compiler") { "src/maglev/maglev-known-node-aspects.cc", "src/maglev/maglev-phi-representation-selector.cc", "src/maglev/maglev-pipeline-statistics.cc", + "src/maglev/maglev-range-verification.cc", "src/maglev/maglev-regalloc.cc", "src/maglev/maglev-truncation.cc", "src/maglev/maglev.cc", @@ -6104,6 +6146,7 @@ v8_source_set("v8_base_without_compiler") { "src/wasm/basic-block-calculator.cc", "src/wasm/canonical-types.cc", "src/wasm/code-space-access.cc", + "src/wasm/compilation-hints-generation.cc", "src/wasm/constant-expression-interface.cc", "src/wasm/constant-expression.cc", "src/wasm/function-body-decoder.cc", @@ -6493,6 +6536,15 @@ v8_source_set("v8_base_without_compiler") { ] } + if (v8_dumpling) { + sources += [ + "src/dumpling/dumpling-manager.cc", + "src/dumpling/dumpling-manager.h", + "src/dumpling/object-dumping.cc", + "src/dumpling/object-dumping.h", + ] + } + if (v8_enable_i18n_support) { deps += [ ":run_gen-regexp-special-case" ] sources += [ "$target_gen_dir/src/regexp/special-case.cc" ] @@ -6694,6 +6746,7 @@ v8_component("v8_libbase") { "src/base/abort-mode.cc", "src/base/abort-mode.h", "src/base/address-region.h", + "src/base/algorithm.h", "src/base/atomic-utils.h", "src/base/atomicops.h", "src/base/base-export.h", @@ -6723,6 +6776,7 @@ v8_component("v8_libbase") { "src/base/file-utils.cc", "src/base/file-utils.h", "src/base/flags.h", + "src/base/float16.h", "src/base/fpu.cc", "src/base/fpu.h", "src/base/free_deleter.h", @@ -6740,6 +6794,7 @@ v8_component("v8_libbase") { "src/base/logging.cc", "src/base/logging.h", "src/base/macros.h", + "src/base/memcopy.h", "src/base/memory.h", "src/base/numbers/bignum-dtoa.cc", "src/base/numbers/bignum-dtoa.h", @@ -7431,6 +7486,7 @@ v8_source_set("cppgc_base") { if (v8_use_perfetto) { sources += [ + "src/tracing/perfetto-sdk.h", "src/tracing/trace-categories.cc", "src/tracing/trace-categories.h", ] diff --git a/deps/v8/DEPS b/deps/v8/DEPS index 86740bd8ebbf1d..86b6f8c1ebbf8a 100644 --- a/deps/v8/DEPS +++ b/deps/v8/DEPS @@ -6,6 +6,7 @@ use_relative_paths = True gclient_gn_args_file = 'build/config/gclient_args.gni' gclient_gn_args = [ + 'checkout_src_internal', ] vars = { @@ -58,6 +59,9 @@ vars = { # Used for downloading the Fuchsia SDK without running hooks. 'checkout_fuchsia_no_hooks': False, + # V8 doesn't need src_internal, but some shared GN files use this variable. + 'checkout_src_internal': False, + # reclient CIPD package version 'reclient_version': 're_client_version:0.185.0.db415f21-gomaip', @@ -75,24 +79,24 @@ vars = { 'build_with_chromium': False, # GN CIPD package version. - 'gn_version': 'git_revision:07d3c6f4dc290fae5ca6152ebcb37d6815c411ab', + 'gn_version': 'git_revision:4619125bd337d259c0dc9f958d0102adc99d2543', # ninja CIPD package version # https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja 'ninja_version': 'version:3@1.12.1.chromium.4', # siso CIPD package version - 'siso_version': 'git_revision:0915813c4c786240e12d03aa3018c02bab4df14f', + 'siso_version': 'git_revision:03ee208f9c31a303e1ba61f9bc7219158078bd50', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Fuchsia sdk # and whatever else without interference from each other. - 'fuchsia_version': 'version:29.20251023.3.1', + 'fuchsia_version': 'version:30.20251119.3.1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling partition_alloc_version # and whatever else without interference from each other. - 'partition_alloc_version': 'db8446987dfff3cfc0c100b7d58e6a404ef639eb', + 'partition_alloc_version': 'c0a91c99639bc5e15f420ae8a6c764f3bcd0bccf', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_build-tools_version @@ -130,9 +134,9 @@ vars = { deps = { 'build': - Var('chromium_url') + '/chromium/src/build.git' + '@' + '81330a6e45719ab8c0d22e5548afbedb5482b068', + Var('chromium_url') + '/chromium/src/build.git' + '@' + '2ea8e0f4b0a7fc9a65b231a159cc0904fb5e7b5d', 'buildtools': - Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '723d636763a2635105e0e912bae25f662b2acaa8', + Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '1267724b67c1e44a778f610ae9dac191f06e2ff4', 'buildtools/linux64': { 'packages': [ { @@ -178,7 +182,7 @@ deps = { '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' + '@' + 'd2940bdbb0e28fd002ec31b89f8182bbf63da092', + Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + '9abd522060e1cd0c15be60c9945f56f7dbb32641', 'third_party/android_platform': { 'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + 'e3919359f2387399042d31401817db4a02d756ec', 'condition': 'checkout_android', @@ -232,7 +236,7 @@ deps = { 'dep_type': 'cipd', }, 'third_party/catapult': { - 'url': Var('chromium_url') + '/catapult.git' + '@' + '4daf7b2cead7fb17ec3da4eedb30215e3bd3674a', + 'url': Var('chromium_url') + '/catapult.git' + '@' + '88692a3d0a7aefbb1c7f2488db568c93c3b46a9c', 'condition': 'checkout_android', }, 'third_party/clang-format/script': @@ -246,7 +250,7 @@ deps = { 'condition': 'checkout_android', }, 'third_party/depot_tools': - Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '8a1ec6a0213ae033f6749f261e1c528488349991', + Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '8efa575d754b8703d99b0f827528e45aeaa167aa', 'third_party/dragonbox/src': Var('chromium_url') + '/external/github.com/jk-jeon/dragonbox.git' + '@' + '6c7c925b571d54486b9ffae8d9d18a822801cbda', 'third_party/fp16/src': @@ -254,11 +258,11 @@ deps = { 'third_party/fast_float/src': Var('chromium_url') + '/external/github.com/fastfloat/fast_float.git' + '@' + 'cb1d42aaa1e14b09e1452cfdef373d051b8c02a4', 'third_party/fuchsia-gn-sdk': { - 'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-gn-sdk.git' + '@' + '99294ee55f28f8ae5a3552f4c435528e4c1686b6', + 'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-gn-sdk.git' + '@' + 'eb5835429b16757f5288d77f502755c8eafd4b5f', 'condition': 'checkout_fuchsia', }, 'third_party/simdutf': - Var('chromium_url') + '/chromium/src/third_party/simdutf' + '@' + 'acd71a451c1bcb808b7c3a77e0242052909e381e', + Var('chromium_url') + '/chromium/src/third_party/simdutf' + '@' + '880a4923a95e0b525f7bf72da82661cfffe46fb3', # Exists for rolling the Fuchsia SDK. Check out of the SDK should always # rely on the hook running |update_sdk.py| script below. 'third_party/fuchsia-sdk/sdk': { @@ -280,13 +284,13 @@ deps = { 'third_party/fuzztest': Var('chromium_url') + '/chromium/src/third_party/fuzztest.git' + '@' + 'aa6ba9074b8d66a2e2853a0a0992c25966022e13', 'third_party/fuzztest/src': - Var('chromium_url') + '/external/github.com/google/fuzztest.git' + '@' + '7940ee9a7ebce6419c6391eef8b289524b16f198', + Var('chromium_url') + '/external/github.com/google/fuzztest.git' + '@' + '7406afb783ff5e7f3a1a66aebb81090622716412', 'third_party/googletest/src': - Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + 'b2b9072ecbe874f5937054653ef8f2731eb0f010', + Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '4fe3307fb2d9f86d19777c7eb0e4809e9694dde7', 'third_party/highway/src': Var('chromium_url') + '/external/github.com/google/highway.git' + '@' + '84379d1c73de9681b54fbe1c035a23c7bd5d272d', 'third_party/icu': - Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'f27805b7d7d8618fa73ce89e9d28e0a8b2216fec', + Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'a86a32e67b8d1384b33f8fa48c83a6079b86f8cd', 'third_party/instrumented_libs': { 'url': Var('chromium_url') + '/chromium/third_party/instrumented_libraries.git' + '@' + '69015643b3f68dbd438c010439c59adc52cac808', 'condition': 'checkout_instrumented_libraries', @@ -302,179 +306,179 @@ deps = { 'third_party/jsoncpp/source': Var('chromium_url') + '/external/github.com/open-source-parsers/jsoncpp.git'+ '@' + '42e892d96e47b1f6e29844cc705e148ec4856448', 'third_party/libc++/src': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + 'cdb24138c1591d12b07d5147825ec7dfeb495276', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + '99d9ab2603b02b6fb974cf19be99777f5cd99e7a', 'third_party/libc++abi/src': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + 'a02fa0058d8d52aca049868d229808a3e5dadbad', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + 'de02e5d57052b3b6d5fcd76dccde9380bca39360', 'third_party/libpfm4': Var('chromium_url') + '/chromium/src/third_party/libpfm4.git' + '@' + '25c29f04c9127e1ca09e6c1181f74850aa7f118b', 'third_party/libpfm4/src': Var('chromium_url') + '/external/git.code.sf.net/p/perfmon2/libpfm4.git' + '@' + '964baf9d35d5f88d8422f96d8a82c672042e7064', 'third_party/libunwind/src': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + '61ba011ba3c4ed238af93ebad476d3ab5a2fb5ab', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + '7ff36f1e358ffb63e25f27a1b5e8e0c52e15c49c', 'third_party/llvm-libc/src': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libc.git' + '@' + 'db35841a6fcbeee98e4d7fe6ba3df1a876a18a62', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libc.git' + '@' + 'b2be5ea77d1978b763e282d5572be69fcbca96d1', 'third_party/llvm-build/Release+Asserts': { 'dep_type': 'gcs', 'bucket': 'chromium-browser-clang', 'objects': [ { - 'object_name': 'Linux_x64/clang-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': 'f6a487ffd0e56ba7a39b063d85d1f8ff7846514f50635785730cffb7368872ce', - 'size_bytes': 55669844, - 'generation': 1759771493989631, + 'object_name': 'Linux_x64/clang-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': '0e18eb7f358240275c4ef5f92072c9acec37a168287ae69942f6a86462792b89', + 'size_bytes': 56526480, + 'generation': 1763731829626474, 'condition': 'host_os == "linux"', }, { - 'object_name': 'Linux_x64/clang-tidy-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '4fc7aacf4c25e50a25a941f1186a9e042ae26a2c5c698f359907798fa68106c8', - 'size_bytes': 14053336, - 'generation': 1759771494041411, + 'object_name': 'Linux_x64/clang-tidy-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'a44de3ffd80004d64e93d9986436e1a6d5a22a2a5b5b4fe4394382e18b8cc245', + 'size_bytes': 14257460, + 'generation': 1763731830089380, 'condition': 'host_os == "linux" and checkout_clang_tidy', }, { - 'object_name': 'Linux_x64/clangd-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '238897cb0b55ffcb7f6b8f6a10055e44e05023642441a800895704ced91d37d1', - 'size_bytes': 14197108, - 'generation': 1759771494144266, + 'object_name': 'Linux_x64/clangd-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'c48b1e3c428d264458991c36d8ae537e31054a3dbdf79d9131ebc82e356de1ee', + 'size_bytes': 14459492, + 'generation': 1763731830217388, 'condition': 'host_os == "linux" and checkout_clangd', }, { - 'object_name': 'Linux_x64/llvm-code-coverage-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '2c5b0bf210ca982d8ec37cacf3d06d9c45bd6e68b33dcaabce0d108d6c266a36', - 'size_bytes': 2272128, - 'generation': 1759771494296549, + 'object_name': 'Linux_x64/llvm-code-coverage-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': '72bebe9710e6d8609b0190eeb7a14b74b49e9634e1452c3c8fc9ab26cc983fea', + 'size_bytes': 2306976, + 'generation': 1763731830690664, 'condition': 'host_os == "linux" and checkout_clang_coverage_tools', }, { - 'object_name': 'Linux_x64/llvmobjdump-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': 'fd644634db56977b072d951f26571ac41c9c298bf5989e99efeb150ee8427364', - 'size_bytes': 5666140, - 'generation': 1759771494159187, + 'object_name': 'Linux_x64/llvmobjdump-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'fc5e696e4aa5b36103089fbe4113f53d19a8f9880bb906c4554d075fc6632b5a', + 'size_bytes': 5727588, + 'generation': 1763731830357400, 'condition': '(checkout_linux or checkout_mac or checkout_android) and host_os == "linux"', }, { - 'object_name': 'Mac/clang-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '44811b6ed6868142c088807f6bcc0d08811a7b11d3f2bc2124c45868037e8cc3', - 'size_bytes': 53583464, - 'generation': 1759771495565305, + 'object_name': 'Mac/clang-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': '0161559fa66e144aff91bd06d573a7c0289aaba15689d3c16130a5bf105286d0', + 'size_bytes': 54125348, + 'generation': 1763731832575158, 'condition': 'host_os == "mac" and host_cpu == "x64"', }, { - 'object_name': 'Mac/clang-mac-runtime-library-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '8a2e16410bede5d52c77a012f182dde2350b05e647f7c1acaf7823ce816b4422', - 'size_bytes': 1005144, - 'generation': 1759771503758969, + 'object_name': 'Mac/clang-mac-runtime-library-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'cccb5d2f91e6a4867df9cf548f1c5c5d9ca91a5bb8b0f5cd73fc3e3499fc7b43', + 'size_bytes': 1008644, + 'generation': 1763731856299525, 'condition': 'checkout_mac and not host_os == "mac"', }, { - 'object_name': 'Mac/clang-tidy-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '66633fe8846fddeda86b5ee992b945939bfe46567c9c685900c39531d22ce5cf', - 'size_bytes': 14133312, - 'generation': 1759771495642847, + 'object_name': 'Mac/clang-tidy-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'ed711ac333d78d5bb69d3ae1570ceb38e8b5d2b56e3241c9d1ba9d1b8b9345d6', + 'size_bytes': 14300644, + 'generation': 1763731832861152, 'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clang_tidy', }, { - 'object_name': 'Mac/clangd-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '44088b951aa7ddc96c0f32703b076311a7e7b803b3adfe0bfe9725f78c4fab29', - 'size_bytes': 15627392, - 'generation': 1759771495653658, + 'object_name': 'Mac/clangd-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': '6f5f99cee7d95600da9af08ccc1360e4b4d84debbbb6f548594e06bdc4bba84e', + 'size_bytes': 15816848, + 'generation': 1763731833029958, 'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clangd', }, { - 'object_name': 'Mac/llvm-code-coverage-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '79d62c78d256a508a0f3dbe59aa0fdf0391a9d462bf74e56adc1dee82efa83ac', - 'size_bytes': 2321940, - 'generation': 1759771495825689, + 'object_name': 'Mac/llvm-code-coverage-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': '8504dfa01a05126380e72ac29281043a88a50f07572dddf42e83c35a5b629802', + 'size_bytes': 2335344, + 'generation': 1763731833595747, 'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clang_coverage_tools', }, { - 'object_name': 'Mac/llvmobjdump-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': 'a10d075e19e7b614ffd8c5a65f04fbd45011ec74c735dda89f0b3780ab397329', - 'size_bytes': 5567160, - 'generation': 1759771495741126, + 'object_name': 'Mac/llvmobjdump-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': '65c229f8ac773e258bcf4ba67038d8db9f9100fea063c60263d7d37a8cee2374', + 'size_bytes': 5611140, + 'generation': 1763731833330327, 'condition': 'host_os == "mac" and host_cpu == "x64"', }, { - 'object_name': 'Mac_arm64/clang-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': 'c97e4f62cdd77edf725ccbf4cd63b589302605bf643c871f83214f39e629b2ea', - 'size_bytes': 44593804, - 'generation': 1759771504972271, + 'object_name': 'Mac_arm64/clang-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'bdd960e7d244b7f05f29481650e7b369739999e245079b58003f98de7d9f5058', + 'size_bytes': 45160412, + 'generation': 1763731858116892, 'condition': 'host_os == "mac" and host_cpu == "arm64"', }, { - 'object_name': 'Mac_arm64/clang-tidy-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '3a0eb0fb3a4633c8b4b143e826c5476c41cdd6bd0db8e93a74bbee6520b02b79', - 'size_bytes': 12136348, - 'generation': 1759771505073378, + 'object_name': 'Mac_arm64/clang-tidy-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'ade766ce0f5eaa40bdd250d052a3ec413553ba0f270a9317476819b1fccb5661', + 'size_bytes': 12303836, + 'generation': 1763731858483086, 'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clang_tidy', }, { - 'object_name': 'Mac_arm64/clangd-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '2a5dc1f385bacd25b974b8aa15c57008e33bc384521e2d705a940acbb3292356', - 'size_bytes': 12479180, - 'generation': 1759771505148040, + 'object_name': 'Mac_arm64/clangd-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'e6cdb50fcd29c96b1ecdea9023b5eabb71bf9410caea32704f80fe357f24e5a2', + 'size_bytes': 12680392, + 'generation': 1763731858628166, 'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clangd', }, { - 'object_name': 'Mac_arm64/llvm-code-coverage-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '00bf0f82ca9aff15f32e7f0cf7e7b25d36a5a672a1a9bc345c1b7e140a478f93', - 'size_bytes': 1948520, - 'generation': 1759771505303586, + 'object_name': 'Mac_arm64/llvm-code-coverage-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': '33434346e4890843296778226d972749b5591ba178ec937b528ef69cecc2e2ca', + 'size_bytes': 1966480, + 'generation': 1763731859129338, 'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clang_coverage_tools', }, { - 'object_name': 'Mac_arm64/llvmobjdump-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '7aa959752d6beafc74129e4822912021f855584e55a55600044f1d42b889f8b0', - 'size_bytes': 5292960, - 'generation': 1759771505201957, + 'object_name': 'Mac_arm64/llvmobjdump-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'cace63bdf68ff4be9680c497a9d15482f52fe01ebeb0de65dce1828e5628df12', + 'size_bytes': 5350540, + 'generation': 1763731858865476, 'condition': 'host_os == "mac" and host_cpu == "arm64"', }, { - 'object_name': 'Win/clang-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': 'fc756186dea61e700bd0f885b585050d9356bbd7f942dafae25d38eef4671adf', - 'size_bytes': 47657436, - 'generation': 1759771514781908, + 'object_name': 'Win/clang-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'fd43dc87de6c86bf9ca414425ccdf4bb244ebf3b77c6e21495ab47bc45fae39c', + 'size_bytes': 48332544, + 'generation': 1763731883374407, 'condition': 'host_os == "win"', }, { - 'object_name': 'Win/clang-tidy-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': 'f7ecd7e8d555e8622e0096ea1aca3ddb3fb4e89e91228c3c87289a4b8ca7919c', - 'size_bytes': 14016476, - 'generation': 1759771514824669, + 'object_name': 'Win/clang-tidy-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'be3b5950302a7e85b277ef0000b08e5b666f2953b2bc93328827e20d1c212e1c', + 'size_bytes': 14227724, + 'generation': 1763731884092633, 'condition': 'host_os == "win" and checkout_clang_tidy', }, { - 'object_name': 'Win/clang-win-runtime-library-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '0a426702c9e0f92ea27f9611a1665cc5df9a58820360d3fa6a4026b9a0e5120f', - 'size_bytes': 2501292, - 'generation': 1759771523074183, + 'object_name': 'Win/clang-win-runtime-library-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': '56f2b48958636c72264d68ef0da88fc0b1ce966b18dcdf9bf32079911afb4df4', + 'size_bytes': 2520580, + 'generation': 1763731907017594, 'condition': 'checkout_win and not host_os == "win"', }, { - 'object_name': 'Win/clangd-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': 'b172d0246511cdeffbc5a4fa44ad402a6b9eacd9d3e2e77d88a9965f80d344d5', - 'size_bytes': 14364312, - 'generation': 1759771514873065, + 'object_name': 'Win/clangd-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'f759d55f072d7a4d099b73c277e874a7a8586dc4b2603c070b1adbbc32c1259c', + 'size_bytes': 14634564, + 'generation': 1763731884451348, 'condition': 'host_os == "win" and checkout_clangd', }, { - 'object_name': 'Win/llvm-code-coverage-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': 'b70528795afd95729971b74939e512c638a8a93fd1ee1c9205a6240f7af28802', - 'size_bytes': 2368144, - 'generation': 1759771515105244, + 'object_name': 'Win/llvm-code-coverage-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': 'befea6b53d1a5fcdfb2aa394c46b03146102f6a4674665a3a57255fac87d8715', + 'size_bytes': 2386216, + 'generation': 1763731885098638, 'condition': 'host_os == "win" and checkout_clang_coverage_tools', }, { - 'object_name': 'Win/llvmobjdump-llvmorg-22-init-8940-g4d4cb757-84.tar.xz', - 'sha256sum': '94c068f109e220e028a38f5beced7d6acd67725fc0b1da9fa8ed1b959f12d799', - 'size_bytes': 5673824, - 'generation': 1759771514962844, + 'object_name': 'Win/llvmobjdump-llvmorg-22-init-14273-gea10026b-2.tar.xz', + 'sha256sum': '89531f1d76c76021fb8ee316d215172dee52457531b893cebc821988b0afdad3', + 'size_bytes': 5725356, + 'generation': 1763731884714790, 'condition': '(checkout_linux or checkout_mac or checkout_android) and host_os == "win"', }, ], }, 'third_party/logdog/logdog': - Var('chromium_url') + '/infra/luci/luci-py/client/libs/logdog' + '@' + '0b2078a90f7a638d576b3a7c407d136f2fb62399', + Var('chromium_url') + '/infra/luci/luci-py/client/libs/logdog' + '@' + '62fe96d7fd97a62f21a4665d2e71f69e9eedb04e', 'third_party/markupsafe': Var('chromium_url') + '/chromium/src/third_party/markupsafe.git' + '@' + '4256084ae14175d38a3ff7d739dca83ae49ccec6', 'third_party/ninja': { @@ -492,51 +496,51 @@ deps = { 'condition': 'not build_with_chromium', }, 'third_party/perfetto': - Var('android_url') + '/platform/external/perfetto.git' + '@' + '40b529923598b739b2892a536a7692eedbed5685', + Var('chromium_url') + '/external/github.com/google/perfetto.git' + '@' + 'e4edb6ba7055c3881214a356272716a8828d76fd', 'third_party/protobuf': - Var('chromium_url') + '/chromium/src/third_party/protobuf.git' + '@' + 'fcb7931541e4fe633b796db3f3e6f54c2dd297a8', + Var('chromium_url') + '/chromium/src/third_party/protobuf.git' + '@' + '2caa6ae88fd4eca3fb7e7e975fc9d841ca42defa', 'third_party/re2/src': - Var('chromium_url') + '/external/github.com/google/re2.git' + '@' + '61c4644171ee6b480540bf9e569cba06d9090b4b', + Var('chromium_url') + '/external/github.com/google/re2.git' + '@' + 'e7aec5985072c1dbe735add802653ef4b36c231a', 'third_party/requests': { 'url': Var('chromium_url') + '/external/github.com/kennethreitz/requests.git' + '@' + 'c7e0fc087ceeadb8b4c84a0953a422c474093d6d', 'condition': 'checkout_android', }, 'tools/rust': - Var('chromium_url') + '/chromium/src/tools/rust' + '@' + '12557fcc00d7e94caa5e270d7343b566e48a68ae', + Var('chromium_url') + '/chromium/src/tools/rust' + '@' + 'ca091d9562b30d94c08154ebb0a3874ca40d4064', 'tools/win': Var('chromium_url') + '/chromium/src/tools/win' + '@' + '24494b071e019a2baea4355d9870ffc5fc0bbafe', 'third_party/rust': - Var('chromium_url') + '/chromium/src/third_party/rust' + '@' + '4d93511ebaceb09ebdd83c8876a4a936b75fa04d', + Var('chromium_url') + '/chromium/src/third_party/rust' + '@' + 'e6ee35e1c94c62365c41db142d17bb96210b6dad', 'third_party/rust-toolchain': { 'dep_type': 'gcs', 'bucket': 'chromium-browser-clang', 'objects': [ { - 'object_name': 'Linux_x64/rust-toolchain-15283f6fe95e5b604273d13a428bab5fc0788f5a-1-llvmorg-22-init-8940-g4d4cb757.tar.xz', - 'sha256sum': '2bdaea0b11cb11a8f2f4dcb79b0dbb4bf38e2bd22479ff8014f55b9b6890e135', - 'size_bytes': 142044388, - 'generation': 1758743116775859, + 'object_name': 'Linux_x64/rust-toolchain-11339a0ef5ed586bb7ea4f85a9b7287880caac3a-1-llvmorg-22-init-14273-gea10026b.tar.xz', + 'sha256sum': '15cf3019dd864ea64d63e5cf33de1ded76ace4f70cbb224812fccbf03b342096', + 'size_bytes': 140380848, + 'generation': 1762971367461755, 'condition': 'host_os == "linux"', }, { - 'object_name': 'Mac/rust-toolchain-15283f6fe95e5b604273d13a428bab5fc0788f5a-1-llvmorg-22-init-8940-g4d4cb757.tar.xz', - 'sha256sum': '351347e1930a900c63b3953cdb10775b73572c6145e389f3820ba920816d46ca', - 'size_bytes': 135891820, - 'generation': 1758743118329536, + 'object_name': 'Mac/rust-toolchain-11339a0ef5ed586bb7ea4f85a9b7287880caac3a-1-llvmorg-22-init-14273-gea10026b.tar.xz', + 'sha256sum': 'bb8be97e327b72f03f9caadae5557c7ce0ddac66e6dcc37cd3b8e65fca074e4b', + 'size_bytes': 134345832, + 'generation': 1762971369029231, 'condition': 'host_os == "mac" and host_cpu == "x64"', }, { - 'object_name': 'Mac_arm64/rust-toolchain-15283f6fe95e5b604273d13a428bab5fc0788f5a-1-llvmorg-22-init-8940-g4d4cb757.tar.xz', - 'sha256sum': '33d6b8cf4fc6617aa98888a46bc1dbef29ae9a9ebd01c3f248ef8c08ec5f198b', - 'size_bytes': 123302332, - 'generation': 1758743119839246, + 'object_name': 'Mac_arm64/rust-toolchain-11339a0ef5ed586bb7ea4f85a9b7287880caac3a-1-llvmorg-22-init-14273-gea10026b.tar.xz', + 'sha256sum': '72b4421aa531822ba4b32533e6efae4e7c06eb15dcc32d1fb361023dd937c63c', + 'size_bytes': 121923464, + 'generation': 1762971370566007, 'condition': 'host_os == "mac" and host_cpu == "arm64"', }, { - 'object_name': 'Win/rust-toolchain-15283f6fe95e5b604273d13a428bab5fc0788f5a-1-llvmorg-22-init-8940-g4d4cb757.tar.xz', - 'sha256sum': '4f6dfa230e5d401bf9aadd804142b412467177b17d50a3f52a8c69c1957aa2db', - 'size_bytes': 199998880, - 'generation': 1758743121322555, + 'object_name': 'Win/rust-toolchain-11339a0ef5ed586bb7ea4f85a9b7287880caac3a-1-llvmorg-22-init-14273-gea10026b.tar.xz', + 'sha256sum': '8cd2f0c4d312c0a7c127a8e6adf0a73ceecad316997e925fbebc1d855e95f6ba', + 'size_bytes': 197809928, + 'generation': 1762971372158285, 'condition': 'host_os == "win"', }, ], @@ -552,13 +556,13 @@ deps = { 'condition': 'not build_with_chromium and host_cpu != "s390x" and host_os != "zos" and host_cpu != "ppc64"', }, 'third_party/zlib': - Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '85f05b0835f934e52772efc308baa80cdd491838', + Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '63d7e16739d83e3a16c673692a348e52db1a3a11', 'tools/clang': - Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '97f0845783b3d8ebca7541afb46ec53c3f4bd3ac', + Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '768d15952d4ac4789455b947375c2ebd7e78d143', 'tools/protoc_wrapper': Var('chromium_url') + '/chromium/src/tools/protoc_wrapper.git' + '@' + '3438d4183bfc7c0d6850e8b970204cc8189f0323', 'third_party/abseil-cpp': { - 'url': Var('chromium_url') + '/chromium/src/third_party/abseil-cpp.git' + '@' + '3fb321d9764442ceaf2e17b6e68ab6b6836bc78a', + 'url': Var('chromium_url') + '/chromium/src/third_party/abseil-cpp.git' + '@' + 'dcfa08fa08bb8ee1f28a2e94d80e0ac1a7015013', 'condition': 'not build_with_chromium', }, 'third_party/zoslib': { diff --git a/deps/v8/WATCHLISTS b/deps/v8/WATCHLISTS index 0e9e78b120c9eb..8fff0bde11fde4 100644 --- a/deps/v8/WATCHLISTS +++ b/deps/v8/WATCHLISTS @@ -60,6 +60,9 @@ 'arm': { 'filepath': '/arm/', }, + 'riscv': { + 'filepath': '/riscv/', + }, 'merges': { 'filepath': '.', }, @@ -140,6 +143,9 @@ 'v8-ppc-ports@googlegroups.com', 'v8-risc-v-ports@chromium.org', ], + 'riscv': [ + 'v8-risc-v-ports@chromium.org', + ], 'merges': [ # Only enabled on branches created with tools/release/create_release.py 'v8-merges@googlegroups.com', diff --git a/deps/v8/bazel/config/BUILD.bazel b/deps/v8/bazel/config/BUILD.bazel index c81f2782031269..17e379b8e27baa 100644 --- a/deps/v8/bazel/config/BUILD.bazel +++ b/deps/v8/bazel/config/BUILD.bazel @@ -357,3 +357,28 @@ selects.config_setting_group( ":is_fastbuild", ], ) + +# To build with sanitizers in the command line, define the local +# variable SANITIZER. +# Eg: bazel build --copt=-fsanitize=address --linkopt=-fsanitize=address \ +# --define=SANITIZER=asan ... + +config_setting( + name = "asan_enabled", + values = {"define": "SANITIZER=asan"}, +) + +config_setting( + name = "hwasan_enabled", + values = {"define": "SANITIZER=hwasan"}, +) + +config_setting( + name = "msan_enabled", + values = {"define": "SANITIZER=msan"}, +) + +config_setting( + name = "ubsan_enabled", + values = {"define": "SANITIZER=ubsan"}, +) diff --git a/deps/v8/gni/v8.gni b/deps/v8/gni/v8.gni index d198859576a4bd..1648a63a9fc2ea 100644 --- a/deps/v8/gni/v8.gni +++ b/deps/v8/gni/v8.gni @@ -61,8 +61,7 @@ declare_args() { # is still not accessible unless --harmony-temporal is enabled at runtime) # # Furthermore, some architectures don't have Rust toolchains in Chromium - v8_enable_temporal_support = !(defined(build_with_node) && build_with_node) && - target_cpu != "ppc64" && target_cpu != "s390x" + v8_enable_temporal_support = !(defined(build_with_node) && build_with_node) # Use static libraries instead of source_sets. v8_static_library = false @@ -80,6 +79,12 @@ declare_args() { # Implement tracing using Perfetto (https://perfetto.dev). v8_use_perfetto = false + # Use Perfetto JSON Export. + v8_use_perfetto_json_export = "" + + # Use Perfetto SDK headers. + v8_use_perfetto_sdk = false + # Override global symbol level setting for v8. v8_symbol_level = symbol_level @@ -225,7 +230,7 @@ declare_args() { # When `v8_enable_pointer_compression_shared_cage` RO space is placed into a # contiguous area at the front of the cage. In case RO allocations fails this # size needs to be adjusted. - v8_contiguous_compressed_ro_space_size_mb = 8 + v8_contiguous_compressed_ro_space_size_mb = 16 # Change code emission and runtime features to be CET shadow-stack compliant # (incomplete and experimental). @@ -269,12 +274,25 @@ if (v8_enable_backtrace == "") { v8_enable_backtrace = is_debug && !v8_optimized_debug } +if (v8_use_perfetto_sdk) { + # When using perfetto SDK, we also need to enable perfetto support. + v8_use_perfetto = true +} + # Chromium is configured to use the perfetto client library, v8 should also # use perfetto for tracing. if (build_with_chromium) { v8_use_perfetto = true } +# Enable JSON export by default when using perfetto but not the SDK. +if (v8_use_perfetto_json_export == "") { + v8_use_perfetto_json_export = v8_use_perfetto && !v8_use_perfetto_sdk +} +assert( + !(v8_use_perfetto_sdk && v8_use_perfetto_json_export), + "Perfetto JSON Export is not available when building with the Perfetto SDK.") + # Includes profiles to optimize builtins if # * it is a Chromium build, and # * Chromium builds with optimization. diff --git a/deps/v8/include/libplatform/v8-tracing.h b/deps/v8/include/libplatform/v8-tracing.h index 2271729240b9cb..9d05949c38efac 100644 --- a/deps/v8/include/libplatform/v8-tracing.h +++ b/deps/v8/include/libplatform/v8-tracing.h @@ -14,9 +14,11 @@ #include "v8-platform.h" // NOLINT(build/include_directory) namespace perfetto { +#if defined(V8_USE_PERFETTO_JSON_EXPORT) namespace trace_processor { class TraceProcessorStorage; } +#endif // defined(V8_USE_PERFETTO_JSON_EXPORT) class TracingSession; } @@ -231,6 +233,12 @@ class V8_PLATFORM_EXPORT TraceConfig { #define V8_PLATFORM_NON_EXPORTED_BASE(code) code #endif // defined(_MSC_VER) +/** + * V8 Tracing controller default implementation. + * + * Will become obsolete in Perfetto build + * (v8_use_perfetto_json_export = true). + */ class V8_PLATFORM_EXPORT TracingController : public V8_PLATFORM_NON_EXPORTED_BASE(v8::TracingController) { public: @@ -307,10 +315,13 @@ class V8_PLATFORM_EXPORT TracingController std::unique_ptr trace_config_; std::atomic_bool recording_{false}; -#if defined(V8_USE_PERFETTO) - std::ostream* output_stream_ = nullptr; +#if defined(V8_USE_PERFETTO_JSON_EXPORT) std::unique_ptr trace_processor_; +#endif + +#if defined(V8_USE_PERFETTO) + std::ostream* output_stream_ = nullptr; TraceEventListener* listener_for_testing_ = nullptr; std::unique_ptr tracing_session_; #else // !defined(V8_USE_PERFETTO) diff --git a/deps/v8/include/v8-callbacks.h b/deps/v8/include/v8-callbacks.h index 850b7ccbd4f210..e5eba5a203b8bc 100644 --- a/deps/v8/include/v8-callbacks.h +++ b/deps/v8/include/v8-callbacks.h @@ -260,6 +260,15 @@ enum class CrashKeyId { using AddCrashKeyCallback = void (*)(CrashKeyId id, const std::string& value); +// --- CrashKeyString Callbacks --- +using CrashKey = void*; +enum class CrashKeySize { Size32, Size64, Size256, Size1024 }; + +using AllocateCrashKeyStringCallback = + std::function; +using SetCrashKeyStringCallback = + std::function; + // --- Enter/Leave Script Callback --- using BeforeCallEnteredCallback = void (*)(Isolate*); using CallCompletedCallback = void (*)(Isolate*); diff --git a/deps/v8/include/v8-context.h b/deps/v8/include/v8-context.h index 1d52f5bf40652e..21137f628f2def 100644 --- a/deps/v8/include/v8-context.h +++ b/deps/v8/include/v8-context.h @@ -276,6 +276,20 @@ class V8_EXPORT Context : public Data { * Gets the embedder data with the given index, which must have been set by a * previous call to SetEmbedderData with the same index. */ + V8_INLINE Local GetEmbedderDataV2(int index); + + /** + * Sets the embedder data with the given index, growing the data as + * needed. Note that index 0 currently has a special meaning for Chrome's + * debugger. + */ + void SetEmbedderDataV2(int index, Local value); + + /** + * Gets the embedder data with the given index, which must have been set by a + * previous call to SetEmbedderData with the same index. + */ + V8_DEPRECATE_SOON("Use GetEmbedderDataV2 instead") V8_INLINE Local GetEmbedderData(int index); /** @@ -291,6 +305,7 @@ class V8_EXPORT Context : public Data { * needed. Note that index 0 currently has a special meaning for Chrome's * debugger. */ + V8_DEPRECATE_SOON("Use SetEmbedderDataV2 instead") void SetEmbedderData(int index, Local value); /** @@ -304,7 +319,7 @@ class V8_EXPORT Context : public Data { V8_INLINE void* GetAlignedPointerFromEmbedderData(int index, EmbedderDataTypeTag tag); - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use GetAlignedPointerFromEmbedderData with EmbedderDataTypeTag " "parameter instead.") V8_INLINE void* GetAlignedPointerFromEmbedderData(Isolate* isolate, @@ -313,7 +328,7 @@ class V8_EXPORT Context : public Data { kEmbedderDataTypeTagDefault); } - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use GetAlignedPointerFromEmbedderData with EmbedderDataTypeTag " "parameter instead.") V8_INLINE void* GetAlignedPointerFromEmbedderData(int index) { @@ -329,7 +344,7 @@ class V8_EXPORT Context : public Data { * index, growing the data as needed. Note that index 0 currently has a * special meaning for Chrome's debugger. */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use SetAlignedPointerInEmbedderData with EmbedderDataTypeTag parameter " "instead.") void SetAlignedPointerInEmbedderData(int index, void* value) { @@ -453,6 +468,7 @@ class V8_EXPORT Context : public Data { internal::ValueHelper::InternalRepresentationType GetDataFromSnapshotOnce( size_t index); Local SlowGetEmbedderData(int index); + Local SlowGetEmbedderDataV2(int index); void* SlowGetAlignedPointerFromEmbedderData(int index, EmbedderDataTypeTag tag); }; @@ -471,7 +487,7 @@ Local Context::GetEmbedderData(int index) { A value = I::ReadRawField(embedder_data, value_offset); #ifdef V8_COMPRESS_POINTERS // We read the full pointer value and then decompress it in order to avoid - // dealing with potential endiannes issues. + // dealing with potential endianness issues. value = I::DecompressTaggedField(embedder_data, static_cast(value)); #endif @@ -482,6 +498,29 @@ Local Context::GetEmbedderData(int index) { #endif } +V8_INLINE Local Context::GetEmbedderDataV2(int index) { +#ifndef V8_ENABLE_CHECKS + using A = internal::Address; + using I = internal::Internals; + A ctx = internal::ValueHelper::ValueAsAddress(this); + A embedder_data = + I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset); + int value_offset = + I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index); + A value = I::ReadRawField(embedder_data, value_offset); +#ifdef V8_COMPRESS_POINTERS + // We read the full pointer value and then decompress it in order to avoid + // dealing with potential endianness issues. + value = I::DecompressTaggedField(embedder_data, static_cast(value)); +#endif + + auto* isolate = I::GetCurrentIsolate(); + return Local::New(isolate, value); +#else + return SlowGetEmbedderDataV2(index); +#endif +} + void* Context::GetAlignedPointerFromEmbedderData(Isolate* isolate, int index, EmbedderDataTypeTag tag) { #if !defined(V8_ENABLE_CHECKS) diff --git a/deps/v8/include/v8-data.h b/deps/v8/include/v8-data.h index bf40b746adf887..93523cbf95ad60 100644 --- a/deps/v8/include/v8-data.h +++ b/deps/v8/include/v8-data.h @@ -77,7 +77,11 @@ class V8_EXPORT Data { class V8_EXPORT FixedArray : public Data { public: int Length() const; - Local Get(Local context, int i) const; + + V8_DEPRECATE_SOON("Use the version without context") + Local Get(Local context, int i) const { return Get(i); } + + Local Get(int i) const; V8_INLINE static FixedArray* Cast(Data* data) { #ifdef V8_ENABLE_CHECKS diff --git a/deps/v8/include/v8-external.h b/deps/v8/include/v8-external.h index c3feb1daad7e5f..ffe8fe6bc74ef6 100644 --- a/deps/v8/include/v8-external.h +++ b/deps/v8/include/v8-external.h @@ -34,7 +34,7 @@ class V8_EXPORT External : public Value { } static Local New(Isolate* isolate, void* value, ExternalPointerTypeTag tag); - V8_INLINE static External* Cast(Value* value) { + V8_INLINE static External* Cast(Data* value) { #ifdef V8_ENABLE_CHECKS CheckCast(value); #endif @@ -47,7 +47,7 @@ class V8_EXPORT External : public Value { void* Value(ExternalPointerTypeTag tag) const; private: - static void CheckCast(v8::Value* obj); + static void CheckCast(v8::Data* obj); }; } // namespace v8 diff --git a/deps/v8/include/v8-function-callback.h b/deps/v8/include/v8-function-callback.h index 0dad94ce22c270..c9176fe91ee738 100644 --- a/deps/v8/include/v8-function-callback.h +++ b/deps/v8/include/v8-function-callback.h @@ -239,31 +239,18 @@ class PropertyCallbackInfo { * CompileRun("obj.a = 'obj'; var r = {a: 'r'}; Reflect.get(obj, 'x', r)"); * \endcode */ + V8_DEPRECATE_SOON( + "Access to receiver will be deprecated soon. Use HolderV2() instead. \n" + "See http://crbug.com/455600234. ") V8_INLINE Local This() const; - /** - * \return The object in the prototype chain of the receiver that has the - * interceptor. Suppose you have `x` and its prototype is `y`, and `y` - * has an interceptor. Then `info.This()` is `x` and `info.Holder()` is `y`. - * The Holder() could be a hidden object (the global object, rather - * than the global proxy). - * - * \note For security reasons, do not pass the object back into the runtime. - */ - V8_DEPRECATED( - "V8 will stop providing access to hidden prototype (i.e. " - "JSGlobalObject). Use HolderV2() instead. \n" - "DO NOT try to workaround this by accessing JSGlobalObject via " - "v8::Object::GetPrototype() - it'll be deprecated soon too. \n" - "See http://crbug.com/333672197. ") - V8_INLINE Local Holder() const; - /** * \return The object in the prototype chain of the receiver that has the * interceptor. Suppose you have `x` and its prototype is `y`, and `y` * has an interceptor. Then `info.This()` is `x` and `info.Holder()` is `y`. * In case the property is installed on the global object the Holder() * would return the global proxy. + * TODO(http://crbug.com/333672197): rename back to Holder(). */ V8_INLINE Local HolderV2() const; @@ -278,11 +265,18 @@ class PropertyCallbackInfo { V8_INLINE ReturnValue GetReturnValue() const; /** + * For [[Set]], [[DefineOwnProperty]] and [[Delete]] operations (i.e. + * for setter/definer/deleter callbacks) indicates whether TypeError + * should be thrown upon operation failure. The callback should throw + * TypeError only if it's necessary to provide more details than a default + * error thrown by V8 contains in this case. + * * \return True if the intercepted function should throw if an error occurs. - * Usually, `true` corresponds to `'use strict'`. + * Usually, `true` corresponds to `'use strict'` execution mode. * - * \note Always `false` when intercepting `Reflect.set()` - * independent of the language mode. + * \note Always `false` when the operation was initiated by respecive + * `Reflect` call (i.e. `Reflect.set()`, `Reflect.defineProperty()` and + * `Reflect.deleteProperty()`). */ V8_INLINE bool ShouldThrowOnError() const; @@ -298,9 +292,10 @@ class PropertyCallbackInfo { static constexpr int kShouldThrowOnErrorIndex = 1; static constexpr int kHolderIndex = 2; static constexpr int kIsolateIndex = 3; - static constexpr int kHolderV2Index = 4; + // TODO(http://crbug.com/333672197): drop this parameter. + static constexpr int kUnusedIndex = 4; static constexpr int kReturnValueIndex = 5; - static constexpr int kDataIndex = 6; + static constexpr int kCallbackInfoIndex = 6; static constexpr int kThisIndex = 7; static constexpr int kArgsLength = 8; @@ -377,8 +372,9 @@ void ReturnValue::SetNonEmpty(const BasicTracedReference& handle) { template template void ReturnValue::Set(const Local handle) { - // "V8_DEPRECATE_SOON" this method if |T| is |void|. -#ifdef V8_IMMINENT_DEPRECATION_WARNINGS + // "V8_DEPRECATED" this method if |T| is |void|. +#if defined(V8_DEPRECATION_WARNINGS) || \ + defined(V8_IMMINENT_DEPRECATION_WARNINGS) static constexpr bool is_allowed_void = false; static_assert(!std::is_void_v, "ReturnValue::Set(const Local) is deprecated. " @@ -388,7 +384,8 @@ void ReturnValue::Set(const Local handle) { "See http://crbug.com/348660658 for details."); #else static constexpr bool is_allowed_void = std::is_void_v; -#endif // V8_IMMINENT_DEPRECATION_WARNINGS +#endif // defined(V8_DEPRECATION_WARNINGS) || + // defined(V8_IMMINENT_DEPRECATION_WARNINGS) static_assert(is_allowed_void || std::is_base_of_v, "type check"); if (V8_UNLIKELY(handle.IsEmpty())) { SetDefaultValue(); @@ -404,8 +401,9 @@ void ReturnValue::Set(const Local handle) { template template void ReturnValue::SetNonEmpty(const Local handle) { - // "V8_DEPRECATE_SOON" this method if |T| is |void|. -#ifdef V8_IMMINENT_DEPRECATION_WARNINGS + // "V8_DEPRECATED" this method if |T| is |void|. +#if defined(V8_DEPRECATION_WARNINGS) || \ + defined(V8_IMMINENT_DEPRECATION_WARNINGS) static constexpr bool is_allowed_void = false; static_assert(!std::is_void_v, "ReturnValue::SetNonEmpty(const Local) is deprecated. " @@ -415,7 +413,9 @@ void ReturnValue::SetNonEmpty(const Local handle) { "See http://crbug.com/348660658 for details."); #else static constexpr bool is_allowed_void = std::is_void_v; -#endif // V8_IMMINENT_DEPRECATION_WARNINGS +#endif // defined(V8_DEPRECATION_WARNINGS) || + // defined(V8_IMMINENT_DEPRECATION_WARNINGS) + static_assert(is_allowed_void || std::is_base_of_v, "type check"); #ifdef V8_ENABLE_CHECKS internal::VerifyHandleIsNonEmpty(handle.IsEmpty()); @@ -668,7 +668,11 @@ Isolate* PropertyCallbackInfo::GetIsolate() const { template Local PropertyCallbackInfo::Data() const { - return Local::FromSlot(&args_[kDataIndex]); + using I = internal::Internals; + internal::Address callback_info = args_[kCallbackInfoIndex]; + internal::Address data = + I::ReadTaggedPointerField(callback_info, I::kCallbackInfoDataOffset); + return Local::New(GetIsolate(), data); } template @@ -676,26 +680,9 @@ Local PropertyCallbackInfo::This() const { return Local::FromSlot(&args_[kThisIndex]); } -template -Local PropertyCallbackInfo::Holder() const { - return Local::FromSlot(&args_[kHolderIndex]); -} - -namespace api_internal { -// Returns JSGlobalProxy if holder is JSGlobalObject or unmodified holder -// otherwise. -V8_EXPORT internal::Address ConvertToJSGlobalProxyIfNecessary( - internal::Address holder); -} // namespace api_internal - template Local PropertyCallbackInfo::HolderV2() const { - using I = internal::Internals; - if (!I::HasHeapObjectTag(args_[kHolderV2Index])) { - args_[kHolderV2Index] = - api_internal::ConvertToJSGlobalProxyIfNecessary(args_[kHolderIndex]); - } - return Local::FromSlot(&args_[kHolderV2Index]); + return Local::FromSlot(&args_[kHolderIndex]); } template diff --git a/deps/v8/include/v8-function.h b/deps/v8/include/v8-function.h index 9ee77596cd3796..18532519f8b89c 100644 --- a/deps/v8/include/v8-function.h +++ b/deps/v8/include/v8-function.h @@ -31,8 +31,8 @@ class V8_EXPORT Function : public Object { * for a given FunctionCallback. */ static MaybeLocal New( - Local context, FunctionCallback callback, - Local data = Local(), int length = 0, + Local context, FunctionCallback callback, Local data = {}, + int length = 0, ConstructorBehavior behavior = ConstructorBehavior::kAllow, SideEffectType side_effect_type = SideEffectType::kHasSideEffect); diff --git a/deps/v8/include/v8-internal.h b/deps/v8/include/v8-internal.h index 8d28f22018609a..60a7ec155c1514 100644 --- a/deps/v8/include/v8-internal.h +++ b/deps/v8/include/v8-internal.h @@ -483,7 +483,7 @@ struct TagRange { return (static_cast(first) << 16) | last; } - // Internally we represent tag ranges as half-open ranges [first, last). + // Internally we represent tag ranges as closed ranges [first, last]. const Tag first; const Tag last; }; @@ -901,6 +901,9 @@ class Internals { static const int kExternalTwoByteRepresentationTag = 0x02; static const int kExternalOneByteRepresentationTag = 0x0a; + // AccessorInfo::data and InterceptorInfo::data field. + static const int kCallbackInfoDataOffset = 1 * kApiTaggedSize; + static const uint32_t kNumIsolateDataSlots = 4; static const int kStackGuardSize = 8 * kApiSystemPointerSize; static const int kNumberOfBooleanFlags = 6; @@ -1020,13 +1023,9 @@ class Internals { using Tagged_t = uint32_t; struct StaticReadOnlyRoot { #ifdef V8_ENABLE_WEBASSEMBLY - static constexpr Tagged_t kBuildDependentTheHoleValue = 0x20001; -#else -#ifdef V8_INTL_SUPPORT - static constexpr Tagged_t kBuildDependentTheHoleValue = 0x6581; + static constexpr Tagged_t kBuildDependentTheHoleValue = 0x2fffd; #else - static constexpr Tagged_t kBuildDependentTheHoleValue = 0x58d1; -#endif + static constexpr Tagged_t kBuildDependentTheHoleValue = 0xfffd; #endif #define DEF_ROOT(name, value) static constexpr Tagged_t k##name = value; diff --git a/deps/v8/include/v8-isolate.h b/deps/v8/include/v8-isolate.h index 1efaa547bc0ed3..299714f07a2db9 100644 --- a/deps/v8/include/v8-isolate.h +++ b/deps/v8/include/v8-isolate.h @@ -357,18 +357,6 @@ class V8_EXPORT Isolate { */ bool allow_atomics_wait = true; - /** - * The following parameters describe the offsets for addressing type info - * for wrapped API objects and are used by the fast C API - * (for details see v8-fast-api-calls.h). - * - * V8_DEPRECATED was applied in v14.3. - */ - V8_DEPRECATED("This field is unused.") - int embedder_wrapper_type_index = -1; - V8_DEPRECATED("This field is unused.") - int embedder_wrapper_object_index = -1; - /** * Callbacks to invoke in case of fatal or OOM errors. */ @@ -1492,6 +1480,13 @@ class V8_EXPORT Isolate { */ void SetAddCrashKeyCallback(AddCrashKeyCallback); + /** + * Enables the host application to provide a mechanism for allocating a new + * crash key and setting/updating values for them. + */ + void SetCrashKeyStringCallbacks(AllocateCrashKeyStringCallback, + SetCrashKeyStringCallback); + /** * Optional notification that the system is running low on memory. * V8 uses these notifications to attempt to free memory. diff --git a/deps/v8/include/v8-object.h b/deps/v8/include/v8-object.h index 65a144474cb095..8e46e71c35e976 100644 --- a/deps/v8/include/v8-object.h +++ b/deps/v8/include/v8-object.h @@ -163,30 +163,44 @@ enum PropertyAttribute { }; /** - * Accessor[Getter|Setter] are used as callback functions when setting|getting - * a particular data property. See Object::SetNativeDataProperty and + * This callback function is called when getting a particular data property + * (i.e. when performing [[Get]] operation). + * + * The callback returns the result by calling `info.GetReturnValue().Set(..)`. + * + * \param property The name of the property being requested. + * \param info Information about the intercepted request, such as + * isolate, object holding the property, return value. See + * `PropertyCallbackInfo`. + * + * See Object::SetNativeDataProperty and * ObjectTemplate::SetNativeDataProperty methods. */ using AccessorNameGetterCallback = void (*)(Local property, const PropertyCallbackInfo& info); -using AccessorNameSetterCallback = - void (*)(Local property, Local value, - const PropertyCallbackInfo& info); - /** - * Access control specifications. + * This callback function is called when setting a particular data property + * (i.e. when performing [[Set]] operation). + * + * In case of operation failure the callback should + * - call `info.GetReturnValue().Set(false)`, + * - (optionally) upon operation failure and info.ShouldThrowOnError() + * is true (indicating execution in `'use strict'` mode) the callback can + * throw TypeError if the error message needs to include more details than + * a TypeError thrown by V8 in this case. * - * Some accessors should be accessible across contexts. These - * accessors have an explicit access control parameter which specifies - * the kind of cross-context access that should be allowed. + * \param property The name of the property being requested. + * \param info Information about the intercepted request, such as + * isolate, object holding the property, return value, or whether running in + * `'use strict'` mode. See `PropertyCallbackInfo`. * + * See Object::SetNativeDataProperty and + * ObjectTemplate::SetNativeDataProperty methods. */ -enum V8_DEPRECATED( - "This enum is no longer used and will be removed in V8 14.3.") - AccessControl { - DEFAULT V8_ENUM_DEPRECATED("not used") = 0, - }; +using AccessorNameSetterCallback = + void (*)(Local property, Local value, + const PropertyCallbackInfo& info); /** * Property filter bits. They can be or'ed to build a composite filter. @@ -517,7 +531,7 @@ class V8_EXPORT Object : public Value { int index, EmbedderDataTypeTag tag); - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use GetAlignedPointerFromInternalField with EmbedderDataTypeTag " "parameter instead.") V8_INLINE void* GetAlignedPointerFromInternalField(int index) { @@ -525,7 +539,7 @@ class V8_EXPORT Object : public Value { kEmbedderDataTypeTagDefault); } - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use GetAlignedPointerFromInternalField with EmbedderDataTypeTag " "parameter instead.") V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate, @@ -542,7 +556,7 @@ class V8_EXPORT Object : public Value { index, tag); } - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use GetAlignedPointerFromInternalField with EmbedderDataTypeTag " "parameter instead.") V8_INLINE static void* GetAlignedPointerFromInternalField( @@ -559,7 +573,7 @@ class V8_EXPORT Object : public Value { index, tag); } - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use GetAlignedPointerFromInternalField with EmbedderDataTypeTag " "parameter instead.") V8_INLINE static void* GetAlignedPointerFromInternalField( @@ -576,14 +590,14 @@ class V8_EXPORT Object : public Value { void SetAlignedPointerInInternalField(int index, void* value, EmbedderDataTypeTag tag); - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use SetAlignedPointerInInternalField with EmbedderDataTypeTag parameter " "instead.") void SetAlignedPointerInInternalField(int index, void* value) { SetAlignedPointerInInternalField(index, value, kEmbedderDataTypeTagDefault); } - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use SetAlignedPointerInInternalField with EmbedderDataTypeTag " "parameter instead.") void SetAlignedPointerInInternalFields(int argc, int indices[], @@ -821,7 +835,7 @@ class V8_EXPORT Object : public Value { void* GetAlignedPointerFromEmbedderDataInCreationContext( int index, EmbedderDataTypeTag tag); - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use GetAlignedPointerFromEmbedderDataInCreationContext with " "EmbedderDataTypeTag parameter instead.") void* GetAlignedPointerFromEmbedderDataInCreationContext(v8::Isolate* isolate, @@ -830,7 +844,7 @@ class V8_EXPORT Object : public Value { isolate, index, kEmbedderDataTypeTagDefault); } - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use GetAlignedPointerFromEmbedderDataInCreationContext with " "EmbedderDataTypeTag parameter instead.") void* GetAlignedPointerFromEmbedderDataInCreationContext(int index) { diff --git a/deps/v8/include/v8-platform.h b/deps/v8/include/v8-platform.h index 8d87fe973bc945..83763bbdcb625f 100644 --- a/deps/v8/include/v8-platform.h +++ b/deps/v8/include/v8-platform.h @@ -369,7 +369,7 @@ class ConvertableToTraceFormat { * * Can be implemented by an embedder to record trace events from V8. * - * Will become obsolete in Perfetto SDK build (v8_use_perfetto = true). + * Will become obsolete in Perfetto build (v8_use_perfetto = true). */ class TracingController { public: diff --git a/deps/v8/include/v8-primitive.h b/deps/v8/include/v8-primitive.h index 87215cf6ece31d..457a8838461faa 100644 --- a/deps/v8/include/v8-primitive.h +++ b/deps/v8/include/v8-primitive.h @@ -199,7 +199,7 @@ class V8_EXPORT String : public Name { * the end of the buffer. If null termination is requested, the output buffer * will always be null terminated even if not all characters fit. In that * case, the capacity must be at least one. The required size of the output - * buffer can be determined using Utf8Length(). + * buffer can be determined using Utf8LengthV2(). * * \param buffer The buffer into which the string will be written. * \param capacity The number of bytes available in the output buffer. diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index 61f427ea47c691..f46c492d4f1660 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -48,6 +48,21 @@ template class V8_EXPORT std::vector; namespace v8 { +/** + * Identifies which component initiated CPU profiling for proper attribution. + */ +enum class CpuProfileSource : uint8_t { + /** Default value when no explicit source is specified. */ + kUnspecified = 0, + /** Profiling initiated via the DevTools Inspector protocol. */ + kInspector = 1, + /** Profiling initiated by the embedder (e.g., Blink) via self-profiling API. + */ + kSelfProfiling = 2, + /** Profiling initiated internally by V8 (e.g., tracing CPU profiler). */ + kInternal = 3, +}; + struct V8_EXPORT CpuProfileDeoptInfo { /** A pointer to a static string owned by v8. */ const char* deopt_reason; @@ -378,11 +393,13 @@ class V8_EXPORT CpuProfilingOptions { * the profiler's sampling interval. * \param filter_context If specified, profiles will only contain frames * using this context. Other frames will be elided. + * \param profile_source Identifies the source of this CPU profile. */ CpuProfilingOptions( CpuProfilingMode mode = kLeafNodeLineNumbers, unsigned max_samples = kNoSampleLimit, int sampling_interval_us = 0, - MaybeLocal filter_context = MaybeLocal()); + MaybeLocal filter_context = MaybeLocal(), + CpuProfileSource profile_source = CpuProfileSource::kUnspecified); CpuProfilingOptions(CpuProfilingOptions&&) = default; CpuProfilingOptions& operator=(CpuProfilingOptions&&) = default; @@ -390,6 +407,7 @@ class V8_EXPORT CpuProfilingOptions { CpuProfilingMode mode() const { return mode_; } unsigned max_samples() const { return max_samples_; } int sampling_interval_us() const { return sampling_interval_us_; } + CpuProfileSource profile_source() const { return profile_source_; } private: friend class internal::CpuProfile; @@ -401,6 +419,7 @@ class V8_EXPORT CpuProfilingOptions { unsigned max_samples_; int sampling_interval_us_; Global filter_context_; + CpuProfileSource profile_source_; }; /** diff --git a/deps/v8/include/v8-promise.h b/deps/v8/include/v8-promise.h index 8c127c8122a2ec..36412c774d1b51 100644 --- a/deps/v8/include/v8-promise.h +++ b/deps/v8/include/v8-promise.h @@ -19,7 +19,7 @@ class Context; #endif /** - * An instance of the built-in Promise constructor (ES6 draft). + * An instance of the built-in Promise constructor. */ class V8_EXPORT Promise : public Object { public: @@ -65,10 +65,21 @@ class V8_EXPORT Promise : public Object { }; /** - * Register a resolution/rejection handler with a promise. - * The handler is given the respective resolution/rejection value as - * an argument. If the promise is already resolved/rejected, the handler is - * invoked at the end of turn. + * Register a resolution/rejection handler with a promise. The handler is + * given the respective resolution/rejection value as an argument. If the + * promise is already resolved/rejected, the handler is invoked at the end of + * turn. + * + * This performs the PerformPromiseThen abstract operation with a fresh native + * promise as result, rather than the similar Promise.prototype.then + * operation. In particular, it does not do species lookup on the Promise + * constructor, and is therefore guaranteed to return a Promise. + * + * https://tc39.es/ecma262/#sec-performpromisethen + * + * This is consistent with Promise reactions in WebIDL: + * + * https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled */ V8_WARN_UNUSED_RESULT MaybeLocal Catch(Local context, Local handler); diff --git a/deps/v8/include/v8-script.h b/deps/v8/include/v8-script.h index debe89b50847ea..c07d95515e842f 100644 --- a/deps/v8/include/v8-script.h +++ b/deps/v8/include/v8-script.h @@ -187,6 +187,13 @@ class V8_EXPORT Module : public Data { kErrored }; + /** + * If the module is a Source Text Module, returns the name that was passed + * by the embedder as resource_name to the ScriptOrigin. If it's a Synthetic + * Module, returns the module_name passed to CreateSyntheticModule(). + */ + Local GetResourceName() const; + /** * Returns the module's current status. */ diff --git a/deps/v8/include/v8-template.h b/deps/v8/include/v8-template.h index 3eff0105f18a86..6eaf6508445218 100644 --- a/deps/v8/include/v8-template.h +++ b/deps/v8/include/v8-template.h @@ -139,7 +139,7 @@ class V8_EXPORT Template : public Data { enum class Intercepted : uint8_t { kNo = 0, kYes = 1 }; /** - * Interceptor for get requests on an object. + * Interceptor for [[Get]] requests on an object. * * If the interceptor handles the request (i.e. the property should not be * looked up beyond the interceptor or in case an exception was thrown) it @@ -153,8 +153,8 @@ enum class Intercepted : uint8_t { kNo = 0, kYes = 1 }; * \param property The name of the property for which the request was * intercepted. * \param info Information about the intercepted request, such as - * isolate, receiver, return value, or whether running in `'use strict'` mode. - * See `PropertyCallbackInfo`. + * isolate, object holding the property, return value. See + * `PropertyCallbackInfo`. * * \code * Intercepted GetterCallback( @@ -183,17 +183,20 @@ enum class Intercepted : uint8_t { kNo = 0, kYes = 1 }; */ using NamedPropertyGetterCallback = Intercepted (*)( Local property, const PropertyCallbackInfo& info); -// This variant will be deleted soon. -using GenericNamedPropertyGetterCallback V8_DEPRECATED( - "Use NamedPropertyGetterCallback instead") = - void (*)(Local property, const PropertyCallbackInfo& info); /** - * Interceptor for set requests on an object. + * Interceptor for [[Set]] requests on an object. * * If the interceptor handles the request (i.e. the property should not be * looked up beyond the interceptor or in case an exception was thrown) it - * should return `Intercepted::kYes`. + * should + * - use `info.GetReturnValue().Set(false)` to indicate that the operation + * failed, + * - (optionally) upon operation failure and info.ShouldThrowOnError() + * is true (indicating execution in `'use strict'` mode) the callback can + * throw TypeError if the error message needs to include more details than + * a TypeError thrown by V8 in this case, + * - return `Intercepted::kYes`. * If the interceptor does not handle the request it must return * `Intercepted::kNo` and it must not produce side effects. * @@ -202,24 +205,19 @@ using GenericNamedPropertyGetterCallback V8_DEPRECATED( * \param value The value which the property will have if the request * is not intercepted. * \param info Information about the intercepted request, such as - * isolate, receiver, return value, or whether running in `'use strict'` mode. - * See `PropertyCallbackInfo`. + * isolate, object holding the property, return value, or whether running in + * `'use strict'` mode. See `PropertyCallbackInfo`. * * See also `ObjectTemplate::SetHandler.` */ using NamedPropertySetterCallback = Intercepted (*)(Local property, Local value, const PropertyCallbackInfo& info); -// This variant will be deleted soon. -using GenericNamedPropertySetterCallback V8_DEPRECATED( - "Use NamedPropertySetterCallback instead") = - void (*)(Local property, Local value, - const PropertyCallbackInfo& info); /** - * Intercepts all requests that query the attributes of the - * property, e.g., getOwnPropertyDescriptor(), propertyIsEnumerable(), and - * defineProperty(). + * Intercepts all requests that query the attributes of the property, + * e.g. [[GetOwnProperty]], [[DefineOwnProperty]], [[Set]] and derived ones + * like Object.prototype.propertyIsEnumerable() and similar. * * If the interceptor handles the request (i.e. the property should not be * looked up beyond the interceptor or in case an exception was thrown) it @@ -244,19 +242,19 @@ using GenericNamedPropertySetterCallback V8_DEPRECATED( */ using NamedPropertyQueryCallback = Intercepted (*)( Local property, const PropertyCallbackInfo& info); -// This variant will be deleted soon. -using GenericNamedPropertyQueryCallback V8_DEPRECATED( - "Use NamedPropertyQueryCallback instead") = - void (*)(Local property, const PropertyCallbackInfo& info); /** - * Interceptor for delete requests on an object. + * Interceptor for [[Delete]] requests on an object. * * If the interceptor handles the request (i.e. the property should not be * looked up beyond the interceptor or in case an exception was thrown) it * should - * - (optionally) use `info.GetReturnValue().Set()` to set to a Boolean value - * indicating whether the property deletion was successful or not, + * - use `info.GetReturnValue().Set(false)` to indicate that the operation + * failed, + * - (optionally) upon operation failure and info.ShouldThrowOnError() + * is true (indicating execution in `'use strict'` mode) the callback can + * throw TypeError if the error message needs to include more details than + * a TypeError thrown by V8 in this case, * - return `Intercepted::kYes`. * If the interceptor does not handle the request it must return * `Intercepted::kNo` and it must not produce side effects. @@ -264,21 +262,13 @@ using GenericNamedPropertyQueryCallback V8_DEPRECATED( * \param property The name of the property for which the request was * intercepted. * \param info Information about the intercepted request, such as - * isolate, receiver, return value, or whether running in `'use strict'` mode. - * See `PropertyCallbackInfo`. - * - * \note If you need to mimic the behavior of `delete`, i.e., throw in strict - * mode instead of returning false, use `info.ShouldThrowOnError()` to determine - * if you are in strict mode. + * isolate, object holding the property, return value, or whether running in + * `'use strict'` mode. See `PropertyCallbackInfo`. * * See also `ObjectTemplate::SetHandler.` */ using NamedPropertyDeleterCallback = Intercepted (*)( Local property, const PropertyCallbackInfo& info); -// This variant will be deleted soon. -using GenericNamedPropertyDeleterCallback V8_DEPRECATED( - "Use NamedPropertyDeleterCallback instead") = - void (*)(Local property, const PropertyCallbackInfo& info); /** * Returns an array containing the names of the properties the named @@ -288,18 +278,20 @@ using GenericNamedPropertyDeleterCallback V8_DEPRECATED( */ using NamedPropertyEnumeratorCallback = void (*)(const PropertyCallbackInfo& info); -// This variant will be deleted soon. -// This is just a renaming of the typedef. -using GenericNamedPropertyEnumeratorCallback V8_DEPRECATED( - "Use NamedPropertyEnumeratorCallback instead") = - NamedPropertyEnumeratorCallback; /** - * Interceptor for defineProperty requests on an object. + * Interceptor for [[DefineOwnProperty]] requests on an object. * * If the interceptor handles the request (i.e. the property should not be * looked up beyond the interceptor or in case an exception was thrown) it - * should return `Intercepted::kYes`. + * should + * - use `info.GetReturnValue().Set(false)` to indicate that the operation + * failed, + * - (optionally) upon operation failure and info.ShouldThrowOnError() + * is true (indicating execution in `'use strict'` mode) the callback can + * throw TypeError if the error message needs to include more details than + * a TypeError thrown by V8 in this case, + * - return `Intercepted::kYes`. * If the interceptor does not handle the request it must return * `Intercepted::kNo` and it must not produce side effects. * @@ -308,22 +300,17 @@ using GenericNamedPropertyEnumeratorCallback V8_DEPRECATED( * \param desc The property descriptor which is used to define the * property if the request is not intercepted. * \param info Information about the intercepted request, such as - * isolate, receiver, return value, or whether running in `'use strict'` mode. - * See `PropertyCallbackInfo`. + * isolate, object holding the property, return value, or whether running in + * `'use strict'` mode. See `PropertyCallbackInfo`. * * See also `ObjectTemplate::SetHandler`. */ using NamedPropertyDefinerCallback = Intercepted (*)(Local property, const PropertyDescriptor& desc, const PropertyCallbackInfo& info); -// This variant will be deleted soon. -using GenericNamedPropertyDefinerCallback V8_DEPRECATED( - "Use NamedPropertyDefinerCallback instead") = - void (*)(Local property, const PropertyDescriptor& desc, - const PropertyCallbackInfo& info); /** - * Interceptor for getOwnPropertyDescriptor requests on an object. + * Interceptor for [[GetOwnProperty]] requests on an object. * * If the interceptor handles the request (i.e. the property should not be * looked up beyond the interceptor or in case an exception was thrown) it @@ -341,17 +328,10 @@ using GenericNamedPropertyDefinerCallback V8_DEPRECATED( * isolate, receiver, return value, or whether running in `'use strict'` mode. * See `PropertyCallbackInfo`. * - * \note If GetOwnPropertyDescriptor is intercepted, it will - * always return true, i.e., indicate that the property was found. - * * See also `ObjectTemplate::SetHandler`. */ using NamedPropertyDescriptorCallback = Intercepted (*)( Local property, const PropertyCallbackInfo& info); -// This variant will be deleted soon. -using GenericNamedPropertyDescriptorCallback V8_DEPRECATED( - "Use NamedPropertyDescriptorCallback instead") = - void (*)(Local property, const PropertyCallbackInfo& info); // TODO(ishell): Rename IndexedPropertyXxxCallbackV2 back to // IndexedPropertyXxxCallback once the old IndexedPropertyXxxCallback is @@ -362,41 +342,24 @@ using GenericNamedPropertyDescriptorCallback V8_DEPRECATED( */ using IndexedPropertyGetterCallbackV2 = Intercepted (*)(uint32_t index, const PropertyCallbackInfo& info); -// This variant will be deleted soon. -using IndexedPropertyGetterCallback V8_DEPRECATED( - "Use IndexedPropertyGetterCallbackV2 instead") = - void (*)(uint32_t index, const PropertyCallbackInfo& info); /** * See `v8::NamedPropertySetterCallback`. */ using IndexedPropertySetterCallbackV2 = Intercepted (*)( uint32_t index, Local value, const PropertyCallbackInfo& info); -// This variant will be deleted soon. -using IndexedPropertySetterCallback V8_DEPRECATED( - "Use IndexedPropertySetterCallbackV2 instead") = - void (*)(uint32_t index, Local value, - const PropertyCallbackInfo& info); /** * See `v8::NamedPropertyQueryCallback`. */ using IndexedPropertyQueryCallbackV2 = Intercepted (*)(uint32_t index, const PropertyCallbackInfo& info); -// This variant will be deleted soon. -using IndexedPropertyQueryCallback V8_DEPRECATED( - "Use IndexedPropertyQueryCallbackV2 instead") = - void (*)(uint32_t index, const PropertyCallbackInfo& info); /** * See `v8::NamedPropertyDeleterCallback`. */ using IndexedPropertyDeleterCallbackV2 = Intercepted (*)(uint32_t index, const PropertyCallbackInfo& info); -// This variant will be deleted soon. -using IndexedPropertyDeleterCallback V8_DEPRECATED( - "Use IndexedPropertyDeleterCallbackV2 instead") = - void (*)(uint32_t index, const PropertyCallbackInfo& info); /** * Returns an array containing the indices of the properties the indexed @@ -413,21 +376,12 @@ using IndexedPropertyEnumeratorCallback = using IndexedPropertyDefinerCallbackV2 = Intercepted (*)(uint32_t index, const PropertyDescriptor& desc, const PropertyCallbackInfo& info); -// This variant will be deleted soon. -using IndexedPropertyDefinerCallback V8_DEPRECATED( - "Use IndexedPropertyDefinerCallbackV2 instead") = - void (*)(uint32_t index, const PropertyDescriptor& desc, - const PropertyCallbackInfo& info); /** * See `v8::NamedPropertyDescriptorCallback`. */ using IndexedPropertyDescriptorCallbackV2 = Intercepted (*)(uint32_t index, const PropertyCallbackInfo& info); -// This variant will be deleted soon. -using IndexedPropertyDescriptorCallback V8_DEPRECATED( - "Use IndexedPropertyDescriptorCallbackV2 instead") = - void (*)(uint32_t index, const PropertyCallbackInfo& info); /** * Returns true if the given context should be allowed to access the given @@ -597,7 +551,7 @@ class V8_EXPORT FunctionTemplate : public Template { * API call, see the comment above the class declaration. */ void SetCallHandler( - FunctionCallback callback, Local data = Local(), + FunctionCallback callback, Local data = {}, SideEffectType side_effect_type = SideEffectType::kHasSideEffect, const MemorySpan& c_function_overloads = {}); diff --git a/deps/v8/include/v8-trace-categories.h b/deps/v8/include/v8-trace-categories.h index 9072cb45675620..777116a02904d5 100644 --- a/deps/v8/include/v8-trace-categories.h +++ b/deps/v8/include/v8-trace-categories.h @@ -5,11 +5,15 @@ #ifndef INCLUDE_V8_TRACE_CATEGORIES_H_ #define INCLUDE_V8_TRACE_CATEGORIES_H_ -#include "v8config.h" +#include "v8config.h" // NOLINT(build/include_directory) #if defined(V8_USE_PERFETTO) +#if defined(V8_USE_PERFETTO_SDK) +#include "perfetto.h" // NOLINT(build/include_directory) +#else #include "perfetto/tracing/track_event.h" +#endif namespace v8 { diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index d094da01d71a80..9cb6c285713e03 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 14 -#define V8_MINOR_VERSION 3 -#define V8_BUILD_NUMBER 127 -#define V8_PATCH_LEVEL 17 +#define V8_MINOR_VERSION 4 +#define V8_BUILD_NUMBER 258 +#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-wasm.h b/deps/v8/include/v8-wasm.h index 5483421f40ff50..ec2c2929bdd92d 100644 --- a/deps/v8/include/v8-wasm.h +++ b/deps/v8/include/v8-wasm.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "v8-internal.h" // NOLINT(build/include_directory) #include "v8-local-handle.h" // NOLINT(build/include_directory) @@ -20,12 +21,9 @@ namespace v8 { class ArrayBuffer; class Promise; -namespace internal { -namespace wasm { +namespace internal::wasm { class NativeModule; -class StreamingDecoder; -} // namespace wasm -} // namespace internal +} // namespace internal::wasm /** * An owned byte buffer with associated size. @@ -38,8 +36,10 @@ struct OwnedBuffer { OwnedBuffer() = default; }; -// Wrapper around a compiled WebAssembly module, which is potentially shared by -// different WasmModuleObjects. +/** + * Wrapper around a compiled WebAssembly module, which is potentially shared by + * different WasmModuleObjects. + */ class V8_EXPORT CompiledWasmModule { public: /** @@ -56,11 +56,12 @@ class V8_EXPORT CompiledWasmModule { const std::string& source_url() const { return source_url_; } private: + friend class WasmModuleCompilation; friend class WasmModuleObject; friend class WasmStreaming; explicit CompiledWasmModule(std::shared_ptr, - const char* source_url, size_t url_length); + std::string source_url); const std::shared_ptr native_module_; const std::string source_url_; @@ -188,7 +189,8 @@ class V8_EXPORT WasmStreaming final { * must not be called after {Abort} has been called already. * If {SetHasCompiledModuleBytes()} was called before, a {caching_callback} * can be passed which can inspect the full received wire bytes and set cached - * module bytes which will be deserialized then. + * module bytes which will be deserialized then. This callback will happen + * synchronously within this call; the callback is not stored. */ void Finish(const ModuleCachingCallback& caching_callback); @@ -257,6 +259,87 @@ class V8_EXPORT WasmStreaming final { MemorySpan cached_compiled_module_bytes_; }; +/** + * An interface for asynchronous WebAssembly module compilation, to be used e.g. + * for implementing source phase imports. + * Note: This interface is experimental and can change or be removed without + * notice. + */ +class V8_EXPORT WasmModuleCompilation final { + public: + using ModuleCachingCallback = WasmStreaming::ModuleCachingCallback; + + /** + * Start an asynchronous module compilation. This can be called on any thread. + * TODO(clemensb): Add some way to pass enabled features. + * TODO(clemensb): Add some way to pass compile time imports. + */ + WasmModuleCompilation(); + + ~WasmModuleCompilation(); + + WasmModuleCompilation(const WasmModuleCompilation&) = delete; + WasmModuleCompilation& operator=(const WasmModuleCompilation&) = delete; + + /** + * Pass a new chunk of bytes to WebAssembly compilation. + * The buffer passed into {OnBytesReceived} is owned by the caller and will + * not be accessed any more after this call returns. + */ + void OnBytesReceived(const uint8_t* bytes, size_t size); + + /** + * {Finish} must be called on the main thread after all bytes were passed to + * {OnBytesReceived}. + * It eventually calls the provided callback to deliver the compiled module or + * an error. This callback will also be called in foreground, but not + * necessarily within this call. + * {Finish} must not be called after {Abort} has been called already. + * If {SetHasCompiledModuleBytes()} was called before, a {caching_callback} + * can be passed which can inspect the full received wire bytes and set cached + * module bytes which will be deserialized then. This callback will happen + * synchronously within this call; the callback is not stored. + */ + void Finish( + Isolate*, const ModuleCachingCallback& caching_callback, + const std::function, Local> module_or_error)>& + resolution_callback); + + /** + * Abort compilation. This can be called from any thread. + * {Abort} must not be called repeatedly, or after {Finish}. + */ + void Abort(); + + /** + * Mark that the embedder has (potentially) cached compiled module bytes (i.e. + * a serialized {CompiledWasmModule}) that could match this streaming request. + * This will cause V8 to skip streaming compilation. + * The embedder should then pass a callback to the {Finish} method to pass the + * serialized bytes, after potentially checking their validity against the + * full received wire bytes. + */ + void SetHasCompiledModuleBytes(); + + /** + * Sets a callback which is called whenever a significant number of new + * functions are ready for serialization. + */ + void SetMoreFunctionsCanBeSerializedCallback( + std::function); + + /* + * Sets the UTF-8 encoded source URL for the {Script} object. This must be + * called before {Finish}. + */ + void SetUrl(const char* url, size_t length); + + private: + class Impl; + const std::unique_ptr impl_; +}; + /** * The V8 interface for a WebAssembly memory map descriptor. This is an * experimental feature that may change and be removed without further diff --git a/deps/v8/include/v8config.h b/deps/v8/include/v8config.h index 6dbda2b1b40fce..06a515ae94da9f 100644 --- a/deps/v8/include/v8config.h +++ b/deps/v8/include/v8config.h @@ -1067,4 +1067,12 @@ arm64 host #define V8_TARGET_BIG_ENDIAN_BOOL false #endif +// V8_USE_PERFETTO_SDK and V8_USE_PERFETTO_JSON_EXPORT must imply +// V8_USE_PERFETTO. +#if (defined(V8_USE_PERFETTO_SDK) || defined(V8_USE_PERFETTO_JSON_EXPORT)) && \ + !defined(V8_USE_PERFETTO) +#error Inconsistent build configuration: To build the V8 with Perfetto \ +features, set V8_USE_PERFETTO as well. +#endif + #endif // V8CONFIG_H_ diff --git a/deps/v8/infra/mb/mb_config.pyl b/deps/v8/infra/mb/mb_config.pyl index 566b46fc3ff4e7..bc3696df78b7ef 100644 --- a/deps/v8/infra/mb/mb_config.pyl +++ b/deps/v8/infra/mb/mb_config.pyl @@ -164,7 +164,7 @@ 'V8 Clusterfuzz Linux ASAN no inline - release builder': 'release_x86_asan_symbolized_verify_heap_undefined_double', 'V8 Clusterfuzz Linux64 ASAN - debug builder': 'debug_x64_asan_undefined_double', - 'V8 Clusterfuzz Linux64 ASAN - undefined double - debug builder': 'debug_x64_asan_undefined_double', + 'V8 Clusterfuzz Linux64 ASAN - undefined double - debug builder': 'debug_x64_asan', 'V8 Clusterfuzz Linux ASAN - debug builder': 'debug_x86_asan_undefined_double', 'V8 Clusterfuzz Linux64 ASAN arm64 - debug builder': 'debug_simulate_arm64_asan_undefined_double', @@ -185,6 +185,9 @@ 'V8 Clusterfuzz Linux64 ASAN sandbox testing - release builder': 'release_x64_asan_sandbox_testing_undefined_double', }, + 'client.v8.fuzzilli' : { + 'V8 Linux64 - builder': 'release_x64', + }, 'client.v8.perf' : { # Arm 'V8 Arm - builder - perf': 'official_arm', @@ -233,8 +236,6 @@ 'V8 Linux - ppc64 - sim - builder': 'release_simulate_ppc64', 'V8 Linux - s390x - sim - builder': 'release_simulate_s390x', # RISC-V - 'V8 Linux - riscv32 - sim - debug builder': 'debug_simulate_riscv32', - 'V8 Linux - riscv32 - sim - builder': 'release_simulate_riscv32', 'V8 Linux - riscv64 - sim - debug builder': 'debug_simulate_riscv64', 'V8 Linux - riscv64 - sim - builder': 'release_simulate_riscv64', 'V8 Linux - riscv64 - sim - pointer compression - builder': 'release_simulate_riscv64_pointer_compression', @@ -311,8 +312,6 @@ 'v8_linux64_loong64_compile_rel': 'release_simulate_loong64', 'v8_linux64_lower_limits_compile_rel': 'release_x64_lower_limits', 'v8_linux64_msan_compile_rel': 'release_simulate_arm64_msan_minimal_symbols', - 'v8_linux_riscv32_compile_dbg': 'debug_simulate_riscv32', - 'v8_linux_riscv32_compile_rel': 'release_simulate_riscv32', 'v8_linux64_riscv64_compile_dbg': 'debug_simulate_riscv64', 'v8_linux64_riscv64_compile_rel': 'release_simulate_riscv64', 'v8_linux64_riscv64_pointer_compression_compile_rel': 'release_simulate_riscv64_pointer_compression', @@ -465,8 +464,6 @@ 'debug_simulate_arm64_asan_undefined_double': [ 'debug_bot', 'simulate_arm64', 'asan', 'lsan', 'v8_enable_undefined_double'], - 'debug_simulate_riscv32': [ - 'debug_bot', 'simulate_riscv32'], 'debug_simulate_riscv64': [ 'debug_bot', 'simulate_riscv64'], @@ -503,8 +500,6 @@ 'release_bot', 'simulate_mips64el'], 'release_simulate_ppc64': [ 'release_bot', 'simulate_ppc64'], - 'release_simulate_riscv32': [ - 'release_bot', 'simulate_riscv32'], 'release_simulate_riscv64': [ 'release_bot', 'simulate_riscv64'], 'release_simulate_riscv64_pointer_compression': [ @@ -597,8 +592,8 @@ 'release_bot', 'x64', 'asan', 'dcheck_always_on', 'v8_enable_slow_dchecks', 'v8_verify_heap', 'v8_enable_undefined_double'], 'release_x64_sandbox_testing_undefined_double': [ - 'release_bot', 'x64', 'symbolized', 'backtrace', 'v8_enable_memory_corruption_api', - 'v8_enable_undefined_double'], + 'release_bot', 'x64', 'symbolized', 'backtrace', 'trace_pc_guard', + 'v8_enable_memory_corruption_api', 'v8_enable_undefined_double'], 'release_x64_asan_sandbox_testing_undefined_double': [ 'release_bot', 'x64', 'asan', 'symbolized', 'v8_enable_memory_corruption_api', 'v8_enable_undefined_double'], @@ -689,6 +684,8 @@ # Debug configs for x64. 'debug_x64': [ 'debug_bot', 'x64'], + 'debug_x64_asan': [ + 'debug_bot', 'x64', 'asan', 'lsan'], 'debug_x64_asan_undefined_double': [ 'debug_bot', 'x64', 'asan', 'lsan', 'v8_enable_undefined_double'], 'debug_x64_asan_centipede': [ @@ -1031,10 +1028,6 @@ 'gn_args': 'target_cpu="x64" v8_target_cpu="ppc64"', }, - 'simulate_riscv32': { - 'gn_args': 'target_cpu="x86" v8_target_cpu="riscv32"', - }, - 'simulate_riscv64': { 'gn_args': 'target_cpu="x64" v8_target_cpu="riscv64"', }, @@ -1052,6 +1045,11 @@ 'gn_args': 'v8_no_inline=true', }, + 'trace_pc_guard': { + 'gn_args': 'sanitizer_coverage_flags="trace-pc-guard" ' + 'v8_enable_partition_alloc=false', + }, + 'tsan': { 'mixins': ['v8_enable_test_features'], 'gn_args': 'is_tsan=true', diff --git a/deps/v8/infra/testing/builders.pyl b/deps/v8/infra/testing/builders.pyl index 1117068160c9f1..fe6a3c08a18dd7 100644 --- a/deps/v8/infra/testing/builders.pyl +++ b/deps/v8/infra/testing/builders.pyl @@ -962,28 +962,12 @@ }, ############################################################################## # Linux with RISC-V simulators - 'v8_linux_riscv32_dbg': { - 'swarming_dimensions': { - 'os': 'Ubuntu-22.04', - }, - 'tests': [ - {'name': 'v8testing', 'shards': 6}, - ], - }, - 'v8_linux_riscv32_rel': { - 'swarming_dimensions': { - 'os': 'Ubuntu-22.04', - }, - 'tests': [ - {'name': 'v8testing', 'shards': 3}, - ], - }, 'v8_linux64_riscv64_dbg': { 'swarming_dimensions': { 'os': 'Ubuntu-22.04', }, 'tests': [ - {'name': 'v8testing', 'shards': 6}, + {'name': 'v8testing', 'shards': 9}, ], }, 'v8_linux64_riscv64_rel': { @@ -991,7 +975,7 @@ 'os': 'Ubuntu-22.04', }, 'tests': [ - {'name': 'v8testing', 'shards': 3}, + {'name': 'v8testing', 'shards': 4}, ], }, 'v8_linux64_riscv64_pointer_compression_rel': { @@ -999,7 +983,7 @@ 'os': 'Ubuntu-22.04', }, 'tests': [ - {'name': 'v8testing', 'shards': 3}, + {'name': 'v8testing', 'shards': 4}, ], }, ############################################################################## @@ -1577,6 +1561,17 @@ }, ], }, + # Used for Fuzzilli imports. + 'V8 Linux64 - builder': { + 'swarming_dimensions' : { + 'cpu': 'x86-64-avx2', + 'os': 'Ubuntu-22.04', + }, + 'tests': [ + {'name': 'mjsunit'}, + {'name': 'test262', 'shards': 2}, + ], + }, 'V8 Linux64 - official': { 'swarming_dimensions' : { 'cpu': 'x86-64-avx2', @@ -1994,7 +1989,7 @@ 'os': 'Ubuntu-22.04', }, 'tests': [ - {'name': 'test262', 'shards': 7}, + {'name': 'test262', 'shards': 10}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, {'name': 'v8testing', 'variant': 'slow_path', 'shards': 1}, @@ -2589,32 +2584,6 @@ {'name': 'v8testing', 'shards': 3}, ], }, - 'V8 Linux - riscv32 - sim - debug': { - 'swarming_dimensions': { - 'os': 'Ubuntu-22.04', - }, - 'swarming_task_attrs': { - 'expiration': 14400, - 'hard_timeout': 3600, - 'priority': 35, - }, - 'tests': [ - {'name': 'v8testing', 'shards': 6}, - ], - }, - 'V8 Linux - riscv32 - sim': { - 'swarming_dimensions': { - 'os': 'Ubuntu-22.04', - }, - 'swarming_task_attrs': { - 'expiration': 14400, - 'hard_timeout': 3600, - 'priority': 35, - }, - 'tests': [ - {'name': 'v8testing', 'shards': 3}, - ], - }, 'V8 Linux - riscv64 - sim - debug': { 'swarming_dimensions': { 'os': 'Ubuntu-22.04', diff --git a/deps/v8/src/api/api-arguments-inl.h b/deps/v8/src/api/api-arguments-inl.h index 2f9c0faab2ee33..df78a4d2743fc9 100644 --- a/deps/v8/src/api/api-arguments-inl.h +++ b/deps/v8/src/api/api-arguments-inl.h @@ -36,12 +36,12 @@ Handle CustomArguments::GetReturnValue(Isolate* isolate) const { return Cast(Handle(slot.location())); } -inline Tagged PropertyCallbackArguments::holder() const { - return Cast(*slot_at(T::kHolderIndex)); +inline DirectHandle PropertyCallbackArguments::holder() const { + return DirectHandle::FromSlot(slot_at(T::kHolderIndex).location()); } -inline Tagged PropertyCallbackArguments::receiver() const { - return *slot_at(T::kThisIndex); +inline DirectHandle PropertyCallbackArguments::receiver() const { + return DirectHandle::FromSlot(slot_at(T::kThisIndex).location()); } #define DCHECK_NAME_COMPATIBLE(interceptor, name) \ @@ -74,6 +74,20 @@ inline Tagged PropertyCallbackArguments::receiver() const { ExternalCallbackScope call_scope(ISOLATE, FUNCTION_ADDR(F), \ EXCEPTION_CONTEXT, &callback_info); +FunctionCallbackArguments::FunctionCallbackArguments( + Isolate* isolate, Tagged target, + Tagged new_target, Address* argv, int argc) + : Super(isolate), argv_(argv), argc_(argc) { + slot_at(T::kTargetIndex).store(target); + slot_at(T::kUnusedIndex).store(ReadOnlyRoots(isolate).undefined_value()); + slot_at(T::kNewTargetIndex).store(new_target); + slot_at(T::kIsolateIndex) + .store(Tagged(reinterpret_cast
(isolate))); + slot_at(T::kReturnValueIndex).store(ReadOnlyRoots(isolate).undefined_value()); + slot_at(T::kContextIndex).store(isolate->context()); + DCHECK(IsSmi(*slot_at(T::kIsolateIndex))); +} + DirectHandle FunctionCallbackArguments::CallOrConstruct( Tagged function, bool is_construct) { Isolate* isolate = this->isolate(); @@ -94,6 +108,37 @@ DirectHandle FunctionCallbackArguments::CallOrConstruct( return GetReturnValue(isolate); } +PropertyCallbackArguments::PropertyCallbackArguments( + Isolate* isolate, Tagged self, Tagged holder, + Maybe should_throw) + : Super(isolate) +#ifdef DEBUG + , + javascript_execution_counter_(isolate->javascript_execution_counter()) +#endif // DEBUG +{ + if (DEBUG_BOOL) { + // Zap these fields to ensure that they are initialized by a subsequent + // CallXXX(..). + Tagged zap_value(kZapValue); + slot_at(T::kPropertyKeyIndex).store(zap_value); + slot_at(T::kReturnValueIndex).store(zap_value); + slot_at(T::kCallbackInfoIndex).store(zap_value); + } + slot_at(T::kThisIndex).store(self); + slot_at(T::kHolderIndex).store(holder); + DCHECK(!IsJSGlobalObject(*holder)); + slot_at(T::kIsolateIndex) + .store(Tagged(reinterpret_cast
(isolate))); + int value = Internals::kInferShouldThrowMode; + if (should_throw.IsJust()) { + value = should_throw.FromJust(); + } + slot_at(T::kShouldThrowOnErrorIndex).store(Smi::FromInt(value)); + slot_at(T::kUnusedIndex).store(Smi::zero()); + DCHECK(IsSmi(*slot_at(T::kIsolateIndex))); +} + PropertyCallbackArguments::~PropertyCallbackArguments(){ #ifdef DEBUG // TODO(chromium:1310062): enable this check. @@ -132,15 +177,6 @@ Maybe PropertyCallbackArguments::GetBooleanReturnValue( if (ignore_return_value) return Just(InterceptorResult::kTrue); bool result = IsTrue(*GetReturnValue(isolate), isolate); - - // TODO(ishell, 348688196): ensure callbacks comply with this and - // enable the check. - if ((false) && DEBUG_BOOL && !result && ShouldThrowOnError()) { - FATAL( - "Check failed: %s interceptor callback hasn't thrown an " - "exception on failure as requested.", - callback_kind_for_error_message); - } return Just(result ? InterceptorResult::kTrue : InterceptorResult::kFalse); } @@ -161,6 +197,7 @@ DirectHandle PropertyCallbackArguments::CallNamedQuery( DCHECK_NAME_COMPATIBLE(interceptor, name); Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedQueryCallback); + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(*name); slot_at(kReturnValueIndex).store(Smi::FromInt(v8::None)); NamedPropertyQueryCallback f = reinterpret_cast( @@ -177,6 +214,7 @@ DirectHandle PropertyCallbackArguments::CallNamedGetter( DCHECK_NAME_COMPATIBLE(interceptor, name); Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedGetterCallback); + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(*name); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).undefined_value()); NamedPropertyGetterCallback f = reinterpret_cast( @@ -193,6 +231,7 @@ Handle PropertyCallbackArguments::CallNamedDescriptor( DCHECK_NAME_COMPATIBLE(interceptor, name); Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedDescriptorCallback); + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(*name); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).undefined_value()); NamedPropertyDescriptorCallback f = @@ -211,6 +250,7 @@ v8::Intercepted PropertyCallbackArguments::CallNamedSetter( DCHECK_NAME_COMPATIBLE(interceptor, name); Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedSetterCallback); + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(*name); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value()); NamedPropertySetterCallback f = reinterpret_cast( @@ -229,6 +269,7 @@ v8::Intercepted PropertyCallbackArguments::CallNamedDefiner( DCHECK_NAME_COMPATIBLE(interceptor, name); Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedDefinerCallback); + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(*name); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value()); NamedPropertyDefinerCallback f = @@ -247,6 +288,7 @@ v8::Intercepted PropertyCallbackArguments::CallNamedDeleter( DCHECK_NAME_COMPATIBLE(interceptor, name); Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedDeleterCallback); + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(*name); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value()); NamedPropertyDeleterCallback f = @@ -277,6 +319,7 @@ DirectHandle PropertyCallbackArguments::CallIndexedQuery( Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kIndexedQueryCallback); index_ = index; + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(Smi::zero()); // indexed callback marker slot_at(kReturnValueIndex).store(Smi::FromInt(v8::None)); IndexedPropertyQueryCallbackV2 f = @@ -295,6 +338,7 @@ DirectHandle PropertyCallbackArguments::CallIndexedGetter( Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedGetterCallback); index_ = index; + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(Smi::zero()); // indexed callback marker slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).undefined_value()); IndexedPropertyGetterCallbackV2 f = @@ -313,6 +357,7 @@ Handle PropertyCallbackArguments::CallIndexedDescriptor( Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kIndexedDescriptorCallback); index_ = index; + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(Smi::zero()); // indexed callback marker slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).undefined_value()); IndexedPropertyDescriptorCallbackV2 f = @@ -332,6 +377,7 @@ v8::Intercepted PropertyCallbackArguments::CallIndexedSetter( Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kIndexedSetterCallback); index_ = index; + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(Smi::zero()); // indexed callback marker slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value()); IndexedPropertySetterCallbackV2 f = @@ -352,6 +398,7 @@ v8::Intercepted PropertyCallbackArguments::CallIndexedDefiner( Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kIndexedDefinerCallback); index_ = index; + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(Smi::zero()); // indexed callback marker slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value()); IndexedPropertyDefinerCallbackV2 f = @@ -370,6 +417,7 @@ v8::Intercepted PropertyCallbackArguments::CallIndexedDeleter( Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kIndexedDeleterCallback); index_ = index; + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(Smi::zero()); // indexed callback marker slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value()); IndexedPropertyDeleterCallbackV2 f = @@ -388,6 +436,7 @@ PropertyCallbackArguments::CallPropertyEnumerator( static_assert(std::is_same_v); Isolate* isolate = this->isolate(); + slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kPropertyKeyIndex).store(Smi::zero()); // not relevant // Enumerator callback's return value is initialized with undefined even // though it's supposed to return v8::Array. @@ -414,20 +463,21 @@ PropertyCallbackArguments::CallPropertyEnumerator( // Accessors DirectHandle PropertyCallbackArguments::CallAccessorGetter( - DirectHandle info, DirectHandle name) { + DirectHandle accessor_info, DirectHandle name) { Isolate* isolate = this->isolate(); RCS_SCOPE(isolate, RuntimeCallCounterId::kAccessorGetterCallback); // Unlike interceptor callbacks we know that the property exists, so // the callback is allowed to have side effects. AcceptSideEffects(); + slot_at(kCallbackInfoIndex).store(*accessor_info); slot_at(kPropertyKeyIndex).store(*name); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).undefined_value()); - AccessorNameGetterCallback f = - reinterpret_cast(info->getter(isolate)); - PREPARE_CALLBACK_INFO_ACCESSOR( - isolate, f, v8::Value, info, direct_handle(receiver(), isolate), - ACCESSOR_GETTER, ExceptionContext::kAttributeGet); + AccessorNameGetterCallback f = reinterpret_cast( + accessor_info->getter(isolate)); + PREPARE_CALLBACK_INFO_ACCESSOR(isolate, f, v8::Value, accessor_info, + receiver(), ACCESSOR_GETTER, + ExceptionContext::kAttributeGet); f(v8::Utils::ToLocal(name), callback_info); return GetReturnValue(isolate); } @@ -441,6 +491,7 @@ bool PropertyCallbackArguments::CallAccessorSetter( // the callback is allowed to have side effects. AcceptSideEffects(); + slot_at(kCallbackInfoIndex).store(*accessor_info); slot_at(kPropertyKeyIndex).store(*name); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value()); // The actual type of setter callback is either @@ -454,9 +505,9 @@ bool PropertyCallbackArguments::CallAccessorSetter( // the result of [[Set]] operation according to JavaScript semantics. AccessorNameSetterCallback f = reinterpret_cast( accessor_info->setter(isolate)); - PREPARE_CALLBACK_INFO_ACCESSOR( - isolate, f, void, accessor_info, direct_handle(receiver(), isolate), - ACCESSOR_SETTER, ExceptionContext::kAttributeSet); + PREPARE_CALLBACK_INFO_ACCESSOR(isolate, f, void, accessor_info, receiver(), + ACCESSOR_SETTER, + ExceptionContext::kAttributeSet); f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), callback_info); // Historically, in case of v8::AccessorNameSetterCallback it wasn't allowed // to set the result and not setting the result was treated as successful diff --git a/deps/v8/src/api/api-arguments.cc b/deps/v8/src/api/api-arguments.cc index e827f4d65b038c..28656effc61db9 100644 --- a/deps/v8/src/api/api-arguments.cc +++ b/deps/v8/src/api/api-arguments.cc @@ -9,50 +9,7 @@ namespace v8 { namespace internal { -PropertyCallbackArguments::PropertyCallbackArguments( - Isolate* isolate, Tagged data, Tagged self, - Tagged holder, Maybe should_throw) - : Super(isolate) -#ifdef DEBUG - , - javascript_execution_counter_(isolate->javascript_execution_counter()) -#endif // DEBUG -{ - if (DEBUG_BOOL) { - // Zap these fields to ensure that they are initialized by a subsequent - // CallXXX(..). - Tagged zap_value(kZapValue); - slot_at(T::kPropertyKeyIndex).store(zap_value); - slot_at(T::kReturnValueIndex).store(zap_value); - } - slot_at(T::kThisIndex).store(self); - slot_at(T::kHolderIndex).store(holder); - slot_at(T::kDataIndex).store(data); - slot_at(T::kIsolateIndex) - .store(Tagged(reinterpret_cast
(isolate))); - int value = Internals::kInferShouldThrowMode; - if (should_throw.IsJust()) { - value = should_throw.FromJust(); - } - slot_at(T::kShouldThrowOnErrorIndex).store(Smi::FromInt(value)); - slot_at(T::kHolderV2Index).store(Smi::zero()); - DCHECK(IsHeapObject(*slot_at(T::kHolderIndex))); - DCHECK(IsSmi(*slot_at(T::kIsolateIndex))); -} - -FunctionCallbackArguments::FunctionCallbackArguments( - Isolate* isolate, Tagged target, - Tagged new_target, Address* argv, int argc) - : Super(isolate), argv_(argv), argc_(argc) { - slot_at(T::kTargetIndex).store(target); - slot_at(T::kUnusedIndex).store(ReadOnlyRoots(isolate).undefined_value()); - slot_at(T::kNewTargetIndex).store(new_target); - slot_at(T::kIsolateIndex) - .store(Tagged(reinterpret_cast
(isolate))); - slot_at(T::kReturnValueIndex).store(ReadOnlyRoots(isolate).undefined_value()); - slot_at(T::kContextIndex).store(isolate->context()); - DCHECK(IsSmi(*slot_at(T::kIsolateIndex))); -} +// TODO(ishell): remove this file if it's really no longer needed. } // namespace internal } // namespace v8 diff --git a/deps/v8/src/api/api-arguments.h b/deps/v8/src/api/api-arguments.h index 26a42125d7027d..8f7b11abf60fdb 100644 --- a/deps/v8/src/api/api-arguments.h +++ b/deps/v8/src/api/api-arguments.h @@ -57,8 +57,6 @@ class CustomArguments : public CustomArgumentsBase { Address values_[T::kArgsLength]; }; -// Note: Calling args.Call() sets the return value on args. For multiple -// Call()'s, a new args should be used every time. // This class also serves as a side effects detection scope (JavaScript code // execution). It is used for ensuring correctness of the interceptor callback // implementations. The idea is that the interceptor callback that does not @@ -74,22 +72,22 @@ class PropertyCallbackArguments final using Super = CustomArguments; static constexpr int kArgsLength = T::kArgsLength; static constexpr int kThisIndex = T::kThisIndex; - static constexpr int kDataIndex = T::kDataIndex; - static constexpr int kHolderV2Index = T::kHolderV2Index; + static constexpr int kCallbackInfoIndex = T::kCallbackInfoIndex; + static constexpr int kUnusedIndex = T::kUnusedIndex; static constexpr int kHolderIndex = T::kHolderIndex; static constexpr int kIsolateIndex = T::kIsolateIndex; static constexpr int kShouldThrowOnErrorIndex = T::kShouldThrowOnErrorIndex; static constexpr int kPropertyKeyIndex = T::kPropertyKeyIndex; - // This constructor leaves kPropertyKeyIndex and kReturnValueIndex slots - // uninitialized in order to let them be initialized by the subsequent - // CallXXX(..) and avoid double initialization. As a consequence, there - // must be no GC call between this constructor and CallXXX(..). - // In debug mode these slots are zapped, so GC should be able to detect - // the misuse of this object. - PropertyCallbackArguments(Isolate* isolate, Tagged data, - Tagged self, Tagged holder, - Maybe should_throw); + // This constructor leaves kPropertyKeyIndex, kReturnValueIndex and + // kCallbackInfoIndex slots uninitialized in order to let them be + // initialized by the subsequent CallXXX(..) and avoid double initialization. + // As a consequence, there must be no GC call between this constructor and + // CallXXX(..). In debug mode these slots are zapped, so GC should be able + // to detect misuse of this object. + inline PropertyCallbackArguments(Isolate* isolate, Tagged self, + Tagged holder, + Maybe should_throw); inline ~PropertyCallbackArguments(); // Don't copy PropertyCallbackArguments, because they would both have the @@ -231,13 +229,14 @@ class PropertyCallbackArguments final return pca->index_; } + inline DirectHandle holder() const; + private: // Returns JSArray-like object with property names or undefined. inline DirectHandle CallPropertyEnumerator( DirectHandle interceptor); - inline Tagged holder() const; - inline Tagged receiver() const; + inline DirectHandle receiver() const; // This field is used for propagating index value from CallIndexedXXX() // to ExceptionPropagationCallback. @@ -278,10 +277,10 @@ class FunctionCallbackArguments static_assert(T::kValuesOffset == offsetof(T, values_)); static_assert(T::kLengthOffset == offsetof(T, length_)); - FunctionCallbackArguments(Isolate* isolate, - Tagged target, - Tagged new_target, Address* argv, - int argc); + inline FunctionCallbackArguments(Isolate* isolate, + Tagged target, + Tagged new_target, Address* argv, + int argc); /* * The following Call function wraps the calling of all callbacks to handle diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index 5a879e9ff5d9e8..16e16df9b2a10e 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -246,6 +246,8 @@ void i::V8::FatalProcessOutOfMemory(i::Isolate* i_isolate, const char* location, if (i_isolate->heap()->HasBeenSetUp()) { i_isolate->heap()->RecordStats(&heap_stats); + i_isolate->heap()->ReportStatsAsCrashKeys(heap_stats); + if (!v8_flags.correctness_fuzzer_suppressions) { char* first_newline = strchr(heap_stats.last_few_messages, '\n'); if (first_newline == nullptr || first_newline[1] == '\0') @@ -538,8 +540,8 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory, size_t old_generation = i::Heap::OldGenerationSizeFromPhysicalMemory(physical_memory); - size_t young_generation = i::Heap::YoungGenerationSizeFromOldGenerationSize( - physical_memory, old_generation); + size_t young_generation = + i::Heap::YoungGenerationSizeFromPhysicalMemory(physical_memory); set_max_young_generation_size_in_bytes(young_generation); set_max_old_generation_size_in_bytes(old_generation); @@ -961,6 +963,27 @@ void Context::SetEmbedderData(int index, v8::Local value) { *Utils::OpenDirectHandle(*GetEmbedderData(index))); } +v8::Local Context::SlowGetEmbedderDataV2(int index) { + const char* location = "v8::Context::GetEmbedderDataV2()"; + i::DirectHandle data = + EmbedderDataFor(this, index, false, location); + if (data.is_null()) return {}; + i::Isolate* i_isolate = i::Isolate::Current(); + return Utils::ToLocal(i::direct_handle( + i::EmbedderDataSlot(*data, index).load_tagged(), i_isolate)); +} + +void Context::SetEmbedderDataV2(int index, v8::Local value) { + const char* location = "v8::Context::SetEmbedderDataV2()"; + i::DirectHandle data = + EmbedderDataFor(this, index, true, location); + if (data.is_null()) return; + auto val = Utils::OpenDirectHandle(*value); + i::EmbedderDataSlot::store_tagged(*data, index, *val); + DCHECK_EQ(*Utils::OpenDirectHandle(*value), + *Utils::OpenDirectHandle(*GetEmbedderDataV2(index))); +} + void* Context::SlowGetAlignedPointerFromEmbedderData(int index, EmbedderDataTypeTag tag) { const char* location = "v8::Context::GetAlignedPointerFromEmbedderData()"; @@ -1096,7 +1119,7 @@ static void EnsureNotPublished(i::DirectHandle info, } i::DirectHandle FunctionTemplateNew( - i::Isolate* i_isolate, FunctionCallback callback, v8::Local data, + i::Isolate* i_isolate, FunctionCallback callback, v8::Local data, v8::Local signature, int length, ConstructorBehavior behavior, bool do_not_cache, v8::Local cached_property_name = v8::Local(), @@ -1258,7 +1281,7 @@ Local Signature::New(Isolate* v8_isolate, } while (false) void FunctionTemplate::SetCallHandler( - FunctionCallback callback, v8::Local data, + FunctionCallback callback, v8::Local data, SideEffectType side_effect_type, const MemorySpan& c_function_overloads) { auto info = Utils::OpenDirectHandle(this); @@ -2096,10 +2119,13 @@ int FixedArray::Length() const { return Utils::OpenDirectHandle(this)->length(); } -Local FixedArray::Get(Local context, int i) const { +Local FixedArray::Get(int i) const { auto self = Utils::OpenDirectHandle(this); auto i_isolate = i::Isolate::Current(); - CHECK_LT(i, self->length()); +#if V8_ENABLE_CHECKS + Utils::ApiCheck(i < self->length(), "v8::FixedArray::Get", + "index out of bounds"); +#endif return ToApiHandle(i::direct_handle(self->get(i), i_isolate)); } @@ -2125,6 +2151,24 @@ Local ModuleRequest::GetImportAttributes() const { i::direct_handle(self->import_attributes(), i_isolate)); } +Local Module::GetResourceName() const { + auto self = Utils::OpenDirectHandle(this); + i::Isolate* i_isolate = i::Isolate::Current(); + i::DisallowGarbageCollection no_gc; + + i::DirectHandle synthetic_module; + if (i::TryCast(self, &synthetic_module)) { + return ToApiHandle( + i::direct_handle(synthetic_module->name(), i_isolate)); + } + + i::DirectHandle sfi( + i::Cast(self)->GetSharedFunctionInfo(), i_isolate); + CHECK(IsScript(sfi->script())); + return ToApiHandle( + i::direct_handle(i::Cast(sfi->script())->name(), i_isolate)); +} + Module::Status Module::GetStatus() const { auto self = Utils::OpenDirectHandle(this); switch (self->status()) { @@ -2874,7 +2918,7 @@ MaybeLocal v8::TryCatch::StackTrace(Local context) const { v8::Local v8::TryCatch::Message() const { i::Tagged message = ToObject(message_obj_); - DCHECK(IsAnyHole(message) || IsJSMessageObject(message)); + DCHECK(IsJSMessageObject(message) || IsTheHole(message, i_isolate_)); if (HasCaught() && !IsTheHole(message, i_isolate_)) { return v8::Utils::MessageToLocal(i::direct_handle(message, i_isolate_)); } else { @@ -2951,7 +2995,7 @@ v8::Local Message::GetStackTrace() const { EnterV8NoScriptNoExceptionScope api_scope(i_isolate); InternalEscapableScope scope(i_isolate); i::DirectHandle stack_trace(self->stack_trace(), i_isolate); - if (IsAnyHole(*stack_trace) || !IsStackTraceInfo(*stack_trace)) return {}; + if (!IsStackTraceInfo(*stack_trace)) return {}; return scope.Escape( Utils::StackTraceToLocal(i::Cast(stack_trace))); } @@ -3837,18 +3881,6 @@ i::Isolate* i::IsolateFromNeverReadOnlySpaceObject(i::Address obj) { return i::Isolate::Current(); } -namespace api_internal { -i::Address ConvertToJSGlobalProxyIfNecessary(i::Address holder_ptr) { - i::Tagged holder = - i::Cast(i::Tagged(holder_ptr)); - - if (i::IsJSGlobalObject(holder)) { - return i::Cast(holder)->global_proxy().ptr(); - } - return holder_ptr; -} -} // namespace api_internal - bool i::ShouldThrowOnError(i::Isolate* i_isolate) { return i::GetShouldThrow(i_isolate, Nothing()) == i::ShouldThrow::kThrowOnError; @@ -3865,9 +3897,9 @@ void v8::Value::CheckCast(Data* that) { Utils::ApiCheck(that->IsValue(), "v8::Value::Cast", "Data is not a Value"); } -void External::CheckCast(v8::Value* that) { - Utils::ApiCheck(that->IsExternal(), "v8::External::Cast", - "Value is not an External"); +void v8::External::CheckCast(v8::Data* that) { + Utils::ApiCheck(that->IsValue() && v8::Value::Cast(that)->IsExternal(), + "v8::External::Cast", "Value is not an External"); } void v8::Object::CheckCast(Value* that) { @@ -5306,7 +5338,7 @@ MaybeLocal Object::CallAsConstructor(Local context, int argc, } MaybeLocal Function::New(Local context, - FunctionCallback callback, Local data, + FunctionCallback callback, Local data, int length, ConstructorBehavior behavior, SideEffectType side_effect_type) { i::Isolate* i_isolate = i::Isolate::Current(); @@ -6855,8 +6887,6 @@ class ObjectVisitorDeepFreezer : i::ObjectVisitor { return false; } - if (IsAnyHole(obj)) return true; - i::DisallowGarbageCollection no_gc; i::InstanceType obj_type = obj->map()->instance_type(); @@ -8540,14 +8570,18 @@ MaybeLocal Promise::Catch(Local context, PrepareForExecutionScope api_scope{context, RCCId::kAPI_Promise_Catch}; i::Isolate* i_isolate = api_scope.i_isolate(); auto self = Utils::OpenDirectHandle(this); + i::Handle return_promise = i_isolate->factory()->NewJSPromise(); i::DirectHandle args[] = {i_isolate->factory()->undefined_value(), - Utils::OpenDirectHandle(*handler)}; + Utils::OpenDirectHandle(*handler), + return_promise}; // Do not call the built-in Promise.prototype.catch! // v8::Promise should not call out to a monkeypatched Promise.prototype.then // as the implementation of Promise.prototype.catch does. - return api_scope.EscapeMaybe( - MaybeLocal::Cast(Utils::ToMaybeLocal(i::Execution::CallBuiltin( - i_isolate, i_isolate->promise_then(), self, base::VectorOf(args))))); + auto result = Utils::ToMaybeLocal( + i::Execution::CallBuiltin(i_isolate, i_isolate->perform_promise_then(), + self, base::VectorOf(args))); + if (result.IsEmpty()) return {}; + return api_scope.Escape(Utils::ToLocal(return_promise)); } MaybeLocal Promise::Then(Local context, @@ -8555,10 +8589,18 @@ MaybeLocal Promise::Then(Local context, PrepareForExecutionScope api_scope{context, RCCId::kAPI_Promise_Then}; i::Isolate* i_isolate = api_scope.i_isolate(); auto self = Utils::OpenDirectHandle(this); - i::DirectHandle args[] = {Utils::OpenDirectHandle(*handler)}; - return api_scope.EscapeMaybe( - MaybeLocal::Cast(Utils::ToMaybeLocal(i::Execution::CallBuiltin( - i_isolate, i_isolate->promise_then(), self, base::VectorOf(args))))); + i::Handle return_promise = i_isolate->factory()->NewJSPromise(); + i::DirectHandle args[] = {Utils::OpenDirectHandle(*handler), + i_isolate->factory()->undefined_value(), + return_promise}; + // Do not call the built-in Promise.prototype.then! + // v8::Promise should not trigger species lookup on a monkeypatched Promise + // as the implementation of Promise.prototype.then does. + auto result = Utils::ToMaybeLocal( + i::Execution::CallBuiltin(i_isolate, i_isolate->perform_promise_then(), + self, base::VectorOf(args))); + if (result.IsEmpty()) return {}; + return api_scope.Escape(Utils::ToLocal(return_promise)); } MaybeLocal Promise::Then(Local context, @@ -8567,11 +8609,18 @@ MaybeLocal Promise::Then(Local context, PrepareForExecutionScope api_scope{context, RCCId::kAPI_Promise_Then}; i::Isolate* i_isolate = api_scope.i_isolate(); auto self = Utils::OpenDirectHandle(this); + i::Handle return_promise = i_isolate->factory()->NewJSPromise(); i::DirectHandle args[] = {Utils::OpenDirectHandle(*on_fulfilled), - Utils::OpenDirectHandle(*on_rejected)}; - return api_scope.EscapeMaybe( - MaybeLocal::Cast(Utils::ToMaybeLocal(i::Execution::CallBuiltin( - i_isolate, i_isolate->promise_then(), self, base::VectorOf(args))))); + Utils::OpenDirectHandle(*on_rejected), + return_promise}; + // Do not call the built-in Promise.prototype.then! + // v8::Promise should not trigger species lookup on a monkeypatched Promise + // as the implementation of Promise.prototype.then does. + auto result = Utils::ToMaybeLocal( + i::Execution::CallBuiltin(i_isolate, i_isolate->perform_promise_then(), + self, base::VectorOf(args))); + if (result.IsEmpty()) return {}; + return api_scope.Escape(Utils::ToLocal(return_promise)); } bool Promise::HasHandler() const { @@ -8646,9 +8695,9 @@ MaybeLocal Proxy::New(Local context, Local local_target, CompiledWasmModule::CompiledWasmModule( std::shared_ptr native_module, - const char* source_url, size_t url_length) + std::string source_url) : native_module_(std::move(native_module)), - source_url_(source_url, url_length) { + source_url_(std::move(source_url)) { CHECK_NOT_NULL(native_module_); } @@ -8694,7 +8743,7 @@ CompiledWasmModule WasmModuleObject::GetCompiledModule() { size_t length; std::unique_ptr cstring = url->ToCString(&length); return CompiledWasmModule(std::move(obj->shared_native_module()), - cstring.get(), length); + {cstring.get(), length}); #else UNREACHABLE(); #endif // V8_ENABLE_WEBASSEMBLY @@ -9030,16 +9079,24 @@ size_t v8::ArrayBufferView::CopyContents(void* dest, size_t byte_length) { if (bytes_to_copy) { i::DisallowGarbageCollection no_gc; const char* source; + bool is_shared; if (i::IsJSTypedArray(*self)) { i::Tagged array = i::Cast(*self); + is_shared = array->buffer()->is_shared(); source = reinterpret_cast(array->DataPtr()); } else { DCHECK(i::IsJSDataView(*self) || i::IsJSRabGsabDataView(*self)); i::Tagged data_view = i::Cast(*self); + is_shared = data_view->buffer()->is_shared(); source = reinterpret_cast(data_view->data_pointer()); } - memcpy(dest, source, bytes_to_copy); + if (is_shared) { + base::Relaxed_Memcpy(reinterpret_cast(dest), source, + bytes_to_copy); + } else { + memcpy(dest, source, bytes_to_copy); + } } return bytes_to_copy; } @@ -10212,9 +10269,7 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { // On 32-bit systems backing_store_bytes() might overflow size_t temporarily // due to concurrent array buffer sweeping. heap_statistics->external_memory_ = - i_isolate->heap()->backing_store_bytes() < SIZE_MAX - ? static_cast(i_isolate->heap()->backing_store_bytes()) - : SIZE_MAX; + base::saturated_cast(i_isolate->heap()->backing_store_bytes()); heap_statistics->peak_malloced_memory_ = i_isolate->allocator()->GetMaxMemoryUsage(); heap_statistics->number_of_native_contexts_ = heap->NumberOfNativeContexts(); @@ -10244,25 +10299,25 @@ bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, i::Isolate* i_isolate = reinterpret_cast(this); i::SetCurrentIsolateScope set_current_isolate(i_isolate); - if (!i::Heap::IsValidAllocationSpace(static_cast(index))) + const auto maybe_space = i::Heap::TryGetAllocationSpaceFromIndex(index); + if (!maybe_space) { return false; + } + const i::AllocationSpace allocation_space = maybe_space.value(); i::Heap* heap = i_isolate->heap(); - heap->FreeMainThreadLinearAllocationAreas(); - i::AllocationSpace allocation_space = static_cast(index); space_statistics->space_name_ = i::ToString(allocation_space); - if (allocation_space == i::RO_SPACE) { - // RO_SPACE memory is shared across all isolates and accounted for - // elsewhere. + // Read-only space is shard across all isolates. Its statistics can be + // retrieved using `V8::GetSharedMemoryStatistics()`. space_statistics->space_size_ = 0; space_statistics->space_used_size_ = 0; space_statistics->space_available_size_ = 0; space_statistics->physical_space_size_ = 0; } else { - i::Space* space = heap->space(static_cast(index)); + i::Space* space = heap->space(allocation_space); space_statistics->space_size_ = space ? space->CommittedMemory() : 0; space_statistics->space_used_size_ = space ? space->SizeOfObjects() : 0; space_statistics->space_available_size_ = space ? space->Available() : 0; @@ -10488,6 +10543,12 @@ void Isolate::SetAddCrashKeyCallback(AddCrashKeyCallback callback) { i_isolate->SetAddCrashKeyCallback(callback); } +void Isolate::SetCrashKeyStringCallbacks(AllocateCrashKeyStringCallback alloc, + SetCrashKeyStringCallback set) { + i::Isolate* i_isolate = reinterpret_cast(this); + i_isolate->SetCrashKeyStringCallbacks(alloc, set); +} + void Isolate::LowMemoryNotification() { i::Isolate* i_isolate = reinterpret_cast(this); { @@ -11358,10 +11419,12 @@ CpuProfiler* CpuProfiler::New(Isolate* v8_isolate, CpuProfilingOptions::CpuProfilingOptions(CpuProfilingMode mode, unsigned max_samples, int sampling_interval_us, - MaybeLocal filter_context) + MaybeLocal filter_context, + CpuProfileSource profile_source) : mode_(mode), max_samples_(max_samples), - sampling_interval_us_(sampling_interval_us) { + sampling_interval_us_(sampling_interval_us), + profile_source_(profile_source) { if (!filter_context.IsEmpty()) { Local local_filter_context = filter_context.ToLocalChecked(); filter_context_.Reset(v8::Isolate::GetCurrent(), local_filter_context); @@ -12265,16 +12328,13 @@ template bool ValidatePropertyCallbackInfo(const PropertyCallbackInfo& info) { auto* i_isolate = reinterpret_cast(info.GetIsolate()); CHECK_EQ(i_isolate, Isolate::Current()); + // Allow usages of v8::PropertyCallbackInfo::This() for now. + // TODO(https://crbug.com/455600234): remove. + START_ALLOW_USE_DEPRECATED() CHECK(info.This()->IsValue()); + END_ALLOW_USE_DEPRECATED() CHECK(info.HolderV2()->IsObject()); CHECK(!i::IsJSGlobalObject(*Utils::OpenDirectHandle(*info.HolderV2()))); - // Allow usages of v8::PropertyCallbackInfo::Holder() for now. - // TODO(https://crbug.com/333672197): remove. - START_ALLOW_USE_DEPRECATED() - CHECK(info.Holder()->IsObject()); - CHECK_IMPLIES(info.Holder() != info.HolderV2(), - i::IsJSGlobalObject(*Utils::OpenDirectHandle(*info.Holder()))); - END_ALLOW_USE_DEPRECATED() i::Tagged key = i::PropertyCallbackArguments::GetPropertyKey(info); CHECK(i::IsSmi(key) || i::IsName(key)); CHECK(info.Data()->IsValue()); diff --git a/deps/v8/src/api/api.h b/deps/v8/src/api/api.h index 5d4bbd79b3c442..5ad6ea759463e4 100644 --- a/deps/v8/src/api/api.h +++ b/deps/v8/src/api/api.h @@ -107,6 +107,7 @@ class RegisteredExtension { V(ToLocal, JSArrayBuffer, ArrayBuffer) \ V(ToLocal, JSArrayBufferView, ArrayBufferView) \ V(ToLocal, JSDataView, DataView) \ + V(ToLocal, JSPromise, Promise) \ V(ToLocal, JSRabGsabDataView, DataView) \ V(ToLocal, JSTypedArray, TypedArray) \ V(ToLocalShared, JSArrayBuffer, SharedArrayBuffer) \ @@ -115,7 +116,6 @@ class RegisteredExtension { V(ToLocal, DictionaryTemplateInfo, DictionaryTemplate) \ V(SignatureToLocal, FunctionTemplateInfo, Signature) \ V(MessageToLocal, Object, Message) \ - V(PromiseToLocal, JSObject, Promise) \ V(StackTraceToLocal, StackTraceInfo, StackTrace) \ V(StackFrameToLocal, StackFrameInfo, StackFrame) \ V(NumberToLocal, Object, Number) \ @@ -137,7 +137,6 @@ class RegisteredExtension { V(ToLocalShared) \ V(SignatureToLocal) \ V(MessageToLocal) \ - V(PromiseToLocal) \ V(StackTraceToLocal) \ V(StackFrameToLocal) \ V(NumberToLocal) \ diff --git a/deps/v8/src/ast/ast-function-literal-id-reindexer.cc b/deps/v8/src/ast/ast-function-literal-id-reindexer.cc index c38d79dfd57b51..f6ddef970b46ee 100644 --- a/deps/v8/src/ast/ast-function-literal-id-reindexer.cc +++ b/deps/v8/src/ast/ast-function-literal-id-reindexer.cc @@ -71,12 +71,14 @@ void AstFunctionLiteralIdReindexer::VisitClassLiteral(ClassLiteral* expr) { for (int i = 0; i < props->length(); ++i) { ClassLiteralProperty* prop = props->at(i); - // Public fields and auto accessors with computed names have their key and + // Public fields and auto-accessors with computed names have their key and // value present in instance_members_initializer_function, so they will // already have been visited. - if (prop->is_computed_name() && - (prop->kind() == ClassLiteralProperty::Kind::FIELD || - (prop->kind() == ClassLiteralProperty::Kind::AUTO_ACCESSOR))) { + // The value of auto-accessors is always present in + // instance_members_initializer_function. + if ((prop->is_computed_name() && + prop->kind() == ClassLiteralProperty::Kind::FIELD) || + (prop->kind() == ClassLiteralProperty::Kind::AUTO_ACCESSOR)) { if (!prop->key()->IsLiteral()) { CheckVisited(prop->key()); } @@ -87,10 +89,6 @@ void AstFunctionLiteralIdReindexer::VisitClassLiteral(ClassLiteral* expr) { } Visit(prop->value()); } - if (prop->kind() == ClassLiteralProperty::Kind::AUTO_ACCESSOR) { - Visit(prop->auto_accessor_info()->generated_getter()); - Visit(prop->auto_accessor_info()->generated_setter()); - } } } diff --git a/deps/v8/src/ast/ast-traversal-visitor.h b/deps/v8/src/ast/ast-traversal-visitor.h index 0d6034920bede2..4611a80867d30b 100644 --- a/deps/v8/src/ast/ast-traversal-visitor.h +++ b/deps/v8/src/ast/ast-traversal-visitor.h @@ -538,6 +538,13 @@ void AstTraversalVisitor::VisitInitializeClassStaticElementsStatement( RECURSE(Visit(prop->key())); } RECURSE(Visit(prop->value())); + if (prop->is_auto_accessor()) { + // The generated getter and setter are created after the + // ClassLiteralProperty value is created, so we visit them in + // the same order. + RECURSE(Visit(prop->auto_accessor_info()->generated_getter())); + RECURSE(Visit(prop->auto_accessor_info()->generated_setter())); + } break; } case ClassLiteral::StaticElement::STATIC_BLOCK: diff --git a/deps/v8/src/ast/ast.cc b/deps/v8/src/ast/ast.cc index 88c29168d6d829..214a746bfce0b9 100644 --- a/deps/v8/src/ast/ast.cc +++ b/deps/v8/src/ast/ast.cc @@ -170,11 +170,13 @@ VariableProxy::VariableProxy(const VariableProxy* copy_from) raw_name_ = copy_from->raw_name_; } -void VariableProxy::BindTo(Variable* var) { +void VariableProxy::BindTo(Variable* var, BindingMode mode) { DCHECK_EQ(raw_name(), var->raw_name()); set_var(var); set_is_resolved(); - var->set_is_used(); + if (mode == BindingMode::kMarkUse) { + var->set_is_used(); + } if (is_assigned()) var->SetMaybeAssigned(); } diff --git a/deps/v8/src/ast/ast.h b/deps/v8/src/ast/ast.h index 56105c4c549dd6..9b58001ac7b75a 100644 --- a/deps/v8/src/ast/ast.h +++ b/deps/v8/src/ast/ast.h @@ -1551,8 +1551,13 @@ class VariableProxy final : public Expression { bool IsPrivateName() const { return raw_name()->IsPrivateName(); } + enum class BindingMode { + kMarkUse, + kNoMarkUse, + }; + // Bind this proxy to the variable var. - void BindTo(Variable* var); + void BindTo(Variable* var, BindingMode mode = BindingMode::kMarkUse); V8_INLINE VariableProxy* next_unresolved() { return next_unresolved_; } V8_INLINE bool is_removed_from_unresolved() const { diff --git a/deps/v8/src/ast/scopes.cc b/deps/v8/src/ast/scopes.cc index e406e9164590f7..b476498a3c9738 100644 --- a/deps/v8/src/ast/scopes.cc +++ b/deps/v8/src/ast/scopes.cc @@ -1063,11 +1063,6 @@ Variable* DeclarationScope::DeclareParameter(const AstRawString* name, if (name == ast_value_factory->arguments_string()) { has_arguments_parameter_ = true; } - // Params are automatically marked as used to make sure that the debugger and - // function.arguments sees them. - // TODO(verwaest): Reevaluate whether we always need to do this, since - // strict-mode function.arguments does not make the arguments available. - var->set_is_used(); return var; } @@ -1453,7 +1448,7 @@ bool DeclarationScope::AllowsLazyCompilation() const { // Functions which force eager compilation and class member initializer // functions are not lazily compilable. return !force_eager_compilation_ && - !IsClassMembersInitializerFunction(function_kind()); + !IsClassInitializerFunction(function_kind()); } int Scope::ContextChainLength(Scope* scope) const { @@ -1879,6 +1874,11 @@ void PrintVar(int indent, Variable* var) { PrintF("never assigned"); comma = true; } + if (!var->is_used()) { + if (comma) PrintF(", "); + PrintF("never used"); + comma = true; + } if (var->initialization_flag() == kNeedsInitialization && !var->binding_needs_init()) { if (comma) PrintF(", "); @@ -2402,6 +2402,8 @@ bool Scope::MustAllocate(Variable* var) { // Give var a read/write use if there is a chance it might be accessed // via an eval() call. This is only possible if the variable has a // visible name. + // TODO(dcarney): hoist this check out of MustAllocate since it's mutating + // state and confusing. if (!var->raw_name()->IsEmpty() && (inner_scope_calls_eval_ || is_catch_scope() || is_script_scope())) { var->set_is_used(); @@ -2464,6 +2466,14 @@ void DeclarationScope::AllocateParameterLocals() { arguments_ = nullptr; } } + // TODO(dcarney): move check from MustAllocate here for parameters. + // Mark all remaining parameters as used if they are reachable through + // arguments. + if (arguments_ != nullptr) { + for (int i = 0; i < num_parameters(); i++) { + parameter(i)->set_is_used(); + } + } // The same parameter may occur multiple times in the parameters_ list. // If it does, and if it is not copied into the context object, it must @@ -2489,7 +2499,8 @@ void DeclarationScope::AllocateParameterLocals() { } void DeclarationScope::AllocateParameter(Variable* var, int index) { - if (!MustAllocate(var)) return; + // TODO(dcarney): eliminate this check. + USE(MustAllocate(var)); if (has_forced_context_allocation_for_parameters() || MustAllocateInContext(var)) { DCHECK(var->IsUnallocated() || var->IsContextSlot()); diff --git a/deps/v8/src/ast/scopes.h b/deps/v8/src/ast/scopes.h index 4b0a70821eb555..2698b6443c81d2 100644 --- a/deps/v8/src/ast/scopes.h +++ b/deps/v8/src/ast/scopes.h @@ -996,7 +996,7 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope { #endif // V8_ENABLE_WEBASSEMBLY bool should_ban_arguments() const { - return IsClassMembersInitializerFunction(function_kind()); + return IsClassInitializerFunction(function_kind()); } void set_module_has_toplevel_await() { diff --git a/deps/v8/src/ast/variables.h b/deps/v8/src/ast/variables.h index d33ba538a0711d..88e6137b6cb589 100644 --- a/deps/v8/src/ast/variables.h +++ b/deps/v8/src/ast/variables.h @@ -306,6 +306,9 @@ class Variable final : public ZoneObject { bit_field_ = VariableModeField::update(bit_field_, VariableMode::kLet); bit_field_ = InitializationFlagField::update(bit_field_, kNeedsInitialization); + // It's possible a parameter hasn't been used but when we introduce + // temporaries, it will be used in the initialization block. + set_is_used(); } static InitializationFlag DefaultInitializationFlag(VariableMode mode) { diff --git a/deps/v8/src/base/DEPS b/deps/v8/src/base/DEPS index 3cead70516d71c..1b9c9d85386e5c 100644 --- a/deps/v8/src/base/DEPS +++ b/deps/v8/src/base/DEPS @@ -10,4 +10,7 @@ specific_include_rules = { "ieee754.h": [ "+third_party/glibc/src/sysdeps/ieee754/dbl-64/trig.h" ], + "float16.h": [ + "+third_party/fp16/src/include/fp16.h" + ], } diff --git a/deps/v8/src/base/algorithm.h b/deps/v8/src/base/algorithm.h new file mode 100644 index 00000000000000..3f5356172cbc1f --- /dev/null +++ b/deps/v8/src/base/algorithm.h @@ -0,0 +1,51 @@ +// Copyright 2025 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. + +#ifndef V8_BASE_ALGORITHM_H_ +#define V8_BASE_ALGORITHM_H_ + +#include +#include +#include + +#include "src/base/memcopy.h" + +namespace v8::base { +namespace internal { + +template +constexpr bool can_use_memcpy_v = + std::contiguous_iterator && std::contiguous_iterator && + std::is_same_v::value_type, + typename std::iterator_traits::value_type> && + std::is_trivially_copyable_v< + typename std::iterator_traits::value_type>; + +} // namespace internal + +// Version of `std::copy()` that delegates to `base::MemCopy()` when possible. +// Unlike `std::copy()` we don't allow any overlaps as our implementation +// assumes `std::execution::par_unseq` execution policy under the hood. +template +OutputIt Copy(InputIt first, InputIt last, OutputIt d_first) + requires(internal::can_use_memcpy_v) +{ + using T = typename std::iterator_traits::value_type; + const auto count = std::distance(first, last); + const T* src_ptr = std::to_address(first); + T* dest_ptr = std::to_address(d_first); + base::MemCopy(dest_ptr, src_ptr, count * sizeof(T)); + return d_first + count; +} + +template +constexpr OutputIt Copy(InputIt first, InputIt last, OutputIt d_first) + requires(!internal::can_use_memcpy_v) +{ + return std::copy(first, last, d_first); +} + +} // namespace v8::base + +#endif // V8_BASE_ALGORITHM_H_ diff --git a/deps/v8/src/base/bits.h b/deps/v8/src/base/bits.h index f53dee47dd9aeb..19bdf0c539cae3 100644 --- a/deps/v8/src/base/bits.h +++ b/deps/v8/src/base/bits.h @@ -483,6 +483,39 @@ inline int32_t WraparoundNeg32(int32_t x) { return static_cast(-static_cast(x)); } +inline constexpr uint16_t ByteReverse16(uint16_t value) { +#if V8_HAS_BUILTIN_BSWAP16 + return __builtin_bswap16(value); +#else + return value << 8 | (value >> 8 & 0x00FF); +#endif +} + +inline constexpr uint32_t ByteReverse32(uint32_t value) { +#if V8_HAS_BUILTIN_BSWAP32 + return __builtin_bswap32(value); +#else + return value << 24 | ((value << 8) & 0x00FF0000) | + ((value >> 8) & 0x0000FF00) | ((value >> 24) & 0x00000FF); +#endif +} + +inline constexpr uint64_t ByteReverse64(uint64_t value) { +#if V8_HAS_BUILTIN_BSWAP64 + return __builtin_bswap64(value); +#else + size_t bits_of_v = sizeof(value) * kBitsPerByte; + return value << (bits_of_v - 8) | + ((value << (bits_of_v - 24)) & 0x00FF000000000000) | + ((value << (bits_of_v - 40)) & 0x0000FF0000000000) | + ((value << (bits_of_v - 56)) & 0x000000FF00000000) | + ((value >> (bits_of_v - 56)) & 0x00000000FF000000) | + ((value >> (bits_of_v - 40)) & 0x0000000000FF0000) | + ((value >> (bits_of_v - 24)) & 0x000000000000FF00) | + ((value >> (bits_of_v - 8)) & 0x00000000000000FF); +#endif +} + // SignedSaturatedAdd64(lhs, rhs) adds |lhs| and |rhs|, // checks and returns the result. V8_BASE_EXPORT int64_t SignedSaturatedAdd64(int64_t lhs, int64_t rhs); diff --git a/deps/v8/src/base/bounded-page-allocator.h b/deps/v8/src/base/bounded-page-allocator.h index 7848cd180d3a7f..13633daf61366b 100644 --- a/deps/v8/src/base/bounded-page-allocator.h +++ b/deps/v8/src/base/bounded-page-allocator.h @@ -151,6 +151,19 @@ class V8_BASE_EXPORT BoundedPageAllocator : public v8::PageAllocator { AllocationStatus allocation_status_ = AllocationStatus::kSuccess; }; +constexpr const char* ToString(BoundedPageAllocator::AllocationStatus status) { + switch (status) { + case BoundedPageAllocator::AllocationStatus::kSuccess: + return "success"; + case BoundedPageAllocator::AllocationStatus::kFailedToCommit: + return "failed to commit"; + case BoundedPageAllocator::AllocationStatus::kRanOutOfReservation: + return "ran out of reservation"; + case BoundedPageAllocator::AllocationStatus::kHintedAddressTakenOrNotFound: + return "hinted address taken or not found"; + } +} + } // namespace base } // namespace v8 diff --git a/deps/v8/src/base/emulated-virtual-address-subspace.h b/deps/v8/src/base/emulated-virtual-address-subspace.h index ddceb7b4e36d23..90f5517f77fff5 100644 --- a/deps/v8/src/base/emulated-virtual-address-subspace.h +++ b/deps/v8/src/base/emulated-virtual-address-subspace.h @@ -73,8 +73,8 @@ class V8_BASE_EXPORT EmulatedVirtualAddressSubspace final std::unique_ptr AllocateSubspace( Address hint, size_t size, size_t alignment, PagePermissions max_page_permissions, - std::optional key = std::nullopt, - PlatformSharedMemoryHandle handle = kInvalidSharedMemoryHandle) override; + std::optional key, + PlatformSharedMemoryHandle handle) override; bool RecommitPages(Address address, size_t size, PagePermissions permissions) override; diff --git a/deps/v8/src/wasm/float16.h b/deps/v8/src/base/float16.h similarity index 85% rename from deps/v8/src/wasm/float16.h rename to deps/v8/src/base/float16.h index 5c0e0a9060132a..1a51af81484266 100644 --- a/deps/v8/src/wasm/float16.h +++ b/deps/v8/src/base/float16.h @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef V8_WASM_FLOAT16_H_ -#define V8_WASM_FLOAT16_H_ +#ifndef V8_BASE_FLOAT16_H_ +#define V8_BASE_FLOAT16_H_ #include "src/base/memory.h" -#include "third_party/fp16/src/include/fp16.h" +#include "third_party/fp16/src/include/fp16.h" // nogncheck namespace v8 { namespace internal { @@ -40,4 +40,4 @@ static_assert(sizeof(Float16) == sizeof(uint16_t)); } // namespace internal } // namespace v8 -#endif // V8_WASM_FLOAT16_H_ +#endif // V8_BASE_FLOAT16_H_ diff --git a/deps/v8/src/base/logging.h b/deps/v8/src/base/logging.h index 7d77327183d0a7..3dc08383b2cd52 100644 --- a/deps/v8/src/base/logging.h +++ b/deps/v8/src/base/logging.h @@ -137,6 +137,16 @@ enum class OOMType { } while (false) #define CHECK(condition) CHECK_WITH_MSG(condition, #condition) +// Special version of CHECK that makes it clear that the CHECK's failure has no +// security impact. +// USE WITH CARE! See also the comments above FatalNoSecurityImpact. +#define CHECK_NO_SECURITY_IMPACT(condition) \ + do { \ + if (V8_UNLIKELY(!(condition))) { \ + base::FatalNoSecurityImpact(#condition); \ + } \ + } while (false) + #ifdef DEBUG #define DCHECK_WITH_MSG_AND_LOC(condition, message, loc) \ diff --git a/deps/v8/src/base/macros.h b/deps/v8/src/base/macros.h index 57ba2620626f10..dc7b9454d30bb5 100644 --- a/deps/v8/src/base/macros.h +++ b/deps/v8/src/base/macros.h @@ -505,6 +505,12 @@ bool is_inbounds(float_t v) { #define IF_TSAN(V, ...) #endif // V8_IS_TSAN +#ifdef V8_ENABLE_SANDBOX_HARDWARE_SUPPORT +#define IF_HARDWARE_SANDBOX(V, ...) EXPAND(V(__VA_ARGS__)) +#else +#define IF_HARDWARE_SANDBOX(V, ...) +#endif // V8_ENABLE_SANDBOX_HARDWARE_SUPPORT + // Defines IF_INTL, to be used in macro lists for elements that should only be // there if INTL is enabled. #ifdef V8_INTL_SUPPORT @@ -572,4 +578,16 @@ bool is_inbounds(float_t v) { #define END_PROHIBIT_SIGN_CONVERSION() #endif // defined(__clang__) +// Disable/enable -Wmissing-designated-field-initializers warnings in code. +#if defined(__clang__) +#define START_ALLOW_MISSING_DESIGNATED_FIELD_INITIALIZERS() \ + _Pragma("clang diagnostic push") _Pragma( \ + "clang diagnostic ignored \"-Wmissing-designated-field-initializers\"") +#define END_ALLOW_MISSING_DESIGNATED_FIELD_INITIALIZERS() \ + _Pragma("clang diagnostic pop") +#else +#define START_ALLOW_MISSING_DESIGNATED_FIELD_INITIALIZERS() +#define END_ALLOW_MISSING_DESIGNATED_FIELD_INITIALIZERS() +#endif // defined(__clang__) + #endif // V8_BASE_MACROS_H_ diff --git a/deps/v8/src/base/memcopy.h b/deps/v8/src/base/memcopy.h new file mode 100644 index 00000000000000..7075d394a6d3f1 --- /dev/null +++ b/deps/v8/src/base/memcopy.h @@ -0,0 +1,261 @@ +// Copyright 2025 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. + +#ifndef V8_BASE_MEMCOPY_H_ +#define V8_BASE_MEMCOPY_H_ + +#include + +#include + +#include "include/v8config.h" +#include "src/base/base-export.h" +#include "src/base/bits.h" +#include "src/base/macros.h" + +#if defined(V8_TARGET_ARCH_ARM64) && \ + (defined(__ARM_NEON) || defined(__ARM_NEON__)) +#define V8_OPTIMIZE_WITH_NEON +#include +#endif +namespace v8::base { + +// Routines for memcpy and friends. Historically, V8 has specialized various +// implementations on different platforms for performance reasons. In an ideal +// world this would all just be plain stdlib `memcpy()` and friends. + +#if defined(V8_OPTIMIZE_WITH_NEON) + +// We intentionally use misaligned read/writes for NEON intrinsics, disable +// alignment sanitization explicitly. +// Overlapping writes help to save instructions, e.g. doing 2 two-byte writes +// instead 3 one-byte write for count == 3. +template +V8_INLINE V8_CLANG_NO_SANITIZE("alignment") void OverlappingWrites( + void* dst, const void* src, size_t count) { + *reinterpret_cast(dst) = *reinterpret_cast(src); + *reinterpret_cast(static_cast(dst) + count - + sizeof(IntType)) = + *reinterpret_cast(static_cast(src) + + count - sizeof(IntType)); +} + +V8_CLANG_NO_SANITIZE("alignment") +inline void SimdMemCopy(void* dst, const void* src, size_t count) { + auto* dst_u = static_cast(dst); + const auto* src_u = static_cast(src); + // Common cases. Handle before doing clz. + if (count == 0) { + return; + } + if (count == 1) { + *dst_u = *src_u; + return; + } + const size_t order = + sizeof(count) * CHAR_BIT - bits::CountLeadingZeros(count - 1); + switch (order) { + case 1: // count: [2, 2] + *reinterpret_cast(dst_u) = + *reinterpret_cast(src_u); + return; + case 2: // count: [3, 4] + OverlappingWrites(dst_u, src_u, count); + return; + case 3: // count: [5, 8] + OverlappingWrites(dst_u, src_u, count); + return; + case 4: // count: [9, 16] + OverlappingWrites(dst_u, src_u, count); + return; + case 5: // count: [17, 32] + vst1q_u8(dst_u, vld1q_u8(src_u)); + vst1q_u8(dst_u + count - sizeof(uint8x16_t), + vld1q_u8(src_u + count - sizeof(uint8x16_t))); + return; + default: // count: [33, ...] + vst1q_u8(dst_u, vld1q_u8(src_u)); + for (size_t i = count % sizeof(uint8x16_t); i < count; + i += sizeof(uint8x16_t)) { + vst1q_u8(dst_u + i, vld1q_u8(src_u + i)); + } + return; + } +} + +V8_INLINE void MemCopy(void* dest, const void* src, size_t size) { +#ifdef DEBUG + if (size == 0) { + return; + } + // Check that there's no overlap in ranges. + const char* src_char = reinterpret_cast(src); + char* dest_char = reinterpret_cast(dest); + DCHECK(dest_char >= (src_char + size) || src_char >= (dest_char + size)); +#endif // DEBUG + // Wrap call to be able to easily identify SIMD usage in profiles. + SimdMemCopy(dest, src, size); +} + +#else // !defined(V8_OPTIMIZE_WITH_NEON) + +// Copy memory area to disjoint memory area. +V8_INLINE void MemCopy(void* dest, const void* src, size_t size) { +#ifdef DEBUG + if (size == 0) { + return; + } + // Check that there's no overlap in ranges. + const char* src_char = reinterpret_cast(src); + char* dest_char = reinterpret_cast(dest); + DCHECK(dest_char >= (src_char + size) || src_char >= (dest_char + size)); +#endif // DEBUG + // Fast path for small sizes. The compiler will expand the `memcpy()` for + // small fixed sizes to a sequence of move instructions. This avoids the + // overhead of the general `memcpy()` function. + switch (size) { + case 0: + return; +#define CASE(N) \ + case N: \ + memcpy(dest, src, N); \ + return; + CASE(1) + CASE(2) + CASE(3) + CASE(4) + CASE(5) + CASE(6) + CASE(7) + CASE(8) + CASE(9) + CASE(10) + CASE(11) + CASE(12) + CASE(13) + CASE(14) + CASE(15) + CASE(16) +#undef CASE + default: + memcpy(dest, src, size); + return; + } +} + +#endif // !defined(V8_OPTIMIZE_WITH_NEON) + +V8_INLINE void MemMove(void* dest, const void* src, size_t size) { + // Fast path for small sizes. The compiler will expand the `memmove()` for + // small fixed sizes to a sequence of move instructions. This avoids the + // overhead of the general `memmove()` function. + switch (size) { + case 0: + return; +#define CASE(N) \ + case N: \ + memmove(dest, src, N); \ + return; + CASE(1) + CASE(2) + CASE(3) + CASE(4) + CASE(5) + CASE(6) + CASE(7) + CASE(8) + CASE(9) + CASE(10) + CASE(11) + CASE(12) + CASE(13) + CASE(14) + CASE(15) + CASE(16) +#undef CASE + default: + memmove(dest, src, size); + return; + } +} + +#if V8_TARGET_BIG_ENDIAN +inline void MemCopyAndSwitchEndianness(void* dst, void* src, + size_t num_elements, + size_t element_size) { +#define COPY_LOOP(type, reverse) \ + { \ + for (uint32_t i = 0; i < num_elements; i++) { \ + type t; \ + type* s = reinterpret_cast(src) + i; \ + type* d = reinterpret_cast(dst) + i; \ + memcpy(&t, reinterpret_cast(s), element_size); \ + t = reverse(t); \ + memcpy(reinterpret_cast(d), &t, element_size); \ + } \ + return; \ + } + + switch (element_size) { + case 1: + MemCopy(dst, src, num_elements); + return; + case 2: + COPY_LOOP(uint16_t, bits::ByteReverse16); + case 4: + COPY_LOOP(uint32_t, bits::ByteReverse32); + case 8: + COPY_LOOP(uint64_t, bits::ByteReverse64); + default: + UNREACHABLE(); + } +#undef COPY_LOOP +} +#endif + +template +V8_INLINE bool TryTrivialCopy(const T* src_begin, const T* src_end, T* dest) { + DCHECK_LE(src_begin, src_end); + if constexpr (std::is_trivially_copyable_v) { + const size_t count = src_end - src_begin; + base::MemCopy(dest, src_begin, count * sizeof(T)); + return true; + } + return false; +} + +template +V8_INLINE bool TryTrivialMove(const T* src_begin, const T* src_end, T* dest) { + DCHECK_LE(src_begin, src_end); + if constexpr (std::is_trivially_copyable_v) { + const size_t count = src_end - src_begin; + base::MemMove(dest, src_begin, count * sizeof(T)); + return true; + } + return false; +} + +// Fills `destination` with `count` `value`s. +template +constexpr void Memset(T* destination, U value, size_t count) + requires std::is_trivially_assignable_v +{ + for (size_t i = 0; i < count; i++) { + destination[i] = value; + } +} + +// Fills `destination` with `count` `value`s. +template +inline void Relaxed_Memset(T* destination, T value, size_t count) + requires std::is_integral_v +{ + for (size_t i = 0; i < count; i++) { + std::atomic_ref(destination[i]).store(value, std::memory_order_relaxed); + } +} + +} // namespace v8::base + +#endif // V8_BASE_MEMCOPY_H_ diff --git a/deps/v8/src/base/platform/platform-fuchsia.cc b/deps/v8/src/base/platform/platform-fuchsia.cc index 46a734a0151574..b35a47c8352465 100644 --- a/deps/v8/src/base/platform/platform-fuchsia.cc +++ b/deps/v8/src/base/platform/platform-fuchsia.cc @@ -251,8 +251,8 @@ TimezoneCache* OS::CreateTimezoneCache() { } // static -void OS::Initialize(AbortMode abort_mode, const char* const gc_fake_mmap) { - PosixInitializeCommon(abort_mode, gc_fake_mmap); +void OS::Initialize(const char* const gc_fake_mmap) { + PosixInitializeCommon(gc_fake_mmap); // Determine base address of root VMAR. zx_info_vmar_t info; diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc index d3cd1edf441186..e39ce34475f2f2 100644 --- a/deps/v8/src/base/platform/platform-posix.cc +++ b/deps/v8/src/base/platform/platform-posix.cc @@ -280,15 +280,13 @@ bool OS::ArmUsingHardFloat() { #endif // def __arm__ #endif -void PosixInitializeCommon(AbortMode abort_mode, - const char* const gc_fake_mmap) { - g_abort_mode = abort_mode; +void PosixInitializeCommon(const char* const gc_fake_mmap) { g_gc_fake_mmap = gc_fake_mmap; } #if !V8_OS_FUCHSIA -void OS::Initialize(AbortMode abort_mode, const char* const gc_fake_mmap) { - PosixInitializeCommon(abort_mode, gc_fake_mmap); +void OS::Initialize(const char* const gc_fake_mmap) { + PosixInitializeCommon(gc_fake_mmap); } #endif // !V8_OS_FUCHSIA diff --git a/deps/v8/src/base/platform/platform-posix.h b/deps/v8/src/base/platform/platform-posix.h index b9ae6cd0cb1ba4..6836a5b360a60c 100644 --- a/deps/v8/src/base/platform/platform-posix.h +++ b/deps/v8/src/base/platform/platform-posix.h @@ -12,8 +12,7 @@ namespace v8 { namespace base { -void PosixInitializeCommon(AbortMode abort_mode, - const char* const gc_fake_mmap); +void PosixInitializeCommon(const char* const gc_fake_mmap); class PosixTimezoneCache : public TimezoneCache { public: diff --git a/deps/v8/src/base/platform/platform-starboard.cc b/deps/v8/src/base/platform/platform-starboard.cc index bd7dcc5e5e6bed..af13ef9b6db029 100644 --- a/deps/v8/src/base/platform/platform-starboard.cc +++ b/deps/v8/src/base/platform/platform-starboard.cc @@ -78,8 +78,7 @@ const int kStackSize = 1; } // namespace -void OS::Initialize(AbortMode abort_mode, const char* const gc_fake_mmap) { - g_abort_mode = abort_mode; +void OS::Initialize(const char* const gc_fake_mmap) { // This is only used on Posix, we don't need to use it for anything. } diff --git a/deps/v8/src/base/platform/platform-win32.cc b/deps/v8/src/base/platform/platform-win32.cc index 60e255af03ec3d..ad4d0c10e10f21 100644 --- a/deps/v8/src/base/platform/platform-win32.cc +++ b/deps/v8/src/base/platform/platform-win32.cc @@ -782,8 +782,8 @@ bool UserShadowStackEnabled() { } // namespace -void OS::Initialize(AbortMode abort_mode, const char* const gc_fake_mmap) { - g_abort_mode = abort_mode; +void OS::Initialize(const char* const gc_fake_mmap) { + // This is only used on Posix, we don't need to use it for anything. } typedef PVOID(__stdcall* VirtualAlloc2_t)(HANDLE, PVOID, SIZE_T, ULONG, ULONG, diff --git a/deps/v8/src/base/platform/platform.h b/deps/v8/src/base/platform/platform.h index d0bb7d6154eda9..173cfc4cd1aa70 100644 --- a/deps/v8/src/base/platform/platform.h +++ b/deps/v8/src/base/platform/platform.h @@ -145,9 +145,8 @@ class VirtualAddressSubspace; class V8_BASE_EXPORT OS { public: // Initialize the OS class. - // - abort_mode: see src/base/abort-mode.h for details. // - gc_fake_mmap: Name of the file for fake gc mmap used in ll_prof. - static void Initialize(AbortMode abort_mode, const char* const gc_fake_mmap); + static void Initialize(const char* const gc_fake_mmap); #if V8_OS_WIN // On Windows, ensure the newer memory API is loaded if available. This diff --git a/deps/v8/src/base/sanitizer/lsan-virtual-address-space.h b/deps/v8/src/base/sanitizer/lsan-virtual-address-space.h index 8a35c380257697..f740531f475677 100644 --- a/deps/v8/src/base/sanitizer/lsan-virtual-address-space.h +++ b/deps/v8/src/base/sanitizer/lsan-virtual-address-space.h @@ -70,8 +70,8 @@ class V8_BASE_EXPORT LsanVirtualAddressSpace final std::unique_ptr AllocateSubspace( Address hint, size_t size, size_t alignment, PagePermissions max_page_permissions, - std::optional key = std::nullopt, - PlatformSharedMemoryHandle handle = kInvalidSharedMemoryHandle) override; + std::optional key, + PlatformSharedMemoryHandle handle) override; bool DiscardSystemPages(Address address, size_t size) override { return vas_->DiscardSystemPages(address, size); diff --git a/deps/v8/src/base/small-vector.h b/deps/v8/src/base/small-vector.h index 23cb27c7652abb..258831dd49d8bb 100644 --- a/deps/v8/src/base/small-vector.h +++ b/deps/v8/src/base/small-vector.h @@ -11,6 +11,7 @@ #include "src/base/bits.h" #include "src/base/macros.h" +#include "src/base/memcopy.h" #include "src/base/vector.h" namespace v8 { @@ -124,7 +125,8 @@ class SmallVector { DCHECK_GE(capacity(), other.size()); // Sanity check. size_t other_size = other.size(); if constexpr (kHasTrivialElement) { - std::move(other.begin_, other.end_, begin_); + // Ranges cannot overlap and we can just emit a trivial memcpy. + base::MemCopy(begin_, other.begin_, other_size * sizeof(T)); } else { ptrdiff_t to_move = std::min(static_cast(other_size), end_ - begin_); diff --git a/deps/v8/src/base/template-meta-programming/list.h b/deps/v8/src/base/template-meta-programming/list.h index dc06ab940ff7c6..0376b7fc4ca87b 100644 --- a/deps/v8/src/base/template-meta-programming/list.h +++ b/deps/v8/src/base/template-meta-programming/list.h @@ -101,11 +101,18 @@ template , Cmp> : std::bool_constant<(Cmp::value && ...)> {}; -template +template struct append_impl; -template -struct append_impl, T> { - using type = list; +template +struct append_impl, Ts...> { + using type = list; +}; + +template +struct append1_impl; +template +struct append1_impl, Ts...> { + using type = list1; }; template @@ -123,19 +130,20 @@ struct insert_at_impl<0, T, list, list> { using type = list; }; -template +template struct insert_at1_impl; -template -struct insert_at1_impl, list1> - : insert_at1_impl, list1> {}; -template -struct insert_at1_impl, list<>> { - using type = list1; +template +struct insert_at1_impl, list1, Ts...> + : insert_at1_impl, list1, Ts...> {}; +template +struct insert_at1_impl, list1<>, Ts...> { + using type = list1; }; -template -struct insert_at1_impl<0, T, list1, list1> { - using type = list1; +template +struct insert_at1_impl<0, list1, list1, Ts...> { + using type = list1; }; template