deps: update V8 to 12.9.202.18

PR-URL: https://github.com/nodejs/node/pull/54536
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
Michaël Zasso 2024-09-17 12:09:47 +02:00 committed by Node.js GitHub Bot
parent b446a587ba
commit 5ab3140dfb
1270 changed files with 69500 additions and 18922 deletions

View file

@ -1,9 +1,9 @@
root = true
# editorconfig.org
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

4
deps/v8/.gitignore vendored
View file

@ -88,8 +88,8 @@
!/third_party/test262-harness
!/third_party/v8
!/third_party/wasm-api
/tools/builtins-pgo/profiles/*.profile
/tools/builtins-pgo/profiles/profiles_version
/tools/builtins-pgo/profiles/*
!/tools/builtins-pgo/profiles/.*
/tools/clang
/tools/gcmole/bootstrap
/tools/gcmole/gcmole-tools

5
deps/v8/AUTHORS vendored
View file

@ -143,11 +143,11 @@ Henrique Ferreiro <henrique.ferreiro@gmail.com>
Helmut Januschka <helmut@januschka.com>
Hirofumi Mako <mkhrfm@gmail.com>
Hisham Muhammad <hisham@gobolinux.org>
Ho Cheung <uioptt24@gmail.com>
Honggyu Kim <honggyu.kp@gmail.com>
Huáng Jùnliàng <jlhwung@gmail.com>
HyeockJin Kim <kherootz@gmail.com>
Iain Ireland <iireland@mozilla.com>
Ilya Gavrilin <ilya.gavrilin@syntacore.com>
Ingvar Stepanyan <me@rreverser.com>
Ioseb Dzmanashvili <ioseb.dzmanashvili@gmail.com>
Isiah Meadows <impinball@gmail.com>
@ -170,6 +170,7 @@ Joel Stanley <joel@jms.id.au>
Johan Bergström <johan@bergstroem.nu>
Johan Levin <johan13@gmail.com>
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Jojo R <rjiejie@gmail.com>
Jonathan Liu <net147@gmail.com>
Juan Arboleda <soyjuanarbol@gmail.com>
Julien Brianceau <jbriance@cisco.com>
@ -205,6 +206,7 @@ Matt Hanselman <mjhanselman@gmail.com>
Matthew Sporleder <msporleder@gmail.com>
Maxim Mazurok <maxim@mazurok.com>
Maxim Mossienko <maxim.mossienko@gmail.com>
Md Hasibul Hasan <hasibulhasan873@gmail.com>
Meir Shpilraien <meir@redis.com>
Michael Lutz <michi@icosahedron.de>
Michael Mclaughlin <m8ch88l@gmail.com>
@ -312,6 +314,7 @@ Yuxiang Cao <caoyxsh@outlook.com>
Zac Hansen <xaxxon@gmail.com>
Zeynep Cankara <zeynepcankara402@gmail.com>
Zhao Jiazhong <kyslie3100@gmail.com>
Zhaojun Meng <zhaojun.meng@gmail.com>
Zheng Liu <i6122f@gmail.com>
Zhongping Wang <kewpie.w.zp@gmail.com>
柳荣一 <admin@web-tinker.com>

80
deps/v8/BUILD.bazel vendored
View file

@ -43,7 +43,6 @@ load(":bazel/v8-non-pointer-compression.bzl", "v8_binary_non_pointer_compression
# v8_enable_concurrent_marking
# v8_enable_conservative_stack_scanning
# v8_enable_direct_handle
# v8_enable_direct_local
# v8_enable_local_off_stack_check
# v8_enable_ignition_dispatch_counting
# v8_enable_builtins_optimization
@ -208,6 +207,49 @@ v8_flag(
default = True,
)
v8_flag(
name = "v8_enable_drumbrake",
default = False,
)
v8_flag(
name = "v8_enable_drumbrake_tracing",
default = False,
)
selects.config_setting_group(
name = "enable_drumbrake_x64",
match_all = [
":is_v8_enable_drumbrake",
"@v8//bazel/config:v8_target_x64",
],
)
selects.config_setting_group(
name = "enable_drumbrake_arm64",
match_all = [
":is_v8_enable_drumbrake",
"@v8//bazel/config:v8_target_arm64",
],
)
selects.config_setting_group(
name = "is_drumbrake_trap_handling_platform",
match_any = [
"@v8//bazel/config:is_linux",
"@v8//bazel/config:is_macos",
"@v8//bazel/config:is_windows",
],
)
selects.config_setting_group(
name = "v8_drumbrake_bounds_checks",
match_all = [
":enable_drumbrake_x64",
":is_drumbrake_trap_handling_platform",
],
)
v8_flag(
name = "v8_jitless",
default = False,
@ -411,6 +453,8 @@ v8_config(
"v8_enable_verify_heap": "VERIFY_HEAP",
"v8_enable_verify_predictable": "VERIFY_PREDICTABLE",
"v8_enable_webassembly": "V8_ENABLE_WEBASSEMBLY",
"v8_enable_drumbrake": "V8_ENABLE_DRUMBRAKE",
"v8_enable_drumbrake_tracing": "V8_ENABLE_DRUMBRAKE_TRACING",
"v8_jitless": "V8_JITLESS",
"v8_enable_vtunejit": "ENABLE_VTUNE_JIT_INTERFACE",
},
@ -518,7 +562,13 @@ v8_config(
"V8_ENABLE_DOUBLE_CONST_STORE_CHECK",
],
"//conditions:default": [],
}) + select({
"v8_drumbrake_bounds_checks": [
"V8_DRUMBRAKE_BOUNDS_CHECKS"
],
"//conditions:default": [],
}),
deps = [":default"],
)
@ -757,7 +807,6 @@ filegroup(
"src/base/numbers/strtod.h",
"src/base/once.cc",
"src/base/once.h",
"src/base/optional.h",
"src/base/overflowing-math.h",
"src/base/page-allocator.cc",
"src/base/page-allocator.h",
@ -1268,6 +1317,7 @@ filegroup(
"src/builtins/builtins.cc",
"src/builtins/builtins-inl.h",
"src/builtins/builtins.h",
"src/builtins/builtins-abstract-module-source.cc",
"src/builtins/builtins-api.cc",
"src/builtins/builtins-array.cc",
"src/builtins/builtins-arraybuffer.cc",
@ -1402,6 +1452,8 @@ filegroup(
"src/common/ptr-compr.cc",
"src/common/ptr-compr.h",
"src/common/ptr-compr-inl.h",
"src/common/segmented-table.h",
"src/common/segmented-table-inl.h",
"src/common/simd128.h",
"src/compiler-dispatcher/lazy-compile-dispatcher.cc",
"src/compiler-dispatcher/lazy-compile-dispatcher.h",
@ -2916,6 +2968,21 @@ filegroup(
"src/wasm/wrappers.cc",
],
"//conditions:default": [],
}) + select({
":is_v8_enable_drumbrake": [
"src/wasm/interpreter/instruction-handlers.h",
"src/wasm/interpreter/wasm-interpreter.cc",
"src/wasm/interpreter/wasm-interpreter.h",
"src/wasm/interpreter/wasm-interpreter-inl.h",
"src/wasm/interpreter/wasm-interpreter-objects.cc",
"src/wasm/interpreter/wasm-interpreter-objects-inl.h",
"src/wasm/interpreter/wasm-interpreter-objects.h",
"src/wasm/interpreter/wasm-interpreter-runtime.cc",
"src/wasm/interpreter/wasm-interpreter-runtime-inl.h",
"src/wasm/interpreter/wasm-interpreter-runtime.h",
"src/wasm/interpreter/wasm-interpreter-simd.cc",
],
"//conditions:default": [],
}),
)
@ -3307,6 +3374,7 @@ filegroup(
"src/compiler/turboshaft/store-store-elimination-phase.cc",
"src/compiler/turboshaft/store-store-elimination-phase.h",
"src/compiler/turboshaft/store-store-elimination-reducer-inl.h",
"src/compiler/turboshaft/string-view.h",
"src/compiler/turboshaft/structural-optimization-reducer.h",
"src/compiler/turboshaft/tracing.h",
"src/compiler/turboshaft/type-assertions-phase.cc",
@ -3579,6 +3647,14 @@ filegroup(
"src/builtins/builtins-wasm-gen.h",
],
"//conditions:default": [],
}) + select({
":enable_drumbrake_x64": [
"src/wasm/interpreter/x64/interpreter-builtins-x64.cc"
],
":enable_drumbrake_arm64": [
"src/wasm/interpreter/arm64/interpreter-builtins-arm64.cc"
],
"//conditions:default": [],
}),
)

116
deps/v8/BUILD.gn vendored
View file

@ -11,6 +11,7 @@ import("//build/config/mips.gni")
import("//build/config/riscv.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build_overrides/build.gni")
import("//third_party/icu/config.gni")
import("gni/snapshot_toolchain.gni")
import("gni/v8.gni")
@ -141,11 +142,6 @@ declare_args() {
# Enable code-generation-time checking of types in the CodeStubAssembler.
v8_enable_verify_csa = false
# Enable pointer compression (sets -dV8_COMPRESS_POINTERS).
v8_enable_pointer_compression = ""
v8_enable_pointer_compression_shared_cage = ""
v8_enable_31bit_smis_on_64bit_arch = false
# Sets -dOBJECT_PRINT.
v8_enable_object_print = ""
@ -339,6 +335,9 @@ declare_args() {
# Sets -DV8_ENABLE_SANDBOX.
v8_enable_sandbox = ""
# Explicitly disable leaptiering (on builds where it would otherwise be enabled).
v8_disable_leaptiering = ""
# Enable the memory corruption API. Useful for testing the sandbox.
# The memory corruption API is only exposed to JavaScript if sandbox testing
# mode is enabled at runtime, for example via --sandbox-fuzzing.
@ -391,6 +390,19 @@ declare_args() {
# This is only used by nodejs.
v8_scriptormodule_legacy_lifetime = false
# WebAssembly interpreter (DrumBrake) build flag.
v8_enable_drumbrake = false
# Enable Wasm interpreter tracing.
v8_enable_drumbrake_tracing = false
# On non-Desktop platforms, enable explicit bounds checks in the Wasm
# interpreter, where the bounds checking is done in the instruction handler,
# not using an unhandled exception filter (which also doesn't work with Win-ASAN).
v8_drumbrake_bounds_checks =
(is_win && (is_asan || is_ubsan || is_msan || is_tsan)) ||
!(is_win || is_linux || is_mac) || v8_current_cpu != "x64"
# Enables pointer compression for 8GB heaps.
# Sets -DV8_COMPRESS_POINTERS_8GB.
v8_enable_pointer_compression_8gb = ""
@ -429,6 +441,9 @@ declare_args() {
# ReadOnlySpace.
v8_enable_extensible_ro_snapshot = true
# Enable Turboshaft CSA pipeline.
v8_enable_turboshaft_csa = false
# Use sticky mark-bits for separating object generations.
v8_enable_sticky_mark_bits = false
@ -477,9 +492,11 @@ if (v8_enable_debug_code == "") {
if (v8_enable_snapshot_native_code_counters == "") {
v8_enable_snapshot_native_code_counters = v8_enable_debugging_features
}
if (v8_enable_pointer_compression == "") {
v8_enable_pointer_compression =
v8_current_cpu == "arm64" || v8_current_cpu == "x64"
if (v8_enable_drumbrake && v8_enable_webassembly) {
assert(
is_drumbrake_supported,
"DrumBrake is only available on x64, arm64 on Windows, Linux and MacOS.")
}
# Toggle pointer compression for correctness fuzzing when building the
@ -586,6 +603,10 @@ if (v8_enable_sandbox == "") {
v8_enable_external_code_space && target_os != "fuchsia"
}
if (v8_disable_leaptiering == "") {
v8_disable_leaptiering = false
}
if (v8_enable_static_roots == "") {
# Static roots are only valid for builds with pointer compression and a
# shared read-only heap.
@ -886,7 +907,7 @@ external_v8_defines = [
"V8_MAP_PACKING",
"V8_IS_TSAN",
"V8_ENABLE_CONSERVATIVE_STACK_SCANNING",
"V8_ENABLE_DIRECT_LOCAL",
"V8_ENABLE_DIRECT_HANDLE",
"V8_MINORMS_STRING_SHORTCUTTING",
"V8_HAVE_TARGET_OS",
"V8_TARGET_OS_ANDROID",
@ -940,8 +961,8 @@ if (is_tsan) {
if (v8_enable_conservative_stack_scanning) {
enabled_external_v8_defines += [ "V8_ENABLE_CONSERVATIVE_STACK_SCANNING" ]
}
if (v8_enable_direct_local) {
enabled_external_v8_defines += [ "V8_ENABLE_DIRECT_LOCAL" ]
if (v8_enable_direct_handle) {
enabled_external_v8_defines += [ "V8_ENABLE_DIRECT_HANDLE" ]
}
if (v8_shortcut_strings_in_minor_ms) {
enabled_external_v8_defines += [ "V8_MINORMS_STRING_SHORTCUTTING" ]
@ -1258,6 +1279,15 @@ config("features") {
if (v8_advanced_bigint_algorithms) {
defines += [ "V8_ADVANCED_BIGINT_ALGORITHMS" ]
}
if (v8_enable_drumbrake) {
defines += [ "V8_ENABLE_DRUMBRAKE" ]
if (v8_enable_drumbrake_tracing) {
defines += [ "V8_ENABLE_DRUMBRAKE_TRACING" ]
}
if (v8_drumbrake_bounds_checks) {
defines += [ "V8_DRUMBRAKE_BOUNDS_CHECKS" ]
}
}
if (v8_enable_memory_corruption_api) {
defines += [ "V8_ENABLE_MEMORY_CORRUPTION_API" ]
}
@ -1291,9 +1321,6 @@ config("features") {
if (v8_enable_builtin_jump_table_switch) {
defines += [ "V8_ENABLE_BUILTIN_JUMP_TABLE_SWITCH" ]
}
if (v8_enable_direct_handle) {
defines += [ "V8_ENABLE_DIRECT_HANDLE" ]
}
if (v8_enable_extensible_ro_snapshot) {
defines += [ "V8_ENABLE_EXTENSIBLE_RO_SNAPSHOT" ]
}
@ -1306,6 +1333,9 @@ config("features") {
if (v8_enable_experimental_tsa_builtins) {
defines += [ "V8_ENABLE_EXPERIMENTAL_TSA_BUILTINS" ]
}
if (v8_disable_leaptiering) {
defines += [ "V8_DISABLE_LEAPTIERING" ]
}
}
config("toolchain") {
@ -1445,6 +1475,9 @@ config("toolchain") {
if (!is_clang) {
cflags += [ "-ffp-contract=off" ]
}
if (riscv_use_sv39) {
defines += [ "RISCV_USE_SV39" ]
}
}
if (v8_current_cpu == "riscv32") {
@ -2420,6 +2453,15 @@ template("run_mksnapshot") {
sources = []
if (icu_use_data_file) {
deps += [ "//third_party/icu:copy_icudata" ]
if (host_byteorder == "big") {
sources += [ "$root_out_dir/icudtb.dat" ]
} else {
sources += [ "$root_out_dir/icudtl.dat" ]
}
}
outputs = []
data = []
@ -2479,6 +2521,10 @@ template("run_mksnapshot") {
}
}
if (v8_enable_turboshaft_csa) {
args += [ "--turboshaft-csa" ]
}
# This is needed to distinguish between generating code for the simulator
# and cross-compiling. The latter may need to run code on the host with the
# simulator but cannot use simulator-specific instructions.
@ -2720,7 +2766,6 @@ action("v8_dump_build_config") {
"debugging_features=$v8_enable_debugging_features",
"dict_property_const_tracking=$v8_dict_property_const_tracking",
"direct_handle=$v8_enable_direct_handle",
"direct_local=$v8_enable_direct_local",
"disassembler=$v8_enable_disassembler",
"full_debug=$is_full_debug",
"gdbjit=$v8_enable_gdbjit",
@ -2728,6 +2773,7 @@ action("v8_dump_build_config") {
"has_maglev=$v8_enable_maglev",
"has_turbofan=$v8_enable_turbofan",
"has_webassembly=$v8_enable_webassembly",
"has_wasm_interpreter=$v8_enable_drumbrake",
"i18n=$v8_enable_i18n_support",
"is_android=$is_android",
"is_ios=$is_ios",
@ -2777,7 +2823,6 @@ generated_file("v8_generate_features_json") {
v8_enable_conservative_stack_scanning =
v8_enable_conservative_stack_scanning
v8_enable_direct_handle = v8_enable_direct_handle
v8_enable_direct_local = v8_enable_direct_local
v8_enable_extensible_ro_snapshot = v8_enable_extensible_ro_snapshot
v8_enable_gdbjit = v8_enable_gdbjit
v8_enable_hugepage = v8_enable_hugepage
@ -2960,6 +3005,15 @@ v8_source_set("v8_initializers") {
"src/builtins/builtins-wasm-gen.cc",
"src/builtins/builtins-wasm-gen.h",
]
if (v8_enable_drumbrake) {
if (v8_current_cpu == "x64") {
sources += [ "src/wasm/interpreter/x64/interpreter-builtins-x64.cc" ]
} else if (v8_current_cpu == "arm64") {
sources +=
[ "src/wasm/interpreter/arm64/interpreter-builtins-arm64.cc" ]
}
}
}
if (v8_current_cpu == "x86") {
@ -3324,6 +3378,8 @@ v8_header_set("v8_internal_headers") {
"src/common/operation.h",
"src/common/ptr-compr-inl.h",
"src/common/ptr-compr.h",
"src/common/segmented-table-inl.h",
"src/common/segmented-table.h",
"src/common/simd128.h",
"src/compiler-dispatcher/lazy-compile-dispatcher.h",
"src/compiler-dispatcher/optimizing-compile-dispatcher.h",
@ -3521,6 +3577,7 @@ v8_header_set("v8_internal_headers") {
"src/compiler/turboshaft/stack-check-lowering-reducer.h",
"src/compiler/turboshaft/store-store-elimination-phase.h",
"src/compiler/turboshaft/store-store-elimination-reducer-inl.h",
"src/compiler/turboshaft/string-view.h",
"src/compiler/turboshaft/structural-optimization-reducer.h",
"src/compiler/turboshaft/tracing.h",
"src/compiler/turboshaft/type-assertions-phase.h",
@ -4395,6 +4452,18 @@ v8_header_set("v8_internal_headers") {
"src/wasm/wasm-value.h",
"src/wasm/well-known-imports.h",
]
if (v8_enable_drumbrake) {
sources += [
"src/wasm/interpreter/instruction-handlers.h",
"src/wasm/interpreter/wasm-interpreter-inl.h",
"src/wasm/interpreter/wasm-interpreter-objects-inl.h",
"src/wasm/interpreter/wasm-interpreter-objects.h",
"src/wasm/interpreter/wasm-interpreter-runtime-inl.h",
"src/wasm/interpreter/wasm-interpreter-runtime.h",
"src/wasm/interpreter/wasm-interpreter.h",
]
}
}
if (v8_enable_wasm_simd256_revec) {
@ -4739,6 +4808,7 @@ v8_header_set("v8_internal_headers") {
"src/codegen/riscv/constant-riscv-f.h",
"src/codegen/riscv/constant-riscv-m.h",
"src/codegen/riscv/constant-riscv-v.h",
"src/codegen/riscv/constant-riscv-zicond.h",
"src/codegen/riscv/constant-riscv-zicsr.h",
"src/codegen/riscv/constant-riscv-zifencei.h",
"src/codegen/riscv/constants-riscv.h",
@ -4750,6 +4820,7 @@ v8_header_set("v8_internal_headers") {
"src/codegen/riscv/extension-riscv-inl.h",
"src/codegen/riscv/extension-riscv-m.h",
"src/codegen/riscv/extension-riscv-v.h",
"src/codegen/riscv/extension-riscv-zicond.h",
"src/codegen/riscv/extension-riscv-zicsr.h",
"src/codegen/riscv/extension-riscv-zifencei.h",
"src/codegen/riscv/interface-descriptors-riscv-inl.h",
@ -5284,6 +5355,7 @@ v8_source_set("v8_base_without_compiler") {
"src/baseline/baseline.cc",
"src/baseline/bytecode-offset-iterator.cc",
"src/builtins/accessors.cc",
"src/builtins/builtins-abstract-module-source.cc",
"src/builtins/builtins-api.cc",
"src/builtins/builtins-array.cc",
"src/builtins/builtins-arraybuffer.cc",
@ -5861,6 +5933,15 @@ v8_source_set("v8_base_without_compiler") {
"src/wasm/fuzzing/random-module-generation.cc",
]
}
if (v8_enable_drumbrake) {
sources += [
"src/wasm/interpreter/wasm-interpreter-objects.cc",
"src/wasm/interpreter/wasm-interpreter-runtime.cc",
"src/wasm/interpreter/wasm-interpreter-simd.cc",
"src/wasm/interpreter/wasm-interpreter.cc",
]
}
}
if (v8_enable_third_party_heap) {
@ -6101,6 +6182,7 @@ v8_source_set("v8_base_without_compiler") {
"src/codegen/riscv/extension-riscv-f.cc",
"src/codegen/riscv/extension-riscv-m.cc",
"src/codegen/riscv/extension-riscv-v.cc",
"src/codegen/riscv/extension-riscv-zicond.cc",
"src/codegen/riscv/extension-riscv-zicsr.cc",
"src/codegen/riscv/extension-riscv-zifencei.cc",
"src/codegen/riscv/macro-assembler-riscv.cc",
@ -6140,6 +6222,7 @@ v8_source_set("v8_base_without_compiler") {
"src/codegen/riscv/extension-riscv-f.cc",
"src/codegen/riscv/extension-riscv-m.cc",
"src/codegen/riscv/extension-riscv-v.cc",
"src/codegen/riscv/extension-riscv-zicond.cc",
"src/codegen/riscv/extension-riscv-zicsr.cc",
"src/codegen/riscv/extension-riscv-zifencei.cc",
"src/codegen/riscv/macro-assembler-riscv.cc",
@ -6462,7 +6545,6 @@ v8_component("v8_libbase") {
"src/base/numbers/strtod.h",
"src/base/once.cc",
"src/base/once.h",
"src/base/optional.h",
"src/base/overflowing-math.h",
"src/base/page-allocator.cc",
"src/base/page-allocator.h",

209
deps/v8/DEPS vendored
View file

@ -39,6 +39,9 @@ vars = {
# Fetch clang-tidy into the same bin/ directory as our clang binary.
'checkout_clang_tidy': False,
# Fetch clangd into the same bin/ directory as our clang binary.
'checkout_clangd': False,
# Fetch and build V8 builtins with PGO profiles
'checkout_v8_builtins_pgo_profiles': False,
@ -57,7 +60,7 @@ vars = {
'checkout_fuchsia_no_hooks': False,
# reclient CIPD package version
'reclient_version': 're_client_version:0.150.1.d9707319-gomaip',
'reclient_version': 're_client_version:0.157.0.d2566cec-gomaip',
# Fetch configuration files required for the 'use_remoteexec' gn arg
'download_remoteexec_cfg': False,
@ -73,22 +76,22 @@ vars = {
'build_with_chromium': False,
# GN CIPD package version.
'gn_version': 'git_revision:b2afae122eeb6ce09c52d63f67dc53fc517dbdc8',
'gn_version': 'git_revision:54f5b539df8c4e460b18c62a11132d77b5601136',
# ninja CIPD package version
# https://chrome-infra-packages.appspot.com/p/infra/3pp/build_support/ninja-1_11_1/
'ninja_version': 'version:2@1.11.1.chromium.2',
# https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja
'ninja_version': 'version:2@1.12.1.chromium.4',
# siso CIPD package version
'siso_version': 'git_revision:50a6db5dae3978d2d2e8dce29f6df024dde48d1b',
'siso_version': 'git_revision:87262779ecc3482c8c60b070404b225107212d0d',
# luci-go CIPD package version.
'luci_go': 'git_revision:771ea9a614a104c71655f699ef82219a2a474817',
'luci_go': 'git_revision:ad7b787aa0ee53a81bc88fb4f7fee7a3ff1e8c29',
# 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:22.20240717.4.1',
'fuchsia_version': 'version:23.20240815.4.1',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling android_sdk_build-tools_version
@ -121,14 +124,14 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling android_sdk_tools-lint_version
# and whatever else without interference from each other.
'android_sdk_cmdline-tools_version': 'mU9jm4LkManzjSzRquV1UIA7fHBZ2pK7NtbCXxoVnVUC',
'android_sdk_cmdline-tools_version': 'fv6JzkTqfxfIbmsRC8u1b2y0EQO7yQDMDzY3-g0NVu4C',
}
deps = {
'build':
Var('chromium_url') + '/chromium/src/build.git' + '@' + '7a8285c06acd753e6228263f48e5595e20ca1577',
Var('chromium_url') + '/chromium/src/build.git' + '@' + '7a468ed1849454cffabf4a64110c24e6f1da2c51',
'buildtools':
Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '3ef44a2b92d5dd1faa5189a06f3a5febe6db2d58',
Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '60a590902cf146c282f15242401bd8543256e2a2',
'buildtools/linux64': {
'packages': [
{
@ -174,7 +177,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' + '@' + 'b01075d87cf48f69a468d75a0eb7c372902965c7',
Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + 'bcb42e339dbac06f2f9902046b1fbf62562e0cd3',
'third_party/android_platform': {
'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + '6337c445f9963ec3914e7e0c5787941d07b46509',
'condition': 'checkout_android',
@ -221,22 +224,22 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_toolchain/android_toolchain',
'version': 'h9HeidXTeHQ-oskldbqCZx26-7VrVvXpLfqOI87uy4QC',
'version': 'Idl-vYnWGnM8K3XJhM3h6zjYVDXlnljVz3FE00V9IM8C',
},
],
'condition': 'checkout_android',
'dep_type': 'cipd',
},
'third_party/boringssl': {
'url': Var('chromium_url') + '/chromium/src/third_party/boringssl.git' + '@' + '35f4fcbdeae229a56fd50320dc03ae6de407aca4',
'url': Var('chromium_url') + '/chromium/src/third_party/boringssl.git' + '@' + '4d98a91cde88f349b96f4018c00053b6699ffd88',
'condition': "checkout_centipede_deps",
},
'third_party/boringssl/src': {
'url': Var('boringssl_url') + '/boringssl.git' + '@' + 'f01108e4761e1d4189cb134322c3cb01dc71ef87',
'url': Var('boringssl_url') + '/boringssl.git' + '@' + '11f334121fd0d13830fefdf08041183da2d30ef3',
'condition': "checkout_centipede_deps",
},
'third_party/catapult': {
'url': Var('chromium_url') + '/catapult.git' + '@' + '16999365265c9850d7b5c46e53ddd52aca56f8dc',
'url': Var('chromium_url') + '/catapult.git' + '@' + '799e21b232f23f6c1391abfd44fe8ab1dd95bd9b',
'condition': 'checkout_android',
},
'third_party/clang-format/script':
@ -250,7 +253,7 @@ deps = {
'condition': 'checkout_android',
},
'third_party/depot_tools':
Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + 'cdcdd6efeec145eb246eeac20c78f2c55c9d393e',
Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '0bc7c4832e4f2d453e4826c9a2e1197e11bd6ec7',
'third_party/fp16/src':
Var('chromium_url') + '/external/github.com/Maratyszcza/FP16.git' + '@' + '0a92994d729ff76a58f692d3028ca1b64b145d91',
'third_party/fuchsia-gn-sdk': {
@ -280,7 +283,7 @@ deps = {
'third_party/fuzztest/src':
Var('chromium_url') + '/external/github.com/google/fuzztest.git' + '@' + '32eb84a95951fa3a0148fb3e6a1a02f830ded136',
'third_party/googletest/src':
Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + 'cee1ba1f24fb12b9ae8f31e70dca3f73dbb12cc2',
Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + 'ff233bdd4cac0a0bf6e5cd45bda3406814cb2796',
'third_party/highway/src':
Var('chromium_url') + '/external/github.com/google/highway.git' + '@' + '8295336dd70f1201d42c22ab5b0861de38cf8fbf',
'third_party/icu':
@ -300,125 +303,153 @@ 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' + '@' + '6bb75caa139ee1e686d2205910454cf6ea212e58',
Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + 'f801c947082a3e0a4b48780303526b73905f6ecd',
'third_party/libc++abi/src':
Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + 'a3c7d3e2f3e1e724b4651891b1a71257cbd88acc',
Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + 'eb6567388e89d9730c76dee71d68ac82e4a1abf6',
'third_party/libunwind/src':
Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + 'd09db732ff68f40fd3581306c650b17ea1955b4e',
Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + '116c20dae60d84a77005697cf29f72783f81b0f9',
'third_party/llvm-build/Release+Asserts': {
'dep_type': 'gcs',
'bucket': 'chromium-browser-clang',
'objects': [
{
'object_name': 'Linux_x64/clang-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': '2c48fb44f408328f59482a1dafb2143bb8b6b04be23f407600117e6f6d4fa437',
'size_bytes': 51489572,
'generation': 1721105679311662,
'object_name': 'Linux_x64/clang-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': '32ac9d9864a6bd99242f1a97778b3a074ac1151ce3eca369903f2ef5337c787a',
'size_bytes': 52250752,
'generation': 1723267014378582,
'condition': 'host_os == "linux"',
},
{
'object_name': 'Linux_x64/clang-tidy-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': '3570497c3c507be0f8f4c0aa149a57fc600ed49252da42676996ea651df05e60',
'size_bytes': 13081104,
'generation': 1721105679453016,
'object_name': 'Linux_x64/clang-tidy-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': '5fd3fb73ceef73593fa09f8228283aec9f7798b648bf450e87f071a097be213b',
'size_bytes': 13217676,
'generation': 1723267014627839,
'condition': 'host_os == "linux" and checkout_clang_tidy',
},
{
'object_name': 'Linux_x64/llvm-code-coverage-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': 'dd6f1c05d5fe244b4524af86e6aa20de2d730f7d7e01fe4002b5aa72347b7658',
'size_bytes': 2357488,
'generation': 1721105679795112,
'object_name': 'Linux_x64/clangd-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': '6e1fe97f8b7131591233d8a2df1ff289ffb878c3fc6834c978a86273f7c00b6b',
'size_bytes': 26125984,
'generation': 1723267014767012,
'condition': 'host_os == "linux" and checkout_clangd',
},
{
'object_name': 'Linux_x64/llvm-code-coverage-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': 'ef317481472926d3e2a82e2d2a02cde78685002b4c9923df476108906022d792',
'size_bytes': 2374748,
'generation': 1723267015213805,
'condition': 'host_os == "linux" and checkout_clang_coverage_tools',
},
{
'object_name': 'Linux_x64/llvmobjdump-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': 'a93d8b39ac573376a2db77b04f014d8751375de8c70ee16ca4713e5da467c5ec',
'size_bytes': 5387304,
'generation': 1721105679641287,
'object_name': 'Linux_x64/llvmobjdump-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': '02be68f7c7c7bf679e1abff2745306b8385275017c89b2b13f638a941785f8c5',
'size_bytes': 5386480,
'generation': 1723267014930087,
'condition': '(checkout_linux or checkout_mac or checkout_android and host_os != "mac")',
},
{
'object_name': 'Mac/clang-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': '04956a3db535f4cf1ab0a6e40383cbb5db7d6ee09721e31a706d230af206eaa0',
'size_bytes': 46446976,
'generation': 1721105680965575,
'object_name': 'Mac/clang-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': '5df8a609a7d2511343fbc20af1de3ed1682c3703fc074f21af1bf8bc2f58e491',
'size_bytes': 47200408,
'generation': 1723267016534642,
'condition': 'host_os == "mac" and host_cpu == "x64"',
},
{
'object_name': 'Mac/clang-mac-runtime-library-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': 'c684d46962bd39f785a143c2b28a0400c6e6d41a610a04ad6982f7513b930a35',
'size_bytes': 865444,
'generation': 1721105687851327,
'object_name': 'Mac/clang-mac-runtime-library-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': 'ffc72ff3fca85f31340c164aab480bd2babfaa6219ff12e93b81f0056309da55',
'size_bytes': 869616,
'generation': 1723267034708598,
'condition': 'checkout_mac and not host_os == "mac"',
},
{
'object_name': 'Mac/clang-tidy-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': '1bcfd396959c5f0e835e33f7bd15f29b2a1b1b27c619480dab767d034da48098',
'size_bytes': 12650532,
'generation': 1721105681146275,
'object_name': 'Mac/clang-tidy-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': 'd02b9a39491d2ff3a291778de87b2a72f5885d01a8093518cb5612b97353ac2a',
'size_bytes': 12805336,
'generation': 1723267016822831,
'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clang_tidy',
},
{
'object_name': 'Mac/llvm-code-coverage-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': 'dbaf0d0bc4d19be0a9bd033b94033a2e9f826f8ed4ec3e9e6fa732ca3b4f1b6f',
'size_bytes': 2234200,
'generation': 1721105681470376,
'object_name': 'Mac/clangd-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': 'ce09141be75350f0f932fcda14d8b906d2869674d79ef5a10a3e60a9a8d3ccee',
'size_bytes': 26372428,
'generation': 1723267016957114,
'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clangd',
},
{
'object_name': 'Mac/llvm-code-coverage-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': 'c0ac62ff01f1ce6e5d30134cb0f83fd8eabf858dfb33d07209a6b40d8f1ae789',
'size_bytes': 2248664,
'generation': 1723267017743181,
'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clang_coverage_tools',
},
{
'object_name': 'Mac_arm64/clang-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': '3d8d0a32604b9c8f9add4865d4e2b4950607d2a201bcd1c3de9e67e2998f1a84',
'size_bytes': 42076344,
'generation': 1721105689042846,
'object_name': 'Mac_arm64/clang-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': 'f4a384ecdaa051ba4786c9e6c46f9101a751b1a5c5ad4bf0d217c4ba71e0ff30',
'size_bytes': 42737720,
'generation': 1723267036349494,
'condition': 'host_os == "mac" and host_cpu == "arm64"',
},
{
'object_name': 'Mac_arm64/clang-tidy-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': '12524e94777f1d78489f58bcd966a341c8a61dca56175c7d6e8835240b2dcade',
'size_bytes': 11612984,
'generation': 1721105689155910,
'object_name': 'Mac_arm64/clang-tidy-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': '2769378fd2891af945f8d29b5eaf05b4ab0450b2d086539df1c78c684e64be14',
'size_bytes': 11740656,
'generation': 1723267036269250,
'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clang_tidy',
},
{
'object_name': 'Mac_arm64/llvm-code-coverage-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': '85db7e11d059902cd2c3d04e1d0380524d0ef4bf6ec3c93f0afdfd663d8b2a64',
'size_bytes': 2005884,
'generation': 1721105689448152,
'object_name': 'Mac_arm64/clangd-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': 'a35dfb99903a487e06d685712e461125978c76ba8eaa99e9f5742e63d3e67444',
'size_bytes': 23470088,
'generation': 1723267036383208,
'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clangd',
},
{
'object_name': 'Mac_arm64/llvm-code-coverage-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': '574a0d7c560aae964d8bdcd85f0145077b1324e79eee4a3dd1636ab7aefc59e5',
'size_bytes': 2010540,
'generation': 1723267036758678,
'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clang_coverage_tools',
},
{
'object_name': 'Win/clang-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': '34ba04b75548fdce4b3d2ba9dc8320a11afb0cad8622d537c1cf37f1c5587bab',
'size_bytes': 41800448,
'generation': 1721105697679553,
'object_name': 'Win/clang-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': 'e255af29c29a741cf39c3000b612466ff805a99766d26ac86ec2afcb4ca0c922',
'size_bytes': 44019080,
'generation': 1723267056892790,
'condition': 'host_os == "win"',
},
{
'object_name': 'Win/clang-tidy-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': '41fe89c54964a6a8efb66c398dbf763e8a4aca6a675c6f4d15a94c5236ba1ab7',
'size_bytes': 12869556,
'generation': 1721105697770165,
'object_name': 'Win/clang-tidy-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': 'a86aa579fc90a053b94874a8c79daeb7f3bbd77107fb460c6d0a7959cefb7e61',
'size_bytes': 13055812,
'generation': 1723267057185720,
'condition': 'host_os == "win" and checkout_clang_tidy',
},
{
'object_name': 'Win/clang-win-runtime-library-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': 'ce7886ecbfb129660a14cc11c4eacd6a2ef6488b36a88a7afb71a8cd22277da0',
'size_bytes': 2842872,
'generation': 1721105704724295,
'object_name': 'Win/clang-win-runtime-library-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': '6d89f358769ef50d008194e0ab9e8d4d80b8d6ffc0095ed44aef925d900aa743',
'size_bytes': 2873772,
'generation': 1723267074433695,
'condition': 'checkout_win and not host_os == "win"',
},
{
'object_name': 'Win/llvm-code-coverage-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': 'e5778f9a2fa59936676579b01b3b576d8c545b72e5261c47a36751d4f1f6b61a',
'size_bytes': 2357104,
'generation': 1721105698068261,
'object_name': 'Win/clangd-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': 'e2b69a726f794005a333ae66a0ef5c0258872a19bc4506eff23f23fdee75ba5c',
'size_bytes': 25053884,
'generation': 1723267057351794,
'condition': 'host_os == "win" and checkout_clangd',
},
{
'object_name': 'Win/llvm-code-coverage-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': 'e68e7c7ecbc7b2fc4f7ec3e97565a7f12bab1d195d22bc76959f3a88b1462ac1',
'size_bytes': 2376020,
'generation': 1723267057803475,
'condition': 'host_os == "win" and checkout_clang_coverage_tools',
},
{
'object_name': 'Win/llvmobjdump-llvmorg-19-init-14561-gecea8371-3.tar.xz',
'sha256sum': 'ad7d9162e1632b5c64188f95362318f0d31e09002be0615df847f2c23cddef4c',
'size_bytes': 5362484,
'generation': 1721105697937832,
'object_name': 'Win/llvmobjdump-llvmorg-20-init-1009-g7088a5ed-10.tar.xz',
'sha256sum': '801714415847b8efea7252b1072b8647f92ba0e946480b3db9b156900e42ab55',
'size_bytes': 5392812,
'generation': 1723267057506056,
'condition': 'checkout_linux or checkout_mac or checkout_android and host_os == "win"',
},
],
@ -430,7 +461,7 @@ deps = {
'third_party/ninja': {
'packages': [
{
'package': 'infra/3pp/build_support/ninja-1_11_1/${{platform}}',
'package': 'infra/3pp/tools/ninja/${{platform}}',
'version': Var('ninja_version'),
}
],
@ -439,7 +470,7 @@ deps = {
},
'third_party/perfetto':
Var('android_url') + '/platform/external/perfetto.git' + '@' + '6fc824d618d2f06b5d9cd8655ba0419b6b3b366e',
'third_party/protobuf_chrome':
'third_party/protobuf':
Var('chromium_url') + '/chromium/src/third_party/protobuf.git' + '@' + 'da2fe725b80ac0ba646fbf77d0ce5b4ac236f823',
'third_party/re2/src':
Var('chromium_url') + '/external/github.com/google/re2.git' + '@' + '6dcd83d60f7944926bfd308cc13979fc53dd69ca',
@ -458,9 +489,9 @@ deps = {
'condition': 'not build_with_chromium and host_cpu != "s390" and host_os != "zos" and host_cpu != "ppc"',
},
'third_party/zlib':
Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + 'c2469fdd73f192383d2d94288da0ff5b9a3869f5',
Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + 'd3aea2341cdeaf7e717bc257a59aa7a9407d318a',
'tools/clang':
Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '4dc76da47b1145e53e508a23c1bf2204cf5ee7ee',
Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '63b7be17f8981d716ea9a0d65bb04654d79548a8',
'tools/luci-go': {
'packages': [
{
@ -478,7 +509,7 @@ deps = {
'tools/protoc_wrapper':
Var('chromium_url') + '/chromium/src/tools/protoc_wrapper.git' + '@' + 'dbcbea90c20ae1ece442d8ef64e61c7b10e2b013',
'third_party/abseil-cpp': {
'url': Var('chromium_url') + '/chromium/src/third_party/abseil-cpp.git' + '@' + '9d1552f25c3d9e9114b7d7aed55790570a99bc4d',
'url': Var('chromium_url') + '/chromium/src/third_party/abseil-cpp.git' + '@' + 'ed3733b91e472a1e7a641c1f0c1e6c0ea698e958',
'condition': 'not build_with_chromium',
},
'third_party/zoslib': {

View file

@ -549,7 +549,6 @@ def build_config_content(cpu, icu):
("debugging_features", "false"),
("dict_property_const_tracking", "false"),
("direct_handle", "false"),
("direct_local", "false"),
("disassembler", "false"),
("full_debug", "false"),
("gdbjit", "false"),
@ -557,6 +556,7 @@ def build_config_content(cpu, icu):
("has_maglev", "true"),
("has_turbofan", "true"),
("has_webassembly", "false"),
("has_wasm_interpreter", "false"),
("i18n", icu),
("is_android", "false"),
("is_ios", "false"),

View file

@ -17,15 +17,6 @@ build_with_node = false
# chromium build.
perfetto_build_with_embedder = true
# TODO(https://crbug.com/337736622): Perfetto and FuzzTest need to know the
# path to protobuf targets. V8 stores them in a different location than Chrome
# until M129. Thereafter, it can move to //third_party/protobuf and these
# variables can be removed.
protobuf_target_prefix = "//third_party/protobuf_chrome/"
perfetto_protobuf_target_prefix = protobuf_target_prefix
perfetto_protobuf_gni = "//third_party/protobuf_chrome/proto_library.gni"
perfetto_protobuf_src_dir = "//third_party/protobuf_chrome/src"
# We use Perfetto's Trace Processor to convert traces to the legacy JSON
# format.
enable_perfetto_trace_processor = true

25
deps/v8/gni/v8.gni vendored
View file

@ -118,12 +118,9 @@ declare_args() {
# Scan the call stack conservatively during garbage collection.
v8_enable_conservative_stack_scanning = false
# Use direct pointers in internal (direct) handles.
# Use direct pointers in handles (v8::internal::Handle and v8::Local).
v8_enable_direct_handle = ""
# Use direct pointers in local handles.
v8_enable_direct_local = ""
# Check for off-stack allocated local handles.
v8_enable_local_off_stack_check = false
@ -166,6 +163,11 @@ declare_args() {
# Location of zlib.
v8_zlib_path = "//third_party/zlib"
# Enable pointer compression (sets -dV8_COMPRESS_POINTERS).
v8_enable_pointer_compression = ""
v8_enable_pointer_compression_shared_cage = ""
v8_enable_31bit_smis_on_64bit_arch = false
# Change code emission and runtime features to be CET shadow-stack compliant
# (incomplete and experimental).
v8_enable_cet_shadow_stack = false
@ -209,6 +211,18 @@ if (v8_enable_webassembly == "") {
assert(!(v8_enable_webassembly && v8_enable_lite_mode),
"Webassembly is not available in lite mode.")
if (v8_enable_pointer_compression == "") {
v8_enable_pointer_compression =
v8_current_cpu == "arm64" || v8_current_cpu == "x64"
}
# The Wasm interpreter is currently supported only on arm64 and x64, on
# Windows, Linux and MacOS.
is_drumbrake_supported =
v8_enable_webassembly && v8_enable_pointer_compression &&
(v8_current_cpu == "x64" || v8_current_cpu == "arm64") &&
(target_os == "win" || target_os == "linux" || target_os == "mac")
# Turbofan is enabled by default, except in lite mode.
if (v8_enable_turbofan == "") {
v8_enable_turbofan = !v8_enable_lite_mode
@ -221,9 +235,6 @@ assert(v8_enable_turbofan || !v8_enable_webassembly,
if (v8_enable_direct_handle == "") {
v8_enable_direct_handle = v8_enable_conservative_stack_scanning
}
if (v8_enable_direct_local == "") {
v8_enable_direct_local = v8_enable_conservative_stack_scanning
}
# Points to // in v8 stand-alone or to //v8/ in chromium. We need absolute
# paths for all configs in templates as they are shared in different

View file

@ -94,6 +94,14 @@ class GarbageCollectedMixin {
public:
using IsGarbageCollectedMixinTypeMarker = void;
// Must use MakeGarbageCollected.
void* operator new(size_t) = delete;
void* operator new[](size_t) = delete;
// The garbage collector is taking care of reclaiming the object.
// Not override the non-array varaint of `delete` to not conflict with the
// operator in GarbageCollected above.
void operator delete[](void*) = delete;
/**
* This Trace method must be overriden by objects inheriting from
* GarbageCollectedMixin.

View file

@ -5,6 +5,8 @@
#ifndef INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
#define INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
#include "v8config.h" // NOLINT(build/include_directory)
namespace cppgc {
#if defined(__has_attribute)
@ -21,7 +23,13 @@ namespace cppgc {
// [[no_unique_address]] comes in C++20 but supported in clang with -std >=
// c++11.
#if CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address)
#if defined(V8_CC_MSVC) && CPPGC_HAS_CPP_ATTRIBUTE(msvc::no_unique_address)
// Unfortunately MSVC ignores [[no_unique_address]] (see
// https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/#msvc-extensions-and-abi),
// and clang-cl matches it for ABI compatibility reasons. We need to prefer
// [[msvc::no_unique_address]] when available if we actually want any effect.
#define CPPGC_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
#elif CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address)
#define CPPGC_NO_UNIQUE_ADDRESS [[no_unique_address]]
#else
#define CPPGC_NO_UNIQUE_ADDRESS

View file

@ -359,7 +359,7 @@ enum class ModuleImportPhase {
* The import_attributes are import attributes for this request in the form:
* [key1, value1, key2, value2, ...] where the keys and values are of type
* v8::String. Note, unlike the FixedArray passed to ResolveModuleCallback and
* returned from ModuleRequest::GetImportAssertions(), this array does not
* returned from ModuleRequest::GetImportAttributes(), this array does not
* contain the source Locations of the attributes.
*
* The embedder must compile, instantiate, evaluate the Module, and

View file

@ -589,37 +589,10 @@ struct FastApiCallbackOptions {
v8::Isolate* isolate = nullptr;
/**
* If the callback wants to signal an error condition or to perform an
* allocation, it must set options.fallback to true and do an early return
* from the fast method. Then V8 checks the value of options.fallback and if
* it's true, falls back to executing the SlowCallback, which is capable of
* reporting the error (either by throwing a JS exception or logging to the
* console) or doing the allocation. It's the embedder's responsibility to
* ensure that the fast callback is idempotent up to the point where error and
* fallback conditions are checked, because otherwise executing the slow
* callback might produce visible side-effects twice.
*/
V8_DEPRECATED(
"It is not necessary to use the `fallback` flag anymore, as it is "
"possible now to trigger GC, throw exceptions, and call back into "
"JavaScript even in API functions called with a fast API call.")
bool fallback = false;
/**
* The `data` passed to the FunctionTemplate constructor, or `undefined`.
*/
v8::Local<v8::Value> data;
/**
* When called from WebAssembly, a view of the calling module's memory.
*/
V8_DEPRECATED(
"The wasm memory should either be provided as a field of the receiver, "
"the data object of the FunctionTemplate, or as a normal parameter of "
"the API function. Since regular API calls don't have this magic "
"`wasm_memory parameter, one of the options above should be possible.")
FastApiTypedArray<uint8_t>* const wasm_memory = nullptr;
};
namespace internal {

View file

@ -325,7 +325,7 @@ class PropertyCallbackInfo {
static constexpr int kSize = kArgsLength * internal::kApiSystemPointerSize;
explicit PropertyCallbackInfo() = default;
PropertyCallbackInfo() = default;
mutable internal::Address args_[kArgsLength];
};

View file

@ -52,6 +52,10 @@ class V8_EXPORT Function : public Object {
Local<Context> context, int argc, Local<Value> argv[],
SideEffectType side_effect_type = SideEffectType::kHasSideEffect) const;
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Call(v8::Isolate* isolate,
Local<Context> context,
Local<Value> recv, int argc,
Local<Value> argv[]);
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Call(Local<Context> context,
Local<Value> recv, int argc,
Local<Value> argv[]);

View file

@ -90,7 +90,7 @@ class IndirectHandleBase {
internal::Address* location_ = nullptr;
};
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
/**
* A base class for abstract handles containing direct pointers.
@ -130,7 +130,7 @@ class DirectHandleBase {
internal::Address ptr_ = internal::ValueHelper::kEmpty;
};
#endif // V8_ENABLE_DIRECT_LOCAL
#endif // V8_ENABLE_DIRECT_HANDLE
} // namespace v8::api_internal

View file

@ -946,12 +946,8 @@ class Internals {
kIsolateCppHeapPointerTableOffset + kExternalPointerTableSize;
static const int kIsolateTrustedPointerTableOffset =
kIsolateTrustedCageBaseOffset + kApiSystemPointerSize;
static const int kIsolateExternalBufferTableOffset =
kIsolateTrustedPointerTableOffset + kTrustedPointerTableSize;
static const int kIsolateSharedExternalBufferTableAddressOffset =
kIsolateExternalBufferTableOffset + kExternalBufferTableSize;
static const int kIsolateApiCallbackThunkArgumentOffset =
kIsolateSharedExternalBufferTableAddressOffset + kApiSystemPointerSize;
kIsolateTrustedPointerTableOffset + kTrustedPointerTableSize;
#else
static const int kIsolateApiCallbackThunkArgumentOffset =
kIsolateCppHeapPointerTableOffset + kExternalPointerTableSize;
@ -978,7 +974,7 @@ class Internals {
V(TrueValue, 0xc9) \
V(FalseValue, 0xad) \
V(EmptyString, 0xa1) \
V(TheHoleValue, 0x741)
V(TheHoleValue, 0x791)
using Tagged_t = uint32_t;
struct StaticReadOnlyRoot {
@ -986,8 +982,9 @@ class Internals {
EXPORTED_STATIC_ROOTS_PTR_LIST(DEF_ROOT)
#undef DEF_ROOT
static constexpr Tagged_t kFirstStringMap = 0xe5;
static constexpr Tagged_t kLastStringMap = 0x47d;
// Use 0 for kStringMapLowerBound since string maps are the first maps.
static constexpr Tagged_t kStringMapLowerBound = 0;
static constexpr Tagged_t kStringMapUpperBound = 0x47d;
#define PLUSONE(...) +1
static constexpr size_t kNumberOfExportedStaticRoots =
@ -1556,12 +1553,12 @@ constexpr WrappedIterator<Iterator> operator+(
// whether direct local support is enabled.
class ValueHelper final {
public:
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
static constexpr Address kTaggedNullAddress = 1;
static constexpr Address kEmpty = kTaggedNullAddress;
#else
static constexpr Address kEmpty = kNullAddress;
#endif // V8_ENABLE_DIRECT_LOCAL
#endif // V8_ENABLE_DIRECT_HANDLE
template <typename T>
V8_INLINE static bool IsEmpty(T* value) {
@ -1577,7 +1574,7 @@ class ValueHelper final {
return handle.template value<T>();
}
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
template <typename T>
V8_INLINE static Address ValueAsAddress(const T* value) {
@ -1592,7 +1589,7 @@ class ValueHelper final {
return *reinterpret_cast<T**>(slot);
}
#else // !V8_ENABLE_DIRECT_LOCAL
#else // !V8_ENABLE_DIRECT_HANDLE
template <typename T>
V8_INLINE static Address ValueAsAddress(const T* value) {
@ -1604,7 +1601,7 @@ class ValueHelper final {
return reinterpret_cast<T*>(slot);
}
#endif // V8_ENABLE_DIRECT_LOCAL
#endif // V8_ENABLE_DIRECT_HANDLE
};
/**

View file

@ -937,6 +937,12 @@ class V8_EXPORT Isolate {
*/
Local<Context> GetIncumbentContext();
/**
* Returns the host defined options set for currently running script or
* module, if available.
*/
MaybeLocal<Data> GetCurrentHostDefinedOptions();
/**
* Schedules a v8::Exception::Error with the given message.
* See ThrowException for more details. Templatized to provide compile-time

View file

@ -150,11 +150,11 @@ class V8_EXPORT V8_NODISCARD HandleScope {
/**
* A base class for local handles.
* Its implementation depends on whether direct local support is enabled.
* Its implementation depends on whether direct handle support is enabled.
* When it is, a local handle contains a direct pointer to the referenced
* object, otherwise it contains an indirect pointer.
*/
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
template <typename T>
class LocalBase : public api_internal::DirectHandleBase {
@ -183,7 +183,7 @@ class LocalBase : public api_internal::DirectHandleBase {
}
};
#else // !V8_ENABLE_DIRECT_LOCAL
#else // !V8_ENABLE_DIRECT_HANDLE
template <typename T>
class LocalBase : public api_internal::IndirectHandleBase {
@ -215,7 +215,7 @@ class LocalBase : public api_internal::IndirectHandleBase {
}
};
#endif // V8_ENABLE_DIRECT_LOCAL
#endif // V8_ENABLE_DIRECT_HANDLE
/**
* An object reference managed by the v8 garbage collector.
@ -400,13 +400,13 @@ class V8_TRIVIAL_ABI Local : public LocalBase<T>,
return Local<T>(LocalBase<T>::FromSlot(slot));
}
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
friend class TypecheckWitness;
V8_INLINE static Local<T> FromAddress(internal::Address ptr) {
return Local<T>(LocalBase<T>(ptr));
}
#endif // V8_ENABLE_DIRECT_LOCAL
#endif // V8_ENABLE_DIRECT_HANDLE
V8_INLINE static Local<T> New(Isolate* isolate, internal::Address value) {
return Local<T>(LocalBase<T>::New(isolate, value));
@ -444,7 +444,7 @@ class V8_TRIVIAL_ABI LocalUnchecked : public Local<T> {
: Local<T>(other, Local<T>::do_not_check) {}
};
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
// Off-stack allocated direct locals must be registered as strong roots.
// For off-stack indirect locals, this is not necessary.
@ -471,7 +471,7 @@ class StrongRootAllocator<LocalUnchecked<T>> : public StrongRootAllocatorBase {
return deallocate_impl(reinterpret_cast<Address*>(p), n);
}
};
#endif // V8_ENABLE_DIRECT_LOCAL
#endif // V8_ENABLE_DIRECT_HANDLE
} // namespace internal
template <typename T>
@ -479,7 +479,7 @@ class LocalVector {
private:
using element_type = internal::LocalUnchecked<T>;
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
using allocator_type = internal::StrongRootAllocator<element_type>;
static allocator_type make_allocator(Isolate* isolate) noexcept {
@ -491,7 +491,7 @@ class LocalVector {
static allocator_type make_allocator(Isolate* isolate) noexcept {
return allocator_type();
}
#endif // V8_ENABLE_DIRECT_LOCAL
#endif // V8_ENABLE_DIRECT_HANDLE
using vector_type = std::vector<element_type, allocator_type>;
@ -715,7 +715,7 @@ class V8_EXPORT V8_NODISCARD EscapableHandleScope
V8_INLINE ~EscapableHandleScope() = default;
template <class T>
V8_INLINE Local<T> Escape(Local<T> value) {
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
return value;
#else
if (value.IsEmpty()) return value;

View file

@ -690,14 +690,17 @@ class V8_EXPORT Object : public Value {
int GetIdentityHash();
/**
* Clone this object with a fast but shallow copy. Values will point
* to the same values as the original object.
* Clone this object with a fast but shallow copy. Values will point to the
* same values as the original object.
*
* Prefer using version with Isolate parameter.
*/
// TODO(dcarney): take an isolate and optionally bail out?
Local<Object> Clone(v8::Isolate* isolate);
Local<Object> Clone();
/**
* Returns the context in which the object was created.
*
* Prefer using version with Isolate parameter.
*/
MaybeLocal<Context> GetCreationContext(v8::Isolate* isolate);
@ -705,6 +708,7 @@ class V8_EXPORT Object : public Value {
/**
* Shortcut for GetCreationContext(...).ToLocalChecked().
*
* Prefer using version with Isolate parameter.
**/
Local<Context> GetCreationContextChecked(v8::Isolate* isolate);

View file

@ -1027,18 +1027,6 @@ class VirtualAddressSpace {
const PagePermissions max_page_permissions_;
};
/**
* V8 Allocator used for allocating zone backings.
*/
class ZoneBackingAllocator {
public:
using MallocFn = void* (*)(size_t);
using FreeFn = void (*)(void*);
virtual MallocFn GetMallocFn() const { return ::malloc; }
virtual FreeFn GetFreeFn() const { return ::free; }
};
/**
* Observer used by V8 to notify the embedder about entering/leaving sections
* with high throughput of malloc/free operations.
@ -1075,14 +1063,6 @@ class Platform {
return nullptr;
}
/**
* Allows the embedder to specify a custom allocator used for zones.
*/
virtual ZoneBackingAllocator* GetZoneBackingAllocator() {
static ZoneBackingAllocator default_allocator;
return &default_allocator;
}
/**
* Enables the embedder to respond in cases where V8 can't allocate large
* blocks of memory. V8 retries the failed allocation once after calling this

View file

@ -388,6 +388,8 @@ class V8_EXPORT String : public Name {
* regardless of the encoding, otherwise return NULL. The encoding of the
* string is returned in encoding_out.
*/
V8_INLINE ExternalStringResourceBase* GetExternalStringResourceBase(
v8::Isolate* isolate, Encoding* encoding_out) const;
V8_INLINE ExternalStringResourceBase* GetExternalStringResourceBase(
Encoding* encoding_out) const;
@ -878,6 +880,28 @@ String::ExternalStringResource* String::GetExternalStringResource() const {
return result;
}
String::ExternalStringResourceBase* String::GetExternalStringResourceBase(
v8::Isolate* isolate, String::Encoding* encoding_out) const {
using A = internal::Address;
using I = internal::Internals;
A obj = internal::ValueHelper::ValueAsAddress(this);
int type = I::GetInstanceType(obj) & I::kStringRepresentationAndEncodingMask;
*encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask);
ExternalStringResourceBase* resource;
if (type == I::kExternalOneByteRepresentationTag ||
type == I::kExternalTwoByteRepresentationTag) {
A value = I::ReadExternalPointerField<internal::kExternalStringResourceTag>(
isolate, obj, I::kStringResourceOffset);
resource = reinterpret_cast<ExternalStringResourceBase*>(value);
} else {
resource = GetExternalStringResourceBaseSlow(encoding_out);
}
#ifdef V8_ENABLE_CHECKS
VerifyExternalStringResourceBase(resource, *encoding_out);
#endif
return resource;
}
String::ExternalStringResourceBase* String::GetExternalStringResourceBase(
String::Encoding* encoding_out) const {
using A = internal::Address;

View file

@ -1109,6 +1109,12 @@ class V8_EXPORT HeapProfiler {
ObjectNameResolver* global_object_name_resolver = nullptr,
bool hide_internals = true, bool capture_numeric_value = false);
/**
* Obtains list of Detached JS Wrapper Objects. This functon calls garbage
* collection, then iterates over traced handles in the isolate
*/
std::vector<v8::Local<v8::Value>> GetDetachedJSWrapperObjects();
/**
* Starts tracking of heap objects population statistics. After calling
* this method, all heap objects relocations done by the garbage collector

View file

@ -210,7 +210,7 @@ class V8_EXPORT Module : public Data {
using ResolveModuleCallback = MaybeLocal<Module> (*)(
Local<Context> context, Local<String> specifier,
Local<FixedArray> import_assertions, Local<Module> referrer);
Local<FixedArray> import_attributes, Local<Module> referrer);
/**
* Instantiates the module and its dependencies.

View file

@ -9,6 +9,7 @@
#include <string_view>
#include "v8-data.h" // NOLINT(build/include_directory)
#include "v8-exception.h" // NOLINT(build/include_directory)
#include "v8-function-callback.h" // NOLINT(build/include_directory)
#include "v8-local-handle.h" // NOLINT(build/include_directory)
#include "v8-memory-span.h" // NOLINT(build/include_directory)
@ -657,6 +658,18 @@ class V8_EXPORT FunctionTemplate : public Template {
*/
void SetClassName(Local<String> name);
/**
* Set the interface name of the FunctionTemplate. This is provided as
* contextual information in an ExceptionPropagationMessage to the embedder.
*/
void SetInterfaceName(Local<String> name);
/**
* Provides information on the type of FunctionTemplate for embedder
* exception handling.
*/
void SetExceptionContext(ExceptionContext context);
/**
* When set to true, no access check will be performed on the receiver of a
* function call. Currently defaults to true, but this is subject to change.

View file

@ -182,7 +182,7 @@ class PersistentValueMapBase {
*/
Local<V> Get(const K& key) {
V* p = FromVal(Traits::Get(&impl_, key));
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
if (p == nullptr) return Local<V>();
#endif
return Local<V>::New(isolate_, p);

View file

@ -635,8 +635,9 @@ bool Value::QuickIsString() const {
A obj = internal::ValueHelper::ValueAsAddress(this);
if (!I::HasHeapObjectTag(obj)) return false;
#if V8_STATIC_ROOTS_BOOL && !V8_MAP_PACKING
return I::CheckInstanceMapRange(obj, I::StaticReadOnlyRoot::kFirstStringMap,
I::StaticReadOnlyRoot::kLastStringMap);
return I::CheckInstanceMapRange(obj,
I::StaticReadOnlyRoot::kStringMapLowerBound,
I::StaticReadOnlyRoot::kStringMapUpperBound);
#else
return (I::GetInstanceType(obj) < I::kFirstNonstringType);
#endif // V8_STATIC_ROOTS_BOOL

View file

@ -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 12
#define V8_MINOR_VERSION 8
#define V8_BUILD_NUMBER 374
#define V8_PATCH_LEVEL 33
#define V8_MINOR_VERSION 9
#define V8_BUILD_NUMBER 202
#define V8_PATCH_LEVEL 18
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)

View file

@ -392,8 +392,14 @@ path. Add it with -I<path> to the command line
# define V8_HAS_ATTRIBUTE_WEAK (__has_attribute(weak))
# define V8_HAS_CPP_ATTRIBUTE_NODISCARD (V8_HAS_CPP_ATTRIBUTE(nodiscard))
#if defined(V8_CC_MSVC)
# define V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS \
(V8_HAS_CPP_ATTRIBUTE(msvc::no_unique_address) || \
V8_HAS_CPP_ATTRIBUTE(no_unique_address))
#else
# define V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS \
(V8_HAS_CPP_ATTRIBUTE(no_unique_address))
#endif
# define V8_HAS_BUILTIN_ADD_OVERFLOW (__has_builtin(__builtin_add_overflow))
# define V8_HAS_BUILTIN_ASSUME (__has_builtin(__builtin_assume))
@ -671,7 +677,7 @@ path. Add it with -I<path> to the command line
// V8_NODISCARD Foo() { ... };
// [[nodiscard]] comes in C++17 but supported in clang with -std >= c++11.
#if V8_HAS_CPP_ATTRIBUTE_NODISCARD
#define V8_NODISCARD
#define V8_NODISCARD [[nodiscard]]
#else
#define V8_NODISCARD /* NOT SUPPORTED */
#endif
@ -692,7 +698,15 @@ path. Add it with -I<path> to the command line
// [[no_unique_address]] comes in C++20 but supported in clang with
// -std >= c++11.
#if V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS
#if defined(V8_CC_MSVC) && V8_HAS_CPP_ATTRIBUTE(msvc::no_unique_address)
// Unfortunately MSVC ignores [[no_unique_address]] (see
// https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/#msvc-extensions-and-abi),
// and clang-cl matches it for ABI compatibility reasons. We need to prefer
// [[msvc::no_unique_address]] when available if we actually want any effect.
#define V8_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
#else
#define V8_NO_UNIQUE_ADDRESS [[no_unique_address]]
#endif
#else
#define V8_NO_UNIQUE_ADDRESS /* NOT SUPPORTED */
#endif

View file

@ -70,6 +70,7 @@
'V8 Linux64 - builder (reclient compare)': 'release_x64_reclient',
'V8 Linux64 - official - builder': 'official_x64_on_release_branch',
'V8 Linux64 - debug builder': 'debug_x64',
'V8 Linux64 - no leaptiering - debug builder': 'debug_x64_no_leaptiering',
'V8 Linux64 - no shared cage - debug builder': 'debug_x64_no_shared_cage',
'V8 Linux64 - external code space - debug - builder': 'debug_x64_external_code_space',
'V8 Linux64 - custom snapshot - debug builder': 'debug_x64_custom',
@ -154,43 +155,43 @@
'V8 Centipede Linux64 ASAN - release builder':
'release_x64_asan_centipede',
'V8 Clusterfuzz Win64 ASAN - release builder':
'release_x64_asan_no_lsan_verify_heap',
'release_x64_asan_no_lsan_verify_heap_turboshaft_csa',
# Note this is called a debug builder, but it uses a release build
# configuration with dchecks (which enables DEBUG in V8), since win-asan
# debug is not supported.
'V8 Clusterfuzz Win64 ASAN - debug builder':
'release_x64_asan_no_lsan_verify_heap_dchecks',
'release_x64_asan_no_lsan_verify_heap_dchecks_turboshaft_csa',
'V8 Clusterfuzz Mac64 ASAN - release builder':
'release_x64_asan_no_lsan_verify_heap',
'release_x64_asan_no_lsan_verify_heap_turboshaft_csa',
'V8 Clusterfuzz Mac64 ASAN - debug builder':
'debug_x64_asan_no_lsan_static',
'debug_x64_asan_no_lsan_static_turboshaft_csa',
'V8 Clusterfuzz Linux64 - release builder':
'release_x64_correctness_fuzzer',
'V8 Clusterfuzz Linux64 - debug builder': 'debug_x64',
'release_x64_correctness_fuzzer_turboshaft_csa',
'V8 Clusterfuzz Linux64 - debug builder': 'debug_x64_turboshaft_csa',
'V8 Clusterfuzz Linux64 ASAN no inline - release builder':
'release_x64_asan_symbolized_verify_heap',
'release_x64_asan_symbolized_verify_heap_turboshaft_csa',
'V8 Clusterfuzz Linux ASAN no inline - release builder':
'release_x86_asan_symbolized_verify_heap',
'V8 Clusterfuzz Linux64 ASAN - debug builder': 'debug_x64_asan',
'V8 Clusterfuzz Linux ASAN - debug builder': 'debug_x86_asan',
'release_x86_asan_symbolized_verify_heap_turboshaft_csa',
'V8 Clusterfuzz Linux64 ASAN - debug builder': 'debug_x64_asan_turboshaft_csa',
'V8 Clusterfuzz Linux ASAN - debug builder': 'debug_x86_asan_turboshaft_csa',
'V8 Clusterfuzz Linux64 ASAN arm64 - debug builder':
'debug_simulate_arm64_asan',
'V8 Clusterfuzz Linux - debug builder': 'debug_x86',
'debug_simulate_arm64_asan_turboshaft_csa',
'V8 Clusterfuzz Linux - debug builder': 'debug_x86_turboshaft_csa',
'V8 Clusterfuzz Linux ASAN arm - debug builder':
'debug_simulate_arm_asan',
'debug_simulate_arm_asan_turboshaft_csa',
'V8 Clusterfuzz Linux64 CFI - release builder':
'release_x64_cfi_clusterfuzz',
'release_x64_cfi_clusterfuzz_turboshaft_csa',
'V8 Clusterfuzz Linux MSAN no origins':
'release_simulate_arm64_msan_no_origins',
'release_simulate_arm64_msan_no_origins_turboshaft_csa',
'V8 Clusterfuzz Linux MSAN chained origins':
'release_simulate_arm64_msan',
'V8 Clusterfuzz Linux64 TSAN - release builder': 'release_x64_tsan',
'release_simulate_arm64_msan_turboshaft_csa',
'V8 Clusterfuzz Linux64 TSAN - release builder': 'release_x64_tsan_turboshaft_csa',
'V8 Clusterfuzz Linux64 UBSan - release builder':
'release_x64_ubsan_recover',
'release_x64_ubsan_recover_turboshaft_csa',
'V8 Clusterfuzz Linux64 sandbox testing - release builder':
'release_x64_sandbox_testing',
'release_x64_sandbox_testing_turboshaft_csa',
'V8 Clusterfuzz Linux64 ASAN sandbox testing - release builder':
'release_x64_asan_sandbox_testing',
'release_x64_asan_sandbox_testing_turboshaft_csa',
},
'client.v8.perf' : {
# Arm
@ -273,6 +274,7 @@
'v8_linux64_asan_centipede_compile_rel': 'release_x64_asan_centipede',
'v8_linux64_cppgc_non_default_compile_dbg': 'debug_x64_non_default_cppgc',
'v8_linux64_compile_dbg': 'debug_x64_trybot',
'v8_linux64_no_leaptiering_compile_dbg': 'debug_x64_no_leaptiering',
'v8_linux64_no_shared_cage_compile_dbg': 'debug_x64_no_shared_cage',
'v8_linux64_coverage_dbg': 'debug_x64_coverage',
'v8_linux64_coverage_rel': 'release_x64_coverage',
@ -305,8 +307,8 @@
'v8_linux64_arm64_no_wasm_compile_dbg': 'debug_arm64_webassembly_disabled',
'v8_linux64_verify_csa_compile_rel': 'release_x64_verify_csa',
'v8_linux64_asan_compile_rel': 'release_x64_asan_minimal_symbols',
'v8_linux64_sandbox_testing_compile_rel': 'release_x64_sandbox_testing',
'v8_linux64_asan_sandbox_testing_compile_rel': 'release_x64_asan_sandbox_testing',
'v8_linux64_sandbox_testing_compile_rel': 'release_x64_sandbox_testing_turboshaft_csa',
'v8_linux64_asan_sandbox_testing_compile_rel': 'release_x64_asan_sandbox_testing_turboshaft_csa',
'v8_linux64_cfi_compile_rel': 'release_x64_cfi',
'v8_linux64_fuzzilli_compile_rel': 'release_x64_fuzzilli',
'v8_linux64_loong64_compile_rel': 'release_simulate_loong64',
@ -454,14 +456,15 @@
# Debug configs for simulators.
'debug_simulate_arm': [
'debug_bot', 'simulate_arm'],
'debug_simulate_arm_asan': [
'debug_bot', 'simulate_arm', 'asan'],
'debug_simulate_arm_asan_turboshaft_csa': [
'debug_bot', 'simulate_arm', 'asan', 'v8_enable_turboshaft_csa'],
'debug_simulate_arm_lite': [
'debug_bot', 'simulate_arm', 'v8_enable_lite_mode'],
'debug_simulate_arm64': [
'debug_bot', 'simulate_arm64'],
'debug_simulate_arm64_asan': [
'debug_bot', 'simulate_arm64', 'asan', 'lsan'],
'debug_simulate_arm64_asan_turboshaft_csa': [
'debug_bot', 'simulate_arm64', 'asan', 'lsan',
'v8_enable_turboshaft_csa'],
# Release configs for simulators.
'release_simulate_arm_gcmole': [
@ -487,10 +490,11 @@
'release_bot', 'simulate_arm64', 'msan'],
'release_simulate_arm64_msan_minimal_symbols': [
'release_bot', 'simulate_arm64', 'msan', 'minimal_symbols'],
'release_simulate_arm64_msan': [
'release_bot', 'simulate_arm64', 'msan'],
'release_simulate_arm64_msan_no_origins': [
'release_bot', 'simulate_arm64', 'msan_no_origins'],
'release_simulate_arm64_msan_no_origins_turboshaft_csa': [
'release_bot', 'simulate_arm64', 'msan_no_origins',
'v8_enable_turboshaft_csa'],
'release_simulate_arm64_msan_turboshaft_csa': [
'release_bot', 'simulate_arm64', 'msan', 'v8_enable_turboshaft_csa'],
'release_simulate_loong64': [
'release_bot', 'simulate_loong64'],
'release_simulate_mips64el': [
@ -582,25 +586,25 @@
'release_bot', 'x64', 'asan', 'lsan', 'minimal_symbols'],
'release_x64_asan_no_lsan': [
'release_bot', 'x64', 'asan'],
'release_x64_asan_no_lsan_verify_heap': [
'release_bot', 'x64', 'asan', 'v8_verify_heap'],
'release_x64_asan_no_lsan_verify_heap': [
'release_bot', 'x64', 'asan', 'v8_verify_heap'],
'release_x64_asan_no_lsan_verify_heap_dchecks': [
'release_x64_asan_no_lsan_verify_heap_turboshaft_csa': [
'release_bot', 'x64', 'asan', 'v8_verify_heap',
'v8_enable_turboshaft_csa'],
'release_x64_asan_no_lsan_verify_heap_dchecks_turboshaft_csa': [
'release_bot', 'x64', 'asan', 'dcheck_always_on',
'v8_enable_slow_dchecks', 'v8_verify_heap'],
'release_x64_sandbox_testing': [
'release_bot', 'x64', 'symbolized', 'v8_enable_memory_corruption_api'],
'release_x64_asan_sandbox_testing': [
'v8_enable_slow_dchecks', 'v8_verify_heap', 'v8_enable_turboshaft_csa'],
'release_x64_sandbox_testing_turboshaft_csa': [
'release_bot', 'x64', 'symbolized', 'v8_enable_memory_corruption_api',
'v8_enable_turboshaft_csa'],
'release_x64_asan_sandbox_testing_turboshaft_csa': [
'release_bot', 'x64', 'asan', 'symbolized',
'v8_enable_memory_corruption_api'],
'release_x64_asan_symbolized_verify_heap': [
'v8_enable_memory_corruption_api', 'v8_enable_turboshaft_csa'],
'release_x64_asan_symbolized_verify_heap_turboshaft_csa': [
'release_bot', 'x64', 'asan', 'lsan', 'symbolized',
'v8_verify_heap'],
'v8_verify_heap', 'v8_enable_turboshaft_csa'],
'release_x64_cfi': [
'release_bot', 'x64', 'cfi'],
'release_x64_cfi_clusterfuzz': [
'release_bot', 'x64', 'cfi_clusterfuzz'],
'release_x64_cfi_clusterfuzz_turboshaft_csa': [
'release_bot', 'x64', 'cfi_clusterfuzz', 'v8_enable_turboshaft_csa'],
'release_x64_coverage': [
'release_bot', 'x64', 'clang_coverage'],
'release_x64_fuzzilli': [
@ -610,8 +614,9 @@
'release_bot', 'x64', 'gcmole'],
'release_x64_msvc': [
'release_bot_no_reclient', 'x64', 'minimal_symbols', 'msvc'],
'release_x64_correctness_fuzzer' : [
'release_bot', 'x64', 'v8_correctness_fuzzer'],
'release_x64_correctness_fuzzer_turboshaft_csa' : [
'release_bot', 'x64', 'v8_correctness_fuzzer',
'v8_enable_turboshaft_csa'],
'release_x64_disable_runtime_call_stats': [
'release_bot', 'x64', 'v8_disable_runtime_call_stats'],
'release_x64_fuchsia': [
@ -647,12 +652,14 @@
'release_bot', 'x64', 'tsan', 'disable_concurrent_marking'],
'release_x64_tsan_minimal_symbols': [
'release_bot', 'x64', 'tsan', 'minimal_symbols'],
'release_x64_tsan_turboshaft_csa': [
'release_bot', 'x64', 'tsan', 'v8_enable_turboshaft_csa'],
'release_x64_ubsan': [
'release_bot', 'x64', 'ubsan'],
'release_x64_ubsan_minimal_symbols': [
'release_bot', 'x64', 'ubsan', 'minimal_symbols'],
'release_x64_ubsan_recover': [
'release_bot', 'x64', 'ubsan_recover'],
'release_x64_ubsan_recover_turboshaft_csa': [
'release_bot', 'x64', 'ubsan_recover', 'v8_enable_turboshaft_csa'],
'release_x64_shared_verify_heap': [
'release_bot', 'x64', 'shared', 'v8_verify_heap'],
'release_x64_verify_builtins': [
@ -678,13 +685,13 @@
# Debug configs for x64.
'debug_x64': [
'debug_bot', 'x64'],
'debug_x64_asan': [
'debug_bot', 'x64', 'asan', 'lsan'],
'debug_x64_asan_turboshaft_csa': [
'debug_bot', 'x64', 'asan', 'lsan', 'v8_enable_turboshaft_csa'],
'debug_x64_asan_centipede': [
'debug_bot', 'x64', 'asan', 'use_centipede'],
'debug_x64_asan_no_lsan_static': [
'debug', 'static', 'reclient', 'v8_enable_slow_dchecks', 'v8_optimized_debug',
'x64', 'asan'],
'debug_x64_asan_no_lsan_static_turboshaft_csa': [
'debug', 'static', 'reclient', 'v8_enable_slow_dchecks',
'v8_optimized_debug', 'x64', 'asan', 'v8_enable_turboshaft_csa'],
'debug_x64_conservative_stack_scanning': [
'debug_bot', 'x64', 'conservative_stack_scanning'],
'debug_x64_coverage': [
@ -701,6 +708,8 @@
'debug_bot_no_reclient', 'x64', 'gcc', 'lld', 'no_custom_libcxx'],
'debug_x64_header_includes': [
'debug_bot', 'x64', 'v8_check_header_includes'],
'debug_x64_no_leaptiering': [
'debug_bot', 'x64', 'v8_disable_leaptiering'],
'debug_x64_no_shared_cage': [
'debug_bot', 'x64', 'v8_disable_pointer_compression_shared_cage'],
'debug_x64_minimal_symbols': [
@ -717,6 +726,8 @@
'debug_bot', 'x64', 'v8_enable_sticky_mark_bits'],
'debug_x64_trybot': [
'debug_trybot', 'x64'],
'debug_x64_turboshaft_csa': [
'debug_bot', 'x64', 'v8_enable_turboshaft_csa'],
'debug_x64_dict_tracking_trybot': [
'debug_trybot', 'x64', 'v8_enable_dict_property_const_tracking'],
'debug_x64_trybot_custom': [
@ -730,8 +741,8 @@
# Debug configs for x86.
'debug_x86': [
'debug_bot', 'x86'],
'debug_x86_asan': [
'debug_bot', 'x86', 'asan', 'lsan'],
'debug_x86_asan_turboshaft_csa': [
'debug_bot', 'x86', 'asan', 'lsan', 'v8_enable_turboshaft_csa'],
'debug_x86_minimal_symbols': [
'debug_bot', 'x86', 'minimal_symbols'],
'debug_x86_msvc': [
@ -740,15 +751,17 @@
'debug_bot', 'x86', 'v8_no_i18n'],
'debug_x86_trybot': [
'debug_trybot', 'x86'],
'debug_x86_turboshaft_csa': [
'debug_bot', 'x86', 'v8_enable_turboshaft_csa'],
'debug_x86_vtunejit': [
'debug_bot', 'x86', 'v8_enable_vtunejit'],
'full_debug_x86': [
'debug', 'x86', 'reclient', 'v8_enable_slow_dchecks', 'v8_full_debug'],
# Release configs for x86.
'release_x86_asan_symbolized_verify_heap': [
'release_x86_asan_symbolized_verify_heap_turboshaft_csa': [
'release_bot', 'x86', 'asan', 'lsan', 'symbolized',
'v8_verify_heap'],
'v8_verify_heap', 'v8_enable_turboshaft_csa'],
'release_x86_gcmole': [
'release_bot', 'x86', 'gcmole'],
'release_x86_gcmole_trybot': [
@ -1068,6 +1081,10 @@
'gn_args': 'v8_control_flow_integrity=true',
},
'v8_disable_leaptiering': {
'gn_args': 'v8_disable_leaptiering=true',
},
'v8_disable_runtime_call_stats': {
'gn_args': 'v8_enable_runtime_call_stats=false',
},
@ -1132,6 +1149,10 @@
'gn_args': 'v8_enable_test_features=true',
},
'v8_enable_turboshaft_csa': {
'gn_args': 'v8_enable_turboshaft_csa=true',
},
'v8_enable_verify_predictable': {
'gn_args': 'v8_enable_verify_predictable=true',
},

View file

@ -621,6 +621,14 @@
{'name': 'v8testing', 'shards': 3},
],
},
'v8_linux64_no_leaptiering_dbg': {
'swarming_dimensions' : {
'os': 'Ubuntu-22.04',
},
'tests': [
{'name': 'v8testing', 'shards': 3},
],
},
'v8_linux64_no_shared_cage_dbg': {
'swarming_dimensions' : {
'os': 'Ubuntu-22.04',
@ -1694,6 +1702,14 @@
{'name': 'v8testing'},
],
},
'V8 Linux64 - no leaptiering - debug': {
'swarming_dimensions' : {
'os': 'Ubuntu-22.04',
},
'tests': [
{'name': 'v8testing', 'shards': 2},
],
},
'V8 Linux64 - no shared cage - debug': {
'swarming_dimensions' : {
'os': 'Ubuntu-22.04',

View file

@ -166,7 +166,7 @@ Handle<Object> PropertyCallbackArguments::CallNamedQuery(
slot_at(kReturnValueIndex).store(Smi::FromInt(v8::None));
NamedPropertyQueryCallback f =
ToCData<NamedPropertyQueryCallback, kApiNamedPropertyQueryCallbackTag>(
interceptor->query());
isolate, interceptor->query());
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Integer, interceptor,
ExceptionContext::kNamedQuery);
v8::Intercepted intercepted = f(v8::Utils::ToLocal(name), callback_info);
@ -183,7 +183,7 @@ Handle<JSAny> PropertyCallbackArguments::CallNamedGetter(
slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).undefined_value());
NamedPropertyGetterCallback f =
ToCData<NamedPropertyGetterCallback, kApiNamedPropertyGetterCallbackTag>(
interceptor->getter());
isolate, interceptor->getter());
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Value, interceptor,
ExceptionContext::kNamedGetter);
v8::Intercepted intercepted = f(v8::Utils::ToLocal(name), callback_info);
@ -201,7 +201,7 @@ Handle<JSAny> PropertyCallbackArguments::CallNamedDescriptor(
NamedPropertyDescriptorCallback f =
ToCData<NamedPropertyDescriptorCallback,
kApiNamedPropertyDescriptorCallbackTag>(
interceptor->descriptor());
isolate, interceptor->descriptor());
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Value, interceptor,
ExceptionContext::kNamedDescriptor);
v8::Intercepted intercepted = f(v8::Utils::ToLocal(name), callback_info);
@ -219,7 +219,7 @@ v8::Intercepted PropertyCallbackArguments::CallNamedSetter(
slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value());
NamedPropertySetterCallback f =
ToCData<NamedPropertySetterCallback, kApiNamedPropertySetterCallbackTag>(
interceptor->setter());
isolate, interceptor->setter());
Handle<InterceptorInfo> has_side_effects;
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, void, has_side_effects,
ExceptionContext::kNamedSetter);
@ -236,9 +236,9 @@ v8::Intercepted PropertyCallbackArguments::CallNamedDefiner(
RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedDefinerCallback);
slot_at(kPropertyKeyIndex).store(*name);
slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value());
NamedPropertyDefinerCallback f =
ToCData<NamedPropertyDefinerCallback,
kApiNamedPropertyDefinerCallbackTag>(interceptor->definer());
NamedPropertyDefinerCallback f = ToCData<NamedPropertyDefinerCallback,
kApiNamedPropertyDefinerCallbackTag>(
isolate, interceptor->definer());
Handle<InterceptorInfo> has_side_effects;
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, void, has_side_effects,
ExceptionContext::kNamedDefiner);
@ -254,9 +254,9 @@ v8::Intercepted PropertyCallbackArguments::CallNamedDeleter(
RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedDeleterCallback);
slot_at(kPropertyKeyIndex).store(*name);
slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value());
NamedPropertyDeleterCallback f =
ToCData<NamedPropertyDeleterCallback,
kApiNamedPropertyDeleterCallbackTag>(interceptor->deleter());
NamedPropertyDeleterCallback f = ToCData<NamedPropertyDeleterCallback,
kApiNamedPropertyDeleterCallbackTag>(
isolate, interceptor->deleter());
Handle<InterceptorInfo> has_side_effects;
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Boolean, has_side_effects,
ExceptionContext::kNamedDeleter);
@ -285,7 +285,8 @@ Handle<Object> PropertyCallbackArguments::CallIndexedQuery(
slot_at(kReturnValueIndex).store(Smi::FromInt(v8::None));
IndexedPropertyQueryCallbackV2 f =
ToCData<IndexedPropertyQueryCallbackV2,
kApiIndexedPropertyQueryCallbackTag>(interceptor->query());
kApiIndexedPropertyQueryCallbackTag>(isolate,
interceptor->query());
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Integer, interceptor,
ExceptionContext::kIndexedQuery);
v8::Intercepted intercepted = f(index, callback_info);
@ -303,7 +304,8 @@ Handle<JSAny> PropertyCallbackArguments::CallIndexedGetter(
slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).undefined_value());
IndexedPropertyGetterCallbackV2 f =
ToCData<IndexedPropertyGetterCallbackV2,
kApiIndexedPropertyGetterCallbackTag>(interceptor->getter());
kApiIndexedPropertyGetterCallbackTag>(isolate,
interceptor->getter());
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Value, interceptor,
ExceptionContext::kIndexedGetter);
v8::Intercepted intercepted = f(index, callback_info);
@ -322,7 +324,7 @@ Handle<JSAny> PropertyCallbackArguments::CallIndexedDescriptor(
IndexedPropertyDescriptorCallbackV2 f =
ToCData<IndexedPropertyDescriptorCallbackV2,
kApiIndexedPropertyDescriptorCallbackTag>(
interceptor->descriptor());
isolate, interceptor->descriptor());
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Value, interceptor,
ExceptionContext::kIndexedDescriptor);
v8::Intercepted intercepted = f(index, callback_info);
@ -341,7 +343,8 @@ v8::Intercepted PropertyCallbackArguments::CallIndexedSetter(
slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value());
IndexedPropertySetterCallbackV2 f =
ToCData<IndexedPropertySetterCallbackV2,
kApiIndexedPropertySetterCallbackTag>(interceptor->setter());
kApiIndexedPropertySetterCallbackTag>(isolate,
interceptor->setter());
Handle<InterceptorInfo> has_side_effects;
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, void, has_side_effects,
ExceptionContext::kIndexedSetter);
@ -361,7 +364,8 @@ v8::Intercepted PropertyCallbackArguments::CallIndexedDefiner(
slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value());
IndexedPropertyDefinerCallbackV2 f =
ToCData<IndexedPropertyDefinerCallbackV2,
kApiIndexedPropertyDefinerCallbackTag>(interceptor->definer());
kApiIndexedPropertyDefinerCallbackTag>(isolate,
interceptor->definer());
Handle<InterceptorInfo> has_side_effects;
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, void, has_side_effects,
ExceptionContext::kIndexedDefiner);
@ -379,7 +383,8 @@ v8::Intercepted PropertyCallbackArguments::CallIndexedDeleter(
slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value());
IndexedPropertyDeleterCallbackV2 f =
ToCData<IndexedPropertyDeleterCallbackV2,
kApiIndexedPropertyDeleterCallbackTag>(interceptor->deleter());
kApiIndexedPropertyDeleterCallbackTag>(isolate,
interceptor->deleter());
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Boolean, interceptor,
ExceptionContext::kIndexedDeleter);
v8::Intercepted intercepted = f(index, callback_info);
@ -401,7 +406,7 @@ Handle<JSObjectOrUndefined> PropertyCallbackArguments::CallPropertyEnumerator(
IndexedPropertyEnumeratorCallback f =
v8::ToCData<IndexedPropertyEnumeratorCallback,
kApiIndexedPropertyEnumeratorCallbackTag>(
interceptor->enumerator());
isolate, interceptor->enumerator());
PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Array, interceptor,
ExceptionContext::kNamedEnumerator);
f(callback_info);
@ -470,7 +475,7 @@ bool PropertyCallbackArguments::CallAccessorSetter(
// v8::AccessorNameSetterCallback or AccessorNameBooleanSetterCallback
// the result is guaranteed to be v8::Boolean value indicating success or
// failure.
Handle<Boolean> result = GetReturnValue<Boolean>(isolate);
DirectHandle<Boolean> result = GetReturnValue<Boolean>(isolate);
return IsTrue(*result, isolate);
}

View file

@ -18,18 +18,21 @@
namespace v8 {
template <typename T, internal::ExternalPointerTag tag>
inline T ToCData(v8::internal::Tagged<v8::internal::Object> obj) {
inline T ToCData(i::Isolate* isolate,
v8::internal::Tagged<v8::internal::Object> obj) {
static_assert(sizeof(T) == sizeof(v8::internal::Address));
if (obj == v8::internal::Smi::zero()) return nullptr;
return reinterpret_cast<T>(
v8::internal::Cast<v8::internal::Foreign>(obj)->foreign_address<tag>());
v8::internal::Cast<v8::internal::Foreign>(obj)->foreign_address<tag>(
isolate));
}
template <internal::ExternalPointerTag tag>
inline v8::internal::Address ToCData(
v8::internal::Tagged<v8::internal::Object> obj) {
i::Isolate* isolate, v8::internal::Tagged<v8::internal::Object> obj) {
if (obj == v8::internal::Smi::zero()) return v8::internal::kNullAddress;
return v8::internal::Cast<v8::internal::Foreign>(obj)->foreign_address<tag>();
return v8::internal::Cast<v8::internal::Foreign>(obj)->foreign_address<tag>(
isolate);
}
template <internal::ExternalPointerTag tag, typename T>
@ -51,66 +54,51 @@ inline v8::internal::Handle<i::UnionOf<i::Smi, i::Foreign>> FromCData(
}
template <class From, class To>
inline Local<To> Utils::Convert(v8::internal::Handle<From> obj) {
DCHECK(obj.is_null() || (IsSmi(*obj) || !IsTheHole(*obj)));
#ifdef V8_ENABLE_DIRECT_LOCAL
inline Local<To> Utils::Convert(v8::internal::DirectHandle<From> obj) {
DCHECK(obj.is_null() || IsSmi(*obj) || !IsTheHole(*obj));
#ifdef V8_ENABLE_DIRECT_HANDLE
if (obj.is_null()) return Local<To>();
#endif
return Local<To>::FromSlot(obj.location());
}
template <class From, class To>
inline Local<To> Utils::Convert(v8::internal::DirectHandle<From> obj,
v8::internal::Isolate* isolate) {
#if defined(V8_ENABLE_DIRECT_LOCAL)
DCHECK(obj.is_null() || (IsSmi(*obj) || !IsTheHole(*obj)));
return Local<To>::FromAddress(obj.address());
#elif defined(V8_ENABLE_DIRECT_HANDLE)
if (obj.is_null()) return Local<To>();
return Convert<From, To>(v8::internal::Handle<From>(*obj, isolate));
#else
return Convert<From, To>(obj);
return Local<To>::FromSlot(obj.location());
#endif
}
// Implementations of ToLocal
#define MAKE_TO_LOCAL(Name, From, To) \
Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \
return Convert<v8::internal::From, v8::To>(obj); \
} \
\
Local<v8::To> Utils::Name( \
v8::internal::DirectHandle<v8::internal::From> obj, \
i::Isolate* isolate) { \
return Convert<v8::internal::From, v8::To>(obj, isolate); \
#define MAKE_TO_LOCAL(Name) \
template <template <typename T> typename HandleType, typename T, typename> \
inline auto Utils::Name(HandleType<T> obj) { \
return Utils::Name##_helper(v8::internal::DirectHandle<T>(obj)); \
}
TO_LOCAL_LIST(MAKE_TO_LOCAL)
TO_LOCAL_NAME_LIST(MAKE_TO_LOCAL)
#define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype) \
Local<v8::Type##Array> Utils::ToLocal##Type##Array( \
v8::internal::Handle<v8::internal::JSTypedArray> obj) { \
DCHECK(obj->type() == v8::internal::kExternal##Type##Array); \
return Convert<v8::internal::JSTypedArray, v8::Type##Array>(obj); \
} \
\
Local<v8::Type##Array> Utils::ToLocal##Type##Array( \
v8::internal::DirectHandle<v8::internal::JSTypedArray> obj, \
v8::internal::Isolate* isolate) { \
DCHECK(obj->type() == v8::internal::kExternal##Type##Array); \
return Convert<v8::internal::JSTypedArray, v8::Type##Array>(obj, isolate); \
#define MAKE_TO_LOCAL_PRIVATE(Name, From, To) \
inline Local<v8::To> Utils::Name##_helper( \
v8::internal::DirectHandle<v8::internal::From> obj) { \
return Convert<v8::internal::From, v8::To>(obj); \
}
TO_LOCAL_LIST(MAKE_TO_LOCAL_PRIVATE)
#define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype) \
Local<v8::Type##Array> Utils::ToLocal##Type##Array( \
v8::internal::DirectHandle<v8::internal::JSTypedArray> obj) { \
DCHECK(obj->type() == v8::internal::kExternal##Type##Array); \
return Convert<v8::internal::JSTypedArray, v8::Type##Array>(obj); \
}
TYPED_ARRAYS(MAKE_TO_LOCAL_TYPED_ARRAY)
#undef MAKE_TO_LOCAL_TYPED_ARRAY
#undef MAKE_TO_LOCAL
#undef MAKE_TO_LOCAL_PRIVATE
#undef TO_LOCAL_LIST
// Implementations of OpenHandle
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
#define MAKE_OPEN_HANDLE(From, To) \
v8::internal::Handle<v8::internal::To> Utils::OpenHandle( \
@ -142,7 +130,7 @@ TYPED_ARRAYS(MAKE_TO_LOCAL_TYPED_ARRAY)
return Utils::OpenHandle(that, allow_empty_handle); \
}
#else // !V8_ENABLE_DIRECT_LOCAL
#else // !V8_ENABLE_DIRECT_HANDLE
#define MAKE_OPEN_HANDLE(From, To) \
v8::internal::Handle<v8::internal::To> Utils::OpenHandle( \
@ -166,7 +154,7 @@ TYPED_ARRAYS(MAKE_TO_LOCAL_TYPED_ARRAY)
return Utils::OpenHandle(that, allow_empty_handle); \
}
#endif // V8_ENABLE_DIRECT_LOCAL
#endif // V8_ENABLE_DIRECT_HANDLE
OPEN_HANDLE_LIST(MAKE_OPEN_HANDLE)
@ -186,7 +174,8 @@ class V8_NODISCARD CallDepthScope {
}
~CallDepthScope() {
i::MicrotaskQueue* microtask_queue =
i::Cast<i::NativeContext>(isolate_->context())->microtask_queue();
i::Cast<i::NativeContext>(isolate_->context())
->microtask_queue(isolate_);
isolate_->thread_local_top()->DecrementCallDepth(this);
// Clear the exception when exiting V8 to avoid memory leaks.
@ -251,7 +240,7 @@ class V8_NODISCARD InternalEscapableScope : public EscapableHandleScopeBase {
*/
template <class T>
V8_INLINE Local<T> Escape(Local<T> value) {
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
return value;
#else
DCHECK(!value.IsEmpty());

View file

@ -131,7 +131,8 @@ MaybeHandle<Object> DefineDataProperty(Isolate* isolate,
void DisableAccessChecks(Isolate* isolate, DirectHandle<JSObject> object) {
Handle<Map> old_map(object->map(), isolate);
// Copy map so it won't interfere constructor's initial map.
Handle<Map> new_map = Map::Copy(isolate, old_map, "DisableAccessChecks");
DirectHandle<Map> new_map =
Map::Copy(isolate, old_map, "DisableAccessChecks");
new_map->set_is_access_check_needed(false);
JSObject::MigrateToMap(isolate, object, new_map);
}
@ -139,7 +140,7 @@ void DisableAccessChecks(Isolate* isolate, DirectHandle<JSObject> object) {
void EnableAccessChecks(Isolate* isolate, DirectHandle<JSObject> object) {
Handle<Map> old_map(object->map(), isolate);
// Copy map so it won't interfere constructor's initial map.
Handle<Map> new_map = Map::Copy(isolate, old_map, "EnableAccessChecks");
DirectHandle<Map> new_map = Map::Copy(isolate, old_map, "EnableAccessChecks");
new_map->set_is_access_check_needed(true);
new_map->set_may_have_interesting_properties(true);
JSObject::MigrateToMap(isolate, object, new_map);

313
deps/v8/src/api/api.cc vendored
View file

@ -7,6 +7,7 @@
#include <algorithm> // For min
#include <cmath> // For isnan.
#include <limits>
#include <optional>
#include <sstream>
#include <string>
#include <utility> // For move
@ -198,10 +199,10 @@ static ScriptOrigin GetScriptOriginForScript(
is_wasm = script->type() == i::Script::Type::kWasm;
#endif // V8_ENABLE_WEBASSEMBLY
v8::ScriptOrigin origin(
Utils::ToLocal(scriptName, i_isolate), script->line_offset(),
Utils::ToLocal(scriptName), script->line_offset(),
script->column_offset(), options.IsSharedCrossOrigin(), script->id(),
Utils::ToLocal(source_map_url, i_isolate), options.IsOpaque(), is_wasm,
options.IsModule(), Utils::ToLocal(host_defined_options, i_isolate));
Utils::ToLocal(source_map_url), options.IsOpaque(), is_wasm,
options.IsModule(), Utils::ToLocal(host_defined_options));
return origin;
}
@ -788,8 +789,8 @@ constexpr InstanceTypeChecker::TaggedAddressRange kStringMapRange =
V(FalseValue, i::StaticReadOnlyRoot::kFalseValue) \
V(EmptyString, i::StaticReadOnlyRoot::kempty_string) \
V(TheHoleValue, i::StaticReadOnlyRoot::kTheHoleValue) \
V(FirstStringMap, kStringMapRange.first) \
V(LastStringMap, kStringMapRange.second)
V(StringMapLowerBound, kStringMapRange.first) \
V(StringMapUpperBound, kStringMapRange.second)
static_assert(std::is_same<Internals::Tagged_t, Tagged_t>::value);
// Ensure they have the correct value.
@ -923,14 +924,14 @@ i::Address* HandleScope::CreateHandle(i::Isolate* i_isolate, i::Address value) {
return i::HandleScope::CreateHandle(i_isolate, value);
}
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
i::Address* HandleScope::CreateHandleForCurrentIsolate(i::Address value) {
i::Isolate* i_isolate = i::Isolate::Current();
return i::HandleScope::CreateHandle(i_isolate, value);
}
#endif // V8_ENABLE_DIRECT_LOCAL
#endif // V8_ENABLE_DIRECT_HANDLE
EscapableHandleScopeBase::EscapableHandleScopeBase(Isolate* v8_isolate) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
@ -1094,10 +1095,8 @@ v8::Local<v8::Value> Context::SlowGetEmbedderData(int index) {
EmbedderDataFor(this, index, false, location);
if (data.is_null()) return Local<Value>();
i::Isolate* i_isolate = Utils::OpenDirectHandle(this)->GetIsolate();
return Utils::ToLocal(
i::direct_handle(i::EmbedderDataSlot(*data, index).load_tagged(),
i_isolate),
i_isolate);
return Utils::ToLocal(i::direct_handle(
i::EmbedderDataSlot(*data, index).load_tagged(), i_isolate));
}
void Context::SetEmbedderData(int index, v8::Local<Value> value) {
@ -1214,7 +1213,7 @@ Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
proto_template);
return Utils::ToLocal(proto_template);
}
return ToApiHandle<ObjectTemplate>(heap_obj, i_isolate);
return ToApiHandle<ObjectTemplate>(heap_obj);
}
void FunctionTemplate::SetPrototypeProviderTemplate(
@ -1482,10 +1481,8 @@ Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() {
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
auto maybe_templ = constructor->GetInstanceTemplate();
if (!i::IsUndefined(maybe_templ, i_isolate)) {
return Utils::ToLocal(
i::direct_handle(i::Cast<i::ObjectTemplateInfo>(maybe_templ),
i_isolate),
i_isolate);
return Utils::ToLocal(i::direct_handle(
i::Cast<i::ObjectTemplateInfo>(maybe_templ), i_isolate));
}
constexpr bool do_not_cache = false;
i::Handle<i::ObjectTemplateInfo> templ =
@ -1510,6 +1507,22 @@ void FunctionTemplate::SetClassName(Local<String> name) {
info->set_class_name(*Utils::OpenDirectHandle(*name));
}
void FunctionTemplate::SetInterfaceName(Local<String> name) {
auto info = Utils::OpenDirectHandle(this);
EnsureNotPublished(info, "v8::FunctionTemplate::SetInterfaceName");
i::Isolate* i_isolate = info->GetIsolateChecked();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
info->set_interface_name(*Utils::OpenDirectHandle(*name));
}
void FunctionTemplate::SetExceptionContext(ExceptionContext context) {
auto info = Utils::OpenDirectHandle(this);
EnsureNotPublished(info, "v8::FunctionTemplate::SetExceptionContext");
i::Isolate* i_isolate = info->GetIsolateChecked();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
info->set_exception_context(static_cast<uint32_t>(context));
}
void FunctionTemplate::SetAcceptAnyReceiver(bool value) {
auto info = Utils::OpenDirectHandle(this);
EnsureNotPublished(info, "v8::FunctionTemplate::SetAcceptAnyReceiver");
@ -1958,7 +1971,7 @@ Local<Script> UnboundScript::BindToCurrentContext() {
DCHECK(!InReadOnlySpace(*function_info));
i::Isolate* i_isolate = i::GetIsolateFromWritableObject(*function_info);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
i::Handle<i::JSFunction> function =
i::DirectHandle<i::JSFunction> function =
i::Factory::JSFunctionBuilder{i_isolate, function_info,
i_isolate->native_context()}
.Build();
@ -1983,7 +1996,8 @@ int UnboundScript::GetLineNumber(int code_pos) {
i::Isolate* i_isolate = i::GetIsolateFromWritableObject(*obj);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
API_RCS_SCOPE(i_isolate, UnboundScript, GetLineNumber);
i::Handle<i::Script> script(i::Cast<i::Script>(obj->script()), i_isolate);
i::DirectHandle<i::Script> script(i::Cast<i::Script>(obj->script()),
i_isolate);
return i::Script::GetLineNumber(script, code_pos);
} else {
return -1;
@ -1999,7 +2013,8 @@ int UnboundScript::GetColumnNumber(int code_pos) {
i::Isolate* i_isolate = i::GetIsolateFromWritableObject(*obj);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
API_RCS_SCOPE(i_isolate, UnboundScript, GetColumnNumber);
i::Handle<i::Script> script(i::Cast<i::Script>(obj->script()), i_isolate);
i::DirectHandle<i::Script> script(i::Cast<i::Script>(obj->script()),
i_isolate);
return i::Script::GetColumnNumber(script, code_pos);
} else {
return -1;
@ -2016,7 +2031,7 @@ Local<Value> UnboundScript::GetScriptName() {
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
API_RCS_SCOPE(i_isolate, UnboundScript, GetName);
i::Tagged<i::Object> name = i::Cast<i::Script>(obj->script())->name();
return Utils::ToLocal(i::direct_handle(name, i_isolate), i_isolate);
return Utils::ToLocal(i::direct_handle(name, i_isolate));
} else {
return Local<String>();
}
@ -2032,7 +2047,7 @@ Local<Value> UnboundScript::GetSourceURL() {
API_RCS_SCOPE(i_isolate, UnboundScript, GetSourceURL);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
i::Tagged<i::Object> url = i::Cast<i::Script>(obj->script())->source_url();
return Utils::ToLocal(i::direct_handle(url, i_isolate), i_isolate);
return Utils::ToLocal(i::direct_handle(url, i_isolate));
} else {
return Local<String>();
}
@ -2049,7 +2064,7 @@ Local<Value> UnboundScript::GetSourceMappingURL() {
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
i::Tagged<i::Object> url =
i::Cast<i::Script>(obj->script())->source_mapping_url();
return Utils::ToLocal(i::direct_handle(url, i_isolate), i_isolate);
return Utils::ToLocal(i::direct_handle(url, i_isolate));
} else {
return Local<String>();
}
@ -2065,7 +2080,7 @@ Local<Value> UnboundModuleScript::GetSourceURL() {
API_RCS_SCOPE(i_isolate, UnboundModuleScript, GetSourceURL);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
i::Tagged<i::Object> url = i::Cast<i::Script>(obj->script())->source_url();
return Utils::ToLocal(i::direct_handle(url, i_isolate), i_isolate);
return Utils::ToLocal(i::direct_handle(url, i_isolate));
} else {
return Local<String>();
}
@ -2082,7 +2097,7 @@ Local<Value> UnboundModuleScript::GetSourceMappingURL() {
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
i::Tagged<i::Object> url =
i::Cast<i::Script>(obj->script())->source_mapping_url();
return Utils::ToLocal(i::direct_handle(url, i_isolate), i_isolate);
return Utils::ToLocal(i::direct_handle(url, i_isolate));
} else {
return Local<String>();
}
@ -2135,8 +2150,7 @@ Local<Value> ScriptOrModule::GetResourceName() {
auto obj = Utils::OpenDirectHandle(this);
i::Isolate* i_isolate = i::GetIsolateFromWritableObject(*obj);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
return ToApiHandle<Value>(i::direct_handle(obj->resource_name(), i_isolate),
i_isolate);
return ToApiHandle<Value>(i::direct_handle(obj->resource_name(), i_isolate));
}
Local<Data> ScriptOrModule::HostDefinedOptions() {
@ -2144,7 +2158,7 @@ Local<Data> ScriptOrModule::HostDefinedOptions() {
i::Isolate* i_isolate = i::GetIsolateFromWritableObject(*obj);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
return ToApiHandle<Data>(
i::direct_handle(obj->host_defined_options(), i_isolate), i_isolate);
i::direct_handle(obj->host_defined_options(), i_isolate));
}
Local<UnboundScript> Script::GetUnboundScript() {
@ -2152,7 +2166,7 @@ Local<UnboundScript> Script::GetUnboundScript() {
auto obj = Utils::OpenDirectHandle(this);
i::DirectHandle<i::SharedFunctionInfo> sfi(obj->shared(), obj->GetIsolate());
DCHECK(!InReadOnlySpace(*sfi));
return ToApiHandle<UnboundScript>(sfi, obj->GetIsolate());
return ToApiHandle<UnboundScript>(sfi);
}
Local<Value> Script::GetResourceName() {
@ -2162,8 +2176,7 @@ Local<Value> Script::GetResourceName() {
CHECK(IsScript(sfi->script()));
i::Isolate* i_isolate = func->GetIsolate();
return ToApiHandle<Value>(
i::direct_handle(i::Cast<i::Script>(sfi->script())->name(), i_isolate),
i_isolate);
i::direct_handle(i::Cast<i::Script>(sfi->script())->name(), i_isolate));
}
std::vector<int> Script::GetProducedCompileHints() const {
@ -2195,7 +2208,8 @@ Local<CompileHintsCollector> Script::GetCompileHintsCollector() const {
i::Isolate* i_isolate = func->GetIsolate();
i::Tagged<i::SharedFunctionInfo> sfi = func->shared();
CHECK(IsScript(sfi->script()));
i::Handle<i::Script> script(i::Cast<i::Script>(sfi->script()), i_isolate);
i::DirectHandle<i::Script> script(i::Cast<i::Script>(sfi->script()),
i_isolate);
return ToApiHandle<CompileHintsCollector>(script);
}
@ -2226,7 +2240,8 @@ Local<PrimitiveArray> PrimitiveArray::New(Isolate* v8_isolate, int length) {
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
Utils::ApiCheck(length >= 0, "v8::PrimitiveArray::New",
"length must be equal or greater than zero");
i::Handle<i::FixedArray> array = i_isolate->factory()->NewFixedArray(length);
i::DirectHandle<i::FixedArray> array =
i_isolate->factory()->NewFixedArray(length);
return ToApiHandle<PrimitiveArray>(array);
}
@ -2254,8 +2269,7 @@ Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
"v8::PrimitiveArray::Get",
"index must be greater than or equal to 0 and less than the "
"array length");
return ToApiHandle<Primitive>(i::direct_handle(array->get(index), i_isolate),
i_isolate);
return ToApiHandle<Primitive>(i::direct_handle(array->get(index), i_isolate));
}
void v8::PrimitiveArray::CheckCast(v8::Data* that) {
@ -2274,15 +2288,13 @@ Local<Data> FixedArray::Get(Local<Context> context, int i) const {
auto self = Utils::OpenDirectHandle(this);
auto i_isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
CHECK_LT(i, self->length());
return ToApiHandle<Data>(i::direct_handle(self->get(i), i_isolate),
i_isolate);
return ToApiHandle<Data>(i::direct_handle(self->get(i), i_isolate));
}
Local<String> ModuleRequest::GetSpecifier() const {
auto self = Utils::OpenDirectHandle(this);
i::Isolate* i_isolate = self->GetIsolate();
return ToApiHandle<String>(i::direct_handle(self->specifier(), i_isolate),
i_isolate);
return ToApiHandle<String>(i::direct_handle(self->specifier(), i_isolate));
}
int ModuleRequest::GetSourceOffset() const {
@ -2293,7 +2305,7 @@ Local<FixedArray> ModuleRequest::GetImportAttributes() const {
auto self = Utils::OpenDirectHandle(this);
i::Isolate* i_isolate = self->GetIsolate();
return ToApiHandle<FixedArray>(
i::direct_handle(self->import_attributes(), i_isolate), i_isolate);
i::direct_handle(self->import_attributes(), i_isolate));
}
Module::Status Module::GetStatus() const {
@ -2324,8 +2336,7 @@ Local<Value> Module::GetException() const {
auto self = Utils::OpenDirectHandle(this);
i::Isolate* i_isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
return ToApiHandle<Value>(i::direct_handle(self->GetException(), i_isolate),
i_isolate);
return ToApiHandle<Value>(i::direct_handle(self->GetException(), i_isolate));
}
Local<FixedArray> Module::GetModuleRequests() const {
@ -2338,11 +2349,9 @@ Local<FixedArray> Module::GetModuleRequests() const {
return ToApiHandle<FixedArray>(
self->GetReadOnlyRoots().empty_fixed_array_handle());
} else {
return ToApiHandle<FixedArray>(
i::direct_handle(
i::Cast<i::SourceTextModule>(self)->info()->module_requests(),
i_isolate),
i_isolate);
return ToApiHandle<FixedArray>(i::direct_handle(
i::Cast<i::SourceTextModule>(self)->info()->module_requests(),
i_isolate));
}
}
@ -2354,8 +2363,8 @@ Location Module::SourceOffsetToLocation(int offset) const {
Utils::ApiCheck(
i::IsSourceTextModule(*self), "v8::Module::SourceOffsetToLocation",
"v8::Module::SourceOffsetToLocation must be used on an SourceTextModule");
i::Handle<i::Script> script(i::Cast<i::SourceTextModule>(self)->GetScript(),
i_isolate);
i::DirectHandle<i::Script> script(
i::Cast<i::SourceTextModule>(self)->GetScript(), i_isolate);
i::Script::PositionInfo info;
i::Script::GetPositionInfo(script, offset, &info);
return v8::Location(info.line, info.column);
@ -2368,7 +2377,7 @@ Local<Value> Module::GetModuleNamespace() {
auto self = Utils::OpenHandle(this);
auto i_isolate = self->GetIsolate();
DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate);
i::Handle<i::JSModuleNamespace> module_namespace =
i::DirectHandle<i::JSModuleNamespace> module_namespace =
i::Module::GetModuleNamespace(i_isolate, self);
return ToApiHandle<Value>(module_namespace);
}
@ -2380,11 +2389,8 @@ Local<UnboundModuleScript> Module::GetUnboundModuleScript() {
"v8::Module::GetUnboundModuleScript must be used on an SourceTextModule");
auto i_isolate = self->GetIsolate();
DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate);
return ToApiHandle<UnboundModuleScript>(
i::direct_handle(
i::Cast<i::SourceTextModule>(self)->GetSharedFunctionInfo(),
i_isolate),
i_isolate);
return ToApiHandle<UnboundModuleScript>(i::direct_handle(
i::Cast<i::SourceTextModule>(self)->GetSharedFunctionInfo(), i_isolate));
}
int Module::ScriptId() const {
@ -3157,7 +3163,7 @@ int Message::GetWasmFunctionIndex() const {
return Message::kNoWasmFunctionIndexInfo;
}
auto debug_script = ToApiHandle<debug::Script>(script, i_isolate);
auto debug_script = ToApiHandle<debug::Script>(script);
return Local<debug::WasmScript>::Cast(debug_script)
->GetContainingFunction(start_position);
#else
@ -3205,8 +3211,8 @@ MaybeLocal<String> Message::GetSource(Local<Context> context) const {
i::Isolate* i_isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
InternalEscapableScope handle_scope(i_isolate);
RETURN_ESCAPED(Utils::ToLocal(i::direct_handle(self->GetSource(), i_isolate),
i_isolate));
RETURN_ESCAPED(
Utils::ToLocal(i::direct_handle(self->GetSource(), i_isolate)));
}
MaybeLocal<String> Message::GetSourceLine(Local<Context> context) const {
@ -3229,11 +3235,9 @@ void Message::PrintCurrentStackTrace(Isolate* v8_isolate, std::ostream& out) {
Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
uint32_t index) const {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
return Utils::StackFrameToLocal(
i::direct_handle(
i::Cast<i::StackFrameInfo>(Utils::OpenDirectHandle(this)->get(index)),
i_isolate),
i_isolate);
return Utils::StackFrameToLocal(i::direct_handle(
i::Cast<i::StackFrameInfo>(Utils::OpenDirectHandle(this)->get(index)),
i_isolate));
}
int StackTrace::GetFrameCount() const {
@ -3263,7 +3267,7 @@ Local<String> StackTrace::CurrentScriptNameOrSourceURL(Isolate* v8_isolate) {
Location StackFrame::GetLocation() const {
auto self = Utils::OpenHandle(this);
i::Isolate* i_isolate = self->GetIsolate();
i::Handle<i::Script> script(self->script(), i_isolate);
i::DirectHandle<i::Script> script(self->script(), i_isolate);
i::Script::PositionInfo info;
CHECK(i::Script::GetPositionInfo(
script, i::StackFrameInfo::GetSourcePosition(self), &info));
@ -3285,7 +3289,7 @@ Local<String> StackFrame::GetScriptName() const {
i::Isolate* i_isolate = self->GetIsolate();
i::DirectHandle<i::Object> name(self->script()->name(), i_isolate);
if (!IsString(*name)) return {};
return Utils::ToLocal(i::Cast<i::String>(name), i_isolate);
return Utils::ToLocal(i::Cast<i::String>(name));
}
Local<String> StackFrame::GetScriptNameOrSourceURL() const {
@ -3294,7 +3298,7 @@ Local<String> StackFrame::GetScriptNameOrSourceURL() const {
i::DirectHandle<i::Object> name_or_source_url(
self->script()->GetNameOrSourceURL(), i_isolate);
if (!IsString(*name_or_source_url)) return {};
return Utils::ToLocal(i::Cast<i::String>(name_or_source_url), i_isolate);
return Utils::ToLocal(i::Cast<i::String>(name_or_source_url));
}
Local<String> StackFrame::GetScriptSource() const {
@ -3304,7 +3308,7 @@ Local<String> StackFrame::GetScriptSource() const {
i::DirectHandle<i::PrimitiveHeapObject> source(self->script()->source(),
i_isolate);
if (!IsString(*source)) return {};
return Utils::ToLocal(i::Cast<i::String>(source), i_isolate);
return Utils::ToLocal(i::Cast<i::String>(source));
}
Local<String> StackFrame::GetScriptSourceMappingURL() const {
@ -3313,7 +3317,7 @@ Local<String> StackFrame::GetScriptSourceMappingURL() const {
i::DirectHandle<i::Object> source_mapping_url(
self->script()->source_mapping_url(), i_isolate);
if (!IsString(*source_mapping_url)) return {};
return Utils::ToLocal(i::Cast<i::String>(source_mapping_url), i_isolate);
return Utils::ToLocal(i::Cast<i::String>(source_mapping_url));
}
Local<String> StackFrame::GetFunctionName() const {
@ -3321,7 +3325,7 @@ Local<String> StackFrame::GetFunctionName() const {
i::Isolate* i_isolate = self->GetIsolate();
i::DirectHandle<i::String> name(self->function_name(), i_isolate);
if (name->length() == 0) return {};
return Utils::ToLocal(name, i_isolate);
return Utils::ToLocal(name);
}
bool StackFrame::IsEval() const {
@ -3860,7 +3864,7 @@ MaybeLocal<String> Value::ToString(Local<Context> context) const {
}
MaybeLocal<String> Value::ToDetailString(Local<Context> context) const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::DirectHandle<i::Object> obj = Utils::OpenDirectHandle(this);
i::Isolate* i_isolate;
if (!context.IsEmpty()) {
i_isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
@ -3870,8 +3874,7 @@ MaybeLocal<String> Value::ToDetailString(Local<Context> context) const {
}
if (i::IsString(*obj)) return ToApiHandle<String>(obj);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
return Utils::ToLocal(i::Object::NoSideEffectsToString(i_isolate, obj),
i_isolate);
return Utils::ToLocal(i::Object::NoSideEffectsToString(i_isolate, obj));
}
MaybeLocal<Object> Value::ToObject(Local<Context> context) const {
@ -4905,7 +4908,7 @@ MaybeLocal<Array> v8::Object::GetPropertyNames(
KeyConversionMode key_conversion) {
PREPARE_FOR_EXECUTION(context, Object, GetPropertyNames);
auto self = Utils::OpenHandle(this);
i::Handle<i::FixedArray> value;
i::DirectHandle<i::FixedArray> value;
i::KeyAccumulator accumulator(
i_isolate, static_cast<i::KeyCollectionMode>(mode),
static_cast<i::PropertyFilter>(property_filter));
@ -5299,14 +5302,19 @@ Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes(
static_cast<PropertyAttribute>(result.FromJust()));
}
Local<v8::Object> v8::Object::Clone() {
Local<v8::Object> v8::Object::Clone(Isolate* isolate) {
auto self = i::Cast<i::JSObject>(Utils::OpenHandle(this));
auto i_isolate = self->GetIsolate();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
i::Handle<i::JSObject> result = i_isolate->factory()->CopyJSObject(self);
return Utils::ToLocal(result);
}
Local<v8::Object> v8::Object::Clone() {
auto self = i::Cast<i::JSObject>(Utils::OpenHandle(this));
return Clone(reinterpret_cast<v8::Isolate*>(self->GetIsolate()));
}
namespace {
V8_INLINE MaybeLocal<v8::Context> GetCreationContextImpl(
i::DirectHandle<i::JSReceiver> object, i::Isolate* i_isolate) {
@ -5436,7 +5444,7 @@ bool v8::Object::IsUndetectable() const {
}
namespace {
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
// A newly allocated vector is required to convert from an array of direct
// locals to an array of indirect handles.
std::vector<i::Handle<i::Object>> PrepareArguments(int argc,
@ -5447,7 +5455,7 @@ std::vector<i::Handle<i::Object>> PrepareArguments(int argc,
}
return args;
}
#else // !V8_ENABLE_DIRECT_LOCAL
#else // !V8_ENABLE_DIRECT_HANDLE
// A simple cast is used to convert from an array of indirect locals to an
// array of indirect handles. A MemorySpan object is returned, as no
// deallocation is necessary.
@ -5456,7 +5464,7 @@ v8::MemorySpan<i::Handle<i::Object>> PrepareArguments(int argc,
return {reinterpret_cast<i::Handle<i::Object>*>(argv),
static_cast<size_t>(argc)};
}
#endif // V8_ENABLE_DIRECT_LOCAL
#endif // V8_ENABLE_DIRECT_HANDLE
} // namespace
MaybeLocal<Value> Object::CallAsFunction(Local<Context> context,
@ -5552,10 +5560,11 @@ MaybeLocal<Object> Function::NewInstanceWithSideEffectType(
RETURN_ESCAPED(result);
}
MaybeLocal<v8::Value> Function::Call(Local<Context> context,
MaybeLocal<v8::Value> Function::Call(v8::Isolate* isolate,
Local<Context> context,
v8::Local<v8::Value> recv, int argc,
v8::Local<v8::Value> argv[]) {
auto i_isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
auto i_isolate = reinterpret_cast<i::Isolate*>(isolate);
TRACE_EVENT_CALL_STATS_SCOPED(i_isolate, "v8", "V8.Execute");
ENTER_V8(i_isolate, context, Function, Call, InternalEscapableScope);
i::TimerEventScope<i::TimerEventExecute> timer_scope(i_isolate);
@ -5575,6 +5584,12 @@ MaybeLocal<v8::Value> Function::Call(Local<Context> context,
RETURN_ESCAPED(result);
}
MaybeLocal<v8::Value> Function::Call(Local<Context> context,
v8::Local<v8::Value> recv, int argc,
v8::Local<v8::Value> argv[]) {
return Call(context->GetIsolate(), context, recv, argc, argv);
}
void Function::SetName(v8::Local<v8::String> name) {
auto self = Utils::OpenDirectHandle(this);
if (!IsJSFunction(*self)) return;
@ -5596,7 +5611,7 @@ Local<Value> Function::GetName() const {
}
if (i::IsJSFunction(*self)) {
auto func = i::Cast<i::JSFunction>(self);
return Utils::ToLocal(handle(func->shared()->Name(), i_isolate));
return Utils::ToLocal(i::direct_handle(func->shared()->Name(), i_isolate));
}
return ToApiHandle<Primitive>(i_isolate->factory()->undefined_value());
}
@ -5610,7 +5625,7 @@ Local<Value> Function::GetInferredName() const {
auto func = i::Cast<i::JSFunction>(self);
i::Isolate* isolate = func->GetIsolate();
return Utils::ToLocal(
i::direct_handle(func->shared()->inferred_name(), isolate), isolate);
i::direct_handle(func->shared()->inferred_name(), isolate));
}
Local<Value> Function::GetDebugName() const {
@ -5621,7 +5636,7 @@ Local<Value> Function::GetDebugName() const {
}
auto func = i::Cast<i::JSFunction>(self);
i::DirectHandle<i::String> name = i::JSFunction::GetDebugName(func);
return Utils::ToLocal(i::direct_handle(*name, i_isolate), i_isolate);
return Utils::ToLocal(i::direct_handle(*name, i_isolate));
}
ScriptOrigin Function::GetScriptOrigin() const {
@ -5645,8 +5660,8 @@ int Function::GetScriptLineNumber() const {
}
auto func = i::Cast<i::JSFunction>(self);
if (i::IsScript(func->shared()->script())) {
i::Handle<i::Script> script(i::Cast<i::Script>(func->shared()->script()),
func->GetIsolate());
i::DirectHandle<i::Script> script(
i::Cast<i::Script>(func->shared()->script()), func->GetIsolate());
return i::Script::GetLineNumber(script, func->shared()->StartPosition());
}
return kLineOffsetNotFound;
@ -5659,8 +5674,8 @@ int Function::GetScriptColumnNumber() const {
}
auto func = i::Cast<i::JSFunction>(self);
if (i::IsScript(func->shared()->script())) {
i::Handle<i::Script> script(i::Cast<i::Script>(func->shared()->script()),
func->GetIsolate());
i::DirectHandle<i::Script> script(
i::Cast<i::Script>(func->shared()->script()), func->GetIsolate());
return i::Script::GetColumnNumber(script, func->shared()->StartPosition());
}
return kLineOffsetNotFound;
@ -6123,8 +6138,7 @@ bool v8::String::IsExternalOneByte() const {
Local<v8::String> v8::String::InternalizeString(Isolate* v8_isolate) {
auto* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
auto str = Utils::OpenDirectHandle(this);
return Utils::ToLocal(isolate->factory()->InternalizeString(str),
isolate);
return Utils::ToLocal(isolate->factory()->InternalizeString(str));
}
void v8::String::VerifyExternalStringResource(
@ -6300,7 +6314,7 @@ v8::String::GetExternalOneByteStringResource() const {
Local<Value> Symbol::Description(Isolate* v8_isolate) const {
auto sym = Utils::OpenDirectHandle(this);
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
return Utils::ToLocal(i::direct_handle(sym->description(), isolate), isolate);
return Utils::ToLocal(i::direct_handle(sym->description(), isolate));
}
Local<Value> Private::Name() const {
@ -6366,10 +6380,8 @@ Local<Data> v8::Object::SlowGetInternalField(int index) {
const char* location = "v8::Object::GetInternalField()";
if (!InternalFieldOK(obj, index, location)) return Local<Value>();
i::Isolate* isolate = obj->GetIsolate();
return ToApiHandle<Data>(
i::direct_handle(i::Cast<i::JSObject>(*obj)->GetEmbedderField(index),
isolate),
isolate);
return ToApiHandle<Data>(i::direct_handle(
i::Cast<i::JSObject>(*obj)->GetEmbedderField(index), isolate));
}
void v8::Object::SetInternalField(int index, v8::Local<Data> value) {
@ -6714,10 +6726,10 @@ static i::Handle<ObjectType> CreateEnvironment(
v8::Local<ObjectTemplate> proxy_template;
i::Handle<i::FunctionTemplateInfo> proxy_constructor;
i::Handle<i::FunctionTemplateInfo> global_constructor;
i::Handle<i::UnionOf<i::Undefined, i::InterceptorInfo>> named_interceptor(
i_isolate->factory()->undefined_value());
i::Handle<i::UnionOf<i::Undefined, i::InterceptorInfo>> indexed_interceptor(
i_isolate->factory()->undefined_value());
i::DirectHandle<i::UnionOf<i::Undefined, i::InterceptorInfo>>
named_interceptor(i_isolate->factory()->undefined_value());
i::DirectHandle<i::UnionOf<i::Undefined, i::InterceptorInfo>>
indexed_interceptor(i_isolate->factory()->undefined_value());
if (!maybe_global_template.IsEmpty()) {
v8::Local<v8::ObjectTemplate> global_template =
@ -6911,8 +6923,7 @@ Local<Value> v8::Context::GetSecurityToken() {
auto env = Utils::OpenDirectHandle(this);
i::Isolate* i_isolate = env->GetIsolate();
i::Tagged<i::Object> security_token = env->security_token();
return Utils::ToLocal(i::Handle<i::Object>(security_token, i_isolate),
i_isolate);
return Utils::ToLocal(i::direct_handle(security_token, i_isolate));
}
namespace {
@ -7195,7 +7206,7 @@ class ObjectVisitorDeepFreezer : i::ObjectVisitor {
std::unordered_set<i::Tagged<i::Object>, i::Object::Hasher> done_list_;
std::vector<i::Handle<i::JSReceiver>> objects_to_freeze_;
std::vector<i::Handle<i::AccessorPair>> lazy_accessor_pairs_to_freeze_;
base::Optional<ErrorInfo> error_;
std::optional<ErrorInfo> error_;
};
} // namespace
@ -7257,9 +7268,9 @@ v8::Local<v8::Object> Context::Global() {
// but can't presently as calls to GetPrototype will return the wrong result.
if (global->IsDetachedFrom(context->global_object())) {
i::DirectHandle<i::JSObject> result(context->global_object(), i_isolate);
return Utils::ToLocal(result, i_isolate);
return Utils::ToLocal(result);
}
return Utils::ToLocal(i::Cast<i::JSObject>(global), i_isolate);
return Utils::ToLocal(i::Cast<i::JSObject>(global));
}
void Context::DetachGlobal() {
@ -7273,7 +7284,7 @@ Local<v8::Object> Context::GetExtrasBindingObject() {
auto context = Utils::OpenDirectHandle(this);
i::Isolate* i_isolate = context->GetIsolate();
return Utils::ToLocal(
i::direct_handle(context->extras_binding_object(), i_isolate), i_isolate);
i::direct_handle(context->extras_binding_object(), i_isolate));
}
void Context::AllowCodeGenerationFromStrings(bool allow) {
@ -7937,10 +7948,8 @@ Local<v8::BigInt> v8::BigIntObject::ValueOf() const {
auto js_primitive_wrapper = i::Cast<i::JSPrimitiveWrapper>(obj);
i::Isolate* i_isolate = js_primitive_wrapper->GetIsolate();
API_RCS_SCOPE(i_isolate, BigIntObject, BigIntValue);
return Utils::ToLocal(
i::direct_handle(i::Cast<i::BigInt>(js_primitive_wrapper->value()),
i_isolate),
i_isolate);
return Utils::ToLocal(i::direct_handle(
i::Cast<i::BigInt>(js_primitive_wrapper->value()), i_isolate));
}
Local<v8::Value> v8::BooleanObject::New(Isolate* v8_isolate, bool value) {
@ -7979,10 +7988,8 @@ Local<v8::String> v8::StringObject::ValueOf() const {
auto js_primitive_wrapper = i::Cast<i::JSPrimitiveWrapper>(obj);
i::Isolate* i_isolate = js_primitive_wrapper->GetIsolate();
API_RCS_SCOPE(i_isolate, StringObject, StringValue);
return Utils::ToLocal(
i::direct_handle(i::Cast<i::String>(js_primitive_wrapper->value()),
i_isolate),
i_isolate);
return Utils::ToLocal(i::direct_handle(
i::Cast<i::String>(js_primitive_wrapper->value()), i_isolate));
}
Local<v8::Value> v8::SymbolObject::New(Isolate* v8_isolate,
@ -8001,10 +8008,8 @@ Local<v8::Symbol> v8::SymbolObject::ValueOf() const {
auto js_primitive_wrapper = i::Cast<i::JSPrimitiveWrapper>(obj);
i::Isolate* i_isolate = js_primitive_wrapper->GetIsolate();
API_RCS_SCOPE(i_isolate, SymbolObject, SymbolValue);
return Utils::ToLocal(
i::direct_handle(i::Cast<i::Symbol>(js_primitive_wrapper->value()),
i_isolate),
i_isolate);
return Utils::ToLocal(i::direct_handle(
i::Cast<i::Symbol>(js_primitive_wrapper->value()), i_isolate));
}
MaybeLocal<v8::Value> v8::Date::New(Local<Context> context, double time) {
@ -8113,8 +8118,7 @@ MaybeLocal<v8::RegExp> v8::RegExp::NewWithBacktrackLimit(
Local<v8::String> v8::RegExp::GetSource() const {
auto obj = Utils::OpenDirectHandle(this);
i::Isolate* i_isolate = obj->GetIsolate();
return Utils::ToLocal(i::direct_handle(obj->EscapedPattern(), i_isolate),
i_isolate);
return Utils::ToLocal(i::direct_handle(obj->EscapedPattern(), i_isolate));
}
// Assert that the static flags cast in GetFlags is valid.
@ -8400,7 +8404,7 @@ Maybe<void> v8::Array::Iterate(Local<Context> context,
}
v8::TypecheckWitness::TypecheckWitness(Isolate* isolate)
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
// An empty local suffices.
: cached_map_()
#else
@ -8413,7 +8417,7 @@ v8::TypecheckWitness::TypecheckWitness(Isolate* isolate)
void v8::TypecheckWitness::Update(Local<Value> baseline) {
i::Tagged<i::Object> obj = *Utils::OpenDirectHandle(*baseline);
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
if (IsSmi(obj)) {
cached_map_ = Local<Data>();
} else {
@ -8682,8 +8686,7 @@ MaybeLocal<Promise::Resolver> Promise::Resolver::New(Local<Context> context) {
Local<Promise> Promise::Resolver::GetPromise() {
auto promise = Utils::OpenDirectHandle(this);
i::Isolate* i_isolate = promise->GetIsolate();
return Local<Promise>::Cast(Utils::ToLocal(promise, i_isolate));
return Local<Promise>::Cast(Utils::ToLocal(promise));
}
Maybe<bool> Promise::Resolver::Resolve(Local<Context> context,
@ -8784,8 +8787,7 @@ Local<Value> Promise::Result() {
auto js_promise = i::Cast<i::JSPromise>(promise);
Utils::ApiCheck(js_promise->status() != kPending, "v8_Promise_Result",
"Promise is still pending");
return Utils::ToLocal(i::direct_handle(js_promise->result(), i_isolate),
i_isolate);
return Utils::ToLocal(i::direct_handle(js_promise->result(), i_isolate));
}
Promise::PromiseState Promise::State() {
@ -8806,14 +8808,13 @@ void Promise::MarkAsSilent() {
Local<Value> Proxy::GetTarget() {
auto self = Utils::OpenDirectHandle(this);
i::Isolate* i_isolate = self->GetIsolate();
return Utils::ToLocal(i::direct_handle(self->target(), i_isolate), i_isolate);
return Utils::ToLocal(i::direct_handle(self->target(), i_isolate));
}
Local<Value> Proxy::GetHandler() {
auto self = Utils::OpenDirectHandle(this);
i::Isolate* i_isolate = self->GetIsolate();
return Utils::ToLocal(i::direct_handle(self->handler(), i_isolate),
i_isolate);
return Utils::ToLocal(i::direct_handle(self->handler(), i_isolate));
}
bool Proxy::IsRevoked() const {
@ -8872,8 +8873,7 @@ Local<ArrayBuffer> v8::WasmMemoryObject::Buffer() {
#if V8_ENABLE_WEBASSEMBLY
auto obj = Utils::OpenDirectHandle(this);
i::Isolate* i_isolate = obj->GetIsolate();
return Utils::ToLocal(i::direct_handle(obj->array_buffer(), i_isolate),
i_isolate);
return Utils::ToLocal(i::direct_handle(obj->array_buffer(), i_isolate));
#else
UNREACHABLE();
#endif // V8_ENABLE_WEBASSEMBLY
@ -9151,18 +9151,14 @@ Local<ArrayBuffer> v8::ArrayBufferView::Buffer() {
i::DirectHandle<i::JSDataView> data_view(i::Cast<i::JSDataView>(*obj),
i_isolate);
DCHECK(IsJSArrayBuffer(data_view->buffer()));
return Utils::ToLocal(
i::direct_handle(i::Cast<i::JSArrayBuffer>(data_view->buffer()),
i_isolate),
i_isolate);
return Utils::ToLocal(i::direct_handle(
i::Cast<i::JSArrayBuffer>(data_view->buffer()), i_isolate));
} else if (i::IsJSRabGsabDataView(*obj)) {
i::DirectHandle<i::JSRabGsabDataView> data_view(
i::Cast<i::JSRabGsabDataView>(*obj), i_isolate);
DCHECK(IsJSArrayBuffer(data_view->buffer()));
return Utils::ToLocal(
i::direct_handle(i::Cast<i::JSArrayBuffer>(data_view->buffer()),
i_isolate),
i_isolate);
return Utils::ToLocal(i::direct_handle(
i::Cast<i::JSArrayBuffer>(data_view->buffer()), i_isolate));
} else {
DCHECK(IsJSTypedArray(*obj));
return Utils::ToLocal(i::Cast<i::JSTypedArray>(*obj)->GetBuffer());
@ -9246,8 +9242,9 @@ static_assert(v8::TypedArray::kMaxByteLength == i::JSTypedArray::kMaxByteLength,
return Local<Type##Array>(); \
} \
auto buffer = Utils::OpenHandle(*array_buffer); \
i::Handle<i::JSTypedArray> obj = i_isolate->factory()->NewJSTypedArray( \
i::kExternal##Type##Array, buffer, byte_offset, length); \
i::DirectHandle<i::JSTypedArray> obj = \
i_isolate->factory()->NewJSTypedArray(i::kExternal##Type##Array, \
buffer, byte_offset, length); \
return Utils::ToLocal##Type##Array(obj); \
} \
Local<Type##Array> Type##Array::New( \
@ -9265,8 +9262,9 @@ static_assert(v8::TypedArray::kMaxByteLength == i::JSTypedArray::kMaxByteLength,
return Local<Type##Array>(); \
} \
auto buffer = Utils::OpenHandle(*shared_array_buffer); \
i::Handle<i::JSTypedArray> obj = i_isolate->factory()->NewJSTypedArray( \
i::kExternal##Type##Array, buffer, byte_offset, length); \
i::DirectHandle<i::JSTypedArray> obj = \
i_isolate->factory()->NewJSTypedArray(i::kExternal##Type##Array, \
buffer, byte_offset, length); \
return Utils::ToLocal##Type##Array(obj); \
}
@ -9287,7 +9285,7 @@ Local<Float16Array> Float16Array::New(Local<ArrayBuffer> array_buffer,
return Local<Float16Array>();
}
auto buffer = Utils::OpenHandle(*array_buffer);
i::Handle<i::JSTypedArray> obj = i_isolate->factory()->NewJSTypedArray(
i::DirectHandle<i::JSTypedArray> obj = i_isolate->factory()->NewJSTypedArray(
i::kExternalFloat16Array, buffer, byte_offset, length);
return Utils::ToLocalFloat16Array(obj);
}
@ -9307,7 +9305,7 @@ Local<Float16Array> Float16Array::New(
return Local<Float16Array>();
}
auto buffer = Utils::OpenHandle(*shared_array_buffer);
i::Handle<i::JSTypedArray> obj = i_isolate->factory()->NewJSTypedArray(
i::DirectHandle<i::JSTypedArray> obj = i_isolate->factory()->NewJSTypedArray(
i::kExternalFloat16Array, buffer, byte_offset, length);
return Utils::ToLocalFloat16Array(obj);
}
@ -9599,7 +9597,7 @@ v8::Local<v8::Context> Isolate::GetCurrentContext() {
i::Tagged<i::Context> context = i_isolate->context();
if (context.is_null()) return Local<Context>();
i::Tagged<i::NativeContext> native_context = context->native_context();
return Utils::ToLocal(handle(native_context, i_isolate));
return Utils::ToLocal(i::direct_handle(native_context, i_isolate));
}
// TODO(ishell): rename back to GetEnteredContext().
@ -9617,6 +9615,16 @@ v8::Local<v8::Context> Isolate::GetIncumbentContext() {
return Utils::ToLocal(context);
}
v8::MaybeLocal<v8::Data> Isolate::GetCurrentHostDefinedOptions() {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this);
i::Handle<i::Script> script;
if (!i_isolate->CurrentReferrerScript().ToHandle(&script)) {
return MaybeLocal<v8::Data>();
}
return ToApiHandle<Data>(
i::direct_handle(script->host_defined_options(), i_isolate));
}
v8::Local<Value> Isolate::ThrowError(v8::Local<v8::String> message) {
return ThrowException(v8::Exception::Error(message));
}
@ -9766,7 +9774,7 @@ void Isolate::RequestGarbageCollectionForTesting(GarbageCollectionType type) {
void Isolate::RequestGarbageCollectionForTesting(GarbageCollectionType type,
StackState stack_state) {
base::Optional<i::EmbedderStackStateScope> stack_scope;
std::optional<i::EmbedderStackStateScope> stack_scope;
if (type == kFullGarbageCollection) {
stack_scope.emplace(reinterpret_cast<i::Isolate*>(this)->heap(),
i::EmbedderStackStateOrigin::kExplicitInvocation,
@ -10052,11 +10060,9 @@ i::Address* Isolate::GetDataFromSnapshotOnce(size_t index) {
Local<Value> Isolate::GetContinuationPreservedEmbedderData() {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this);
#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
return ToApiHandle<Object>(
i::direct_handle(
i_isolate->isolate_data()->continuation_preserved_embedder_data(),
i_isolate),
i_isolate);
return ToApiHandle<Object>(i::direct_handle(
i_isolate->isolate_data()->continuation_preserved_embedder_data(),
i_isolate));
#else // V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
return v8::Undefined(reinterpret_cast<v8::Isolate*>(i_isolate));
#endif // V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
@ -10952,7 +10958,7 @@ void String::ValueView::CheckOneByte(bool is_one_byte) const {
i::Handle<i::JSFunction> constructor = i_isolate->name##_function(); \
error = *i_isolate->factory()->NewError(constructor, message, options); \
} \
return Utils::ToLocal(i::direct_handle(error, i_isolate), i_isolate); \
return Utils::ToLocal(i::direct_handle(error, i_isolate)); \
}
DEFINE_ERROR(RangeError, range_error)
@ -11051,7 +11057,7 @@ Local<String> CpuProfileNode::GetFunctionName() const {
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
i::Isolate* i_isolate = node->isolate();
const i::CodeEntry* entry = node->entry();
i::Handle<i::String> name =
i::DirectHandle<i::String> name =
i_isolate->factory()->InternalizeUtf8String(entry->name());
return ToApiHandle<String>(name);
}
@ -11580,6 +11586,11 @@ const HeapSnapshot* HeapProfiler::TakeHeapSnapshot(ActivityControl* control,
return TakeHeapSnapshot(options);
}
std::vector<v8::Local<v8::Value>> HeapProfiler::GetDetachedJSWrapperObjects() {
return reinterpret_cast<i::HeapProfiler*>(this)
->GetDetachedJSWrapperObjects();
}
void HeapProfiler::StartTrackingHeapObjects(bool track_allocations) {
reinterpret_cast<i::HeapProfiler*>(this)->StartHeapObjectsTracking(
track_allocations);

70
deps/v8/src/api/api.h vendored
View file

@ -49,10 +49,11 @@ class EphemeronTable;
} // namespace debug
template <typename T, internal::ExternalPointerTag tag>
inline T ToCData(v8::internal::Tagged<v8::internal::Object> obj);
inline T ToCData(i::Isolate* isolate,
v8::internal::Tagged<v8::internal::Object> obj);
template <internal::ExternalPointerTag tag>
inline v8::internal::Address ToCData(
v8::internal::Isolate* isolate,
v8::internal::Tagged<v8::internal::Object> obj);
template <internal::ExternalPointerTag tag, typename T>
@ -132,6 +133,23 @@ class RegisteredExtension {
V(ToLocal, ScriptOrModule, ScriptOrModule) \
IF_WASM(V, ToLocal, WasmModuleObject, WasmModuleObject)
#define TO_LOCAL_NAME_LIST(V) \
V(ToLocal) \
V(ToLocalShared) \
V(SignatureToLocal) \
V(MessageToLocal) \
V(PromiseToLocal) \
V(StackTraceToLocal) \
V(StackFrameToLocal) \
V(NumberToLocal) \
V(IntegerToLocal) \
V(Uint32ToLocal) \
V(ExternalToLocal) \
V(CallableToLocal) \
V(ToLocalPrimitive) \
V(FixedArrayToLocal) \
V(PrimitiveArrayToLocal)
#define OPEN_HANDLE_LIST(V) \
V(Template, TemplateInfo) \
V(FunctionTemplate, FunctionTemplateInfo) \
@ -201,21 +219,23 @@ class Utils {
static void ReportOOMFailure(v8::internal::Isolate* isolate,
const char* location, const OOMDetails& details);
#define DECLARE_TO_LOCAL(Name, From, To) \
static inline Local<v8::To> Name( \
v8::internal::Handle<v8::internal::From> obj); \
static inline Local<v8::To> Name( \
v8::internal::DirectHandle<v8::internal::From> obj, \
v8::internal::Isolate* isolate);
// TODO(42203211): It would be nice if we could keep only a version with
// direct handles. But the implicit conversion from handles to direct handles
// combined with the heterogeneous copy constructor for direct handles make
// this ambiguous.
// TODO(42203211): Use C++20 concepts instead of the enable_if trait, when
// they are fully supported in V8.
#define DECLARE_TO_LOCAL(Name) \
template <template <typename T> typename HandleType, typename T, \
typename = std::enable_if_t<std::is_convertible_v< \
HandleType<T>, v8::internal::DirectHandle<T>>>> \
static inline auto Name(HandleType<T> obj);
TO_LOCAL_LIST(DECLARE_TO_LOCAL)
TO_LOCAL_NAME_LIST(DECLARE_TO_LOCAL)
#define DECLARE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype) \
static inline Local<v8::Type##Array> ToLocal##Type##Array( \
v8::internal::Handle<v8::internal::JSTypedArray> obj); \
static inline Local<v8::Type##Array> ToLocal##Type##Array( \
v8::internal::DirectHandle<v8::internal::JSTypedArray> obj, \
v8::internal::Isolate* isolate);
v8::internal::DirectHandle<v8::internal::JSTypedArray> obj);
TYPED_ARRAYS(DECLARE_TO_LOCAL_TYPED_ARRAY)
@ -234,11 +254,7 @@ class Utils {
#undef DECLARE_TO_LOCAL
template <class From, class To>
static inline Local<To> Convert(v8::internal::Handle<From> obj);
template <class From, class To>
static inline Local<To> Convert(v8::internal::DirectHandle<From> obj,
v8::internal::Isolate* isolate);
static inline Local<To> Convert(v8::internal::DirectHandle<From> obj);
template <class T>
static inline v8::internal::Handle<v8::internal::Object> OpenPersistent(
@ -266,6 +282,13 @@ class Utils {
private:
V8_NOINLINE V8_PRESERVE_MOST static void ReportApiFailure(
const char* location, const char* message);
#define DECLARE_TO_LOCAL_PRIVATE(Name, From, To) \
static inline Local<v8::To> Name##_helper( \
v8::internal::DirectHandle<v8::internal::From> obj);
TO_LOCAL_LIST(DECLARE_TO_LOCAL_PRIVATE)
#undef DECLARE_TO_LOCAL_PRIVATE
};
template <class T>
@ -275,17 +298,10 @@ inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) {
template <class T>
inline v8::Local<T> ToApiHandle(
v8::internal::Handle<v8::internal::Object> obj) {
v8::internal::DirectHandle<v8::internal::Object> obj) {
return Utils::Convert<v8::internal::Object, T>(obj);
}
template <class T>
inline v8::Local<T> ToApiHandle(
v8::internal::DirectHandle<v8::internal::Object> obj,
v8::internal::Isolate* isolate) {
return Utils::Convert<v8::internal::Object, T>(obj, isolate);
}
template <class T>
inline bool ToLocal(v8::internal::MaybeHandle<v8::internal::Object> maybe,
Local<T>* local) {
@ -467,7 +483,7 @@ void HandleScopeImplementer::DeleteExtensions(internal::Address* prev_limit) {
// SealHandleScope may make the prev_limit to point inside the block.
// Cast possibly-unrelated pointers to plain Addres before comparing them
// to avoid undefined behavior.
if (reinterpret_cast<Address>(block_start) <=
if (reinterpret_cast<Address>(block_start) <
reinterpret_cast<Address>(prev_limit) &&
reinterpret_cast<Address>(prev_limit) <=
reinterpret_cast<Address>(block_limit)) {

View file

@ -4,10 +4,11 @@
#include "src/asmjs/asm-js.h"
#include <optional>
#include "src/asmjs/asm-names.h"
#include "src/asmjs/asm-parser.h"
#include "src/ast/ast.h"
#include "src/base/optional.h"
#include "src/base/platform/elapsed-timer.h"
#include "src/base/vector.h"
#include "src/codegen/compiler.h"
@ -235,7 +236,7 @@ UnoptimizedCompilationJob::Status AsmJsCompilationJob::ExecuteJobImpl() {
Zone translate_zone(allocator_, ZONE_NAME);
Utf16CharacterStream* stream = parse_info()->character_stream();
base::Optional<AllowHandleDereference> allow_deref;
std::optional<AllowHandleDereference> allow_deref;
if (stream->can_access_heap()) {
allow_deref.emplace();
}

View file

@ -8,10 +8,10 @@
#include <string.h>
#include <algorithm>
#include <optional>
#include "src/asmjs/asm-js.h"
#include "src/asmjs/asm-types.h"
#include "src/base/optional.h"
#include "src/base/overflowing-math.h"
#include "src/flags/flags.h"
#include "src/numbers/conversions-inl.h"
@ -2119,7 +2119,7 @@ AsmType* AsmJsParser::ValidateCall() {
// both cases we might be seeing the {function_name} for the first time and
// hence allocate a {VarInfo} here, all subsequent uses of the same name then
// need to match the information stored at this point.
base::Optional<TemporaryVariableScope> tmp_scope;
std::optional<TemporaryVariableScope> tmp_scope;
if (Check('[')) {
AsmType* index = nullptr;
RECURSEn(index = EqualityExpression());

View file

@ -6,6 +6,7 @@
#include <cinttypes>
#include "src/base/iterator.h"
#include "src/flags/flags.h"
#include "src/numbers/conversions.h"
#include "src/parsing/scanner.h"
@ -271,6 +272,13 @@ void AsmJsScanner::ConsumeIdentifier(base::uc32 ch) {
}
}
namespace {
bool IsValidImplicitOctal(std::string_view number) {
DCHECK_EQ(number[0], '0');
return std::all_of(number.begin() + 1, number.end(), IsOctalDigit);
}
} // namespace
void AsmJsScanner::ConsumeNumber(base::uc32 ch) {
std::string number;
number.assign(1, ch);
@ -308,10 +316,40 @@ void AsmJsScanner::ConsumeNumber(base::uc32 ch) {
token_ = '.';
return;
}
// Decode numbers.
double_value_ = StringToDouble(
base::Vector<const uint8_t>::cast(base::VectorOf(number)),
ALLOW_HEX | ALLOW_OCTAL | ALLOW_BINARY | ALLOW_IMPLICIT_OCTAL);
// Decode numbers, with seperate paths for prefixes and implicit octals.
if (has_prefix && number[0] == '0') {
// "0[xob]" by itself is a parse error.
if (number.size() <= 2) {
token_ = kParseError;
return;
}
switch (number[1]) {
case 'b':
double_value_ = BinaryStringToDouble(
base::Vector<const uint8_t>::cast(base::VectorOf(number)));
break;
case 'o':
double_value_ = OctalStringToDouble(
base::Vector<const uint8_t>::cast(base::VectorOf(number)));
break;
case 'x':
double_value_ = HexStringToDouble(
base::Vector<const uint8_t>::cast(base::VectorOf(number)));
break;
default:
// If there is a prefix character, but it's not the second character,
// then there's a parse error somewhere.
token_ = kParseError;
break;
}
} else if (number[0] == '0' && !has_prefix && IsValidImplicitOctal(number)) {
double_value_ = ImplicitOctalStringToDouble(
base::Vector<const uint8_t>::cast(base::VectorOf(number)));
} else {
double_value_ = StringToDouble(
base::Vector<const uint8_t>::cast(base::VectorOf(number)),
NO_CONVERSION_FLAG);
}
if (std::isnan(double_value_)) {
// Check if string to number conversion didn't consume all the characters.
// This happens if the character filter let through something invalid

View file

@ -31,6 +31,13 @@ void AstFunctionLiteralIdReindexer::VisitFunctionLiteral(FunctionLiteral* lit) {
lit->set_function_literal_id(lit->function_literal_id() + delta_);
}
void AstFunctionLiteralIdReindexer::VisitCall(Call* expr) {
AstTraversalVisitor::VisitCall(expr);
if (expr->is_possibly_eval()) {
expr->adjust_eval_scope_info_index(delta_);
}
}
void AstFunctionLiteralIdReindexer::VisitClassLiteral(ClassLiteral* expr) {
// Manually visit the class literal so that we can change the property walk.
// This should be kept in-sync with AstTraversalVisitor::VisitClassLiteral.

View file

@ -30,6 +30,7 @@ class AstFunctionLiteralIdReindexer final
// AstTraversalVisitor implementation.
void VisitFunctionLiteral(FunctionLiteral* lit);
void VisitClassLiteral(ClassLiteral* lit);
void VisitCall(Call* lit);
private:
int delta_;

View file

@ -540,6 +540,18 @@ void AstTraversalVisitor<Subclass>::VisitInitializeClassStaticElementsStatement(
}
}
template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitAutoAccessorGetterBody(
AutoAccessorGetterBody* stmt) {
PROCESS_NODE(stmt);
}
template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitAutoAccessorSetterBody(
AutoAccessorSetterBody* stmt) {
PROCESS_NODE(stmt);
}
template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitSpread(Spread* expr) {
PROCESS_EXPRESSION(expr);

View file

@ -305,6 +305,19 @@ ClassLiteralProperty::ClassLiteralProperty(Expression* key, Expression* value,
is_private_(is_private),
private_or_computed_name_proxy_(nullptr) {}
ClassLiteralProperty::ClassLiteralProperty(Expression* key, Expression* value,
AutoAccessorInfo* info,
bool is_static,
bool is_computed_name,
bool is_private)
: LiteralProperty(key, value, is_computed_name),
kind_(Kind::AUTO_ACCESSOR),
is_static_(is_static),
is_private_(is_private),
auto_accessor_info_(info) {
DCHECK_NOT_NULL(info);
}
bool ObjectLiteral::Property::IsCompileTimeValue() const {
return kind_ == CONSTANT ||
(kind_ == MATERIALIZED_LITERAL && value_->IsCompileTimeValue());

200
deps/v8/src/ast/ast.h vendored
View file

@ -57,22 +57,24 @@ namespace internal {
V(Block) \
V(SwitchStatement)
#define STATEMENT_NODE_LIST(V) \
ITERATION_NODE_LIST(V) \
BREAKABLE_NODE_LIST(V) \
V(ExpressionStatement) \
V(EmptyStatement) \
V(SloppyBlockFunctionStatement) \
V(IfStatement) \
V(ContinueStatement) \
V(BreakStatement) \
V(ReturnStatement) \
V(WithStatement) \
V(TryCatchStatement) \
V(TryFinallyStatement) \
V(DebuggerStatement) \
V(InitializeClassMembersStatement) \
V(InitializeClassStaticElementsStatement)
#define STATEMENT_NODE_LIST(V) \
ITERATION_NODE_LIST(V) \
BREAKABLE_NODE_LIST(V) \
V(ExpressionStatement) \
V(EmptyStatement) \
V(SloppyBlockFunctionStatement) \
V(IfStatement) \
V(ContinueStatement) \
V(BreakStatement) \
V(ReturnStatement) \
V(WithStatement) \
V(TryCatchStatement) \
V(TryFinallyStatement) \
V(DebuggerStatement) \
V(InitializeClassMembersStatement) \
V(InitializeClassStaticElementsStatement) \
V(AutoAccessorGetterBody) \
V(AutoAccessorSetterBody)
#define LITERAL_NODE_LIST(V) \
V(RegExpLiteral) \
@ -1731,7 +1733,7 @@ class CallBase : public Expression {
class Call final : public CallBase {
public:
bool is_possibly_eval() const {
return IsPossiblyEvalField::decode(bit_field_);
return EvalScopeInfoIndexField::decode(bit_field_) > 0;
}
bool is_tagged_template() const {
@ -1742,6 +1744,15 @@ class Call final : public CallBase {
return IsOptionalChainLinkField::decode(bit_field_);
}
uint32_t eval_scope_info_index() const {
return EvalScopeInfoIndexField::decode(bit_field_);
}
void adjust_eval_scope_info_index(int delta) {
bit_field_ = EvalScopeInfoIndexField::update(
bit_field_, eval_scope_info_index() + delta);
}
enum CallType {
GLOBAL_CALL,
WITH_CALL,
@ -1757,11 +1768,6 @@ class Call final : public CallBase {
OTHER_CALL,
};
enum PossiblyEval {
IS_POSSIBLY_EVAL,
NOT_EVAL,
};
// Helpers to determine how to handle the call.
CallType GetCallType() const;
@ -1773,26 +1779,26 @@ class Call final : public CallBase {
Call(Zone* zone, Expression* expression,
const ScopedPtrList<Expression>& arguments, int pos, bool has_spread,
PossiblyEval possibly_eval, bool optional_chain)
int eval_scope_info_index, bool optional_chain)
: CallBase(zone, kCall, expression, arguments, pos, has_spread) {
bit_field_ |=
IsPossiblyEvalField::encode(possibly_eval == IS_POSSIBLY_EVAL) |
IsTaggedTemplateField::encode(false) |
IsOptionalChainLinkField::encode(optional_chain);
bit_field_ |= IsTaggedTemplateField::encode(false) |
IsOptionalChainLinkField::encode(optional_chain) |
EvalScopeInfoIndexField::encode(eval_scope_info_index);
DCHECK_EQ(eval_scope_info_index > 0, is_possibly_eval());
}
Call(Zone* zone, Expression* expression,
const ScopedPtrList<Expression>& arguments, int pos,
TaggedTemplateTag tag)
: CallBase(zone, kCall, expression, arguments, pos, false) {
bit_field_ |= IsPossiblyEvalField::encode(false) |
IsTaggedTemplateField::encode(true) |
IsOptionalChainLinkField::encode(false);
bit_field_ |= IsTaggedTemplateField::encode(true) |
IsOptionalChainLinkField::encode(false) |
EvalScopeInfoIndexField::encode(0);
}
using IsPossiblyEvalField = CallBase::NextBitField<bool, 1>;
using IsTaggedTemplateField = IsPossiblyEvalField::Next<bool, 1>;
using IsTaggedTemplateField = CallBase::NextBitField<bool, 1>;
using IsOptionalChainLinkField = IsTaggedTemplateField::Next<bool, 1>;
using EvalScopeInfoIndexField = IsOptionalChainLinkField::Next<uint32_t, 20>;
};
class CallNew final : public CallBase {
@ -2455,11 +2461,53 @@ class FunctionLiteral final : public Expression {
ProducedPreparseData* produced_preparse_data_;
};
class AutoAccessorInfo final : public ZoneObject {
public:
FunctionLiteral* generated_getter() const { return generated_getter_; }
FunctionLiteral* generated_setter() const { return generated_setter_; }
VariableProxy* accessor_storage_name_proxy() const {
DCHECK_NOT_NULL(accessor_storage_name_proxy_);
return accessor_storage_name_proxy_;
}
VariableProxy* property_private_name_proxy() const {
DCHECK_NOT_NULL(property_private_name_proxy_);
return property_private_name_proxy_;
}
void set_property_private_name_proxy(
VariableProxy* property_private_name_proxy) {
DCHECK_NULL(property_private_name_proxy_);
DCHECK_NOT_NULL(property_private_name_proxy);
property_private_name_proxy_ = property_private_name_proxy;
}
private:
friend class AstNodeFactory;
friend Zone;
AutoAccessorInfo(FunctionLiteral* generated_getter,
FunctionLiteral* generated_setter,
VariableProxy* accessor_storage_name_proxy)
: generated_getter_(generated_getter),
generated_setter_(generated_setter),
accessor_storage_name_proxy_(accessor_storage_name_proxy),
property_private_name_proxy_(nullptr) {}
FunctionLiteral* generated_getter_;
FunctionLiteral* generated_setter_;
// `accessor_storage_name_proxy_` is used to store the internal name of the
// backing storage property associated with the generated getter/setters.
VariableProxy* accessor_storage_name_proxy_;
// `property_private_name_proxy_` only has a value if the accessor keyword
// was applied to a private field.
VariableProxy* property_private_name_proxy_;
};
// Property is used for passing information
// about a class literal's properties from the parser to the code generator.
class ClassLiteralProperty final : public LiteralProperty {
public:
enum Kind : uint8_t { METHOD, GETTER, SETTER, FIELD };
enum Kind : uint8_t { METHOD, GETTER, SETTER, FIELD, AUTO_ACCESSOR };
Kind kind() const { return kind_; }
@ -2467,6 +2515,8 @@ class ClassLiteralProperty final : public LiteralProperty {
bool is_private() const { return is_private_; }
bool is_auto_accessor() const { return kind() == AUTO_ACCESSOR; }
void set_computed_name_proxy(VariableProxy* proxy) {
DCHECK_EQ(FIELD, kind());
DCHECK(!is_private());
@ -2479,26 +2529,43 @@ class ClassLiteralProperty final : public LiteralProperty {
return private_or_computed_name_proxy_->var();
}
void set_private_name_proxy(VariableProxy* proxy) {
void SetPrivateNameProxy(VariableProxy* proxy) {
DCHECK(is_private());
if (is_auto_accessor()) {
auto_accessor_info()->set_property_private_name_proxy(proxy);
return;
}
private_or_computed_name_proxy_ = proxy;
}
Variable* private_name_var() const {
DCHECK(is_private());
DCHECK(!is_auto_accessor());
return private_or_computed_name_proxy_->var();
}
AutoAccessorInfo* auto_accessor_info() {
DCHECK(is_auto_accessor());
DCHECK_NOT_NULL(auto_accessor_info_);
return auto_accessor_info_;
}
private:
friend class AstNodeFactory;
friend Zone;
ClassLiteralProperty(Expression* key, Expression* value, Kind kind,
bool is_static, bool is_computed_name, bool is_private);
ClassLiteralProperty(Expression* key, Expression* value,
AutoAccessorInfo* auto_accessor_info, bool is_static,
bool is_computed_name, bool is_private);
Kind kind_;
bool is_static_;
bool is_private_;
VariableProxy* private_or_computed_name_proxy_;
union {
VariableProxy* private_or_computed_name_proxy_;
AutoAccessorInfo* auto_accessor_info_;
};
};
class ClassLiteralStaticElement final : public ZoneObject {
@ -2569,6 +2636,32 @@ class InitializeClassStaticElementsStatement final : public Statement {
ZonePtrList<StaticElement>* elements_;
};
class AutoAccessorGetterBody final : public Statement {
public:
VariableProxy* name_proxy() const { return name_proxy_; }
private:
friend class AstNodeFactory;
friend Zone;
AutoAccessorGetterBody(VariableProxy* name_proxy, int pos)
: Statement(pos, kAutoAccessorGetterBody), name_proxy_(name_proxy) {}
VariableProxy* name_proxy_;
};
class AutoAccessorSetterBody final : public Statement {
public:
VariableProxy* name_proxy() const { return name_proxy_; }
private:
friend class AstNodeFactory;
friend Zone;
AutoAccessorSetterBody(VariableProxy* name_proxy, int pos)
: Statement(pos, kAutoAccessorSetterBody), name_proxy_(name_proxy) {}
VariableProxy* name_proxy_;
};
class ClassLiteral final : public Expression {
public:
using Property = ClassLiteralProperty;
@ -2645,7 +2738,6 @@ class ClassLiteral final : public Expression {
Variable* static_home_object_;
};
class NativeFunctionLiteral final : public Expression {
public:
Handle<String> name() const { return name_->string(); }
@ -2984,8 +3076,9 @@ class AstNodeFactory final {
pos, end_position);
}
ReturnStatement* NewAsyncReturnStatement(Expression* expression, int pos,
int end_position) {
ReturnStatement* NewAsyncReturnStatement(
Expression* expression, int pos,
int end_position = ReturnStatement::kFunctionLiteralReturnPosition) {
return zone_->New<ReturnStatement>(
expression, ReturnStatement::kAsyncReturn, pos, end_position);
}
@ -3184,12 +3277,11 @@ class AstNodeFactory final {
Call* NewCall(Expression* expression,
const ScopedPtrList<Expression>& arguments, int pos,
bool has_spread,
Call::PossiblyEval possibly_eval = Call::NOT_EVAL,
bool has_spread, int eval_scope_info_index = 0,
bool optional_chain = false) {
DCHECK_IMPLIES(possibly_eval == Call::IS_POSSIBLY_EVAL, !optional_chain);
DCHECK_IMPLIES(eval_scope_info_index > 0, !optional_chain);
return zone_->New<Call>(zone_, expression, arguments, pos, has_spread,
possibly_eval, optional_chain);
eval_scope_info_index, optional_chain);
}
SuperCallForwardArgs* NewSuperCallForwardArgs(SuperCallReference* expression,
@ -3344,12 +3436,26 @@ class AstNodeFactory final {
kFunctionLiteralIdTopLevel);
}
AutoAccessorInfo* NewAutoAccessorInfo(
FunctionLiteral* generated_getter, FunctionLiteral* generated_setter,
VariableProxy* accessor_storage_name_proxy) {
return zone_->New<AutoAccessorInfo>(generated_getter, generated_setter,
accessor_storage_name_proxy);
}
ClassLiteral::Property* NewClassLiteralProperty(
Expression* key, Expression* value, ClassLiteralProperty::Kind kind,
bool is_static, bool is_computed_name, bool is_private) {
return zone_->New<ClassLiteral::Property>(key, value, kind, is_static,
is_computed_name, is_private);
}
ClassLiteral::Property* NewClassLiteralProperty(
Expression* key, Expression* value, AutoAccessorInfo* auto_accessor_info,
bool is_static, bool is_computed_name, bool is_private) {
return zone_->New<ClassLiteral::Property>(key, value, auto_accessor_info,
is_static, is_computed_name,
is_private);
}
ClassLiteral::StaticElement* NewClassLiteralStaticElement(
ClassLiteral::Property* property) {
@ -3435,6 +3541,16 @@ class AstNodeFactory final {
return zone_->New<InitializeClassStaticElementsStatement>(args, pos);
}
AutoAccessorGetterBody* NewAutoAccessorGetterBody(VariableProxy* name_proxy,
int pos) {
return zone_->New<AutoAccessorGetterBody>(name_proxy, pos);
}
AutoAccessorSetterBody* NewAutoAccessorSetterBody(VariableProxy* name_proxy,
int pos) {
return zone_->New<AutoAccessorSetterBody>(name_proxy, pos);
}
Zone* zone() const { return zone_; }
private:

View file

@ -254,6 +254,10 @@ void CallPrinter::VisitInitializeClassStaticElementsStatement(
}
}
void CallPrinter::VisitAutoAccessorGetterBody(AutoAccessorGetterBody* node) {}
void CallPrinter::VisitAutoAccessorSetterBody(AutoAccessorSetterBody* node) {}
void CallPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) {}
void CallPrinter::VisitConditionalChain(ConditionalChain* node) {
@ -1136,6 +1140,16 @@ void AstPrinter::VisitInitializeClassStaticElementsStatement(
PrintClassStaticElements(node->elements());
}
void AstPrinter::VisitAutoAccessorGetterBody(AutoAccessorGetterBody* node) {
IndentedScope indent(this, "AUTO ACCESSOR GETTER BODY", node->position());
PrintIndentedVisit("AUTO ACCESSOR STORAGE PRIVATE NAME", node->name_proxy());
}
void AstPrinter::VisitAutoAccessorSetterBody(AutoAccessorSetterBody* node) {
IndentedScope indent(this, "AUTO ACCESSOR SETTER BODY", node->position());
PrintIndentedVisit("AUTO ACCESSOR STORAGE PRIVATE NAME", node->name_proxy());
}
void AstPrinter::PrintClassProperty(ClassLiteral::Property* property) {
const char* prop_kind = nullptr;
switch (property->kind()) {
@ -1151,6 +1165,9 @@ void AstPrinter::PrintClassProperty(ClassLiteral::Property* property) {
case ClassLiteral::Property::FIELD:
prop_kind = "FIELD";
break;
case ClassLiteral::Property::AUTO_ACCESSOR:
prop_kind = "AUTO ACCESSOR";
break;
}
base::EmbeddedVector<char, 128> buf;
SNPrintF(buf, "PROPERTY%s%s - %s", property->is_static() ? " - STATIC" : "",

View file

@ -4,11 +4,11 @@
#include "src/ast/scopes.h"
#include <optional>
#include <set>
#include "src/ast/ast.h"
#include "src/base/logging.h"
#include "src/base/optional.h"
#include "src/builtins/accessors.h"
#include "src/common/message-template.h"
#include "src/heap/local-factory-inl.h"
@ -374,6 +374,8 @@ void Scope::SetDefaults() {
has_using_declaration_ = false;
has_await_using_declaration_ = false;
is_wrapped_function_ = false;
num_stack_slots_ = 0;
num_heap_slots_ = ContextHeaderLength();
@ -417,7 +419,8 @@ Scope* Scope::DeserializeScopeChain(IsolateT* isolate, Zone* zone,
Tagged<ScopeInfo> scope_info,
DeclarationScope* script_scope,
AstValueFactory* ast_value_factory,
DeserializationMode deserialization_mode) {
DeserializationMode deserialization_mode,
ParseInfo* parse_info) {
// Reconstruct the outer scope chain from a closure's context chain.
Scope* current_scope = nullptr;
Scope* innermost_scope = nullptr;
@ -470,6 +473,9 @@ Scope* Scope::DeserializeScopeChain(IsolateT* isolate, Zone* zone,
} else if (scope_info->scope_type() == MODULE_SCOPE) {
outer_scope = zone->New<ModuleScope>(handle(scope_info, isolate),
ast_value_factory);
if (parse_info) {
parse_info->set_has_module_in_scope_chain();
}
} else {
DCHECK_EQ(scope_info->scope_type(), CATCH_SCOPE);
DCHECK_EQ(scope_info->ContextLocalCount(), 1);
@ -536,12 +542,12 @@ template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE)
Scope* Scope::DeserializeScopeChain(
Isolate* isolate, Zone* zone, Tagged<ScopeInfo> scope_info,
DeclarationScope* script_scope, AstValueFactory* ast_value_factory,
DeserializationMode deserialization_mode);
DeserializationMode deserialization_mode, ParseInfo* parse_info);
template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE)
Scope* Scope::DeserializeScopeChain(
LocalIsolate* isolate, Zone* zone, Tagged<ScopeInfo> scope_info,
DeclarationScope* script_scope, AstValueFactory* ast_value_factory,
DeserializationMode deserialization_mode);
DeserializationMode deserialization_mode, ParseInfo* parse_info);
DeclarationScope* Scope::AsDeclarationScope() {
// Here and below: if an attacker corrupts the in-sandox SFI::unique_id or
@ -694,7 +700,7 @@ bool DeclarationScope::Analyze(ParseInfo* info) {
DCHECK_NOT_NULL(info->literal());
DeclarationScope* scope = info->literal()->scope();
base::Optional<AllowHandleDereference> allow_deref;
std::optional<AllowHandleDereference> allow_deref;
#ifdef DEBUG
if (scope->outer_scope() && !scope->outer_scope()->scope_info_.is_null()) {
allow_deref.emplace();
@ -2589,8 +2595,9 @@ void DeclarationScope::AllocateLocals() {
new_target_ = nullptr;
}
NullifyRareVariableIf(RareVariable::kThisFunction,
[=](Variable* var) { return !MustAllocate(var); });
NullifyRareVariableIf(RareVariable::kThisFunction, [=, this](Variable* var) {
return !MustAllocate(var);
});
}
void ModuleScope::AllocateModuleVariables() {
@ -2607,6 +2614,30 @@ void ModuleScope::AllocateModuleVariables() {
}
}
// Needs to be kept in sync with ScopeInfo::UniqueIdInScript and
// SharedFunctionInfo::UniqueIdInScript.
int Scope::UniqueIdInScript() const {
DCHECK(!is_hidden_catch_scope());
// Script scopes start "before" the script to avoid clashing with a scope that
// starts on character 0.
if (is_script_scope() || scope_type() == EVAL_SCOPE ||
scope_type() == MODULE_SCOPE) {
return -2;
}
// Wrapped functions start before the function body, but after the script
// start, to avoid clashing with a scope starting on character 0.
if (is_wrapped_function()) {
return -1;
}
if (is_declaration_scope()) {
// Default constructors have the same start position as their parent class
// scope. Use the next char position to distinguish this scope.
return start_position() +
IsDefaultConstructor(AsDeclarationScope()->function_kind());
}
return start_position();
}
void Scope::AllocateVariablesRecursively() {
this->ForEach([](Scope* scope) -> Iteration {
DCHECK(!scope->already_resolved_);
@ -2658,33 +2689,70 @@ void Scope::AllocateVariablesRecursively() {
}
template <typename IsolateT>
void Scope::AllocateScopeInfosRecursively(IsolateT* isolate,
MaybeHandle<ScopeInfo> outer_scope) {
void Scope::AllocateScopeInfosRecursively(
IsolateT* isolate, MaybeHandle<ScopeInfo> outer_scope,
std::unordered_map<int, Handle<ScopeInfo>>& scope_infos_to_reuse) {
DCHECK(scope_info_.is_null());
MaybeHandle<ScopeInfo> next_outer_scope = outer_scope;
if (NeedsScopeInfo()) {
auto it = is_hidden_catch_scope()
? scope_infos_to_reuse.end()
: scope_infos_to_reuse.find(UniqueIdInScript());
if (it != scope_infos_to_reuse.end()) {
scope_info_ = it->second;
CHECK(NeedsContext());
// The ScopeInfo chain mirrors the context chain, so we only link to the
// next outer scope that needs a context.
next_outer_scope = scope_info_;
DCHECK(!scope_info_.is_null());
DCHECK(!is_hidden_catch_scope());
CHECK_EQ(scope_info_->scope_type(), scope_type_);
CHECK_EQ(scope_info_->ContextLength(), num_heap_slots_);
#ifdef DEBUG
// Consume the scope info.
it->second = {};
#endif
} else if (NeedsScopeInfo()) {
scope_info_ = ScopeInfo::Create(isolate, zone(), this, outer_scope);
// The ScopeInfo chain should mirror the context chain, so we only link to
// the next outer scope that needs a context.
#ifdef DEBUG
// Mark this ID as being used. Skip hidden scopes because they are
// synthetic, unreusable, but hard to make unique.
if (v8_flags.reuse_scope_infos && !is_hidden_catch_scope()) {
scope_infos_to_reuse[UniqueIdInScript()] = {};
DCHECK_EQ(UniqueIdInScript(), scope_info_->UniqueIdInScript());
}
#endif
// The ScopeInfo chain mirrors the context chain, so we only link to the
// next outer scope that needs a context.
if (NeedsContext()) next_outer_scope = scope_info_;
}
// Allocate ScopeInfos for inner scopes.
for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) {
#ifdef DEBUG
if (!scope->is_hidden_catch_scope()) {
DCHECK_GT(scope->UniqueIdInScript(), UniqueIdInScript());
DCHECK_IMPLIES(
scope->sibling_ && !scope->sibling_->is_hidden_catch_scope(),
scope->sibling_->UniqueIdInScript() != scope->UniqueIdInScript());
}
#endif
if (!scope->is_function_scope() ||
scope->AsDeclarationScope()->ShouldEagerCompile()) {
scope->AllocateScopeInfosRecursively(isolate, next_outer_scope);
scope->AllocateScopeInfosRecursively(isolate, next_outer_scope,
scope_infos_to_reuse);
}
}
}
template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) void Scope::
AllocateScopeInfosRecursively<Isolate>(Isolate* isolate,
MaybeHandle<ScopeInfo> outer_scope);
AllocateScopeInfosRecursively<Isolate>(
Isolate* isolate, MaybeHandle<ScopeInfo> outer_scope,
std::unordered_map<int, Handle<ScopeInfo>>& scope_infos_to_reuse);
template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) void Scope::
AllocateScopeInfosRecursively<LocalIsolate>(
LocalIsolate* isolate, MaybeHandle<ScopeInfo> outer_scope);
LocalIsolate* isolate, MaybeHandle<ScopeInfo> outer_scope,
std::unordered_map<int, Handle<ScopeInfo>>& scope_infos_to_reuse);
void DeclarationScope::RecalcPrivateNameContextChain() {
// The outermost scope in a class heritage expression is marked to skip the
@ -2729,7 +2797,9 @@ void DeclarationScope::RecordNeedsPrivateNameContextChainRecalc() {
// static
template <typename IsolateT>
void DeclarationScope::AllocateScopeInfos(ParseInfo* info, IsolateT* isolate) {
void DeclarationScope::AllocateScopeInfos(ParseInfo* info,
DirectHandle<Script> script,
IsolateT* isolate) {
DeclarationScope* scope = info->literal()->scope();
// No one else should have allocated a scope info for this scope yet.
@ -2744,7 +2814,54 @@ void DeclarationScope::AllocateScopeInfos(ParseInfo* info, IsolateT* isolate) {
if (scope->needs_private_name_context_chain_recalc()) {
scope->RecalcPrivateNameContextChain();
}
scope->AllocateScopeInfosRecursively(isolate, outer_scope);
Tagged<WeakFixedArray> infos = script->infos();
std::unordered_map<int, Handle<ScopeInfo>> scope_infos_to_reuse;
if (v8_flags.reuse_scope_infos && infos->length() != 0) {
Tagged<SharedFunctionInfo> sfi = *info->literal()->shared_function_info();
Tagged<ScopeInfo> outer = sfi->HasOuterScopeInfo()
? sfi->GetOuterScopeInfo()
: Tagged<ScopeInfo>();
// Look at all inner functions whether they have scope infos that we should
// reuse. Also look at the compiled function itself, and reuse its function
// scope info if it exists.
for (int i = info->literal()->function_literal_id();
i < info->max_info_id() + 1; ++i) {
Tagged<MaybeObject> maybe_info = infos->get(i);
if (maybe_info.IsWeak()) {
Tagged<Object> info = maybe_info.GetHeapObjectAssumeWeak();
Tagged<ScopeInfo> scope_info;
if (Is<SharedFunctionInfo>(info)) {
Tagged<SharedFunctionInfo> sfi = Cast<SharedFunctionInfo>(info);
if (!sfi->scope_info()->IsEmpty() &&
sfi->scope_info()->HasContext()) {
scope_info = sfi->scope_info();
} else if (sfi->HasOuterScopeInfo()) {
scope_info = sfi->GetOuterScopeInfo();
} else {
continue;
}
} else {
scope_info = Cast<ScopeInfo>(info);
}
while (true) {
if (scope_info == outer) break;
int id = scope_info->UniqueIdInScript();
auto it = scope_infos_to_reuse.find(id);
if (it != scope_infos_to_reuse.end()) {
CHECK_EQ(*it->second, scope_info);
break;
}
scope_infos_to_reuse[id] = handle(scope_info, isolate);
if (!scope_info->HasOuterScopeInfo()) break;
scope_info = scope_info->OuterScopeInfo();
}
}
}
}
scope->AllocateScopeInfosRecursively(isolate, outer_scope,
scope_infos_to_reuse);
// The debugger expects all shared function infos to contain a scope info.
// Since the top-most scope will end up in a shared function info, make sure
@ -2763,9 +2880,9 @@ void DeclarationScope::AllocateScopeInfos(ParseInfo* info, IsolateT* isolate) {
}
template V8_EXPORT_PRIVATE void DeclarationScope::AllocateScopeInfos(
ParseInfo* info, Isolate* isolate);
ParseInfo* info, DirectHandle<Script> script, Isolate* isolate);
template V8_EXPORT_PRIVATE void DeclarationScope::AllocateScopeInfos(
ParseInfo* info, LocalIsolate* isolate);
ParseInfo* info, DirectHandle<Script> script, LocalIsolate* isolate);
int Scope::ContextLocalCount() const {
if (num_heap_slots() == 0) return 0;

View file

@ -101,6 +101,11 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
}
#endif
// An ID that uniquely identifies this scope within the script. Inner scopes
// have a higher ID than their outer scopes. ScopeInfo created from a scope
// has the same ID as the scope.
int UniqueIdInScript() const;
DeclarationScope* AsDeclarationScope();
const DeclarationScope* AsDeclarationScope() const;
ModuleScope* AsModuleScope();
@ -152,7 +157,8 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
Tagged<ScopeInfo> scope_info,
DeclarationScope* script_scope,
AstValueFactory* ast_value_factory,
DeserializationMode deserialization_mode);
DeserializationMode deserialization_mode,
ParseInfo* info = nullptr);
template <typename IsolateT>
EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE)
@ -334,6 +340,10 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
bool is_hidden() const { return is_hidden_; }
void set_is_hidden() { is_hidden_ = true; }
bool is_hidden_catch_scope() const {
return is_hidden() && scope_type() == CATCH_SCOPE;
}
void ForceContextAllocationForParameters() {
DCHECK(!already_resolved_);
force_context_allocation_for_parameters_ = true;
@ -382,6 +392,15 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
return has_await_using_declaration_;
}
bool is_wrapped_function() const {
DCHECK_IMPLIES(is_wrapped_function_, is_function_scope());
return is_wrapped_function_;
}
void set_is_wrapped_function() {
DCHECK(is_function_scope());
is_wrapped_function_ = true;
}
#if V8_ENABLE_WEBASSEMBLY
bool IsAsmModule() const;
// Returns true if this scope or any inner scopes that might be eagerly
@ -719,11 +738,9 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
void AllocateVariablesRecursively();
template <typename IsolateT>
void AllocateScopeInfosRecursively(IsolateT* isolate,
MaybeHandle<ScopeInfo> outer_scope);
void AllocateDebuggerScopeInfos(Isolate* isolate,
MaybeHandle<ScopeInfo> outer_scope);
void AllocateScopeInfosRecursively(
IsolateT* isolate, MaybeHandle<ScopeInfo> outer_scope,
std::unordered_map<int, Handle<ScopeInfo>>& scope_infos_to_reuse);
// Construct a scope based on the scope info.
Scope(Zone* zone, ScopeType type, AstValueFactory* ast_value_factory,
@ -823,10 +840,6 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
bool must_use_preparsed_scope_data_ : 1;
// True if this is a script scope that originated from
// DebugEvaluate::GlobalREPL().
bool is_repl_mode_scope_ : 1;
// True if this is a deserialized scope which caches its lookups on another
// Scope's variable map. This will be true for every scope above the first
// non-eval declaration scope above the compilation entry point, e.g. for
@ -852,6 +865,10 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
// If declarations include any `using` or `await using` declarations.
bool has_using_declaration_ : 1;
bool has_await_using_declaration_ : 1;
// If the scope was generated for wrapped function syntax, which will affect
// its UniqueIdInScript.
bool is_wrapped_function_ : 1;
};
class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
@ -1161,6 +1178,7 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
// Does nothing if ScopeInfo is already allocated.
template <typename IsolateT>
V8_EXPORT_PRIVATE static void AllocateScopeInfos(ParseInfo* info,
DirectHandle<Script> script,
IsolateT* isolate);
// Determine if we can use lazy compilation for this scope.

View file

@ -10,7 +10,6 @@
#include <type_traits>
#include "src/base/logging.h"
#include "src/base/optional.h"
namespace v8::base {

View file

@ -23,6 +23,23 @@
// Creates an unique identifier. Useful for scopes to avoid shadowing names.
#define UNIQUE_IDENTIFIER(base) CONCAT(base, __COUNTER__)
// COUNT_MACRO_ARGS(...) returns the number of arguments passed. Currently, up
// to 8 arguments are supported.
#define COUNT_MACRO_ARGS(...) \
EXPAND(COUNT_MACRO_ARGS_IMPL(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0))
#define COUNT_MACRO_ARGS_IMPL(_8, _7, _6, _5, _4, _3, _2, _1, N, ...) N
// GET_NTH_ARG(N, ...) returns the Nth argument in the list of arguments
// following. Currently, up to N=8 is supported.
#define GET_NTH_ARG(N, ...) CONCAT(GET_NTH_ARG_IMPL_, N)(__VA_ARGS__)
#define GET_NTH_ARG_IMPL_0(_0, ...) _0
#define GET_NTH_ARG_IMPL_1(_0, _1, ...) _1
#define GET_NTH_ARG_IMPL_2(_0, _1, _2, ...) _2
#define GET_NTH_ARG_IMPL_3(_0, _1, _2, _3, ...) _3
#define GET_NTH_ARG_IMPL_4(_0, _1, _2, _3, _4, ...) _4
#define GET_NTH_ARG_IMPL_5(_0, _1, _2, _3, _4, _5, ...) _5
#define GET_NTH_ARG_IMPL_6(_0, _1, _2, _3, _4, _5, _6, ...) _6
#define GET_NTH_ARG_IMPL_7(_0, _1, _2, _3, _4, _5, _6, _7, ...) _7
// UNPAREN(x) removes a layer of nested parentheses on x, if any. This means
// that both UNPAREN(x) and UNPAREN((x)) expand to x. This is helpful for macros
// that want to support multi argument templates with commas, e.g.
@ -406,9 +423,9 @@ bool is_inbounds(float_t v) {
// Setup for Windows shared library export.
#define V8_EXPORT_ENUM
#ifdef BUILDING_V8_SHARED_PRIVATE
#define V8_EXPORT_PRIVATE
#define V8_EXPORT_PRIVATE __declspec(dllexport)
#elif USING_V8_SHARED_PRIVATE
#define V8_EXPORT_PRIVATE
#define V8_EXPORT_PRIVATE __declspec(dllimport)
#else
#define V8_EXPORT_PRIVATE
#endif // BUILDING_V8_SHARED
@ -418,8 +435,8 @@ bool is_inbounds(float_t v) {
// Setup for Linux shared library export.
#if V8_HAS_ATTRIBUTE_VISIBILITY
#ifdef BUILDING_V8_SHARED_PRIVATE
#define V8_EXPORT_PRIVATE
#define V8_EXPORT_ENUM
#define V8_EXPORT_PRIVATE __attribute__((visibility("default")))
#define V8_EXPORT_ENUM V8_EXPORT_PRIVATE
#else
#define V8_EXPORT_PRIVATE
#define V8_EXPORT_ENUM
@ -440,6 +457,18 @@ bool is_inbounds(float_t v) {
#define IF_WASM(V, ...)
#endif // V8_ENABLE_WEBASSEMBLY
#ifdef V8_ENABLE_DRUMBRAKE
#define IF_WASM_DRUMBRAKE(V, ...) EXPAND(V(__VA_ARGS__))
#else
#define IF_WASM_DRUMBRAKE(V, ...)
#endif // V8_ENABLE_DRUMBRAKE
#if defined(V8_ENABLE_DRUMBRAKE) && !defined(V8_DRUMBRAKE_BOUNDS_CHECKS)
#define IF_WASM_DRUMBRAKE_INSTR_HANDLER(V, ...) EXPAND(V(__VA_ARGS__))
#else
#define IF_WASM_DRUMBRAKE_INSTR_HANDLER(V, ...)
#endif // V8_ENABLE_DRUMBRAKE && !V8_DRUMBRAKE_BOUNDS_CHECKS
// Defines IF_TSAN, to be used in macro lists for elements that should only be
// there if TSAN is enabled.
#ifdef V8_IS_TSAN

View file

@ -1,29 +0,0 @@
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is a clone of "base/optional.h" in chromium.
// Keep in sync, especially when fixing bugs.
// Copyright 2017 the V8 project authors. All rights reserved.
#ifndef V8_BASE_OPTIONAL_H_
#define V8_BASE_OPTIONAL_H_
#include <optional>
namespace v8 {
namespace base {
// These aliases are deprecated, use std::optional directly.
template <typename T>
using Optional = std::optional<T>;
using std::in_place;
using std::make_optional;
using std::nullopt;
using std::nullopt_t;
} // namespace base
} // namespace v8
#endif // V8_BASE_OPTIONAL_H_

View file

@ -5,6 +5,8 @@
#ifndef V8_BASE_PLATFORM_MUTEX_H_
#define V8_BASE_PLATFORM_MUTEX_H_
#include <optional>
#include "include/v8config.h"
#if V8_OS_DARWIN
@ -18,7 +20,6 @@
#include "src/base/base-export.h"
#include "src/base/lazy-instance.h"
#include "src/base/logging.h"
#include "src/base/optional.h"
#if V8_OS_WIN
#include "src/base/win32-headers.h"
@ -378,7 +379,7 @@ class V8_NODISCARD SharedMutexGuardIf final {
SharedMutexGuardIf& operator=(const SharedMutexGuardIf&) = delete;
private:
base::Optional<SharedMutexGuard<kIsShared, Behavior>> mutex_;
std::optional<SharedMutexGuard<kIsShared, Behavior>> mutex_;
};
} // namespace base

View file

@ -9,6 +9,8 @@
#include <lib/zx/vmar.h>
#include <lib/zx/vmo.h>
#include <optional>
#include "src/base/bits.h"
#include "src/base/macros.h"
#include "src/base/platform/platform-posix-time.h"
@ -322,7 +324,7 @@ bool OS::DecommitPages(void* address, size_t size) {
bool OS::CanReserveAddressSpace() { return true; }
// static
Optional<AddressSpaceReservation> OS::CreateAddressSpaceReservation(
std::optional<AddressSpaceReservation> OS::CreateAddressSpaceReservation(
void* hint, size_t size, size_t alignment,
MemoryPermission max_permission) {
DCHECK_EQ(0, reinterpret_cast<Address>(hint) % alignment);
@ -400,7 +402,8 @@ std::optional<OS::MemoryRange> OS::GetFirstFreeMemoryRangeWithin(
return std::nullopt;
}
Optional<AddressSpaceReservation> AddressSpaceReservation::CreateSubReservation(
std::optional<AddressSpaceReservation>
AddressSpaceReservation::CreateSubReservation(
void* address, size_t size, OS::MemoryPermission max_permission) {
DCHECK(Contains(address, size));

View file

@ -33,6 +33,7 @@
#include <cmath>
#include <cstdio>
#include <memory>
#include <optional>
#include "src/base/logging.h"
#include "src/base/memory.h"
@ -139,7 +140,7 @@ std::optional<OS::MemoryRange> OS::GetFirstFreeMemoryRangeWithin(
}
// static
base::Optional<MemoryRegion> MemoryRegion::FromMapsLine(const char* line) {
std::optional<MemoryRegion> MemoryRegion::FromMapsLine(const char* line) {
MemoryRegion region;
unsigned dev_major = 0, dev_minor = 0;
uintptr_t inode = 0;
@ -157,7 +158,7 @@ base::Optional<MemoryRegion> MemoryRegion::FromMapsLine(const char* line) {
" %x:%x %" V8PRIdPTR " %n",
&region.start, &region.end, region.permissions, &offset,
&dev_major, &dev_minor, &inode, &path_index) < 7) {
return base::nullopt;
return std::nullopt;
}
region.permissions[4] = '\0';
region.inode = inode;
@ -204,8 +205,7 @@ std::unique_ptr<std::vector<MemoryRegion>> ParseProcSelfMaps(
if (line.get()[line_length - 1] != '\n') break;
line.get()[line_length - 1] = '\0';
base::Optional<MemoryRegion> region =
MemoryRegion::FromMapsLine(line.get());
std::optional<MemoryRegion> region = MemoryRegion::FromMapsLine(line.get());
if (!region) {
break;
}

View file

@ -8,10 +8,10 @@
#include <sys/types.h>
#include <cstdint>
#include <optional>
#include <string>
#include "src/base/base-export.h"
#include "src/base/optional.h"
#include "src/base/platform/platform.h"
namespace v8 {
@ -29,7 +29,7 @@ struct V8_BASE_EXPORT MemoryRegion {
std::string pathname;
// |line| must not contains the tail '\n'.
static base::Optional<MemoryRegion> FromMapsLine(const char* line);
static std::optional<MemoryRegion> FromMapsLine(const char* line);
};
// The |fp| parameter is for testing, to pass a fake /proc/self/maps file.

View file

@ -35,6 +35,7 @@
#include <cmath>
#include <cstdlib>
#include <optional>
#include "src/base/lazy-instance.h"
#include "src/base/macros.h"
@ -616,7 +617,7 @@ bool OS::DecommitPages(void* address, size_t size) {
bool OS::CanReserveAddressSpace() { return true; }
// static
Optional<AddressSpaceReservation> OS::CreateAddressSpaceReservation(
std::optional<AddressSpaceReservation> OS::CreateAddressSpaceReservation(
void* hint, size_t size, size_t alignment,
MemoryPermission max_permission) {
// On POSIX, address space reservations are backed by private memory mappings.
@ -1038,7 +1039,8 @@ void OS::StrNCpy(char* dest, int length, const char* src, size_t n) {
#if !V8_OS_CYGWIN && !V8_OS_FUCHSIA
Optional<AddressSpaceReservation> AddressSpaceReservation::CreateSubReservation(
std::optional<AddressSpaceReservation>
AddressSpaceReservation::CreateSubReservation(
void* address, size_t size, OS::MemoryPermission max_permission) {
DCHECK(Contains(address, size));
DCHECK_EQ(0, size % OS::AllocatePageSize());

View file

@ -27,6 +27,7 @@
#include <tlhelp32.h> // For Module32First and al.
#include <limits>
#include <optional>
#include "src/base/bits.h"
#include "src/base/lazy-instance.h"
@ -137,15 +138,6 @@ int strncpy_s(char* dest, size_t dest_size, const char* source, size_t count) {
namespace v8 {
namespace base {
namespace {
// g_cet gets set to kEnabled on platform initialization if the Intel CET shadow
// stack is found to be enabled for this process.
enum PlatformCETStatus { kNotSet, kEnabled, kDisabled };
PlatformCETStatus g_cet = kNotSet;
} // namespace
class WindowsTimezoneCache : public TimezoneCache {
public:
WindowsTimezoneCache() : initialized_(false) {}
@ -788,16 +780,10 @@ bool UserShadowStackEnabled() {
return uss_policy.EnableUserShadowStack;
}
void InitializeCETStatus() {
DCHECK_EQ(kNotSet, g_cet);
g_cet = UserShadowStackEnabled() ? kEnabled : kDisabled;
}
} // namespace
void OS::Initialize(AbortMode abort_mode, const char* const gc_fake_mmap) {
g_abort_mode = abort_mode;
InitializeCETStatus();
}
typedef PVOID(__stdcall* VirtualAlloc2_t)(HANDLE, PVOID, SIZE_T, ULONG, ULONG,
@ -830,8 +816,8 @@ void OS::EnsureWin32MemoryAPILoaded() {
// static
bool OS::IsHardwareEnforcedShadowStacksEnabled() {
DCHECK_NE(kNotSet, g_cet);
return g_cet == kEnabled;
static bool cet_enabled = UserShadowStackEnabled();
return cet_enabled;
}
// static
@ -1142,7 +1128,7 @@ bool OS::CanReserveAddressSpace() {
}
// static
Optional<AddressSpaceReservation> OS::CreateAddressSpaceReservation(
std::optional<AddressSpaceReservation> OS::CreateAddressSpaceReservation(
void* hint, size_t size, size_t alignment,
MemoryPermission max_permission) {
CHECK(CanReserveAddressSpace());
@ -1364,7 +1350,8 @@ Win32MemoryMappedFile::~Win32MemoryMappedFile() {
CloseHandle(file_);
}
Optional<AddressSpaceReservation> AddressSpaceReservation::CreateSubReservation(
std::optional<AddressSpaceReservation>
AddressSpaceReservation::CreateSubReservation(
void* address, size_t size, OS::MemoryPermission max_permission) {
// Nothing to do, the sub reservation must already have been split by now.
DCHECK(Contains(address, size));

View file

@ -23,6 +23,7 @@
#include <cstdarg>
#include <cstdint>
#include <optional>
#include <string>
#include <vector>
@ -32,7 +33,6 @@
#include "src/base/build_config.h"
#include "src/base/compiler-specific.h"
#include "src/base/macros.h"
#include "src/base/optional.h"
#include "src/base/platform/mutex.h"
#include "src/base/platform/semaphore.h"
#include "testing/gtest/include/gtest/gtest_prod.h" // nogncheck
@ -404,7 +404,7 @@ class V8_BASE_EXPORT OS {
V8_WARN_UNUSED_RESULT static bool CanReserveAddressSpace();
V8_WARN_UNUSED_RESULT static Optional<AddressSpaceReservation>
V8_WARN_UNUSED_RESULT static std::optional<AddressSpaceReservation>
CreateAddressSpaceReservation(void* hint, size_t size, size_t alignment,
MemoryPermission max_permission);
@ -476,8 +476,9 @@ class V8_BASE_EXPORT AddressSpaceReservation {
V8_WARN_UNUSED_RESULT bool DecommitPages(void* address, size_t size);
V8_WARN_UNUSED_RESULT Optional<AddressSpaceReservation> CreateSubReservation(
void* address, size_t size, OS::MemoryPermission max_permission);
V8_WARN_UNUSED_RESULT std::optional<AddressSpaceReservation>
CreateSubReservation(void* address, size_t size,
OS::MemoryPermission max_permission);
V8_WARN_UNUSED_RESULT static bool FreeSubReservation(
AddressSpaceReservation reservation);

View file

@ -9,6 +9,11 @@
namespace v8::base::tmp {
template <typename T>
struct lazy_false : std::false_type {};
template <typename T>
struct lazy_true : std::true_type {};
// call_parameters returns a list of parameter types of the given (member)
// function pointer.
template <typename>

View file

@ -96,6 +96,32 @@ constexpr auto tuple_for_each_with_index_impl(const Tuple& tpl,
...);
}
template <typename Tuple, typename Function, size_t... Index>
constexpr auto tuple_map_impl(Tuple&& tpl, const Function& function,
std::index_sequence<Index...>) {
return std::make_tuple(
function(std::get<Index>(std::forward<Tuple>(tpl)))...);
}
template <typename TupleV, typename TupleU, typename Function, size_t... Index>
constexpr auto tuple_map2_impl(TupleV&& tplv, TupleU&& tplu,
const Function& function,
std::index_sequence<Index...>) {
return std::make_tuple(
function(std::get<Index>(tplv), std::get<Index>(tplu))...);
}
template <size_t I, typename T, typename Tuple, typename Function>
constexpr auto tuple_fold_impl(T&& initial, Tuple&& tpl, Function&& function) {
if constexpr (I == 0) {
return function(std::forward<T>(initial), std::get<0>(tpl));
} else {
return function(tuple_fold_impl<I - 1>(std::forward<T>(initial),
std::forward<Tuple>(tpl), function),
std::get<I>(tpl));
}
}
} // namespace detail
// Get the first N elements from a tuple.
@ -140,6 +166,34 @@ constexpr void tuple_for_each_with_index(Tuple&& tpl, Function&& function) {
std::make_index_sequence<std::tuple_size_v<std::decay_t<Tuple>>>());
}
// Calls `function(v)` for each `v` in the tuple and returns a new tuple with
// all the results.
template <typename Tuple, typename Function>
constexpr auto tuple_map(Tuple&& tpl, Function&& function) {
return detail::tuple_map_impl(
std::forward<Tuple>(tpl), function,
std::make_index_sequence<std::tuple_size_v<std::decay_t<Tuple>>>());
}
// Calls `function(v, u)` for pairs `v<I>, u<I>` in the
// tuples and returns a new tuple with all the results.
template <typename TupleV, typename TupleU, typename Function>
constexpr auto tuple_map2(TupleV&& tplv, TupleU&& tplu, Function&& function) {
constexpr size_t S = std::tuple_size_v<std::decay_t<TupleV>>;
static_assert(S == std::tuple_size_v<std::decay_t<TupleU>>);
return detail::tuple_map2_impl(std::forward<TupleV>(tplv),
std::forward<TupleU>(tplu), function,
std::make_index_sequence<S>());
}
// Left fold (reduce) the tuple starting with an initial value by applying
// function(...function(initial, tpl<0>)..., tpl<size-1>)
template <typename T, typename Tuple, typename Function>
constexpr auto tuple_fold(T&& initial, Tuple&& tpl, Function&& function) {
return detail::tuple_fold_impl<std::tuple_size_v<std::decay_t<Tuple>> - 1>(
std::forward<T>(initial), std::forward<Tuple>(tpl), function);
}
#ifdef __clang__
template <size_t N, typename... Ts>

View file

@ -4,6 +4,8 @@
#include "src/base/virtual-address-space.h"
#include <optional>
#include "include/v8-platform.h"
#include "src/base/bits.h"
#include "src/base/platform/platform.h"
@ -150,7 +152,7 @@ std::unique_ptr<v8::VirtualAddressSpace> VirtualAddressSpace::AllocateSubspace(
DCHECK(IsAligned(hint, alignment));
DCHECK(IsAligned(size, allocation_granularity()));
base::Optional<AddressSpaceReservation> reservation =
std::optional<AddressSpaceReservation> reservation =
OS::CreateAddressSpaceReservation(
reinterpret_cast<void*>(hint), size, alignment,
static_cast<OS::MemoryPermission>(max_page_permissions));
@ -354,7 +356,7 @@ VirtualAddressSubspace::AllocateSubspace(Address hint, size_t size,
return std::unique_ptr<v8::VirtualAddressSpace>();
}
base::Optional<AddressSpaceReservation> reservation =
std::optional<AddressSpaceReservation> reservation =
reservation_.CreateSubReservation(
reinterpret_cast<void*>(address), size,
static_cast<OS::MemoryPermission>(max_page_permissions));

View file

@ -253,7 +253,7 @@ bool BaselineBatchCompiler::concurrent() const {
!isolate_->EfficiencyModeEnabledForTiering();
}
void BaselineBatchCompiler::EnqueueFunction(Handle<JSFunction> function) {
void BaselineBatchCompiler::EnqueueFunction(DirectHandle<JSFunction> function) {
DirectHandle<SharedFunctionInfo> shared(function->shared(), isolate_);
// Immediately compile the function if batch compilation is disabled.
if (!is_enabled()) {
@ -309,7 +309,7 @@ void BaselineBatchCompiler::EnsureQueueCapacity() {
}
}
void BaselineBatchCompiler::CompileBatch(Handle<JSFunction> function) {
void BaselineBatchCompiler::CompileBatch(DirectHandle<JSFunction> function) {
{
IsCompiledScope is_compiled_scope(
function->shared()->is_compiled_scope(isolate_));

View file

@ -24,7 +24,7 @@ class BaselineBatchCompiler {
explicit BaselineBatchCompiler(Isolate* isolate);
~BaselineBatchCompiler();
// Enqueues SharedFunctionInfo of |function| for compilation.
void EnqueueFunction(Handle<JSFunction> function);
void EnqueueFunction(DirectHandle<JSFunction> function);
void EnqueueSFI(Tagged<SharedFunctionInfo> shared);
void set_enabled(bool enabled) { enabled_ = enabled; }
@ -47,7 +47,7 @@ class BaselineBatchCompiler {
bool ShouldCompileBatch(Tagged<SharedFunctionInfo> shared);
// Compiles the current batch.
void CompileBatch(Handle<JSFunction> function);
void CompileBatch(DirectHandle<JSFunction> function);
// Compiles the current batch concurrently.
void CompileBatchConcurrent(Tagged<SharedFunctionInfo> shared);

View file

@ -5,6 +5,7 @@
#include "src/baseline/baseline-compiler.h"
#include <algorithm>
#include <optional>
#include <type_traits>
#include "src/base/bits.h"
@ -502,7 +503,7 @@ void BaselineCompiler::VisitSingleBytecode() {
interpreter::Bytecode bytecode = iterator().current_bytecode();
#ifdef DEBUG
base::Optional<EnsureAccumulatorPreservedScope> accumulator_preserved_scope;
std::optional<EnsureAccumulatorPreservedScope> accumulator_preserved_scope;
// We should make sure to preserve the accumulator whenever the bytecode
// isn't registered as writing to it. We can't do this for jumps or switches
// though, since the control flow would not match the control flow of this

View file

@ -5,6 +5,8 @@
#ifndef V8_BASELINE_BYTECODE_OFFSET_ITERATOR_H_
#define V8_BASELINE_BYTECODE_OFFSET_ITERATOR_H_
#include <optional>
#include "src/base/vlq.h"
#include "src/common/globals.h"
#include "src/interpreter/bytecode-array-iterator.h"
@ -87,7 +89,7 @@ class V8_EXPORT_PRIVATE BytecodeOffsetIterator {
Tagged<BytecodeArray> bytecode_handle_storage_;
interpreter::BytecodeArrayIterator bytecode_iterator_;
LocalHeap* local_heap_;
base::Optional<DisallowGarbageCollection> no_gc_;
std::optional<DisallowGarbageCollection> no_gc_;
};
} // namespace baseline

View file

@ -2,15 +2,12 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
include_rules = [
# TSA builtins require assembler macros
"+src/compiler/turboshaft/define-assembler-macros.inc",
"+src/compiler/turboshaft/undef-assembler-macros.inc",
]
specific_include_rules = {
"setup-builtins-internal.cc": [
"+src/compiler/pipeline.h",
"+src/compiler/turboshaft/phase.h",
],
".*-tsa.cc": [
"+src/compiler",
],
}

View file

@ -91,7 +91,7 @@ Accessors::ReplaceAccessorWithDataProperty(Isolate* isolate,
LookupIterator::OWN_SKIP_INTERCEPTOR);
// Skip any access checks we might hit. This accessor should never hit in a
// situation where the caller does not have access.
if (it.state() == LookupIterator::ACCESS_CHECK) {
while (it.state() == LookupIterator::ACCESS_CHECK) {
CHECK(it.HasAccess());
it.Next();
}
@ -306,7 +306,7 @@ Handle<AccessorInfo> Accessors::MakeStringLengthInfo(Isolate* isolate) {
//
static Handle<Object> GetFunctionPrototype(Isolate* isolate,
Handle<JSFunction> function) {
DirectHandle<JSFunction> function) {
if (!function->has_prototype()) {
// We lazily allocate .prototype for functions, which confuses debug
// evaluate which assumes we can write to temporary objects we allocated
@ -325,8 +325,8 @@ void Accessors::FunctionPrototypeGetter(
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
RCS_SCOPE(isolate, RuntimeCallCounterId::kFunctionPrototypeGetter);
HandleScope scope(isolate);
Handle<JSFunction> function =
Cast<JSFunction>(Utils::OpenHandle(*info.Holder()));
DirectHandle<JSFunction> function =
Cast<JSFunction>(Utils::OpenDirectHandle(*info.Holder()));
DCHECK(function->has_prototype_property());
Handle<Object> result = GetFunctionPrototype(isolate, function);
info.GetReturnValue().Set(Utils::ToLocal(result));
@ -339,8 +339,8 @@ void Accessors::FunctionPrototypeSetter(
RCS_SCOPE(isolate, RuntimeCallCounterId::kFunctionPrototypeSetter);
HandleScope scope(isolate);
Handle<Object> value = Utils::OpenHandle(*val);
Handle<JSFunction> object =
Cast<JSFunction>(Utils::OpenHandle(*info.Holder()));
DirectHandle<JSFunction> object =
Cast<JSFunction>(Utils::OpenDirectHandle(*info.Holder()));
DCHECK(object->has_prototype_property());
JSFunction::SetPrototype(object, value);
info.GetReturnValue().Set(true);
@ -728,7 +728,7 @@ void Accessors::BoundFunctionLengthGetter(
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
RCS_SCOPE(isolate, RuntimeCallCounterId::kBoundFunctionLengthGetter);
HandleScope scope(isolate);
Handle<JSBoundFunction> function =
DirectHandle<JSBoundFunction> function =
Cast<JSBoundFunction>(Utils::OpenHandle(*info.Holder()));
int length = 0;
@ -753,7 +753,7 @@ void Accessors::BoundFunctionNameGetter(
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
RCS_SCOPE(isolate, RuntimeCallCounterId::kBoundFunctionNameGetter);
HandleScope scope(isolate);
Handle<JSBoundFunction> function =
DirectHandle<JSBoundFunction> function =
Cast<JSBoundFunction>(Utils::OpenHandle(*info.Holder()));
Handle<Object> result;
if (!JSBoundFunction::GetName(isolate, function).ToHandle(&result)) {

View file

@ -175,7 +175,7 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
__ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kFlagsOffset));
__ DecodeField<SharedFunctionInfo::FunctionKindBits>(r4);
__ JumpIfIsInRange(
r4, static_cast<uint32_t>(FunctionKind::kDefaultDerivedConstructor),
r4, r4, static_cast<uint32_t>(FunctionKind::kDefaultDerivedConstructor),
static_cast<uint32_t>(FunctionKind::kDerivedConstructor),
&not_create_implicit_receiver);
@ -304,33 +304,38 @@ static void AssertCodeIsBaseline(MacroAssembler* masm, Register code,
__ Assert(eq, AbortReason::kExpectedBaselineData);
}
static void GetSharedFunctionInfoBytecodeOrBaseline(MacroAssembler* masm,
Register sfi_data,
Register scratch1,
Label* is_baseline) {
static void GetSharedFunctionInfoBytecodeOrBaseline(
MacroAssembler* masm, Register sfi, Register bytecode, Register scratch1,
Label* is_baseline, Label* is_unavailable) {
ASM_CODE_COMMENT(masm);
Label done;
__ LoadMap(scratch1, sfi_data);
Register data = bytecode;
__ ldr(data,
FieldMemOperand(sfi, SharedFunctionInfo::kTrustedFunctionDataOffset));
__ LoadMap(scratch1, data);
__ ldrh(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset));
#ifndef V8_JITLESS
__ CompareInstanceType(scratch1, scratch1, CODE_TYPE);
__ cmp(scratch1, Operand(CODE_TYPE));
if (v8_flags.debug_code) {
Label not_baseline;
__ b(ne, &not_baseline);
AssertCodeIsBaseline(masm, sfi_data, scratch1);
AssertCodeIsBaseline(masm, data, scratch1);
__ b(eq, is_baseline);
__ bind(&not_baseline);
} else {
__ b(eq, is_baseline);
}
__ cmp(scratch1, Operand(INTERPRETER_DATA_TYPE));
#else
__ CompareInstanceType(scratch1, scratch1, INTERPRETER_DATA_TYPE);
#endif // !V8_JITLESS
__ b(ne, &done);
__ ldr(sfi_data,
FieldMemOperand(sfi_data, InterpreterData::kBytecodeArrayOffset));
__ cmp(scratch1, Operand(BYTECODE_ARRAY_TYPE));
__ b(eq, &done);
__ cmp(scratch1, Operand(INTERPRETER_DATA_TYPE));
__ b(ne, is_unavailable);
__ ldr(data, FieldMemOperand(data, InterpreterData::kBytecodeArrayOffset));
__ bind(&done);
}
@ -415,13 +420,20 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
// Underlying function needs to have bytecode available.
if (v8_flags.debug_code) {
Label is_baseline;
Label is_baseline, is_unavailable, ok;
__ ldr(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
__ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset));
GetSharedFunctionInfoBytecodeOrBaseline(masm, r3, r0, &is_baseline);
__ CompareObjectType(r3, r3, r3, BYTECODE_ARRAY_TYPE);
__ Assert(eq, AbortReason::kMissingBytecodeArray);
GetSharedFunctionInfoBytecodeOrBaseline(masm, r3, r3, r0, &is_baseline,
&is_unavailable);
__ jmp(&ok);
__ bind(&is_unavailable);
__ Abort(AbortReason::kMissingBytecodeArray);
__ bind(&is_baseline);
__ CompareObjectType(r3, r3, r3, CODE_TYPE);
__ Assert(eq, AbortReason::kMissingBytecodeArray);
__ bind(&ok);
}
// Resume (Ignition/TurboFan) generator object.
@ -1119,19 +1131,13 @@ void Builtins::Generate_InterpreterEntryTrampoline(
// kInterpreterBytecodeArrayRegister.
__ ldr(r4, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
ResetSharedFunctionInfoAge(masm, r4, r8);
__ ldr(kInterpreterBytecodeArrayRegister,
FieldMemOperand(r4, SharedFunctionInfo::kFunctionDataOffset));
Label is_baseline;
GetSharedFunctionInfoBytecodeOrBaseline(
masm, kInterpreterBytecodeArrayRegister, r8, &is_baseline);
// The bytecode array could have been flushed from the shared function info,
// if so, call into CompileLazy.
Label compile_lazy;
__ CompareObjectType(kInterpreterBytecodeArrayRegister, r4, no_reg,
BYTECODE_ARRAY_TYPE);
__ b(ne, &compile_lazy);
Label is_baseline, compile_lazy;
GetSharedFunctionInfoBytecodeOrBaseline(masm, r4,
kInterpreterBytecodeArrayRegister, r8,
&is_baseline, &compile_lazy);
Label push_stack_frame;
Register feedback_vector = r2;
@ -1611,7 +1617,7 @@ void Builtins::Generate_InterpreterPushArgsThenFastConstructFunction(
Label not_create_implicit_receiver;
__ DecodeField<SharedFunctionInfo::FunctionKindBits>(r2);
__ JumpIfIsInRange(
r2, static_cast<uint32_t>(FunctionKind::kDefaultDerivedConstructor),
r2, r2, static_cast<uint32_t>(FunctionKind::kDefaultDerivedConstructor),
static_cast<uint32_t>(FunctionKind::kDerivedConstructor),
&not_create_implicit_receiver);
NewImplicitReceiver(masm);
@ -1706,7 +1712,8 @@ static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) {
// trampoline.
__ ldr(r2, MemOperand(fp, StandardFrameConstants::kFunctionOffset));
__ ldr(r2, FieldMemOperand(r2, JSFunction::kSharedFunctionInfoOffset));
__ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kFunctionDataOffset));
__ ldr(r2,
FieldMemOperand(r2, SharedFunctionInfo::kTrustedFunctionDataOffset));
__ CompareObjectType(r2, kInterpreterDispatchTableRegister,
kInterpreterDispatchTableRegister,
INTERPRETER_DATA_TYPE);
@ -2579,12 +2586,13 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
Register target = r1;
Register map = r4;
Register instance_type = r5;
Register scratch = r6;
DCHECK(!AreAliased(r0, target, map, instance_type));
Label non_callable, class_constructor;
__ JumpIfSmi(target, &non_callable);
__ LoadMap(map, target);
__ CompareInstanceTypeRange(map, instance_type,
__ CompareInstanceTypeRange(map, instance_type, scratch,
FIRST_CALLABLE_JS_FUNCTION_TYPE,
LAST_CALLABLE_JS_FUNCTION_TYPE);
__ TailCallBuiltin(Builtins::CallFunction(mode), ls);
@ -2704,7 +2712,8 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
Register target = r1;
Register map = r4;
Register instance_type = r5;
DCHECK(!AreAliased(r0, target, map, instance_type));
Register scratch = r6;
DCHECK(!AreAliased(r0, target, map, instance_type, scratch));
// Check if target is a Smi.
Label non_constructor, non_proxy;
@ -2721,8 +2730,8 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
}
// Dispatch based on instance type.
__ CompareInstanceTypeRange(map, instance_type, FIRST_JS_FUNCTION_TYPE,
LAST_JS_FUNCTION_TYPE);
__ CompareInstanceTypeRange(map, instance_type, scratch,
FIRST_JS_FUNCTION_TYPE, LAST_JS_FUNCTION_TYPE);
__ TailCallBuiltin(Builtin::kConstructFunction, ls);
// Only dispatch to bound functions after checking whether they are
@ -3231,7 +3240,7 @@ class RegisterAllocator {
#define FREE_REG(Name) regs.Free(&Name);
// Loads the context field of the WasmTrustedInstanceData or WasmApiFunctionRef
// Loads the context field of the WasmTrustedInstanceData or WasmImportData
// depending on the ref's type, and places the result in the input register.
void GetContextFromRef(MacroAssembler* masm, Register ref, Register scratch) {
__ LoadTaggedField(scratch, FieldMemOperand(ref, HeapObject::kMapOffset));
@ -3240,7 +3249,7 @@ void GetContextFromRef(MacroAssembler* masm, Register ref, Register scratch) {
Label end;
__ b(eq, &instance);
__ LoadTaggedField(
ref, FieldMemOperand(ref, WasmApiFunctionRef::kNativeContextOffset));
ref, FieldMemOperand(ref, WasmImportData::kNativeContextOffset));
__ jmp(&end);
__ bind(&instance);
__ LoadTaggedField(
@ -3409,7 +3418,7 @@ void Generate_WasmResumeHelper(MacroAssembler* masm, wasm::OnResume on_resume) {
DEFINE_REG(resume_data);
__ LoadTaggedField(
resume_data,
FieldMemOperand(sfi, SharedFunctionInfo::kFunctionDataOffset));
FieldMemOperand(sfi, SharedFunctionInfo::kUntrustedFunctionDataOffset));
__ LoadTaggedField(
suspender,
FieldMemOperand(resume_data, WasmResumeData::kSuspenderOffset));
@ -4016,12 +4025,11 @@ void SwitchFromTheCentralStackIfNeeded(MacroAssembler* masm) {
} // namespace
void Builtins::Generate_WasmToOnHeapWasmToJsTrampoline(MacroAssembler* masm) {
// Load the code pointer from the WasmApiFunctionRef and tail-call there.
Register api_function_ref = wasm::kGpParamRegisters[0];
// Load the code pointer from the WasmImportData and tail-call there.
Register import_data = wasm::kGpParamRegisters[0];
UseScratchRegisterScope temps{masm};
Register scratch = temps.Acquire();
__ Move(scratch,
FieldMemOperand(api_function_ref, WasmApiFunctionRef::kCodeOffset));
__ Move(scratch, FieldMemOperand(import_data, WasmImportData::kCodeOffset));
__ Move(scratch, FieldMemOperand(scratch, Code::kInstructionStartOffset));
__ Jump(scratch);
}
@ -4513,7 +4521,7 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) {
DCHECK(!AreAliased(api_function_address, property_callback_info_arg, name_arg,
callback, scratch));
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
// name_arg = Local<Name>(name), name value was pushed to GC-ed stack space.
// |name_arg| is already initialized above.
#else
@ -4852,7 +4860,8 @@ void Generate_BaselineOrInterpreterEntry(MacroAssembler* masm,
}
__ ldr(code_obj,
FieldMemOperand(code_obj, SharedFunctionInfo::kFunctionDataOffset));
FieldMemOperand(code_obj,
SharedFunctionInfo::kTrustedFunctionDataOffset));
// Check if we have baseline code. For OSR entry it is safe to assume we
// always have baseline code.

View file

@ -391,43 +391,6 @@ static void AssertCodeIsBaseline(MacroAssembler* masm, Register code,
return AssertCodeIsBaselineAllowClobber(masm, code, scratch);
}
// Equivalent of SharedFunctionInfo::GetData
static void GetSharedFunctionInfoData(MacroAssembler* masm, Register data,
Register sfi, Register scratch) {
#ifdef V8_ENABLE_SANDBOX
DCHECK(!AreAliased(data, scratch));
DCHECK(!AreAliased(sfi, scratch));
// Use trusted_function_data if non-empy, otherwise the regular function_data.
Label use_tagged_field, done;
__ Ldr(scratch.W(),
FieldMemOperand(sfi, SharedFunctionInfo::kTrustedFunctionDataOffset));
__ Cbz(scratch.W(), &use_tagged_field);
__ ResolveIndirectPointerHandle(data, scratch, kUnknownIndirectPointerTag);
__ B(&done);
__ Bind(&use_tagged_field);
__ LoadTaggedField(
data, FieldMemOperand(sfi, SharedFunctionInfo::kFunctionDataOffset));
__ Bind(&done);
#else
__ LoadTaggedField(
data, FieldMemOperand(sfi, SharedFunctionInfo::kFunctionDataOffset));
#endif // V8_ENABLE_SANDBOX
}
#ifdef V8_ENABLE_WEBASSEMBLY
// Equivalent of SharedFunctionInfo::wasm_resume_data()
static void GetSharedFunctionInfoWasmResumeData(MacroAssembler* masm,
Register resume_data,
Register sfi) {
__ LoadTaggedField(
resume_data,
FieldMemOperand(sfi, SharedFunctionInfo::kFunctionDataOffset));
}
#endif // V8_ENABLE_WEBASSEMBLY
static void CheckSharedFunctionInfoBytecodeOrBaseline(MacroAssembler* masm,
Register data,
Register scratch,
@ -469,18 +432,11 @@ static void GetSharedFunctionInfoBytecodeOrBaseline(
Label done;
Register data = bytecode;
#ifdef V8_ENABLE_SANDBOX
// In this case, the bytecode array must be referenced via a trusted pointer.
// Loading it from the tagged function_data field would not be safe.
__ Ldr(scratch1.W(),
FieldMemOperand(sfi, SharedFunctionInfo::kTrustedFunctionDataOffset));
__ LoadTrustedPointerField(
data,
FieldMemOperand(sfi, SharedFunctionInfo::kTrustedFunctionDataOffset),
kUnknownIndirectPointerTag);
__ Cbz(scratch1.W(), is_unavailable);
__ ResolveIndirectPointerHandle(data, scratch1, kUnknownIndirectPointerTag);
#else
__ LoadTaggedField(
data, FieldMemOperand(sfi, SharedFunctionInfo::kFunctionDataOffset));
#endif // V8_ENABLE_SANDBOX
if (V8_JITLESS_BOOL) {
__ IsObjectType(data, scratch1, scratch1, INTERPRETER_DATA_TYPE);
__ B(ne, &done);
@ -2011,7 +1967,9 @@ static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) {
__ Ldr(x1, MemOperand(fp, StandardFrameConstants::kFunctionOffset));
__ LoadTaggedField(
x1, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
GetSharedFunctionInfoData(masm, x1, x1, x2);
__ LoadTrustedPointerField(
x1, FieldMemOperand(x1, SharedFunctionInfo::kTrustedFunctionDataOffset),
kUnknownIndirectPointerTag);
__ IsObjectType(x1, kInterpreterDispatchTableRegister,
kInterpreterDispatchTableRegister, INTERPRETER_DATA_TYPE);
__ B(ne, &builtin_trampoline);
@ -3726,7 +3684,7 @@ class RegisterAllocator {
#define FREE_REG(Name) regs.Free(&Name);
// Loads the context field of the WasmTrustedInstanceData or WasmApiFunctionRef
// Loads the context field of the WasmTrustedInstanceData or WasmImportData
// depending on the ref's type, and places the result in the input register.
void GetContextFromRef(MacroAssembler* masm, Register ref, Register scratch) {
__ LoadTaggedField(scratch, FieldMemOperand(ref, HeapObject::kMapOffset));
@ -3735,7 +3693,7 @@ void GetContextFromRef(MacroAssembler* masm, Register ref, Register scratch) {
Label end;
__ B(eq, &instance);
__ LoadTaggedField(
ref, FieldMemOperand(ref, WasmApiFunctionRef::kNativeContextOffset));
ref, FieldMemOperand(ref, WasmImportData::kNativeContextOffset));
__ jmp(&end);
__ bind(&instance);
__ LoadTaggedField(
@ -3897,7 +3855,9 @@ void Generate_WasmResumeHelper(MacroAssembler* masm, wasm::OnResume on_resume) {
// RecordWriteField calls later.
DEFINE_PINNED(suspender, WriteBarrierDescriptor::ObjectRegister());
DEFINE_REG(resume_data);
GetSharedFunctionInfoWasmResumeData(masm, resume_data, sfi);
__ LoadTaggedField(
resume_data,
FieldMemOperand(sfi, SharedFunctionInfo::kUntrustedFunctionDataOffset));
// The write barrier uses a fixed register for the host object (rdi). The next
// barrier is on the suspender, so load it in rdi directly.
__ LoadTaggedField(
@ -4501,8 +4461,8 @@ void SwitchFromTheCentralStackIfNeeded(MacroAssembler* masm) {
} // namespace
void Builtins::Generate_WasmToOnHeapWasmToJsTrampoline(MacroAssembler* masm) {
// Load the code pointer from the WasmApiFunctionRef and tail-call there.
Register api_function_ref = wasm::kGpParamRegisters[0];
// Load the code pointer from the WasmImportData and tail-call there.
Register import_data = wasm::kGpParamRegisters[0];
// Use x17 which is not in kGpParamRegisters and allows to jump to a "bti c"
// marker.
Register call_target = x17;
@ -4510,13 +4470,11 @@ void Builtins::Generate_WasmToOnHeapWasmToJsTrampoline(MacroAssembler* masm) {
temps.Exclude(call_target);
#ifdef V8_ENABLE_SANDBOX
__ LoadCodeEntrypointViaCodePointer(
call_target,
FieldMemOperand(api_function_ref, WasmApiFunctionRef::kCodeOffset),
call_target, FieldMemOperand(import_data, WasmImportData::kCodeOffset),
kWasmEntrypointTag);
#else
Register code = call_target;
__ Ldr(code,
FieldMemOperand(api_function_ref, WasmApiFunctionRef::kCodeOffset));
__ Ldr(code, FieldMemOperand(import_data, WasmImportData::kCodeOffset));
__ Ldr(call_target, FieldMemOperand(code, Code::kInstructionStartOffset));
#endif
__ Jump(call_target);
@ -5014,7 +4972,7 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) {
DCHECK(!AreAliased(api_function_address, property_callback_info_arg, name_arg,
callback, scratch, scratch2));
#ifdef V8_ENABLE_DIRECT_LOCAL
#ifdef V8_ENABLE_DIRECT_HANDLE
// name_arg = Local<Name>(name), name value was pushed to GC-ed stack space.
// |name_arg| is already initialized above.
#else
@ -5374,7 +5332,10 @@ void Generate_BaselineOrInterpreterEntry(MacroAssembler* masm,
ResetSharedFunctionInfoAge(masm, code_obj);
}
GetSharedFunctionInfoData(masm, code_obj, code_obj, x3);
__ LoadTrustedPointerField(
code_obj,
FieldMemOperand(code_obj, SharedFunctionInfo::kTrustedFunctionDataOffset),
kUnknownIndirectPointerTag);
// Check if we have baseline code. For OSR entry it is safe to assume we
// always have baseline code.

View file

@ -91,9 +91,17 @@ extern enum ArrayFromAsyncIterableResolveContextSlots extends intptr
kArrayFromAsyncIterableResolveLength
}
extern macro AllocateRootFunctionWithContext(
constexpr intptr, FunctionContext): JSFunction;
const kArrayFromAsyncIterableOnFulfilledSharedFun: constexpr intptr
generates 'RootIndex::kArrayFromAsyncIterableOnFulfilledSharedFun';
const kArrayFromAsyncIterableOnRejectedSharedFun: constexpr intptr
generates 'RootIndex::kArrayFromAsyncIterableOnRejectedSharedFun';
macro CreateArrayFromAsyncIterableResolveContext(
implicit context: Context)(resumeState: ArrayFromAsyncIterableResumeState,
promise: JSPromise, promiseFun: JSReceiver, map: Map, iterator: JSReceiver,
promise: JSPromise, promiseFun: JSReceiver, iterator: JSReceiver,
next: JSAny, arr: JSReceiver, error: JSAny, mapfn: JSAny, thisArg: JSAny,
nativeContext: NativeContext): ArrayFromAsyncIterableResolveContext {
const resolveContext = %RawDownCast<ArrayFromAsyncIterableResolveContext>(
@ -130,16 +138,14 @@ macro CreateArrayFromAsyncIterableResolveContext(
resolveContext,
ArrayFromAsyncIterableResolveContextSlots::
kArrayFromAsyncIterableResolveOnFulfilledFunctionSlot,
promise::AllocateFunctionWithMapAndContext(
map, ArrayFromAsyncIterableOnFulfilledSharedFunConstant(),
resolveContext));
AllocateRootFunctionWithContext(
kArrayFromAsyncIterableOnFulfilledSharedFun, resolveContext));
InitContextSlot(
resolveContext,
ArrayFromAsyncIterableResolveContextSlots::
kArrayFromAsyncIterableResolveOnRejectedFunctionSlot,
promise::AllocateFunctionWithMapAndContext(
map, ArrayFromAsyncIterableOnRejectedSharedFunConstant(),
resolveContext));
AllocateRootFunctionWithContext(
kArrayFromAsyncIterableOnRejectedSharedFun, resolveContext));
InitContextSlot(
resolveContext,
ArrayFromAsyncIterableResolveContextSlots::
@ -503,9 +509,14 @@ extern enum ArrayFromAsyncArrayLikeResolveContextSlots extends intptr
kArrayFromAsyncArrayLikeResolveLength
}
const kArrayFromAsyncArrayLikeOnFulfilledSharedFun: constexpr intptr
generates 'RootIndex::kArrayFromAsyncArrayLikeOnFulfilledSharedFun';
const kArrayFromAsyncArrayLikeOnRejectedSharedFun: constexpr intptr
generates 'RootIndex::kArrayFromAsyncArrayLikeOnRejectedSharedFun';
macro CreateArrayFromAsyncArrayLikeResolveContext(
implicit context: Context)(resumeState: ArrayFromAsyncArrayLikeResumeState,
promise: JSPromise, promiseFun: JSReceiver, map: Map, arrayLike: JSReceiver,
promise: JSPromise, promiseFun: JSReceiver, arrayLike: JSReceiver,
arr: JSReceiver, error: JSAny, mapfn: JSAny, thisArg: JSAny,
nativeContext: NativeContext): ArrayFromAsyncArrayLikeResolveContext {
const resolveContext = %RawDownCast<ArrayFromAsyncArrayLikeResolveContext>(
@ -547,16 +558,14 @@ macro CreateArrayFromAsyncArrayLikeResolveContext(
resolveContext,
ArrayFromAsyncArrayLikeResolveContextSlots::
kArrayFromAsyncArrayLikeResolveOnFulfilledFunctionSlot,
promise::AllocateFunctionWithMapAndContext(
map, ArrayFromAsyncArrayLikeOnFulfilledSharedFunConstant(),
resolveContext));
AllocateRootFunctionWithContext(
kArrayFromAsyncArrayLikeOnFulfilledSharedFun, resolveContext));
InitContextSlot(
resolveContext,
ArrayFromAsyncArrayLikeResolveContextSlots::
kArrayFromAsyncArrayLikeResolveOnRejectedFunctionSlot,
promise::AllocateFunctionWithMapAndContext(
map, ArrayFromAsyncArrayLikeOnRejectedSharedFunConstant(),
resolveContext));
AllocateRootFunctionWithContext(
kArrayFromAsyncArrayLikeOnRejectedSharedFun, resolveContext));
InitContextSlot(
resolveContext,
ArrayFromAsyncArrayLikeResolveContextSlots::
@ -805,8 +814,6 @@ transitioning javascript builtin ArrayFromAsync(
const promiseFun = *NativeContextSlot(
context, ContextSlot::PROMISE_FUNCTION_INDEX);
const map = *NativeContextSlot(
context, ContextSlot::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX);
// 3. Let fromAsyncClosure be a new Abstract Closure with no parameters that
// captures C, mapfn, and thisArg and performs the following steps when
@ -876,7 +883,7 @@ transitioning javascript builtin ArrayFromAsync(
const arrayLikeResolveContext =
CreateArrayFromAsyncArrayLikeResolveContext(
resumeState, promise, promiseFun, map, arrayLike, arr, Undefined,
resumeState, promise, promiseFun, arrayLike, arr, Undefined,
mapfn, thisArg, context);
CreateArrayFromArrayLikeAsynchronously(arrayLikeResolveContext);
@ -929,7 +936,7 @@ transitioning javascript builtin ArrayFromAsync(
};
const iterableResolveContext = CreateArrayFromAsyncIterableResolveContext(
iterableResumeState, promise, promiseFun, map, iteratorRecord.object,
iterableResumeState, promise, promiseFun, iteratorRecord.object,
iteratorRecord.next, arr, Undefined, mapfn, thisArg, context);
CreateArrayFromIterableAsynchronously(iterableResolveContext);

View file

@ -243,12 +243,10 @@ type ExternalPointer
generates 'TNode<ExternalPointerT>' constexpr 'ExternalPointer_t';
type CppHeapPointer
generates 'TNode<CppHeapPointerT>' constexpr 'CppHeapPointer_t';
type IndirectPointer
generates 'TNode<IndirectPointerHandleT>'
constexpr 'IndirectPointerHandle';
// TODO(saelo): implement accessors and type checkers for these fields.
type IndirectPointer<To : type extends ExposedTrustedObject> extends
IndirectPointer;
type TrustedPointer
generates 'TNode<TrustedPointerT>' constexpr 'TrustedPointer_t';
type TrustedPointer<To : type extends ExposedTrustedObject> extends
TrustedPointer;
type ProtectedPointer extends Tagged;
type ProtectedPointer<To : type extends TrustedObject> extends ProtectedPointer;
extern class InstructionStream extends TrustedObject;

View file

@ -0,0 +1,40 @@
// Copyright 2024 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.
#include "src/builtins/builtins-utils-inl.h"
#include "src/objects/objects-inl.h"
namespace v8 {
namespace internal {
// https://tc39.es/proposal-source-phase-imports/#sec-get-%abstractmodulesource%.prototype.@@tostringtag
BUILTIN(AbstractModuleSourceToStringTag) {
HandleScope scope(isolate);
// 1. Let O be the this value.
Handle<Object> receiver = args.receiver();
// 2. If O is not an Object, return undefined.
if (!IsJSReceiver(*receiver)) {
return *isolate->factory()->undefined_value();
}
// 3. Let sourceNameResult be Completion(HostGetModuleSourceName(O)).
// 4. If sourceNameResult is an abrupt completion, return undefined.
// 5. Let name be ! sourceNameResult.
// 6. Assert: name is a String.
// 7. Return name.
#if V8_ENABLE_WEBASSEMBLY
// https://webassembly.github.io/esm-integration/js-api/index.html#hostgetmodulesourcename
// Whenever a WebAssembly Module object is provided with a [[Module]] internal
// slot, the string "WebAssembly.Module" is always returned.
if (IsWasmModuleObject(*receiver)) {
return *isolate->factory()->WebAssemblyModule_string();
}
#endif
// TODO(42204365): Implement host hook.
return *isolate->factory()->undefined_value();
}
} // namespace internal
} // namespace v8

View file

@ -57,7 +57,7 @@ Tagged<JSReceiver> GetCompatibleReceiver(Isolate* isolate,
template <bool is_construct>
V8_WARN_UNUSED_RESULT MaybeHandle<Object> HandleApiCallHelper(
Isolate* isolate, Handle<HeapObject> new_target,
Handle<FunctionTemplateInfo> fun_data, Handle<Object> receiver,
DirectHandle<FunctionTemplateInfo> fun_data, Handle<Object> receiver,
Address* argv, int argc) {
Handle<JSReceiver> js_receiver;
Tagged<JSReceiver> raw_holder;
@ -132,7 +132,7 @@ BUILTIN(HandleApiConstruct) {
Handle<Object> receiver = args.receiver();
Handle<HeapObject> new_target = args.new_target();
DCHECK(!IsUndefined(*new_target, isolate));
Handle<FunctionTemplateInfo> fun_data(
DirectHandle<FunctionTemplateInfo> fun_data(
args.target()->shared()->api_func_data(), isolate);
int argc = args.length() - 1;
Address* argv = args.address_of_first_argument();

View file

@ -4,6 +4,8 @@
#include "src/builtins/builtins-array-gen.h"
#include <optional>
#include "src/builtins/builtins-constructor-gen.h"
#include "src/builtins/builtins-constructor.h"
#include "src/builtins/builtins-iterator-gen.h"
@ -462,7 +464,7 @@ TF_BUILTIN(ArrayPrototypePush, CodeStubAssembler) {
BIND(&default_label);
{
args.ForEach(
[=](TNode<Object> arg) {
[=, this](TNode<Object> arg) {
TNode<Number> length = LoadJSArrayLength(array_receiver);
SetPropertyStrict(context, array_receiver, length, arg);
},
@ -520,7 +522,7 @@ TF_BUILTIN(CloneFastJSArrayFillingHoles, ArrayBuiltinsAssembler) {
LoadElementsKind(array))),
Word32BinaryNot(IsNoElementsProtectorCellInvalid())));
Return(CloneFastJSArray(context, array, base::nullopt,
Return(CloneFastJSArray(context, array, std::nullopt,
HoleConversionMode::kConvertToUndefined));
}
@ -1600,7 +1602,7 @@ void ArrayBuiltinsAssembler::TailCallArrayConstructorStub(
void ArrayBuiltinsAssembler::CreateArrayDispatchNoArgument(
TNode<Context> context, TNode<JSFunction> target, TNode<Int32T> argc,
AllocationSiteOverrideMode mode,
base::Optional<TNode<AllocationSite>> allocation_site) {
std::optional<TNode<AllocationSite>> allocation_site) {
if (mode == DISABLE_ALLOCATION_SITES) {
Callable callable = CodeFactory::ArrayNoArgumentConstructor(
isolate(), GetInitialFastElementsKind(), mode);
@ -1638,7 +1640,7 @@ void ArrayBuiltinsAssembler::CreateArrayDispatchNoArgument(
void ArrayBuiltinsAssembler::CreateArrayDispatchSingleArgument(
TNode<Context> context, TNode<JSFunction> target, TNode<Int32T> argc,
AllocationSiteOverrideMode mode,
base::Optional<TNode<AllocationSite>> allocation_site) {
std::optional<TNode<AllocationSite>> allocation_site) {
if (mode == DISABLE_ALLOCATION_SITES) {
ElementsKind initial = GetInitialFastElementsKind();
ElementsKind holey_initial = GetHoleyElementsKind(initial);
@ -1708,7 +1710,7 @@ void ArrayBuiltinsAssembler::CreateArrayDispatchSingleArgument(
void ArrayBuiltinsAssembler::GenerateDispatchToArrayStub(
TNode<Context> context, TNode<JSFunction> target, TNode<Int32T> argc,
AllocationSiteOverrideMode mode,
base::Optional<TNode<AllocationSite>> allocation_site) {
std::optional<TNode<AllocationSite>> allocation_site) {
CodeStubArguments args(this, argc);
Label check_one_case(this), fallthrough(this);
GotoIfNot(IntPtrEqual(args.GetLengthWithoutReceiver(), IntPtrConstant(0)),
@ -1799,7 +1801,7 @@ void ArrayBuiltinsAssembler::GenerateConstructor(
TNode<JSArray> array = AllocateJSArray(
elements_kind, array_map, array_size_smi, array_size_smi,
mode == DONT_TRACK_ALLOCATION_SITE
? base::Optional<TNode<AllocationSite>>(base::nullopt)
? std::optional<TNode<AllocationSite>>(std::nullopt)
: CAST(allocation_site));
Return(array);
}
@ -1819,10 +1821,10 @@ void ArrayBuiltinsAssembler::GenerateArrayNoArgumentConstructor(
Parameter<HeapObject>(Descriptor::kFunction), JSFunction::kContextOffset);
bool track_allocation_site =
AllocationSite::ShouldTrack(kind) && mode != DISABLE_ALLOCATION_SITES;
base::Optional<TNode<AllocationSite>> allocation_site =
std::optional<TNode<AllocationSite>> allocation_site =
track_allocation_site
? Parameter<AllocationSite>(Descriptor::kAllocationSite)
: base::Optional<TNode<AllocationSite>>(base::nullopt);
: std::optional<TNode<AllocationSite>>(std::nullopt);
TNode<Map> array_map = LoadJSArrayElementsMap(kind, native_context);
TNode<JSArray> array = AllocateJSArray(
kind, array_map, IntPtrConstant(JSArray::kPreallocatedArrayElements),

View file

@ -5,6 +5,8 @@
#ifndef V8_BUILTINS_BUILTINS_ARRAY_GEN_H_
#define V8_BUILTINS_BUILTINS_ARRAY_GEN_H_
#include <optional>
#include "src/codegen/code-factory.h" // for enum AllocationSiteOverrideMode
#include "src/codegen/code-stub-assembler.h"
@ -76,17 +78,17 @@ class ArrayBuiltinsAssembler : public CodeStubAssembler {
void GenerateDispatchToArrayStub(
TNode<Context> context, TNode<JSFunction> target, TNode<Int32T> argc,
AllocationSiteOverrideMode mode,
base::Optional<TNode<AllocationSite>> allocation_site = base::nullopt);
std::optional<TNode<AllocationSite>> allocation_site = std::nullopt);
void CreateArrayDispatchNoArgument(
TNode<Context> context, TNode<JSFunction> target, TNode<Int32T> argc,
AllocationSiteOverrideMode mode,
base::Optional<TNode<AllocationSite>> allocation_site);
std::optional<TNode<AllocationSite>> allocation_site);
void CreateArrayDispatchSingleArgument(
TNode<Context> context, TNode<JSFunction> target, TNode<Int32T> argc,
AllocationSiteOverrideMode mode,
base::Optional<TNode<AllocationSite>> allocation_site);
std::optional<TNode<AllocationSite>> allocation_site);
void GenerateConstructor(TNode<Context> context,
TNode<HeapObject> array_function,

View file

@ -1443,7 +1443,7 @@ Tagged<Object> Slow_ArrayConcat(BuiltinArguments* args, Handle<Object> species,
// In case of failure, fall through.
}
Handle<HeapObject> storage;
DirectHandle<HeapObject> storage;
if (fast_case) {
// The backing storage array must have non-existing elements to preserve
// holes across concat operations.

View file

@ -13,26 +13,6 @@
namespace v8 {
namespace internal {
BUILTIN(AsyncDisposableStackOnFulfilled) {
HandleScope scope(isolate);
Handle<JSDisposableStackBase> stack = Handle<JSDisposableStackBase>(
Cast<JSDisposableStackBase>(isolate->context()->get(static_cast<int>(
JSDisposableStackBase::AsyncDisposableStackContextSlots::kStack))),
isolate);
MaybeHandle<Object> maybe_error = MaybeHandle<Object>(
Cast<Object>(isolate->context()->get(static_cast<int>(
JSDisposableStackBase::AsyncDisposableStackContextSlots::kError))),
isolate);
JSDisposableStackBase::DisposeResources(
isolate, stack, maybe_error,
DisposableStackResourcesType::kAtLeastOneAsync);
return ReadOnlyRoots(isolate).undefined_value();
}
BUILTIN(AsyncDisposableStackOnRejected) { UNIMPLEMENTED(); }
// Part of
// https://tc39.es/proposal-explicit-resource-management/#sec-getdisposemethod
BUILTIN(AsyncDisposeFromSyncDispose) {

View file

@ -159,7 +159,8 @@ void AsyncBuiltinsAssembler::InitializeNativeClosure(
IntPtrEqual(LoadMapInstanceSizeInWords(function_map),
IntPtrConstant(JSFunction::kSizeWithoutPrototype /
kTaggedSize)));
static_assert(JSFunction::kSizeWithoutPrototype == 7 * kTaggedSize);
static_assert(JSFunction::kSizeWithoutPrototype ==
(7 + V8_ENABLE_LEAPTIERING_BOOL) * kTaggedSize);
StoreMapNoWriteBarrier(function, function_map);
StoreObjectFieldRoot(function, JSObject::kPropertiesOrHashOffset,
RootIndex::kEmptyFixedArray);
@ -167,6 +168,11 @@ void AsyncBuiltinsAssembler::InitializeNativeClosure(
RootIndex::kEmptyFixedArray);
StoreObjectFieldRoot(function, JSFunction::kFeedbackCellOffset,
RootIndex::kManyClosuresCell);
#ifdef V8_ENABLE_LEAPTIERING
// TODO(saelo): obtain an appropriate dispatch handle here.
StoreObjectFieldNoWriteBarrier(function, JSFunction::kDispatchHandleOffset,
Int32Constant(kNullJSDispatchHandle));
#endif // V8_ENABLE_LEAPTIERING
StoreObjectFieldNoWriteBarrier(
function, JSFunction::kSharedFunctionInfoOffset, shared_info);
@ -184,14 +190,10 @@ void AsyncBuiltinsAssembler::InitializeNativeClosure(
TNode<JSFunction> AsyncBuiltinsAssembler::CreateUnwrapClosure(
TNode<NativeContext> native_context, TNode<Boolean> done) {
const TNode<Map> map = CAST(LoadContextElement(
native_context, Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX));
const TNode<SharedFunctionInfo> on_fulfilled_shared =
AsyncIteratorValueUnwrapSharedFunConstant();
const TNode<Context> closure_context =
AllocateAsyncIteratorValueUnwrapContext(native_context, done);
return AllocateFunctionWithMapAndContext(map, on_fulfilled_shared,
closure_context);
return AllocateRootFunctionWithContext(
RootIndex::kAsyncIteratorValueUnwrapSharedFun, closure_context);
}
TNode<Context> AsyncBuiltinsAssembler::AllocateAsyncIteratorValueUnwrapContext(

View file

@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/base/optional.h"
#include <optional>
#include "src/builtins/builtins-async-gen.h"
#include "src/builtins/builtins-utils-gen.h"
#include "src/builtins/builtins.h"
@ -35,7 +36,7 @@ class AsyncFromSyncBuiltinsAssembler : public AsyncBuiltinsAssembler {
const UndefinedMethodHandler& if_method_undefined,
const char* operation_name, CloseOnRejectionOption close_on_rejection,
Label::Type reject_label_type = Label::kDeferred,
base::Optional<TNode<Object>> initial_exception_value = base::nullopt);
std::optional<TNode<Object>> initial_exception_value = std::nullopt);
void Generate_AsyncFromSyncIteratorMethod(
CodeStubArguments* args, const TNode<Context> context,
@ -43,8 +44,8 @@ class AsyncFromSyncBuiltinsAssembler : public AsyncBuiltinsAssembler {
Handle<String> name, const UndefinedMethodHandler& if_method_undefined,
const char* operation_name, CloseOnRejectionOption close_on_rejection,
Label::Type reject_label_type = Label::kDeferred,
base::Optional<TNode<Object>> initial_exception_value = base::nullopt) {
auto get_method = [=](const TNode<JSReceiver> sync_iterator) {
std::optional<TNode<Object>> initial_exception_value = std::nullopt) {
auto get_method = [=, this](const TNode<JSReceiver> sync_iterator) {
return GetProperty(context, sync_iterator, name);
};
return Generate_AsyncFromSyncIteratorMethod(
@ -89,7 +90,7 @@ void AsyncFromSyncBuiltinsAssembler::Generate_AsyncFromSyncIteratorMethod(
const UndefinedMethodHandler& if_method_undefined,
const char* operation_name, CloseOnRejectionOption close_on_rejection,
Label::Type reject_label_type,
base::Optional<TNode<Object>> initial_exception_value) {
std::optional<TNode<Object>> initial_exception_value) {
const TNode<NativeContext> native_context = LoadNativeContext(context);
const TNode<JSPromise> promise = NewJSPromise(context);
@ -174,8 +175,8 @@ void AsyncFromSyncBuiltinsAssembler::Generate_AsyncFromSyncIteratorMethod(
TNode<Object> on_rejected;
if (close_on_rejection == kCloseOnRejection) {
on_rejected = Select<Object>(
IsTrue(done), [=] { return UndefinedConstant(); },
[=] {
IsTrue(done), [=, this] { return UndefinedConstant(); },
[=, this] {
return CreateAsyncFromSyncIteratorCloseSyncAndRethrowClosure(
native_context, sync_iterator);
});
@ -296,15 +297,12 @@ AsyncFromSyncBuiltinsAssembler::LoadIteratorResult(
TNode<JSFunction> AsyncFromSyncBuiltinsAssembler::
CreateAsyncFromSyncIteratorCloseSyncAndRethrowClosure(
TNode<NativeContext> native_context, TNode<JSReceiver> sync_iterator) {
const TNode<Map> map = CAST(LoadContextElement(
native_context, Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX));
const TNode<SharedFunctionInfo> on_rejected_shared =
AsyncFromSyncIteratorCloseSyncAndRethrowSharedFunConstant();
const TNode<Context> closure_context =
AllocateAsyncFromSyncIteratorCloseSyncAndRethrowContext(native_context,
sync_iterator);
return AllocateFunctionWithMapAndContext(map, on_rejected_shared,
closure_context);
return AllocateRootFunctionWithContext(
RootIndex::kAsyncFromSyncIteratorCloseSyncAndRethrowSharedFun,
closure_context);
}
TNode<Context> AsyncFromSyncBuiltinsAssembler::
@ -330,7 +328,7 @@ TF_BUILTIN(AsyncFromSyncIteratorPrototypeNext, AsyncFromSyncBuiltinsAssembler) {
const TNode<Object> value = args.GetOptionalArgumentValue(kValueOrReasonArg);
const auto context = Parameter<Context>(Descriptor::kContext);
auto get_method = [=](const TNode<JSReceiver> unused) {
auto get_method = [=, this](const TNode<JSReceiver> unused) {
return LoadObjectField(CAST(iterator),
JSAsyncFromSyncIterator::kNextOffset);
};
@ -350,7 +348,7 @@ TF_BUILTIN(AsyncFromSyncIteratorPrototypeReturn,
const TNode<Object> value = args.GetOptionalArgumentValue(kValueOrReasonArg);
const auto context = Parameter<Context>(Descriptor::kContext);
auto if_return_undefined = [=, &args](
auto if_return_undefined = [=, this, &args](
const TNode<NativeContext> native_context,
const TNode<JSPromise> promise,
const TNode<JSReceiver> sync_iterator,
@ -386,9 +384,10 @@ TF_BUILTIN(AsyncFromSyncIteratorPrototypeThrow,
// 8. If throw is undefined, then
auto if_throw_undefined =
[=, &args](const TNode<NativeContext> native_context,
const TNode<JSPromise> promise,
const TNode<JSReceiver> sync_iterator, Label* if_exception) {
[=, this, &args](const TNode<NativeContext> native_context,
const TNode<JSPromise> promise,
const TNode<JSReceiver> sync_iterator,
Label* if_exception) {
// a. NOTE: If syncIterator does not have a `throw` method, close it to
// give it a chance to clean up before we reject the capability.
// b. Let closeCompletion be NormalCompletion(~empty~).

View file

@ -230,7 +230,7 @@ BUILTIN(AtomicsMutexAsyncUnlockResolveHandler) {
DCHECK(v8_flags.harmony_struct);
HandleScope scope(isolate);
Handle<Object> previous_result = args.atOrUndefined(isolate, 1);
DirectHandle<Object> previous_result = args.atOrUndefined(isolate, 1);
Handle<JSPromise> js_unlock_promise =
UnlockAsyncLockedMutexFromPromiseHandler(isolate);

View file

@ -4,6 +4,8 @@
#include "src/builtins/builtins-call-gen.h"
#include <optional>
#include "src/builtins/builtins-inl.h"
#include "src/builtins/builtins-utils-gen.h"
#include "src/codegen/macro-assembler.h"
@ -159,7 +161,7 @@ TF_BUILTIN(Call_ReceiverIsAny_WithFeedback, CallOrConstructBuiltinsAssembler) {
}
void CallOrConstructBuiltinsAssembler::CallOrConstructWithArrayLike(
TNode<Object> target, base::Optional<TNode<Object>> new_target,
TNode<Object> target, std::optional<TNode<Object>> new_target,
TNode<Object> arguments_list, TNode<Context> context) {
Label if_done(this), if_arguments(this), if_array(this),
if_holey_array(this, Label::kDeferred),
@ -334,7 +336,7 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithArrayLike(
// boxed as HeapNumbers, then tail calls CallVarargs/ConstructVarargs depending
// on whether {new_target} was passed.
void CallOrConstructBuiltinsAssembler::CallOrConstructDoubleVarargs(
TNode<Object> target, base::Optional<TNode<Object>> new_target,
TNode<Object> target, std::optional<TNode<Object>> new_target,
TNode<FixedDoubleArray> elements, TNode<Int32T> length,
TNode<Int32T> args_count, TNode<Context> context, TNode<Int32T> kind) {
const ElementsKind new_kind = PACKED_ELEMENTS;
@ -362,7 +364,7 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructDoubleVarargs(
}
void CallOrConstructBuiltinsAssembler::CallOrConstructWithSpread(
TNode<Object> target, base::Optional<TNode<Object>> new_target,
TNode<Object> target, std::optional<TNode<Object>> new_target,
TNode<Object> spread, TNode<Int32T> args_count, TNode<Context> context) {
Label if_smiorobject(this), if_double(this),
if_generic(this, Label::kDeferred);
@ -475,7 +477,7 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithSpread(
template <class Descriptor>
void CallOrConstructBuiltinsAssembler::CallReceiver(
Builtin id, base::Optional<TNode<Object>> receiver) {
Builtin id, std::optional<TNode<Object>> receiver) {
static_assert(std::is_same<Descriptor,
CallTrampoline_Baseline_CompactDescriptor>::value,
"Incompatible Descriptor");
@ -493,11 +495,11 @@ void CallOrConstructBuiltinsAssembler::CallReceiver(
template <class Descriptor>
void CallOrConstructBuiltinsAssembler::CallReceiver(
Builtin id, TNode<Int32T> argc, TNode<UintPtrT> slot,
base::Optional<TNode<Object>> maybe_receiver) {
std::optional<TNode<Object>> maybe_receiver) {
auto target = Parameter<Object>(Descriptor::kFunction);
auto context = LoadContextFromBaseline();
auto feedback_vector = LoadFeedbackVectorFromBaseline();
LazyNode<Object> receiver = [=] {
LazyNode<Object> receiver = [=, this] {
if (maybe_receiver) {
return *maybe_receiver;
} else {
@ -512,7 +514,7 @@ void CallOrConstructBuiltinsAssembler::CallReceiver(
TF_BUILTIN(CallWithArrayLike, CallOrConstructBuiltinsAssembler) {
auto target = Parameter<Object>(Descriptor::kTarget);
base::Optional<TNode<Object>> new_target = base::nullopt;
std::optional<TNode<Object>> new_target = std::nullopt;
auto arguments_list = Parameter<Object>(Descriptor::kArgumentsList);
auto context = Parameter<Context>(Descriptor::kContext);
CallOrConstructWithArrayLike(target, new_target, arguments_list, context);
@ -521,7 +523,7 @@ TF_BUILTIN(CallWithArrayLike, CallOrConstructBuiltinsAssembler) {
// TODO(ishell): not used, consider removing.
TF_BUILTIN(CallWithArrayLike_WithFeedback, CallOrConstructBuiltinsAssembler) {
auto target = Parameter<Object>(Descriptor::kTarget);
base::Optional<TNode<Object>> new_target = base::nullopt;
std::optional<TNode<Object>> new_target = std::nullopt;
auto arguments_list = Parameter<Object>(Descriptor::kArgumentsList);
auto context = Parameter<Context>(Descriptor::kContext);
auto feedback_vector = Parameter<FeedbackVector>(Descriptor::kFeedbackVector);
@ -534,7 +536,7 @@ TF_BUILTIN(CallWithArrayLike_WithFeedback, CallOrConstructBuiltinsAssembler) {
TF_BUILTIN(CallWithSpread, CallOrConstructBuiltinsAssembler) {
auto target = Parameter<Object>(Descriptor::kTarget);
base::Optional<TNode<Object>> new_target = base::nullopt;
std::optional<TNode<Object>> new_target = std::nullopt;
auto spread = Parameter<Object>(Descriptor::kSpread);
auto args_count = UncheckedParameter<Int32T>(Descriptor::kArgumentsCount);
auto context = Parameter<Context>(Descriptor::kContext);
@ -543,7 +545,7 @@ TF_BUILTIN(CallWithSpread, CallOrConstructBuiltinsAssembler) {
TF_BUILTIN(CallWithSpread_Baseline, CallOrConstructBuiltinsAssembler) {
auto target = Parameter<Object>(Descriptor::kTarget);
base::Optional<TNode<Object>> new_target = base::nullopt;
std::optional<TNode<Object>> new_target = std::nullopt;
auto spread = Parameter<Object>(Descriptor::kSpread);
auto args_count = UncheckedParameter<Int32T>(Descriptor::kArgumentsCount);
auto context = LoadContextFromBaseline();
@ -558,7 +560,7 @@ TF_BUILTIN(CallWithSpread_Baseline, CallOrConstructBuiltinsAssembler) {
TF_BUILTIN(CallWithSpread_WithFeedback, CallOrConstructBuiltinsAssembler) {
auto target = Parameter<Object>(Descriptor::kTarget);
base::Optional<TNode<Object>> new_target = base::nullopt;
std::optional<TNode<Object>> new_target = std::nullopt;
auto spread = Parameter<Object>(Descriptor::kSpread);
auto args_count = UncheckedParameter<Int32T>(Descriptor::kArgumentsCount);
auto context = Parameter<Context>(Descriptor::kContext);
@ -638,7 +640,7 @@ TNode<JSReceiver> CallOrConstructBuiltinsAssembler::GetCompatibleReceiver(
LoadObjectField<SharedFunctionInfo>(
var_template.value(), JSFunction::kSharedFunctionInfoOffset);
TNode<Object> template_data =
LoadSharedFunctionInfoFunctionData(template_shared);
LoadSharedFunctionInfoUntrustedFunctionData(template_shared);
GotoIf(TaggedIsSmi(template_data), &holder_next);
var_template = CAST(template_data);
Goto(&template_loop);
@ -880,7 +882,7 @@ TF_BUILTIN(HandleApiCallOrConstruct, CallOrConstructBuiltinsAssembler) {
TNode<SharedFunctionInfo> shared =
LoadJSFunctionSharedFunctionInfo(CAST(target));
TNode<FunctionTemplateInfo> function_template_info =
CAST(LoadSharedFunctionInfoFunctionData(shared));
CAST(LoadSharedFunctionInfoUntrustedFunctionData(shared));
// The topmost script-having context is not guaranteed to be equal to
// current context at this point. For example, if target function was

View file

@ -5,6 +5,8 @@
#ifndef V8_BUILTINS_BUILTINS_CALL_GEN_H_
#define V8_BUILTINS_BUILTINS_CALL_GEN_H_
#include <optional>
#include "src/codegen/code-stub-assembler.h"
namespace v8 {
@ -16,25 +18,25 @@ class CallOrConstructBuiltinsAssembler : public CodeStubAssembler {
: CodeStubAssembler(state) {}
void CallOrConstructWithArrayLike(TNode<Object> target,
base::Optional<TNode<Object>> new_target,
std::optional<TNode<Object>> new_target,
TNode<Object> arguments_list,
TNode<Context> context);
void CallOrConstructDoubleVarargs(TNode<Object> target,
base::Optional<TNode<Object>> new_target,
std::optional<TNode<Object>> new_target,
TNode<FixedDoubleArray> elements,
TNode<Int32T> length,
TNode<Int32T> args_count,
TNode<Context> context, TNode<Int32T> kind);
void CallOrConstructWithSpread(TNode<Object> target,
base::Optional<TNode<Object>> new_target,
std::optional<TNode<Object>> new_target,
TNode<Object> spread, TNode<Int32T> args_count,
TNode<Context> context);
template <class Descriptor>
void CallReceiver(Builtin id, base::Optional<TNode<Object>> = base::nullopt);
void CallReceiver(Builtin id, std::optional<TNode<Object>> = std::nullopt);
template <class Descriptor>
void CallReceiver(Builtin id, TNode<Int32T> argc, TNode<UintPtrT> slot,
base::Optional<TNode<Object>> = base::nullopt);
std::optional<TNode<Object>> = std::nullopt);
enum class CallFunctionTemplateMode : uint8_t {
// This version is for using from IC system and generic builtins like

View file

@ -347,8 +347,8 @@ TNode<JSObject> BaseCollectionsAssembler::AllocateJSCollection(
return Select<JSObject>(
is_target_unmodified,
[=] { return AllocateJSCollectionFast(constructor); },
[=] {
[=, this] { return AllocateJSCollectionFast(constructor); },
[=, this] {
return AllocateJSCollectionSlow(context, constructor, new_target);
});
}
@ -531,8 +531,9 @@ TNode<BoolT> BaseCollectionsAssembler::HasInitialCollectionPrototype(
TNode<Object> BaseCollectionsAssembler::LoadAndNormalizeFixedArrayElement(
TNode<FixedArray> elements, TNode<IntPtrT> index) {
TNode<Object> element = UnsafeLoadFixedArrayElement(elements, index);
return Select<Object>(IsTheHole(element), [=] { return UndefinedConstant(); },
[=] { return element; });
return Select<Object>(
IsTheHole(element), [=, this] { return UndefinedConstant(); },
[=] { return element; });
}
TNode<Object> BaseCollectionsAssembler::LoadAndNormalizeFixedDoubleArrayElement(

View file

@ -159,7 +159,7 @@ void ConsoleCall(
int context_id = 0;
Handle<String> context_name = isolate->factory()->anonymous_string();
if (!IsNativeContext(args.target()->context())) {
Handle<Context> context(args.target()->context(), isolate);
DirectHandle<Context> context(args.target()->context(), isolate);
CHECK_EQ(CONSOLE_CONTEXT_SLOTS, context->length());
context_id = Cast<Smi>(context->get(CONSOLE_CONTEXT_ID_INDEX)).value();
context_name =
@ -248,14 +248,13 @@ void InstallContextFunction(Isolate* isolate, Handle<JSObject> target,
Handle<SharedFunctionInfo> info =
factory->NewSharedFunctionInfoForBuiltin(name_string, builtin);
info->set_language_mode(LanguageMode::kSloppy);
info->set_native(true);
info->DontAdaptArguments();
info->set_length(1);
Handle<JSFunction> fun =
DirectHandle<JSFunction> fun =
Factory::JSFunctionBuilder{isolate, info, context}.set_map(map).Build();
fun->shared()->set_native(true);
fun->shared()->DontAdaptArguments();
fun->shared()->set_length(1);
JSObject::AddProperty(isolate, target, name_string, fun, NONE);
}

View file

@ -4,6 +4,8 @@
#include "src/builtins/builtins-constructor-gen.h"
#include <optional>
#include "src/ast/ast.h"
#include "src/builtins/builtins-call-gen.h"
#include "src/builtins/builtins-constructor.h"
@ -53,8 +55,8 @@ TF_BUILTIN(Construct_Baseline, CallOrConstructBuiltinsAssembler) {
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot);
BuildConstruct(
target, new_target, argc, [=] { return LoadContextFromBaseline(); },
[=] { return LoadFeedbackVectorFromBaseline(); }, slot,
target, new_target, argc, [=, this] { return LoadContextFromBaseline(); },
[=, this] { return LoadFeedbackVectorFromBaseline(); }, slot,
UpdateFeedbackMode::kGuaranteedFeedback);
}
@ -121,8 +123,8 @@ TF_BUILTIN(ConstructWithSpread_Baseline, CallOrConstructBuiltinsAssembler) {
auto slot = UncheckedParameter<TaggedIndex>(Descriptor::kSlot);
return BuildConstructWithSpread(
target, new_target, spread, args_count,
[=] { return LoadContextFromBaseline(); },
[=] { return LoadFeedbackVectorFromBaseline(); }, slot,
[=, this] { return LoadContextFromBaseline(); },
[=, this] { return LoadFeedbackVectorFromBaseline(); }, slot,
UpdateFeedbackMode::kGuaranteedFeedback);
}
@ -168,8 +170,8 @@ TF_BUILTIN(ConstructForwardAllArgs_Baseline, CallOrConstructBuiltinsAssembler) {
auto slot = UncheckedParameter<TaggedIndex>(Descriptor::kSlot);
return BuildConstructForwardAllArgs(
target, new_target, [=] { return LoadContextFromBaseline(); },
[=] { return LoadFeedbackVectorFromBaseline(); }, slot);
target, new_target, [=, this] { return LoadContextFromBaseline(); },
[=, this] { return LoadFeedbackVectorFromBaseline(); }, slot);
}
TF_BUILTIN(ConstructForwardAllArgs_WithFeedback,
@ -208,7 +210,7 @@ TF_BUILTIN(FastNewClosure, ConstructorBuiltinsAssembler) {
auto feedback_cell = Parameter<FeedbackCell>(Descriptor::kFeedbackCell);
auto context = Parameter<Context>(Descriptor::kContext);
// Bump the closure counter encoded the {feedback_cell}s map.
// Bump the closure counter encoded in the {feedback_cell}s map.
{
const TNode<Map> feedback_cell_map = LoadMap(feedback_cell);
Label no_closures(this), one_closure(this), cell_done(this);
@ -274,12 +276,21 @@ TF_BUILTIN(FastNewClosure, ConstructorBuiltinsAssembler) {
BIND(&done);
}
static_assert(JSFunction::kSizeWithoutPrototype == 7 * kTaggedSize);
static_assert(JSFunction::kSizeWithoutPrototype ==
(7 + V8_ENABLE_LEAPTIERING_BOOL) * kTaggedSize);
StoreObjectFieldNoWriteBarrier(result, JSFunction::kFeedbackCellOffset,
feedback_cell);
StoreObjectFieldNoWriteBarrier(result, JSFunction::kSharedFunctionInfoOffset,
shared_function_info);
StoreObjectFieldNoWriteBarrier(result, JSFunction::kContextOffset, context);
#ifdef V8_ENABLE_LEAPTIERING
TNode<JSDispatchHandleT> dispatch_handle = LoadObjectField<JSDispatchHandleT>(
feedback_cell, FeedbackCell::kDispatchHandleOffset);
CSA_DCHECK(this, Word32NotEqual(dispatch_handle,
Int32Constant(kNullJSDispatchHandle)));
StoreObjectFieldNoWriteBarrier(result, JSFunction::kDispatchHandleOffset,
dispatch_handle);
#endif // V8_ENABLE_LEAPTIERING
TNode<Code> lazy_builtin =
HeapConstantNoHole(BUILTIN_CODE(isolate(), CompileLazy));
StoreCodePointerField(result, JSFunction::kCodeOffset, lazy_builtin);
@ -357,7 +368,7 @@ TNode<JSObject> ConstructorBuiltinsAssembler::FastNewObject(
}
BIND(&instantiate_map);
return AllocateJSObjectFromMap(initial_map, properties.value(), base::nullopt,
return AllocateJSObjectFromMap(initial_map, properties.value(), std::nullopt,
AllocationFlag::kNone, kWithSlackTracking);
}
@ -403,7 +414,7 @@ TNode<Context> ConstructorBuiltinsAssembler::FastNewFunctionContext(
CodeStubAssembler::VariableList vars(0, zone());
BuildFastLoop<IntPtrT>(
vars, start_offset, size,
[=](TNode<IntPtrT> offset) {
[=, this](TNode<IntPtrT> offset) {
StoreObjectFieldNoWriteBarrier(function_context, offset, undefined);
},
kTaggedSize, LoopUnrollingMode::kYes, IndexAdvanceMode::kPost);
@ -449,10 +460,11 @@ TNode<JSRegExp> ConstructorBuiltinsAssembler::CreateRegExpLiteral(
StoreObjectFieldRoot(new_object, JSObject::kElementsOffset,
RootIndex::kEmptyFixedArray);
// Initialize JSRegExp fields.
StoreObjectFieldNoWriteBarrier(
new_object, JSRegExp::kDataOffset,
LoadObjectField(boilerplate,
RegExpBoilerplateDescription::kDataOffset));
StoreTrustedPointerField(
new_object, JSRegExp::kDataOffset, kRegExpDataIndirectPointerTag,
CAST(LoadTrustedPointerFromObject(
boilerplate, RegExpBoilerplateDescription::kDataOffset,
kRegExpDataIndirectPointerTag)));
StoreObjectFieldNoWriteBarrier(
new_object, JSRegExp::kSourceOffset,
LoadObjectField(boilerplate,
@ -533,10 +545,10 @@ TNode<JSArray> ConstructorBuiltinsAssembler::CreateEmptyArrayLiteral(
TNode<IntPtrT> zero_intptr = IntPtrConstant(0);
TNode<Smi> zero = SmiConstant(0);
Comment("Allocate JSArray");
base::Optional<TNode<AllocationSite>> site =
std::optional<TNode<AllocationSite>> site =
V8_ALLOCATION_SITE_TRACKING_BOOL
? base::make_optional(allocation_site.value())
: base::nullopt;
? std::make_optional(allocation_site.value())
: std::nullopt;
TNode<JSArray> result = AllocateJSArray(GetInitialFastElementsKind(),
array_map, zero_intptr, zero, site);
@ -691,7 +703,7 @@ TNode<HeapObject> ConstructorBuiltinsAssembler::CreateShallowObjectLiteral(
Comment("Copy in-object properties slow");
BuildFastLoop<IntPtrT>(
offset.value(), instance_size,
[=](TNode<IntPtrT> offset) {
[=, this](TNode<IntPtrT> offset) {
// TODO(ishell): value decompression is not necessary here.
TNode<Object> field = LoadObjectField(boilerplate, offset);
StoreObjectFieldNoWriteBarrier(copy, offset, field);
@ -728,7 +740,7 @@ void ConstructorBuiltinsAssembler::CopyMutableHeapNumbersInObject(
Comment("Copy mutable HeapNumber values");
BuildFastLoop<IntPtrT>(
start_offset, end_offset,
[=](TNode<IntPtrT> offset) {
[=, this](TNode<IntPtrT> offset) {
TNode<Object> field = LoadObjectField(copy, offset);
Label copy_heap_number(this, Label::kDeferred), continue_loop(this);
// We only have to clone complex field values.

View file

@ -61,7 +61,7 @@ namespace internal {
/* Adaptor for CPP builtins. */ \
TFC(AdaptorWithBuiltinExitFrame, CppBuiltinAdaptor)
#define BUILTIN_LIST_BASE_TIER1(CPP, TFJ, TSC, TFC, TFS, TFH, ASM) \
#define BUILTIN_LIST_BASE_TIER1(CPP, TSJ, TFJ, TSC, TFC, TFS, TFH, ASM) \
/* GC write barriers */ \
TFC(IndirectPointerBarrierSaveFP, IndirectPointerWriteBarrier) \
TFC(IndirectPointerBarrierIgnoreFP, IndirectPointerWriteBarrier) \
@ -359,10 +359,14 @@ namespace internal {
/* Special internal builtins */ \
CPP(EmptyFunction) \
CPP(Illegal) \
CPP(IllegalInvocationThrower) \
CPP(StrictPoisonPillThrower) \
CPP(UnsupportedThrower) \
TFJ(ReturnReceiver, kJSArgcReceiverSlots, kReceiver) \
\
/* AbstractModuleSource */ \
CPP(AbstractModuleSourceToStringTag) \
\
/* Array */ \
TFC(ArrayConstructor, JSTrampoline) \
TFC(ArrayConstructorImpl, ArrayConstructor) \
@ -614,8 +618,6 @@ namespace internal {
CPP(DisposableStackPrototypeMove) \
\
/* Async DisposabeStack*/ \
CPP(AsyncDisposableStackOnFulfilled) \
CPP(AsyncDisposableStackOnRejected) \
CPP(AsyncDisposeFromSyncDispose) \
\
/* Error */ \
@ -983,7 +985,7 @@ namespace internal {
/* ES #sec-string.fromcodepoint */ \
CPP(StringFromCodePoint) \
/* ES6 #sec-string.fromcharcode */ \
TFJ(StringFromCharCode, kDontAdaptArgumentsSentinel) \
IF_TSA(TSJ, TFJ)(StringFromCharCode, kDontAdaptArgumentsSentinel) \
/* ES6 #sec-string.prototype.lastindexof */ \
CPP(StringPrototypeLastIndexOf) \
/* ES #sec-string.prototype.matchAll */ \
@ -1035,6 +1037,111 @@ namespace internal {
TFJ(TypedArrayPrototypeMap, kDontAdaptArgumentsSentinel) \
\
/* Wasm */ \
IF_WASM_DRUMBRAKE(ASM, WasmInterpreterEntry, WasmDummy) \
IF_WASM_DRUMBRAKE(ASM, GenericJSToWasmInterpreterWrapper, WasmDummy) \
IF_WASM_DRUMBRAKE(ASM, WasmInterpreterCWasmEntry, WasmDummy) \
IF_WASM_DRUMBRAKE(ASM, GenericWasmToJSInterpreterWrapper, WasmDummy) \
\
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_I32LoadMem8S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_I32LoadMem8U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_I32LoadMem16S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_I32LoadMem16U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_I64LoadMem8S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_I64LoadMem8U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_I64LoadMem16S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_I64LoadMem16U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_I64LoadMem32S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_I64LoadMem32U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_I32LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_I64LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_F32LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2r_F64LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I32LoadMem8S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I32LoadMem8U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I32LoadMem16S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I32LoadMem16U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I64LoadMem8S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I64LoadMem8U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I64LoadMem16S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I64LoadMem16U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I64LoadMem32S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I64LoadMem32U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I32LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I64LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_F32LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_F64LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_I32LoadMem8S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_I32LoadMem8U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_I32LoadMem16S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_I32LoadMem16U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_I64LoadMem8S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_I64LoadMem8U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_I64LoadMem16S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_I64LoadMem16U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_I64LoadMem32S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_I64LoadMem32U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_I32LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_I64LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_F32LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2r_F64LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32LoadMem8S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32LoadMem8U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32LoadMem16S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32LoadMem16U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem8S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem8U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem16S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem16U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem32S, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem32U, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_F32LoadMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_F64LoadMem, WasmDummy) \
\
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32LoadMem8S_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32LoadMem8U_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32LoadMem16S_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32LoadMem16U_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem8S_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem8U_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem16S_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem16U_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem32S_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem32U_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32LoadMem_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadMem_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_F32LoadMem_LocalSet, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_F64LoadMem_LocalSet, WasmDummy) \
\
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I32StoreMem8, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I32StoreMem16, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I64StoreMem8, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I64StoreMem16, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I64StoreMem32, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I32StoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I64StoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_F32StoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_F64StoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32StoreMem8, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32StoreMem16, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64StoreMem8, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64StoreMem16, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64StoreMem32, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32StoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64StoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_F32StoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_F64StoreMem, WasmDummy) \
\
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I32LoadStoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_I64LoadStoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_F32LoadStoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, r2s_F64LoadStoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I32LoadStoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_I64LoadStoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_F32LoadStoreMem, WasmDummy) \
IF_WASM_DRUMBRAKE_INSTR_HANDLER(ASM, s2s_F64LoadStoreMem, WasmDummy) \
\
IF_WASM(ASM, JSToWasmWrapperAsm, WasmJSToWasmWrapper) \
IF_WASM(ASM, WasmReturnPromiseOnSuspendAsm, WasmJSToWasmWrapper) \
IF_WASM(ASM, WasmToJsWrapperAsm, WasmDummy) \
@ -1783,9 +1890,9 @@ namespace internal {
TFJ(StringFixedArrayFromIterable, kJSArgcReceiverSlots, kIterable) \
TFJ(TemporalInstantFixedArrayFromIterable, kJSArgcReceiverSlots, kIterable)
#define BUILTIN_LIST_BASE(CPP, TFJ, TSC, TFC, TFS, TFH, ASM) \
BUILTIN_LIST_BASE_TIER0(CPP, TFJ, TFC, TFS, TFH, ASM) \
BUILTIN_LIST_BASE_TIER1(CPP, TFJ, TSC, TFC, TFS, TFH, ASM)
#define BUILTIN_LIST_BASE(CPP, TSJ, TFJ, TSC, TFC, TFS, TFH, ASM) \
BUILTIN_LIST_BASE_TIER0(CPP, TFJ, TFC, TFS, TFH, ASM) \
BUILTIN_LIST_BASE_TIER1(CPP, TSJ, TFJ, TSC, TFC, TFS, TFH, ASM)
#ifdef V8_INTL_SUPPORT
#define BUILTIN_LIST_INTL(CPP, TFJ, TFS) \
@ -2022,10 +2129,10 @@ namespace internal {
CPP(StringPrototypeToUpperCase)
#endif // V8_INTL_SUPPORT
#define BUILTIN_LIST(CPP, TFJ, TSC, TFC, TFS, TFH, BCH, ASM) \
BUILTIN_LIST_BASE(CPP, TFJ, TSC, TFC, TFS, TFH, ASM) \
BUILTIN_LIST_FROM_TORQUE(CPP, TFJ, TFC, TFS, TFH, ASM) \
BUILTIN_LIST_INTL(CPP, TFJ, TFS) \
#define BUILTIN_LIST(CPP, TSJ, TFJ, TSC, TFC, TFS, TFH, BCH, ASM) \
BUILTIN_LIST_BASE(CPP, TSJ, TFJ, TSC, TFC, TFS, TFH, ASM) \
BUILTIN_LIST_FROM_TORQUE(CPP, TFJ, TFC, TFS, TFH, ASM) \
BUILTIN_LIST_INTL(CPP, TFJ, TFS) \
BUILTIN_LIST_BYTECODE_HANDLERS(BCH)
// See the comment on top of BUILTIN_LIST_BASE_TIER0 for an explanation of
@ -2033,10 +2140,10 @@ namespace internal {
#define BUILTIN_LIST_TIER0(CPP, TFJ, TFC, TFS, TFH, BCH, ASM) \
BUILTIN_LIST_BASE_TIER0(CPP, TFJ, TFC, TFS, TFH, ASM)
#define BUILTIN_LIST_TIER1(CPP, TFJ, TFC, TFS, TFH, BCH, ASM) \
BUILTIN_LIST_BASE_TIER1(CPP, TFJ, TFC, TFS, TFH, ASM) \
BUILTIN_LIST_FROM_TORQUE(CPP, TFJ, TFC, TFS, TFH, ASM) \
BUILTIN_LIST_INTL(CPP, TFJ, TFS) \
#define BUILTIN_LIST_TIER1(CPP, TSJ, TFJ, TFC, TFS, TFH, BCH, ASM) \
BUILTIN_LIST_BASE_TIER1(CPP, TSJ, TFJ, TFC, TFS, TFH, ASM) \
BUILTIN_LIST_FROM_TORQUE(CPP, TFJ, TFC, TFS, TFH, ASM) \
BUILTIN_LIST_INTL(CPP, TFJ, TFS) \
BUILTIN_LIST_BYTECODE_HANDLERS(BCH)
// The exception thrown in the following builtins are caught
@ -2059,37 +2166,50 @@ namespace internal {
#define IGNORE_BUILTIN(...)
#define BUILTIN_LIST_C(V) \
BUILTIN_LIST(V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
#define BUILTIN_LIST_C(V) \
BUILTIN_LIST(V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN)
#define BUILTIN_LIST_TFJ(V) \
BUILTIN_LIST(IGNORE_BUILTIN, V, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
#define BUILTIN_LIST_TSJ(V) \
BUILTIN_LIST(IGNORE_BUILTIN, V, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN)
#define BUILTIN_LIST_TSC(V) \
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, V, IGNORE_BUILTIN, \
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
#define BUILTIN_LIST_TFJ(V) \
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, V, IGNORE_BUILTIN, \
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN)
#define BUILTIN_LIST_TFC(V) \
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, V, \
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
#define BUILTIN_LIST_TSC(V) \
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, V, \
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN)
#define BUILTIN_LIST_TFC(V) \
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN)
#define BUILTIN_LIST_TFS(V) \
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
IGNORE_BUILTIN, V, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN)
#define BUILTIN_LIST_TFH(V) \
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN, V, IGNORE_BUILTIN, IGNORE_BUILTIN)
IGNORE_BUILTIN, IGNORE_BUILTIN, V, IGNORE_BUILTIN, \
IGNORE_BUILTIN)
#define BUILTIN_LIST_BCH(V) \
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN, IGNORE_BUILTIN, V, IGNORE_BUILTIN)
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, V, \
IGNORE_BUILTIN)
#define BUILTIN_LIST_A(V) \
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, V)
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
V)
} // namespace internal
} // namespace v8

View file

@ -29,6 +29,9 @@ namespace internal {
static_assert(kJSTarget == -1, "Unexpected kJSTarget index value"); \
};
#define DEFINE_TSJ_INTERFACE_DESCRIPTOR(...) \
DEFINE_TFJ_INTERFACE_DESCRIPTOR(__VA_ARGS__)
#define DEFINE_TSC_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor) \
using Builtin_##Name##_InterfaceDescriptor = InterfaceDescriptor##Descriptor;
@ -46,12 +49,15 @@ namespace internal {
#define DEFINE_ASM_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor) \
using Builtin_##Name##_InterfaceDescriptor = InterfaceDescriptor##Descriptor;
BUILTIN_LIST(IGNORE_BUILTIN, DEFINE_TFJ_INTERFACE_DESCRIPTOR,
DEFINE_TSC_INTERFACE_DESCRIPTOR, DEFINE_TFC_INTERFACE_DESCRIPTOR,
DEFINE_TFS_INTERFACE_DESCRIPTOR, DEFINE_TFH_INTERFACE_DESCRIPTOR,
IGNORE_BUILTIN, DEFINE_ASM_INTERFACE_DESCRIPTOR)
BUILTIN_LIST(IGNORE_BUILTIN, DEFINE_TSJ_INTERFACE_DESCRIPTOR,
DEFINE_TFJ_INTERFACE_DESCRIPTOR, DEFINE_TSC_INTERFACE_DESCRIPTOR,
DEFINE_TFC_INTERFACE_DESCRIPTOR, DEFINE_TFS_INTERFACE_DESCRIPTOR,
DEFINE_TFH_INTERFACE_DESCRIPTOR, IGNORE_BUILTIN,
DEFINE_ASM_INTERFACE_DESCRIPTOR)
#undef DEFINE_TFJ_INTERFACE_DESCRIPTOR
#undef DEFINE_TSJ_INTERFACE_DESCRIPTOR
#undef DEFINE_TSC_INTERFACE_DESCRIPTOR
#undef DEFINE_TFC_INTERFACE_DESCRIPTOR
#undef DEFINE_TFS_INTERFACE_DESCRIPTOR
#undef DEFINE_TFH_INTERFACE_DESCRIPTOR

View file

@ -84,11 +84,10 @@ MaybeHandle<Object> CreateDynamicFunction(Isolate* isolate,
// come from here.
Handle<JSFunction> function;
{
ASSIGN_RETURN_ON_EXCEPTION(
isolate, function,
Compiler::GetFunctionFromString(
handle(target->native_context(), isolate), source,
ONLY_SINGLE_FUNCTION_LITERAL, parameters_end_pos, is_code_like));
ASSIGN_RETURN_ON_EXCEPTION(isolate, function,
Compiler::GetFunctionFromString(
handle(target->native_context(), isolate),
source, parameters_end_pos, is_code_like));
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
@ -196,7 +195,7 @@ Tagged<Object> DoFunctionBind(Isolate* isolate, BuiltinArguments args,
// Allocate the bound function with the given {this_arg} and {args}.
Handle<JSReceiver> target = args.at<JSReceiver>(0);
Handle<JSAny> this_arg = isolate->factory()->undefined_value();
DirectHandle<JSAny> this_arg = isolate->factory()->undefined_value();
base::ScopedVector<Handle<Object>> argv(std::max(0, args.length() - 2));
if (args.length() > 1) {
this_arg = args.at<JSAny>(1);

View file

@ -239,7 +239,7 @@ TF_BUILTIN(SuspendGeneratorBaseline, GeneratorBuiltinsAssembler) {
auto parent_frame_pointer = LoadParentFramePointer();
BuildFastLoop<IntPtrT>(
IntPtrConstant(0), formal_parameter_count,
[=](TNode<IntPtrT> index) {
[=, this](TNode<IntPtrT> index) {
auto reg_index = IntPtrAdd(parameter_base_index, index);
TNode<Object> value = LoadFullTagged(parent_frame_pointer,
TimesSystemPointerSize(reg_index));
@ -258,7 +258,7 @@ TF_BUILTIN(SuspendGeneratorBaseline, GeneratorBuiltinsAssembler) {
CSA_CHECK(this, UintPtrLessThan(end_index, parameters_and_registers_length));
BuildFastLoop<IntPtrT>(
formal_parameter_count, end_index,
[=](TNode<IntPtrT> index) {
[=, this](TNode<IntPtrT> index) {
auto reg_index = IntPtrSub(register_base_index, index);
TNode<Object> value = LoadFullTagged(parent_frame_pointer,
TimesSystemPointerSize(reg_index));
@ -296,7 +296,7 @@ TF_BUILTIN(ResumeGeneratorBaseline, GeneratorBuiltinsAssembler) {
auto parent_frame_pointer = LoadParentFramePointer();
BuildFastLoop<IntPtrT>(
formal_parameter_count, end_index,
[=](TNode<IntPtrT> index) {
[=, this](TNode<IntPtrT> index) {
TNode<Object> value =
UnsafeLoadFixedArrayElement(parameters_and_registers, index);
auto reg_index = IntPtrSub(register_base_index, index);

View file

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/base/optional.h"
#include "src/builtins/builtins-utils-gen.h"
#include "src/builtins/builtins.h"
#include "src/codegen/code-stub-assembler-inl.h"
@ -159,7 +158,7 @@ void HandlerBuiltinsAssembler::Generate_ElementsTransitionAndStore(
// TODO(v8:8481): Pass from_kind and to_kind in feedback vector slots.
DispatchForElementsKindTransition(
LoadElementsKind(receiver), LoadMapElementsKind(map),
[=, &miss](ElementsKind from_kind, ElementsKind to_kind) {
[=, this, &miss](ElementsKind from_kind, ElementsKind to_kind) {
TransitionElementsKind(receiver, map, from_kind, to_kind, &miss);
EmitElementStore(receiver, key, value, to_kind, store_mode, &miss,
context, nullptr);
@ -305,7 +304,7 @@ void HandlerBuiltinsAssembler::Generate_StoreFastElementIC(
// TODO(v8:8481): Pass elements_kind in feedback vector slots.
DispatchByElementsKind(
LoadElementsKind(receiver),
[=, &miss, &maybe_converted_value](ElementsKind elements_kind) {
[=, this, &miss, &maybe_converted_value](ElementsKind elements_kind) {
EmitElementStore(receiver, key, value, elements_kind, store_mode, &miss,
context, &maybe_converted_value);
},

View file

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <optional>
#include "src/api/api.h"
#include "src/baseline/baseline.h"
#include "src/builtins/builtins-inl.h"
@ -974,8 +976,8 @@ class SetOrCopyDataPropertiesAssembler : public CodeStubAssembler {
TNode<Object> SetOrCopyDataProperties(
TNode<Context> context, TNode<JSReceiver> target, TNode<Object> source,
Label* if_runtime,
base::Optional<TNode<IntPtrT>> excluded_property_count = base::nullopt,
base::Optional<TNode<IntPtrT>> excluded_property_base = base::nullopt,
std::optional<TNode<IntPtrT>> excluded_property_count = std::nullopt,
std::optional<TNode<IntPtrT>> excluded_property_base = std::nullopt,
bool use_set = true) {
Label if_done(this), if_noelements(this),
if_sourcenotjsobject(this, Label::kDeferred);
@ -1009,7 +1011,7 @@ class SetOrCopyDataPropertiesAssembler : public CodeStubAssembler {
TNode<BoolT> target_is_simple_receiver = IsSimpleObjectMap(target_map);
ForEachEnumerableOwnProperty(
context, source_map, CAST(source), kEnumerationOrder,
[=](TNode<Name> key, LazyNode<Object> value) {
[=, this](TNode<Name> key, LazyNode<Object> value) {
KeyedStoreGenericGenerator::SetProperty(
state(), context, target, target_is_simple_receiver, key,
value(), LanguageMode::kStrict);
@ -1018,7 +1020,7 @@ class SetOrCopyDataPropertiesAssembler : public CodeStubAssembler {
} else {
ForEachEnumerableOwnProperty(
context, source_map, CAST(source), kEnumerationOrder,
[=](TNode<Name> key, LazyNode<Object> value) {
[=, this](TNode<Name> key, LazyNode<Object> value) {
Label skip(this);
if (excluded_property_count.has_value()) {
BuildFastLoop<IntPtrT>(
@ -1125,8 +1127,8 @@ TF_BUILTIN(CopyDataProperties, SetOrCopyDataPropertiesAssembler) {
CSA_DCHECK(this, TaggedNotEqual(target, source));
Label if_runtime(this, Label::kDeferred);
SetOrCopyDataProperties(context, target, source, &if_runtime, base::nullopt,
base::nullopt, false);
SetOrCopyDataProperties(context, target, source, &if_runtime, std::nullopt,
std::nullopt, false);
Return(UndefinedConstant());
BIND(&if_runtime);
@ -1140,8 +1142,8 @@ TF_BUILTIN(SetDataProperties, SetOrCopyDataPropertiesAssembler) {
Label if_runtime(this, Label::kDeferred);
GotoIfForceSlowPath(&if_runtime);
SetOrCopyDataProperties(context, target, source, &if_runtime, base::nullopt,
base::nullopt, true);
SetOrCopyDataProperties(context, target, source, &if_runtime, std::nullopt,
std::nullopt, true);
Return(UndefinedConstant());
BIND(&if_runtime);
@ -1449,9 +1451,10 @@ TF_BUILTIN(GetProperty, CodeStubAssembler) {
if_slow(this, Label::kDeferred);
CodeStubAssembler::LookupPropertyInHolder lookup_property_in_holder =
[=](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<Name> unique_name, Label* next_holder, Label* if_bailout) {
[=, this](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<Name> unique_name, Label* next_holder,
Label* if_bailout) {
TVARIABLE(Object, var_value);
Label if_found(this);
// If we get here then it's guaranteed that |object| (and thus the
@ -1465,9 +1468,9 @@ TF_BUILTIN(GetProperty, CodeStubAssembler) {
};
CodeStubAssembler::LookupElementInHolder lookup_element_in_holder =
[=](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<IntPtrT> index, Label* next_holder, Label* if_bailout) {
[=, this](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<IntPtrT> index, Label* next_holder, Label* if_bailout) {
// Not supported yet.
Use(next_holder);
Goto(if_bailout);
@ -1507,9 +1510,10 @@ TF_BUILTIN(GetPropertyWithReceiver, CodeStubAssembler) {
if_slow(this, Label::kDeferred);
CodeStubAssembler::LookupPropertyInHolder lookup_property_in_holder =
[=](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<Name> unique_name, Label* next_holder, Label* if_bailout) {
[=, this](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<Name> unique_name, Label* next_holder,
Label* if_bailout) {
TVARIABLE(Object, var_value);
Label if_found(this);
TryGetOwnProperty(context, receiver, CAST(holder), holder_map,
@ -1521,9 +1525,9 @@ TF_BUILTIN(GetPropertyWithReceiver, CodeStubAssembler) {
};
CodeStubAssembler::LookupElementInHolder lookup_element_in_holder =
[=](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<IntPtrT> index, Label* next_holder, Label* if_bailout) {
[=, this](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<IntPtrT> index, Label* next_holder, Label* if_bailout) {
// Not supported yet.
Use(next_holder);
Goto(if_bailout);

View file

@ -15,6 +15,12 @@ BUILTIN(Illegal) {
UNREACHABLE();
}
BUILTIN(IllegalInvocationThrower) {
HandleScope scope(isolate);
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kIllegalInvocation));
}
BUILTIN(EmptyFunction) { return ReadOnlyRoots(isolate).undefined_value(); }
BUILTIN(UnsupportedThrower) {

View file

@ -157,11 +157,8 @@ void IntlBuiltinsAssembler::ToLowerCaseImpl(
const TNode<Uint32T> length = LoadStringLengthAsWord32(string);
GotoIf(Word32Equal(length, Uint32Constant(0)), &return_string);
const TNode<Int32T> instance_type = to_direct.instance_type();
CSA_DCHECK(this,
Word32BinaryNot(IsIndirectStringInstanceType(instance_type)));
GotoIfNot(IsOneByteStringInstanceType(instance_type), &runtime);
const TNode<BoolT> is_one_byte = to_direct.IsOneByte();
GotoIfNot(is_one_byte, &runtime);
// For short strings, do the conversion in CSA through the lookup table.

View file

@ -602,7 +602,7 @@ BUILTIN(DateTimeFormatInternalFormat) {
// 1. Let dtf be F.[[DateTimeFormat]].
// 2. Assert: Type(dtf) is Object and dtf has an [[InitializedDateTimeFormat]]
// internal slot.
Handle<JSDateTimeFormat> date_format_holder = Handle<JSDateTimeFormat>(
DirectHandle<JSDateTimeFormat> date_format_holder(
Cast<JSDateTimeFormat>(context->get(
static_cast<int>(Intl::BoundFunctionContextSlot::kBoundFunction))),
isolate);

View file

@ -4,6 +4,8 @@
#include "src/builtins/builtins-iterator-gen.h"
#include <optional>
#include "src/builtins/builtins-collections-gen.h"
#include "src/builtins/builtins-string-gen.h"
#include "src/builtins/builtins-utils-gen.h"
@ -61,7 +63,7 @@ IteratorRecord IteratorBuiltinsAssembler::GetIterator(TNode<Context> context,
TNode<JSReceiver> IteratorBuiltinsAssembler::IteratorStep(
TNode<Context> context, const IteratorRecord& iterator, Label* if_done,
base::Optional<TNode<Map>> fast_iterator_result_map) {
std::optional<TNode<Map>> fast_iterator_result_map) {
DCHECK_NOT_NULL(if_done);
// 1. a. Let result be ? Invoke(iterator, "next", « »).
TNode<Object> result = Call(context, iterator.next, iterator.object);
@ -89,7 +91,7 @@ TNode<JSReceiver> IteratorBuiltinsAssembler::IteratorStep(
void IteratorBuiltinsAssembler::IteratorComplete(
TNode<Context> context, const TNode<HeapObject> iterator, Label* if_done,
base::Optional<TNode<Map>> fast_iterator_result_map) {
std::optional<TNode<Map>> fast_iterator_result_map) {
DCHECK_NOT_NULL(if_done);
Label return_result(this);
@ -124,7 +126,7 @@ void IteratorBuiltinsAssembler::IteratorComplete(
TNode<Object> IteratorBuiltinsAssembler::IteratorValue(
TNode<Context> context, TNode<JSReceiver> result,
base::Optional<TNode<Map>> fast_iterator_result_map) {
std::optional<TNode<Map>> fast_iterator_result_map) {
Label exit(this);
TVARIABLE(Object, var_value);
if (fast_iterator_result_map) {

View file

@ -35,20 +35,20 @@ class IteratorBuiltinsAssembler : public CodeStubAssembler {
// object, loaded from the native context.
TNode<JSReceiver> IteratorStep(
TNode<Context> context, const IteratorRecord& iterator, Label* if_done,
base::Optional<TNode<Map>> fast_iterator_result_map = base::nullopt);
std::optional<TNode<Map>> fast_iterator_result_map = std::nullopt);
TNode<JSReceiver> IteratorStep(
TNode<Context> context, const IteratorRecord& iterator,
base::Optional<TNode<Map>> fast_iterator_result_map, Label* if_done) {
std::optional<TNode<Map>> fast_iterator_result_map, Label* if_done) {
return IteratorStep(context, iterator, if_done, fast_iterator_result_map);
}
// https://tc39.es/ecma262/#sec-iteratorcomplete
void IteratorComplete(
TNode<Context> context, const TNode<HeapObject> iterator, Label* if_done,
base::Optional<TNode<Map>> fast_iterator_result_map = base::nullopt);
std::optional<TNode<Map>> fast_iterator_result_map = std::nullopt);
void IteratorComplete(TNode<Context> context,
const TNode<HeapObject> iterator,
base::Optional<TNode<Map>> fast_iterator_result_map,
std::optional<TNode<Map>> fast_iterator_result_map,
Label* if_done) {
return IteratorComplete(context, iterator, if_done,
fast_iterator_result_map);
@ -60,7 +60,7 @@ class IteratorBuiltinsAssembler : public CodeStubAssembler {
// object, loaded from the native context.
TNode<Object> IteratorValue(
TNode<Context> context, TNode<JSReceiver> result,
base::Optional<TNode<Map>> fast_iterator_result_map = base::nullopt);
std::optional<TNode<Map>> fast_iterator_result_map = std::nullopt);
void Iterate(TNode<Context> context, TNode<Object> iterable,
std::function<void(TNode<Object>)> func,

View file

@ -144,7 +144,7 @@ void LazyBuiltinsAssembler::CompileLazy(TNode<JSFunction> function) {
// Ensure we have a feedback vector.
code = Select<Code>(
IsFeedbackVector(feedback_cell_value), [=]() { return sfi_code; },
[=]() {
[=, this]() {
return CAST(CallRuntime(Runtime::kInstallBaselineCode,
Parameter<Context>(Descriptor::kContext),
function));

View file

@ -515,7 +515,7 @@ void MicrotaskQueueBuiltinsAssembler::RunPromiseHook(
// Get to the underlying JSPromise instance.
TNode<HeapObject> promise = Select<HeapObject>(
IsPromiseCapability(promise_or_capability),
[=] {
[=, this] {
return CAST(LoadObjectField(promise_or_capability,
PromiseCapability::kPromiseOffset));
},

View file

@ -144,21 +144,33 @@ DEF_UNOP(Increment_Baseline, Generate_IncrementWithFeedback)
DEF_UNOP(Negate_Baseline, Generate_NegateWithFeedback)
#undef DEF_UNOP
#define DEF_COMPARE(Name) \
TF_BUILTIN(Name##_WithFeedback, CodeStubAssembler) { \
auto lhs = Parameter<Object>(Descriptor::kLeft); \
auto rhs = Parameter<Object>(Descriptor::kRight); \
auto context = Parameter<Context>(Descriptor::kContext); \
auto feedback_vector = \
Parameter<FeedbackVector>(Descriptor::kFeedbackVector); \
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot); \
\
TVARIABLE(Smi, var_type_feedback); \
TNode<Boolean> result = RelationalComparison(Operation::k##Name, lhs, rhs, \
context, &var_type_feedback); \
UpdateFeedback(var_type_feedback.value(), feedback_vector, slot); \
\
Return(result); \
#define DEF_COMPARE(Name) \
TF_BUILTIN(Name##_WithFeedback, CodeStubAssembler) { \
auto lhs = Parameter<Object>(Descriptor::kLeft); \
auto rhs = Parameter<Object>(Descriptor::kRight); \
auto context = Parameter<Context>(Descriptor::kContext); \
auto feedback_vector = \
Parameter<FeedbackVector>(Descriptor::kFeedbackVector); \
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot); \
\
TVARIABLE(Smi, var_type_feedback); \
TVARIABLE(Object, var_exception); \
Label if_exception(this, Label::kDeferred); \
TNode<Boolean> result; \
{ \
ScopedExceptionHandler handler(this, &if_exception, &var_exception); \
result = RelationalComparison(Operation::k##Name, lhs, rhs, context, \
&var_type_feedback); \
} \
UpdateFeedback(var_type_feedback.value(), feedback_vector, slot); \
\
Return(result); \
BIND(&if_exception); \
{ \
UpdateFeedback(var_type_feedback.value(), feedback_vector, slot); \
CallRuntime(Runtime::kReThrow, context, var_exception.value()); \
Unreachable(); \
} \
}
DEF_COMPARE(LessThan)
DEF_COMPARE(LessThanOrEqual)
@ -166,20 +178,34 @@ DEF_COMPARE(GreaterThan)
DEF_COMPARE(GreaterThanOrEqual)
#undef DEF_COMPARE
#define DEF_COMPARE(Name) \
TF_BUILTIN(Name##_Baseline, CodeStubAssembler) { \
auto lhs = Parameter<Object>(Descriptor::kLeft); \
auto rhs = Parameter<Object>(Descriptor::kRight); \
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot); \
\
TVARIABLE(Smi, var_type_feedback); \
TNode<Boolean> result = RelationalComparison( \
Operation::k##Name, lhs, rhs, \
[&]() { return LoadContextFromBaseline(); }, &var_type_feedback); \
auto feedback_vector = LoadFeedbackVectorFromBaseline(); \
UpdateFeedback(var_type_feedback.value(), feedback_vector, slot); \
\
Return(result); \
#define DEF_COMPARE(Name) \
TF_BUILTIN(Name##_Baseline, CodeStubAssembler) { \
auto lhs = Parameter<Object>(Descriptor::kLeft); \
auto rhs = Parameter<Object>(Descriptor::kRight); \
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot); \
\
TVARIABLE(Smi, var_type_feedback); \
TVARIABLE(Object, var_exception); \
Label if_exception(this, Label::kDeferred); \
TNode<Boolean> result; \
{ \
ScopedExceptionHandler handler(this, &if_exception, &var_exception); \
result = RelationalComparison( \
Operation::k##Name, lhs, rhs, \
[&]() { return LoadContextFromBaseline(); }, &var_type_feedback); \
} \
auto feedback_vector = LoadFeedbackVectorFromBaseline(); \
UpdateFeedback(var_type_feedback.value(), feedback_vector, slot); \
\
Return(result); \
BIND(&if_exception); \
{ \
auto feedback_vector = LoadFeedbackVectorFromBaseline(); \
UpdateFeedback(var_type_feedback.value(), feedback_vector, slot); \
CallRuntime(Runtime::kReThrow, LoadContextFromBaseline(), \
var_exception.value()); \
Unreachable(); \
} \
}
DEF_COMPARE(LessThan)
DEF_COMPARE(LessThanOrEqual)
@ -195,11 +221,21 @@ TF_BUILTIN(Equal_WithFeedback, CodeStubAssembler) {
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot);
TVARIABLE(Smi, var_type_feedback);
TNode<Boolean> result = Equal(
lhs, rhs, [&]() { return context; }, &var_type_feedback);
TVARIABLE(Object, var_exception);
Label if_exception(this, Label::kDeferred);
TNode<Boolean> result;
{
ScopedExceptionHandler handler(this, &if_exception, &var_exception);
result = Equal(lhs, rhs, [&]() { return context; }, &var_type_feedback);
}
UpdateFeedback(var_type_feedback.value(), feedback_vector, slot);
Return(result);
BIND(&if_exception);
UpdateFeedback(var_type_feedback.value(), feedback_vector, slot);
CallRuntime(Runtime::kReThrow, LoadContextFromBaseline(),
var_exception.value());
Unreachable();
}
TF_BUILTIN(StrictEqual_WithFeedback, CodeStubAssembler) {
@ -221,13 +257,27 @@ TF_BUILTIN(Equal_Baseline, CodeStubAssembler) {
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot);
TVARIABLE(Smi, var_type_feedback);
TNode<Boolean> result = Equal(
lhs, rhs, [&]() { return LoadContextFromBaseline(); },
&var_type_feedback);
TVARIABLE(Object, var_exception);
Label if_exception(this, Label::kDeferred);
TNode<Boolean> result;
{
ScopedExceptionHandler handler(this, &if_exception, &var_exception);
result = Equal(
lhs, rhs, [&]() { return LoadContextFromBaseline(); },
&var_type_feedback);
}
auto feedback_vector = LoadFeedbackVectorFromBaseline();
UpdateFeedback(var_type_feedback.value(), feedback_vector, slot);
Return(result);
BIND(&if_exception);
{
auto feedback_vector = LoadFeedbackVectorFromBaseline();
UpdateFeedback(var_type_feedback.value(), feedback_vector, slot);
CallRuntime(Runtime::kReThrow, LoadContextFromBaseline(),
var_exception.value());
Unreachable();
}
}
TF_BUILTIN(StrictEqual_Baseline, CodeStubAssembler) {

View file

@ -4,6 +4,8 @@
#include "src/builtins/builtins-object-gen.h"
#include <optional>
#include "src/builtins/builtins-constructor-gen.h"
#include "src/builtins/builtins-inl.h"
#include "src/builtins/builtins-utils-gen.h"
@ -17,6 +19,7 @@
#include "src/objects/property-descriptor-object.h"
#include "src/objects/property-details.h"
#include "src/objects/shared-function-info.h"
#include "src/objects/transitions.h"
namespace v8 {
namespace internal {
@ -284,7 +287,7 @@ TNode<JSArray> ObjectEntriesValuesBuiltinsAssembler::FastGetOwnValuesOrEntries(
TNode<JSArray> array;
TNode<FixedArrayBase> elements;
std::tie(array, elements) = AllocateUninitializedJSArrayWithElements(
PACKED_ELEMENTS, array_map, SmiConstant(2), base::nullopt,
PACKED_ELEMENTS, array_map, SmiConstant(2), std::nullopt,
IntPtrConstant(2));
StoreFixedArrayElement(CAST(elements), 0, next_key, SKIP_WRITE_BARRIER);
StoreFixedArrayElement(CAST(elements), 1, value, SKIP_WRITE_BARRIER);
@ -409,7 +412,6 @@ TF_BUILTIN(ObjectAssign, ObjectBuiltinsAssembler) {
TNode<IntPtrT> args_length = args.GetLengthWithoutReceiver();
GotoIf(UintPtrLessThanOrEqual(args_length, IntPtrConstant(1)), &done);
#ifdef V8_OBJECT_ASSIGN_FASTCASE
// First let's try a fastpath specifically for when the target objects is an
// empty object literal.
// TODO(olivf): For the cases where we could detect that the object literal
@ -486,31 +488,78 @@ TF_BUILTIN(ObjectAssign, ObjectBuiltinsAssembler) {
GotoIfNot(TaggedEqual(LoadElements(CAST(to)), EmptyFixedArrayConstant()),
&slow_path);
Label continue_fast_path(this), runtime_map_lookup(this, Label::kDeferred);
// Check if our particular source->target combination is fast clonable.
// E.g., this ensures that we only have fast properties and in general that
// the binary layout is compatible for `FastCloneJSObject`.
// TODO(olivf): Add a fastcase to read the cached target map from the
// transition array without going through the runtime.
Label continue_fast_path(this);
// If suche a clone map exists then it can be found in the transition array
// with object_assign_clone_transition_symbol as a key. If this transition
// slot is cleared, then the map is not clonable. If the key is missing
// from the transitions we rely on the runtime function
// ObjectAssignTryFastcase that does the actual computation.
TVARIABLE(Map, clone_map);
{
// First check if we have a transition array.
TNode<MaybeObject> maybe_transitions = LoadMaybeWeakObjectField(
from_map, Map::kTransitionsOrPrototypeInfoOffset);
TNode<HeapObject> maybe_transitions2 =
GetHeapObjectIfStrong(maybe_transitions, &runtime_map_lookup);
GotoIfNot(IsTransitionArrayMap(LoadMap(maybe_transitions2)),
&runtime_map_lookup);
TNode<WeakFixedArray> transitions = CAST(maybe_transitions2);
TNode<Object> side_step_transitions = CAST(LoadWeakFixedArrayElement(
transitions,
IntPtrConstant(TransitionArray::kSideStepTransitionsIndex)));
GotoIf(TaggedIsSmi(side_step_transitions), &runtime_map_lookup);
TNode<MaybeObject> maybe_target_map = LoadWeakFixedArrayElement(
CAST(side_step_transitions),
IntPtrConstant(SideStepTransition::index_of(
SideStepTransition::Kind::kObjectAssign)));
GotoIf(TaggedEqual(maybe_target_map,
SmiConstant(SideStepTransition::Unreachable)),
&slow_path);
GotoIf(
TaggedEqual(maybe_target_map, SmiConstant(SideStepTransition::Empty)),
&runtime_map_lookup);
TNode<Map> target_map =
CAST(GetHeapObjectAssumeWeak(maybe_target_map, &runtime_map_lookup));
GotoIf(IsDeprecatedMap(target_map), &runtime_map_lookup);
TNode<MaybeObject> maybe_validity_cell = LoadWeakFixedArrayElement(
CAST(side_step_transitions),
IntPtrConstant(SideStepTransition::index_of(
SideStepTransition::Kind::kObjectAssignValidityCell)));
TNode<Cell> validity_cell = CAST(
GetHeapObjectAssumeWeak(maybe_validity_cell, &runtime_map_lookup));
GotoIfNot(TaggedEqual(LoadCellValue(validity_cell),
SmiConstant(Map::kPrototypeChainValid)),
&runtime_map_lookup);
clone_map = target_map;
}
Goto(&continue_fast_path);
BIND(&runtime_map_lookup);
TNode<HeapObject> maybe_clone_map =
CAST(CallRuntime(Runtime::kObjectAssignTryFastcase, context, from, to));
GotoIf(TaggedEqual(maybe_clone_map, UndefinedConstant()), &slow_path);
GotoIf(TaggedEqual(maybe_clone_map, TrueConstant()), &done_fast_path);
CSA_DCHECK(this, IsMap(maybe_clone_map));
clone_map = CAST(maybe_clone_map);
Goto(&continue_fast_path);
BIND(&continue_fast_path);
TNode<Map> clone_map = CAST(maybe_clone_map);
CSA_DCHECK(this, IntPtrEqual(LoadMapInstanceSizeInWords(to_map),
LoadMapInstanceSizeInWords(clone_map)));
CSA_DCHECK(this,
IntPtrEqual(LoadMapInobjectPropertiesStartInWords(to_map),
LoadMapInobjectPropertiesStartInWords(clone_map)));
IntPtrEqual(LoadMapInstanceSizeInWords(to_map),
LoadMapInstanceSizeInWords(clone_map.value())));
CSA_DCHECK(
this,
IntPtrEqual(LoadMapInobjectPropertiesStartInWords(to_map),
LoadMapInobjectPropertiesStartInWords(clone_map.value())));
FastCloneJSObject(
from, from_map, clone_map,
from, from_map, clone_map.value(),
[&](TNode<Map> map, TNode<HeapObject> properties,
TNode<FixedArray> elements) {
StoreMap(to, clone_map);
StoreMap(to, clone_map.value());
StoreJSReceiverPropertiesOrHash(to, properties);
StoreJSObjectElements(CAST(to), elements);
return to;
@ -527,14 +576,13 @@ TF_BUILTIN(ObjectAssign, ObjectBuiltinsAssembler) {
&done);
}
BIND(&slow_path);
#endif // V8_OBJECT_ASSIGN_FASTCASE
// 3. Let sources be the List of argument values starting with the
// second argument.
// 4. For each element nextSource of sources, in ascending index order,
{
args.ForEach(
[=](TNode<Object> next_source) {
[=, this](TNode<Object> next_source) {
CallBuiltin(Builtin::kSetDataProperties, context, to, next_source);
},
slow_path_index.value());
@ -599,7 +647,7 @@ TF_BUILTIN(ObjectKeys, ObjectBuiltinsAssembler) {
TNode<IntPtrT> object_enum_length_intptr = Signed(object_enum_length);
TNode<Smi> array_length = SmiTag(object_enum_length_intptr);
std::tie(array, elements) = AllocateUninitializedJSArrayWithElements(
PACKED_ELEMENTS, array_map, array_length, base::nullopt,
PACKED_ELEMENTS, array_map, array_length, std::nullopt,
object_enum_length_intptr);
CopyFixedArrayElements(PACKED_ELEMENTS, object_enum_keys, elements,
object_enum_length_intptr, SKIP_WRITE_BARRIER);
@ -729,7 +777,7 @@ TF_BUILTIN(ObjectGetOwnPropertyNames, ObjectBuiltinsAssembler) {
TNode<IntPtrT> object_enum_length_intptr = Signed(object_enum_length);
TNode<Smi> array_length = SmiTag(object_enum_length_intptr);
std::tie(array, elements) = AllocateUninitializedJSArrayWithElements(
PACKED_ELEMENTS, array_map, array_length, base::nullopt,
PACKED_ELEMENTS, array_map, array_length, std::nullopt,
object_enum_length_intptr);
CopyFixedArrayElements(PACKED_ELEMENTS, object_enum_keys, elements,
object_enum_length_intptr, SKIP_WRITE_BARRIER);
@ -1110,12 +1158,12 @@ TF_BUILTIN(ObjectToString, ObjectBuiltinsAssembler) {
TNode<Object> receiver_is_array =
CallRuntime(Runtime::kArrayIsArray, context, receiver_heap_object);
TNode<String> builtin_tag = Select<String>(
IsTrue(receiver_is_array), [=] { return ArrayStringConstant(); },
[=] {
IsTrue(receiver_is_array), [=, this] { return ArrayStringConstant(); },
[=, this] {
return Select<String>(
IsCallableMap(receiver_map),
[=] { return FunctionStringConstant(); },
[=] { return ObjectStringConstant(); });
[=, this] { return FunctionStringConstant(); },
[=, this] { return ObjectStringConstant(); });
});
// Lookup the @@toStringTag property on the {receiver_heap_object}.
@ -1352,7 +1400,7 @@ TF_BUILTIN(CreateGeneratorObject, ObjectBuiltinsAssembler) {
IntPtrConstant(0), size, RootIndex::kUndefinedValue);
// TODO(cbruni): support start_offset to avoid double initialization.
TNode<JSObject> result =
AllocateJSObjectFromMap(map, base::nullopt, base::nullopt,
AllocateJSObjectFromMap(map, std::nullopt, std::nullopt,
AllocationFlag::kNone, kWithSlackTracking);
StoreObjectFieldNoWriteBarrier(result, JSGeneratorObject::kFunctionOffset,
closure);

View file

@ -78,12 +78,8 @@ TNode<JSFunction> ProxiesCodeStubAssembler::AllocateProxyRevokeFunction(
const TNode<Context> proxy_context =
CreateProxyRevokeFunctionContext(proxy, native_context);
const TNode<Map> revoke_map = CAST(LoadContextElement(
native_context, Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX));
const TNode<SharedFunctionInfo> revoke_info = ProxyRevokeSharedFunConstant();
return AllocateFunctionWithMapAndContext(revoke_map, revoke_info,
proxy_context);
return AllocateRootFunctionWithContext(RootIndex::kProxyRevokeSharedFun,
proxy_context);
}
TF_BUILTIN(CallProxy, ProxiesCodeStubAssembler) {

Some files were not shown because too many files have changed in this diff Show more