deps: update V8 to 6.7.288.43
PR-URL: https://github.com/nodejs/node/pull/19989 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matheus Marchini <matheus@sthima.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Myles Borins <myles.borins@gmail.com>
This commit is contained in:
parent
faf449ca04
commit
352a525eb9
19
deps/v8/.gitignore
vendored
19
deps/v8/.gitignore
vendored
@ -49,24 +49,25 @@
|
||||
/test/fuzzer/wasm_corpus.tar.gz
|
||||
/test/mozilla/data
|
||||
/test/test262/data
|
||||
/test/test262/data.tar
|
||||
/test/test262/harness
|
||||
/test/wasm-js
|
||||
/test/wasm-spec-tests/tests
|
||||
/test/wasm-spec-tests/tests.tar.gz
|
||||
/testing/gmock
|
||||
/testing/gtest/*
|
||||
!/testing/gtest/include
|
||||
/testing/gtest/include/*
|
||||
!/testing/gtest/include/gtest
|
||||
/testing/gtest/include/gtest/*
|
||||
!/testing/gtest/include/gtest/gtest_prod.h
|
||||
/third_party/*
|
||||
!/third_party/antlr4
|
||||
!/third_party/binutils
|
||||
!/third_party/eu-strip
|
||||
!/third_party/inspector_protocol
|
||||
!/third_party/colorama
|
||||
/third_party/colorama/src
|
||||
!/third_party/googletest
|
||||
/third_party/googletest/src/*
|
||||
!/third_party/googletest/src/googletest
|
||||
/third_party/googletest/src/googletest/*
|
||||
!/third_party/googletest/src/googletest/include
|
||||
/third_party/googletest/src/googletest/include/*
|
||||
!/third_party/googletest/src/googletest/include/gtest
|
||||
/third_party/googletest/src/googletest/include/gtest/*
|
||||
!/third_party/googletest/src/googletest/include/gtest/gtest_prod.h
|
||||
/tools/clang
|
||||
/tools/gcmole/gcmole-tools
|
||||
/tools/gcmole/gcmole-tools.tar.gz
|
||||
|
3
deps/v8/.gn
vendored
3
deps/v8/.gn
vendored
@ -21,5 +21,4 @@ check_targets = []
|
||||
# These are the list of GN files that run exec_script. This whitelist exists
|
||||
# to force additional review for new uses of exec_script, which is strongly
|
||||
# discouraged except for gypi_to_gn calls.
|
||||
exec_script_whitelist =
|
||||
build_dotfile_settings.exec_script_whitelist + [ "//test/test262/BUILD.gn" ]
|
||||
exec_script_whitelist = build_dotfile_settings.exec_script_whitelist + []
|
||||
|
13
deps/v8/.vpython
vendored
13
deps/v8/.vpython
vendored
@ -30,3 +30,16 @@ wheel: <
|
||||
name: "infra/python/wheels/psutil/${vpython_platform}"
|
||||
version: "version:5.2.2"
|
||||
>
|
||||
|
||||
# Used by:
|
||||
# build/toolchain/win
|
||||
wheel: <
|
||||
name: "infra/python/wheels/pypiwin32/${vpython_platform}"
|
||||
version: "version:219"
|
||||
match_tag: <
|
||||
platform: "win32"
|
||||
>
|
||||
match_tag: <
|
||||
platform: "win_amd64"
|
||||
>
|
||||
>
|
||||
|
4
deps/v8/AUTHORS
vendored
4
deps/v8/AUTHORS
vendored
@ -70,7 +70,6 @@ Felix Geisendörfer <haimuiba@gmail.com>
|
||||
Filipe David Manana <fdmanana@gmail.com>
|
||||
Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
|
||||
Geoffrey Garside <ggarside@gmail.com>
|
||||
Gus Caplan <me@gus.host>
|
||||
Gwang Yoon Hwang <ryumiel@company100.net>
|
||||
Henrique Ferreiro <henrique.ferreiro@gmail.com>
|
||||
Hirofumi Mako <mkhrfm@gmail.com>
|
||||
@ -99,6 +98,7 @@ Maciej Małecki <me@mmalecki.com>
|
||||
Marcin Cieślak <saper@marcincieslak.com>
|
||||
Marcin Wiącek <marcin@mwiacek.com>
|
||||
Mateusz Czeladka <mateusz.szczap@gmail.com>
|
||||
Matheus Marchini <matheus@sthima.com.br>
|
||||
Mathias Bynens <mathias@qiwi.be>
|
||||
Matt Hanselman <mjhanselman@gmail.com>
|
||||
Matthew Sporleder <msporleder@gmail.com>
|
||||
@ -138,6 +138,7 @@ Seo Sanghyeon <sanxiyn@gmail.com>
|
||||
Stefan Penner <stefan.penner@gmail.com>
|
||||
Sylvestre Ledru <sledru@mozilla.com>
|
||||
Taketoshi Aono <brn@b6n.ch>
|
||||
Teddy Katz <teddy.katz@gmail.com>
|
||||
Tiancheng "Timothy" Gu <timothygu99@gmail.com>
|
||||
Tobias Burnus <burnus@net-b.de>
|
||||
Victor Costan <costan@gmail.com>
|
||||
@ -145,6 +146,7 @@ Vlad Burlik <vladbph@gmail.com>
|
||||
Vladimir Krivosheev <develar@gmail.com>
|
||||
Vladimir Shutoff <vovan@shutoff.ru>
|
||||
Wiktor Garbacz <wiktor.garbacz@gmail.com>
|
||||
Xiaoyin Liu <xiaoyin.l@outlook.com>
|
||||
Yong Wang <ccyongwang@tencent.com>
|
||||
Yu Yin <xwafish@gmail.com>
|
||||
Zac Hansen <xaxxon@gmail.com>
|
||||
|
227
deps/v8/BUILD.gn
vendored
227
deps/v8/BUILD.gn
vendored
@ -9,19 +9,23 @@ import("//build/config/host_byteorder.gni")
|
||||
import("//build/config/jumbo.gni")
|
||||
import("//build/config/mips.gni")
|
||||
import("//build/config/sanitizers/sanitizers.gni")
|
||||
import("//build_overrides/build.gni")
|
||||
|
||||
if (is_android) {
|
||||
import("//build/config/android/rules.gni")
|
||||
}
|
||||
|
||||
import("gni/v8.gni")
|
||||
import("gni/isolate.gni")
|
||||
import("snapshot_toolchain.gni")
|
||||
|
||||
declare_args() {
|
||||
# Print to stdout on Android.
|
||||
v8_android_log_stdout = false
|
||||
|
||||
# Turns on all V8 debug features. Enables running V8 in a pseudo debug mode
|
||||
# within a release Chrome.
|
||||
v8_enable_debugging_features = is_debug
|
||||
|
||||
# Sets -DV8_ENABLE_FUTURE.
|
||||
v8_enable_future = false
|
||||
|
||||
@ -65,7 +69,8 @@ declare_args() {
|
||||
v8_enable_fast_mksnapshot = false
|
||||
|
||||
# Enable embedded builtins.
|
||||
# TODO(jgruber,v8:6666): Support ia32.
|
||||
# TODO(jgruber,v8:6666): Support ia32 and maybe MSVC.
|
||||
# TODO(jgruber,v8:6666): Re-enable after the M67 branch point.
|
||||
v8_enable_embedded_builtins = false
|
||||
|
||||
# Enable code-generation-time checking of types in the CodeStubAssembler.
|
||||
@ -142,29 +147,33 @@ declare_args() {
|
||||
|
||||
# Enable mitigations for executing untrusted code.
|
||||
v8_untrusted_code_mitigations = true
|
||||
|
||||
# Enable minor mark compact.
|
||||
v8_enable_minor_mc = true
|
||||
}
|
||||
|
||||
# Derived defaults.
|
||||
if (v8_enable_verify_heap == "") {
|
||||
v8_enable_verify_heap = is_debug
|
||||
v8_enable_verify_heap = v8_enable_debugging_features
|
||||
}
|
||||
if (v8_enable_object_print == "") {
|
||||
v8_enable_object_print = is_debug
|
||||
v8_enable_object_print = v8_enable_debugging_features
|
||||
}
|
||||
if (v8_enable_disassembler == "") {
|
||||
v8_enable_disassembler = is_debug
|
||||
v8_enable_disassembler = v8_enable_debugging_features
|
||||
}
|
||||
if (v8_enable_trace_maps == "") {
|
||||
v8_enable_trace_maps = is_debug
|
||||
v8_enable_trace_maps = v8_enable_debugging_features
|
||||
}
|
||||
if (v8_enable_test_features == "") {
|
||||
v8_enable_test_features = is_debug || dcheck_always_on
|
||||
v8_enable_test_features = v8_enable_debugging_features || dcheck_always_on
|
||||
}
|
||||
if (v8_enable_v8_checks == "") {
|
||||
v8_enable_v8_checks = is_debug
|
||||
v8_enable_v8_checks = v8_enable_debugging_features
|
||||
}
|
||||
if (v8_check_microtasks_scopes_consistency == "") {
|
||||
v8_check_microtasks_scopes_consistency = is_debug || dcheck_always_on
|
||||
v8_check_microtasks_scopes_consistency =
|
||||
v8_enable_debugging_features || dcheck_always_on
|
||||
}
|
||||
|
||||
# Specifies if the target build is a simulator build. Comparing target cpu
|
||||
@ -268,6 +277,9 @@ config("features") {
|
||||
if (v8_enable_vtunejit) {
|
||||
defines += [ "ENABLE_VTUNE_JIT_INTERFACE" ]
|
||||
}
|
||||
if (v8_enable_minor_mc) {
|
||||
defines += [ "ENABLE_MINOR_MC" ]
|
||||
}
|
||||
if (v8_enable_object_print) {
|
||||
defines += [ "OBJECT_PRINT" ]
|
||||
}
|
||||
@ -326,6 +338,9 @@ config("features") {
|
||||
if (v8_enable_embedded_builtins) {
|
||||
defines += [ "V8_EMBEDDED_BUILTINS" ]
|
||||
}
|
||||
if (v8_use_multi_snapshots) {
|
||||
defines += [ "V8_MULTI_SNAPSHOTS" ]
|
||||
}
|
||||
}
|
||||
|
||||
config("toolchain") {
|
||||
@ -497,7 +512,7 @@ config("toolchain") {
|
||||
# TODO(jochen): Support v8_enable_prof on Windows.
|
||||
# TODO(jochen): Add support for compiling with simulators.
|
||||
|
||||
if (is_debug) {
|
||||
if (v8_enable_debugging_features) {
|
||||
if (is_linux && v8_enable_backtrace) {
|
||||
ldflags += [ "-rdynamic" ]
|
||||
}
|
||||
@ -527,6 +542,8 @@ config("toolchain") {
|
||||
|
||||
if (is_clang) {
|
||||
cflags += [
|
||||
"-Wmissing-field-initializers",
|
||||
|
||||
# TODO(hans): Remove once http://crbug.com/428099 is resolved.
|
||||
"-Winconsistent-missing-override",
|
||||
]
|
||||
@ -602,8 +619,6 @@ action("js2c") {
|
||||
"src/js/prologue.js",
|
||||
"src/js/array.js",
|
||||
"src/js/typedarray.js",
|
||||
"src/js/messages.js",
|
||||
"src/js/spread.js",
|
||||
"src/debug/mirrors.js",
|
||||
"src/debug/debug.js",
|
||||
"src/debug/liveedit.js",
|
||||
@ -717,6 +732,8 @@ action("d8_js2c") {
|
||||
if (is_android && enable_java_templates) {
|
||||
android_assets("v8_external_startup_data_assets") {
|
||||
if (v8_use_external_startup_data) {
|
||||
# We don't support side-by-side snapshots on Android within Chromium.
|
||||
assert(!v8_use_multi_snapshots)
|
||||
deps = [
|
||||
"//v8",
|
||||
]
|
||||
@ -756,6 +773,10 @@ if (v8_use_external_startup_data) {
|
||||
"$root_out_dir/natives_blob.bin",
|
||||
]
|
||||
|
||||
data = [
|
||||
"$root_out_dir/natives_blob.bin",
|
||||
]
|
||||
|
||||
script = "tools/concatenate-files.py"
|
||||
|
||||
args = rebase_path(sources + outputs, root_build_dir)
|
||||
@ -786,6 +807,8 @@ action("postmortem-metadata") {
|
||||
"src/objects/js-array.h",
|
||||
"src/objects/js-regexp-inl.h",
|
||||
"src/objects/js-regexp.h",
|
||||
"src/objects/js-regexp-string-iterator-inl.h",
|
||||
"src/objects/js-regexp-string-iterator.h",
|
||||
"src/objects/map.h",
|
||||
"src/objects/map-inl.h",
|
||||
"src/objects/script.h",
|
||||
@ -804,8 +827,24 @@ action("postmortem-metadata") {
|
||||
rebase_path(sources, root_build_dir)
|
||||
}
|
||||
|
||||
if (v8_use_snapshot) {
|
||||
action("run_mksnapshot") {
|
||||
# Template to generate different V8 snapshots based on different runtime flags.
|
||||
# Can be invoked with run_mksnapshot(<name>). The target will resolve to
|
||||
# run_mksnapshot_<name>. If <name> is "default", no file suffixes will be used.
|
||||
# Otherwise files are suffixed, e.g. embedded_<name>.cc and
|
||||
# snapshot_blob_<name>.bin.
|
||||
#
|
||||
# The template exposes the variables:
|
||||
# args: additional flags for mksnapshots
|
||||
# embedded_suffix: a camel case suffix for method names in the embedded
|
||||
# snapshot.
|
||||
template("run_mksnapshot") {
|
||||
name = target_name
|
||||
if (name == "default") {
|
||||
suffix = ""
|
||||
} else {
|
||||
suffix = "_$name"
|
||||
}
|
||||
action("run_mksnapshot_" + name) {
|
||||
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
|
||||
deps = [
|
||||
@ -816,19 +855,33 @@ if (v8_use_snapshot) {
|
||||
|
||||
sources = []
|
||||
|
||||
outputs = [
|
||||
"$target_gen_dir/snapshot.cc",
|
||||
]
|
||||
outputs = []
|
||||
|
||||
data = []
|
||||
|
||||
args = [
|
||||
"./" + rebase_path(get_label_info(":mksnapshot($v8_snapshot_toolchain)",
|
||||
"root_out_dir") + "/mksnapshot",
|
||||
root_build_dir),
|
||||
"--turbo_instruction_scheduling",
|
||||
"--startup_src",
|
||||
rebase_path("$target_gen_dir/snapshot.cc", root_build_dir),
|
||||
]
|
||||
|
||||
args += invoker.args
|
||||
|
||||
if (v8_enable_embedded_builtins) {
|
||||
outputs += [ "$target_gen_dir/embedded${suffix}.cc" ]
|
||||
args += [
|
||||
"--embedded_src",
|
||||
rebase_path("$target_gen_dir/embedded${suffix}.cc", root_build_dir),
|
||||
]
|
||||
if (invoker.embedded_variant != "") {
|
||||
args += [
|
||||
"--embedded_variant",
|
||||
invoker.embedded_variant,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (v8_random_seed != "0") {
|
||||
args += [
|
||||
"--random-seed",
|
||||
@ -848,10 +901,17 @@ if (v8_use_snapshot) {
|
||||
}
|
||||
|
||||
if (v8_use_external_startup_data) {
|
||||
outputs += [ "$root_out_dir/snapshot_blob.bin" ]
|
||||
outputs += [ "$root_out_dir/snapshot_blob${suffix}.bin" ]
|
||||
data += [ "$root_out_dir/snapshot_blob${suffix}.bin" ]
|
||||
args += [
|
||||
"--startup_blob",
|
||||
rebase_path("$root_out_dir/snapshot_blob.bin", root_build_dir),
|
||||
rebase_path("$root_out_dir/snapshot_blob${suffix}.bin", root_build_dir),
|
||||
]
|
||||
} else {
|
||||
outputs += [ "$target_gen_dir/snapshot${suffix}.cc" ]
|
||||
args += [
|
||||
"--startup_src",
|
||||
rebase_path("$target_gen_dir/snapshot${suffix}.cc", root_build_dir),
|
||||
]
|
||||
}
|
||||
|
||||
@ -869,6 +929,23 @@ if (v8_use_snapshot) {
|
||||
}
|
||||
}
|
||||
|
||||
if (v8_use_snapshot) {
|
||||
run_mksnapshot("default") {
|
||||
args = []
|
||||
if (v8_enable_embedded_builtins) {
|
||||
embedded_variant = "Default"
|
||||
}
|
||||
}
|
||||
if (v8_use_multi_snapshots) {
|
||||
run_mksnapshot("trusted") {
|
||||
args = [ "--no-untrusted-code-mitigations" ]
|
||||
if (v8_enable_embedded_builtins) {
|
||||
embedded_variant = "Trusted"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
action("v8_dump_build_config") {
|
||||
script = "tools/testrunner/utils/dump_build_config.py"
|
||||
outputs = [
|
||||
@ -882,7 +959,7 @@ action("v8_dump_build_config") {
|
||||
"is_asan=$is_asan",
|
||||
"is_cfi=$is_cfi",
|
||||
"is_component_build=$is_component_build",
|
||||
"is_debug=$is_debug",
|
||||
"is_debug=$v8_enable_debugging_features",
|
||||
"is_gcov_coverage=$is_gcov_coverage",
|
||||
"is_msan=$is_msan",
|
||||
"is_tsan=$is_tsan",
|
||||
@ -940,12 +1017,13 @@ v8_source_set("v8_nosnapshot") {
|
||||
"$target_gen_dir/experimental-extras-libraries.cc",
|
||||
"$target_gen_dir/extras-libraries.cc",
|
||||
"$target_gen_dir/libraries.cc",
|
||||
"src/snapshot/embedded-empty.cc",
|
||||
"src/snapshot/snapshot-empty.cc",
|
||||
]
|
||||
|
||||
if (use_jumbo_build == true) {
|
||||
jumbo_excluded_sources = [
|
||||
# TODO(mostynb@opera.com): don't exclude these http://crbug.com/752428
|
||||
# TODO(mostynb@vewd.com): don't exclude these http://crbug.com/752428
|
||||
# Generated source, contains same variable names as libraries.cc
|
||||
"$target_gen_dir/experimental-extras-libraries.cc",
|
||||
"$target_gen_dir/libraries.cc",
|
||||
@ -955,7 +1033,7 @@ v8_source_set("v8_nosnapshot") {
|
||||
configs = [ ":internal_config" ]
|
||||
}
|
||||
|
||||
if (v8_use_snapshot) {
|
||||
if (v8_use_snapshot && !v8_use_external_startup_data) {
|
||||
v8_source_set("v8_snapshot") {
|
||||
# Only targets in this file and the top-level visibility target can
|
||||
# depend on this.
|
||||
@ -973,7 +1051,7 @@ if (v8_use_snapshot) {
|
||||
public_deps = [
|
||||
# This should be public so downstream targets can declare the snapshot
|
||||
# output file as their inputs.
|
||||
":run_mksnapshot",
|
||||
":run_mksnapshot_default",
|
||||
]
|
||||
|
||||
sources = [
|
||||
@ -984,9 +1062,13 @@ if (v8_use_snapshot) {
|
||||
"src/setup-isolate-deserialize.cc",
|
||||
]
|
||||
|
||||
if (v8_enable_embedded_builtins) {
|
||||
sources += [ "$target_gen_dir/embedded.cc" ]
|
||||
}
|
||||
|
||||
if (use_jumbo_build == true) {
|
||||
jumbo_excluded_sources = [
|
||||
# TODO(mostynb@opera.com): don't exclude these http://crbug.com/752428
|
||||
# TODO(mostynb@vewd.com): don't exclude these http://crbug.com/752428
|
||||
# Generated source, contains same variable names as libraries.cc
|
||||
"$target_gen_dir/experimental-extras-libraries.cc",
|
||||
"$target_gen_dir/libraries.cc",
|
||||
@ -997,7 +1079,7 @@ if (v8_use_snapshot) {
|
||||
}
|
||||
}
|
||||
|
||||
if (v8_use_external_startup_data) {
|
||||
if (v8_use_snapshot && v8_use_external_startup_data) {
|
||||
v8_source_set("v8_external_snapshot") {
|
||||
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
|
||||
@ -1009,15 +1091,34 @@ if (v8_use_external_startup_data) {
|
||||
]
|
||||
public_deps = [
|
||||
":natives_blob",
|
||||
":run_mksnapshot",
|
||||
":run_mksnapshot_default",
|
||||
]
|
||||
|
||||
if (v8_use_multi_snapshots) {
|
||||
public_deps += [ ":run_mksnapshot_trusted" ]
|
||||
}
|
||||
|
||||
sources = [
|
||||
"src/setup-isolate-deserialize.cc",
|
||||
"src/snapshot/natives-external.cc",
|
||||
"src/snapshot/snapshot-external.cc",
|
||||
]
|
||||
|
||||
if (v8_enable_embedded_builtins) {
|
||||
sources += [ "$target_gen_dir/embedded.cc" ]
|
||||
|
||||
if (v8_use_multi_snapshots) {
|
||||
sources += [ "$target_gen_dir/embedded_trusted.cc" ]
|
||||
|
||||
if (use_jumbo_build == true) {
|
||||
jumbo_excluded_sources = [
|
||||
# Duplicated symbols with embedded.cc
|
||||
"$target_gen_dir/embedded_trusted.cc",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configs = [ ":internal_config" ]
|
||||
}
|
||||
}
|
||||
@ -1105,7 +1206,7 @@ v8_source_set("v8_initializers") {
|
||||
|
||||
if (use_jumbo_build == true) {
|
||||
jumbo_excluded_sources = [
|
||||
# TODO(mostynb@opera.com): don't exclude these http://crbug.com/752428
|
||||
# TODO(mostynb@vewd.com): don't exclude these http://crbug.com/752428
|
||||
"src/builtins/builtins-async-iterator-gen.cc",
|
||||
"src/builtins/builtins-async-generator-gen.cc",
|
||||
|
||||
@ -1232,7 +1333,6 @@ v8_source_set("v8_base") {
|
||||
"src/allocation.cc",
|
||||
"src/allocation.h",
|
||||
"src/api-arguments-inl.h",
|
||||
"src/api-arguments.cc",
|
||||
"src/api-arguments.h",
|
||||
"src/api-natives.cc",
|
||||
"src/api-natives.h",
|
||||
@ -1350,8 +1450,6 @@ v8_source_set("v8_base") {
|
||||
"src/compilation-cache.h",
|
||||
"src/compilation-dependencies.cc",
|
||||
"src/compilation-dependencies.h",
|
||||
"src/compilation-info.cc",
|
||||
"src/compilation-info.h",
|
||||
"src/compilation-statistics.cc",
|
||||
"src/compilation-statistics.h",
|
||||
"src/compiler-dispatcher/compiler-dispatcher-job.cc",
|
||||
@ -1634,9 +1732,8 @@ v8_source_set("v8_base") {
|
||||
"src/extensions/trigger-failure-extension.h",
|
||||
"src/external-reference-table.cc",
|
||||
"src/external-reference-table.h",
|
||||
"src/factory-inl.h",
|
||||
"src/factory.cc",
|
||||
"src/factory.h",
|
||||
"src/external-reference.cc",
|
||||
"src/external-reference.h",
|
||||
"src/fast-dtoa.cc",
|
||||
"src/fast-dtoa.h",
|
||||
"src/feedback-vector-inl.h",
|
||||
@ -1680,6 +1777,9 @@ v8_source_set("v8_base") {
|
||||
"src/heap/concurrent-marking.h",
|
||||
"src/heap/embedder-tracing.cc",
|
||||
"src/heap/embedder-tracing.h",
|
||||
"src/heap/factory-inl.h",
|
||||
"src/heap/factory.cc",
|
||||
"src/heap/factory.h",
|
||||
"src/heap/gc-idle-time-handler.cc",
|
||||
"src/heap/gc-idle-time-handler.h",
|
||||
"src/heap/gc-tracer.cc",
|
||||
@ -1866,12 +1966,16 @@ v8_source_set("v8_base") {
|
||||
"src/objects/js-promise-inl.h",
|
||||
"src/objects/js-promise.h",
|
||||
"src/objects/js-regexp-inl.h",
|
||||
"src/objects/js-regexp-string-iterator-inl.h",
|
||||
"src/objects/js-regexp-string-iterator.h",
|
||||
"src/objects/js-regexp.h",
|
||||
"src/objects/literal-objects-inl.h",
|
||||
"src/objects/literal-objects.cc",
|
||||
"src/objects/literal-objects.h",
|
||||
"src/objects/map-inl.h",
|
||||
"src/objects/map.h",
|
||||
"src/objects/maybe-object-inl.h",
|
||||
"src/objects/maybe-object.h",
|
||||
"src/objects/microtask-inl.h",
|
||||
"src/objects/microtask.h",
|
||||
"src/objects/module-inl.h",
|
||||
@ -1897,6 +2001,8 @@ v8_source_set("v8_base") {
|
||||
"src/objects/string.h",
|
||||
"src/objects/template-objects.cc",
|
||||
"src/objects/template-objects.h",
|
||||
"src/optimized-compilation-info.cc",
|
||||
"src/optimized-compilation-info.h",
|
||||
"src/ostreams.cc",
|
||||
"src/ostreams.h",
|
||||
"src/parsing/duplicate-finder.h",
|
||||
@ -2051,6 +2157,7 @@ v8_source_set("v8_base") {
|
||||
"src/snapshot/default-serializer-allocator.h",
|
||||
"src/snapshot/deserializer.cc",
|
||||
"src/snapshot/deserializer.h",
|
||||
"src/snapshot/macros.h",
|
||||
"src/snapshot/natives-common.cc",
|
||||
"src/snapshot/natives.h",
|
||||
"src/snapshot/object-deserializer.cc",
|
||||
@ -2113,6 +2220,8 @@ v8_source_set("v8_base") {
|
||||
"src/unicode-inl.h",
|
||||
"src/unicode.cc",
|
||||
"src/unicode.h",
|
||||
"src/unoptimized-compilation-info.cc",
|
||||
"src/unoptimized-compilation-info.h",
|
||||
"src/uri.cc",
|
||||
"src/uri.h",
|
||||
"src/utils-inl.h",
|
||||
@ -2162,8 +2271,6 @@ v8_source_set("v8_base") {
|
||||
"src/wasm/wasm-code-manager.h",
|
||||
"src/wasm/wasm-code-specialization.cc",
|
||||
"src/wasm/wasm-code-specialization.h",
|
||||
"src/wasm/wasm-code-wrapper.cc",
|
||||
"src/wasm/wasm-code-wrapper.h",
|
||||
"src/wasm/wasm-constants.h",
|
||||
"src/wasm/wasm-debug.cc",
|
||||
"src/wasm/wasm-engine.cc",
|
||||
@ -2196,7 +2303,6 @@ v8_source_set("v8_base") {
|
||||
"src/zone/accounting-allocator.cc",
|
||||
"src/zone/accounting-allocator.h",
|
||||
"src/zone/zone-allocator.h",
|
||||
"src/zone/zone-allocator.h",
|
||||
"src/zone/zone-chunk-list.h",
|
||||
"src/zone/zone-containers.h",
|
||||
"src/zone/zone-handle-set.h",
|
||||
@ -2209,7 +2315,7 @@ v8_source_set("v8_base") {
|
||||
|
||||
if (use_jumbo_build == true) {
|
||||
jumbo_excluded_sources = [
|
||||
# TODO(mostynb@opera.com): don't exclude these http://crbug.com/752428
|
||||
# TODO(mostynb@vewd.com): don't exclude these http://crbug.com/752428
|
||||
"src/profiler/heap-snapshot-generator.cc", # Macro clash in mman-linux.h
|
||||
|
||||
# These source files take an unusually large amount of time to
|
||||
@ -2364,7 +2470,7 @@ v8_source_set("v8_base") {
|
||||
]
|
||||
if (use_jumbo_build) {
|
||||
jumbo_excluded_sources += [
|
||||
# TODO(mostynb@opera.com): fix this code so it doesn't need
|
||||
# TODO(mostynb@vewd.com): fix this code so it doesn't need
|
||||
# to be excluded, see the comments inside.
|
||||
"src/arm64/instructions-arm64-constants.cc",
|
||||
]
|
||||
@ -2592,13 +2698,17 @@ v8_component("v8_libbase") {
|
||||
|
||||
public_configs = [ ":libbase_config" ]
|
||||
|
||||
data = []
|
||||
|
||||
data_deps = []
|
||||
|
||||
defines = []
|
||||
|
||||
if (is_component_build) {
|
||||
defines = [ "BUILDING_V8_BASE_SHARED" ]
|
||||
}
|
||||
|
||||
if (is_posix) {
|
||||
if (is_posix || is_fuchsia) {
|
||||
sources += [
|
||||
"src/base/platform/platform-posix.cc",
|
||||
"src/base/platform/platform-posix.h",
|
||||
@ -2680,6 +2790,12 @@ v8_component("v8_libbase") {
|
||||
"winmm.lib",
|
||||
"ws2_32.lib",
|
||||
]
|
||||
|
||||
data_deps += [ "//build/win:runtime_libs" ]
|
||||
}
|
||||
|
||||
if (is_tsan && !build_with_chromium) {
|
||||
data += [ "tools/sanitizers/tsan_suppressions.txt" ]
|
||||
}
|
||||
|
||||
# TODO(jochen): Add support for qnx, freebsd, openbsd, netbsd, and solaris.
|
||||
@ -2691,12 +2807,12 @@ v8_component("v8_libplatform") {
|
||||
"include/libplatform/libplatform-export.h",
|
||||
"include/libplatform/libplatform.h",
|
||||
"include/libplatform/v8-tracing.h",
|
||||
"src/libplatform/default-background-task-runner.cc",
|
||||
"src/libplatform/default-background-task-runner.h",
|
||||
"src/libplatform/default-foreground-task-runner.cc",
|
||||
"src/libplatform/default-foreground-task-runner.h",
|
||||
"src/libplatform/default-platform.cc",
|
||||
"src/libplatform/default-platform.h",
|
||||
"src/libplatform/default-worker-threads-task-runner.cc",
|
||||
"src/libplatform/default-worker-threads-task-runner.h",
|
||||
"src/libplatform/task-queue.cc",
|
||||
"src/libplatform/task-queue.h",
|
||||
"src/libplatform/tracing/trace-buffer.cc",
|
||||
@ -2834,10 +2950,6 @@ group("gn_all") {
|
||||
if (want_v8_shell) {
|
||||
deps += [ ":v8_shell" ]
|
||||
}
|
||||
|
||||
if (v8_test_isolation_mode != "noop") {
|
||||
deps += [ ":d8_run" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("v8_clusterfuzz") {
|
||||
@ -2855,13 +2967,6 @@ group("v8_clusterfuzz") {
|
||||
":d8(//build/toolchain/linux:clang_x86_v8_arm)",
|
||||
]
|
||||
}
|
||||
|
||||
if (v8_test_isolation_mode != "noop") {
|
||||
deps += [
|
||||
"test:d8_default_run",
|
||||
"tools:run-num-fuzzer_run",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
group("v8_archive") {
|
||||
@ -2872,7 +2977,7 @@ group("v8_archive") {
|
||||
|
||||
group("v8_fuzzers") {
|
||||
testonly = true
|
||||
deps = [
|
||||
data_deps = [
|
||||
":v8_simple_json_fuzzer",
|
||||
":v8_simple_multi_return_fuzzer",
|
||||
":v8_simple_parser_fuzzer",
|
||||
@ -2979,7 +3084,7 @@ v8_executable("d8") {
|
||||
"//build/win:default_exe_manifest",
|
||||
]
|
||||
|
||||
if (is_posix) {
|
||||
if (is_posix || is_fuchsia) {
|
||||
sources += [ "src/d8-posix.cc" ]
|
||||
} else if (is_win) {
|
||||
sources += [ "src/d8-windows.cc" ]
|
||||
@ -2992,18 +3097,10 @@ v8_executable("d8") {
|
||||
defines = []
|
||||
|
||||
if (v8_enable_vtunejit) {
|
||||
deps += [ "//src/third_party/vtune:v8_vtune" ]
|
||||
deps += [ "src/third_party/vtune:v8_vtune" ]
|
||||
}
|
||||
}
|
||||
|
||||
v8_isolate_run("d8") {
|
||||
deps = [
|
||||
":d8",
|
||||
]
|
||||
|
||||
isolate = "//src/d8.isolate"
|
||||
}
|
||||
|
||||
v8_executable("v8_hello_world") {
|
||||
sources = [
|
||||
"samples/hello-world.cc",
|
||||
|
1490
deps/v8/ChangeLog
vendored
1490
deps/v8/ChangeLog
vendored
File diff suppressed because it is too large
Load Diff
36
deps/v8/DEPS
vendored
36
deps/v8/DEPS
vendored
@ -12,57 +12,55 @@ vars = {
|
||||
|
||||
deps = {
|
||||
'v8/build':
|
||||
Var('chromium_url') + '/chromium/src/build.git' + '@' + 'b1d6c28b4a64128ad856d9da458afda2861fddab',
|
||||
Var('chromium_url') + '/chromium/src/build.git' + '@' + '73e352e758d90603e23bdc84734c12aa5817ab5f',
|
||||
'v8/tools/gyp':
|
||||
Var('chromium_url') + '/external/gyp.git' + '@' + 'd61a9397e668fa9843c4aa7da9e79460fe590bfb',
|
||||
'v8/third_party/icu':
|
||||
Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'd888fd2a1be890f4d35e43f68d6d79f42519a357',
|
||||
'v8/third_party/instrumented_libraries':
|
||||
Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + 'b745ddca2c63719167c0f2008ae19e667c5e9952',
|
||||
Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + '323cf32193caecbf074d1a0cb5b02b905f163e0f',
|
||||
'v8/buildtools':
|
||||
Var('chromium_url') + '/chromium/buildtools.git' + '@' + '2888931260f2a32bc583f005bd807a561b2fa6af',
|
||||
Var('chromium_url') + '/chromium/buildtools.git' + '@' + 'e8aa02ea839e087f2db66100d02c3b5d47993852',
|
||||
'v8/base/trace_event/common':
|
||||
Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + '0e9a47d74970bee1bbfc063c47215406f8918699',
|
||||
Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + '211b3ed9d0481b4caddbee1322321b86a483ca1f',
|
||||
'v8/third_party/android_ndk': {
|
||||
'url': Var('chromium_url') + '/android_ndk.git' + '@' + 'e951c37287c7d8cd915bf8d4149fd4a06d808b55',
|
||||
'url': Var('chromium_url') + '/android_ndk.git' + '@' + '635bc380968a76f6948fee65f80a0b28db53ae81',
|
||||
'condition': 'checkout_android',
|
||||
},
|
||||
'v8/third_party/android_tools': {
|
||||
'url': Var('chromium_url') + '/android_tools.git' + '@' + '9a70d48fcdd68cd0e7e968f342bd767ee6323bd1',
|
||||
'url': Var('chromium_url') + '/android_tools.git' + '@' + 'c22a664c39af72dd8f89200220713dcad811300a',
|
||||
'condition': 'checkout_android',
|
||||
},
|
||||
'v8/third_party/catapult': {
|
||||
'url': Var('chromium_url') + '/catapult.git' + '@' + '8a42ad3cb185e340c32b20f657980fd057e3769f',
|
||||
'url': Var('chromium_url') + '/catapult.git' + '@' + '2c59f678c7ede8a844fb687525d594b71aabe3dd',
|
||||
'condition': 'checkout_android',
|
||||
},
|
||||
'v8/third_party/colorama/src': {
|
||||
'url': Var('chromium_url') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8',
|
||||
'condition': 'checkout_android',
|
||||
},
|
||||
'v8/third_party/googletest/src':
|
||||
Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '7e5f90d3780d553cb86771141fb81349f3a63508',
|
||||
'v8/third_party/jinja2':
|
||||
Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + 'd34383206fa42d52faa10bb9931d6d538f3a57e0',
|
||||
Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + '45571de473282bd1d8b63a8dfcb1fd268d0635d2',
|
||||
'v8/third_party/markupsafe':
|
||||
Var('chromium_url') + '/chromium/src/third_party/markupsafe.git' + '@' + '8f45f5cfa0009d2a70589bcda0349b8cb2b72783',
|
||||
'v8/tools/swarming_client':
|
||||
Var('chromium_url') + '/infra/luci/client-py.git' + '@' + '88229872dd17e71658fe96763feaa77915d8cbd6',
|
||||
'v8/testing/gtest':
|
||||
Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '6f8a66431cb592dad629028a50b3dd418a408c87',
|
||||
'v8/testing/gmock':
|
||||
Var('chromium_url') + '/external/googlemock.git' + '@' + '0421b6f358139f02e102c9c332ce19a33faf75be',
|
||||
'v8/test/benchmarks/data':
|
||||
Var('chromium_url') + '/v8/deps/third_party/benchmarks.git' + '@' + '05d7188267b4560491ff9155c5ee13e207ecd65f',
|
||||
'v8/test/mozilla/data':
|
||||
Var('chromium_url') + '/v8/deps/third_party/mozilla-tests.git' + '@' + 'f6c578a10ea707b1a8ab0b88943fe5115ce2b9be',
|
||||
'v8/test/test262/data':
|
||||
Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + 'b59d956b3c268abd0875aeb87d6688f4c7aafc9b',
|
||||
Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + '0192e0d70e2295fb590f14865da42f0f9dfa64bd',
|
||||
'v8/test/test262/harness':
|
||||
Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '0f2acdd882c84cff43b9d60df7574a1901e2cdcd',
|
||||
'v8/tools/clang':
|
||||
Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'b3d3f5920b161f95f1a8ffe08b75c695e0edf350',
|
||||
Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'd7c36b0ae001a5cc31f2da79a430154916a3def2',
|
||||
'v8/tools/luci-go':
|
||||
Var('chromium_url') + '/chromium/src/tools/luci-go.git' + '@' + 'ff0709d4283b1f233dcf0c9fec1672c6ecaed2f1',
|
||||
'v8/test/wasm-js':
|
||||
Var('chromium_url') + '/external/github.com/WebAssembly/spec.git' + '@' + '4653fc002a510b4f207af07f2c7c61b13dba78d9',
|
||||
Var('chromium_url') + '/external/github.com/WebAssembly/spec.git' + '@' + '586d34770c6445bfb93c9bae8ac50baade7ee168',
|
||||
}
|
||||
|
||||
recursedeps = [
|
||||
@ -255,28 +253,28 @@ hooks = [
|
||||
{
|
||||
'name': 'sysroot_arm',
|
||||
'pattern': '.',
|
||||
'condition': 'checkout_linux and checkout_arm',
|
||||
'condition': '(checkout_linux and checkout_arm)',
|
||||
'action': ['python', 'v8/build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--arch=arm'],
|
||||
},
|
||||
{
|
||||
'name': 'sysroot_arm64',
|
||||
'pattern': '.',
|
||||
'condition': 'checkout_linux and checkout_arm64',
|
||||
'condition': '(checkout_linux and checkout_arm64)',
|
||||
'action': ['python', 'v8/build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--arch=arm64'],
|
||||
},
|
||||
{
|
||||
'name': 'sysroot_x86',
|
||||
'pattern': '.',
|
||||
'condition': 'checkout_linux and (checkout_x86 or checkout_x64)',
|
||||
'condition': '(checkout_linux and (checkout_x86 or checkout_x64))',
|
||||
'action': ['python', 'v8/build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--arch=x86'],
|
||||
},
|
||||
{
|
||||
'name': 'sysroot_mips',
|
||||
'pattern': '.',
|
||||
'condition': 'checkout_linux and checkout_mips',
|
||||
'condition': '(checkout_linux and checkout_mips)',
|
||||
'action': ['python', 'v8/build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--arch=mips'],
|
||||
},
|
||||
|
3
deps/v8/LICENSE
vendored
3
deps/v8/LICENSE
vendored
@ -23,6 +23,9 @@ are:
|
||||
- Valgrind client API header, located at third_party/valgrind/valgrind.h
|
||||
This is release under the BSD license.
|
||||
|
||||
- antlr4 parser generator Cpp library located in third_party/antlr4
|
||||
This is release under the BSD license.
|
||||
|
||||
These libraries have their own licenses; we recommend you read them,
|
||||
as their terms may differ from the terms below.
|
||||
|
||||
|
2
deps/v8/OWNERS
vendored
2
deps/v8/OWNERS
vendored
@ -1,5 +1,6 @@
|
||||
adamk@chromium.org
|
||||
ahaas@chromium.org
|
||||
aseemgarg@chromium.org
|
||||
bbudge@chromium.org
|
||||
binji@chromium.org
|
||||
bmeurer@chromium.org
|
||||
@ -18,6 +19,7 @@ ishell@chromium.org
|
||||
jarin@chromium.org
|
||||
jgruber@chromium.org
|
||||
jkummerow@chromium.org
|
||||
kschimpf@chromium.org
|
||||
leszeks@chromium.org
|
||||
machenbach@chromium.org
|
||||
marja@chromium.org
|
||||
|
@ -2,6 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BASE_TRACE_EVENT_COMMON_TRACE_EVENT_COMMON_H_
|
||||
#define BASE_TRACE_EVENT_COMMON_TRACE_EVENT_COMMON_H_
|
||||
|
||||
// This header file defines the set of trace_event macros without specifying
|
||||
// how the events actually get collected and stored. If you need to expose trace
|
||||
// events to some other universe, you can copy-and-paste this file as well as
|
||||
@ -687,6 +690,11 @@
|
||||
TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \
|
||||
TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \
|
||||
arg1_name, arg1_val, arg2_name, arg2_val)
|
||||
#define TRACE_EVENT_COPY_ASYNC_END_WITH_TIMESTAMP0(category_group, name, id, \
|
||||
timestamp) \
|
||||
INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
|
||||
TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \
|
||||
TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_COPY)
|
||||
|
||||
// NESTABLE_ASYNC_* APIs are used to describe an async operation, which can
|
||||
// be nested within a NESTABLE_ASYNC event and/or have inner NESTABLE_ASYNC
|
||||
@ -1020,6 +1028,14 @@
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Macro for getting the real base::TimeTicks::Now() which can be overridden in
|
||||
// headless when VirtualTime is enabled.
|
||||
#define TRACE_TIME_TICKS_NOW() INTERNAL_TRACE_TIME_TICKS_NOW()
|
||||
|
||||
// Macro for getting the real base::Time::Now() which can be overridden in
|
||||
// headless when VirtualTime is enabled.
|
||||
#define TRACE_TIME_NOW() INTERNAL_TRACE_TIME_NOW()
|
||||
|
||||
// Notes regarding the following definitions:
|
||||
// New values can be added and propagated to third party libraries, but existing
|
||||
// definitions must never be changed, because third party libraries may use old
|
||||
@ -1094,3 +1110,5 @@
|
||||
#define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g')
|
||||
#define TRACE_EVENT_SCOPE_NAME_PROCESS ('p')
|
||||
#define TRACE_EVENT_SCOPE_NAME_THREAD ('t')
|
||||
|
||||
#endif // BASE_TRACE_EVENT_COMMON_TRACE_EVENT_COMMON_H_
|
||||
|
196
deps/v8/gni/isolate.gni
vendored
196
deps/v8/gni/isolate.gni
vendored
@ -1,196 +0,0 @@
|
||||
# Copyright 2016 the V8 project authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/sanitizers/sanitizers.gni")
|
||||
import("//third_party/icu/config.gni")
|
||||
import("v8.gni")
|
||||
|
||||
declare_args() {
|
||||
# Sets the test isolation mode (noop|prepare|check).
|
||||
v8_test_isolation_mode = "noop"
|
||||
}
|
||||
|
||||
template("v8_isolate_run") {
|
||||
forward_variables_from(invoker,
|
||||
"*",
|
||||
[
|
||||
"deps",
|
||||
"isolate",
|
||||
])
|
||||
|
||||
# Remember target name as within the action scope the target name will be
|
||||
# different.
|
||||
name = target_name
|
||||
|
||||
assert(defined(invoker.deps))
|
||||
assert(defined(invoker.isolate))
|
||||
|
||||
if (name != "" && v8_test_isolation_mode != "noop") {
|
||||
action(name + "_run") {
|
||||
testonly = true
|
||||
|
||||
deps = invoker.deps
|
||||
|
||||
script = "//tools/isolate_driver.py"
|
||||
|
||||
sources = [
|
||||
invoker.isolate,
|
||||
]
|
||||
|
||||
inputs = [
|
||||
# Files that are known to be involved in this step.
|
||||
"//tools/swarming_client/isolate.py",
|
||||
"//tools/swarming_client/run_isolated.py",
|
||||
]
|
||||
|
||||
if (v8_test_isolation_mode == "prepare") {
|
||||
outputs = [
|
||||
"$root_out_dir/$name.isolated.gen.json",
|
||||
]
|
||||
} else if (v8_test_isolation_mode == "check") {
|
||||
outputs = [
|
||||
"$root_out_dir/$name.isolated",
|
||||
"$root_out_dir/$name.isolated.state",
|
||||
]
|
||||
}
|
||||
|
||||
# Translate gn to gyp variables.
|
||||
if (v8_code_coverage) {
|
||||
coverage = "1"
|
||||
} else {
|
||||
coverage = "0"
|
||||
}
|
||||
if (is_asan) {
|
||||
asan = "1"
|
||||
} else {
|
||||
asan = "0"
|
||||
}
|
||||
if (is_msan) {
|
||||
msan = "1"
|
||||
} else {
|
||||
msan = "0"
|
||||
}
|
||||
if (is_tsan) {
|
||||
tsan = "1"
|
||||
} else {
|
||||
tsan = "0"
|
||||
}
|
||||
if (is_cfi) {
|
||||
cfi_vptr = "1"
|
||||
} else {
|
||||
cfi_vptr = "0"
|
||||
}
|
||||
if (target_cpu == "x86") {
|
||||
target_arch = "ia32"
|
||||
} else {
|
||||
target_arch = target_cpu
|
||||
}
|
||||
if (is_debug) {
|
||||
configuration_name = "Debug"
|
||||
} else {
|
||||
configuration_name = "Release"
|
||||
}
|
||||
if (is_component_build) {
|
||||
component = "shared_library"
|
||||
} else {
|
||||
component = "static_library"
|
||||
}
|
||||
if (icu_use_data_file) {
|
||||
icu_use_data_file_flag = "1"
|
||||
} else {
|
||||
icu_use_data_file_flag = "0"
|
||||
}
|
||||
if (v8_use_external_startup_data) {
|
||||
use_external_startup_data = "1"
|
||||
} else {
|
||||
use_external_startup_data = "0"
|
||||
}
|
||||
if (is_ubsan_vptr) {
|
||||
ubsan_vptr = "1"
|
||||
} else {
|
||||
ubsan_vptr = "0"
|
||||
}
|
||||
if (v8_use_snapshot) {
|
||||
use_snapshot = "true"
|
||||
} else {
|
||||
use_snapshot = "false"
|
||||
}
|
||||
if (v8_has_valgrind) {
|
||||
has_valgrind = "1"
|
||||
} else {
|
||||
has_valgrind = "0"
|
||||
}
|
||||
if (v8_gcmole) {
|
||||
gcmole = "1"
|
||||
} else {
|
||||
gcmole = "0"
|
||||
}
|
||||
|
||||
# Note, all paths will be rebased in isolate_driver.py to be relative to
|
||||
# the isolate file.
|
||||
args = [
|
||||
v8_test_isolation_mode,
|
||||
"--isolated",
|
||||
rebase_path("$root_out_dir/$name.isolated", root_build_dir),
|
||||
"--isolate",
|
||||
rebase_path(invoker.isolate, root_build_dir),
|
||||
|
||||
# Path variables are used to replace file paths when loading a .isolate
|
||||
# file
|
||||
"--path-variable",
|
||||
"DEPTH",
|
||||
rebase_path("//", root_build_dir),
|
||||
"--path-variable",
|
||||
"PRODUCT_DIR",
|
||||
rebase_path(root_out_dir, root_build_dir),
|
||||
|
||||
# TODO(machenbach): Set variables for remaining features.
|
||||
"--config-variable",
|
||||
"CONFIGURATION_NAME=$configuration_name",
|
||||
"--config-variable",
|
||||
"OS=$target_os",
|
||||
"--config-variable",
|
||||
"asan=$asan",
|
||||
"--config-variable",
|
||||
"cfi_vptr=$cfi_vptr",
|
||||
"--config-variable",
|
||||
"gcmole=$gcmole",
|
||||
"--config-variable",
|
||||
"has_valgrind=$has_valgrind",
|
||||
"--config-variable",
|
||||
"icu_use_data_file_flag=$icu_use_data_file_flag",
|
||||
"--config-variable",
|
||||
"msan=$msan",
|
||||
"--config-variable",
|
||||
"tsan=$tsan",
|
||||
"--config-variable",
|
||||
"coverage=$coverage",
|
||||
"--config-variable",
|
||||
"sanitizer_coverage=$sanitizer_coverage_flags",
|
||||
"--config-variable",
|
||||
"component=$component",
|
||||
"--config-variable",
|
||||
"target_arch=$target_arch",
|
||||
"--config-variable",
|
||||
"ubsan_vptr=$ubsan_vptr",
|
||||
"--config-variable",
|
||||
"v8_use_external_startup_data=$use_external_startup_data",
|
||||
"--config-variable",
|
||||
"v8_use_snapshot=$use_snapshot",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
args += [
|
||||
"--config-variable",
|
||||
"msvs_version=2017",
|
||||
]
|
||||
} else {
|
||||
args += [
|
||||
"--config-variable",
|
||||
"msvs_version=0",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
97
deps/v8/gni/msvs_dependencies.isolate
vendored
97
deps/v8/gni/msvs_dependencies.isolate
vendored
@ -1,97 +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.
|
||||
|
||||
# TODO(machenbach): Remove this when crbug.com/669910 is resolved.
|
||||
{
|
||||
'conditions': [
|
||||
# Copy the VS runtime DLLs into the isolate so that they
|
||||
# don't have to be preinstalled on the target machine.
|
||||
#
|
||||
# VS2013 runtimes
|
||||
['OS=="win" and msvs_version==2013 and component=="shared_library" and (CONFIGURATION_NAME=="Debug" or CONFIGURATION_NAME=="Debug_x64")', {
|
||||
'variables': {
|
||||
'files': [
|
||||
'<(PRODUCT_DIR)/msvcp120d.dll',
|
||||
'<(PRODUCT_DIR)/msvcr120d.dll',
|
||||
],
|
||||
},
|
||||
}],
|
||||
['OS=="win" and msvs_version==2013 and component=="shared_library" and (CONFIGURATION_NAME=="Release" or CONFIGURATION_NAME=="Release_x64")', {
|
||||
'variables': {
|
||||
'files': [
|
||||
'<(PRODUCT_DIR)/msvcp120.dll',
|
||||
'<(PRODUCT_DIR)/msvcr120.dll',
|
||||
],
|
||||
},
|
||||
}],
|
||||
# VS2015/2017 runtimes
|
||||
['OS=="win" and (msvs_version==2015 or msvs_version==2017) and component=="shared_library" and (CONFIGURATION_NAME=="Debug" or CONFIGURATION_NAME=="Debug_x64")', {
|
||||
'variables': {
|
||||
'files': [
|
||||
'<(PRODUCT_DIR)/msvcp140d.dll',
|
||||
'<(PRODUCT_DIR)/vccorlib140d.dll',
|
||||
'<(PRODUCT_DIR)/vcruntime140d.dll',
|
||||
'<(PRODUCT_DIR)/ucrtbased.dll',
|
||||
],
|
||||
},
|
||||
}],
|
||||
['OS=="win" and (msvs_version==2015 or msvs_version==2017) and component=="shared_library" and (CONFIGURATION_NAME=="Release" or CONFIGURATION_NAME=="Release_x64")', {
|
||||
'variables': {
|
||||
'files': [
|
||||
'<(PRODUCT_DIR)/msvcp140.dll',
|
||||
'<(PRODUCT_DIR)/vccorlib140.dll',
|
||||
'<(PRODUCT_DIR)/vcruntime140.dll',
|
||||
'<(PRODUCT_DIR)/ucrtbase.dll',
|
||||
],
|
||||
},
|
||||
}],
|
||||
['OS=="win" and (msvs_version==2015 or msvs_version==2017) and component=="shared_library"', {
|
||||
# Windows 10 Universal C Runtime binaries.
|
||||
'variables': {
|
||||
'files': [
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-console-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-datetime-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-debug-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-errorhandling-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-file-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-file-l1-2-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-file-l2-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-handle-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-heap-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-interlocked-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-libraryloader-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-localization-l1-2-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-memory-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-namedpipe-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-processenvironment-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-processthreads-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-processthreads-l1-1-1.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-profile-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-rtlsupport-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-string-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-synch-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-synch-l1-2-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-sysinfo-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-timezone-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-core-util-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-conio-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-convert-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-environment-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-filesystem-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-heap-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-locale-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-math-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-multibyte-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-private-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-process-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-runtime-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-stdio-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-string-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-time-l1-1-0.dll',
|
||||
'<(PRODUCT_DIR)/api-ms-win-crt-utility-l1-1-0.dll',
|
||||
],
|
||||
},
|
||||
}],
|
||||
],
|
||||
}
|
13
deps/v8/gni/v8.gni
vendored
13
deps/v8/gni/v8.gni
vendored
@ -37,6 +37,9 @@ declare_args() {
|
||||
# https://803591
|
||||
v8_use_snapshot = !(is_win && host_os != "win" && target_cpu == "x64")
|
||||
|
||||
# Enable several snapshots side-by-side (e.g. default and for trusted code).
|
||||
v8_use_multi_snapshots = ""
|
||||
|
||||
# Use external files for startup data blobs:
|
||||
# the JS builtins sources and the start snapshot.
|
||||
v8_use_external_startup_data = ""
|
||||
@ -58,6 +61,11 @@ if (v8_use_external_startup_data == "") {
|
||||
v8_use_external_startup_data = v8_use_snapshot && !is_ios
|
||||
}
|
||||
|
||||
if (v8_use_multi_snapshots == "") {
|
||||
v8_use_multi_snapshots =
|
||||
v8_use_external_startup_data && !build_with_chromium && !use_jumbo_build
|
||||
}
|
||||
|
||||
if (v8_enable_backtrace == "") {
|
||||
v8_enable_backtrace = is_debug && !v8_optimized_debug
|
||||
}
|
||||
@ -113,6 +121,10 @@ if (target_cpu == "mipsel" || target_cpu == "mips64el" ||
|
||||
v8_add_configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
||||
}
|
||||
|
||||
if (!build_with_chromium && is_clang) {
|
||||
v8_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
|
||||
}
|
||||
|
||||
# All templates should be kept in sync.
|
||||
template("v8_source_set") {
|
||||
if (defined(invoker.split_count) && invoker.split_count > 1 &&
|
||||
@ -192,6 +204,7 @@ template("v8_static_library") {
|
||||
forward_variables_from(invoker, "*", [ "configs" ])
|
||||
configs += invoker.configs
|
||||
configs -= v8_remove_configs
|
||||
configs -= [ "//build/config/compiler:thin_archive" ]
|
||||
configs += v8_add_configs
|
||||
}
|
||||
}
|
||||
|
4
deps/v8/include/OWNERS
vendored
4
deps/v8/include/OWNERS
vendored
@ -1,5 +1,9 @@
|
||||
set noparent
|
||||
|
||||
adamk@chromium.org
|
||||
danno@chromium.org
|
||||
ulan@chromium.org
|
||||
yangguo@chromium.org
|
||||
|
||||
per-file v8-inspector.h=dgozman@chromium.org
|
||||
per-file v8-inspector.h=pfeldman@chromium.org
|
||||
|
6
deps/v8/include/libplatform/libplatform.h
vendored
6
deps/v8/include/libplatform/libplatform.h
vendored
@ -62,8 +62,10 @@ V8_PLATFORM_EXPORT bool PumpMessageLoop(
|
||||
v8::Platform* platform, v8::Isolate* isolate,
|
||||
MessageLoopBehavior behavior = MessageLoopBehavior::kDoNotWait);
|
||||
|
||||
V8_PLATFORM_EXPORT void EnsureEventLoopInitialized(v8::Platform* platform,
|
||||
v8::Isolate* isolate);
|
||||
V8_PLATFORM_EXPORT V8_DEPRECATE_SOON(
|
||||
"This function has become obsolete and is essentially a nop",
|
||||
void EnsureEventLoopInitialized(v8::Platform* platform,
|
||||
v8::Isolate* isolate));
|
||||
|
||||
/**
|
||||
* Runs pending idle tasks for at most |idle_time_in_seconds| seconds.
|
||||
|
2
deps/v8/include/libplatform/v8-tracing.h
vendored
2
deps/v8/include/libplatform/v8-tracing.h
vendored
@ -112,8 +112,6 @@ class V8_PLATFORM_EXPORT TraceWriter {
|
||||
virtual void Flush() = 0;
|
||||
|
||||
static TraceWriter* CreateJSONTraceWriter(std::ostream& stream);
|
||||
static TraceWriter* CreateJSONTraceWriter(std::ostream& stream,
|
||||
const std::string& tag);
|
||||
|
||||
private:
|
||||
// Disallow copy and assign
|
||||
|
32
deps/v8/include/v8-platform.h
vendored
32
deps/v8/include/v8-platform.h
vendored
@ -5,9 +5,9 @@
|
||||
#ifndef V8_V8_PLATFORM_H_
|
||||
#define V8_V8_PLATFORM_H_
|
||||
|
||||
#include <cstdlib>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h> // For abort.
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
@ -288,16 +288,21 @@ class Platform {
|
||||
*/
|
||||
virtual bool OnCriticalMemoryPressure(size_t length) { return false; }
|
||||
|
||||
/**
|
||||
* Gets the number of worker threads used by GetWorkerThreadsTaskRunner() and
|
||||
* CallOnWorkerThread(). This can be used to estimate the number of tasks a
|
||||
* work package should be split into. A return value of 0 means that there are
|
||||
* no worker threads available. Note that a value of 0 won't prohibit V8 from
|
||||
* posting tasks using |CallOnWorkerThread|.
|
||||
*/
|
||||
virtual int NumberOfWorkerThreads() {
|
||||
return static_cast<int>(NumberOfAvailableBackgroundThreads());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of threads that are used to execute background tasks. Is
|
||||
* used to estimate the number of tasks a work package should be split into.
|
||||
* A return value of 0 means that there are no background threads available.
|
||||
* Note that a value of 0 won't prohibit V8 from posting tasks using
|
||||
* |CallOnBackgroundThread|.
|
||||
* Deprecated. Use NumberOfWorkerThreads() instead.
|
||||
* TODO(gab): Remove this when all embedders override
|
||||
* NumberOfWorkerThreads() instead.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"NumberOfAvailableBackgroundThreads() is deprecated, use "
|
||||
@ -340,8 +345,14 @@ class Platform {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a TaskRunner which can be used to post async tasks on a worker.
|
||||
* This function should only be called from a foreground thread.
|
||||
*/
|
||||
virtual std::shared_ptr<v8::TaskRunner> GetWorkerThreadsTaskRunner(
|
||||
Isolate* isolate) {
|
||||
// TODO(gab): Make this function abstract after it got implemented on all
|
||||
// platforms.
|
||||
return GetBackgroundTaskRunner(isolate);
|
||||
}
|
||||
|
||||
@ -365,10 +376,19 @@ class Platform {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a worker thread.
|
||||
* TODO(gab): Make pure virtual when all embedders override this instead of
|
||||
* CallOnBackgroundThread().
|
||||
*/
|
||||
virtual void CallOnWorkerThread(std::unique_ptr<Task> task) {
|
||||
CallOnBackgroundThread(task.release(), kShortRunningTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a task that blocks the main thread to be invoked with
|
||||
* high-priority on a worker thread.
|
||||
*/
|
||||
virtual void CallBlockingTaskOnWorkerThread(std::unique_ptr<Task> task) {
|
||||
// Embedders may optionally override this to process these tasks in a high
|
||||
// priority pool.
|
||||
|
18
deps/v8/include/v8-profiler.h
vendored
18
deps/v8/include/v8-profiler.h
vendored
@ -335,7 +335,8 @@ class V8_EXPORT CpuProfiler {
|
||||
/**
|
||||
* Tells the profiler whether the embedder is idle.
|
||||
*/
|
||||
void SetIdle(bool is_idle);
|
||||
V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.",
|
||||
void SetIdle(bool is_idle));
|
||||
|
||||
private:
|
||||
CpuProfiler();
|
||||
@ -401,7 +402,8 @@ class V8_EXPORT HeapGraphNode {
|
||||
// snapshot items together.
|
||||
kConsString = 10, // Concatenated string. A pair of pointers to strings.
|
||||
kSlicedString = 11, // Sliced string. A fragment of another string.
|
||||
kSymbol = 12 // A Symbol (ES6).
|
||||
kSymbol = 12, // A Symbol (ES6).
|
||||
kBigInt = 13 // BigInt.
|
||||
};
|
||||
|
||||
/** Returns node type (see HeapGraphNode::Type). */
|
||||
@ -875,11 +877,15 @@ class V8_EXPORT HeapProfiler {
|
||||
void DeleteAllHeapSnapshots();
|
||||
|
||||
/** Binds a callback to embedder's class ID. */
|
||||
void SetWrapperClassInfoProvider(
|
||||
uint16_t class_id,
|
||||
WrapperInfoCallback callback);
|
||||
V8_DEPRECATED(
|
||||
"Use SetBuildEmbedderGraphCallback to provide info about embedder nodes",
|
||||
void SetWrapperClassInfoProvider(uint16_t class_id,
|
||||
WrapperInfoCallback callback));
|
||||
|
||||
V8_DEPRECATED(
|
||||
"Use SetBuildEmbedderGraphCallback to provide info about embedder nodes",
|
||||
void SetGetRetainerInfosCallback(GetRetainerInfosCallback callback));
|
||||
|
||||
void SetGetRetainerInfosCallback(GetRetainerInfosCallback callback);
|
||||
void SetBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback);
|
||||
|
||||
/**
|
||||
|
6
deps/v8/include/v8-version.h
vendored
6
deps/v8/include/v8-version.h
vendored
@ -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 6
|
||||
#define V8_MINOR_VERSION 6
|
||||
#define V8_BUILD_NUMBER 346
|
||||
#define V8_PATCH_LEVEL 32
|
||||
#define V8_MINOR_VERSION 7
|
||||
#define V8_BUILD_NUMBER 288
|
||||
#define V8_PATCH_LEVEL 43
|
||||
|
||||
// Use 1 for candidates and 0 otherwise.
|
||||
// (Boolean macro values are not supported by all preprocessors.)
|
||||
|
197
deps/v8/include/v8.h
vendored
197
deps/v8/include/v8.h
vendored
@ -66,6 +66,8 @@ namespace v8 {
|
||||
class AccessorSignature;
|
||||
class Array;
|
||||
class ArrayBuffer;
|
||||
class BigInt;
|
||||
class BigIntObject;
|
||||
class Boolean;
|
||||
class BooleanObject;
|
||||
class Context;
|
||||
@ -1579,6 +1581,15 @@ class V8_EXPORT ScriptCompiler {
|
||||
static CachedData* CreateCodeCache(Local<UnboundScript> unbound_script,
|
||||
Local<String> source);
|
||||
|
||||
/**
|
||||
* Creates and returns code cache for the specified function that was
|
||||
* previously produced by CompileFunctionInContext.
|
||||
* This will return nullptr if the script cannot be serialized. The
|
||||
* CachedData returned by this function should be owned by the caller.
|
||||
*/
|
||||
static CachedData* CreateCodeCacheForFunction(Local<Function> function,
|
||||
Local<String> source);
|
||||
|
||||
private:
|
||||
static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal(
|
||||
Isolate* isolate, Source* source, CompileOptions options,
|
||||
@ -1650,6 +1661,7 @@ class V8_EXPORT Message {
|
||||
* Returns the index within the line of the last character where
|
||||
* the error occurred.
|
||||
*/
|
||||
int GetEndColumn() const;
|
||||
V8_WARN_UNUSED_RESULT Maybe<int> GetEndColumn(Local<Context> context) const;
|
||||
|
||||
/**
|
||||
@ -2153,6 +2165,11 @@ class V8_EXPORT Value : public Data {
|
||||
*/
|
||||
bool IsObject() const;
|
||||
|
||||
/**
|
||||
* Returns true if this value is a bigint.
|
||||
*/
|
||||
bool IsBigInt() const;
|
||||
|
||||
/**
|
||||
* Returns true if this value is boolean.
|
||||
*/
|
||||
@ -2188,6 +2205,11 @@ class V8_EXPORT Value : public Data {
|
||||
*/
|
||||
bool IsArgumentsObject() const;
|
||||
|
||||
/**
|
||||
* Returns true if this value is a BigInt object.
|
||||
*/
|
||||
bool IsBigIntObject() const;
|
||||
|
||||
/**
|
||||
* Returns true if this value is a Boolean object.
|
||||
*/
|
||||
@ -2356,11 +2378,8 @@ class V8_EXPORT Value : public Data {
|
||||
|
||||
bool IsWebAssemblyCompiledModule() const;
|
||||
|
||||
/**
|
||||
* Returns true if the value is a Module Namespace Object.
|
||||
*/
|
||||
bool IsModuleNamespaceObject() const;
|
||||
|
||||
V8_WARN_UNUSED_RESULT MaybeLocal<BigInt> ToBigInt(
|
||||
Local<Context> context) const;
|
||||
V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
|
||||
Local<Context> context) const;
|
||||
V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber(
|
||||
@ -3012,6 +3031,19 @@ class V8_EXPORT Uint32 : public Integer {
|
||||
static void CheckCast(v8::Value* obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* A JavaScript BigInt value (https://tc39.github.io/proposal-bigint)
|
||||
*/
|
||||
class V8_EXPORT BigInt : public Primitive {
|
||||
public:
|
||||
static Local<BigInt> New(Isolate* isolate, int64_t value);
|
||||
V8_INLINE static BigInt* Cast(v8::Value* obj);
|
||||
|
||||
private:
|
||||
BigInt();
|
||||
static void CheckCast(v8::Value* obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* PropertyAttribute.
|
||||
*/
|
||||
@ -3077,6 +3109,13 @@ enum PropertyFilter {
|
||||
SKIP_SYMBOLS = 16
|
||||
};
|
||||
|
||||
/**
|
||||
* Options for marking whether callbacks may trigger JS-observable side effects.
|
||||
* Side-effect-free callbacks are whitelisted during debug evaluation with
|
||||
* throwOnSideEffect. It applies when calling a Function, FunctionTemplate,
|
||||
* or an Accessor's getter callback. For Interceptors, please see
|
||||
* PropertyHandlerFlags's kHasNoSideEffect.
|
||||
*/
|
||||
enum class SideEffectType { kHasSideEffect, kHasNoSideEffect };
|
||||
|
||||
/**
|
||||
@ -3090,7 +3129,7 @@ enum class KeyCollectionMode { kOwnOnly, kIncludePrototypes };
|
||||
|
||||
/**
|
||||
* kIncludesIndices allows for integer indices to be collected, while
|
||||
* kSkipIndices will exclude integer indicies from being collected.
|
||||
* kSkipIndices will exclude integer indices from being collected.
|
||||
*/
|
||||
enum class IndexFilter { kIncludeIndices, kSkipIndices };
|
||||
|
||||
@ -3205,12 +3244,14 @@ class V8_EXPORT Object : public Value {
|
||||
V8_WARN_UNUSED_RESULT Maybe<bool> Delete(Local<Context> context,
|
||||
Local<Value> key);
|
||||
|
||||
V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context,
|
||||
uint32_t index);
|
||||
V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context, uint32_t index);
|
||||
|
||||
V8_WARN_UNUSED_RESULT Maybe<bool> Delete(Local<Context> context,
|
||||
uint32_t index);
|
||||
|
||||
/**
|
||||
* Note: SideEffectType affects the getter only, not the setter.
|
||||
*/
|
||||
V8_WARN_UNUSED_RESULT Maybe<bool> SetAccessor(
|
||||
Local<Context> context, Local<Name> name,
|
||||
AccessorNameGetterCallback getter, AccessorNameSetterCallback setter = 0,
|
||||
@ -3503,17 +3544,6 @@ class V8_EXPORT Object : public Value {
|
||||
*/
|
||||
Isolate* GetIsolate();
|
||||
|
||||
/**
|
||||
* If this object is a Set, Map, WeakSet or WeakMap, this returns a
|
||||
* representation of the elements of this object as an array.
|
||||
* If this object is a SetIterator or MapIterator, this returns all
|
||||
* elements of the underlying collection, starting at the iterator's current
|
||||
* position.
|
||||
* For other types, this will return an empty MaybeLocal<Array> (without
|
||||
* scheduling an exception).
|
||||
*/
|
||||
MaybeLocal<Array> PreviewEntries(bool* is_key_value);
|
||||
|
||||
static Local<Object> New(Isolate* isolate);
|
||||
|
||||
V8_INLINE static Object* Cast(Value* obj);
|
||||
@ -4294,6 +4324,11 @@ class V8_EXPORT ArrayBuffer : public Object {
|
||||
*/
|
||||
virtual void Free(void* data, size_t length) = 0;
|
||||
|
||||
/**
|
||||
* ArrayBuffer allocation mode. kNormal is a malloc/free style allocation,
|
||||
* while kReservation is for larger allocations with the ability to set
|
||||
* access permissions.
|
||||
*/
|
||||
enum class AllocationMode { kNormal, kReservation };
|
||||
|
||||
/**
|
||||
@ -4868,6 +4903,20 @@ class V8_EXPORT NumberObject : public Object {
|
||||
static void CheckCast(Value* obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* A BigInt object (https://tc39.github.io/proposal-bigint)
|
||||
*/
|
||||
class V8_EXPORT BigIntObject : public Object {
|
||||
public:
|
||||
static Local<Value> New(Isolate* isolate, int64_t value);
|
||||
|
||||
Local<BigInt> ValueOf() const;
|
||||
|
||||
V8_INLINE static BigIntObject* Cast(Value* obj);
|
||||
|
||||
private:
|
||||
static void CheckCast(Value* obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* A Boolean object (ECMA-262, 4.3.15).
|
||||
@ -5532,7 +5581,7 @@ class V8_EXPORT FunctionTemplate : public Template {
|
||||
|
||||
/**
|
||||
* Causes the function template to inherit from a parent function template.
|
||||
* This means the the function's prototype.__proto__ is set to the parent
|
||||
* This means the function's prototype.__proto__ is set to the parent
|
||||
* function's prototype.
|
||||
**/
|
||||
void Inherit(Local<FunctionTemplate> parent);
|
||||
@ -5633,6 +5682,11 @@ enum class PropertyHandlerFlags {
|
||||
* named interceptors.
|
||||
*/
|
||||
kOnlyInterceptStrings = 1 << 2,
|
||||
|
||||
/**
|
||||
* The getter, query, enumerator callbacks do not produce side effects.
|
||||
*/
|
||||
kHasNoSideEffect = 1 << 3,
|
||||
};
|
||||
|
||||
struct NamedPropertyHandlerConfiguration {
|
||||
@ -6209,24 +6263,6 @@ typedef void* (*CreateHistogramCallback)(const char* name,
|
||||
|
||||
typedef void (*AddHistogramSampleCallback)(void* histogram, int sample);
|
||||
|
||||
// --- Memory Allocation Callback ---
|
||||
enum ObjectSpace {
|
||||
kObjectSpaceNewSpace = 1 << 0,
|
||||
kObjectSpaceOldSpace = 1 << 1,
|
||||
kObjectSpaceCodeSpace = 1 << 2,
|
||||
kObjectSpaceMapSpace = 1 << 3,
|
||||
kObjectSpaceLoSpace = 1 << 4,
|
||||
kObjectSpaceAll = kObjectSpaceNewSpace | kObjectSpaceOldSpace |
|
||||
kObjectSpaceCodeSpace | kObjectSpaceMapSpace |
|
||||
kObjectSpaceLoSpace
|
||||
};
|
||||
|
||||
enum AllocationAction {
|
||||
kAllocationActionAllocate = 1 << 0,
|
||||
kAllocationActionFree = 1 << 1,
|
||||
kAllocationActionAll = kAllocationActionAllocate | kAllocationActionFree
|
||||
};
|
||||
|
||||
// --- Enter/Leave Script Callback ---
|
||||
typedef void (*BeforeCallEnteredCallback)(Isolate*);
|
||||
typedef void (*CallCompletedCallback)(Isolate*);
|
||||
@ -6445,6 +6481,15 @@ typedef void (*GCCallback)(GCType type, GCCallbackFlags flags);
|
||||
|
||||
typedef void (*InterruptCallback)(Isolate* isolate, void* data);
|
||||
|
||||
/**
|
||||
* This callback is invoked when the heap size is close to the heap limit and
|
||||
* V8 is likely to abort with out-of-memory error.
|
||||
* The callback can extend the heap limit by returning a value that is greater
|
||||
* than the current_heap_limit. The initial heap limit is the limit that was
|
||||
* set after heap setup.
|
||||
*/
|
||||
typedef size_t (*NearHeapLimitCallback)(void* data, size_t current_heap_limit,
|
||||
size_t initial_heap_limit);
|
||||
|
||||
/**
|
||||
* Collection of V8 heap information.
|
||||
@ -6578,6 +6623,12 @@ struct JitCodeEvent {
|
||||
// statement, and is used to indicate possible break locations.
|
||||
enum PositionType { POSITION, STATEMENT_POSITION };
|
||||
|
||||
// There are two different kinds of JitCodeEvents, one for JIT code generated
|
||||
// by the optimizing compiler, and one for byte code generated for the
|
||||
// interpreter. For JIT_CODE events, the |code_start| member of the event
|
||||
// points to the beginning of jitted assembly code, while for BYTE_CODE
|
||||
// events, |code_start| points to the first bytecode of the interpreted
|
||||
// function.
|
||||
enum CodeType { BYTE_CODE, JIT_CODE };
|
||||
|
||||
// Type of event.
|
||||
@ -7281,6 +7332,11 @@ class V8_EXPORT Isolate {
|
||||
V8_DEPRECATED("CpuProfiler should be created with CpuProfiler::New call.",
|
||||
CpuProfiler* GetCpuProfiler());
|
||||
|
||||
/**
|
||||
* Tells the CPU profiler whether the embedder is idle.
|
||||
*/
|
||||
void SetIdle(bool is_idle);
|
||||
|
||||
/** Returns true if this isolate has a current context. */
|
||||
bool InContext();
|
||||
|
||||
@ -7692,6 +7748,23 @@ class V8_EXPORT Isolate {
|
||||
/** Set the callback to invoke in case of OOM errors. */
|
||||
void SetOOMErrorHandler(OOMErrorCallback that);
|
||||
|
||||
/**
|
||||
* Add a callback to invoke in case the heap size is close to the heap limit.
|
||||
* If multiple callbacks are added, only the most recently added callback is
|
||||
* invoked.
|
||||
*/
|
||||
void AddNearHeapLimitCallback(NearHeapLimitCallback callback, void* data);
|
||||
|
||||
/**
|
||||
* Remove the given callback and restore the heap limit to the
|
||||
* given limit. If the given limit is zero, then it is ignored.
|
||||
* If the current heap size is greater than the given limit,
|
||||
* then the heap limit is restored to the minimal limit that
|
||||
* is possible for the current heap size.
|
||||
*/
|
||||
void RemoveNearHeapLimitCallback(NearHeapLimitCallback callback,
|
||||
size_t heap_limit);
|
||||
|
||||
/**
|
||||
* Set the callback to invoke to check if code generation from
|
||||
* strings should be allowed.
|
||||
@ -7947,6 +8020,15 @@ class V8_EXPORT V8 {
|
||||
*/
|
||||
static bool Dispose();
|
||||
|
||||
/**
|
||||
* Initialize the ICU library bundled with V8. The embedder should only
|
||||
* invoke this method when using the bundled ICU. Returns true on success.
|
||||
*
|
||||
* If V8 was compiled with the ICU data in an external file, the location
|
||||
* of the data file has to be provided.
|
||||
*/
|
||||
static bool InitializeICU(const char* icu_data_file = nullptr);
|
||||
|
||||
/**
|
||||
* Initialize the ICU library bundled with V8. The embedder should only
|
||||
* invoke this method when using the bundled ICU. If V8 was compiled with
|
||||
@ -8023,6 +8105,14 @@ class V8_EXPORT V8 {
|
||||
V8_DEPRECATE_SOON("Use EnableWebAssemblyTrapHandler",
|
||||
static bool RegisterDefaultSignalHandler());
|
||||
|
||||
/**
|
||||
* Activate trap-based bounds checking for WebAssembly.
|
||||
*
|
||||
* \param use_v8_signal_handler Whether V8 should install its own signal
|
||||
* handler or rely on the embedder's.
|
||||
*/
|
||||
static bool EnableWebAssemblyTrapHandler(bool use_v8_signal_handler);
|
||||
|
||||
private:
|
||||
V8();
|
||||
|
||||
@ -8580,6 +8670,11 @@ class V8_EXPORT Context {
|
||||
*/
|
||||
enum EmbedderDataFields { kDebugIdIndex = 0 };
|
||||
|
||||
/**
|
||||
* Return the number of fields allocated for embedder data.
|
||||
*/
|
||||
uint32_t GetNumberOfEmbedderDataFields();
|
||||
|
||||
/**
|
||||
* Gets the embedder data with the given index, which must have been set by a
|
||||
* previous call to SetEmbedderData with the same index.
|
||||
@ -8835,6 +8930,7 @@ const int kApiInt64Size = sizeof(int64_t); // NOLINT
|
||||
|
||||
// Tag information for HeapObject.
|
||||
const int kHeapObjectTag = 1;
|
||||
const int kWeakHeapObjectTag = 3;
|
||||
const int kHeapObjectTagSize = 2;
|
||||
const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1;
|
||||
|
||||
@ -9849,6 +9945,12 @@ Uint32* Uint32::Cast(v8::Value* value) {
|
||||
return static_cast<Uint32*>(value);
|
||||
}
|
||||
|
||||
BigInt* BigInt::Cast(v8::Value* value) {
|
||||
#ifdef V8_ENABLE_CHECKS
|
||||
CheckCast(value);
|
||||
#endif
|
||||
return static_cast<BigInt*>(value);
|
||||
}
|
||||
|
||||
Date* Date::Cast(v8::Value* value) {
|
||||
#ifdef V8_ENABLE_CHECKS
|
||||
@ -9881,6 +9983,12 @@ NumberObject* NumberObject::Cast(v8::Value* value) {
|
||||
return static_cast<NumberObject*>(value);
|
||||
}
|
||||
|
||||
BigIntObject* BigIntObject::Cast(v8::Value* value) {
|
||||
#ifdef V8_ENABLE_CHECKS
|
||||
CheckCast(value);
|
||||
#endif
|
||||
return static_cast<BigIntObject*>(value);
|
||||
}
|
||||
|
||||
BooleanObject* BooleanObject::Cast(v8::Value* value) {
|
||||
#ifdef V8_ENABLE_CHECKS
|
||||
@ -10047,6 +10155,19 @@ Float64Array* Float64Array::Cast(v8::Value* value) {
|
||||
return static_cast<Float64Array*>(value);
|
||||
}
|
||||
|
||||
BigInt64Array* BigInt64Array::Cast(v8::Value* value) {
|
||||
#ifdef V8_ENABLE_CHECKS
|
||||
CheckCast(value);
|
||||
#endif
|
||||
return static_cast<BigInt64Array*>(value);
|
||||
}
|
||||
|
||||
BigUint64Array* BigUint64Array::Cast(v8::Value* value) {
|
||||
#ifdef V8_ENABLE_CHECKS
|
||||
CheckCast(value);
|
||||
#endif
|
||||
return static_cast<BigUint64Array*>(value);
|
||||
}
|
||||
|
||||
Uint8ClampedArray* Uint8ClampedArray::Cast(v8::Value* value) {
|
||||
#ifdef V8_ENABLE_CHECKS
|
||||
|
8
deps/v8/include/v8config.h
vendored
8
deps/v8/include/v8config.h
vendored
@ -177,6 +177,9 @@
|
||||
// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
|
||||
// V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
|
||||
// supported
|
||||
// V8_HAS_BUILTIN_BSWAP16 - __builtin_bswap16() supported
|
||||
// V8_HAS_BUILTIN_BSWAP32 - __builtin_bswap32() supported
|
||||
// V8_HAS_BUILTIN_BSWAP64 - __builtin_bswap64() supported
|
||||
// V8_HAS_BUILTIN_CLZ - __builtin_clz() supported
|
||||
// V8_HAS_BUILTIN_CTZ - __builtin_ctz() supported
|
||||
// V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported
|
||||
@ -217,6 +220,9 @@
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(__has_attribute(warn_unused_result))
|
||||
|
||||
# define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
|
||||
# define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
|
||||
# define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
|
||||
# define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz))
|
||||
# define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz))
|
||||
# define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
|
||||
@ -405,7 +411,7 @@ namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; }
|
||||
|
||||
// Annotate a function indicating the caller must examine the return value.
|
||||
// Use like:
|
||||
// int foo() WARN_UNUSED_RESULT;
|
||||
// int foo() V8_WARN_UNUSED_RESULT;
|
||||
#if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
|
||||
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
|
7
deps/v8/infra/config/cq.cfg
vendored
7
deps/v8/infra/config/cq.cfg
vendored
@ -31,6 +31,7 @@ verifiers {
|
||||
triggered_by: "v8_linux64_asan_rel_ng"
|
||||
}
|
||||
builders { name: "v8_linux64_gcc_compile_dbg" }
|
||||
builders { name: "v8_linux64_jumbo_compile_rel" }
|
||||
builders { name: "v8_linux64_rel_ng" }
|
||||
builders {
|
||||
name: "v8_linux64_rel_ng_triggered"
|
||||
@ -84,10 +85,10 @@ verifiers {
|
||||
name: "v8_linux_verify_csa_rel_ng_triggered"
|
||||
triggered_by: "v8_linux_verify_csa_rel_ng"
|
||||
}
|
||||
builders { name: "v8_mac_rel_ng" }
|
||||
builders { name: "v8_mac64_rel_ng" }
|
||||
builders {
|
||||
name: "v8_mac_rel_ng_triggered"
|
||||
triggered_by: "v8_mac_rel_ng"
|
||||
name: "v8_mac64_rel_ng_triggered"
|
||||
triggered_by: "v8_mac64_rel_ng"
|
||||
}
|
||||
builders { name: "v8_node_linux64_rel" }
|
||||
builders { name: "v8_presubmit" }
|
||||
|
74
deps/v8/infra/mb/gn_isolate_map.pyl
vendored
Normal file
74
deps/v8/infra/mb/gn_isolate_map.pyl
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
# Copyright 2018 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.
|
||||
|
||||
# gn_isolate_map.pyl - A mapping of Ninja build target names to GN labels and
|
||||
# test type classifications for the tests that are run on the bots.
|
||||
#
|
||||
# This file is based on testing/buildbot/gn_isolate_map.pyl for Chromium, but
|
||||
# is covering V8 stand-alone tests instead.
|
||||
# See https://cs.chromium.org/chromium/src/testing/buildbot/gn_isolate_map.pyl
|
||||
# for more detailed documentation.
|
||||
|
||||
{
|
||||
"All": {
|
||||
"label": "//:All",
|
||||
"type": "script",
|
||||
},
|
||||
"benchmarks": {
|
||||
"label": "//test/benchmarks:v8_benchmarks",
|
||||
"type": "script",
|
||||
},
|
||||
"bot_default": {
|
||||
"label": "//test:v8_bot_default",
|
||||
"type": "script",
|
||||
},
|
||||
"check-static-initializers": {
|
||||
"label": "//tools:v8_check_static_initializers",
|
||||
"type": "script",
|
||||
},
|
||||
"d8_default": {
|
||||
"label": "//test:v8_d8_default",
|
||||
"type": "script",
|
||||
},
|
||||
"mjsunit": {
|
||||
"label": "//test/mjsunit:v8_mjsunit",
|
||||
"type": "script",
|
||||
},
|
||||
"mozilla": {
|
||||
"label": "//test/mozilla:v8_mozilla",
|
||||
"type": "script",
|
||||
},
|
||||
"optimize_for_size": {
|
||||
"label": "//test:v8_optimize_for_size",
|
||||
"type": "script",
|
||||
},
|
||||
"perf": {
|
||||
"label": "//test:v8_perf",
|
||||
"type": "script",
|
||||
},
|
||||
"jsfunfuzz": {
|
||||
"label": "//tools/jsfunfuzz:v8_jsfunfuzz",
|
||||
"type": "script",
|
||||
},
|
||||
"run-gcmole": {
|
||||
"label": "//tools/gcmole:v8_run_gcmole",
|
||||
"type": "script",
|
||||
},
|
||||
"run-num-fuzzer": {
|
||||
"label": "//test:v8_run_num_fuzzer",
|
||||
"type": "script",
|
||||
},
|
||||
"test262": {
|
||||
"label": "//test/test262:v8_test262",
|
||||
"type": "script",
|
||||
},
|
||||
"unittests": {
|
||||
"label": "//test/unittests:unittests",
|
||||
"type": "script",
|
||||
},
|
||||
"webkit": {
|
||||
"label": "//test/webkit:v8_webkit",
|
||||
"type": "script",
|
||||
},
|
||||
}
|
195
deps/v8/infra/mb/mb_config.pyl
vendored
195
deps/v8/infra/mb/mb_config.pyl
vendored
@ -68,6 +68,11 @@
|
||||
'V8 Linux64 - custom snapshot - debug builder': 'debug_x64_custom',
|
||||
'V8 Linux64 - internal snapshot': 'release_x64_internal',
|
||||
'V8 Linux64 - verify csa': 'release_x64_verify_csa',
|
||||
# Jumbo.
|
||||
'V8 Linux64 Jumbo': 'release_x64_jumbo',
|
||||
'V8 Linux64 Jumbo - debug': 'debug_x64_jumbo',
|
||||
'V8 Linux64 Jumbo - limited': 'release_x64_jumbo_limited',
|
||||
'V8 Linux64 Jumbo - limited - debug': 'debug_x64_jumbo_limited',
|
||||
# Windows.
|
||||
'V8 Win32 - builder': 'release_x86_minimal_symbols',
|
||||
'V8 Win32 - debug builder': 'debug_x86_minimal_symbols',
|
||||
@ -79,11 +84,9 @@
|
||||
'V8 Win64 - debug': 'debug_x64_minimal_symbols',
|
||||
'V8 Win64 - msvc': 'release_x64_msvc',
|
||||
# Mac.
|
||||
'V8 Mac': 'release_x86',
|
||||
'V8 Mac - debug': 'debug_x86',
|
||||
'V8 Mac64': 'release_x64',
|
||||
'V8 Mac64 - debug': 'debug_x64',
|
||||
'V8 Mac GC Stress': 'debug_x86',
|
||||
'V8 Mac64 GC Stress': 'debug_x64',
|
||||
'V8 Mac64 ASAN': 'release_x64_asan_no_lsan',
|
||||
# Sanitizers.
|
||||
'V8 Linux64 ASAN': 'release_x64_asan',
|
||||
@ -97,7 +100,6 @@
|
||||
# FYI.
|
||||
'V8 Fuchsia': 'release_x64_fuchsia',
|
||||
'V8 Fuchsia - debug': 'debug_x64_fuchsia',
|
||||
'V8 Linux - swarming staging': 'release_x64',
|
||||
'V8 Linux64 - cfi': 'release_x64_cfi',
|
||||
'V8 Linux64 UBSanVptr': 'release_x64_ubsan_vptr',
|
||||
'V8 Linux - vtunejit': 'debug_x86_vtunejit',
|
||||
@ -210,9 +212,12 @@
|
||||
'v8_linux64_rel_ng': 'release_x64_test_features_trybot',
|
||||
'v8_linux64_verify_csa_rel_ng': 'release_x64_verify_csa',
|
||||
'v8_linux64_asan_rel_ng': 'release_x64_asan_minimal_symbols',
|
||||
'v8_linux64_cfi_rel_ng': 'release_x64_cfi',
|
||||
'v8_linux64_msan_rel': 'release_simulate_arm64_msan_minimal_symbols',
|
||||
'v8_linux64_sanitizer_coverage_rel':
|
||||
'release_x64_asan_minimal_symbols_coverage',
|
||||
'v8_linux64_jumbo_compile_rel': 'release_x64_jumbo_trybot',
|
||||
'v8_linux64_jumbo_limited_compile_rel': 'release_x64_jumbo_limited_trybot',
|
||||
'v8_linux64_tsan_rel': 'release_x64_tsan_minimal_symbols',
|
||||
'v8_linux64_tsan_concurrent_marking_rel_ng':
|
||||
'release_x64_tsan_concurrent_marking_minimal_symbols',
|
||||
@ -226,12 +231,12 @@
|
||||
'v8_win64_asan_rel_ng': 'release_x64_asan_no_lsan',
|
||||
'v8_win64_msvc_compile_rel': 'release_x64_msvc',
|
||||
'v8_win64_dbg': 'debug_x64_minimal_symbols',
|
||||
'v8_win64_msvc_rel_ng': 'release_x64_msvc',
|
||||
'v8_win64_rel_ng': 'release_x64_trybot',
|
||||
'v8_mac_rel_ng': 'release_x86_trybot',
|
||||
'v8_mac_dbg': 'debug_x86_trybot',
|
||||
'v8_mac_gc_stress_dbg': 'debug_x86_trybot',
|
||||
'v8_mac64_rel': 'release_x64_trybot',
|
||||
'v8_mac64_dbg': 'debug_x64_minimal_symbols',
|
||||
'v8_mac64_gc_stress_dbg': 'debug_x64_trybot',
|
||||
'v8_mac64_rel_ng': 'release_x64_trybot',
|
||||
'v8_mac64_dbg': 'debug_x64',
|
||||
'v8_mac64_dbg_ng': 'debug_x64',
|
||||
'v8_mac64_asan_rel': 'release_x64_asan_no_lsan',
|
||||
'v8_linux_arm_rel_ng': 'release_simulate_arm_trybot',
|
||||
'v8_linux_arm_dbg': 'debug_simulate_arm',
|
||||
@ -321,160 +326,174 @@
|
||||
|
||||
# Debug configs for simulators.
|
||||
'debug_simulate_arm': [
|
||||
'debug_bot', 'simulate_arm', 'swarming'],
|
||||
'debug_bot', 'simulate_arm'],
|
||||
'debug_simulate_arm_asan_edge': [
|
||||
'debug_bot', 'simulate_arm', 'asan', 'edge'],
|
||||
'debug_simulate_arm64': [
|
||||
'debug_bot', 'simulate_arm64', 'swarming'],
|
||||
'debug_bot', 'simulate_arm64'],
|
||||
'debug_simulate_arm64_asan_edge': [
|
||||
'debug_bot', 'simulate_arm64', 'asan', 'lsan', 'edge'],
|
||||
'debug_simulate_arm64_no_snap': [
|
||||
'debug', 'simulate_arm64', 'shared', 'goma', 'v8_optimized_debug',
|
||||
'swarming', 'v8_snapshot_none'],
|
||||
'v8_snapshot_none'],
|
||||
'debug_simulate_mipsel_asan_edge': [
|
||||
'debug_bot', 'simulate_mipsel', 'asan', 'edge'],
|
||||
|
||||
# Release configs for simulators.
|
||||
'release_simulate_arm': [
|
||||
'release_bot', 'simulate_arm', 'swarming'],
|
||||
'release_bot', 'simulate_arm'],
|
||||
'release_simulate_arm_trybot': [
|
||||
'release_trybot', 'simulate_arm', 'swarming'],
|
||||
'release_trybot', 'simulate_arm'],
|
||||
'release_simulate_arm64': [
|
||||
'release_bot', 'simulate_arm64', 'swarming'],
|
||||
'release_bot', 'simulate_arm64'],
|
||||
'release_simulate_arm64_msan': [
|
||||
'release_bot', 'simulate_arm64', 'msan', 'swarming'],
|
||||
'release_bot', 'simulate_arm64', 'msan'],
|
||||
'release_simulate_arm64_msan_minimal_symbols': [
|
||||
'release_bot', 'simulate_arm64', 'msan', 'minimal_symbols', 'swarming'],
|
||||
'release_bot', 'simulate_arm64', 'msan', 'minimal_symbols'],
|
||||
'release_simulate_arm64_msan_edge': [
|
||||
'release_bot', 'simulate_arm64', 'edge', 'msan'],
|
||||
'release_simulate_arm64_msan_no_origins_edge': [
|
||||
'release_bot', 'simulate_arm64', 'edge', 'msan_no_origins'],
|
||||
'release_simulate_arm64_trybot': [
|
||||
'release_trybot', 'simulate_arm64', 'swarming'],
|
||||
'release_trybot', 'simulate_arm64'],
|
||||
'release_simulate_mipsel': [
|
||||
'release_bot', 'simulate_mipsel', 'swarming'],
|
||||
'release_bot', 'simulate_mipsel'],
|
||||
'release_simulate_mips64el': [
|
||||
'release_bot', 'simulate_mips64el', 'swarming'],
|
||||
'release_bot', 'simulate_mips64el'],
|
||||
'release_simulate_ppc': [
|
||||
'release_bot', 'simulate_ppc', 'swarming'],
|
||||
'release_bot', 'simulate_ppc'],
|
||||
'release_simulate_ppc64': [
|
||||
'release_bot', 'simulate_ppc64', 'swarming'],
|
||||
'release_bot', 'simulate_ppc64'],
|
||||
'release_simulate_s390': [
|
||||
'release_bot', 'simulate_s390', 'swarming'],
|
||||
'release_bot', 'simulate_s390'],
|
||||
'release_simulate_s390x': [
|
||||
'release_bot', 'simulate_s390x', 'swarming'],
|
||||
'release_bot', 'simulate_s390x'],
|
||||
|
||||
# Debug configs for arm.
|
||||
'debug_arm': [
|
||||
'debug_bot', 'arm', 'hard_float', 'swarming'],
|
||||
'debug_bot', 'arm', 'hard_float'],
|
||||
|
||||
# Release configs for arm.
|
||||
'release_arm': [
|
||||
'release_bot', 'arm', 'hard_float', 'swarming'],
|
||||
'release_bot', 'arm', 'hard_float'],
|
||||
'release_android_arm': [
|
||||
'release_bot', 'arm', 'android', 'minimal_symbols', 'swarming'],
|
||||
'release_bot', 'arm', 'android', 'minimal_symbols'],
|
||||
'release_android_arm64': [
|
||||
'release_bot', 'arm64', 'android', 'minimal_symbols', 'swarming'],
|
||||
'release_bot', 'arm64', 'android', 'minimal_symbols'],
|
||||
|
||||
# Release configs for x64.
|
||||
'release_x64': [
|
||||
'release_bot', 'x64', 'swarming'],
|
||||
'release_bot', 'x64'],
|
||||
'release_x64_asan': [
|
||||
'release_bot', 'x64', 'asan', 'lsan', 'swarming'],
|
||||
'release_bot', 'x64', 'asan', 'lsan'],
|
||||
'release_x64_asan_minimal_symbols': [
|
||||
'release_bot', 'x64', 'asan', 'lsan', 'minimal_symbols', 'swarming'],
|
||||
'release_bot', 'x64', 'asan', 'lsan', 'minimal_symbols'],
|
||||
'release_x64_asan_minimal_symbols_coverage': [
|
||||
'release_bot', 'x64', 'asan', 'bb', 'coverage', 'lsan', 'minimal_symbols',
|
||||
'swarming'],
|
||||
'release_bot', 'x64', 'asan', 'bb', 'coverage', 'lsan', 'minimal_symbols'],
|
||||
'release_x64_asan_no_lsan': [
|
||||
'release_bot', 'x64', 'asan', 'swarming'],
|
||||
'release_bot', 'x64', 'asan'],
|
||||
'release_x64_asan_no_lsan_edge_verify_heap': [
|
||||
'release_bot', 'x64', 'asan', 'edge', 'swarming', 'v8_verify_heap'],
|
||||
'release_bot', 'x64', 'asan', 'edge', 'v8_verify_heap'],
|
||||
'release_x64_asan_no_lsan_verify_heap': [
|
||||
'release_bot', 'x64', 'asan', 'swarming', 'v8_verify_heap'],
|
||||
'release_bot', 'x64', 'asan', 'v8_verify_heap'],
|
||||
'release_x64_asan_no_lsan_verify_heap_dchecks': [
|
||||
'release_bot', 'x64', 'asan', 'swarming', 'dcheck_always_on',
|
||||
'release_bot', 'x64', 'asan', 'dcheck_always_on',
|
||||
'v8_enable_slow_dchecks', 'v8_verify_heap'],
|
||||
'release_x64_asan_symbolized_edge_verify_heap': [
|
||||
'release_bot', 'x64', 'asan', 'edge', 'lsan', 'symbolized',
|
||||
'v8_verify_heap'],
|
||||
'release_x64_cfi': [
|
||||
'release_bot', 'x64', 'cfi', 'swarming'],
|
||||
'release_bot', 'x64', 'cfi'],
|
||||
'release_x64_cfi_clusterfuzz': [
|
||||
'release_bot', 'x64', 'cfi_clusterfuzz'],
|
||||
'release_x64_msvc': [
|
||||
'release_bot', 'x64', 'msvc', 'swarming'],
|
||||
'release_bot', 'x64', 'msvc'],
|
||||
'release_x64_concurrent_marking': [
|
||||
'release_bot', 'x64', 'v8_enable_concurrent_marking', 'swarming'],
|
||||
'release_bot', 'x64', 'v8_enable_concurrent_marking'],
|
||||
'release_x64_correctness_fuzzer' : [
|
||||
'release_bot', 'x64', 'v8_correctness_fuzzer', 'swarming'],
|
||||
'release_bot', 'x64', 'v8_correctness_fuzzer'],
|
||||
'release_x64_fuchsia': [
|
||||
'release_bot', 'x64', 'fuchsia', 'swarming'],
|
||||
'release_bot', 'x64', 'fuchsia'],
|
||||
'release_x64_fuchsia_trybot': [
|
||||
'release_trybot', 'x64', 'fuchsia', 'swarming'],
|
||||
'release_trybot', 'x64', 'fuchsia'],
|
||||
'release_x64_gcc_coverage': [
|
||||
'release_bot', 'x64', 'coverage', 'gcc'],
|
||||
'release_x64_internal': [
|
||||
'release_bot', 'x64', 'swarming', 'v8_snapshot_internal'],
|
||||
'release_bot', 'x64', 'v8_enable_embedded_builtins',
|
||||
'v8_snapshot_internal'],
|
||||
'release_x64_jumbo': [
|
||||
'release_bot', 'x64', 'jumbo'],
|
||||
'release_x64_jumbo_trybot': [
|
||||
'release_trybot', 'x64', 'jumbo'],
|
||||
'release_x64_jumbo_limited': [
|
||||
'release_bot', 'x64', 'jumbo_limited'],
|
||||
'release_x64_jumbo_limited_trybot': [
|
||||
'release_trybot', 'x64', 'jumbo_limited'],
|
||||
'release_x64_minimal_symbols': [
|
||||
'release_bot', 'x64', 'minimal_symbols', 'swarming'],
|
||||
'release_bot', 'x64', 'minimal_symbols'],
|
||||
'release_x64_no_snap': [
|
||||
'release_bot', 'x64', 'swarming', 'v8_snapshot_none'],
|
||||
'release_bot', 'x64', 'v8_snapshot_none'],
|
||||
'release_x64_trybot': [
|
||||
'release_trybot', 'x64', 'swarming'],
|
||||
'release_trybot', 'x64'],
|
||||
'release_x64_test_features_trybot': [
|
||||
'release_trybot', 'x64', 'swarming', 'v8_enable_test_features'],
|
||||
'release_trybot', 'x64', 'v8_enable_test_features'],
|
||||
'release_x64_tsan': [
|
||||
'release_bot', 'x64', 'tsan', 'swarming'],
|
||||
'release_bot', 'x64', 'tsan'],
|
||||
'release_x64_tsan_concurrent_marking': [
|
||||
'release_bot', 'x64', 'v8_enable_concurrent_marking', 'tsan', 'swarming'],
|
||||
'release_bot', 'x64', 'v8_enable_concurrent_marking', 'tsan'],
|
||||
'release_x64_tsan_concurrent_marking_minimal_symbols': [
|
||||
'release_bot', 'x64', 'v8_enable_concurrent_marking', 'tsan',
|
||||
'minimal_symbols', 'swarming'],
|
||||
'minimal_symbols'],
|
||||
'release_x64_tsan_minimal_symbols': [
|
||||
'release_bot', 'x64', 'tsan', 'minimal_symbols', 'swarming'],
|
||||
'release_bot', 'x64', 'tsan', 'minimal_symbols'],
|
||||
'release_x64_ubsan_vptr': [
|
||||
'release_bot', 'x64', 'ubsan_vptr', 'swarming'],
|
||||
'release_bot', 'x64', 'ubsan_vptr'],
|
||||
'release_x64_ubsan_vptr_recover_edge': [
|
||||
'release_bot', 'x64', 'edge', 'ubsan_vptr_recover', 'swarming'],
|
||||
'release_bot', 'x64', 'edge', 'ubsan_vptr_recover'],
|
||||
'release_x64_ubsan_vptr_minimal_symbols': [
|
||||
'release_bot', 'x64', 'ubsan_vptr', 'minimal_symbols', 'swarming'],
|
||||
'release_bot', 'x64', 'ubsan_vptr', 'minimal_symbols'],
|
||||
'release_x64_verify_csa': [
|
||||
'release_bot', 'x64', 'swarming', 'dcheck_always_on',
|
||||
'v8_enable_slow_dchecks', 'v8_verify_csa'],
|
||||
'release_bot', 'x64', 'dcheck_always_on',
|
||||
'v8_enable_slow_dchecks', 'v8_enable_embedded_builtins', 'v8_verify_csa'],
|
||||
|
||||
# Debug configs for x64.
|
||||
'debug_x64': [
|
||||
'debug_bot', 'x64', 'swarming'],
|
||||
'debug_bot', 'x64'],
|
||||
'debug_x64_asan_edge': [
|
||||
'debug_bot', 'x64', 'asan', 'lsan', 'edge'],
|
||||
'debug_x64_asan_no_lsan_static_edge': [
|
||||
'debug', 'static', 'goma', 'v8_enable_slow_dchecks', 'v8_optimized_debug',
|
||||
'x64', 'asan', 'edge', 'swarming'],
|
||||
'x64', 'asan', 'edge'],
|
||||
'debug_x64_custom': [
|
||||
'debug_bot', 'x64', 'swarming', 'v8_snapshot_custom'],
|
||||
'debug_bot', 'x64', 'v8_snapshot_custom'],
|
||||
'debug_x64_fuchsia': [
|
||||
'debug_bot', 'x64', 'fuchsia', 'swarming'],
|
||||
'debug_bot', 'x64', 'fuchsia'],
|
||||
'debug_x64_gcc': [
|
||||
'debug_bot', 'x64', 'gcc'],
|
||||
'debug_x64_jumbo': [
|
||||
'debug_bot', 'x64', 'jumbo'],
|
||||
'debug_x64_jumbo_limited': [
|
||||
'debug_bot', 'x64', 'jumbo_limited'],
|
||||
'debug_x64_minimal_symbols': [
|
||||
'debug_bot', 'x64', 'minimal_symbols', 'swarming'],
|
||||
'debug_bot', 'x64', 'minimal_symbols'],
|
||||
'debug_x64_no_snap': [
|
||||
'debug_bot', 'x64', 'swarming', 'v8_snapshot_none'],
|
||||
'debug_bot', 'x64', 'v8_snapshot_none'],
|
||||
'debug_x64_trybot': [
|
||||
'debug_trybot', 'x64'],
|
||||
|
||||
# Debug configs for x86.
|
||||
'debug_x86': [
|
||||
'debug_bot', 'x86', 'swarming'],
|
||||
'debug_bot', 'x86'],
|
||||
'debug_x86_minimal_symbols': [
|
||||
'debug_bot', 'x86', 'minimal_symbols', 'swarming'],
|
||||
'debug_bot', 'x86', 'minimal_symbols'],
|
||||
'debug_x86_no_i18n': [
|
||||
'debug_bot', 'x86', 'swarming', 'v8_no_i18n'],
|
||||
'debug_bot', 'x86', 'v8_no_i18n'],
|
||||
'debug_x86_no_snap': [
|
||||
'debug_bot', 'x86', 'swarming', 'v8_snapshot_none'],
|
||||
'debug_bot', 'x86', 'v8_snapshot_none'],
|
||||
'debug_x86_no_snap_trybot': [
|
||||
'debug_trybot', 'x86', 'swarming', 'v8_snapshot_none'],
|
||||
'debug_trybot', 'x86', 'v8_snapshot_none'],
|
||||
'debug_x86_trybot': [
|
||||
'debug_trybot', 'x86', 'swarming'],
|
||||
'debug_trybot', 'x86'],
|
||||
'debug_x86_vtunejit': [
|
||||
'debug_bot', 'x86', 'v8_enable_vtunejit'],
|
||||
'full_debug_x86': [
|
||||
@ -483,7 +502,7 @@
|
||||
|
||||
# Release configs for x86.
|
||||
'release_x86': [
|
||||
'release_bot', 'x86', 'swarming'],
|
||||
'release_bot', 'x86'],
|
||||
'release_x86_disassembler': [
|
||||
'release_bot', 'x86', 'v8_enable_disassembler'],
|
||||
'release_x86_gcc': [
|
||||
@ -491,30 +510,30 @@
|
||||
'release_x86_gcc_minimal_symbols': [
|
||||
'release_bot', 'x86', 'gcc', 'minimal_symbols'],
|
||||
'release_x86_gcmole': [
|
||||
'release_bot', 'x86', 'gcmole', 'swarming'],
|
||||
'release_bot', 'x86', 'gcmole'],
|
||||
'release_x86_gcmole_trybot': [
|
||||
'release_trybot', 'x86', 'gcmole', 'swarming'],
|
||||
'release_trybot', 'x86', 'gcmole'],
|
||||
'release_x86_interpreted_regexp': [
|
||||
'release_bot', 'x86', 'v8_interpreted_regexp'],
|
||||
'release_x86_minimal_symbols': [
|
||||
'release_bot', 'x86', 'minimal_symbols', 'swarming'],
|
||||
'release_bot', 'x86', 'minimal_symbols'],
|
||||
'release_x86_no_i18n_trybot': [
|
||||
'release_trybot', 'x86', 'swarming', 'v8_no_i18n'],
|
||||
'release_trybot', 'x86', 'v8_no_i18n'],
|
||||
'release_x86_no_snap': [
|
||||
'release_bot', 'x86', 'swarming', 'v8_snapshot_none'],
|
||||
'release_bot', 'x86', 'v8_snapshot_none'],
|
||||
'release_x86_no_snap_shared_minimal_symbols': [
|
||||
'release', 'x86', 'goma', 'minimal_symbols', 'shared', 'swarming',
|
||||
'release', 'x86', 'goma', 'minimal_symbols', 'shared',
|
||||
'v8_snapshot_none'],
|
||||
'release_x86_no_snap_trybot': [
|
||||
'release_trybot', 'x86', 'swarming', 'v8_snapshot_none'],
|
||||
'release_trybot', 'x86', 'v8_snapshot_none'],
|
||||
'release_x86_predictable': [
|
||||
'release_bot', 'x86', 'v8_enable_verify_predictable'],
|
||||
'release_x86_shared_verify_heap': [
|
||||
'release', 'x86', 'goma', 'shared', 'swarming', 'v8_verify_heap'],
|
||||
'release', 'x86', 'goma', 'shared', 'v8_verify_heap'],
|
||||
'release_x86_trybot': [
|
||||
'release_trybot', 'x86', 'swarming'],
|
||||
'release_trybot', 'x86'],
|
||||
'release_x86_verify_csa': [
|
||||
'release_bot', 'x86', 'swarming', 'dcheck_always_on',
|
||||
'release_bot', 'x86', 'dcheck_always_on',
|
||||
'v8_enable_slow_dchecks', 'v8_verify_csa'],
|
||||
|
||||
# Release configs for mips.
|
||||
@ -608,6 +627,14 @@
|
||||
'gn_args': 'arm_float_abi="hard"',
|
||||
},
|
||||
|
||||
'jumbo': {
|
||||
'gn_args': 'use_jumbo_build=true',
|
||||
},
|
||||
|
||||
'jumbo_limited': {
|
||||
'gn_args': 'use_jumbo_build=true jumbo_file_merge_limit=50',
|
||||
},
|
||||
|
||||
'lsan': {
|
||||
'mixins': ['v8_enable_test_features'],
|
||||
'gn_args': 'is_lsan=true',
|
||||
@ -699,10 +726,6 @@
|
||||
'gn_args': 'is_component_build=false',
|
||||
},
|
||||
|
||||
'swarming': {
|
||||
'gn_args': 'v8_test_isolation_mode="prepare"',
|
||||
},
|
||||
|
||||
# TODO(machenbach): Remove the symbolized config after the bots are gone.
|
||||
'symbolized': {
|
||||
'gn_args': 'v8_no_inline=true',
|
||||
@ -744,6 +767,10 @@
|
||||
'gn_args': 'v8_enable_disassembler=true',
|
||||
},
|
||||
|
||||
'v8_enable_embedded_builtins': {
|
||||
'gn_args': 'v8_enable_embedded_builtins=true',
|
||||
},
|
||||
|
||||
'v8_enable_slow_dchecks': {
|
||||
'gn_args': 'v8_enable_slow_dchecks=true',
|
||||
},
|
||||
|
2
deps/v8/src/DEPS
vendored
2
deps/v8/src/DEPS
vendored
@ -8,6 +8,8 @@ include_rules = [
|
||||
"+src/compiler/code-assembler.h",
|
||||
"+src/compiler/wasm-compiler.h",
|
||||
"-src/heap",
|
||||
"+src/heap/factory.h",
|
||||
"+src/heap/factory-inl.h",
|
||||
"+src/heap/heap.h",
|
||||
"+src/heap/heap-inl.h",
|
||||
"-src/inspector",
|
||||
|
23
deps/v8/src/accessors.cc
vendored
23
deps/v8/src/accessors.cc
vendored
@ -8,8 +8,8 @@
|
||||
#include "src/contexts.h"
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/execution.h"
|
||||
#include "src/factory.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/heap/factory.h"
|
||||
#include "src/isolate-inl.h"
|
||||
#include "src/messages.h"
|
||||
#include "src/property-details.h"
|
||||
@ -28,6 +28,7 @@ Handle<AccessorInfo> Accessors::MakeAccessor(
|
||||
info->set_is_special_data_property(true);
|
||||
info->set_is_sloppy(false);
|
||||
info->set_replace_on_access(false);
|
||||
info->set_has_no_side_effect(false);
|
||||
name = factory->InternalizeName(name);
|
||||
info->set_name(*name);
|
||||
Handle<Object> get = v8::FromCData(isolate, getter);
|
||||
@ -78,7 +79,7 @@ bool Accessors::IsJSObjectFieldAccessor(Handle<Map> map, Handle<Name> name,
|
||||
|
||||
namespace {
|
||||
|
||||
MUST_USE_RESULT MaybeHandle<Object> ReplaceAccessorWithDataProperty(
|
||||
V8_WARN_UNUSED_RESULT MaybeHandle<Object> ReplaceAccessorWithDataProperty(
|
||||
Isolate* isolate, Handle<Object> receiver, Handle<JSObject> holder,
|
||||
Handle<Name> name, Handle<Object> value) {
|
||||
LookupIterator it(receiver, name, holder,
|
||||
@ -97,6 +98,9 @@ MUST_USE_RESULT MaybeHandle<Object> ReplaceAccessorWithDataProperty(
|
||||
|
||||
} // namespace
|
||||
|
||||
//
|
||||
// Accessors::ReconfigureToDataProperty
|
||||
//
|
||||
void Accessors::ReconfigureToDataProperty(
|
||||
v8::Local<v8::Name> key, v8::Local<v8::Value> val,
|
||||
const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
||||
@ -118,6 +122,18 @@ void Accessors::ReconfigureToDataProperty(
|
||||
}
|
||||
}
|
||||
|
||||
void Accessors::ReconfigureToDataPropertyGetter(
|
||||
v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
Handle<AccessorInfo> Accessors::MakeReconfigureToDataPropertyInfo(
|
||||
Isolate* isolate) {
|
||||
Handle<Name> name = isolate->factory()->ReconfigureToDataProperty_string();
|
||||
return MakeAccessor(isolate, name, &ReconfigureToDataPropertyGetter,
|
||||
&ReconfigureToDataProperty);
|
||||
}
|
||||
|
||||
//
|
||||
// Accessors::ArgumentsIterator
|
||||
//
|
||||
@ -299,7 +315,6 @@ Handle<AccessorInfo> Accessors::MakeStringLengthInfo(Isolate* isolate) {
|
||||
&StringLengthGetter, nullptr);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Accessors::ScriptColumnOffset
|
||||
//
|
||||
@ -613,7 +628,7 @@ void Accessors::ScriptEvalFromFunctionNameGetter(
|
||||
if (script->has_eval_from_shared()) {
|
||||
Handle<SharedFunctionInfo> shared(script->eval_from_shared());
|
||||
// Find the name of the function calling eval.
|
||||
result = Handle<Object>(shared->name(), isolate);
|
||||
result = Handle<Object>(shared->Name(), isolate);
|
||||
}
|
||||
info.GetReturnValue().Set(Utils::ToLocal(result));
|
||||
}
|
||||
|
20
deps/v8/src/accessors.h
vendored
20
deps/v8/src/accessors.h
vendored
@ -33,6 +33,7 @@ class JavaScriptFrame;
|
||||
V(function_name, FunctionName) \
|
||||
V(function_length, FunctionLength) \
|
||||
V(function_prototype, FunctionPrototype) \
|
||||
V(reconfigure_to_data_property, ReconfigureToDataProperty) \
|
||||
V(script_column_offset, ScriptColumnOffset) \
|
||||
V(script_compilation_type, ScriptCompilationType) \
|
||||
V(script_context_data, ScriptContextData) \
|
||||
@ -48,6 +49,15 @@ class JavaScriptFrame;
|
||||
V(script_source_mapping_url, ScriptSourceMappingUrl) \
|
||||
V(string_length, StringLength)
|
||||
|
||||
#define SIDE_EFFECT_FREE_ACCESSOR_INFO_LIST(V) \
|
||||
V(ArrayLength) \
|
||||
V(BoundFunctionLength) \
|
||||
V(BoundFunctionName) \
|
||||
V(FunctionName) \
|
||||
V(FunctionLength) \
|
||||
V(FunctionPrototype) \
|
||||
V(StringLength)
|
||||
|
||||
#define ACCESSOR_SETTER_LIST(V) \
|
||||
V(ArrayLengthSetter) \
|
||||
V(ErrorStackSetter) \
|
||||
@ -73,6 +83,16 @@ class Accessors : public AllStatic {
|
||||
ACCESSOR_SETTER_LIST(ACCESSOR_SETTER_DECLARATION)
|
||||
#undef ACCESSOR_SETTER_DECLARATION
|
||||
|
||||
static constexpr int kAccessorInfoCount =
|
||||
#define COUNT_ACCESSOR(...) +1
|
||||
ACCESSOR_INFO_LIST(COUNT_ACCESSOR);
|
||||
#undef COUNT_ACCESSOR
|
||||
|
||||
static constexpr int kAccessorSetterCount =
|
||||
#define COUNT_ACCESSOR(...) +1
|
||||
ACCESSOR_SETTER_LIST(COUNT_ACCESSOR);
|
||||
#undef COUNT_ACCESSOR
|
||||
|
||||
static void ModuleNamespaceEntryGetter(
|
||||
v8::Local<v8::Name> name,
|
||||
const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
|
4
deps/v8/src/allocation.cc
vendored
4
deps/v8/src/allocation.cc
vendored
@ -69,7 +69,7 @@ const int kAllocationTries = 2;
|
||||
void* Malloced::New(size_t size) {
|
||||
void* result = AllocWithRetry(size);
|
||||
if (result == nullptr) {
|
||||
V8::FatalProcessOutOfMemory("Malloced operator new");
|
||||
V8::FatalProcessOutOfMemory(nullptr, "Malloced operator new");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -115,7 +115,7 @@ void* AlignedAlloc(size_t size, size_t alignment) {
|
||||
if (!OnCriticalMemoryPressure(size + alignment)) break;
|
||||
}
|
||||
if (result == nullptr) {
|
||||
V8::FatalProcessOutOfMemory("AlignedAlloc");
|
||||
V8::FatalProcessOutOfMemory(nullptr, "AlignedAlloc");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
11
deps/v8/src/allocation.h
vendored
11
deps/v8/src/allocation.h
vendored
@ -14,13 +14,16 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
class Isolate;
|
||||
|
||||
// This file defines memory allocation functions. If a first attempt at an
|
||||
// allocation fails, these functions call back into the embedder, then attempt
|
||||
// the allocation a second time. The embedder callback must not reenter V8.
|
||||
|
||||
// Called when allocation routines fail to allocate, even with a possible retry.
|
||||
// This function should not return, but should terminate the current processing.
|
||||
V8_EXPORT_PRIVATE void FatalProcessOutOfMemory(const char* message);
|
||||
[[noreturn]] V8_EXPORT_PRIVATE void FatalProcessOutOfMemory(
|
||||
Isolate* isolate, const char* message);
|
||||
|
||||
// Superclass for classes managed with new & delete.
|
||||
class V8_EXPORT_PRIVATE Malloced {
|
||||
@ -38,13 +41,13 @@ T* NewArray(size_t size) {
|
||||
if (result == nullptr) {
|
||||
V8::GetCurrentPlatform()->OnCriticalMemoryPressure();
|
||||
result = new (std::nothrow) T[size];
|
||||
if (result == nullptr) FatalProcessOutOfMemory("NewArray");
|
||||
if (result == nullptr) FatalProcessOutOfMemory(nullptr, "NewArray");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T,
|
||||
typename = typename std::enable_if<IS_TRIVIALLY_COPYABLE(T)>::type>
|
||||
template <typename T, typename = typename std::enable_if<
|
||||
base::is_trivially_copyable<T>::value>::type>
|
||||
T* NewArray(size_t size, T default_val) {
|
||||
T* result = reinterpret_cast<T*>(NewArray<uint8_t>(sizeof(T) * size));
|
||||
for (size_t i = 0; i < size; ++i) result[i] = default_val;
|
||||
|
180
deps/v8/src/api-arguments-inl.h
vendored
180
deps/v8/src/api-arguments-inl.h
vendored
@ -13,56 +13,63 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
#define FOR_EACH_CALLBACK(F) \
|
||||
F(Query, query, Object, v8::Integer) \
|
||||
F(Deleter, deleter, Object, v8::Boolean)
|
||||
#define FOR_EACH_CALLBACK(F) \
|
||||
F(Query, query, Object, v8::Integer, interceptor) \
|
||||
F(Deleter, deleter, Object, v8::Boolean, Handle<Object>())
|
||||
|
||||
#define PREPARE_CALLBACK_INFO(ISOLATE, F, RETURN_VALUE, API_RETURN_TYPE) \
|
||||
if (ISOLATE->needs_side_effect_check() && \
|
||||
!PerformSideEffectCheck(ISOLATE, FUNCTION_ADDR(F))) { \
|
||||
return RETURN_VALUE(); \
|
||||
} \
|
||||
VMState<EXTERNAL> state(ISOLATE); \
|
||||
ExternalCallbackScope call_scope(ISOLATE, FUNCTION_ADDR(F)); \
|
||||
#define DCHECK_NAME_COMPATIBLE(interceptor, name) \
|
||||
DCHECK(interceptor->is_named()); \
|
||||
DCHECK(!name->IsPrivate()); \
|
||||
DCHECK_IMPLIES(name->IsSymbol(), interceptor->can_intercept_symbols());
|
||||
|
||||
#define PREPARE_CALLBACK_INFO(ISOLATE, F, RETURN_VALUE, API_RETURN_TYPE, \
|
||||
CALLBACK_INFO) \
|
||||
if (ISOLATE->debug_execution_mode() == DebugInfo::kSideEffects && \
|
||||
!ISOLATE->debug()->PerformSideEffectCheckForCallback(CALLBACK_INFO)) { \
|
||||
return RETURN_VALUE(); \
|
||||
} \
|
||||
VMState<EXTERNAL> state(ISOLATE); \
|
||||
ExternalCallbackScope call_scope(ISOLATE, FUNCTION_ADDR(F)); \
|
||||
PropertyCallbackInfo<API_RETURN_TYPE> callback_info(begin());
|
||||
|
||||
#define CREATE_NAMED_CALLBACK(Function, type, ReturnType, ApiReturnType) \
|
||||
Handle<ReturnType> PropertyCallbackArguments::CallNamed##Function( \
|
||||
#define CREATE_NAMED_CALLBACK(FUNCTION, TYPE, RETURN_TYPE, API_RETURN_TYPE, \
|
||||
INFO_FOR_SIDE_EFFECT) \
|
||||
Handle<RETURN_TYPE> PropertyCallbackArguments::CallNamed##FUNCTION( \
|
||||
Handle<InterceptorInfo> interceptor, Handle<Name> name) { \
|
||||
DCHECK(interceptor->is_named()); \
|
||||
DCHECK(!name->IsPrivate()); \
|
||||
DCHECK_IMPLIES(name->IsSymbol(), interceptor->can_intercept_symbols()); \
|
||||
DCHECK_NAME_COMPATIBLE(interceptor, name); \
|
||||
Isolate* isolate = this->isolate(); \
|
||||
RuntimeCallTimerScope timer( \
|
||||
isolate, RuntimeCallCounterId::kNamed##Function##Callback); \
|
||||
DCHECK(!name->IsPrivate()); \
|
||||
GenericNamedProperty##Function##Callback f = \
|
||||
ToCData<GenericNamedProperty##Function##Callback>( \
|
||||
interceptor->type()); \
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<ReturnType>, ApiReturnType); \
|
||||
isolate, RuntimeCallCounterId::kNamed##FUNCTION##Callback); \
|
||||
GenericNamedProperty##FUNCTION##Callback f = \
|
||||
ToCData<GenericNamedProperty##FUNCTION##Callback>( \
|
||||
interceptor->TYPE()); \
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<RETURN_TYPE>, API_RETURN_TYPE, \
|
||||
INFO_FOR_SIDE_EFFECT); \
|
||||
LOG(isolate, \
|
||||
ApiNamedPropertyAccess("interceptor-named-" #type, holder(), *name)); \
|
||||
ApiNamedPropertyAccess("interceptor-named-" #TYPE, holder(), *name)); \
|
||||
f(v8::Utils::ToLocal(name), callback_info); \
|
||||
return GetReturnValue<ReturnType>(isolate); \
|
||||
return GetReturnValue<RETURN_TYPE>(isolate); \
|
||||
}
|
||||
|
||||
FOR_EACH_CALLBACK(CREATE_NAMED_CALLBACK)
|
||||
#undef CREATE_NAMED_CALLBACK
|
||||
|
||||
#define CREATE_INDEXED_CALLBACK(Function, type, ReturnType, ApiReturnType) \
|
||||
Handle<ReturnType> PropertyCallbackArguments::CallIndexed##Function( \
|
||||
Handle<InterceptorInfo> interceptor, uint32_t index) { \
|
||||
DCHECK(!interceptor->is_named()); \
|
||||
Isolate* isolate = this->isolate(); \
|
||||
RuntimeCallTimerScope timer( \
|
||||
isolate, RuntimeCallCounterId::kIndexed##Function##Callback); \
|
||||
IndexedProperty##Function##Callback f = \
|
||||
ToCData<IndexedProperty##Function##Callback>(interceptor->type()); \
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<ReturnType>, ApiReturnType); \
|
||||
LOG(isolate, ApiIndexedPropertyAccess("interceptor-indexed-" #type, \
|
||||
holder(), index)); \
|
||||
f(index, callback_info); \
|
||||
return GetReturnValue<ReturnType>(isolate); \
|
||||
#define CREATE_INDEXED_CALLBACK(FUNCTION, TYPE, RETURN_TYPE, API_RETURN_TYPE, \
|
||||
INFO_FOR_SIDE_EFFECT) \
|
||||
Handle<RETURN_TYPE> PropertyCallbackArguments::CallIndexed##FUNCTION( \
|
||||
Handle<InterceptorInfo> interceptor, uint32_t index) { \
|
||||
DCHECK(!interceptor->is_named()); \
|
||||
Isolate* isolate = this->isolate(); \
|
||||
RuntimeCallTimerScope timer( \
|
||||
isolate, RuntimeCallCounterId::kIndexed##FUNCTION##Callback); \
|
||||
IndexedProperty##FUNCTION##Callback f = \
|
||||
ToCData<IndexedProperty##FUNCTION##Callback>(interceptor->TYPE()); \
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<RETURN_TYPE>, API_RETURN_TYPE, \
|
||||
INFO_FOR_SIDE_EFFECT); \
|
||||
LOG(isolate, ApiIndexedPropertyAccess("interceptor-indexed-" #TYPE, \
|
||||
holder(), index)); \
|
||||
f(index, callback_info); \
|
||||
return GetReturnValue<RETURN_TYPE>(isolate); \
|
||||
}
|
||||
|
||||
FOR_EACH_CALLBACK(CREATE_INDEXED_CALLBACK)
|
||||
@ -70,11 +77,44 @@ FOR_EACH_CALLBACK(CREATE_INDEXED_CALLBACK)
|
||||
#undef FOR_EACH_CALLBACK
|
||||
#undef CREATE_INDEXED_CALLBACK
|
||||
|
||||
Handle<Object> FunctionCallbackArguments::Call(CallHandlerInfo* handler) {
|
||||
Isolate* isolate = this->isolate();
|
||||
LOG(isolate, ApiObjectAccess("call", holder()));
|
||||
RuntimeCallTimerScope timer(isolate, RuntimeCallCounterId::kFunctionCallback);
|
||||
v8::FunctionCallback f =
|
||||
v8::ToCData<v8::FunctionCallback>(handler->callback());
|
||||
if (isolate->debug_execution_mode() == DebugInfo::kSideEffects &&
|
||||
!isolate->debug()->PerformSideEffectCheckForCallback(handle(handler))) {
|
||||
return Handle<Object>();
|
||||
}
|
||||
VMState<EXTERNAL> state(isolate);
|
||||
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
|
||||
FunctionCallbackInfo<v8::Value> info(begin(), argv_, argc_);
|
||||
f(info);
|
||||
return GetReturnValue<Object>(isolate);
|
||||
}
|
||||
|
||||
Handle<JSObject> PropertyCallbackArguments::CallNamedEnumerator(
|
||||
Handle<InterceptorInfo> interceptor) {
|
||||
DCHECK(interceptor->is_named());
|
||||
LOG(isolate(), ApiObjectAccess("interceptor-named-enumerator", holder()));
|
||||
RuntimeCallTimerScope timer(isolate(),
|
||||
RuntimeCallCounterId::kNamedEnumeratorCallback);
|
||||
return CallPropertyEnumerator(interceptor);
|
||||
}
|
||||
|
||||
Handle<JSObject> PropertyCallbackArguments::CallIndexedEnumerator(
|
||||
Handle<InterceptorInfo> interceptor) {
|
||||
DCHECK(!interceptor->is_named());
|
||||
LOG(isolate(), ApiObjectAccess("interceptor-indexed-enumerator", holder()));
|
||||
RuntimeCallTimerScope timer(isolate(),
|
||||
RuntimeCallCounterId::kIndexedEnumeratorCallback);
|
||||
return CallPropertyEnumerator(interceptor);
|
||||
}
|
||||
|
||||
Handle<Object> PropertyCallbackArguments::CallNamedGetter(
|
||||
Handle<InterceptorInfo> interceptor, Handle<Name> name) {
|
||||
DCHECK(interceptor->is_named());
|
||||
DCHECK_IMPLIES(name->IsSymbol(), interceptor->can_intercept_symbols());
|
||||
DCHECK(!name->IsPrivate());
|
||||
DCHECK_NAME_COMPATIBLE(interceptor, name);
|
||||
Isolate* isolate = this->isolate();
|
||||
RuntimeCallTimerScope timer(isolate,
|
||||
RuntimeCallCounterId::kNamedGetterCallback);
|
||||
@ -82,13 +122,12 @@ Handle<Object> PropertyCallbackArguments::CallNamedGetter(
|
||||
ApiNamedPropertyAccess("interceptor-named-getter", holder(), *name));
|
||||
GenericNamedPropertyGetterCallback f =
|
||||
ToCData<GenericNamedPropertyGetterCallback>(interceptor->getter());
|
||||
return BasicCallNamedGetterCallback(f, name);
|
||||
return BasicCallNamedGetterCallback(f, name, interceptor);
|
||||
}
|
||||
|
||||
Handle<Object> PropertyCallbackArguments::CallNamedDescriptor(
|
||||
Handle<InterceptorInfo> interceptor, Handle<Name> name) {
|
||||
DCHECK(interceptor->is_named());
|
||||
DCHECK_IMPLIES(name->IsSymbol(), interceptor->can_intercept_symbols());
|
||||
DCHECK_NAME_COMPATIBLE(interceptor, name);
|
||||
Isolate* isolate = this->isolate();
|
||||
RuntimeCallTimerScope timer(isolate,
|
||||
RuntimeCallCounterId::kNamedDescriptorCallback);
|
||||
@ -97,14 +136,15 @@ Handle<Object> PropertyCallbackArguments::CallNamedDescriptor(
|
||||
GenericNamedPropertyDescriptorCallback f =
|
||||
ToCData<GenericNamedPropertyDescriptorCallback>(
|
||||
interceptor->descriptor());
|
||||
return BasicCallNamedGetterCallback(f, name);
|
||||
return BasicCallNamedGetterCallback(f, name, interceptor);
|
||||
}
|
||||
|
||||
Handle<Object> PropertyCallbackArguments::BasicCallNamedGetterCallback(
|
||||
GenericNamedPropertyGetterCallback f, Handle<Name> name) {
|
||||
GenericNamedPropertyGetterCallback f, Handle<Name> name,
|
||||
Handle<Object> info) {
|
||||
DCHECK(!name->IsPrivate());
|
||||
Isolate* isolate = this->isolate();
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, v8::Value);
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, v8::Value, info);
|
||||
f(v8::Utils::ToLocal(name), callback_info);
|
||||
return GetReturnValue<Object>(isolate);
|
||||
}
|
||||
@ -112,20 +152,15 @@ Handle<Object> PropertyCallbackArguments::BasicCallNamedGetterCallback(
|
||||
Handle<Object> PropertyCallbackArguments::CallNamedSetter(
|
||||
Handle<InterceptorInfo> interceptor, Handle<Name> name,
|
||||
Handle<Object> value) {
|
||||
DCHECK_IMPLIES(name->IsSymbol(), interceptor->can_intercept_symbols());
|
||||
DCHECK_NAME_COMPATIBLE(interceptor, name);
|
||||
GenericNamedPropertySetterCallback f =
|
||||
ToCData<GenericNamedPropertySetterCallback>(interceptor->setter());
|
||||
return CallNamedSetterCallback(f, name, value);
|
||||
}
|
||||
|
||||
Handle<Object> PropertyCallbackArguments::CallNamedSetterCallback(
|
||||
GenericNamedPropertySetterCallback f, Handle<Name> name,
|
||||
Handle<Object> value) {
|
||||
DCHECK(!name->IsPrivate());
|
||||
Isolate* isolate = this->isolate();
|
||||
RuntimeCallTimerScope timer(isolate,
|
||||
RuntimeCallCounterId::kNamedSetterCallback);
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, v8::Value);
|
||||
Handle<Object> side_effect_check_not_supported;
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, v8::Value,
|
||||
side_effect_check_not_supported);
|
||||
LOG(isolate,
|
||||
ApiNamedPropertyAccess("interceptor-named-set", holder(), *name));
|
||||
f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), callback_info);
|
||||
@ -135,15 +170,15 @@ Handle<Object> PropertyCallbackArguments::CallNamedSetterCallback(
|
||||
Handle<Object> PropertyCallbackArguments::CallNamedDefiner(
|
||||
Handle<InterceptorInfo> interceptor, Handle<Name> name,
|
||||
const v8::PropertyDescriptor& desc) {
|
||||
DCHECK(interceptor->is_named());
|
||||
DCHECK(!name->IsPrivate());
|
||||
DCHECK_IMPLIES(name->IsSymbol(), interceptor->can_intercept_symbols());
|
||||
DCHECK_NAME_COMPATIBLE(interceptor, name);
|
||||
Isolate* isolate = this->isolate();
|
||||
RuntimeCallTimerScope timer(isolate,
|
||||
RuntimeCallCounterId::kNamedDefinerCallback);
|
||||
GenericNamedPropertyDefinerCallback f =
|
||||
ToCData<GenericNamedPropertyDefinerCallback>(interceptor->definer());
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, v8::Value);
|
||||
Handle<Object> side_effect_check_not_supported;
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, v8::Value,
|
||||
side_effect_check_not_supported);
|
||||
LOG(isolate,
|
||||
ApiNamedPropertyAccess("interceptor-named-define", holder(), *name));
|
||||
f(v8::Utils::ToLocal(name), desc, callback_info);
|
||||
@ -158,7 +193,9 @@ Handle<Object> PropertyCallbackArguments::CallIndexedSetter(
|
||||
RuntimeCallCounterId::kIndexedSetterCallback);
|
||||
IndexedPropertySetterCallback f =
|
||||
ToCData<IndexedPropertySetterCallback>(interceptor->setter());
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, v8::Value);
|
||||
Handle<Object> side_effect_check_not_supported;
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, v8::Value,
|
||||
side_effect_check_not_supported);
|
||||
LOG(isolate,
|
||||
ApiIndexedPropertyAccess("interceptor-indexed-set", holder(), index));
|
||||
f(index, v8::Utils::ToLocal(value), callback_info);
|
||||
@ -174,7 +211,9 @@ Handle<Object> PropertyCallbackArguments::CallIndexedDefiner(
|
||||
RuntimeCallCounterId::kIndexedDefinerCallback);
|
||||
IndexedPropertyDefinerCallback f =
|
||||
ToCData<IndexedPropertyDefinerCallback>(interceptor->definer());
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, v8::Value);
|
||||
Handle<Object> side_effect_check_not_supported;
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, v8::Value,
|
||||
side_effect_check_not_supported);
|
||||
LOG(isolate,
|
||||
ApiIndexedPropertyAccess("interceptor-indexed-define", holder(), index));
|
||||
f(index, desc, callback_info);
|
||||
@ -191,7 +230,7 @@ Handle<Object> PropertyCallbackArguments::CallIndexedGetter(
|
||||
ApiIndexedPropertyAccess("interceptor-indexed-getter", holder(), index));
|
||||
IndexedPropertyGetterCallback f =
|
||||
ToCData<IndexedPropertyGetterCallback>(interceptor->getter());
|
||||
return BasicCallIndexedGetterCallback(f, index);
|
||||
return BasicCallIndexedGetterCallback(f, index, interceptor);
|
||||
}
|
||||
|
||||
Handle<Object> PropertyCallbackArguments::CallIndexedDescriptor(
|
||||
@ -204,13 +243,13 @@ Handle<Object> PropertyCallbackArguments::CallIndexedDescriptor(
|
||||
holder(), index));
|
||||
IndexedPropertyDescriptorCallback f =
|
||||
ToCData<IndexedPropertyDescriptorCallback>(interceptor->descriptor());
|
||||
return BasicCallIndexedGetterCallback(f, index);
|
||||
return BasicCallIndexedGetterCallback(f, index, interceptor);
|
||||
}
|
||||
|
||||
Handle<Object> PropertyCallbackArguments::BasicCallIndexedGetterCallback(
|
||||
IndexedPropertyGetterCallback f, uint32_t index) {
|
||||
IndexedPropertyGetterCallback f, uint32_t index, Handle<Object> info) {
|
||||
Isolate* isolate = this->isolate();
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, v8::Value);
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, v8::Value, info);
|
||||
f(index, callback_info);
|
||||
return GetReturnValue<Object>(isolate);
|
||||
}
|
||||
@ -222,7 +261,7 @@ Handle<JSObject> PropertyCallbackArguments::CallPropertyEnumerator(
|
||||
v8::ToCData<IndexedPropertyEnumeratorCallback>(interceptor->enumerator());
|
||||
// TODO(cbruni): assert same type for indexed and named callback.
|
||||
Isolate* isolate = this->isolate();
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<JSObject>, v8::Array);
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<JSObject>, v8::Array, interceptor);
|
||||
f(callback_info);
|
||||
return GetReturnValue<JSObject>(isolate);
|
||||
}
|
||||
@ -238,10 +277,10 @@ Handle<Object> PropertyCallbackArguments::CallAccessorGetter(
|
||||
LOG(isolate, ApiNamedPropertyAccess("accessor-getter", holder(), *name));
|
||||
AccessorNameGetterCallback f =
|
||||
ToCData<AccessorNameGetterCallback>(info->getter());
|
||||
return BasicCallNamedGetterCallback(f, name);
|
||||
return BasicCallNamedGetterCallback(f, name, info);
|
||||
}
|
||||
|
||||
void PropertyCallbackArguments::CallAccessorSetter(
|
||||
Handle<Object> PropertyCallbackArguments::CallAccessorSetter(
|
||||
Handle<AccessorInfo> accessor_info, Handle<Name> name,
|
||||
Handle<Object> value) {
|
||||
Isolate* isolate = this->isolate();
|
||||
@ -249,9 +288,12 @@ void PropertyCallbackArguments::CallAccessorSetter(
|
||||
RuntimeCallCounterId::kAccessorSetterCallback);
|
||||
AccessorNameSetterCallback f =
|
||||
ToCData<AccessorNameSetterCallback>(accessor_info->setter());
|
||||
PREPARE_CALLBACK_INFO(isolate, f, void, void);
|
||||
Handle<Object> side_effect_check_not_supported;
|
||||
PREPARE_CALLBACK_INFO(isolate, f, Handle<Object>, void,
|
||||
side_effect_check_not_supported);
|
||||
LOG(isolate, ApiNamedPropertyAccess("accessor-setter", holder(), *name));
|
||||
f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), callback_info);
|
||||
return GetReturnValue<Object>(isolate);
|
||||
}
|
||||
|
||||
#undef PREPARE_CALLBACK_INFO
|
||||
|
57
deps/v8/src/api-arguments.cc
vendored
57
deps/v8/src/api-arguments.cc
vendored
@ -1,57 +0,0 @@
|
||||
// Copyright 2016 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/api-arguments.h"
|
||||
#include "src/api-arguments-inl.h"
|
||||
|
||||
#include "src/debug/debug.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/tracing/trace-event.h"
|
||||
#include "src/vm-state-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
Handle<Object> FunctionCallbackArguments::Call(CallHandlerInfo* handler) {
|
||||
Isolate* isolate = this->isolate();
|
||||
LOG(isolate, ApiObjectAccess("call", holder()));
|
||||
RuntimeCallTimerScope timer(isolate, RuntimeCallCounterId::kFunctionCallback);
|
||||
v8::FunctionCallback f =
|
||||
v8::ToCData<v8::FunctionCallback>(handler->callback());
|
||||
if (isolate->needs_side_effect_check() &&
|
||||
!isolate->debug()->PerformSideEffectCheckForCallback(FUNCTION_ADDR(f))) {
|
||||
return Handle<Object>();
|
||||
}
|
||||
VMState<EXTERNAL> state(isolate);
|
||||
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
|
||||
FunctionCallbackInfo<v8::Value> info(begin(), argv_, argc_);
|
||||
f(info);
|
||||
return GetReturnValue<Object>(isolate);
|
||||
}
|
||||
|
||||
Handle<JSObject> PropertyCallbackArguments::CallNamedEnumerator(
|
||||
Handle<InterceptorInfo> interceptor) {
|
||||
DCHECK(interceptor->is_named());
|
||||
LOG(isolate(), ApiObjectAccess("interceptor-named-enumerator", holder()));
|
||||
RuntimeCallTimerScope timer(isolate(),
|
||||
RuntimeCallCounterId::kNamedEnumeratorCallback);
|
||||
return CallPropertyEnumerator(interceptor);
|
||||
}
|
||||
|
||||
Handle<JSObject> PropertyCallbackArguments::CallIndexedEnumerator(
|
||||
Handle<InterceptorInfo> interceptor) {
|
||||
DCHECK(!interceptor->is_named());
|
||||
LOG(isolate(), ApiObjectAccess("interceptor-indexed-enumerator", holder()));
|
||||
RuntimeCallTimerScope timer(isolate(),
|
||||
RuntimeCallCounterId::kIndexedEnumeratorCallback);
|
||||
return CallPropertyEnumerator(interceptor);
|
||||
}
|
||||
|
||||
bool PropertyCallbackArguments::PerformSideEffectCheck(Isolate* isolate,
|
||||
Address function) {
|
||||
return isolate->debug()->PerformSideEffectCheckForCallback(function);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
47
deps/v8/src/api-arguments.h
vendored
47
deps/v8/src/api-arguments.h
vendored
@ -6,6 +6,7 @@
|
||||
#define V8_API_ARGUMENTS_H_
|
||||
|
||||
#include "src/api.h"
|
||||
#include "src/debug/debug.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/visitors.h"
|
||||
|
||||
@ -15,34 +16,30 @@ namespace internal {
|
||||
// Custom arguments replicate a small segment of stack that can be
|
||||
// accessed through an Arguments object the same way the actual stack
|
||||
// can.
|
||||
template <int kArrayLength>
|
||||
class CustomArgumentsBase : public Relocatable {
|
||||
public:
|
||||
virtual inline void IterateInstance(RootVisitor* v) {
|
||||
v->VisitRootPointers(Root::kRelocatable, nullptr, values_,
|
||||
values_ + kArrayLength);
|
||||
}
|
||||
|
||||
protected:
|
||||
inline Object** begin() { return values_; }
|
||||
explicit inline CustomArgumentsBase(Isolate* isolate)
|
||||
: Relocatable(isolate) {}
|
||||
Object* values_[kArrayLength];
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class CustomArguments : public CustomArgumentsBase<T::kArgsLength> {
|
||||
class CustomArguments : public CustomArgumentsBase {
|
||||
public:
|
||||
static const int kReturnValueOffset = T::kReturnValueIndex;
|
||||
|
||||
typedef CustomArgumentsBase<T::kArgsLength> Super;
|
||||
~CustomArguments() {
|
||||
this->begin()[kReturnValueOffset] =
|
||||
reinterpret_cast<Object*>(kHandleZapValue);
|
||||
}
|
||||
|
||||
virtual inline void IterateInstance(RootVisitor* v) {
|
||||
v->VisitRootPointers(Root::kRelocatable, nullptr, values_,
|
||||
values_ + T::kArgsLength);
|
||||
}
|
||||
|
||||
protected:
|
||||
explicit inline CustomArguments(Isolate* isolate) : Super(isolate) {}
|
||||
explicit inline CustomArguments(Isolate* isolate)
|
||||
: CustomArgumentsBase(isolate) {}
|
||||
|
||||
template <typename V>
|
||||
Handle<V> GetReturnValue(Isolate* isolate);
|
||||
@ -50,6 +47,9 @@ class CustomArguments : public CustomArgumentsBase<T::kArgsLength> {
|
||||
inline Isolate* isolate() {
|
||||
return reinterpret_cast<Isolate*>(this->begin()[T::kIsolateIndex]);
|
||||
}
|
||||
|
||||
inline Object** begin() { return values_; }
|
||||
Object* values_[T::kArgsLength];
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@ -103,8 +103,9 @@ class PropertyCallbackArguments
|
||||
// -------------------------------------------------------------------------
|
||||
// Accessor Callbacks
|
||||
// Also used for AccessorSetterCallback.
|
||||
inline void CallAccessorSetter(Handle<AccessorInfo> info, Handle<Name> name,
|
||||
Handle<Object> value);
|
||||
inline Handle<Object> CallAccessorSetter(Handle<AccessorInfo> info,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value);
|
||||
// Also used for AccessorGetterCallback, AccessorNameGetterCallback.
|
||||
inline Handle<Object> CallAccessorGetter(Handle<AccessorInfo> info,
|
||||
Handle<Name> name);
|
||||
@ -118,9 +119,6 @@ class PropertyCallbackArguments
|
||||
inline Handle<Object> CallNamedSetter(Handle<InterceptorInfo> interceptor,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value);
|
||||
inline Handle<Object> CallNamedSetterCallback(
|
||||
GenericNamedPropertySetterCallback callback, Handle<Name> name,
|
||||
Handle<Object> value);
|
||||
inline Handle<Object> CallNamedDefiner(Handle<InterceptorInfo> interceptor,
|
||||
Handle<Name> name,
|
||||
const v8::PropertyDescriptor& desc);
|
||||
@ -128,7 +126,8 @@ class PropertyCallbackArguments
|
||||
Handle<Name> name);
|
||||
inline Handle<Object> CallNamedDescriptor(Handle<InterceptorInfo> interceptor,
|
||||
Handle<Name> name);
|
||||
Handle<JSObject> CallNamedEnumerator(Handle<InterceptorInfo> interceptor);
|
||||
inline Handle<JSObject> CallNamedEnumerator(
|
||||
Handle<InterceptorInfo> interceptor);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Indexed Interceptor Callbacks
|
||||
@ -145,7 +144,8 @@ class PropertyCallbackArguments
|
||||
uint32_t index);
|
||||
inline Handle<Object> CallIndexedDescriptor(
|
||||
Handle<InterceptorInfo> interceptor, uint32_t index);
|
||||
Handle<JSObject> CallIndexedEnumerator(Handle<InterceptorInfo> interceptor);
|
||||
inline Handle<JSObject> CallIndexedEnumerator(
|
||||
Handle<InterceptorInfo> interceptor);
|
||||
|
||||
private:
|
||||
/*
|
||||
@ -160,16 +160,15 @@ class PropertyCallbackArguments
|
||||
Handle<InterceptorInfo> interceptor);
|
||||
|
||||
inline Handle<Object> BasicCallIndexedGetterCallback(
|
||||
IndexedPropertyGetterCallback f, uint32_t index);
|
||||
IndexedPropertyGetterCallback f, uint32_t index, Handle<Object> info);
|
||||
inline Handle<Object> BasicCallNamedGetterCallback(
|
||||
GenericNamedPropertyGetterCallback f, Handle<Name> name);
|
||||
GenericNamedPropertyGetterCallback f, Handle<Name> name,
|
||||
Handle<Object> info);
|
||||
|
||||
inline JSObject* holder() {
|
||||
return JSObject::cast(this->begin()[T::kHolderIndex]);
|
||||
}
|
||||
|
||||
bool PerformSideEffectCheck(Isolate* isolate, Address function);
|
||||
|
||||
// Don't copy PropertyCallbackArguments, because they would both have the
|
||||
// same prev_ pointer.
|
||||
DISALLOW_COPY_AND_ASSIGN(PropertyCallbackArguments);
|
||||
@ -216,7 +215,7 @@ class FunctionCallbackArguments
|
||||
* and used if it's been set to anything inside the callback.
|
||||
* New style callbacks always use the return value.
|
||||
*/
|
||||
Handle<Object> Call(CallHandlerInfo* handler);
|
||||
inline Handle<Object> Call(CallHandlerInfo* handler);
|
||||
|
||||
private:
|
||||
inline JSObject* holder() {
|
||||
|
2
deps/v8/src/api-natives.cc
vendored
2
deps/v8/src/api-natives.cc
vendored
@ -626,7 +626,7 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
|
||||
FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, obj,
|
||||
maybe_name);
|
||||
// To simplify things, API functions always have shared name.
|
||||
DCHECK(shared->has_shared_name());
|
||||
DCHECK(shared->HasSharedName());
|
||||
|
||||
Handle<JSFunction> result =
|
||||
isolate->factory()->NewFunctionFromSharedFunctionInfo(
|
||||
|
8
deps/v8/src/api-natives.h
vendored
8
deps/v8/src/api-natives.h
vendored
@ -21,15 +21,15 @@ class ApiNatives {
|
||||
public:
|
||||
static const int kInitialFunctionCacheSize = 256;
|
||||
|
||||
MUST_USE_RESULT static MaybeHandle<JSFunction> InstantiateFunction(
|
||||
V8_WARN_UNUSED_RESULT static MaybeHandle<JSFunction> InstantiateFunction(
|
||||
Handle<FunctionTemplateInfo> data,
|
||||
MaybeHandle<Name> maybe_name = MaybeHandle<Name>());
|
||||
|
||||
MUST_USE_RESULT static MaybeHandle<JSObject> InstantiateObject(
|
||||
V8_WARN_UNUSED_RESULT static MaybeHandle<JSObject> InstantiateObject(
|
||||
Handle<ObjectTemplateInfo> data,
|
||||
Handle<JSReceiver> new_target = Handle<JSReceiver>());
|
||||
|
||||
MUST_USE_RESULT static MaybeHandle<JSObject> InstantiateRemoteObject(
|
||||
V8_WARN_UNUSED_RESULT static MaybeHandle<JSObject> InstantiateRemoteObject(
|
||||
Handle<ObjectTemplateInfo> data);
|
||||
|
||||
enum ApiInstanceType {
|
||||
@ -41,7 +41,7 @@ class ApiNatives {
|
||||
static Handle<JSFunction> CreateApiFunction(
|
||||
Isolate* isolate, Handle<FunctionTemplateInfo> obj,
|
||||
Handle<Object> prototype, ApiInstanceType instance_type,
|
||||
MaybeHandle<Name> maybe_name = MaybeHandle<Name>());
|
||||
MaybeHandle<Name> name = MaybeHandle<Name>());
|
||||
|
||||
static void AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info,
|
||||
Handle<Name> name, Handle<Object> value,
|
||||
|
480
deps/v8/src/api.cc
vendored
480
deps/v8/src/api.cc
vendored
@ -69,6 +69,7 @@
|
||||
#include "src/snapshot/natives.h"
|
||||
#include "src/snapshot/snapshot.h"
|
||||
#include "src/startup-data-util.h"
|
||||
#include "src/string-hasher.h"
|
||||
#include "src/tracing/trace-event.h"
|
||||
#include "src/trap-handler/trap-handler.h"
|
||||
#include "src/unicode-cache-inl.h"
|
||||
@ -307,19 +308,22 @@ static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate,
|
||||
|
||||
// --- E x c e p t i o n B e h a v i o r ---
|
||||
|
||||
|
||||
void i::FatalProcessOutOfMemory(const char* location) {
|
||||
i::V8::FatalProcessOutOfMemory(location, false);
|
||||
void i::FatalProcessOutOfMemory(i::Isolate* isolate, const char* location) {
|
||||
i::V8::FatalProcessOutOfMemory(isolate, location, false);
|
||||
}
|
||||
|
||||
// When V8 cannot allocate memory FatalProcessOutOfMemory is called. The default
|
||||
// OOM error handler is called and execution is stopped.
|
||||
void i::V8::FatalProcessOutOfMemory(const char* location, bool is_heap_oom) {
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
void i::V8::FatalProcessOutOfMemory(i::Isolate* isolate, const char* location,
|
||||
bool is_heap_oom) {
|
||||
char last_few_messages[Heap::kTraceRingBufferSize + 1];
|
||||
char js_stacktrace[Heap::kStacktraceBufferSize + 1];
|
||||
i::HeapStats heap_stats;
|
||||
|
||||
if (isolate == nullptr) {
|
||||
isolate = Isolate::Current();
|
||||
}
|
||||
|
||||
if (isolate == nullptr) {
|
||||
// On a background thread -> we cannot retrieve memory information from the
|
||||
// Isolate. Write easy-to-recognize values on the stack.
|
||||
@ -329,7 +333,7 @@ void i::V8::FatalProcessOutOfMemory(const char* location, bool is_heap_oom) {
|
||||
// Note that the embedder's oom handler won't be called in this case. We
|
||||
// just crash.
|
||||
FATAL("API fatal error handler returned after process out of memory");
|
||||
return;
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
memset(last_few_messages, 0, Heap::kTraceRingBufferSize + 1);
|
||||
@ -393,7 +397,7 @@ void i::V8::FatalProcessOutOfMemory(const char* location, bool is_heap_oom) {
|
||||
PrintF("\n<--- Last few GCs --->\n%s\n", first_newline);
|
||||
PrintF("\n<--- JS stacktrace --->\n%s\n", js_stacktrace);
|
||||
}
|
||||
Utils::ReportOOMFailure(location, is_heap_oom);
|
||||
Utils::ReportOOMFailure(isolate, location, is_heap_oom);
|
||||
// If the fatal error handler returns, we stop execution.
|
||||
FATAL("API fatal error handler returned after process out of memory");
|
||||
}
|
||||
@ -415,8 +419,8 @@ void Utils::ReportApiFailure(const char* location, const char* message) {
|
||||
isolate->SignalFatalError();
|
||||
}
|
||||
|
||||
void Utils::ReportOOMFailure(const char* location, bool is_heap_oom) {
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
void Utils::ReportOOMFailure(i::Isolate* isolate, const char* location,
|
||||
bool is_heap_oom) {
|
||||
OOMErrorCallback oom_callback = isolate->oom_behavior();
|
||||
if (oom_callback == nullptr) {
|
||||
// TODO(wfh): Remove this fallback once Blink is setting OOM handler. See
|
||||
@ -704,7 +708,7 @@ StartupData SnapshotCreator::CreateBlob(
|
||||
// context even after we have disposed of the context.
|
||||
isolate->heap()->CollectAllAvailableGarbage(
|
||||
i::GarbageCollectionReason::kSnapshotCreator);
|
||||
isolate->heap()->CompactWeakFixedArrays();
|
||||
isolate->heap()->CompactFixedArraysOfWeakCells();
|
||||
|
||||
i::DisallowHeapAllocation no_gc_from_here_on;
|
||||
|
||||
@ -728,15 +732,33 @@ StartupData SnapshotCreator::CreateBlob(
|
||||
i::SerializedHandleChecker handle_checker(isolate, &contexts);
|
||||
CHECK(handle_checker.CheckGlobalAndEternalHandles());
|
||||
|
||||
// Complete in-object slack tracking for all functions.
|
||||
i::HeapIterator heap_iterator(isolate->heap());
|
||||
while (i::HeapObject* current_obj = heap_iterator.next()) {
|
||||
if (!current_obj->IsJSFunction()) continue;
|
||||
i::JSFunction* fun = i::JSFunction::cast(current_obj);
|
||||
fun->CompleteInobjectSlackTrackingIfActive();
|
||||
if (current_obj->IsJSFunction()) {
|
||||
i::JSFunction* fun = i::JSFunction::cast(current_obj);
|
||||
|
||||
// Complete in-object slack tracking for all functions.
|
||||
fun->CompleteInobjectSlackTrackingIfActive();
|
||||
|
||||
// Also, clear out feedback vectors.
|
||||
fun->feedback_cell()->set_value(isolate->heap()->undefined_value());
|
||||
}
|
||||
|
||||
// Clear out re-compilable data from all shared function infos. Any
|
||||
// JSFunctions using these SFIs will have their code pointers reset by the
|
||||
// partial serializer.
|
||||
if (current_obj->IsSharedFunctionInfo() &&
|
||||
function_code_handling == FunctionCodeHandling::kClear) {
|
||||
i::SharedFunctionInfo* shared = i::SharedFunctionInfo::cast(current_obj);
|
||||
if (shared->CanFlushCompiled()) {
|
||||
shared->FlushCompiled();
|
||||
}
|
||||
DCHECK(shared->HasCodeObject() || shared->HasBuiltinId() ||
|
||||
shared->IsApiFunction());
|
||||
}
|
||||
}
|
||||
|
||||
i::StartupSerializer startup_serializer(isolate, function_code_handling);
|
||||
i::StartupSerializer startup_serializer(isolate);
|
||||
startup_serializer.SerializeStrongReferences();
|
||||
|
||||
// Serialize each context with a new partial serializer.
|
||||
@ -1221,13 +1243,18 @@ static i::Handle<i::FixedArray> EmbedderDataFor(Context* context,
|
||||
if (!Utils::ApiCheck(can_grow, location, "Index too large")) {
|
||||
return i::Handle<i::FixedArray>();
|
||||
}
|
||||
int new_size = i::Max(index, data->length() << 1) + 1;
|
||||
int new_size = index + 1;
|
||||
int grow_by = new_size - data->length();
|
||||
data = isolate->factory()->CopyFixedArrayAndGrow(data, grow_by);
|
||||
env->set_embedder_data(*data);
|
||||
return data;
|
||||
}
|
||||
|
||||
uint32_t Context::GetNumberOfEmbedderDataFields() {
|
||||
i::Handle<i::Context> context = Utils::OpenHandle(this);
|
||||
CHECK(context->IsNativeContext());
|
||||
return static_cast<uint32_t>(context->embedder_data()->length());
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> Context::SlowGetEmbedderData(int index) {
|
||||
const char* location = "v8::Context::GetEmbedderData()";
|
||||
@ -1375,7 +1402,8 @@ void FunctionTemplate::Inherit(v8::Local<FunctionTemplate> value) {
|
||||
static Local<FunctionTemplate> FunctionTemplateNew(
|
||||
i::Isolate* isolate, FunctionCallback callback, v8::Local<Value> data,
|
||||
v8::Local<Signature> signature, int length, bool do_not_cache,
|
||||
v8::Local<Private> cached_property_name = v8::Local<Private>()) {
|
||||
v8::Local<Private> cached_property_name = v8::Local<Private>(),
|
||||
SideEffectType side_effect_type = SideEffectType::kHasSideEffect) {
|
||||
i::Handle<i::Struct> struct_obj =
|
||||
isolate->factory()->NewStruct(i::FUNCTION_TEMPLATE_INFO_TYPE, i::TENURED);
|
||||
i::Handle<i::FunctionTemplateInfo> obj =
|
||||
@ -1388,7 +1416,7 @@ static Local<FunctionTemplate> FunctionTemplateNew(
|
||||
}
|
||||
obj->set_serial_number(i::Smi::FromInt(next_serial_number));
|
||||
if (callback != 0) {
|
||||
Utils::ToLocal(obj)->SetCallHandler(callback, data);
|
||||
Utils::ToLocal(obj)->SetCallHandler(callback, data, side_effect_type);
|
||||
}
|
||||
obj->set_length(length);
|
||||
obj->set_undetectable(false);
|
||||
@ -1413,8 +1441,8 @@ Local<FunctionTemplate> FunctionTemplate::New(
|
||||
// function templates when the isolate is created for serialization.
|
||||
LOG_API(i_isolate, FunctionTemplate, New);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
|
||||
auto templ =
|
||||
FunctionTemplateNew(i_isolate, callback, data, signature, length, false);
|
||||
auto templ = FunctionTemplateNew(i_isolate, callback, data, signature, length,
|
||||
false, Local<Private>(), side_effect_type);
|
||||
if (behavior == ConstructorBehavior::kThrow) templ->RemovePrototype();
|
||||
return templ;
|
||||
}
|
||||
@ -1442,7 +1470,7 @@ Local<FunctionTemplate> FunctionTemplate::NewWithCache(
|
||||
LOG_API(i_isolate, FunctionTemplate, NewWithCache);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
|
||||
return FunctionTemplateNew(i_isolate, callback, data, signature, length,
|
||||
false, cache_property);
|
||||
false, cache_property, side_effect_type);
|
||||
}
|
||||
|
||||
Local<Signature> Signature::New(Isolate* isolate,
|
||||
@ -1470,10 +1498,8 @@ void FunctionTemplate::SetCallHandler(FunctionCallback callback,
|
||||
i::Isolate* isolate = info->GetIsolate();
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
|
||||
i::HandleScope scope(isolate);
|
||||
i::Handle<i::Struct> struct_obj =
|
||||
isolate->factory()->NewStruct(i::TUPLE3_TYPE, i::TENURED);
|
||||
i::Handle<i::CallHandlerInfo> obj =
|
||||
i::Handle<i::CallHandlerInfo>::cast(struct_obj);
|
||||
i::Handle<i::CallHandlerInfo> obj = isolate->factory()->NewCallHandlerInfo(
|
||||
side_effect_type == SideEffectType::kHasNoSideEffect);
|
||||
SET_FIELD_WRAPPED(obj, set_callback, callback);
|
||||
SET_FIELD_WRAPPED(obj, set_js_callback, obj->redirected_callback());
|
||||
if (data.IsEmpty()) {
|
||||
@ -1781,6 +1807,9 @@ static i::Handle<i::InterceptorInfo> CreateInterceptorInfo(
|
||||
static_cast<int>(PropertyHandlerFlags::kAllCanRead));
|
||||
obj->set_non_masking(static_cast<int>(flags) &
|
||||
static_cast<int>(PropertyHandlerFlags::kNonMasking));
|
||||
obj->set_has_no_side_effect(
|
||||
static_cast<int>(flags) &
|
||||
static_cast<int>(PropertyHandlerFlags::kHasNoSideEffect));
|
||||
|
||||
if (data.IsEmpty()) {
|
||||
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
|
||||
@ -1940,7 +1969,6 @@ void ObjectTemplate::SetHandler(
|
||||
cons->set_indexed_property_handler(*obj);
|
||||
}
|
||||
|
||||
|
||||
void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback,
|
||||
Local<Value> data) {
|
||||
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
||||
@ -1948,10 +1976,7 @@ void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback,
|
||||
i::HandleScope scope(isolate);
|
||||
auto cons = EnsureConstructor(isolate, this);
|
||||
EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetCallAsFunctionHandler");
|
||||
i::Handle<i::Struct> struct_obj =
|
||||
isolate->factory()->NewStruct(i::TUPLE3_TYPE, i::TENURED);
|
||||
i::Handle<i::CallHandlerInfo> obj =
|
||||
i::Handle<i::CallHandlerInfo>::cast(struct_obj);
|
||||
i::Handle<i::CallHandlerInfo> obj = isolate->factory()->NewCallHandlerInfo();
|
||||
SET_FIELD_WRAPPED(obj, set_callback, callback);
|
||||
SET_FIELD_WRAPPED(obj, set_js_callback, obj->redirected_callback());
|
||||
if (data.IsEmpty()) {
|
||||
@ -2374,22 +2399,14 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
|
||||
source->host_defined_options);
|
||||
i::MaybeHandle<i::SharedFunctionInfo> maybe_function_info =
|
||||
i::Compiler::GetSharedFunctionInfoForScript(
|
||||
str, script_details, source->resource_options, nullptr, &script_data,
|
||||
str, script_details, source->resource_options, nullptr, script_data,
|
||||
options, no_cache_reason, i::NOT_NATIVES_CODE);
|
||||
has_pending_exception = !maybe_function_info.ToHandle(&result);
|
||||
if (has_pending_exception && script_data != nullptr) {
|
||||
// This case won't happen during normal operation; we have compiled
|
||||
// successfully and produced cached data, and but the second compilation
|
||||
// of the same source code fails.
|
||||
delete script_data;
|
||||
script_data = nullptr;
|
||||
}
|
||||
RETURN_ON_FAILED_EXECUTION(UnboundScript);
|
||||
|
||||
if (options == kConsumeCodeCache) {
|
||||
source->cached_data->rejected = script_data->rejected();
|
||||
}
|
||||
delete script_data;
|
||||
has_pending_exception = !maybe_function_info.ToHandle(&result);
|
||||
RETURN_ON_FAILED_EXECUTION(UnboundScript);
|
||||
RETURN_ESCAPED(ToApiHandle<UnboundScript>(result));
|
||||
}
|
||||
|
||||
@ -2483,6 +2500,10 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext(
|
||||
Function);
|
||||
TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.ScriptCompiler");
|
||||
|
||||
DCHECK(options == CompileOptions::kConsumeCodeCache ||
|
||||
options == CompileOptions::kEagerCompile ||
|
||||
options == CompileOptions::kNoCompileOptions);
|
||||
|
||||
i::Handle<i::Context> context = Utils::OpenHandle(*v8_context);
|
||||
i::Handle<i::SharedFunctionInfo> outer_info(context->closure()->shared(),
|
||||
isolate);
|
||||
@ -2511,25 +2532,30 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext(
|
||||
extension);
|
||||
}
|
||||
|
||||
i::Handle<i::Object> name_obj;
|
||||
int line_offset = 0;
|
||||
int column_offset = 0;
|
||||
if (!source->resource_name.IsEmpty()) {
|
||||
name_obj = Utils::OpenHandle(*(source->resource_name));
|
||||
}
|
||||
if (!source->resource_line_offset.IsEmpty()) {
|
||||
line_offset = static_cast<int>(source->resource_line_offset->Value());
|
||||
}
|
||||
if (!source->resource_column_offset.IsEmpty()) {
|
||||
column_offset = static_cast<int>(source->resource_column_offset->Value());
|
||||
i::Compiler::ScriptDetails script_details = GetScriptDetails(
|
||||
isolate, source->resource_name, source->resource_line_offset,
|
||||
source->resource_column_offset, source->source_map_url,
|
||||
source->host_defined_options);
|
||||
|
||||
i::ScriptData* script_data = nullptr;
|
||||
if (options == kConsumeCodeCache) {
|
||||
DCHECK(source->cached_data);
|
||||
// ScriptData takes care of pointer-aligning the data.
|
||||
script_data = new i::ScriptData(source->cached_data->data,
|
||||
source->cached_data->length);
|
||||
}
|
||||
|
||||
i::Handle<i::JSFunction> result;
|
||||
has_pending_exception =
|
||||
!i::Compiler::GetWrappedFunction(
|
||||
Utils::OpenHandle(*source->source_string), arguments_list, context,
|
||||
line_offset, column_offset, name_obj, source->resource_options)
|
||||
script_details, source->resource_options, script_data, options,
|
||||
no_cache_reason)
|
||||
.ToHandle(&result);
|
||||
if (options == kConsumeCodeCache) {
|
||||
source->cached_data->rejected = script_data->rejected();
|
||||
}
|
||||
delete script_data;
|
||||
RETURN_ON_FAILED_EXECUTION(Function);
|
||||
RETURN_ESCAPED(Utils::CallableToLocal(result));
|
||||
}
|
||||
@ -2603,37 +2629,18 @@ ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCache(
|
||||
i::Handle<i::SharedFunctionInfo> shared =
|
||||
i::Handle<i::SharedFunctionInfo>::cast(
|
||||
Utils::OpenHandle(*unbound_script));
|
||||
i::Isolate* isolate = shared->GetIsolate();
|
||||
TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.Execute");
|
||||
base::ElapsedTimer timer;
|
||||
if (i::FLAG_profile_deserialization) {
|
||||
timer.Start();
|
||||
}
|
||||
i::HistogramTimerScope histogram_timer(
|
||||
isolate->counters()->compile_serialize());
|
||||
i::RuntimeCallTimerScope runtimeTimer(
|
||||
isolate, i::RuntimeCallCounterId::kCompileSerialize);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileSerialize");
|
||||
|
||||
i::Handle<i::String> source_str = Utils::OpenHandle(*source);
|
||||
DCHECK(shared->is_toplevel());
|
||||
i::Handle<i::Script> script(i::Script::cast(shared->script()));
|
||||
// TODO(7110): Enable serialization of Asm modules once the AsmWasmData is
|
||||
// context independent.
|
||||
if (script->ContainsAsmModule()) return nullptr;
|
||||
if (isolate->debug()->is_loaded()) return nullptr;
|
||||
return i::CodeSerializer::Serialize(shared, source_str);
|
||||
}
|
||||
|
||||
i::ScriptData* script_data =
|
||||
i::CodeSerializer::Serialize(isolate, shared, Utils::OpenHandle(*source));
|
||||
CachedData* result = new CachedData(
|
||||
script_data->data(), script_data->length(), CachedData::BufferOwned);
|
||||
script_data->ReleaseDataOwnership();
|
||||
delete script_data;
|
||||
|
||||
if (i::FLAG_profile_deserialization) {
|
||||
i::PrintF("[Serializing took %0.3f ms]\n",
|
||||
timer.Elapsed().InMillisecondsF());
|
||||
}
|
||||
return result;
|
||||
ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCacheForFunction(
|
||||
Local<Function> function, Local<String> source) {
|
||||
i::Handle<i::SharedFunctionInfo> shared(
|
||||
i::Handle<i::JSFunction>::cast(Utils::OpenHandle(*function))->shared());
|
||||
i::Handle<i::String> source_str = Utils::OpenHandle(*source);
|
||||
CHECK(shared->is_wrapped());
|
||||
return i::CodeSerializer::Serialize(shared, source_str);
|
||||
}
|
||||
|
||||
MaybeLocal<Script> Script::Compile(Local<Context> context, Local<String> source,
|
||||
@ -2889,34 +2896,34 @@ int Message::ErrorLevel() const {
|
||||
return self->error_level();
|
||||
}
|
||||
|
||||
Maybe<int> Message::GetStartColumn(Local<Context> context) const {
|
||||
int Message::GetStartColumn() const {
|
||||
auto self = Utils::OpenHandle(this);
|
||||
i::Isolate* isolate = self->GetIsolate();
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
|
||||
EscapableHandleScope handle_scope(reinterpret_cast<Isolate*>(isolate));
|
||||
auto msg = i::Handle<i::JSMessageObject>::cast(self);
|
||||
return Just(msg->GetColumnNumber());
|
||||
return msg->GetColumnNumber();
|
||||
}
|
||||
|
||||
|
||||
int Message::GetStartColumn() const {
|
||||
auto context = ContextFromHeapObject(Utils::OpenHandle(this));
|
||||
const int default_value = kNoColumnInfo;
|
||||
return GetStartColumn(context).FromMaybe(default_value);
|
||||
Maybe<int> Message::GetStartColumn(Local<Context> context) const {
|
||||
return Just(GetStartColumn());
|
||||
}
|
||||
|
||||
|
||||
Maybe<int> Message::GetEndColumn(Local<Context> context) const {
|
||||
int Message::GetEndColumn() const {
|
||||
auto self = Utils::OpenHandle(this);
|
||||
i::Isolate* isolate = self->GetIsolate();
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
|
||||
EscapableHandleScope handle_scope(reinterpret_cast<Isolate*>(isolate));
|
||||
auto msg = i::Handle<i::JSMessageObject>::cast(self);
|
||||
const int column_number = msg->GetColumnNumber();
|
||||
if (column_number == -1) return Just(-1);
|
||||
if (column_number == -1) return -1;
|
||||
const int start = self->start_position();
|
||||
const int end = self->end_position();
|
||||
return Just(column_number + (end - start));
|
||||
return column_number + (end - start);
|
||||
}
|
||||
|
||||
Maybe<int> Message::GetEndColumn(Local<Context> context) const {
|
||||
return Just(GetEndColumn());
|
||||
}
|
||||
|
||||
|
||||
@ -3468,6 +3475,7 @@ bool Value::IsNumber() const {
|
||||
return Utils::OpenHandle(this)->IsNumber();
|
||||
}
|
||||
|
||||
bool Value::IsBigInt() const { return Utils::OpenHandle(this)->IsBigInt(); }
|
||||
|
||||
bool Value::IsProxy() const { return Utils::OpenHandle(this)->IsJSProxy(); }
|
||||
|
||||
@ -3486,6 +3494,7 @@ bool Value::IsWebAssemblyCompiledModule() const {
|
||||
}
|
||||
|
||||
VALUE_IS_SPECIFIC_TYPE(ArgumentsObject, JSArgumentsObject)
|
||||
VALUE_IS_SPECIFIC_TYPE(BigIntObject, BigIntWrapper)
|
||||
VALUE_IS_SPECIFIC_TYPE(BooleanObject, BooleanWrapper)
|
||||
VALUE_IS_SPECIFIC_TYPE(NumberObject, NumberWrapper)
|
||||
VALUE_IS_SPECIFIC_TYPE(StringObject, StringWrapper)
|
||||
@ -3574,10 +3583,6 @@ bool Value::IsSetIterator() const {
|
||||
|
||||
bool Value::IsPromise() const { return Utils::OpenHandle(this)->IsJSPromise(); }
|
||||
|
||||
bool Value::IsModuleNamespaceObject() const {
|
||||
return Utils::OpenHandle(this)->IsJSModuleNamespace();
|
||||
}
|
||||
|
||||
MaybeLocal<String> Value::ToString(Local<Context> context) const {
|
||||
auto obj = Utils::OpenHandle(this);
|
||||
if (obj->IsString()) return ToApiHandle<String>(obj);
|
||||
@ -3622,6 +3627,16 @@ Local<v8::Object> Value::ToObject(Isolate* isolate) const {
|
||||
RETURN_TO_LOCAL_UNCHECKED(ToObject(isolate->GetCurrentContext()), Object);
|
||||
}
|
||||
|
||||
MaybeLocal<BigInt> Value::ToBigInt(Local<Context> context) const {
|
||||
i::Handle<i::Object> obj = Utils::OpenHandle(this);
|
||||
if (obj->IsBigInt()) return ToApiHandle<BigInt>(obj);
|
||||
PREPARE_FOR_EXECUTION(context, Object, ToBigInt, BigInt);
|
||||
Local<BigInt> result;
|
||||
has_pending_exception =
|
||||
!ToLocal<BigInt>(i::BigInt::FromObject(isolate, obj), &result);
|
||||
RETURN_ON_FAILED_EXECUTION(BigInt);
|
||||
RETURN_ESCAPED(result);
|
||||
}
|
||||
|
||||
MaybeLocal<Boolean> Value::ToBoolean(Local<Context> context) const {
|
||||
auto obj = Utils::OpenHandle(this);
|
||||
@ -3789,6 +3804,10 @@ void v8::Uint32::CheckCast(v8::Value* that) {
|
||||
"Could not convert to 32-bit unsigned integer");
|
||||
}
|
||||
|
||||
void v8::BigInt::CheckCast(v8::Value* that) {
|
||||
Utils::ApiCheck(that->IsBigInt(), "v8::BigInt::Cast",
|
||||
"Could not convert to BigInt");
|
||||
}
|
||||
|
||||
void v8::Array::CheckCast(Value* that) {
|
||||
i::Handle<i::Object> obj = Utils::OpenHandle(that);
|
||||
@ -3915,6 +3934,11 @@ void v8::NumberObject::CheckCast(v8::Value* that) {
|
||||
"Could not convert to NumberObject");
|
||||
}
|
||||
|
||||
void v8::BigIntObject::CheckCast(v8::Value* that) {
|
||||
i::Handle<i::Object> obj = Utils::OpenHandle(that);
|
||||
Utils::ApiCheck(obj->IsBigIntWrapper(), "v8::BigIntObject::Cast()",
|
||||
"Could not convert to BigIntObject");
|
||||
}
|
||||
|
||||
void v8::BooleanObject::CheckCast(v8::Value* that) {
|
||||
i::Handle<i::Object> obj = Utils::OpenHandle(that);
|
||||
@ -4675,13 +4699,12 @@ Maybe<bool> v8::Object::Has(Local<Context> context, uint32_t index) {
|
||||
}
|
||||
|
||||
template <typename Getter, typename Setter, typename Data>
|
||||
static Maybe<bool> ObjectSetAccessor(Local<Context> context, Object* self,
|
||||
Local<Name> name, Getter getter,
|
||||
Setter setter, Data data,
|
||||
AccessControl settings,
|
||||
PropertyAttribute attributes,
|
||||
bool is_special_data_property,
|
||||
bool replace_on_access) {
|
||||
static Maybe<bool> ObjectSetAccessor(
|
||||
Local<Context> context, Object* self, Local<Name> name, Getter getter,
|
||||
Setter setter, Data data, AccessControl settings,
|
||||
PropertyAttribute attributes, bool is_special_data_property,
|
||||
bool replace_on_access,
|
||||
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect) {
|
||||
auto isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
|
||||
ENTER_V8_NO_SCRIPT(isolate, context, Object, SetAccessor, Nothing<bool>(),
|
||||
i::HandleScope);
|
||||
@ -4692,6 +4715,8 @@ static Maybe<bool> ObjectSetAccessor(Local<Context> context, Object* self,
|
||||
i::Handle<i::AccessorInfo> info =
|
||||
MakeAccessorInfo(isolate, name, getter, setter, data, settings, signature,
|
||||
is_special_data_property, replace_on_access);
|
||||
info->set_has_no_side_effect(getter_side_effect_type ==
|
||||
SideEffectType::kHasNoSideEffect);
|
||||
if (info.is_null()) return Nothing<bool>();
|
||||
bool fast = obj->HasFastProperties();
|
||||
i::Handle<i::Object> result;
|
||||
@ -4717,7 +4742,8 @@ Maybe<bool> Object::SetAccessor(Local<Context> context, Local<Name> name,
|
||||
SideEffectType getter_side_effect_type) {
|
||||
return ObjectSetAccessor(context, this, name, getter, setter,
|
||||
data.FromMaybe(Local<Value>()), settings, attribute,
|
||||
i::FLAG_disable_old_api_accessors, false);
|
||||
i::FLAG_disable_old_api_accessors, false,
|
||||
getter_side_effect_type);
|
||||
}
|
||||
|
||||
|
||||
@ -4746,7 +4772,7 @@ Maybe<bool> Object::SetNativeDataProperty(
|
||||
v8::Local<Value> data, PropertyAttribute attributes,
|
||||
SideEffectType getter_side_effect_type) {
|
||||
return ObjectSetAccessor(context, this, name, getter, setter, data, DEFAULT,
|
||||
attributes, true, false);
|
||||
attributes, true, false, getter_side_effect_type);
|
||||
}
|
||||
|
||||
Maybe<bool> Object::SetLazyDataProperty(
|
||||
@ -4755,7 +4781,8 @@ Maybe<bool> Object::SetLazyDataProperty(
|
||||
PropertyAttribute attributes, SideEffectType getter_side_effect_type) {
|
||||
return ObjectSetAccessor(context, this, name, getter,
|
||||
static_cast<AccessorNameSetterCallback>(nullptr),
|
||||
data, DEFAULT, attributes, true, true);
|
||||
data, DEFAULT, attributes, true, true,
|
||||
getter_side_effect_type);
|
||||
}
|
||||
|
||||
Maybe<bool> v8::Object::HasOwnProperty(Local<Context> context,
|
||||
@ -5025,8 +5052,9 @@ MaybeLocal<Function> Function::New(Local<Context> context,
|
||||
i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate();
|
||||
LOG_API(isolate, Function, New);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
|
||||
auto templ = FunctionTemplateNew(isolate, callback, data, Local<Signature>(),
|
||||
length, true);
|
||||
auto templ =
|
||||
FunctionTemplateNew(isolate, callback, data, Local<Signature>(), length,
|
||||
true, Local<Private>(), side_effect_type);
|
||||
if (behavior == ConstructorBehavior::kThrow) templ->RemovePrototype();
|
||||
return templ->GetFunction(context);
|
||||
}
|
||||
@ -5091,7 +5119,7 @@ void Function::SetName(v8::Local<v8::String> name) {
|
||||
auto self = Utils::OpenHandle(this);
|
||||
if (!self->IsJSFunction()) return;
|
||||
auto func = i::Handle<i::JSFunction>::cast(self);
|
||||
func->shared()->set_name(*Utils::OpenHandle(*name));
|
||||
func->shared()->SetName(*Utils::OpenHandle(*name));
|
||||
}
|
||||
|
||||
|
||||
@ -5108,7 +5136,7 @@ Local<Value> Function::GetName() const {
|
||||
}
|
||||
if (self->IsJSFunction()) {
|
||||
auto func = i::Handle<i::JSFunction>::cast(self);
|
||||
return Utils::ToLocal(handle(func->shared()->name(), isolate));
|
||||
return Utils::ToLocal(handle(func->shared()->Name(), isolate));
|
||||
}
|
||||
return ToApiHandle<Primitive>(isolate->factory()->undefined_value());
|
||||
}
|
||||
@ -5183,7 +5211,7 @@ int Function::GetScriptLineNumber() const {
|
||||
auto func = i::Handle<i::JSFunction>::cast(self);
|
||||
if (func->shared()->script()->IsScript()) {
|
||||
i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
|
||||
return i::Script::GetLineNumber(script, func->shared()->start_position());
|
||||
return i::Script::GetLineNumber(script, func->shared()->StartPosition());
|
||||
}
|
||||
return kLineOffsetNotFound;
|
||||
}
|
||||
@ -5197,7 +5225,7 @@ int Function::GetScriptColumnNumber() const {
|
||||
auto func = i::Handle<i::JSFunction>::cast(self);
|
||||
if (func->shared()->script()->IsScript()) {
|
||||
i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
|
||||
return i::Script::GetColumnNumber(script, func->shared()->start_position());
|
||||
return i::Script::GetColumnNumber(script, func->shared()->StartPosition());
|
||||
}
|
||||
return kLineOffsetNotFound;
|
||||
}
|
||||
@ -5556,6 +5584,7 @@ static int Utf8Length(i::String* str, i::Isolate* isolate) {
|
||||
|
||||
int String::Utf8Length() const {
|
||||
i::Handle<i::String> str = Utils::OpenHandle(this);
|
||||
str = i::String::Flatten(str);
|
||||
i::Isolate* isolate = str->GetIsolate();
|
||||
return v8::Utf8Length(*str, isolate);
|
||||
}
|
||||
@ -5769,9 +5798,7 @@ int String::WriteUtf8(char* buffer,
|
||||
i::Isolate* isolate = str->GetIsolate();
|
||||
LOG_API(isolate, String, WriteUtf8);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
|
||||
if (options & HINT_MANY_WRITES_EXPECTED) {
|
||||
str = i::String::Flatten(str); // Flatten the string for efficiency.
|
||||
}
|
||||
str = i::String::Flatten(str); // Flatten the string for efficiency.
|
||||
const int string_length = str->length();
|
||||
bool write_null = !(options & NO_NULL_TERMINATION);
|
||||
bool replace_invalid_utf8 = (options & REPLACE_INVALID_UTF8);
|
||||
@ -5823,11 +5850,7 @@ static inline int WriteHelper(const String* string,
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
|
||||
DCHECK(start >= 0 && length >= -1);
|
||||
i::Handle<i::String> str = Utils::OpenHandle(string);
|
||||
if (options & String::HINT_MANY_WRITES_EXPECTED) {
|
||||
// Flatten the string for efficiency. This applies whether we are
|
||||
// using StringCharacterStream or Get(i) to access the characters.
|
||||
str = i::String::Flatten(str);
|
||||
}
|
||||
str = i::String::Flatten(str);
|
||||
int end = start + length;
|
||||
if ((length == -1) || (length > str->length() - start) )
|
||||
end = str->length();
|
||||
@ -6088,6 +6111,10 @@ bool V8::RegisterDefaultSignalHandler() {
|
||||
return v8::internal::trap_handler::RegisterDefaultSignalHandler();
|
||||
}
|
||||
|
||||
bool V8::EnableWebAssemblyTrapHandler(bool use_v8_signal_handler) {
|
||||
return v8::internal::trap_handler::EnableTrapHandler(use_v8_signal_handler);
|
||||
}
|
||||
|
||||
void v8::V8::SetEntropySource(EntropySource entropy_source) {
|
||||
base::RandomNumberGenerator::SetEntropySource(entropy_source);
|
||||
}
|
||||
@ -6136,6 +6163,10 @@ HeapObjectStatistics::HeapObjectStatistics()
|
||||
HeapCodeStatistics::HeapCodeStatistics()
|
||||
: code_and_metadata_size_(0), bytecode_and_metadata_size_(0) {}
|
||||
|
||||
bool v8::V8::InitializeICU(const char* icu_data_file) {
|
||||
return i::InitializeICU(icu_data_file);
|
||||
}
|
||||
|
||||
bool v8::V8::InitializeICUDefaultLocation(const char* exec_path,
|
||||
const char* icu_data_file) {
|
||||
return i::InitializeICUDefaultLocation(exec_path, icu_data_file);
|
||||
@ -6604,8 +6635,7 @@ inline int StringLength(const uint16_t* string) {
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
MUST_USE_RESULT
|
||||
V8_WARN_UNUSED_RESULT
|
||||
inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
|
||||
v8::NewStringType type,
|
||||
i::Vector<const char> string) {
|
||||
@ -6615,8 +6645,7 @@ inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
|
||||
return factory->NewStringFromUtf8(string);
|
||||
}
|
||||
|
||||
|
||||
MUST_USE_RESULT
|
||||
V8_WARN_UNUSED_RESULT
|
||||
inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
|
||||
v8::NewStringType type,
|
||||
i::Vector<const uint8_t> string) {
|
||||
@ -6626,8 +6655,7 @@ inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
|
||||
return factory->NewStringFromOneByte(string);
|
||||
}
|
||||
|
||||
|
||||
MUST_USE_RESULT
|
||||
V8_WARN_UNUSED_RESULT
|
||||
inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
|
||||
v8::NewStringType type,
|
||||
i::Vector<const uint16_t> string) {
|
||||
@ -6867,6 +6895,25 @@ double v8::NumberObject::ValueOf() const {
|
||||
return jsvalue->value()->Number();
|
||||
}
|
||||
|
||||
Local<v8::Value> v8::BigIntObject::New(Isolate* isolate, int64_t value) {
|
||||
CHECK(i::FLAG_harmony_bigint);
|
||||
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
LOG_API(i_isolate, BigIntObject, New);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
|
||||
i::Handle<i::Object> bigint = i::BigInt::FromInt64(i_isolate, value);
|
||||
i::Handle<i::Object> obj =
|
||||
i::Object::ToObject(i_isolate, bigint).ToHandleChecked();
|
||||
return Utils::ToLocal(obj);
|
||||
}
|
||||
|
||||
Local<v8::BigInt> v8::BigIntObject::ValueOf() const {
|
||||
i::Handle<i::Object> obj = Utils::OpenHandle(this);
|
||||
i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
|
||||
i::Isolate* isolate = jsvalue->GetIsolate();
|
||||
LOG_API(isolate, BigIntObject, BigIntValue);
|
||||
return Utils::ToLocal(
|
||||
i::Handle<i::BigInt>(i::BigInt::cast(jsvalue->value())));
|
||||
}
|
||||
|
||||
Local<v8::Value> v8::BooleanObject::New(Isolate* isolate, bool value) {
|
||||
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
@ -7644,17 +7691,23 @@ v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() {
|
||||
Utils::ApiCheck(!self->is_external(), "v8_ArrayBuffer_Externalize",
|
||||
"ArrayBuffer already externalized");
|
||||
self->set_is_external(true);
|
||||
if (self->has_guard_region()) {
|
||||
|
||||
// We need to capture the contents before releasing the allocation from the
|
||||
// Wasm tracker, because otherwise we will not correctly capture the
|
||||
// allocation data.
|
||||
const v8::ArrayBuffer::Contents contents = GetContents();
|
||||
if (self->is_wasm_memory()) {
|
||||
// Since this is being externalized, the Wasm Allocation Tracker can no
|
||||
// longer track it.
|
||||
//
|
||||
// TODO(eholk): Find a way to track this across externalization
|
||||
isolate->wasm_engine()->allocation_tracker()->ReleaseAddressSpace(
|
||||
self->allocation_length());
|
||||
isolate->wasm_engine()->memory_tracker()->ReleaseAllocation(
|
||||
self->backing_store());
|
||||
}
|
||||
isolate->heap()->UnregisterArrayBuffer(*self);
|
||||
|
||||
return GetContents();
|
||||
// A regular copy is good enough. No move semantics needed.
|
||||
return contents;
|
||||
}
|
||||
|
||||
|
||||
@ -7664,7 +7717,7 @@ v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents() {
|
||||
Contents contents;
|
||||
contents.allocation_base_ = self->allocation_base();
|
||||
contents.allocation_length_ = self->allocation_length();
|
||||
contents.allocation_mode_ = self->has_guard_region()
|
||||
contents.allocation_mode_ = self->is_wasm_memory()
|
||||
? Allocator::AllocationMode::kReservation
|
||||
: Allocator::AllocationMode::kNormal;
|
||||
contents.data_ = self->backing_store();
|
||||
@ -7702,7 +7755,7 @@ Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) {
|
||||
// TODO(jbroman): It may be useful in the future to provide a MaybeLocal
|
||||
// version that throws an exception or otherwise does not crash.
|
||||
if (!i::JSArrayBuffer::SetupAllocatingData(obj, i_isolate, byte_length)) {
|
||||
i::FatalProcessOutOfMemory("v8::ArrayBuffer::New");
|
||||
i::FatalProcessOutOfMemory(i_isolate, "v8::ArrayBuffer::New");
|
||||
}
|
||||
return Utils::ToLocal(obj);
|
||||
}
|
||||
@ -7867,16 +7920,23 @@ v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::Externalize() {
|
||||
Utils::ApiCheck(!self->is_external(), "v8_SharedArrayBuffer_Externalize",
|
||||
"SharedArrayBuffer already externalized");
|
||||
self->set_is_external(true);
|
||||
if (self->has_guard_region()) {
|
||||
|
||||
// We need to capture the contents before releasing the allocation from the
|
||||
// Wasm tracker, because otherwise we will not correctly capture the
|
||||
// allocation data.
|
||||
const v8::SharedArrayBuffer::Contents contents = GetContents();
|
||||
if (self->is_wasm_memory()) {
|
||||
// Since this is being externalized, the Wasm Allocation Tracker can no
|
||||
// longer track it.
|
||||
//
|
||||
// TODO(eholk): Find a way to track this across externalization
|
||||
isolate->wasm_engine()->allocation_tracker()->ReleaseAddressSpace(
|
||||
self->allocation_length());
|
||||
isolate->wasm_engine()->memory_tracker()->ReleaseAllocation(
|
||||
self->backing_store());
|
||||
}
|
||||
isolate->heap()->UnregisterArrayBuffer(*self);
|
||||
return GetContents();
|
||||
|
||||
// A regular copy is good enough. No move semantics needed.
|
||||
return contents;
|
||||
}
|
||||
|
||||
|
||||
@ -7887,7 +7947,7 @@ v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::GetContents() {
|
||||
contents.allocation_base_ = self->allocation_base();
|
||||
contents.allocation_length_ = self->allocation_length();
|
||||
contents.allocation_mode_ =
|
||||
self->has_guard_region()
|
||||
self->is_wasm_memory()
|
||||
? ArrayBufferAllocator::Allocator::AllocationMode::kReservation
|
||||
: ArrayBufferAllocator::Allocator::AllocationMode::kNormal;
|
||||
contents.data_ = self->backing_store();
|
||||
@ -7914,7 +7974,7 @@ Local<SharedArrayBuffer> v8::SharedArrayBuffer::New(Isolate* isolate,
|
||||
// version that throws an exception or otherwise does not crash.
|
||||
if (!i::JSArrayBuffer::SetupAllocatingData(obj, i_isolate, byte_length, true,
|
||||
i::SharedFlag::kShared)) {
|
||||
i::FatalProcessOutOfMemory("v8::SharedArrayBuffer::New");
|
||||
i::FatalProcessOutOfMemory(i_isolate, "v8::SharedArrayBuffer::New");
|
||||
}
|
||||
return Utils::ToLocalShared(obj);
|
||||
}
|
||||
@ -8041,6 +8101,13 @@ Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) {
|
||||
return Utils::IntegerToLocal(result);
|
||||
}
|
||||
|
||||
Local<BigInt> v8::BigInt::New(Isolate* isolate, int64_t value) {
|
||||
CHECK(i::FLAG_harmony_bigint);
|
||||
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(internal_isolate);
|
||||
i::Handle<i::BigInt> result = i::BigInt::FromInt64(internal_isolate, value);
|
||||
return Utils::ToLocal(result);
|
||||
}
|
||||
|
||||
void Isolate::ReportExternalAllocationLimitReached() {
|
||||
i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap();
|
||||
@ -8067,6 +8134,10 @@ CpuProfiler* Isolate::GetCpuProfiler() {
|
||||
return reinterpret_cast<CpuProfiler*>(cpu_profiler);
|
||||
}
|
||||
|
||||
void Isolate::SetIdle(bool is_idle) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
isolate->SetIdle(is_idle);
|
||||
}
|
||||
|
||||
bool Isolate::InContext() {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
@ -8745,19 +8816,14 @@ void Isolate::SetRAILMode(RAILMode rail_mode) {
|
||||
}
|
||||
|
||||
void Isolate::IncreaseHeapLimitForDebugging() {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
isolate->heap()->IncreaseHeapLimitForDebugging();
|
||||
// No-op.
|
||||
}
|
||||
|
||||
void Isolate::RestoreOriginalHeapLimit() {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
isolate->heap()->RestoreOriginalHeapLimit();
|
||||
// No-op.
|
||||
}
|
||||
|
||||
bool Isolate::IsHeapLimitIncreasedForDebugging() {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
return isolate->heap()->IsHeapLimitIncreasedForDebugging();
|
||||
}
|
||||
bool Isolate::IsHeapLimitIncreasedForDebugging() { return false; }
|
||||
|
||||
void Isolate::SetJitCodeEventHandler(JitCodeEventOptions options,
|
||||
JitCodeEventHandler event_handler) {
|
||||
@ -8806,6 +8872,18 @@ CALLBACK_SETTER(WasmInstanceCallback, ExtensionCallback, wasm_instance_callback)
|
||||
CALLBACK_SETTER(WasmCompileStreamingCallback, ApiImplementationCallback,
|
||||
wasm_compile_streaming_callback)
|
||||
|
||||
void Isolate::AddNearHeapLimitCallback(v8::NearHeapLimitCallback callback,
|
||||
void* data) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
isolate->heap()->AddNearHeapLimitCallback(callback, data);
|
||||
}
|
||||
|
||||
void Isolate::RemoveNearHeapLimitCallback(v8::NearHeapLimitCallback callback,
|
||||
size_t heap_limit) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
isolate->heap()->RemoveNearHeapLimitCallback(callback, heap_limit);
|
||||
}
|
||||
|
||||
bool Isolate::IsDead() {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
return isolate->IsDead();
|
||||
@ -9054,6 +9132,16 @@ int debug::GetContextId(Local<Context> context) {
|
||||
return (value->IsSmi()) ? i::Smi::ToInt(value) : 0;
|
||||
}
|
||||
|
||||
void debug::SetInspector(Isolate* isolate,
|
||||
v8_inspector::V8Inspector* inspector) {
|
||||
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
i_isolate->set_inspector(inspector);
|
||||
}
|
||||
|
||||
v8_inspector::V8Inspector* debug::GetInspector(Isolate* isolate) {
|
||||
return reinterpret_cast<i::Isolate*>(isolate)->inspector();
|
||||
}
|
||||
|
||||
Local<Context> debug::GetDebugContext(Isolate* isolate) {
|
||||
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
|
||||
@ -9118,9 +9206,7 @@ void debug::SetBreakPointsActive(Isolate* v8_isolate, bool is_active) {
|
||||
|
||||
void debug::SetOutOfMemoryCallback(Isolate* isolate,
|
||||
OutOfMemoryCallback callback, void* data) {
|
||||
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
|
||||
i_isolate->heap()->SetOutOfMemoryCallback(callback, data);
|
||||
// No-op.
|
||||
}
|
||||
|
||||
void debug::PrepareStep(Isolate* v8_isolate, StepAction action) {
|
||||
@ -9367,8 +9453,8 @@ bool debug::Script::SetBreakpoint(v8::Local<v8::String> condition,
|
||||
i::Handle<i::Script> script = Utils::OpenHandle(this);
|
||||
i::Isolate* isolate = script->GetIsolate();
|
||||
int offset = GetSourceOffset(*location);
|
||||
if (!isolate->debug()->SetBreakpoint(script, Utils::OpenHandle(*condition),
|
||||
&offset, id)) {
|
||||
if (!isolate->debug()->SetBreakPointForScript(
|
||||
script, Utils::OpenHandle(*condition), &offset, id)) {
|
||||
return false;
|
||||
}
|
||||
*location = GetSourceLocation(offset);
|
||||
@ -9425,6 +9511,25 @@ std::pair<int, int> debug::WasmScript::GetFunctionRange(
|
||||
static_cast<int>(func.code.end_offset()));
|
||||
}
|
||||
|
||||
uint32_t debug::WasmScript::GetFunctionHash(int function_index) {
|
||||
i::DisallowHeapAllocation no_gc;
|
||||
i::Handle<i::Script> script = Utils::OpenHandle(this);
|
||||
DCHECK_EQ(i::Script::TYPE_WASM, script->type());
|
||||
i::WasmCompiledModule* compiled_module =
|
||||
i::WasmCompiledModule::cast(script->wasm_compiled_module());
|
||||
i::wasm::WasmModule* module = compiled_module->shared()->module();
|
||||
DCHECK_LE(0, function_index);
|
||||
DCHECK_GT(module->functions.size(), function_index);
|
||||
i::wasm::WasmFunction& func = module->functions[function_index];
|
||||
i::SeqOneByteString* module_bytes = compiled_module->shared()->module_bytes();
|
||||
i::wasm::ModuleWireBytes wire_bytes(
|
||||
module_bytes->GetFlatContent().ToOneByteVector());
|
||||
i::Vector<const i::byte> function_bytes = wire_bytes.GetFunctionBytes(&func);
|
||||
// TODO(herhut): Maybe also take module, name and signature into account.
|
||||
return i::StringHasher::HashSequentialString(function_bytes.start(),
|
||||
function_bytes.length(), 0);
|
||||
}
|
||||
|
||||
debug::WasmDisassembly debug::WasmScript::DisassembleFunction(
|
||||
int function_index) const {
|
||||
i::DisallowHeapAllocation no_gc;
|
||||
@ -9480,15 +9585,15 @@ MaybeLocal<UnboundScript> debug::CompileInspectorScript(Isolate* v8_isolate,
|
||||
Local<String> source) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
||||
PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(isolate, UnboundScript);
|
||||
i::ScriptData* script_data = nullptr;
|
||||
i::Handle<i::String> str = Utils::OpenHandle(*source);
|
||||
i::Handle<i::SharedFunctionInfo> result;
|
||||
{
|
||||
ScriptOriginOptions origin_options;
|
||||
i::ScriptData* script_data = nullptr;
|
||||
i::MaybeHandle<i::SharedFunctionInfo> maybe_function_info =
|
||||
i::Compiler::GetSharedFunctionInfoForScript(
|
||||
str, i::Compiler::ScriptDetails(), origin_options, nullptr,
|
||||
&script_data, ScriptCompiler::kNoCompileOptions,
|
||||
script_data, ScriptCompiler::kNoCompileOptions,
|
||||
ScriptCompiler::kNoCacheBecauseInspector,
|
||||
i::FLAG_expose_inspector_scripts ? i::NOT_NATIVES_CODE
|
||||
: i::INSPECTOR_CODE);
|
||||
@ -9526,20 +9631,21 @@ int debug::EstimatedValueSize(Isolate* v8_isolate, v8::Local<v8::Value> value) {
|
||||
return i::Handle<i::HeapObject>::cast(object)->Size();
|
||||
}
|
||||
|
||||
v8::MaybeLocal<v8::Array> v8::Object::PreviewEntries(bool* is_key_value) {
|
||||
if (IsMap()) {
|
||||
v8::MaybeLocal<v8::Array> debug::EntriesPreview(Isolate* v8_isolate,
|
||||
v8::Local<v8::Value> value,
|
||||
bool* is_key_value) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
|
||||
if (value->IsMap()) {
|
||||
*is_key_value = true;
|
||||
return Map::Cast(this)->AsArray();
|
||||
return value.As<Map>()->AsArray();
|
||||
}
|
||||
if (IsSet()) {
|
||||
if (value->IsSet()) {
|
||||
*is_key_value = false;
|
||||
return Set::Cast(this)->AsArray();
|
||||
return value.As<Set>()->AsArray();
|
||||
}
|
||||
|
||||
i::Handle<i::JSReceiver> object = Utils::OpenHandle(this);
|
||||
i::Isolate* isolate = object->GetIsolate();
|
||||
Isolate* v8_isolate = reinterpret_cast<Isolate*>(isolate);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
|
||||
i::Handle<i::Object> object = Utils::OpenHandle(*value);
|
||||
if (object->IsJSWeakCollection()) {
|
||||
*is_key_value = object->IsJSWeakMap();
|
||||
return Utils::ToLocal(i::JSWeakCollection::GetEntries(
|
||||
@ -9591,9 +9697,8 @@ Local<Function> debug::GetBuiltin(Isolate* v8_isolate, Builtin builtin) {
|
||||
}
|
||||
|
||||
i::Handle<i::String> name = isolate->factory()->empty_string();
|
||||
i::Handle<i::Code> code(isolate->builtins()->builtin(builtin_id));
|
||||
i::NewFunctionArgs args = i::NewFunctionArgs::ForBuiltinWithoutPrototype(
|
||||
name, code, builtin_id, i::LanguageMode::kSloppy);
|
||||
name, builtin_id, i::LanguageMode::kSloppy);
|
||||
i::Handle<i::JSFunction> fun = isolate->factory()->NewFunction(args);
|
||||
|
||||
fun->shared()->DontAdaptArguments();
|
||||
@ -9668,12 +9773,14 @@ v8::Local<debug::GeneratorObject> debug::GeneratorObject::Cast(
|
||||
}
|
||||
|
||||
MaybeLocal<v8::Value> debug::EvaluateGlobal(v8::Isolate* isolate,
|
||||
v8::Local<v8::String> source) {
|
||||
v8::Local<v8::String> source,
|
||||
bool throw_on_side_effect) {
|
||||
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(internal_isolate, Value);
|
||||
Local<Value> result;
|
||||
has_pending_exception = !ToLocal<Value>(
|
||||
i::DebugEvaluate::Global(internal_isolate, Utils::OpenHandle(*source)),
|
||||
i::DebugEvaluate::Global(internal_isolate, Utils::OpenHandle(*source),
|
||||
throw_on_side_effect),
|
||||
&result);
|
||||
RETURN_ON_FAILED_EXECUTION(Value);
|
||||
RETURN_ESCAPED(result);
|
||||
@ -9755,6 +9862,35 @@ int64_t debug::GetNextRandomInt64(v8::Isolate* v8_isolate) {
|
||||
->NextInt64();
|
||||
}
|
||||
|
||||
int debug::GetDebuggingId(v8::Local<v8::Function> function) {
|
||||
i::JSReceiver* callable = *v8::Utils::OpenHandle(*function);
|
||||
if (!callable->IsJSFunction()) return i::SharedFunctionInfo::kNoDebuggingId;
|
||||
i::JSFunction* fun = i::JSFunction::cast(callable);
|
||||
i::SharedFunctionInfo* shared = fun->shared();
|
||||
int id = shared->debugging_id();
|
||||
if (id == i::SharedFunctionInfo::kNoDebuggingId) {
|
||||
id = shared->GetHeap()->NextDebuggingId();
|
||||
shared->set_debugging_id(id);
|
||||
}
|
||||
DCHECK_NE(i::SharedFunctionInfo::kNoDebuggingId, id);
|
||||
return id;
|
||||
}
|
||||
|
||||
bool debug::SetFunctionBreakpoint(v8::Local<v8::Function> function,
|
||||
v8::Local<v8::String> condition,
|
||||
BreakpointId* id) {
|
||||
i::Handle<i::JSReceiver> callable = Utils::OpenHandle(*function);
|
||||
if (!callable->IsJSFunction()) return false;
|
||||
i::Handle<i::JSFunction> jsfunction =
|
||||
i::Handle<i::JSFunction>::cast(callable);
|
||||
i::Isolate* isolate = jsfunction->GetIsolate();
|
||||
i::Handle<i::String> condition_string =
|
||||
condition.IsEmpty() ? isolate->factory()->empty_string()
|
||||
: Utils::OpenHandle(*condition);
|
||||
return isolate->debug()->SetBreakpointForFunction(jsfunction,
|
||||
condition_string, id);
|
||||
}
|
||||
|
||||
Local<String> CpuProfileNode::GetFunctionName() const {
|
||||
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
|
||||
i::Isolate* isolate = node->isolate();
|
||||
@ -10061,15 +10197,7 @@ CpuProfile* CpuProfiler::StopProfiling(Local<String> title) {
|
||||
void CpuProfiler::SetIdle(bool is_idle) {
|
||||
i::CpuProfiler* profiler = reinterpret_cast<i::CpuProfiler*>(this);
|
||||
i::Isolate* isolate = profiler->isolate();
|
||||
if (!isolate->is_profiling()) return;
|
||||
v8::StateTag state = isolate->current_vm_state();
|
||||
DCHECK(state == v8::EXTERNAL || state == v8::IDLE);
|
||||
if (isolate->js_entry_sp() != nullptr) return;
|
||||
if (is_idle) {
|
||||
isolate->set_current_vm_state(v8::IDLE);
|
||||
} else if (state == v8::IDLE) {
|
||||
isolate->set_current_vm_state(v8::EXTERNAL);
|
||||
}
|
||||
isolate->SetIdle(is_idle);
|
||||
}
|
||||
|
||||
|
||||
|
9
deps/v8/src/api.h
vendored
9
deps/v8/src/api.h
vendored
@ -9,7 +9,7 @@
|
||||
#include "src/contexts.h"
|
||||
#include "src/debug/debug-interface.h"
|
||||
#include "src/detachable-vector.h"
|
||||
#include "src/factory.h"
|
||||
#include "src/heap/factory.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/objects/js-collection.h"
|
||||
|
||||
@ -124,7 +124,8 @@ class Utils {
|
||||
if (!condition) Utils::ReportApiFailure(location, message);
|
||||
return condition;
|
||||
}
|
||||
static void ReportOOMFailure(const char* location, bool is_heap_oom);
|
||||
static void ReportOOMFailure(v8::internal::Isolate* isolate,
|
||||
const char* location, bool is_heap_oom);
|
||||
|
||||
static inline Local<Context> ToLocal(
|
||||
v8::internal::Handle<v8::internal::Context> obj);
|
||||
@ -202,6 +203,8 @@ class Utils {
|
||||
v8::internal::Handle<v8::internal::Object> obj);
|
||||
static inline Local<Uint32> Uint32ToLocal(
|
||||
v8::internal::Handle<v8::internal::Object> obj);
|
||||
static inline Local<BigInt> ToLocal(
|
||||
v8::internal::Handle<v8::internal::BigInt> obj);
|
||||
static inline Local<FunctionTemplate> ToLocal(
|
||||
v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
|
||||
static inline Local<ObjectTemplate> ToLocal(
|
||||
@ -333,6 +336,7 @@ MAKE_TO_LOCAL(StackFrameToLocal, StackFrameInfo, StackFrame)
|
||||
MAKE_TO_LOCAL(NumberToLocal, Object, Number)
|
||||
MAKE_TO_LOCAL(IntegerToLocal, Object, Integer)
|
||||
MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32)
|
||||
MAKE_TO_LOCAL(ToLocal, BigInt, BigInt);
|
||||
MAKE_TO_LOCAL(ExternalToLocal, JSObject, External)
|
||||
MAKE_TO_LOCAL(CallableToLocal, JSReceiver, Function)
|
||||
MAKE_TO_LOCAL(ToLocalPrimitive, Object, Primitive)
|
||||
@ -630,7 +634,6 @@ void HandleScopeImplementer::EnterMicrotaskContext(Handle<Context> context) {
|
||||
}
|
||||
|
||||
void HandleScopeImplementer::LeaveMicrotaskContext() {
|
||||
DCHECK(microtask_context_);
|
||||
microtask_context_ = nullptr;
|
||||
entered_context_count_during_microtasks_ = 0;
|
||||
}
|
||||
|
22
deps/v8/src/arm/assembler-arm-inl.h
vendored
22
deps/v8/src/arm/assembler-arm-inl.h
vendored
@ -73,7 +73,8 @@ Address RelocInfo::target_address() {
|
||||
|
||||
Address RelocInfo::target_address_address() {
|
||||
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_) ||
|
||||
rmode_ == EMBEDDED_OBJECT || rmode_ == EXTERNAL_REFERENCE);
|
||||
IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) ||
|
||||
IsOffHeapTarget(rmode_));
|
||||
if (Assembler::IsMovW(Memory::int32_at(pc_))) {
|
||||
return reinterpret_cast<Address>(pc_);
|
||||
} else {
|
||||
@ -125,6 +126,12 @@ Address RelocInfo::target_external_reference() {
|
||||
return Assembler::target_address_at(pc_, constant_pool_);
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_external_reference(
|
||||
Address target, ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(rmode_ == RelocInfo::EXTERNAL_REFERENCE);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, target,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::target_internal_reference() {
|
||||
DCHECK(rmode_ == INTERNAL_REFERENCE);
|
||||
@ -137,6 +144,12 @@ Address RelocInfo::target_internal_reference_address() {
|
||||
return reinterpret_cast<Address>(pc_);
|
||||
}
|
||||
|
||||
void RelocInfo::set_wasm_code_table_entry(Address target,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(rmode_ == RelocInfo::WASM_CODE_TABLE_ENTRY);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, target,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::target_runtime_entry(Assembler* origin) {
|
||||
DCHECK(IsRuntimeEntry(rmode_));
|
||||
@ -151,6 +164,11 @@ void RelocInfo::set_target_runtime_entry(Address target,
|
||||
set_target_address(target, write_barrier_mode, icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::target_off_heap_target() {
|
||||
DCHECK(IsOffHeapTarget(rmode_));
|
||||
return Assembler::target_address_at(pc_, constant_pool_);
|
||||
}
|
||||
|
||||
void RelocInfo::WipeOut() {
|
||||
DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
|
||||
IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
|
||||
@ -175,6 +193,8 @@ void RelocInfo::Visit(ObjectVisitor* visitor) {
|
||||
visitor->VisitInternalReference(host(), this);
|
||||
} else if (RelocInfo::IsRuntimeEntry(mode)) {
|
||||
visitor->VisitRuntimeEntry(host(), this);
|
||||
} else if (RelocInfo::IsOffHeapTarget(mode)) {
|
||||
visitor->VisitOffHeapTarget(host(), this);
|
||||
}
|
||||
}
|
||||
|
||||
|
16
deps/v8/src/arm/assembler-arm.cc
vendored
16
deps/v8/src/arm/assembler-arm.cc
vendored
@ -5081,7 +5081,7 @@ void Assembler::GrowBuffer() {
|
||||
// Some internal data structures overflow for very large buffers,
|
||||
// they must ensure that kMaximalBufferSize is not too large.
|
||||
if (desc.buffer_size > kMaximalBufferSize) {
|
||||
V8::FatalProcessOutOfMemory("Assembler::GrowBuffer");
|
||||
V8::FatalProcessOutOfMemory(nullptr, "Assembler::GrowBuffer");
|
||||
}
|
||||
|
||||
// Set up new buffer.
|
||||
@ -5144,14 +5144,6 @@ void Assembler::dq(uint64_t value) {
|
||||
pc_ += sizeof(uint64_t);
|
||||
}
|
||||
|
||||
|
||||
void Assembler::emit_code_stub_address(Code* stub) {
|
||||
CheckBuffer();
|
||||
*reinterpret_cast<uint32_t*>(pc_) =
|
||||
reinterpret_cast<uint32_t>(stub->instruction_start());
|
||||
pc_ += sizeof(uint32_t);
|
||||
}
|
||||
|
||||
void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
|
||||
if (RelocInfo::IsNone(rmode) ||
|
||||
// Don't record external references unless the heap will be serialized.
|
||||
@ -5175,7 +5167,8 @@ void Assembler::ConstantPoolAddEntry(int position, RelocInfo::Mode rmode,
|
||||
}
|
||||
ConstantPoolEntry entry(position, value,
|
||||
sharing_ok || (rmode == RelocInfo::CODE_TARGET &&
|
||||
IsCodeTargetSharingAllowed()));
|
||||
IsCodeTargetSharingAllowed()),
|
||||
rmode);
|
||||
|
||||
bool shared = false;
|
||||
if (sharing_ok) {
|
||||
@ -5183,7 +5176,8 @@ void Assembler::ConstantPoolAddEntry(int position, RelocInfo::Mode rmode,
|
||||
for (size_t i = 0; i < pending_32_bit_constants_.size(); i++) {
|
||||
ConstantPoolEntry& current_entry = pending_32_bit_constants_[i];
|
||||
if (!current_entry.sharing_ok()) continue;
|
||||
if (entry.value() == current_entry.value()) {
|
||||
if (entry.value() == current_entry.value() &&
|
||||
entry.rmode() == current_entry.rmode()) {
|
||||
entry.set_merged_index(i);
|
||||
shared = true;
|
||||
break;
|
||||
|
24
deps/v8/src/arm/assembler-arm.h
vendored
24
deps/v8/src/arm/assembler-arm.h
vendored
@ -162,8 +162,8 @@ class Register : public RegisterBase<Register, kRegAfterLast> {
|
||||
explicit constexpr Register(int code) : RegisterBase(code) {}
|
||||
};
|
||||
|
||||
static_assert(IS_TRIVIALLY_COPYABLE(Register) &&
|
||||
sizeof(Register) == sizeof(int),
|
||||
ASSERT_TRIVIALLY_COPYABLE(Register);
|
||||
static_assert(sizeof(Register) == sizeof(int),
|
||||
"Register can efficiently be passed by value");
|
||||
|
||||
// r7: context register
|
||||
@ -218,8 +218,8 @@ class SwVfpRegister : public RegisterBase<SwVfpRegister, kSwVfpAfterLast> {
|
||||
explicit constexpr SwVfpRegister(int code) : RegisterBase(code) {}
|
||||
};
|
||||
|
||||
static_assert(IS_TRIVIALLY_COPYABLE(SwVfpRegister) &&
|
||||
sizeof(SwVfpRegister) == sizeof(int),
|
||||
ASSERT_TRIVIALLY_COPYABLE(SwVfpRegister);
|
||||
static_assert(sizeof(SwVfpRegister) == sizeof(int),
|
||||
"SwVfpRegister can efficiently be passed by value");
|
||||
|
||||
typedef SwVfpRegister FloatRegister;
|
||||
@ -256,8 +256,8 @@ class DwVfpRegister : public RegisterBase<DwVfpRegister, kDoubleAfterLast> {
|
||||
explicit constexpr DwVfpRegister(int code) : RegisterBase(code) {}
|
||||
};
|
||||
|
||||
static_assert(IS_TRIVIALLY_COPYABLE(DwVfpRegister) &&
|
||||
sizeof(DwVfpRegister) == sizeof(int),
|
||||
ASSERT_TRIVIALLY_COPYABLE(DwVfpRegister);
|
||||
static_assert(sizeof(DwVfpRegister) == sizeof(int),
|
||||
"DwVfpRegister can efficiently be passed by value");
|
||||
|
||||
typedef DwVfpRegister DoubleRegister;
|
||||
@ -1491,9 +1491,6 @@ class Assembler : public AssemblerBase {
|
||||
void dq(uint64_t data);
|
||||
void dp(uintptr_t data) { dd(data); }
|
||||
|
||||
// Emits the address of the code stub's first instruction.
|
||||
void emit_code_stub_address(Code* stub);
|
||||
|
||||
// Read/patch instructions
|
||||
Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); }
|
||||
void instr_at_put(int pos, Instr instr) {
|
||||
@ -1820,15 +1817,14 @@ class UseScratchRegisterScope {
|
||||
return reg;
|
||||
}
|
||||
|
||||
// Check if we have registers available to acquire.
|
||||
bool CanAcquire() const { return *assembler_->GetScratchRegisterList() != 0; }
|
||||
bool CanAcquireD() const { return CanAcquireVfp<DwVfpRegister>(); }
|
||||
|
||||
private:
|
||||
friend class Assembler;
|
||||
friend class TurboAssembler;
|
||||
|
||||
// Check if we have registers available to acquire.
|
||||
// These methods are kept private intentionally to restrict their usage to the
|
||||
// assemblers. Choosing to emit a difference instruction sequence depending on
|
||||
// the availability of scratch registers is generally their job.
|
||||
bool CanAcquire() const { return *assembler_->GetScratchRegisterList() != 0; }
|
||||
template <typename T>
|
||||
bool CanAcquireVfp() const;
|
||||
|
||||
|
46
deps/v8/src/arm/code-stubs-arm.cc
vendored
46
deps/v8/src/arm/code-stubs-arm.cc
vendored
@ -141,42 +141,30 @@ void MathPowStub::Generate(MacroAssembler* masm) {
|
||||
const Register scratch2 = r4;
|
||||
|
||||
Label call_runtime, done, int_exponent;
|
||||
if (exponent_type() == TAGGED) {
|
||||
// Base is already in double_base.
|
||||
__ UntagAndJumpIfSmi(scratch, exponent, &int_exponent);
|
||||
|
||||
__ vldr(double_exponent,
|
||||
FieldMemOperand(exponent, HeapNumber::kValueOffset));
|
||||
}
|
||||
|
||||
if (exponent_type() != INTEGER) {
|
||||
// Detect integer exponents stored as double.
|
||||
__ TryDoubleToInt32Exact(scratch, double_exponent, double_scratch);
|
||||
__ b(eq, &int_exponent);
|
||||
|
||||
__ push(lr);
|
||||
{
|
||||
AllowExternalCallThatCantCauseGC scope(masm);
|
||||
__ PrepareCallCFunction(0, 2);
|
||||
__ MovToFloatParameters(double_base, double_exponent);
|
||||
__ CallCFunction(
|
||||
ExternalReference::power_double_double_function(isolate()), 0, 2);
|
||||
}
|
||||
__ pop(lr);
|
||||
__ MovFromFloatResult(double_result);
|
||||
__ b(&done);
|
||||
// Detect integer exponents stored as double.
|
||||
__ TryDoubleToInt32Exact(scratch, double_exponent, double_scratch);
|
||||
__ b(eq, &int_exponent);
|
||||
|
||||
__ push(lr);
|
||||
{
|
||||
AllowExternalCallThatCantCauseGC scope(masm);
|
||||
__ PrepareCallCFunction(0, 2);
|
||||
__ MovToFloatParameters(double_base, double_exponent);
|
||||
__ CallCFunction(ExternalReference::power_double_double_function(isolate()),
|
||||
0, 2);
|
||||
}
|
||||
__ pop(lr);
|
||||
__ MovFromFloatResult(double_result);
|
||||
__ b(&done);
|
||||
|
||||
// Calculate power with integer exponent.
|
||||
__ bind(&int_exponent);
|
||||
|
||||
// Get two copies of exponent in the registers scratch and exponent.
|
||||
if (exponent_type() == INTEGER) {
|
||||
__ mov(scratch, exponent);
|
||||
} else {
|
||||
// Exponent has previously been stored into scratch as untagged integer.
|
||||
__ mov(exponent, scratch);
|
||||
}
|
||||
// Exponent has previously been stored into scratch as untagged integer.
|
||||
__ mov(exponent, scratch);
|
||||
|
||||
__ vmov(double_scratch, double_base); // Back up base.
|
||||
__ vmov(double_result, Double(1.0), scratch2);
|
||||
|
||||
|
1
deps/v8/src/arm/codegen-arm.cc
vendored
1
deps/v8/src/arm/codegen-arm.cc
vendored
@ -9,6 +9,7 @@
|
||||
#include "src/arm/assembler-arm-inl.h"
|
||||
#include "src/arm/simulator-arm.h"
|
||||
#include "src/codegen.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/macro-assembler.h"
|
||||
|
||||
namespace v8 {
|
||||
|
24
deps/v8/src/arm/frame-constants-arm.h
vendored
24
deps/v8/src/arm/frame-constants-arm.h
vendored
@ -10,36 +10,38 @@ namespace internal {
|
||||
|
||||
class EntryFrameConstants : public AllStatic {
|
||||
public:
|
||||
static const int kCallerFPOffset =
|
||||
static constexpr int kCallerFPOffset =
|
||||
-(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
|
||||
};
|
||||
|
||||
class ExitFrameConstants : public TypedFrameConstants {
|
||||
public:
|
||||
static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
|
||||
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
|
||||
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
|
||||
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
|
||||
DEFINE_TYPED_FRAME_SIZES(2);
|
||||
|
||||
// The caller fields are below the frame pointer on the stack.
|
||||
static const int kCallerFPOffset = 0 * kPointerSize;
|
||||
static constexpr int kCallerFPOffset = 0 * kPointerSize;
|
||||
// The calling JS function is below FP.
|
||||
static const int kCallerPCOffset = 1 * kPointerSize;
|
||||
static constexpr int kCallerPCOffset = 1 * kPointerSize;
|
||||
|
||||
// FP-relative displacement of the caller's SP. It points just
|
||||
// below the saved PC.
|
||||
static const int kCallerSPDisplacement = 2 * kPointerSize;
|
||||
static constexpr int kCallerSPDisplacement = 2 * kPointerSize;
|
||||
};
|
||||
|
||||
class JavaScriptFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
|
||||
static const int kLastParameterOffset = +2 * kPointerSize;
|
||||
static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
|
||||
static constexpr int kLocal0Offset =
|
||||
StandardFrameConstants::kExpressionsOffset;
|
||||
static constexpr int kLastParameterOffset = +2 * kPointerSize;
|
||||
static constexpr int kFunctionOffset =
|
||||
StandardFrameConstants::kFunctionOffset;
|
||||
|
||||
// Caller SP-relative.
|
||||
static const int kParam0Offset = -2 * kPointerSize;
|
||||
static const int kReceiverOffset = -1 * kPointerSize;
|
||||
static constexpr int kParam0Offset = -2 * kPointerSize;
|
||||
static constexpr int kReceiverOffset = -1 * kPointerSize;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
47
deps/v8/src/arm/macro-assembler-arm.cc
vendored
47
deps/v8/src/arm/macro-assembler-arm.cc
vendored
@ -1370,30 +1370,15 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
|
||||
void MacroAssembler::CheckDebugHook(Register fun, Register new_target,
|
||||
const ParameterCount& expected,
|
||||
const ParameterCount& actual) {
|
||||
Label skip_hook, call_hook;
|
||||
|
||||
ExternalReference debug_is_active =
|
||||
ExternalReference::debug_is_active_address(isolate());
|
||||
mov(r4, Operand(debug_is_active));
|
||||
ldrsb(r4, MemOperand(r4));
|
||||
cmp(r4, Operand(0));
|
||||
b(eq, &skip_hook);
|
||||
Label skip_hook;
|
||||
|
||||
ExternalReference debug_hook_avtive =
|
||||
ExternalReference::debug_hook_on_function_call_address(isolate());
|
||||
mov(r4, Operand(debug_hook_avtive));
|
||||
ldrsb(r4, MemOperand(r4));
|
||||
cmp(r4, Operand(0));
|
||||
b(ne, &call_hook);
|
||||
|
||||
ldr(r4, FieldMemOperand(fun, JSFunction::kSharedFunctionInfoOffset));
|
||||
ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kDebugInfoOffset));
|
||||
JumpIfSmi(r4, &skip_hook);
|
||||
ldr(r4, FieldMemOperand(r4, DebugInfo::kFlagsOffset));
|
||||
tst(r4, Operand(Smi::FromInt(DebugInfo::kBreakAtEntry)));
|
||||
b(eq, &skip_hook);
|
||||
|
||||
bind(&call_hook);
|
||||
{
|
||||
FrameScope frame(this,
|
||||
has_frame() ? StackFrame::NONE : StackFrame::INTERNAL);
|
||||
@ -1730,12 +1715,20 @@ void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin,
|
||||
Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
void MacroAssembler::JumpToInstructionStream(const InstructionStream* stream) {
|
||||
int32_t bytes_address = reinterpret_cast<int32_t>(stream->bytes());
|
||||
mov(kOffHeapTrampolineRegister, Operand(bytes_address, RelocInfo::NONE));
|
||||
void MacroAssembler::JumpToInstructionStream(Address entry) {
|
||||
mov(kOffHeapTrampolineRegister,
|
||||
Operand(reinterpret_cast<int32_t>(entry), RelocInfo::OFF_HEAP_TARGET));
|
||||
Jump(kOffHeapTrampolineRegister);
|
||||
}
|
||||
|
||||
void MacroAssembler::LoadWeakValue(Register out, Register in,
|
||||
Label* target_if_cleared) {
|
||||
cmp(in, Operand(kClearedWeakHeapObject));
|
||||
b(eq, target_if_cleared);
|
||||
|
||||
and_(out, in, Operand(~kWeakHeapObjectMask));
|
||||
}
|
||||
|
||||
void MacroAssembler::IncrementCounter(StatsCounter* counter, int value,
|
||||
Register scratch1, Register scratch2) {
|
||||
DCHECK_GT(value, 0);
|
||||
@ -1892,6 +1885,20 @@ void MacroAssembler::AssertFixedArray(Register object) {
|
||||
}
|
||||
}
|
||||
|
||||
void MacroAssembler::AssertConstructor(Register object) {
|
||||
if (emit_debug_code()) {
|
||||
STATIC_ASSERT(kSmiTag == 0);
|
||||
tst(object, Operand(kSmiTagMask));
|
||||
Check(ne, AbortReason::kOperandIsASmiAndNotAConstructor);
|
||||
push(object);
|
||||
ldr(object, FieldMemOperand(object, HeapObject::kMapOffset));
|
||||
ldrb(object, FieldMemOperand(object, Map::kBitFieldOffset));
|
||||
tst(object, Operand(Map::IsConstructorBit::kMask));
|
||||
pop(object);
|
||||
Check(ne, AbortReason::kOperandIsNotAConstructor);
|
||||
}
|
||||
}
|
||||
|
||||
void MacroAssembler::AssertFunction(Register object) {
|
||||
if (emit_debug_code()) {
|
||||
STATIC_ASSERT(kSmiTag == 0);
|
||||
@ -1958,7 +1965,7 @@ void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
|
||||
|
||||
|
||||
void TurboAssembler::CheckFor32DRegs(Register scratch) {
|
||||
mov(scratch, Operand(ExternalReference::cpu_features()));
|
||||
mov(scratch, Operand(ExternalReference::cpu_features(isolate())));
|
||||
ldr(scratch, MemOperand(scratch));
|
||||
tst(scratch, Operand(1u << VFP32DREGS));
|
||||
}
|
||||
|
11
deps/v8/src/arm/macro-assembler-arm.h
vendored
11
deps/v8/src/arm/macro-assembler-arm.h
vendored
@ -28,7 +28,7 @@ constexpr Register kInterpreterDispatchTableRegister = r8;
|
||||
constexpr Register kJavaScriptCallArgCountRegister = r0;
|
||||
constexpr Register kJavaScriptCallCodeStartRegister = r2;
|
||||
constexpr Register kJavaScriptCallNewTargetRegister = r3;
|
||||
constexpr Register kOffHeapTrampolineRegister = r4;
|
||||
constexpr Register kOffHeapTrampolineRegister = r6;
|
||||
constexpr Register kRuntimeCallFunctionRegister = r1;
|
||||
constexpr Register kRuntimeCallArgCountRegister = r0;
|
||||
|
||||
@ -799,7 +799,11 @@ class MacroAssembler : public TurboAssembler {
|
||||
bool builtin_exit_frame = false);
|
||||
|
||||
// Generates a trampoline to jump to the off-heap instruction stream.
|
||||
void JumpToInstructionStream(const InstructionStream* stream);
|
||||
void JumpToInstructionStream(Address entry);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// In-place weak references.
|
||||
void LoadWeakValue(Register out, Register in, Label* target_if_cleared);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// StatsCounter support
|
||||
@ -833,6 +837,9 @@ class MacroAssembler : public TurboAssembler {
|
||||
// Abort execution if argument is not a FixedArray, enabled via --debug-code.
|
||||
void AssertFixedArray(Register object);
|
||||
|
||||
// Abort execution if argument is not a Constructor, enabled via --debug-code.
|
||||
void AssertConstructor(Register object);
|
||||
|
||||
// Abort execution if argument is not a JSFunction, enabled via --debug-code.
|
||||
void AssertFunction(Register object);
|
||||
|
||||
|
22
deps/v8/src/arm64/assembler-arm64-inl.h
vendored
22
deps/v8/src/arm64/assembler-arm64-inl.h
vendored
@ -613,7 +613,8 @@ Address RelocInfo::target_address() {
|
||||
|
||||
Address RelocInfo::target_address_address() {
|
||||
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_) ||
|
||||
rmode_ == EMBEDDED_OBJECT || rmode_ == EXTERNAL_REFERENCE);
|
||||
IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) ||
|
||||
IsOffHeapTarget(rmode_));
|
||||
return Assembler::target_pointer_address_at(pc_);
|
||||
}
|
||||
|
||||
@ -655,6 +656,12 @@ Address RelocInfo::target_external_reference() {
|
||||
return Assembler::target_address_at(pc_, constant_pool_);
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_external_reference(
|
||||
Address target, ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(rmode_ == RelocInfo::EXTERNAL_REFERENCE);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, target,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::target_internal_reference() {
|
||||
DCHECK(rmode_ == INTERNAL_REFERENCE);
|
||||
@ -667,6 +674,12 @@ Address RelocInfo::target_internal_reference_address() {
|
||||
return reinterpret_cast<Address>(pc_);
|
||||
}
|
||||
|
||||
void RelocInfo::set_wasm_code_table_entry(Address target,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(rmode_ == RelocInfo::WASM_CODE_TABLE_ENTRY);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, target,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::target_runtime_entry(Assembler* origin) {
|
||||
DCHECK(IsRuntimeEntry(rmode_));
|
||||
@ -682,6 +695,11 @@ void RelocInfo::set_target_runtime_entry(Address target,
|
||||
}
|
||||
}
|
||||
|
||||
Address RelocInfo::target_off_heap_target() {
|
||||
DCHECK(IsOffHeapTarget(rmode_));
|
||||
return Assembler::target_address_at(pc_, constant_pool_);
|
||||
}
|
||||
|
||||
void RelocInfo::WipeOut() {
|
||||
DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
|
||||
IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
|
||||
@ -706,6 +724,8 @@ void RelocInfo::Visit(ObjectVisitor* visitor) {
|
||||
visitor->VisitInternalReference(host(), this);
|
||||
} else if (RelocInfo::IsRuntimeEntry(mode)) {
|
||||
visitor->VisitRuntimeEntry(host(), this);
|
||||
} else if (RelocInfo::IsOffHeapTarget(mode)) {
|
||||
visitor->VisitOffHeapTarget(host(), this);
|
||||
}
|
||||
}
|
||||
|
||||
|
3
deps/v8/src/arm64/assembler-arm64.cc
vendored
3
deps/v8/src/arm64/assembler-arm64.cc
vendored
@ -1749,7 +1749,6 @@ void Assembler::stlr(const Register& rt, const Register& rn) {
|
||||
|
||||
void Assembler::stlxr(const Register& rs, const Register& rt,
|
||||
const Register& rn) {
|
||||
DCHECK(rs.Is32Bits());
|
||||
DCHECK(rn.Is64Bits());
|
||||
DCHECK(!rs.Is(rt) && !rs.Is(rn));
|
||||
LoadStoreAcquireReleaseOp op = rt.Is32Bits() ? STLXR_w : STLXR_x;
|
||||
@ -4698,7 +4697,7 @@ void Assembler::GrowBuffer() {
|
||||
// Some internal data structures overflow for very large buffers,
|
||||
// they must ensure that kMaximalBufferSize is not too large.
|
||||
if (desc.buffer_size > kMaximalBufferSize) {
|
||||
V8::FatalProcessOutOfMemory("Assembler::GrowBuffer");
|
||||
V8::FatalProcessOutOfMemory(nullptr, "Assembler::GrowBuffer");
|
||||
}
|
||||
|
||||
byte* buffer = reinterpret_cast<byte*>(buffer_);
|
||||
|
53
deps/v8/src/arm64/assembler-arm64.h
vendored
53
deps/v8/src/arm64/assembler-arm64.h
vendored
@ -39,8 +39,8 @@ namespace internal {
|
||||
#define ALLOCATABLE_GENERAL_REGISTERS(R) \
|
||||
R(x0) R(x1) R(x2) R(x3) R(x4) R(x5) R(x6) R(x7) \
|
||||
R(x8) R(x9) R(x10) R(x11) R(x12) R(x13) R(x14) R(x15) \
|
||||
R(x18) R(x19) R(x20) R(x21) R(x22) R(x23) R(x24) R(x27) \
|
||||
R(x28)
|
||||
R(x18) R(x19) R(x20) R(x21) R(x22) R(x23) R(x24) R(x25) \
|
||||
R(x27) R(x28)
|
||||
|
||||
#define FLOAT_REGISTERS(V) \
|
||||
V(s0) V(s1) V(s2) V(s3) V(s4) V(s5) V(s6) V(s7) \
|
||||
@ -60,6 +60,8 @@ namespace internal {
|
||||
V(q16) V(q17) V(q18) V(q19) V(q20) V(q21) V(q22) V(q23) \
|
||||
V(q24) V(q25) V(q26) V(q27) V(q28) V(q29) V(q30) V(q31)
|
||||
|
||||
// Register d29 could be allocated, but we keep an even length list here, in
|
||||
// order to make stack alignment easier for save and restore.
|
||||
#define ALLOCATABLE_DOUBLE_REGISTERS(R) \
|
||||
R(d0) R(d1) R(d2) R(d3) R(d4) R(d5) R(d6) R(d7) \
|
||||
R(d8) R(d9) R(d10) R(d11) R(d12) R(d13) R(d14) R(d16) \
|
||||
@ -202,7 +204,6 @@ class CPURegister : public RegisterBase<CPURegister, kRegAfterLast> {
|
||||
|
||||
bool IsSameSizeAndType(const CPURegister& other) const;
|
||||
|
||||
// V8 compatibility.
|
||||
bool is(const CPURegister& other) const { return Is(other); }
|
||||
bool is_valid() const { return IsValid(); }
|
||||
|
||||
@ -237,8 +238,7 @@ class CPURegister : public RegisterBase<CPURegister, kRegAfterLast> {
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(IS_TRIVIALLY_COPYABLE(CPURegister),
|
||||
"CPURegister can efficiently be passed by value");
|
||||
ASSERT_TRIVIALLY_COPYABLE(CPURegister);
|
||||
|
||||
class Register : public CPURegister {
|
||||
public:
|
||||
@ -256,25 +256,6 @@ class Register : public CPURegister {
|
||||
static Register XRegFromCode(unsigned code);
|
||||
static Register WRegFromCode(unsigned code);
|
||||
|
||||
// Start of V8 compatibility section ---------------------
|
||||
// These memebers are necessary for compilation.
|
||||
// A few of them may be unused for now.
|
||||
|
||||
// We allow crankshaft to use the following registers:
|
||||
// - x0 to x15
|
||||
// - x18 to x24
|
||||
// - x27 (also context)
|
||||
//
|
||||
// TODO(all): Register x25 is currently free and could be available for
|
||||
// crankshaft, but we don't use it as we might use it as a per function
|
||||
// literal pool pointer in the future.
|
||||
//
|
||||
// TODO(all): Consider storing cp in x25 to have only two ranges.
|
||||
// We split allocatable registers in three ranges called
|
||||
// - "low range"
|
||||
// - "high range"
|
||||
// - "context"
|
||||
|
||||
static Register from_code(int code) {
|
||||
// Always return an X register.
|
||||
return Register::Create(code, kXRegSizeInBits);
|
||||
@ -286,14 +267,11 @@ class Register : public CPURegister {
|
||||
return Register::Create<code, kXRegSizeInBits>();
|
||||
}
|
||||
|
||||
// End of V8 compatibility section -----------------------
|
||||
//
|
||||
private:
|
||||
constexpr explicit Register(const CPURegister& r) : CPURegister(r) {}
|
||||
};
|
||||
|
||||
static_assert(IS_TRIVIALLY_COPYABLE(Register),
|
||||
"Register can efficiently be passed by value");
|
||||
ASSERT_TRIVIALLY_COPYABLE(Register);
|
||||
|
||||
constexpr bool kPadArguments = true;
|
||||
constexpr bool kSimpleFPAliasing = true;
|
||||
@ -405,19 +383,13 @@ class VRegister : public CPURegister {
|
||||
|
||||
unsigned LaneSizeInBits() const { return LaneSizeInBytes() * 8; }
|
||||
|
||||
// Start of V8 compatibility section ---------------------
|
||||
static constexpr int kMaxNumRegisters = kNumberOfVRegisters;
|
||||
STATIC_ASSERT(kMaxNumRegisters == kDoubleAfterLast);
|
||||
|
||||
// Crankshaft can use all the V registers except:
|
||||
// - d15 which is used to keep the 0 double value
|
||||
// - d30 which is used in crankshaft as a double scratch register
|
||||
// - d31 which is used in the MacroAssembler as a double scratch register
|
||||
static VRegister from_code(int code) {
|
||||
// Always return a D register.
|
||||
return VRegister::Create(code, kDRegSizeInBits);
|
||||
}
|
||||
// End of V8 compatibility section -----------------------
|
||||
|
||||
private:
|
||||
int lane_count_;
|
||||
@ -430,8 +402,7 @@ class VRegister : public CPURegister {
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(IS_TRIVIALLY_COPYABLE(VRegister),
|
||||
"VRegister can efficiently be passed by value");
|
||||
ASSERT_TRIVIALLY_COPYABLE(VRegister);
|
||||
|
||||
// No*Reg is used to indicate an unused argument, or an error case. Note that
|
||||
// these all compare equal (using the Is() method). The Register and VRegister
|
||||
@ -439,8 +410,6 @@ static_assert(IS_TRIVIALLY_COPYABLE(VRegister),
|
||||
constexpr Register NoReg = Register::no_reg();
|
||||
constexpr VRegister NoVReg = VRegister::no_reg();
|
||||
constexpr CPURegister NoCPUReg = CPURegister::no_reg();
|
||||
|
||||
// v8 compatibility.
|
||||
constexpr Register no_reg = NoReg;
|
||||
|
||||
#define DEFINE_REGISTER(register_class, name, ...) \
|
||||
@ -491,11 +460,9 @@ ALIAS_REGISTER(Register, padreg, x31);
|
||||
// Keeps the 0 double value.
|
||||
ALIAS_REGISTER(VRegister, fp_zero, d15);
|
||||
// MacroAssembler fixed V Registers.
|
||||
ALIAS_REGISTER(VRegister, fp_fixed1, d27);
|
||||
ALIAS_REGISTER(VRegister, fp_fixed2, d28);
|
||||
ALIAS_REGISTER(VRegister, fp_fixed3, d29); // same as Crankshaft scratch.
|
||||
// Crankshaft double scratch register.
|
||||
ALIAS_REGISTER(VRegister, crankshaft_fp_scratch, d29);
|
||||
ALIAS_REGISTER(VRegister, fp_fixed1, d28);
|
||||
ALIAS_REGISTER(VRegister, fp_fixed2, d29);
|
||||
|
||||
// MacroAssembler scratch V registers.
|
||||
ALIAS_REGISTER(VRegister, fp_scratch, d30);
|
||||
ALIAS_REGISTER(VRegister, fp_scratch1, d30);
|
||||
|
43
deps/v8/src/arm64/code-stubs-arm64.cc
vendored
43
deps/v8/src/arm64/code-stubs-arm64.cc
vendored
@ -122,36 +122,29 @@ void MathPowStub::Generate(MacroAssembler* masm) {
|
||||
Label done;
|
||||
|
||||
// Unpack the inputs.
|
||||
if (exponent_type() == TAGGED) {
|
||||
__ JumpIfSmi(exponent_tagged, &exponent_is_smi);
|
||||
__ Ldr(exponent_double,
|
||||
FieldMemOperand(exponent_tagged, HeapNumber::kValueOffset));
|
||||
}
|
||||
|
||||
// Handle double (heap number) exponents.
|
||||
if (exponent_type() != INTEGER) {
|
||||
// Detect integer exponents stored as doubles and handle those in the
|
||||
// integer fast-path.
|
||||
__ TryRepresentDoubleAsInt64(exponent_integer, exponent_double,
|
||||
scratch0_double, &exponent_is_integer);
|
||||
// Detect integer exponents stored as doubles and handle those in the
|
||||
// integer fast-path.
|
||||
__ TryRepresentDoubleAsInt64(exponent_integer, exponent_double,
|
||||
scratch0_double, &exponent_is_integer);
|
||||
|
||||
{
|
||||
AllowExternalCallThatCantCauseGC scope(masm);
|
||||
__ Mov(saved_lr, lr);
|
||||
__ CallCFunction(
|
||||
ExternalReference::power_double_double_function(isolate()), 0, 2);
|
||||
__ Mov(lr, saved_lr);
|
||||
__ B(&done);
|
||||
}
|
||||
|
||||
// Handle SMI exponents.
|
||||
__ Bind(&exponent_is_smi);
|
||||
// x10 base_tagged The tagged base (input).
|
||||
// x11 exponent_tagged The tagged exponent (input).
|
||||
// d1 base_double The base as a double.
|
||||
__ SmiUntag(exponent_integer, exponent_tagged);
|
||||
{
|
||||
AllowExternalCallThatCantCauseGC scope(masm);
|
||||
__ Mov(saved_lr, lr);
|
||||
__ CallCFunction(ExternalReference::power_double_double_function(isolate()),
|
||||
0, 2);
|
||||
__ Mov(lr, saved_lr);
|
||||
__ B(&done);
|
||||
}
|
||||
|
||||
// Handle SMI exponents.
|
||||
__ Bind(&exponent_is_smi);
|
||||
// x10 base_tagged The tagged base (input).
|
||||
// x11 exponent_tagged The tagged exponent (input).
|
||||
// d1 base_double The base as a double.
|
||||
__ SmiUntag(exponent_integer, exponent_tagged);
|
||||
|
||||
__ Bind(&exponent_is_integer);
|
||||
// x10 base_tagged The tagged base (input).
|
||||
// x11 exponent_tagged The tagged exponent (input).
|
||||
|
1
deps/v8/src/arm64/codegen-arm64.cc
vendored
1
deps/v8/src/arm64/codegen-arm64.cc
vendored
@ -8,6 +8,7 @@
|
||||
#include "src/arm64/macro-assembler-arm64-inl.h"
|
||||
#include "src/arm64/simulator-arm64.h"
|
||||
#include "src/codegen.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/macro-assembler.h"
|
||||
|
||||
namespace v8 {
|
||||
|
22
deps/v8/src/arm64/frame-constants-arm64.h
vendored
22
deps/v8/src/arm64/frame-constants-arm64.h
vendored
@ -31,31 +31,33 @@ namespace internal {
|
||||
//
|
||||
class EntryFrameConstants : public AllStatic {
|
||||
public:
|
||||
static const int kCallerFPOffset = -3 * kPointerSize;
|
||||
static const int kFixedFrameSize = 6 * kPointerSize;
|
||||
static constexpr int kCallerFPOffset = -3 * kPointerSize;
|
||||
static constexpr int kFixedFrameSize = 6 * kPointerSize;
|
||||
};
|
||||
|
||||
class ExitFrameConstants : public TypedFrameConstants {
|
||||
public:
|
||||
static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
|
||||
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
|
||||
static const int kPaddingOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
|
||||
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
|
||||
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
|
||||
static constexpr int kPaddingOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
|
||||
DEFINE_TYPED_FRAME_SIZES(3);
|
||||
static const int kLastExitFrameField = kPaddingOffset;
|
||||
static constexpr int kLastExitFrameField = kPaddingOffset;
|
||||
|
||||
static const int kConstantPoolOffset = 0; // Not used
|
||||
static constexpr int kConstantPoolOffset = 0; // Not used
|
||||
};
|
||||
|
||||
class JavaScriptFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
|
||||
static constexpr int kLocal0Offset =
|
||||
StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
// There are two words on the stack (saved fp and saved lr) between fp and
|
||||
// the arguments.
|
||||
static const int kLastParameterOffset = 2 * kPointerSize;
|
||||
static constexpr int kLastParameterOffset = 2 * kPointerSize;
|
||||
|
||||
static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
|
||||
static constexpr int kFunctionOffset =
|
||||
StandardFrameConstants::kFunctionOffset;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
45
deps/v8/src/arm64/macro-assembler-arm64.cc
vendored
45
deps/v8/src/arm64/macro-assembler-arm64.cc
vendored
@ -1625,6 +1625,21 @@ void MacroAssembler::AssertFixedArray(Register object) {
|
||||
}
|
||||
}
|
||||
|
||||
void MacroAssembler::AssertConstructor(Register object) {
|
||||
if (emit_debug_code()) {
|
||||
AssertNotSmi(object, AbortReason::kOperandIsASmiAndNotAConstructor);
|
||||
|
||||
UseScratchRegisterScope temps(this);
|
||||
Register temp = temps.AcquireX();
|
||||
|
||||
Ldr(temp, FieldMemOperand(object, HeapObject::kMapOffset));
|
||||
Ldrb(temp, FieldMemOperand(temp, Map::kBitFieldOffset));
|
||||
Tst(temp, Operand(Map::IsConstructorBit::kMask));
|
||||
|
||||
Check(ne, AbortReason::kOperandIsNotAConstructor);
|
||||
}
|
||||
}
|
||||
|
||||
void MacroAssembler::AssertFunction(Register object) {
|
||||
if (emit_debug_code()) {
|
||||
AssertNotSmi(object, AbortReason::kOperandIsASmiAndNotAFunction);
|
||||
@ -1759,9 +1774,9 @@ void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin,
|
||||
Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
void MacroAssembler::JumpToInstructionStream(const InstructionStream* stream) {
|
||||
uint64_t bytes_address = reinterpret_cast<uint64_t>(stream->bytes());
|
||||
Mov(kOffHeapTrampolineRegister, bytes_address);
|
||||
void MacroAssembler::JumpToInstructionStream(Address entry) {
|
||||
Mov(kOffHeapTrampolineRegister,
|
||||
Operand(reinterpret_cast<uint64_t>(entry), RelocInfo::OFF_HEAP_TARGET));
|
||||
Br(kOffHeapTrampolineRegister);
|
||||
}
|
||||
|
||||
@ -2144,28 +2159,14 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
|
||||
void MacroAssembler::CheckDebugHook(Register fun, Register new_target,
|
||||
const ParameterCount& expected,
|
||||
const ParameterCount& actual) {
|
||||
Label skip_hook, call_hook;
|
||||
|
||||
ExternalReference debug_is_active =
|
||||
ExternalReference::debug_is_active_address(isolate());
|
||||
Mov(x4, Operand(debug_is_active));
|
||||
Ldrsb(x4, MemOperand(x4));
|
||||
Cbz(x4, &skip_hook);
|
||||
Label skip_hook;
|
||||
|
||||
ExternalReference debug_hook_active =
|
||||
ExternalReference::debug_hook_on_function_call_address(isolate());
|
||||
Mov(x4, Operand(debug_hook_active));
|
||||
Ldrsb(x4, MemOperand(x4));
|
||||
Cbnz(x4, &call_hook);
|
||||
Cbz(x4, &skip_hook);
|
||||
|
||||
Ldr(x4, FieldMemOperand(fun, JSFunction::kSharedFunctionInfoOffset));
|
||||
Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kDebugInfoOffset));
|
||||
JumpIfSmi(x4, &skip_hook);
|
||||
Ldr(x4, FieldMemOperand(x4, DebugInfo::kFlagsOffset));
|
||||
Tst(x4, Operand(Smi::FromInt(DebugInfo::kBreakAtEntry)));
|
||||
B(eq, &skip_hook);
|
||||
|
||||
bind(&call_hook);
|
||||
{
|
||||
FrameScope frame(this,
|
||||
has_frame() ? StackFrame::NONE : StackFrame::INTERNAL);
|
||||
@ -2503,6 +2504,12 @@ void MacroAssembler::LeaveExitFrame(bool restore_doubles,
|
||||
Pop(fp, lr);
|
||||
}
|
||||
|
||||
void MacroAssembler::LoadWeakValue(Register out, Register in,
|
||||
Label* target_if_cleared) {
|
||||
CompareAndBranch(in, Operand(kClearedWeakHeapObject), eq, target_if_cleared);
|
||||
|
||||
and_(out, in, Operand(~kWeakHeapObjectMask));
|
||||
}
|
||||
|
||||
void MacroAssembler::IncrementCounter(StatsCounter* counter, int value,
|
||||
Register scratch1, Register scratch2) {
|
||||
|
9
deps/v8/src/arm64/macro-assembler-arm64.h
vendored
9
deps/v8/src/arm64/macro-assembler-arm64.h
vendored
@ -1713,6 +1713,9 @@ class MacroAssembler : public TurboAssembler {
|
||||
// Abort execution if argument is not a FixedArray, enabled via --debug-code.
|
||||
void AssertFixedArray(Register object);
|
||||
|
||||
// Abort execution if argument is not a Constructor, enabled via --debug-code.
|
||||
void AssertConstructor(Register object);
|
||||
|
||||
// Abort execution if argument is not a JSFunction, enabled via --debug-code.
|
||||
void AssertFunction(Register object);
|
||||
|
||||
@ -1771,7 +1774,7 @@ class MacroAssembler : public TurboAssembler {
|
||||
bool builtin_exit_frame = false);
|
||||
|
||||
// Generates a trampoline to jump to the off-heap instruction stream.
|
||||
void JumpToInstructionStream(const InstructionStream* stream);
|
||||
void JumpToInstructionStream(Address entry);
|
||||
|
||||
// Registers used through the invocation chain are hard-coded.
|
||||
// We force passing the parameters to ensure the contracts are correctly
|
||||
@ -1921,6 +1924,10 @@ class MacroAssembler : public TurboAssembler {
|
||||
LoadNativeContextSlot(Context::GLOBAL_PROXY_INDEX, dst);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// In-place weak references.
|
||||
void LoadWeakValue(Register out, Register in, Label* target_if_cleared);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// StatsCounter support
|
||||
|
||||
|
12
deps/v8/src/arm64/simulator-arm64.cc
vendored
12
deps/v8/src/arm64/simulator-arm64.cc
vendored
@ -2083,6 +2083,8 @@ Simulator::TransactionSize Simulator::get_transaction_size(unsigned size) {
|
||||
return TransactionSize::HalfWord;
|
||||
case 4:
|
||||
return TransactionSize::Word;
|
||||
case 8:
|
||||
return TransactionSize::DoubleWord;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -2127,6 +2129,10 @@ void Simulator::VisitLoadStoreAcquireRelease(Instruction* instr) {
|
||||
case LDAXR_w:
|
||||
set_wreg_no_log(rt, MemoryRead<uint32_t>(address));
|
||||
break;
|
||||
case LDAR_x:
|
||||
case LDAXR_x:
|
||||
set_xreg_no_log(rt, MemoryRead<uint64_t>(address));
|
||||
break;
|
||||
default:
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
@ -2150,6 +2156,9 @@ void Simulator::VisitLoadStoreAcquireRelease(Instruction* instr) {
|
||||
case STLXR_w:
|
||||
MemoryWrite<uint32_t>(address, wreg(rt));
|
||||
break;
|
||||
case STLXR_x:
|
||||
MemoryWrite<uint64_t>(address, xreg(rt));
|
||||
break;
|
||||
default:
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
@ -2171,6 +2180,9 @@ void Simulator::VisitLoadStoreAcquireRelease(Instruction* instr) {
|
||||
case STLR_w:
|
||||
MemoryWrite<uint32_t>(address, wreg(rt));
|
||||
break;
|
||||
case STLR_x:
|
||||
MemoryWrite<uint64_t>(address, xreg(rt));
|
||||
break;
|
||||
default:
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
1
deps/v8/src/arm64/simulator-arm64.h
vendored
1
deps/v8/src/arm64/simulator-arm64.h
vendored
@ -2196,6 +2196,7 @@ class Simulator : public DecoderVisitor, public SimulatorBase {
|
||||
Byte = 1,
|
||||
HalfWord = 2,
|
||||
Word = 4,
|
||||
DoubleWord = 8,
|
||||
};
|
||||
|
||||
TransactionSize get_transaction_size(unsigned size);
|
||||
|
64
deps/v8/src/asmjs/asm-js.cc
vendored
64
deps/v8/src/asmjs/asm-js.cc
vendored
@ -10,16 +10,16 @@
|
||||
#include "src/ast/ast.h"
|
||||
#include "src/base/optional.h"
|
||||
#include "src/base/platform/elapsed-timer.h"
|
||||
#include "src/compilation-info.h"
|
||||
#include "src/compiler.h"
|
||||
#include "src/execution.h"
|
||||
#include "src/factory.h"
|
||||
#include "src/handles.h"
|
||||
#include "src/heap/factory.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/parsing/parse-info.h"
|
||||
#include "src/parsing/scanner-character-streams.h"
|
||||
#include "src/parsing/scanner.h"
|
||||
#include "src/unoptimized-compilation-info.h"
|
||||
|
||||
#include "src/wasm/wasm-engine.h"
|
||||
#include "src/wasm/wasm-js.h"
|
||||
@ -65,21 +65,20 @@ bool AreStdlibMembersValid(Isolate* isolate, Handle<JSReceiver> stdlib,
|
||||
Handle<Object> value = JSReceiver::GetDataProperty(stdlib, name);
|
||||
if (!value->IsNaN()) return false;
|
||||
}
|
||||
#define STDLIB_MATH_FUNC(fname, FName, ignore1, ignore2) \
|
||||
if (members.Contains(wasm::AsmJsParser::StandardMember::kMath##FName)) { \
|
||||
members.Remove(wasm::AsmJsParser::StandardMember::kMath##FName); \
|
||||
Handle<Name> name(isolate->factory()->InternalizeOneByteString( \
|
||||
STATIC_CHAR_VECTOR(#fname))); \
|
||||
Handle<Object> value = StdlibMathMember(isolate, stdlib, name); \
|
||||
if (!value->IsJSFunction()) return false; \
|
||||
SharedFunctionInfo* shared = Handle<JSFunction>::cast(value)->shared(); \
|
||||
if (shared->HasLazyDeserializationBuiltinId()) { \
|
||||
if (shared->lazy_deserialization_builtin_id() != Builtins::kMath##FName) \
|
||||
return false; \
|
||||
} else if (shared->code() != \
|
||||
isolate->builtins()->builtin(Builtins::kMath##FName)) { \
|
||||
return false; \
|
||||
} \
|
||||
#define STDLIB_MATH_FUNC(fname, FName, ignore1, ignore2) \
|
||||
if (members.Contains(wasm::AsmJsParser::StandardMember::kMath##FName)) { \
|
||||
members.Remove(wasm::AsmJsParser::StandardMember::kMath##FName); \
|
||||
Handle<Name> name(isolate->factory()->InternalizeOneByteString( \
|
||||
STATIC_CHAR_VECTOR(#fname))); \
|
||||
Handle<Object> value = StdlibMathMember(isolate, stdlib, name); \
|
||||
if (!value->IsJSFunction()) return false; \
|
||||
SharedFunctionInfo* shared = Handle<JSFunction>::cast(value)->shared(); \
|
||||
if (!shared->HasBuiltinId() || \
|
||||
shared->builtin_id() != Builtins::kMath##FName) { \
|
||||
return false; \
|
||||
} \
|
||||
DCHECK_EQ(shared->GetCode(), \
|
||||
isolate->builtins()->builtin(Builtins::kMath##FName)); \
|
||||
}
|
||||
STDLIB_MATH_FUNCTION_LIST(STDLIB_MATH_FUNC)
|
||||
#undef STDLIB_MATH_FUNC
|
||||
@ -185,12 +184,12 @@ void ReportInstantiationFailure(Handle<Script> script, int position,
|
||||
// [2] FinalizeJobImpl: The module is handed to WebAssembly which decodes it
|
||||
// into an internal representation and eventually compiles it to machine
|
||||
// code.
|
||||
class AsmJsCompilationJob final : public CompilationJob {
|
||||
class AsmJsCompilationJob final : public UnoptimizedCompilationJob {
|
||||
public:
|
||||
explicit AsmJsCompilationJob(ParseInfo* parse_info, FunctionLiteral* literal,
|
||||
AccountingAllocator* allocator)
|
||||
: CompilationJob(parse_info->stack_limit(), parse_info,
|
||||
&compilation_info_, "AsmJs", State::kReadyToExecute),
|
||||
: UnoptimizedCompilationJob(parse_info->stack_limit(), parse_info,
|
||||
&compilation_info_),
|
||||
allocator_(allocator),
|
||||
zone_(allocator, ZONE_NAME),
|
||||
compilation_info_(&zone_, parse_info, literal),
|
||||
@ -203,16 +202,16 @@ class AsmJsCompilationJob final : public CompilationJob {
|
||||
translate_zone_size_(0) {}
|
||||
|
||||
protected:
|
||||
Status PrepareJobImpl(Isolate* isolate) final;
|
||||
Status ExecuteJobImpl() final;
|
||||
Status FinalizeJobImpl(Isolate* isolate) final;
|
||||
Status FinalizeJobImpl(Handle<SharedFunctionInfo> shared_info,
|
||||
Isolate* isolate) final;
|
||||
|
||||
private:
|
||||
void RecordHistograms(Isolate* isolate);
|
||||
|
||||
AccountingAllocator* allocator_;
|
||||
Zone zone_;
|
||||
CompilationInfo compilation_info_;
|
||||
UnoptimizedCompilationInfo compilation_info_;
|
||||
wasm::ZoneBuffer* module_;
|
||||
wasm::ZoneBuffer* asm_offsets_;
|
||||
wasm::AsmJsParser::StdlibSet stdlib_uses_;
|
||||
@ -226,12 +225,7 @@ class AsmJsCompilationJob final : public CompilationJob {
|
||||
DISALLOW_COPY_AND_ASSIGN(AsmJsCompilationJob);
|
||||
};
|
||||
|
||||
CompilationJob::Status AsmJsCompilationJob::PrepareJobImpl(Isolate* isolate) {
|
||||
UNREACHABLE(); // Prepare should always be skipped.
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
CompilationJob::Status AsmJsCompilationJob::ExecuteJobImpl() {
|
||||
UnoptimizedCompilationJob::Status AsmJsCompilationJob::ExecuteJobImpl() {
|
||||
// Step 1: Translate asm.js module to WebAssembly module.
|
||||
size_t compile_zone_start = compilation_info()->zone()->allocation_size();
|
||||
base::ElapsedTimer translate_timer;
|
||||
@ -276,7 +270,8 @@ CompilationJob::Status AsmJsCompilationJob::ExecuteJobImpl() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
CompilationJob::Status AsmJsCompilationJob::FinalizeJobImpl(Isolate* isolate) {
|
||||
UnoptimizedCompilationJob::Status AsmJsCompilationJob::FinalizeJobImpl(
|
||||
Handle<SharedFunctionInfo> shared_info, Isolate* isolate) {
|
||||
// Step 2: Compile and decode the WebAssembly module.
|
||||
base::ElapsedTimer compile_timer;
|
||||
compile_timer.Start();
|
||||
@ -302,7 +297,6 @@ CompilationJob::Status AsmJsCompilationJob::FinalizeJobImpl(Isolate* isolate) {
|
||||
result->set(kWasmDataCompiledModule, *compiled);
|
||||
result->set(kWasmDataUsesBitSet, *uses_bitset);
|
||||
compilation_info()->SetAsmWasmData(result);
|
||||
compilation_info()->SetCode(BUILTIN_CODE(isolate, InstantiateAsmJs));
|
||||
|
||||
RecordHistograms(isolate);
|
||||
ReportCompilationSuccess(parse_info()->script(),
|
||||
@ -329,9 +323,9 @@ void AsmJsCompilationJob::RecordHistograms(Isolate* isolate) {
|
||||
translation_throughput);
|
||||
}
|
||||
|
||||
CompilationJob* AsmJs::NewCompilationJob(ParseInfo* parse_info,
|
||||
FunctionLiteral* literal,
|
||||
AccountingAllocator* allocator) {
|
||||
UnoptimizedCompilationJob* AsmJs::NewCompilationJob(
|
||||
ParseInfo* parse_info, FunctionLiteral* literal,
|
||||
AccountingAllocator* allocator) {
|
||||
return new AsmJsCompilationJob(parse_info, literal, allocator);
|
||||
}
|
||||
|
||||
@ -350,7 +344,7 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(Isolate* isolate,
|
||||
Handle<Script> script(Script::cast(shared->script()));
|
||||
// TODO(mstarzinger): The position currently points to the module definition
|
||||
// but should instead point to the instantiation site (more intuitive).
|
||||
int position = shared->start_position();
|
||||
int position = shared->StartPosition();
|
||||
|
||||
// Check that all used stdlib members are valid.
|
||||
bool stdlib_use_of_typed_array_present = false;
|
||||
|
9
deps/v8/src/asmjs/asm-js.h
vendored
9
deps/v8/src/asmjs/asm-js.h
vendored
@ -13,19 +13,18 @@ namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
class AccountingAllocator;
|
||||
class CompilationInfo;
|
||||
class CompilationJob;
|
||||
class FunctionLiteral;
|
||||
class JSArrayBuffer;
|
||||
class ParseInfo;
|
||||
class SharedFunctionInfo;
|
||||
class UnoptimizedCompilationJob;
|
||||
|
||||
// Interface to compile and instantiate for asm.js modules.
|
||||
class AsmJs {
|
||||
public:
|
||||
static CompilationJob* NewCompilationJob(ParseInfo* parse_info,
|
||||
FunctionLiteral* literal,
|
||||
AccountingAllocator* allocator);
|
||||
static UnoptimizedCompilationJob* NewCompilationJob(
|
||||
ParseInfo* parse_info, FunctionLiteral* literal,
|
||||
AccountingAllocator* allocator);
|
||||
static MaybeHandle<Object> InstantiateAsmWasm(Isolate* isolate,
|
||||
Handle<SharedFunctionInfo>,
|
||||
Handle<FixedArray> wasm_data,
|
||||
|
1039
deps/v8/src/assembler.cc
vendored
1039
deps/v8/src/assembler.cc
vendored
File diff suppressed because it is too large
Load Diff
413
deps/v8/src/assembler.h
vendored
413
deps/v8/src/assembler.h
vendored
@ -37,17 +37,19 @@
|
||||
|
||||
#include <forward_list>
|
||||
#include <iosfwd>
|
||||
#include <map>
|
||||
|
||||
#include "src/allocation.h"
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/contexts.h"
|
||||
#include "src/deoptimize-reason.h"
|
||||
#include "src/double.h"
|
||||
#include "src/external-reference.h"
|
||||
#include "src/flags.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/label.h"
|
||||
#include "src/log.h"
|
||||
#include "src/objects.h"
|
||||
#include "src/register-configuration.h"
|
||||
#include "src/reglist.h"
|
||||
#include "src/runtime/runtime.h"
|
||||
|
||||
namespace v8 {
|
||||
|
||||
@ -364,11 +366,6 @@ class RelocInfo {
|
||||
// Please note the order is important (see IsCodeTarget, IsGCRelocMode).
|
||||
CODE_TARGET,
|
||||
EMBEDDED_OBJECT,
|
||||
// Wasm entries are to relocate pointers into the wasm memory embedded in
|
||||
// wasm code. Everything after WASM_CONTEXT_REFERENCE (inclusive) is not
|
||||
// GC'ed.
|
||||
WASM_CONTEXT_REFERENCE,
|
||||
WASM_FUNCTION_TABLE_SIZE_REFERENCE,
|
||||
WASM_GLOBAL_HANDLE,
|
||||
WASM_CALL,
|
||||
JS_TO_WASM_CALL,
|
||||
@ -382,6 +379,9 @@ class RelocInfo {
|
||||
// Encoded internal reference, used only on MIPS, MIPS64 and PPC.
|
||||
INTERNAL_REFERENCE_ENCODED,
|
||||
|
||||
// An off-heap instruction stream target. See http://goo.gl/Z2HUiM.
|
||||
OFF_HEAP_TARGET,
|
||||
|
||||
// Marks constant and veneer pools. Only used on ARM and ARM64.
|
||||
// They use a custom noncompact encoding.
|
||||
CONST_POOL,
|
||||
@ -396,6 +396,9 @@ class RelocInfo {
|
||||
// cannot be encoded as part of another record.
|
||||
PC_JUMP,
|
||||
|
||||
// Points to a wasm code table entry.
|
||||
WASM_CODE_TABLE_ENTRY,
|
||||
|
||||
// Pseudo-types
|
||||
NUMBER_OF_MODES,
|
||||
NONE, // never recorded value
|
||||
@ -458,22 +461,16 @@ class RelocInfo {
|
||||
static inline bool IsInternalReferenceEncoded(Mode mode) {
|
||||
return mode == INTERNAL_REFERENCE_ENCODED;
|
||||
}
|
||||
static inline bool IsOffHeapTarget(Mode mode) {
|
||||
return mode == OFF_HEAP_TARGET;
|
||||
}
|
||||
static inline bool IsNone(Mode mode) { return mode == NONE; }
|
||||
static inline bool IsWasmContextReference(Mode mode) {
|
||||
return mode == WASM_CONTEXT_REFERENCE;
|
||||
}
|
||||
static inline bool IsWasmFunctionTableSizeReference(Mode mode) {
|
||||
return mode == WASM_FUNCTION_TABLE_SIZE_REFERENCE;
|
||||
}
|
||||
static inline bool IsWasmReference(Mode mode) {
|
||||
return IsWasmPtrReference(mode) || IsWasmSizeReference(mode);
|
||||
}
|
||||
static inline bool IsWasmSizeReference(Mode mode) {
|
||||
return IsWasmFunctionTableSizeReference(mode);
|
||||
return IsWasmPtrReference(mode);
|
||||
}
|
||||
static inline bool IsWasmPtrReference(Mode mode) {
|
||||
return mode == WASM_CONTEXT_REFERENCE || mode == WASM_GLOBAL_HANDLE ||
|
||||
mode == WASM_CALL || mode == JS_TO_WASM_CALL;
|
||||
return mode == WASM_GLOBAL_HANDLE || mode == WASM_CALL ||
|
||||
mode == JS_TO_WASM_CALL;
|
||||
}
|
||||
|
||||
static constexpr int ModeMask(Mode mode) { return 1 << mode; }
|
||||
@ -500,22 +497,18 @@ class RelocInfo {
|
||||
// instructions).
|
||||
bool IsCodedSpecially();
|
||||
|
||||
// The static pendant to IsCodedSpecially, just for off-heap targets. Used
|
||||
// during deserialization, when we don't actually have a RelocInfo handy.
|
||||
static bool OffHeapTargetIsCodedSpecially();
|
||||
|
||||
// If true, the pointer this relocation info refers to is an entry in the
|
||||
// constant pool, otherwise the pointer is embedded in the instruction stream.
|
||||
bool IsInConstantPool();
|
||||
|
||||
Address wasm_context_reference() const;
|
||||
uint32_t wasm_function_table_size_reference() const;
|
||||
Address global_handle() const;
|
||||
Address js_to_wasm_address() const;
|
||||
Address wasm_call_address() const;
|
||||
|
||||
void set_wasm_context_reference(
|
||||
Address address,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
void update_wasm_function_table_size_reference(
|
||||
uint32_t old_base, uint32_t new_base,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
void set_target_address(
|
||||
Address target,
|
||||
WriteBarrierMode write_barrier_mode = UPDATE_WRITE_BARRIER,
|
||||
@ -542,11 +535,16 @@ class RelocInfo {
|
||||
Address target,
|
||||
WriteBarrierMode write_barrier_mode = UPDATE_WRITE_BARRIER,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
|
||||
INLINE(Address target_off_heap_target());
|
||||
INLINE(Cell* target_cell());
|
||||
INLINE(Handle<Cell> target_cell_handle());
|
||||
INLINE(void set_target_cell(
|
||||
Cell* cell, WriteBarrierMode write_barrier_mode = UPDATE_WRITE_BARRIER,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
|
||||
INLINE(void set_wasm_code_table_entry(
|
||||
Address, ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
|
||||
INLINE(void set_target_external_reference(
|
||||
Address, ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
|
||||
|
||||
// Returns the address of the constant pool entry where the target address
|
||||
// is held. This should only be called if IsInConstantPool returns true.
|
||||
@ -733,349 +731,6 @@ class RelocIterator: public Malloced {
|
||||
DISALLOW_COPY_AND_ASSIGN(RelocIterator);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// External references
|
||||
|
||||
// An ExternalReference represents a C++ address used in the generated
|
||||
// code. All references to C++ functions and variables must be encapsulated in
|
||||
// an ExternalReference instance. This is done in order to track the origin of
|
||||
// all external references in the code so that they can be bound to the correct
|
||||
// addresses when deserializing a heap.
|
||||
class ExternalReference BASE_EMBEDDED {
|
||||
public:
|
||||
// Used in the simulator to support different native api calls.
|
||||
enum Type {
|
||||
// Builtin call.
|
||||
// Object* f(v8::internal::Arguments).
|
||||
BUILTIN_CALL, // default
|
||||
|
||||
// Builtin call returning object pair.
|
||||
// ObjectPair f(v8::internal::Arguments).
|
||||
BUILTIN_CALL_PAIR,
|
||||
|
||||
// Builtin that takes float arguments and returns an int.
|
||||
// int f(double, double).
|
||||
BUILTIN_COMPARE_CALL,
|
||||
|
||||
// Builtin call that returns floating point.
|
||||
// double f(double, double).
|
||||
BUILTIN_FP_FP_CALL,
|
||||
|
||||
// Builtin call that returns floating point.
|
||||
// double f(double).
|
||||
BUILTIN_FP_CALL,
|
||||
|
||||
// Builtin call that returns floating point.
|
||||
// double f(double, int).
|
||||
BUILTIN_FP_INT_CALL,
|
||||
|
||||
// Direct call to API function callback.
|
||||
// void f(v8::FunctionCallbackInfo&)
|
||||
DIRECT_API_CALL,
|
||||
|
||||
// Call to function callback via InvokeFunctionCallback.
|
||||
// void f(v8::FunctionCallbackInfo&, v8::FunctionCallback)
|
||||
PROFILING_API_CALL,
|
||||
|
||||
// Direct call to accessor getter callback.
|
||||
// void f(Local<Name> property, PropertyCallbackInfo& info)
|
||||
DIRECT_GETTER_CALL,
|
||||
|
||||
// Call to accessor getter callback via InvokeAccessorGetterCallback.
|
||||
// void f(Local<Name> property, PropertyCallbackInfo& info,
|
||||
// AccessorNameGetterCallback callback)
|
||||
PROFILING_GETTER_CALL
|
||||
};
|
||||
|
||||
static void SetUp();
|
||||
|
||||
typedef void* ExternalReferenceRedirector(void* original, Type type);
|
||||
|
||||
ExternalReference() : address_(nullptr) {}
|
||||
|
||||
ExternalReference(Address address, Isolate* isolate);
|
||||
|
||||
ExternalReference(ApiFunction* ptr, Type type, Isolate* isolate);
|
||||
|
||||
ExternalReference(Runtime::FunctionId id, Isolate* isolate);
|
||||
|
||||
ExternalReference(const Runtime::Function* f, Isolate* isolate);
|
||||
|
||||
explicit ExternalReference(StatsCounter* counter);
|
||||
|
||||
ExternalReference(IsolateAddressId id, Isolate* isolate);
|
||||
|
||||
explicit ExternalReference(const SCTableReference& table_ref);
|
||||
|
||||
// Isolate as an external reference.
|
||||
static ExternalReference isolate_address(Isolate* isolate);
|
||||
|
||||
// The builtins table as an external reference, used by lazy deserialization.
|
||||
static ExternalReference builtins_address(Isolate* isolate);
|
||||
|
||||
static ExternalReference handle_scope_implementer_address(Isolate* isolate);
|
||||
static ExternalReference pending_microtask_count_address(Isolate* isolate);
|
||||
|
||||
// One-of-a-kind references. These references are not part of a general
|
||||
// pattern. This means that they have to be added to the
|
||||
// ExternalReferenceTable in serialize.cc manually.
|
||||
|
||||
static ExternalReference interpreter_dispatch_table_address(Isolate* isolate);
|
||||
static ExternalReference interpreter_dispatch_counters(Isolate* isolate);
|
||||
static ExternalReference bytecode_size_table_address(Isolate* isolate);
|
||||
|
||||
static ExternalReference incremental_marking_record_write_function(
|
||||
Isolate* isolate);
|
||||
static ExternalReference store_buffer_overflow_function(
|
||||
Isolate* isolate);
|
||||
static ExternalReference delete_handle_scope_extensions(Isolate* isolate);
|
||||
|
||||
static ExternalReference get_date_field_function(Isolate* isolate);
|
||||
static ExternalReference date_cache_stamp(Isolate* isolate);
|
||||
|
||||
// Deoptimization support.
|
||||
static ExternalReference new_deoptimizer_function(Isolate* isolate);
|
||||
static ExternalReference compute_output_frames_function(Isolate* isolate);
|
||||
|
||||
static ExternalReference wasm_f32_trunc(Isolate* isolate);
|
||||
static ExternalReference wasm_f32_floor(Isolate* isolate);
|
||||
static ExternalReference wasm_f32_ceil(Isolate* isolate);
|
||||
static ExternalReference wasm_f32_nearest_int(Isolate* isolate);
|
||||
static ExternalReference wasm_f64_trunc(Isolate* isolate);
|
||||
static ExternalReference wasm_f64_floor(Isolate* isolate);
|
||||
static ExternalReference wasm_f64_ceil(Isolate* isolate);
|
||||
static ExternalReference wasm_f64_nearest_int(Isolate* isolate);
|
||||
static ExternalReference wasm_int64_to_float32(Isolate* isolate);
|
||||
static ExternalReference wasm_uint64_to_float32(Isolate* isolate);
|
||||
static ExternalReference wasm_int64_to_float64(Isolate* isolate);
|
||||
static ExternalReference wasm_uint64_to_float64(Isolate* isolate);
|
||||
static ExternalReference wasm_float32_to_int64(Isolate* isolate);
|
||||
static ExternalReference wasm_float32_to_uint64(Isolate* isolate);
|
||||
static ExternalReference wasm_float64_to_int64(Isolate* isolate);
|
||||
static ExternalReference wasm_float64_to_uint64(Isolate* isolate);
|
||||
static ExternalReference wasm_int64_div(Isolate* isolate);
|
||||
static ExternalReference wasm_int64_mod(Isolate* isolate);
|
||||
static ExternalReference wasm_uint64_div(Isolate* isolate);
|
||||
static ExternalReference wasm_uint64_mod(Isolate* isolate);
|
||||
static ExternalReference wasm_word32_ctz(Isolate* isolate);
|
||||
static ExternalReference wasm_word64_ctz(Isolate* isolate);
|
||||
static ExternalReference wasm_word32_popcnt(Isolate* isolate);
|
||||
static ExternalReference wasm_word64_popcnt(Isolate* isolate);
|
||||
static ExternalReference wasm_word32_rol(Isolate* isolate);
|
||||
static ExternalReference wasm_word32_ror(Isolate* isolate);
|
||||
static ExternalReference wasm_float64_pow(Isolate* isolate);
|
||||
static ExternalReference wasm_set_thread_in_wasm_flag(Isolate* isolate);
|
||||
static ExternalReference wasm_clear_thread_in_wasm_flag(Isolate* isolate);
|
||||
|
||||
static ExternalReference f64_acos_wrapper_function(Isolate* isolate);
|
||||
static ExternalReference f64_asin_wrapper_function(Isolate* isolate);
|
||||
static ExternalReference f64_mod_wrapper_function(Isolate* isolate);
|
||||
|
||||
// Trap callback function for cctest/wasm/wasm-run-utils.h
|
||||
static ExternalReference wasm_call_trap_callback_for_testing(
|
||||
Isolate* isolate);
|
||||
|
||||
// Log support.
|
||||
static ExternalReference log_enter_external_function(Isolate* isolate);
|
||||
static ExternalReference log_leave_external_function(Isolate* isolate);
|
||||
|
||||
// Static variable Heap::roots_array_start()
|
||||
static ExternalReference roots_array_start(Isolate* isolate);
|
||||
|
||||
// Static variable Heap::allocation_sites_list_address()
|
||||
static ExternalReference allocation_sites_list_address(Isolate* isolate);
|
||||
|
||||
// Static variable StackGuard::address_of_jslimit()
|
||||
V8_EXPORT_PRIVATE static ExternalReference address_of_stack_limit(
|
||||
Isolate* isolate);
|
||||
|
||||
// Static variable StackGuard::address_of_real_jslimit()
|
||||
static ExternalReference address_of_real_stack_limit(Isolate* isolate);
|
||||
|
||||
// Static variable RegExpStack::limit_address()
|
||||
static ExternalReference address_of_regexp_stack_limit(Isolate* isolate);
|
||||
|
||||
// Static variables for RegExp.
|
||||
static ExternalReference address_of_static_offsets_vector(Isolate* isolate);
|
||||
static ExternalReference address_of_regexp_stack_memory_address(
|
||||
Isolate* isolate);
|
||||
static ExternalReference address_of_regexp_stack_memory_size(
|
||||
Isolate* isolate);
|
||||
|
||||
// Write barrier.
|
||||
static ExternalReference store_buffer_top(Isolate* isolate);
|
||||
static ExternalReference heap_is_marking_flag_address(Isolate* isolate);
|
||||
|
||||
// Used for fast allocation in generated code.
|
||||
static ExternalReference new_space_allocation_top_address(Isolate* isolate);
|
||||
static ExternalReference new_space_allocation_limit_address(Isolate* isolate);
|
||||
static ExternalReference old_space_allocation_top_address(Isolate* isolate);
|
||||
static ExternalReference old_space_allocation_limit_address(Isolate* isolate);
|
||||
|
||||
static ExternalReference mod_two_doubles_operation(Isolate* isolate);
|
||||
static ExternalReference power_double_double_function(Isolate* isolate);
|
||||
|
||||
static ExternalReference handle_scope_next_address(Isolate* isolate);
|
||||
static ExternalReference handle_scope_limit_address(Isolate* isolate);
|
||||
static ExternalReference handle_scope_level_address(Isolate* isolate);
|
||||
|
||||
static ExternalReference scheduled_exception_address(Isolate* isolate);
|
||||
static ExternalReference address_of_pending_message_obj(Isolate* isolate);
|
||||
|
||||
// Static variables containing common double constants.
|
||||
static ExternalReference address_of_min_int();
|
||||
static ExternalReference address_of_one_half();
|
||||
static ExternalReference address_of_minus_one_half();
|
||||
static ExternalReference address_of_negative_infinity();
|
||||
static ExternalReference address_of_the_hole_nan();
|
||||
static ExternalReference address_of_uint32_bias();
|
||||
|
||||
// Static variables containing simd constants.
|
||||
static ExternalReference address_of_float_abs_constant();
|
||||
static ExternalReference address_of_float_neg_constant();
|
||||
static ExternalReference address_of_double_abs_constant();
|
||||
static ExternalReference address_of_double_neg_constant();
|
||||
|
||||
// IEEE 754 functions.
|
||||
static ExternalReference ieee754_acos_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_acosh_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_asin_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_asinh_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_atan_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_atanh_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_atan2_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_cbrt_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_cos_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_cosh_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_exp_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_expm1_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_log_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_log1p_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_log10_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_log2_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_sin_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_sinh_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_tan_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_tanh_function(Isolate* isolate);
|
||||
|
||||
static ExternalReference libc_memchr_function(Isolate* isolate);
|
||||
static ExternalReference libc_memcpy_function(Isolate* isolate);
|
||||
static ExternalReference libc_memmove_function(Isolate* isolate);
|
||||
static ExternalReference libc_memset_function(Isolate* isolate);
|
||||
|
||||
static ExternalReference printf_function(Isolate* isolate);
|
||||
|
||||
static ExternalReference try_internalize_string_function(Isolate* isolate);
|
||||
|
||||
static ExternalReference check_object_type(Isolate* isolate);
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
static ExternalReference intl_convert_one_byte_to_lower(Isolate* isolate);
|
||||
static ExternalReference intl_to_latin1_lower_table(Isolate* isolate);
|
||||
#endif // V8_INTL_SUPPORT
|
||||
|
||||
template <typename SubjectChar, typename PatternChar>
|
||||
static ExternalReference search_string_raw(Isolate* isolate);
|
||||
|
||||
static ExternalReference orderedhashmap_gethash_raw(Isolate* isolate);
|
||||
|
||||
static ExternalReference get_or_create_hash_raw(Isolate* isolate);
|
||||
static ExternalReference jsreceiver_create_identity_hash(Isolate* isolate);
|
||||
|
||||
static ExternalReference copy_fast_number_jsarray_elements_to_typed_array(
|
||||
Isolate* isolate);
|
||||
static ExternalReference copy_typed_array_elements_to_typed_array(
|
||||
Isolate* isolate);
|
||||
static ExternalReference copy_typed_array_elements_slice(Isolate* isolate);
|
||||
|
||||
static ExternalReference page_flags(Page* page);
|
||||
|
||||
static ExternalReference ForDeoptEntry(Address entry);
|
||||
|
||||
static ExternalReference cpu_features();
|
||||
|
||||
static ExternalReference debug_is_active_address(Isolate* isolate);
|
||||
static ExternalReference debug_hook_on_function_call_address(
|
||||
Isolate* isolate);
|
||||
|
||||
static ExternalReference is_profiling_address(Isolate* isolate);
|
||||
static ExternalReference invoke_function_callback(Isolate* isolate);
|
||||
static ExternalReference invoke_accessor_getter_callback(Isolate* isolate);
|
||||
|
||||
static ExternalReference promise_hook_or_debug_is_active_address(
|
||||
Isolate* isolate);
|
||||
|
||||
V8_EXPORT_PRIVATE static ExternalReference runtime_function_table_address(
|
||||
Isolate* isolate);
|
||||
|
||||
static ExternalReference invalidate_prototype_chains_function(
|
||||
Isolate* isolate);
|
||||
|
||||
Address address() const { return reinterpret_cast<Address>(address_); }
|
||||
|
||||
// Used to read out the last step action of the debugger.
|
||||
static ExternalReference debug_last_step_action_address(Isolate* isolate);
|
||||
|
||||
// Used to check for suspended generator, used for stepping across await call.
|
||||
static ExternalReference debug_suspended_generator_address(Isolate* isolate);
|
||||
|
||||
// Used to store the frame pointer to drop to when restarting a frame.
|
||||
static ExternalReference debug_restart_fp_address(Isolate* isolate);
|
||||
|
||||
#ifndef V8_INTERPRETED_REGEXP
|
||||
// C functions called from RegExp generated code.
|
||||
|
||||
// Function NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16()
|
||||
static ExternalReference re_case_insensitive_compare_uc16(Isolate* isolate);
|
||||
|
||||
// Function RegExpMacroAssembler*::CheckStackGuardState()
|
||||
static ExternalReference re_check_stack_guard_state(Isolate* isolate);
|
||||
|
||||
// Function NativeRegExpMacroAssembler::GrowStack()
|
||||
static ExternalReference re_grow_stack(Isolate* isolate);
|
||||
|
||||
// byte NativeRegExpMacroAssembler::word_character_bitmap
|
||||
static ExternalReference re_word_character_map();
|
||||
|
||||
#endif
|
||||
|
||||
// This lets you register a function that rewrites all external references.
|
||||
// Used by the ARM simulator to catch calls to external references.
|
||||
static void set_redirector(Isolate* isolate,
|
||||
ExternalReferenceRedirector* redirector);
|
||||
|
||||
static ExternalReference stress_deopt_count(Isolate* isolate);
|
||||
|
||||
static ExternalReference force_slow_path(Isolate* isolate);
|
||||
|
||||
static ExternalReference fixed_typed_array_base_data_offset();
|
||||
|
||||
private:
|
||||
explicit ExternalReference(void* address)
|
||||
: address_(address) {}
|
||||
|
||||
static void* Redirect(Isolate* isolate,
|
||||
Address address_arg,
|
||||
Type type = ExternalReference::BUILTIN_CALL) {
|
||||
ExternalReferenceRedirector* redirector =
|
||||
reinterpret_cast<ExternalReferenceRedirector*>(
|
||||
isolate->external_reference_redirector());
|
||||
void* address = reinterpret_cast<void*>(address_arg);
|
||||
void* answer =
|
||||
(redirector == nullptr) ? address : (*redirector)(address, type);
|
||||
return answer;
|
||||
}
|
||||
|
||||
void* address_;
|
||||
};
|
||||
|
||||
V8_EXPORT_PRIVATE bool operator==(ExternalReference, ExternalReference);
|
||||
bool operator!=(ExternalReference, ExternalReference);
|
||||
|
||||
size_t hash_value(ExternalReference);
|
||||
|
||||
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ExternalReference);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Utility functions
|
||||
|
||||
@ -1091,14 +746,18 @@ double power_double_double(double x, double y);
|
||||
class ConstantPoolEntry {
|
||||
public:
|
||||
ConstantPoolEntry() {}
|
||||
ConstantPoolEntry(int position, intptr_t value, bool sharing_ok)
|
||||
ConstantPoolEntry(int position, intptr_t value, bool sharing_ok,
|
||||
RelocInfo::Mode rmode = RelocInfo::NONE)
|
||||
: position_(position),
|
||||
merged_index_(sharing_ok ? SHARING_ALLOWED : SHARING_PROHIBITED),
|
||||
value_(value) {}
|
||||
ConstantPoolEntry(int position, Double value)
|
||||
value_(value),
|
||||
rmode_(rmode) {}
|
||||
ConstantPoolEntry(int position, Double value,
|
||||
RelocInfo::Mode rmode = RelocInfo::NONE)
|
||||
: position_(position),
|
||||
merged_index_(SHARING_ALLOWED),
|
||||
value64_(value.AsUint64()) {}
|
||||
value64_(value.AsUint64()),
|
||||
rmode_(rmode) {}
|
||||
|
||||
int position() const { return position_; }
|
||||
bool sharing_ok() const { return merged_index_ != SHARING_PROHIBITED; }
|
||||
@ -1122,6 +781,7 @@ class ConstantPoolEntry {
|
||||
}
|
||||
intptr_t value() const { return value_; }
|
||||
uint64_t value64() const { return value64_; }
|
||||
RelocInfo::Mode rmode() const { return rmode_; }
|
||||
|
||||
enum Type { INTPTR, DOUBLE, NUMBER_OF_TYPES };
|
||||
|
||||
@ -1138,6 +798,9 @@ class ConstantPoolEntry {
|
||||
intptr_t value_;
|
||||
uint64_t value64_;
|
||||
};
|
||||
// TODO(leszeks): The way we use this, it could probably be packed into
|
||||
// merged_index_ if size is a concern.
|
||||
RelocInfo::Mode rmode_;
|
||||
enum { SHARING_PROHIBITED = -2, SHARING_ALLOWED = -1 };
|
||||
};
|
||||
|
||||
|
18
deps/v8/src/ast/ast-traversal-visitor.h
vendored
18
deps/v8/src/ast/ast-traversal-visitor.h
vendored
@ -517,6 +517,15 @@ void AstTraversalVisitor<Subclass>::VisitSpread(Spread* expr) {
|
||||
RECURSE_EXPRESSION(Visit(expr->expression()));
|
||||
}
|
||||
|
||||
template <class Subclass>
|
||||
void AstTraversalVisitor<Subclass>::VisitStoreInArrayLiteral(
|
||||
StoreInArrayLiteral* expr) {
|
||||
PROCESS_EXPRESSION(expr);
|
||||
RECURSE_EXPRESSION(Visit(expr->array()));
|
||||
RECURSE_EXPRESSION(Visit(expr->index()));
|
||||
RECURSE_EXPRESSION(Visit(expr->value()));
|
||||
}
|
||||
|
||||
template <class Subclass>
|
||||
void AstTraversalVisitor<Subclass>::VisitEmptyParentheses(
|
||||
EmptyParentheses* expr) {
|
||||
@ -535,6 +544,15 @@ void AstTraversalVisitor<Subclass>::VisitGetTemplateObject(
|
||||
PROCESS_EXPRESSION(expr);
|
||||
}
|
||||
|
||||
template <class Subclass>
|
||||
void AstTraversalVisitor<Subclass>::VisitTemplateLiteral(
|
||||
TemplateLiteral* expr) {
|
||||
PROCESS_EXPRESSION(expr);
|
||||
for (Expression* sub : *expr->substitutions()) {
|
||||
RECURSE_EXPRESSION(Visit(sub));
|
||||
}
|
||||
}
|
||||
|
||||
template <class Subclass>
|
||||
void AstTraversalVisitor<Subclass>::VisitImportCallExpression(
|
||||
ImportCallExpression* expr) {
|
||||
|
2
deps/v8/src/ast/ast-value-factory.h
vendored
2
deps/v8/src/ast/ast-value-factory.h
vendored
@ -32,8 +32,8 @@
|
||||
|
||||
#include "src/base/hashmap.h"
|
||||
#include "src/conversions.h"
|
||||
#include "src/factory.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/heap/factory.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/utils.h"
|
||||
|
||||
|
17
deps/v8/src/ast/ast.cc
vendored
17
deps/v8/src/ast/ast.cc
vendored
@ -211,6 +211,23 @@ Assignment::Assignment(NodeType node_type, Token::Value op, Expression* target,
|
||||
bit_field_ |= TokenField::encode(op);
|
||||
}
|
||||
|
||||
void FunctionLiteral::set_inferred_name(Handle<String> inferred_name) {
|
||||
DCHECK(!inferred_name.is_null());
|
||||
inferred_name_ = inferred_name;
|
||||
DCHECK(raw_inferred_name_ == nullptr || raw_inferred_name_->IsEmpty());
|
||||
raw_inferred_name_ = nullptr;
|
||||
scope()->set_has_inferred_function_name(true);
|
||||
}
|
||||
|
||||
void FunctionLiteral::set_raw_inferred_name(
|
||||
const AstConsString* raw_inferred_name) {
|
||||
DCHECK_NOT_NULL(raw_inferred_name);
|
||||
raw_inferred_name_ = raw_inferred_name;
|
||||
DCHECK(inferred_name_.is_null());
|
||||
inferred_name_ = Handle<String>();
|
||||
scope()->set_has_inferred_function_name(true);
|
||||
}
|
||||
|
||||
bool FunctionLiteral::ShouldEagerCompile() const {
|
||||
return scope()->ShouldEagerCompile();
|
||||
}
|
||||
|
92
deps/v8/src/ast/ast.h
vendored
92
deps/v8/src/ast/ast.h
vendored
@ -11,8 +11,8 @@
|
||||
#include "src/ast/modules.h"
|
||||
#include "src/ast/variables.h"
|
||||
#include "src/bailout-reason.h"
|
||||
#include "src/factory.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/heap/factory.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/label.h"
|
||||
#include "src/objects/literal-objects.h"
|
||||
@ -97,8 +97,10 @@ namespace internal {
|
||||
V(ResolvedProperty) \
|
||||
V(RewritableExpression) \
|
||||
V(Spread) \
|
||||
V(StoreInArrayLiteral) \
|
||||
V(SuperCallReference) \
|
||||
V(SuperPropertyReference) \
|
||||
V(TemplateLiteral) \
|
||||
V(ThisFunction) \
|
||||
V(Throw) \
|
||||
V(UnaryOperation) \
|
||||
@ -1946,6 +1948,29 @@ class Spread final : public Expression {
|
||||
Expression* expression_;
|
||||
};
|
||||
|
||||
// The StoreInArrayLiteral node corresponds to the StaInArrayLiteral bytecode.
|
||||
// It is used in the rewriting of destructuring assignments that contain an
|
||||
// array rest pattern.
|
||||
class StoreInArrayLiteral final : public Expression {
|
||||
public:
|
||||
Expression* array() const { return array_; }
|
||||
Expression* index() const { return index_; }
|
||||
Expression* value() const { return value_; }
|
||||
|
||||
private:
|
||||
friend class AstNodeFactory;
|
||||
|
||||
StoreInArrayLiteral(Expression* array, Expression* index, Expression* value,
|
||||
int position)
|
||||
: Expression(position, kStoreInArrayLiteral),
|
||||
array_(array),
|
||||
index_(index),
|
||||
value_(value) {}
|
||||
|
||||
Expression* array_;
|
||||
Expression* index_;
|
||||
Expression* value_;
|
||||
};
|
||||
|
||||
class Conditional final : public Expression {
|
||||
public:
|
||||
@ -2221,23 +2246,11 @@ class FunctionLiteral final : public Expression {
|
||||
}
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
// Only one of {set_inferred_name, set_raw_inferred_name} should be called.
|
||||
void set_inferred_name(Handle<String> inferred_name) {
|
||||
DCHECK(!inferred_name.is_null());
|
||||
inferred_name_ = inferred_name;
|
||||
DCHECK(raw_inferred_name_ == nullptr || raw_inferred_name_->IsEmpty());
|
||||
raw_inferred_name_ = nullptr;
|
||||
}
|
||||
|
||||
const AstConsString* raw_inferred_name() { return raw_inferred_name_; }
|
||||
|
||||
void set_raw_inferred_name(const AstConsString* raw_inferred_name) {
|
||||
DCHECK_NOT_NULL(raw_inferred_name);
|
||||
raw_inferred_name_ = raw_inferred_name;
|
||||
DCHECK(inferred_name_.is_null());
|
||||
inferred_name_ = Handle<String>();
|
||||
}
|
||||
// Only one of {set_inferred_name, set_raw_inferred_name} should be called.
|
||||
void set_inferred_name(Handle<String> inferred_name);
|
||||
void set_raw_inferred_name(const AstConsString* raw_inferred_name);
|
||||
|
||||
bool pretenure() const { return Pretenure::decode(bit_field_); }
|
||||
void set_pretenure() { bit_field_ = Pretenure::update(bit_field_, true); }
|
||||
@ -2279,7 +2292,9 @@ class FunctionLiteral final : public Expression {
|
||||
void set_suspend_count(int suspend_count) { suspend_count_ = suspend_count; }
|
||||
|
||||
int return_position() {
|
||||
return std::max(start_position(), end_position() - (has_braces_ ? 1 : 0));
|
||||
return std::max(
|
||||
start_position(),
|
||||
end_position() - (HasBracesField::decode(bit_field_) ? 1 : 0));
|
||||
}
|
||||
|
||||
int function_literal_id() const { return function_literal_id_; }
|
||||
@ -2315,19 +2330,19 @@ class FunctionLiteral final : public Expression {
|
||||
function_length_(function_length),
|
||||
function_token_position_(kNoSourcePosition),
|
||||
suspend_count_(0),
|
||||
has_braces_(has_braces),
|
||||
function_literal_id_(function_literal_id),
|
||||
raw_name_(name ? ast_value_factory->NewConsString(name) : nullptr),
|
||||
scope_(scope),
|
||||
body_(body),
|
||||
raw_inferred_name_(ast_value_factory->empty_cons_string()),
|
||||
function_literal_id_(function_literal_id),
|
||||
produced_preparsed_scope_data_(produced_preparsed_scope_data) {
|
||||
bit_field_ |= FunctionTypeBits::encode(function_type) |
|
||||
Pretenure::encode(false) |
|
||||
HasDuplicateParameters::encode(has_duplicate_parameters ==
|
||||
kHasDuplicateParameters) |
|
||||
DontOptimizeReasonField::encode(BailoutReason::kNoReason) |
|
||||
RequiresInstanceFieldsInitializer::encode(false);
|
||||
RequiresInstanceFieldsInitializer::encode(false) |
|
||||
HasBracesField::encode(has_braces);
|
||||
if (eager_compile_hint == kShouldEagerCompile) SetShouldEagerCompile();
|
||||
DCHECK_EQ(body == nullptr, expected_property_count < 0);
|
||||
}
|
||||
@ -2340,20 +2355,21 @@ class FunctionLiteral final : public Expression {
|
||||
: public BitField<BailoutReason, HasDuplicateParameters::kNext, 8> {};
|
||||
class RequiresInstanceFieldsInitializer
|
||||
: public BitField<bool, DontOptimizeReasonField::kNext, 1> {};
|
||||
class HasBracesField
|
||||
: public BitField<bool, RequiresInstanceFieldsInitializer::kNext, 1> {};
|
||||
|
||||
int expected_property_count_;
|
||||
int parameter_count_;
|
||||
int function_length_;
|
||||
int function_token_position_;
|
||||
int suspend_count_;
|
||||
bool has_braces_;
|
||||
int function_literal_id_;
|
||||
|
||||
const AstConsString* raw_name_;
|
||||
DeclarationScope* scope_;
|
||||
ZoneList<Statement*>* body_;
|
||||
const AstConsString* raw_inferred_name_;
|
||||
Handle<String> inferred_name_;
|
||||
int function_literal_id_;
|
||||
ProducedPreParsedScopeData* produced_preparsed_scope_data_;
|
||||
};
|
||||
|
||||
@ -2650,6 +2666,26 @@ class GetTemplateObject final : public Expression {
|
||||
const ZoneList<const AstRawString*>* raw_strings_;
|
||||
};
|
||||
|
||||
class TemplateLiteral final : public Expression {
|
||||
public:
|
||||
using StringList = ZoneList<const AstRawString*>;
|
||||
using ExpressionList = ZoneList<Expression*>;
|
||||
|
||||
const StringList* string_parts() const { return string_parts_; }
|
||||
const ExpressionList* substitutions() const { return substitutions_; }
|
||||
|
||||
private:
|
||||
friend class AstNodeFactory;
|
||||
TemplateLiteral(const StringList* parts, const ExpressionList* substitutions,
|
||||
int pos)
|
||||
: Expression(pos, kTemplateLiteral),
|
||||
string_parts_(parts),
|
||||
substitutions_(substitutions) {}
|
||||
|
||||
const StringList* string_parts_;
|
||||
const ExpressionList* substitutions_;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Basic visitor
|
||||
// Sub-class should parametrize AstVisitor with itself, e.g.:
|
||||
@ -3067,6 +3103,12 @@ class AstNodeFactory final BASE_EMBEDDED {
|
||||
return new (zone_) Spread(expression, pos, expr_pos);
|
||||
}
|
||||
|
||||
StoreInArrayLiteral* NewStoreInArrayLiteral(Expression* array,
|
||||
Expression* index,
|
||||
Expression* value, int pos) {
|
||||
return new (zone_) StoreInArrayLiteral(array, index, value, pos);
|
||||
}
|
||||
|
||||
Conditional* NewConditional(Expression* condition,
|
||||
Expression* then_expression,
|
||||
Expression* else_expression,
|
||||
@ -3226,6 +3268,12 @@ class AstNodeFactory final BASE_EMBEDDED {
|
||||
return new (zone_) GetTemplateObject(cooked_strings, raw_strings, pos);
|
||||
}
|
||||
|
||||
TemplateLiteral* NewTemplateLiteral(
|
||||
const ZoneList<const AstRawString*>* string_parts,
|
||||
const ZoneList<Expression*>* substitutions, int pos) {
|
||||
return new (zone_) TemplateLiteral(string_parts, substitutions, pos);
|
||||
}
|
||||
|
||||
ImportCallExpression* NewImportCallExpression(Expression* args, int pos) {
|
||||
return new (zone_) ImportCallExpression(args, pos);
|
||||
}
|
||||
|
2
deps/v8/src/ast/compile-time-value.cc
vendored
2
deps/v8/src/ast/compile-time-value.cc
vendored
@ -5,8 +5,8 @@
|
||||
#include "src/ast/compile-time-value.h"
|
||||
|
||||
#include "src/ast/ast.h"
|
||||
#include "src/factory.h"
|
||||
#include "src/handles-inl.h"
|
||||
#include "src/heap/factory.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/objects-inl.h"
|
||||
|
||||
|
30
deps/v8/src/ast/prettyprinter.cc
vendored
30
deps/v8/src/ast/prettyprinter.cc
vendored
@ -442,6 +442,11 @@ void CallPrinter::VisitSpread(Spread* node) {
|
||||
Print(")");
|
||||
}
|
||||
|
||||
void CallPrinter::VisitStoreInArrayLiteral(StoreInArrayLiteral* node) {
|
||||
Find(node->array());
|
||||
Find(node->index());
|
||||
Find(node->value());
|
||||
}
|
||||
|
||||
void CallPrinter::VisitEmptyParentheses(EmptyParentheses* node) {
|
||||
UNREACHABLE();
|
||||
@ -466,6 +471,12 @@ void CallPrinter::VisitGetIterator(GetIterator* node) {
|
||||
|
||||
void CallPrinter::VisitGetTemplateObject(GetTemplateObject* node) {}
|
||||
|
||||
void CallPrinter::VisitTemplateLiteral(TemplateLiteral* node) {
|
||||
for (Expression* substitution : *node->substitutions()) {
|
||||
Find(substitution, true);
|
||||
}
|
||||
}
|
||||
|
||||
void CallPrinter::VisitImportCallExpression(ImportCallExpression* node) {
|
||||
Print("ImportCall(");
|
||||
Find(node->argument(), true);
|
||||
@ -1318,6 +1329,12 @@ void AstPrinter::VisitSpread(Spread* node) {
|
||||
Visit(node->expression());
|
||||
}
|
||||
|
||||
void AstPrinter::VisitStoreInArrayLiteral(StoreInArrayLiteral* node) {
|
||||
IndentedScope indent(this, "STORE IN ARRAY LITERAL", node->position());
|
||||
PrintIndentedVisit("ARRAY", node->array());
|
||||
PrintIndentedVisit("INDEX", node->index());
|
||||
PrintIndentedVisit("VALUE", node->value());
|
||||
}
|
||||
|
||||
void AstPrinter::VisitEmptyParentheses(EmptyParentheses* node) {
|
||||
IndentedScope indent(this, "()", node->position());
|
||||
@ -1332,6 +1349,19 @@ void AstPrinter::VisitGetTemplateObject(GetTemplateObject* node) {
|
||||
IndentedScope indent(this, "GET-TEMPLATE-OBJECT", node->position());
|
||||
}
|
||||
|
||||
void AstPrinter::VisitTemplateLiteral(TemplateLiteral* node) {
|
||||
IndentedScope indent(this, "TEMPLATE-LITERAL", node->position());
|
||||
const AstRawString* string = node->string_parts()->first();
|
||||
if (!string->IsEmpty()) PrintLiteralIndented("SPAN", string, true);
|
||||
for (int i = 0; i < node->substitutions()->length();) {
|
||||
PrintIndentedVisit("EXPR", node->substitutions()->at(i++));
|
||||
if (i < node->string_parts()->length()) {
|
||||
string = node->string_parts()->at(i);
|
||||
if (!string->IsEmpty()) PrintLiteralIndented("SPAN", string, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AstPrinter::VisitImportCallExpression(ImportCallExpression* node) {
|
||||
IndentedScope indent(this, "IMPORT-CALL", node->position());
|
||||
Visit(node->argument());
|
||||
|
1
deps/v8/src/ast/scopes.cc
vendored
1
deps/v8/src/ast/scopes.cc
vendored
@ -1492,6 +1492,7 @@ void DeclarationScope::ResetAfterPreparsing(AstValueFactory* ast_value_factory,
|
||||
unresolved_ = nullptr;
|
||||
sloppy_block_function_map_ = nullptr;
|
||||
rare_data_ = nullptr;
|
||||
has_rest_ = false;
|
||||
|
||||
if (aborted) {
|
||||
// Prepare scope for use in the outer zone.
|
||||
|
16
deps/v8/src/ast/scopes.h
vendored
16
deps/v8/src/ast/scopes.h
vendored
@ -590,8 +590,9 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
|
||||
Variable* LookupRecursive(ParseInfo* info, VariableProxy* proxy,
|
||||
Scope* outer_scope_end);
|
||||
void ResolveTo(ParseInfo* info, VariableProxy* proxy, Variable* var);
|
||||
MUST_USE_RESULT bool ResolveVariable(ParseInfo* info, VariableProxy* proxy);
|
||||
MUST_USE_RESULT bool ResolveVariablesRecursively(ParseInfo* info);
|
||||
V8_WARN_UNUSED_RESULT bool ResolveVariable(ParseInfo* info,
|
||||
VariableProxy* proxy);
|
||||
V8_WARN_UNUSED_RESULT bool ResolveVariablesRecursively(ParseInfo* info);
|
||||
|
||||
// Finds free variables of this scope. This mutates the unresolved variables
|
||||
// list along the way, so full resolution cannot be done afterwards.
|
||||
@ -854,7 +855,7 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
|
||||
// Returns false if private fields can not be resolved and
|
||||
// ParseInfo's pending_error_handler will be populated with an
|
||||
// error. Otherwise, returns true.
|
||||
MUST_USE_RESULT
|
||||
V8_WARN_UNUSED_RESULT
|
||||
static bool Analyze(ParseInfo* info);
|
||||
|
||||
// To be called during parsing. Do just enough scope analysis that we can
|
||||
@ -901,6 +902,14 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
|
||||
is_skipped_function_ = is_skipped_function;
|
||||
}
|
||||
|
||||
bool has_inferred_function_name() const {
|
||||
return has_inferred_function_name_;
|
||||
}
|
||||
void set_has_inferred_function_name(bool value) {
|
||||
DCHECK(is_function_scope());
|
||||
has_inferred_function_name_ = value;
|
||||
}
|
||||
|
||||
// Save data describing the context allocation of the variables in this scope
|
||||
// and its subscopes (except scopes at the laziness boundary). The data is
|
||||
// saved in produced_preparsed_scope_data_.
|
||||
@ -952,6 +961,7 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
|
||||
bool is_being_lazily_parsed_ : 1;
|
||||
#endif
|
||||
bool is_skipped_function_ : 1;
|
||||
bool has_inferred_function_name_ : 1;
|
||||
|
||||
// Parameter list in source order.
|
||||
ZoneList<Variable*> params_;
|
||||
|
4
deps/v8/src/bailout-reason.h
vendored
4
deps/v8/src/bailout-reason.h
vendored
@ -32,6 +32,7 @@ namespace internal {
|
||||
V(kInvalidHandleScopeLevel, "Invalid HandleScope level") \
|
||||
V(kInvalidJumpTableIndex, "Invalid jump table index") \
|
||||
V(kInvalidRegisterFileInGenerator, "invalid register file in generator") \
|
||||
V(kInvalidSharedFunctionInfoData, "Invalid SharedFunctionInfo data") \
|
||||
V(kMissingBytecodeArray, "Missing bytecode array from function") \
|
||||
V(kObjectNotTagged, "The object is not tagged") \
|
||||
V(kObjectTagged, "The object is tagged") \
|
||||
@ -39,11 +40,14 @@ namespace internal {
|
||||
V(kOperandIsASmi, "Operand is a smi") \
|
||||
V(kOperandIsASmiAndNotABoundFunction, \
|
||||
"Operand is a smi and not a bound function") \
|
||||
V(kOperandIsASmiAndNotAConstructor, \
|
||||
"Operand is a smi and not a constructor") \
|
||||
V(kOperandIsASmiAndNotAFixedArray, "Operand is a smi and not a fixed array") \
|
||||
V(kOperandIsASmiAndNotAFunction, "Operand is a smi and not a function") \
|
||||
V(kOperandIsASmiAndNotAGeneratorObject, \
|
||||
"Operand is a smi and not a generator object") \
|
||||
V(kOperandIsNotABoundFunction, "Operand is not a bound function") \
|
||||
V(kOperandIsNotAConstructor, "Operand is not a constructor") \
|
||||
V(kOperandIsNotAFixedArray, "Operand is not a fixed array") \
|
||||
V(kOperandIsNotAFunction, "Operand is not a function") \
|
||||
V(kOperandIsNotAGeneratorObject, "Operand is not a generator object") \
|
||||
|
39
deps/v8/src/base.isolate
vendored
39
deps/v8/src/base.isolate
vendored
@ -1,39 +0,0 @@
|
||||
# Copyright 2015 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.
|
||||
{
|
||||
'includes': [
|
||||
'../third_party/icu/icu.isolate',
|
||||
|
||||
# MSVS runtime libraries.
|
||||
'../gni/msvs_dependencies.isolate',
|
||||
],
|
||||
'conditions': [
|
||||
['v8_use_snapshot=="true" and v8_use_external_startup_data==1', {
|
||||
'variables': {
|
||||
'files': [
|
||||
'<(PRODUCT_DIR)/natives_blob.bin',
|
||||
'<(PRODUCT_DIR)/snapshot_blob.bin',
|
||||
],
|
||||
},
|
||||
}],
|
||||
['tsan==1', {
|
||||
'variables': {
|
||||
'files': [
|
||||
'../tools/sanitizers/tsan_suppressions.txt',
|
||||
],
|
||||
},
|
||||
}],
|
||||
['asan==1 or cfi_vptr==1 or msan==1 or tsan==1 or ubsan_vptr==1', {
|
||||
'variables': {
|
||||
'files': [
|
||||
'../third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer<(EXECUTABLE_SUFFIX)',
|
||||
],
|
||||
},
|
||||
}],
|
||||
# Workaround for https://code.google.com/p/swarming/issues/detail?id=211
|
||||
['asan==0 or cfi_vptr==0 or msan==0 or tsan==0 or ubsan_vptr==0 ', {
|
||||
'variables': {},
|
||||
}],
|
||||
],
|
||||
}
|
10
deps/v8/src/base/compiler-specific.h
vendored
10
deps/v8/src/base/compiler-specific.h
vendored
@ -16,16 +16,6 @@
|
||||
#define ALLOW_UNUSED_TYPE
|
||||
#endif
|
||||
|
||||
|
||||
// Annotate a function indicating the caller must examine the return value.
|
||||
// Use like:
|
||||
// int foo() WARN_UNUSED_RESULT;
|
||||
#if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
|
||||
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
#define WARN_UNUSED_RESULT /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
// Tell the compiler a function is using a printf-style format string.
|
||||
// |format_param| is the one-based index of the format string parameter;
|
||||
// |dots_param| is the one-based index of the "..." parameter.
|
||||
|
7
deps/v8/src/base/debug/stack_trace_posix.cc
vendored
7
deps/v8/src/base/debug/stack_trace_posix.cc
vendored
@ -72,6 +72,7 @@ const char kMangledSymbolPrefix[] = "_Z";
|
||||
const char kSymbolCharacters[] =
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
|
||||
|
||||
#if HAVE_EXECINFO_H
|
||||
// Demangles C++ symbols in the given text. Example:
|
||||
//
|
||||
// "out/Debug/base_unittests(_ZN10StackTraceC1Ev+0x20) [0x817778c]"
|
||||
@ -81,7 +82,6 @@ void DemangleSymbols(std::string* text) {
|
||||
// Note: code in this function is NOT async-signal safe (std::string uses
|
||||
// malloc internally).
|
||||
|
||||
#if HAVE_EXECINFO_H
|
||||
|
||||
std::string::size_type search_from = 0;
|
||||
while (search_from < text->size()) {
|
||||
@ -117,9 +117,8 @@ void DemangleSymbols(std::string* text) {
|
||||
search_from = mangled_start + 2;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAVE_EXECINFO_H
|
||||
}
|
||||
#endif // HAVE_EXECINFO_H
|
||||
|
||||
class BacktraceOutputHandler {
|
||||
public:
|
||||
@ -129,6 +128,7 @@ class BacktraceOutputHandler {
|
||||
virtual ~BacktraceOutputHandler() {}
|
||||
};
|
||||
|
||||
#if HAVE_EXECINFO_H
|
||||
void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
|
||||
// This should be more than enough to store a 64-bit number in hex:
|
||||
// 16 hex digits + 1 for null-terminator.
|
||||
@ -139,7 +139,6 @@ void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
|
||||
handler->HandleOutput(buf);
|
||||
}
|
||||
|
||||
#if HAVE_EXECINFO_H
|
||||
void ProcessBacktrace(void* const* trace, size_t size,
|
||||
BacktraceOutputHandler* handler) {
|
||||
// NOTE: This code MUST be async-signal safe (it's used by in-process
|
||||
|
13
deps/v8/src/base/debug/stack_trace_win.cc
vendored
13
deps/v8/src/base/debug/stack_trace_win.cc
vendored
@ -163,24 +163,11 @@ void DisableSignalStackDump() {
|
||||
g_dump_stack_in_signal_handler = false;
|
||||
}
|
||||
|
||||
// Disable optimizations for the StackTrace::StackTrace function. It is
|
||||
// important to disable at least frame pointer optimization ("y"), since
|
||||
// that breaks CaptureStackBackTrace() and prevents StackTrace from working
|
||||
// in Release builds (it may still be janky if other frames are using FPO,
|
||||
// but at least it will make it further).
|
||||
#if defined(V8_CC_MSVC)
|
||||
#pragma optimize("", off)
|
||||
#endif
|
||||
|
||||
StackTrace::StackTrace() {
|
||||
// When walking our own stack, use CaptureStackBackTrace().
|
||||
count_ = CaptureStackBackTrace(0, arraysize(trace_), trace_, nullptr);
|
||||
}
|
||||
|
||||
#if defined(V8_CC_MSVC)
|
||||
#pragma optimize("", on)
|
||||
#endif
|
||||
|
||||
StackTrace::StackTrace(EXCEPTION_POINTERS* exception_pointers) {
|
||||
InitTrace(exception_pointers->ContextRecord);
|
||||
}
|
||||
|
86
deps/v8/src/base/flags.h
vendored
86
deps/v8/src/base/flags.h
vendored
@ -75,49 +75,49 @@ class Flags final {
|
||||
mask_type mask_;
|
||||
};
|
||||
|
||||
|
||||
#define DEFINE_OPERATORS_FOR_FLAGS(Type) \
|
||||
inline Type operator&( \
|
||||
Type::flag_type lhs, \
|
||||
Type::flag_type rhs)ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \
|
||||
inline Type operator&(Type::flag_type lhs, Type::flag_type rhs) { \
|
||||
return Type(lhs) & rhs; \
|
||||
} \
|
||||
inline Type operator&(Type::flag_type lhs, \
|
||||
const Type& rhs)ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \
|
||||
inline Type operator&(Type::flag_type lhs, const Type& rhs) { \
|
||||
return rhs & lhs; \
|
||||
} \
|
||||
inline void operator&(Type::flag_type lhs, \
|
||||
Type::mask_type rhs)ALLOW_UNUSED_TYPE; \
|
||||
inline void operator&(Type::flag_type lhs, Type::mask_type rhs) {} \
|
||||
inline Type operator|(Type::flag_type lhs, Type::flag_type rhs) \
|
||||
ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \
|
||||
inline Type operator|(Type::flag_type lhs, Type::flag_type rhs) { \
|
||||
return Type(lhs) | rhs; \
|
||||
} \
|
||||
inline Type operator|(Type::flag_type lhs, const Type& rhs) \
|
||||
ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \
|
||||
inline Type operator|(Type::flag_type lhs, const Type& rhs) { \
|
||||
return rhs | lhs; \
|
||||
} \
|
||||
inline void operator|(Type::flag_type lhs, Type::mask_type rhs) \
|
||||
ALLOW_UNUSED_TYPE; \
|
||||
inline void operator|(Type::flag_type lhs, Type::mask_type rhs) {} \
|
||||
inline Type operator^(Type::flag_type lhs, Type::flag_type rhs) \
|
||||
ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \
|
||||
inline Type operator^(Type::flag_type lhs, Type::flag_type rhs) { \
|
||||
return Type(lhs) ^ rhs; \
|
||||
} inline Type \
|
||||
operator^(Type::flag_type lhs, const Type& rhs) \
|
||||
ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \
|
||||
inline Type operator^(Type::flag_type lhs, const Type& rhs) { \
|
||||
return rhs ^ lhs; \
|
||||
} inline void \
|
||||
operator^(Type::flag_type lhs, Type::mask_type rhs) ALLOW_UNUSED_TYPE; \
|
||||
inline void operator^(Type::flag_type lhs, Type::mask_type rhs) { \
|
||||
} inline Type \
|
||||
operator~(Type::flag_type val)ALLOW_UNUSED_TYPE; \
|
||||
#define DEFINE_OPERATORS_FOR_FLAGS(Type) \
|
||||
inline Type operator&( \
|
||||
Type::flag_type lhs, \
|
||||
Type::flag_type rhs)ALLOW_UNUSED_TYPE V8_WARN_UNUSED_RESULT; \
|
||||
inline Type operator&(Type::flag_type lhs, Type::flag_type rhs) { \
|
||||
return Type(lhs) & rhs; \
|
||||
} \
|
||||
inline Type operator&( \
|
||||
Type::flag_type lhs, \
|
||||
const Type& rhs)ALLOW_UNUSED_TYPE V8_WARN_UNUSED_RESULT; \
|
||||
inline Type operator&(Type::flag_type lhs, const Type& rhs) { \
|
||||
return rhs & lhs; \
|
||||
} \
|
||||
inline void operator&(Type::flag_type lhs, \
|
||||
Type::mask_type rhs)ALLOW_UNUSED_TYPE; \
|
||||
inline void operator&(Type::flag_type lhs, Type::mask_type rhs) {} \
|
||||
inline Type operator|(Type::flag_type lhs, Type::flag_type rhs) \
|
||||
ALLOW_UNUSED_TYPE V8_WARN_UNUSED_RESULT; \
|
||||
inline Type operator|(Type::flag_type lhs, Type::flag_type rhs) { \
|
||||
return Type(lhs) | rhs; \
|
||||
} \
|
||||
inline Type operator|(Type::flag_type lhs, const Type& rhs) \
|
||||
ALLOW_UNUSED_TYPE V8_WARN_UNUSED_RESULT; \
|
||||
inline Type operator|(Type::flag_type lhs, const Type& rhs) { \
|
||||
return rhs | lhs; \
|
||||
} \
|
||||
inline void operator|(Type::flag_type lhs, Type::mask_type rhs) \
|
||||
ALLOW_UNUSED_TYPE; \
|
||||
inline void operator|(Type::flag_type lhs, Type::mask_type rhs) {} \
|
||||
inline Type operator^(Type::flag_type lhs, Type::flag_type rhs) \
|
||||
ALLOW_UNUSED_TYPE V8_WARN_UNUSED_RESULT; \
|
||||
inline Type operator^(Type::flag_type lhs, Type::flag_type rhs) { \
|
||||
return Type(lhs) ^ rhs; \
|
||||
} \
|
||||
inline Type operator^(Type::flag_type lhs, const Type& rhs) \
|
||||
ALLOW_UNUSED_TYPE V8_WARN_UNUSED_RESULT; \
|
||||
inline Type operator^(Type::flag_type lhs, const Type& rhs) { \
|
||||
return rhs ^ lhs; \
|
||||
} \
|
||||
inline void operator^(Type::flag_type lhs, Type::mask_type rhs) \
|
||||
ALLOW_UNUSED_TYPE; \
|
||||
inline void operator^(Type::flag_type lhs, Type::mask_type rhs) {} \
|
||||
inline Type operator~(Type::flag_type val)ALLOW_UNUSED_TYPE; \
|
||||
inline Type operator~(Type::flag_type val) { return ~Type(val); }
|
||||
|
||||
} // namespace base
|
||||
|
10
deps/v8/src/base/ieee754.cc
vendored
10
deps/v8/src/base/ieee754.cc
vendored
@ -159,11 +159,11 @@ typedef union {
|
||||
|
||||
#define STRICT_ASSIGN(type, lval, rval) ((lval) = (rval))
|
||||
|
||||
int32_t __ieee754_rem_pio2(double x, double *y) WARN_UNUSED_RESULT;
|
||||
double __kernel_cos(double x, double y) WARN_UNUSED_RESULT;
|
||||
int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec,
|
||||
const int32_t *ipio2) WARN_UNUSED_RESULT;
|
||||
double __kernel_sin(double x, double y, int iy) WARN_UNUSED_RESULT;
|
||||
int32_t __ieee754_rem_pio2(double x, double* y) V8_WARN_UNUSED_RESULT;
|
||||
double __kernel_cos(double x, double y) V8_WARN_UNUSED_RESULT;
|
||||
int __kernel_rem_pio2(double* x, double* y, int e0, int nx, int prec,
|
||||
const int32_t* ipio2) V8_WARN_UNUSED_RESULT;
|
||||
double __kernel_sin(double x, double y, int iy) V8_WARN_UNUSED_RESULT;
|
||||
|
||||
/* __ieee754_rem_pio2(x,y)
|
||||
*
|
||||
|
18
deps/v8/src/base/logging.h
vendored
18
deps/v8/src/base/logging.h
vendored
@ -106,11 +106,25 @@ V8_BASE_EXPORT void SetDcheckFunction(void (*dcheck_Function)(const char*, int,
|
||||
|
||||
// Define PrintCheckOperand<T> for each T which defines operator<< for ostream.
|
||||
template <typename T>
|
||||
typename std::enable_if<has_output_operator<T>::value>::type PrintCheckOperand(
|
||||
std::ostream& os, T val) {
|
||||
typename std::enable_if<
|
||||
!std::is_function<typename std::remove_pointer<T>::type>::value &&
|
||||
has_output_operator<T>::value>::type
|
||||
PrintCheckOperand(std::ostream& os, T val) {
|
||||
os << std::forward<T>(val);
|
||||
}
|
||||
|
||||
// Provide an overload for functions and function pointers. Function pointers
|
||||
// don't implicitly convert to void* but do implicitly convert to bool, so
|
||||
// without this function pointers are always printed as 1 or 0. (MSVC isn't
|
||||
// standards-conforming here and converts function pointers to regular
|
||||
// pointers, so this is a no-op for MSVC.)
|
||||
template <typename T>
|
||||
typename std::enable_if<
|
||||
std::is_function<typename std::remove_pointer<T>::type>::value>::type
|
||||
PrintCheckOperand(std::ostream& os, T val) {
|
||||
os << reinterpret_cast<const void*>(val);
|
||||
}
|
||||
|
||||
// Define PrintCheckOperand<T> for enums which have no operator<<.
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_enum<T>::value &&
|
||||
|
82
deps/v8/src/base/macros.h
vendored
82
deps/v8/src/base/macros.h
vendored
@ -150,11 +150,6 @@ V8_INLINE Dest bit_cast(Source const& source) {
|
||||
#define INLINE(declarator) V8_INLINE declarator
|
||||
#define NO_INLINE(declarator) V8_NOINLINE declarator
|
||||
|
||||
|
||||
// Newly written code should use WARN_UNUSED_RESULT.
|
||||
#define MUST_USE_RESULT WARN_UNUSED_RESULT
|
||||
|
||||
|
||||
// Define V8_USE_ADDRESS_SANITIZER macros.
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(address_sanitizer)
|
||||
@ -196,12 +191,68 @@ V8_INLINE Dest bit_cast(Source const& source) {
|
||||
// TODO(all) Replace all uses of this macro with static_assert, remove macro.
|
||||
#define STATIC_ASSERT(test) static_assert(test, #test)
|
||||
|
||||
// TODO(rongjie) Remove this workaround once we require gcc >= 5.0
|
||||
#if __GNUG__ && __GNUC__ < 5
|
||||
#define IS_TRIVIALLY_COPYABLE(T) \
|
||||
(__has_trivial_copy(T) && __has_trivial_destructor(T))
|
||||
namespace v8 {
|
||||
namespace base {
|
||||
|
||||
// Note that some implementations of std::is_trivially_copyable mandate that at
|
||||
// least one of the copy constructor, move constructor, copy assignment or move
|
||||
// assignment is non-deleted, while others do not. Be aware that also
|
||||
// base::is_trivially_copyable will differ for these cases.
|
||||
template <typename T>
|
||||
struct is_trivially_copyable {
|
||||
#if V8_CC_MSVC
|
||||
// Unfortunately, MSVC 2015 is broken in that std::is_trivially_copyable can
|
||||
// be false even though it should be true according to the standard.
|
||||
// (status at 2018-02-26, observed on the msvc waterfall bot).
|
||||
// Interestingly, the lower-level primitives used below are working as
|
||||
// intended, so we reimplement this according to the standard.
|
||||
// See also https://developercommunity.visualstudio.com/content/problem/
|
||||
// 170883/msvc-type-traits-stdis-trivial-is-bugged.html.
|
||||
static constexpr bool value =
|
||||
// Copy constructor is trivial or deleted.
|
||||
(std::is_trivially_copy_constructible<T>::value ||
|
||||
!std::is_copy_constructible<T>::value) &&
|
||||
// Copy assignment operator is trivial or deleted.
|
||||
(std::is_trivially_copy_assignable<T>::value ||
|
||||
!std::is_copy_assignable<T>::value) &&
|
||||
// Move constructor is trivial or deleted.
|
||||
(std::is_trivially_move_constructible<T>::value ||
|
||||
!std::is_move_constructible<T>::value) &&
|
||||
// Move assignment operator is trivial or deleted.
|
||||
(std::is_trivially_move_assignable<T>::value ||
|
||||
!std::is_move_assignable<T>::value) &&
|
||||
// (Some implementations mandate that one of the above is non-deleted, but
|
||||
// the standard does not, so let's skip this check.)
|
||||
// Trivial non-deleted destructor.
|
||||
std::is_trivially_destructible<T>::value;
|
||||
|
||||
#elif defined(__GNUC__) && __GNUC__ < 5
|
||||
// WARNING:
|
||||
// On older libstdc++ versions, there is no way to correctly implement
|
||||
// is_trivially_copyable. The workaround below is an approximation (neither
|
||||
// over- nor underapproximation). E.g. it wrongly returns true if the move
|
||||
// constructor is non-trivial, and it wrongly returns false if the copy
|
||||
// constructor is deleted, but copy assignment is trivial.
|
||||
// TODO(rongjie) Remove this workaround once we require gcc >= 5.0
|
||||
static constexpr bool value =
|
||||
__has_trivial_copy(T) && __has_trivial_destructor(T);
|
||||
|
||||
#else
|
||||
#define IS_TRIVIALLY_COPYABLE(T) std::is_trivially_copyable<T>::value
|
||||
static constexpr bool value = std::is_trivially_copyable<T>::value;
|
||||
#endif
|
||||
};
|
||||
#if defined(__GNUC__) && __GNUC__ < 5
|
||||
// On older libstdc++ versions, base::is_trivially_copyable<T>::value is only an
|
||||
// approximation (see above), so make ASSERT_{NOT_,}TRIVIALLY_COPYABLE a noop.
|
||||
#define ASSERT_TRIVIALLY_COPYABLE(T) static_assert(true, "check disabled")
|
||||
#define ASSERT_NOT_TRIVIALLY_COPYABLE(T) static_assert(true, "check disabled")
|
||||
#else
|
||||
#define ASSERT_TRIVIALLY_COPYABLE(T) \
|
||||
static_assert(::v8::base::is_trivially_copyable<T>::value, \
|
||||
#T " should be trivially copyable")
|
||||
#define ASSERT_NOT_TRIVIALLY_COPYABLE(T) \
|
||||
static_assert(!::v8::base::is_trivially_copyable<T>::value, \
|
||||
#T " should not be trivially copyable")
|
||||
#endif
|
||||
|
||||
// The USE(x, ...) template is used to silence C++ compiler warnings
|
||||
@ -211,12 +262,15 @@ struct Use {
|
||||
template <typename T>
|
||||
Use(T&&) {} // NOLINT(runtime/explicit)
|
||||
};
|
||||
#define USE(...) \
|
||||
do { \
|
||||
::Use unused_tmp_array_for_use_macro[]{__VA_ARGS__}; \
|
||||
(void)unused_tmp_array_for_use_macro; \
|
||||
#define USE(...) \
|
||||
do { \
|
||||
::v8::base::Use unused_tmp_array_for_use_macro[]{__VA_ARGS__}; \
|
||||
(void)unused_tmp_array_for_use_macro; \
|
||||
} while (false)
|
||||
|
||||
} // namespace base
|
||||
} // namespace v8
|
||||
|
||||
// Define our own macros for writing 64-bit constants. This is less fragile
|
||||
// than defining __STDC_CONSTANT_MACROS before including <stdint.h>, and it
|
||||
// works on compilers that don't have it (like MSVC).
|
||||
|
@ -57,7 +57,7 @@ class V8_BASE_EXPORT ConditionVariable final {
|
||||
// spuriously. When unblocked, regardless of the reason, the lock on the mutex
|
||||
// is reacquired and |WaitFor()| exits. Returns true if the condition variable
|
||||
// was notified prior to the timeout.
|
||||
bool WaitFor(Mutex* mutex, const TimeDelta& rel_time) WARN_UNUSED_RESULT;
|
||||
bool WaitFor(Mutex* mutex, const TimeDelta& rel_time) V8_WARN_UNUSED_RESULT;
|
||||
|
||||
// The implementation-defined native handle type.
|
||||
#if V8_OS_POSIX
|
||||
|
4
deps/v8/src/base/platform/mutex.h
vendored
4
deps/v8/src/base/platform/mutex.h
vendored
@ -51,7 +51,7 @@ class V8_BASE_EXPORT Mutex final {
|
||||
|
||||
// Tries to lock the given mutex. Returns whether the mutex was
|
||||
// successfully locked.
|
||||
bool TryLock() WARN_UNUSED_RESULT;
|
||||
bool TryLock() V8_WARN_UNUSED_RESULT;
|
||||
|
||||
// The implementation-defined native handle type.
|
||||
#if V8_OS_POSIX
|
||||
@ -150,7 +150,7 @@ class V8_BASE_EXPORT RecursiveMutex final {
|
||||
|
||||
// Tries to lock the given mutex. Returns whether the mutex was
|
||||
// successfully locked.
|
||||
bool TryLock() WARN_UNUSED_RESULT;
|
||||
bool TryLock() V8_WARN_UNUSED_RESULT;
|
||||
|
||||
// The implementation-defined native handle type.
|
||||
#if V8_OS_POSIX
|
||||
|
10
deps/v8/src/base/platform/platform-aix.cc
vendored
10
deps/v8/src/base/platform/platform-aix.cc
vendored
@ -39,21 +39,21 @@ namespace base {
|
||||
class AIXTimezoneCache : public PosixTimezoneCache {
|
||||
const char* LocalTimezone(double time) override;
|
||||
|
||||
double LocalTimeOffset() override;
|
||||
double LocalTimeOffset(double time_ms, bool is_utc) override;
|
||||
|
||||
~AIXTimezoneCache() override {}
|
||||
};
|
||||
|
||||
const char* AIXTimezoneCache::LocalTimezone(double time) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(floor(time / msPerSecond));
|
||||
const char* AIXTimezoneCache::LocalTimezone(double time_ms) {
|
||||
if (std::isnan(time_ms)) return "";
|
||||
time_t tv = static_cast<time_t>(floor(time_ms / msPerSecond));
|
||||
struct tm tm;
|
||||
struct tm* t = localtime_r(&tv, &tm);
|
||||
if (nullptr == t) return "";
|
||||
return tzname[0]; // The location of the timezone string on AIX.
|
||||
}
|
||||
|
||||
double AIXTimezoneCache::LocalTimeOffset() {
|
||||
double AIXTimezoneCache::LocalTimeOffset(double time_ms, bool is_utc) {
|
||||
// On AIX, struct tm does not contain a tm_gmtoff field.
|
||||
time_t utc = time(nullptr);
|
||||
DCHECK_NE(utc, -1);
|
||||
|
4
deps/v8/src/base/platform/platform-cygwin.cc
vendored
4
deps/v8/src/base/platform/platform-cygwin.cc
vendored
@ -66,7 +66,7 @@ uint8_t* RandomizedVirtualAlloc(size_t size, DWORD flags, DWORD protect,
|
||||
class CygwinTimezoneCache : public PosixTimezoneCache {
|
||||
const char* LocalTimezone(double time) override;
|
||||
|
||||
double LocalTimeOffset() override;
|
||||
double LocalTimeOffset(double time_ms, bool is_utc) override;
|
||||
|
||||
~CygwinTimezoneCache() override {}
|
||||
};
|
||||
@ -80,7 +80,7 @@ const char* CygwinTimezoneCache::LocalTimezone(double time) {
|
||||
return tzname[0]; // The location of the timezone string on Cygwin.
|
||||
}
|
||||
|
||||
double CygwinTimezoneCache::LocalTimeOffset() {
|
||||
double LocalTimeOffset(double time_ms, bool is_utc) {
|
||||
// On Cygwin, struct tm does not contain a tm_gmtoff field.
|
||||
time_t utc = time(nullptr);
|
||||
DCHECK_NE(utc, -1);
|
||||
|
@ -18,7 +18,9 @@ const char* PosixDefaultTimezoneCache::LocalTimezone(double time) {
|
||||
return t->tm_zone;
|
||||
}
|
||||
|
||||
double PosixDefaultTimezoneCache::LocalTimeOffset() {
|
||||
double PosixDefaultTimezoneCache::LocalTimeOffset(double time_ms, bool is_utc) {
|
||||
// Preserve the old behavior for non-ICU implementation by ignoring both
|
||||
// time_ms and is_utc.
|
||||
time_t tv = time(nullptr);
|
||||
struct tm tm;
|
||||
struct tm* t = localtime_r(&tv, &tm);
|
||||
|
@ -13,7 +13,7 @@ namespace base {
|
||||
class PosixDefaultTimezoneCache : public PosixTimezoneCache {
|
||||
public:
|
||||
const char* LocalTimezone(double time_ms) override;
|
||||
double LocalTimeOffset() override;
|
||||
double LocalTimeOffset(double time_ms, bool is_utc) override;
|
||||
|
||||
~PosixDefaultTimezoneCache() override {}
|
||||
};
|
||||
|
7
deps/v8/src/base/platform/platform-posix.cc
vendored
7
deps/v8/src/base/platform/platform-posix.cc
vendored
@ -491,6 +491,13 @@ int OS::GetCurrentThreadId() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void OS::ExitProcess(int exit_code) {
|
||||
// Use _exit instead of exit to avoid races between isolate
|
||||
// threads and static destructors.
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
_exit(exit_code);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// POSIX date/time support.
|
||||
|
@ -37,8 +37,7 @@ namespace base {
|
||||
class SolarisTimezoneCache : public PosixTimezoneCache {
|
||||
const char* LocalTimezone(double time) override;
|
||||
|
||||
double LocalTimeOffset() override;
|
||||
|
||||
double LocalTimeOffset(double time, bool is_utc) override;
|
||||
~SolarisTimezoneCache() override {}
|
||||
};
|
||||
|
||||
@ -51,7 +50,7 @@ const char* SolarisTimezoneCache::LocalTimezone(double time) {
|
||||
return tzname[0]; // The location of the timezone string on Solaris.
|
||||
}
|
||||
|
||||
double SolarisTimezoneCache::LocalTimeOffset() {
|
||||
double SolarisTimezoneCache::LocalTimeOffset(double time, bool is_utc) {
|
||||
tzset();
|
||||
return -static_cast<double>(timezone * msPerSecond);
|
||||
}
|
||||
|
35
deps/v8/src/base/platform/platform-win32.cc
vendored
35
deps/v8/src/base/platform/platform-win32.cc
vendored
@ -27,6 +27,10 @@
|
||||
#include "src/base/timezone-cache.h"
|
||||
#include "src/base/utils/random-number-generator.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <crtdbg.h> // NOLINT
|
||||
#endif // defined(_MSC_VER)
|
||||
|
||||
// Extra functions for MinGW. Most of these are the _s functions which are in
|
||||
// the Microsoft Visual Studio C++ CRT.
|
||||
#ifdef __MINGW32__
|
||||
@ -111,7 +115,7 @@ class WindowsTimezoneCache : public TimezoneCache {
|
||||
|
||||
const char* LocalTimezone(double time) override;
|
||||
|
||||
double LocalTimeOffset() override;
|
||||
double LocalTimeOffset(double time, bool is_utc) override;
|
||||
|
||||
double DaylightSavingsOffset(double time) override;
|
||||
|
||||
@ -462,7 +466,9 @@ const char* WindowsTimezoneCache::LocalTimezone(double time) {
|
||||
|
||||
// Returns the local time offset in milliseconds east of UTC without
|
||||
// taking daylight savings time into account.
|
||||
double WindowsTimezoneCache::LocalTimeOffset() {
|
||||
double WindowsTimezoneCache::LocalTimeOffset(double time_ms, bool is_utc) {
|
||||
// Ignore is_utc and time_ms for now. That way, the behavior wouldn't
|
||||
// change with icu_timezone_data disabled.
|
||||
// Use current time, rounded to the millisecond.
|
||||
Win32Time t(OS::TimeCurrentMillis());
|
||||
// Time::LocalOffset inlcudes any daylight savings offset, so subtract it.
|
||||
@ -493,6 +499,13 @@ int OS::GetCurrentThreadId() {
|
||||
return static_cast<int>(::GetCurrentThreadId());
|
||||
}
|
||||
|
||||
void OS::ExitProcess(int exit_code) {
|
||||
// Use TerminateProcess avoid races between isolate threads and
|
||||
// static destructors.
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
TerminateProcess(GetCurrentProcess(), exit_code);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Win32 console output.
|
||||
@ -1239,6 +1252,24 @@ int OS::ActivationFrameAlignment() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (defined(_WIN32) || defined(_WIN64))
|
||||
void EnsureConsoleOutputWin32() {
|
||||
UINT new_flags =
|
||||
SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
|
||||
UINT existing_flags = SetErrorMode(new_flags);
|
||||
SetErrorMode(existing_flags | new_flags);
|
||||
#if defined(_MSC_VER)
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
|
||||
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
|
||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
|
||||
_set_error_mode(_OUT_TO_STDERR);
|
||||
#endif // defined(_MSC_VER)
|
||||
}
|
||||
#endif // (defined(_WIN32) || defined(_WIN64))
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Win32 thread support.
|
||||
|
||||
|
14
deps/v8/src/base/platform/platform.h
vendored
14
deps/v8/src/base/platform/platform.h
vendored
@ -245,6 +245,8 @@ class V8_BASE_EXPORT OS {
|
||||
|
||||
static int GetCurrentThreadId();
|
||||
|
||||
static void ExitProcess(int exit_code);
|
||||
|
||||
private:
|
||||
// These classes use the private memory management API below.
|
||||
friend class MemoryMappedFile;
|
||||
@ -279,6 +281,18 @@ class V8_BASE_EXPORT OS {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(OS);
|
||||
};
|
||||
|
||||
#if (defined(_WIN32) || defined(_WIN64))
|
||||
V8_BASE_EXPORT void EnsureConsoleOutputWin32();
|
||||
#endif // (defined(_WIN32) || defined(_WIN64))
|
||||
|
||||
inline void EnsureConsoleOutput() {
|
||||
#if (defined(_WIN32) || defined(_WIN64))
|
||||
// Windows requires extra calls to send assert output to the console
|
||||
// rather than a dialog box.
|
||||
EnsureConsoleOutputWin32();
|
||||
#endif // (defined(_WIN32) || defined(_WIN64))
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Thread
|
||||
//
|
||||
|
2
deps/v8/src/base/platform/semaphore.h
vendored
2
deps/v8/src/base/platform/semaphore.h
vendored
@ -47,7 +47,7 @@ class V8_BASE_EXPORT Semaphore final {
|
||||
// Like Wait() but returns after rel_time time has passed. If the timeout
|
||||
// happens the return value is false and the counter is unchanged. Otherwise
|
||||
// the semaphore counter is decremented and true is returned.
|
||||
bool WaitFor(const TimeDelta& rel_time) WARN_UNUSED_RESULT;
|
||||
bool WaitFor(const TimeDelta& rel_time) V8_WARN_UNUSED_RESULT;
|
||||
|
||||
#if V8_OS_MACOSX
|
||||
typedef semaphore_t NativeHandle;
|
||||
|
19
deps/v8/src/base/template-utils.h
vendored
19
deps/v8/src/base/template-utils.h
vendored
@ -79,20 +79,13 @@ struct pass_value_or_ref {
|
||||
decay_t, const decay_t&>::type;
|
||||
};
|
||||
|
||||
// Uses expression SFINAE to detect whether using operator<< would work.
|
||||
template <typename T, typename = void>
|
||||
struct has_output_operator : std::false_type {};
|
||||
template <typename T>
|
||||
struct has_output_operator {
|
||||
// This template is only instantiable if U provides operator<< with ostream.
|
||||
// Its return type is uint8_t.
|
||||
template <typename U>
|
||||
static auto __check_operator(U u)
|
||||
-> decltype(*(std::ostream*)nullptr << *u, uint8_t{0});
|
||||
// This is a fallback implementation, returning uint16_t. If the template
|
||||
// above is instantiable, is has precedence over this varargs function.
|
||||
static uint16_t __check_operator(...);
|
||||
|
||||
using ptr_t = typename std::add_pointer<T>::type;
|
||||
static constexpr bool value = sizeof(__check_operator(ptr_t{nullptr})) == 1;
|
||||
};
|
||||
struct has_output_operator<T, decltype(void(std::declval<std::ostream&>()
|
||||
<< std::declval<T>()))>
|
||||
: std::true_type {};
|
||||
|
||||
namespace detail {
|
||||
|
||||
|
4
deps/v8/src/base/timezone-cache.h
vendored
4
deps/v8/src/base/timezone-cache.h
vendored
@ -20,10 +20,8 @@ class TimezoneCache {
|
||||
// ES #sec-local-time-zone-adjustment
|
||||
// Local Time Zone Adjustment
|
||||
//
|
||||
// TODO(littledan): Make more accurate with another parameter along the
|
||||
// lines of this spec change:
|
||||
// https://github.com/tc39/ecma262/pull/778
|
||||
virtual double LocalTimeOffset() = 0;
|
||||
virtual double LocalTimeOffset(double time_ms, bool is_utc) = 0;
|
||||
|
||||
// Called when the local timezone changes
|
||||
virtual void Clear() = 0;
|
||||
|
21
deps/v8/src/base/utils/random-number-generator.h
vendored
21
deps/v8/src/base/utils/random-number-generator.h
vendored
@ -50,9 +50,7 @@ class V8_BASE_EXPORT RandomNumberGenerator final {
|
||||
// that one int value is pseudorandomly generated and returned.
|
||||
// All 2^32 possible integer values are produced with (approximately) equal
|
||||
// probability.
|
||||
V8_INLINE int NextInt() WARN_UNUSED_RESULT {
|
||||
return Next(32);
|
||||
}
|
||||
V8_INLINE int NextInt() V8_WARN_UNUSED_RESULT { return Next(32); }
|
||||
|
||||
// Returns a pseudorandom, uniformly distributed int value between 0
|
||||
// (inclusive) and the specified max value (exclusive), drawn from this random
|
||||
@ -60,30 +58,28 @@ class V8_BASE_EXPORT RandomNumberGenerator final {
|
||||
// one int value in the specified range is pseudorandomly generated and
|
||||
// returned. All max possible int values are produced with (approximately)
|
||||
// equal probability.
|
||||
int NextInt(int max) WARN_UNUSED_RESULT;
|
||||
int NextInt(int max) V8_WARN_UNUSED_RESULT;
|
||||
|
||||
// Returns the next pseudorandom, uniformly distributed boolean value from
|
||||
// this random number generator's sequence. The general contract of
|
||||
// |NextBoolean()| is that one boolean value is pseudorandomly generated and
|
||||
// returned. The values true and false are produced with (approximately) equal
|
||||
// probability.
|
||||
V8_INLINE bool NextBool() WARN_UNUSED_RESULT {
|
||||
return Next(1) != 0;
|
||||
}
|
||||
V8_INLINE bool NextBool() V8_WARN_UNUSED_RESULT { return Next(1) != 0; }
|
||||
|
||||
// Returns the next pseudorandom, uniformly distributed double value between
|
||||
// 0.0 and 1.0 from this random number generator's sequence.
|
||||
// The general contract of |NextDouble()| is that one double value, chosen
|
||||
// (approximately) uniformly from the range 0.0 (inclusive) to 1.0
|
||||
// (exclusive), is pseudorandomly generated and returned.
|
||||
double NextDouble() WARN_UNUSED_RESULT;
|
||||
double NextDouble() V8_WARN_UNUSED_RESULT;
|
||||
|
||||
// Returns the next pseudorandom, uniformly distributed int64 value from this
|
||||
// random number generator's sequence. The general contract of |NextInt64()|
|
||||
// is that one 64-bit int value is pseudorandomly generated and returned.
|
||||
// All 2^64 possible integer values are produced with (approximately) equal
|
||||
// probability.
|
||||
int64_t NextInt64() WARN_UNUSED_RESULT;
|
||||
int64_t NextInt64() V8_WARN_UNUSED_RESULT;
|
||||
|
||||
// Fills the elements of a specified array of bytes with random numbers.
|
||||
void NextBytes(void* buffer, size_t buflen);
|
||||
@ -91,7 +87,8 @@ class V8_BASE_EXPORT RandomNumberGenerator final {
|
||||
// Returns the next pseudorandom set of n unique uint64 values smaller than
|
||||
// max.
|
||||
// n must be less or equal to max.
|
||||
std::vector<uint64_t> NextSample(uint64_t max, size_t n) WARN_UNUSED_RESULT;
|
||||
std::vector<uint64_t> NextSample(uint64_t max,
|
||||
size_t n) V8_WARN_UNUSED_RESULT;
|
||||
|
||||
// Returns the next pseudorandom set of n unique uint64 values smaller than
|
||||
// max.
|
||||
@ -103,7 +100,7 @@ class V8_BASE_EXPORT RandomNumberGenerator final {
|
||||
std::vector<uint64_t> NextSampleSlow(
|
||||
uint64_t max, size_t n,
|
||||
const std::unordered_set<uint64_t>& excluded =
|
||||
std::unordered_set<uint64_t>{}) WARN_UNUSED_RESULT;
|
||||
std::unordered_set<uint64_t>{}) V8_WARN_UNUSED_RESULT;
|
||||
|
||||
// Override the current ssed.
|
||||
void SetSeed(int64_t seed);
|
||||
@ -136,7 +133,7 @@ class V8_BASE_EXPORT RandomNumberGenerator final {
|
||||
static const int64_t kAddend = 0xb;
|
||||
static const int64_t kMask = V8_2PART_UINT64_C(0xffff, ffffffff);
|
||||
|
||||
int Next(int bits) WARN_UNUSED_RESULT;
|
||||
int Next(int bits) V8_WARN_UNUSED_RESULT;
|
||||
|
||||
static uint64_t MurmurHash3(uint64_t);
|
||||
|
||||
|
284
deps/v8/src/bootstrapper.cc
vendored
284
deps/v8/src/bootstrapper.cc
vendored
@ -356,28 +356,21 @@ void Bootstrapper::DetachGlobal(Handle<Context> env) {
|
||||
|
||||
namespace {
|
||||
|
||||
// Non-construct case.
|
||||
V8_NOINLINE Handle<SharedFunctionInfo> SimpleCreateSharedFunctionInfo(
|
||||
Isolate* isolate, Builtins::Name builtin_id, Handle<String> name, int len) {
|
||||
Handle<Code> code = isolate->builtins()->builtin_handle(builtin_id);
|
||||
const bool kNotConstructor = false;
|
||||
Handle<SharedFunctionInfo> shared = isolate->factory()->NewSharedFunctionInfo(
|
||||
name, code, kNotConstructor, kNormalFunction, builtin_id);
|
||||
Handle<SharedFunctionInfo> shared =
|
||||
isolate->factory()->NewSharedFunctionInfoForBuiltin(name, builtin_id,
|
||||
kNormalFunction);
|
||||
shared->set_internal_formal_parameter_count(len);
|
||||
shared->set_length(len);
|
||||
return shared;
|
||||
}
|
||||
|
||||
// Construct case.
|
||||
V8_NOINLINE Handle<SharedFunctionInfo>
|
||||
SimpleCreateConstructorSharedFunctionInfo(Isolate* isolate,
|
||||
Builtins::Name builtin_id,
|
||||
Handle<String> name, int len) {
|
||||
Handle<Code> code = isolate->builtins()->builtin_handle(builtin_id);
|
||||
const bool kIsConstructor = true;
|
||||
Handle<SharedFunctionInfo> shared = isolate->factory()->NewSharedFunctionInfo(
|
||||
name, code, kIsConstructor, kNormalFunction, builtin_id);
|
||||
shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub));
|
||||
V8_NOINLINE Handle<SharedFunctionInfo> SimpleCreateBuiltinSharedFunctionInfo(
|
||||
Isolate* isolate, Builtins::Name builtin_id, Handle<String> name, int len) {
|
||||
Handle<SharedFunctionInfo> shared =
|
||||
isolate->factory()->NewSharedFunctionInfoForBuiltin(name, builtin_id,
|
||||
kNormalFunction);
|
||||
shared->set_internal_formal_parameter_count(len);
|
||||
shared->set_length(len);
|
||||
return shared;
|
||||
@ -402,14 +395,13 @@ V8_NOINLINE Handle<JSFunction> CreateFunction(
|
||||
Isolate* isolate, Handle<String> name, InstanceType type, int instance_size,
|
||||
int inobject_properties, MaybeHandle<Object> maybe_prototype,
|
||||
Builtins::Name builtin_id) {
|
||||
Handle<Code> code(isolate->builtins()->builtin(builtin_id));
|
||||
Handle<Object> prototype;
|
||||
Handle<JSFunction> result;
|
||||
|
||||
if (maybe_prototype.ToHandle(&prototype)) {
|
||||
NewFunctionArgs args = NewFunctionArgs::ForBuiltinWithPrototype(
|
||||
name, code, prototype, type, instance_size, inobject_properties,
|
||||
builtin_id, IMMUTABLE);
|
||||
name, prototype, type, instance_size, inobject_properties, builtin_id,
|
||||
IMMUTABLE);
|
||||
|
||||
result = isolate->factory()->NewFunction(args);
|
||||
// Make the JSFunction's prototype object fast.
|
||||
@ -417,7 +409,7 @@ V8_NOINLINE Handle<JSFunction> CreateFunction(
|
||||
kStartAtReceiver, isolate);
|
||||
} else {
|
||||
NewFunctionArgs args = NewFunctionArgs::ForBuiltinWithoutPrototype(
|
||||
name, code, builtin_id, LanguageMode::kStrict);
|
||||
name, builtin_id, LanguageMode::kStrict);
|
||||
result = isolate->factory()->NewFunction(args);
|
||||
}
|
||||
|
||||
@ -608,20 +600,18 @@ Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) {
|
||||
|
||||
// Allocate the empty function as the prototype for function according to
|
||||
// ES#sec-properties-of-the-function-prototype-object
|
||||
Handle<Code> code(BUILTIN_CODE(isolate, EmptyFunction));
|
||||
NewFunctionArgs args =
|
||||
NewFunctionArgs::ForBuiltin(factory->empty_string(), code,
|
||||
empty_function_map, Builtins::kEmptyFunction);
|
||||
NewFunctionArgs args = NewFunctionArgs::ForBuiltin(
|
||||
factory->empty_string(), empty_function_map, Builtins::kEmptyFunction);
|
||||
Handle<JSFunction> empty_function = factory->NewFunction(args);
|
||||
|
||||
// --- E m p t y ---
|
||||
Handle<String> source = factory->NewStringFromStaticChars("() {}");
|
||||
Handle<Script> script = factory->NewScript(source);
|
||||
script->set_type(Script::TYPE_NATIVE);
|
||||
Handle<FixedArray> infos = factory->NewFixedArray(2);
|
||||
Handle<WeakFixedArray> infos = factory->NewWeakFixedArray(2);
|
||||
script->set_shared_function_infos(*infos);
|
||||
empty_function->shared()->set_start_position(0);
|
||||
empty_function->shared()->set_end_position(source->length());
|
||||
empty_function->shared()->set_raw_start_position(0);
|
||||
empty_function->shared()->set_raw_end_position(source->length());
|
||||
empty_function->shared()->set_function_literal_id(1);
|
||||
empty_function->shared()->DontAdaptArguments();
|
||||
SharedFunctionInfo::SetScript(handle(empty_function->shared()), script);
|
||||
@ -663,9 +653,8 @@ Handle<JSFunction> Genesis::GetThrowTypeErrorIntrinsic() {
|
||||
return restricted_properties_thrower_;
|
||||
}
|
||||
Handle<String> name(factory()->empty_string());
|
||||
Handle<Code> code = BUILTIN_CODE(isolate(), StrictPoisonPillThrower);
|
||||
NewFunctionArgs args = NewFunctionArgs::ForBuiltinWithoutPrototype(
|
||||
name, code, Builtins::kStrictPoisonPillThrower, i::LanguageMode::kStrict);
|
||||
name, Builtins::kStrictPoisonPillThrower, i::LanguageMode::kStrict);
|
||||
Handle<JSFunction> function = factory()->NewFunction(args);
|
||||
function->shared()->DontAdaptArguments();
|
||||
|
||||
@ -761,8 +750,6 @@ void Genesis::CreateObjectFunction(Handle<JSFunction> empty_function) {
|
||||
inobject_properties, factory->null_value(), Builtins::kObjectConstructor);
|
||||
object_fun->shared()->set_length(1);
|
||||
object_fun->shared()->DontAdaptArguments();
|
||||
object_fun->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate_, ObjectConstructor_ConstructStub));
|
||||
native_context()->set_object_function(*object_fun);
|
||||
|
||||
{
|
||||
@ -1228,11 +1215,10 @@ Handle<JSGlobalObject> Genesis::CreateNewGlobals(
|
||||
|
||||
if (js_global_object_template.is_null()) {
|
||||
Handle<String> name(factory()->empty_string());
|
||||
Handle<Code> code = BUILTIN_CODE(isolate(), Illegal);
|
||||
Handle<JSObject> prototype =
|
||||
factory()->NewFunctionPrototype(isolate()->object_function());
|
||||
NewFunctionArgs args = NewFunctionArgs::ForBuiltinWithPrototype(
|
||||
name, code, prototype, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize, 0,
|
||||
name, prototype, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize, 0,
|
||||
Builtins::kIllegal, MUTABLE);
|
||||
js_global_object_function = factory()->NewFunction(args);
|
||||
#ifdef DEBUG
|
||||
@ -1261,9 +1247,8 @@ Handle<JSGlobalObject> Genesis::CreateNewGlobals(
|
||||
Handle<JSFunction> global_proxy_function;
|
||||
if (global_proxy_template.IsEmpty()) {
|
||||
Handle<String> name(factory()->empty_string());
|
||||
Handle<Code> code = BUILTIN_CODE(isolate(), Illegal);
|
||||
NewFunctionArgs args = NewFunctionArgs::ForBuiltinWithPrototype(
|
||||
name, code, factory()->the_hole_value(), JS_GLOBAL_PROXY_TYPE,
|
||||
name, factory()->the_hole_value(), JS_GLOBAL_PROXY_TYPE,
|
||||
JSGlobalProxy::SizeWithEmbedderFields(0), 0, Builtins::kIllegal,
|
||||
MUTABLE);
|
||||
global_proxy_function = factory()->NewFunction(args);
|
||||
@ -1343,8 +1328,6 @@ static void InstallError(Isolate* isolate, Handle<JSObject> global,
|
||||
global, name, JS_ERROR_TYPE, JSObject::kHeaderSize, 0,
|
||||
factory->the_hole_value(), Builtins::kErrorConstructor, DONT_ENUM);
|
||||
error_fun->shared()->DontAdaptArguments();
|
||||
error_fun->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate, ErrorConstructor));
|
||||
error_fun->shared()->set_length(1);
|
||||
|
||||
if (context_index == Context::ERROR_FUNCTION_INDEX) {
|
||||
@ -1399,11 +1382,9 @@ static void InstallError(Isolate* isolate, Handle<JSObject> global,
|
||||
namespace {
|
||||
|
||||
void InstallMakeError(Isolate* isolate, int builtin_id, int context_index) {
|
||||
Handle<Code> code(isolate->builtins()->builtin(builtin_id));
|
||||
NewFunctionArgs args = NewFunctionArgs::ForBuiltinWithPrototype(
|
||||
isolate->factory()->empty_string(), code,
|
||||
isolate->factory()->the_hole_value(), JS_OBJECT_TYPE,
|
||||
JSObject::kHeaderSize, 0, builtin_id, MUTABLE);
|
||||
isolate->factory()->empty_string(), isolate->factory()->the_hole_value(),
|
||||
JS_OBJECT_TYPE, JSObject::kHeaderSize, 0, builtin_id, MUTABLE);
|
||||
|
||||
Handle<JSFunction> function = isolate->factory()->NewFunction(args);
|
||||
function->shared()->DontAdaptArguments();
|
||||
@ -1553,8 +1534,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
// Function instances are sloppy by default.
|
||||
function_fun->set_prototype_or_initial_map(*isolate->sloppy_function_map());
|
||||
function_fun->shared()->DontAdaptArguments();
|
||||
function_fun->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate, FunctionConstructor));
|
||||
function_fun->shared()->set_length(1);
|
||||
InstallWithIntrinsicDefaultProto(isolate, function_fun,
|
||||
Context::FUNCTION_FUNCTION_INDEX);
|
||||
@ -1626,6 +1605,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
PropertyAttributes attribs = static_cast<PropertyAttributes>(
|
||||
DONT_ENUM | DONT_DELETE);
|
||||
|
||||
STATIC_ASSERT(JSArray::kLengthDescriptorIndex == 0);
|
||||
{ // Add length.
|
||||
Descriptor d = Descriptor::AccessorConstant(
|
||||
factory->length_string(), factory->array_length_accessor(), attribs);
|
||||
@ -1638,9 +1618,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
|
||||
// Cache the array maps, needed by ArrayConstructorStub
|
||||
CacheInitialJSArrayMaps(native_context(), initial_map);
|
||||
ArrayConstructorStub array_constructor_stub(isolate);
|
||||
Handle<Code> code = array_constructor_stub.GetCode();
|
||||
array_function->shared()->SetConstructStub(*code);
|
||||
|
||||
// Set up %ArrayPrototype%.
|
||||
// The %ArrayPrototype% has TERMINAL_FAST_ELEMENTS_KIND in order to ensure
|
||||
@ -1673,12 +1650,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
SimpleInstallFunction(proto, "shift", Builtins::kArrayPrototypeShift, 0,
|
||||
false);
|
||||
SimpleInstallFunction(proto, "unshift", Builtins::kArrayUnshift, 1, false);
|
||||
if (FLAG_enable_experimental_builtins) {
|
||||
SimpleInstallFunction(proto, "slice", Builtins::kArrayPrototypeSlice, 2,
|
||||
false);
|
||||
} else {
|
||||
SimpleInstallFunction(proto, "slice", Builtins::kArraySlice, 2, false);
|
||||
}
|
||||
SimpleInstallFunction(proto, "slice", Builtins::kArrayPrototypeSlice, 2,
|
||||
false);
|
||||
SimpleInstallFunction(proto, "splice", Builtins::kArraySplice, 2, false);
|
||||
SimpleInstallFunction(proto, "includes", Builtins::kArrayIncludes, 1,
|
||||
false);
|
||||
@ -1717,73 +1690,16 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
Builtins::kArrayIteratorPrototypeNext, 0, true,
|
||||
kArrayIteratorNext);
|
||||
|
||||
Handle<JSFunction> array_iterator_function = CreateFunction(
|
||||
isolate, factory->ArrayIterator_string(),
|
||||
JS_FAST_ARRAY_VALUE_ITERATOR_TYPE, JSArrayIterator::kSize, 0,
|
||||
array_iterator_prototype, Builtins::kIllegal);
|
||||
Handle<JSFunction> array_iterator_function =
|
||||
CreateFunction(isolate, factory->ArrayIterator_string(),
|
||||
JS_ARRAY_ITERATOR_TYPE, JSArrayIterator::kSize, 0,
|
||||
array_iterator_prototype, Builtins::kIllegal);
|
||||
array_iterator_function->shared()->set_native(false);
|
||||
|
||||
native_context()->set_initial_array_iterator_map(
|
||||
array_iterator_function->initial_map());
|
||||
native_context()->set_initial_array_iterator_prototype(
|
||||
*array_iterator_prototype);
|
||||
native_context()->set_initial_array_iterator_prototype_map(
|
||||
array_iterator_prototype->map());
|
||||
|
||||
Handle<Map> initial_map(array_iterator_function->initial_map(), isolate);
|
||||
|
||||
#define ARRAY_ITERATOR_LIST(V) \
|
||||
V(TYPED_ARRAY, KEY, typed_array, key) \
|
||||
V(FAST_ARRAY, KEY, fast_array, key) \
|
||||
V(GENERIC_ARRAY, KEY, array, key) \
|
||||
V(UINT8_ARRAY, KEY_VALUE, uint8_array, key_value) \
|
||||
V(INT8_ARRAY, KEY_VALUE, int8_array, key_value) \
|
||||
V(UINT16_ARRAY, KEY_VALUE, uint16_array, key_value) \
|
||||
V(INT16_ARRAY, KEY_VALUE, int16_array, key_value) \
|
||||
V(UINT32_ARRAY, KEY_VALUE, uint32_array, key_value) \
|
||||
V(INT32_ARRAY, KEY_VALUE, int32_array, key_value) \
|
||||
V(FLOAT32_ARRAY, KEY_VALUE, float32_array, key_value) \
|
||||
V(FLOAT64_ARRAY, KEY_VALUE, float64_array, key_value) \
|
||||
V(UINT8_CLAMPED_ARRAY, KEY_VALUE, uint8_clamped_array, key_value) \
|
||||
V(BIGUINT64_ARRAY, KEY_VALUE, biguint64_array, key_value) \
|
||||
V(BIGINT64_ARRAY, KEY_VALUE, bigint64_array, key_value) \
|
||||
V(FAST_SMI_ARRAY, KEY_VALUE, fast_smi_array, key_value) \
|
||||
V(FAST_HOLEY_SMI_ARRAY, KEY_VALUE, fast_holey_smi_array, key_value) \
|
||||
V(FAST_ARRAY, KEY_VALUE, fast_array, key_value) \
|
||||
V(FAST_HOLEY_ARRAY, KEY_VALUE, fast_holey_array, key_value) \
|
||||
V(FAST_DOUBLE_ARRAY, KEY_VALUE, fast_double_array, key_value) \
|
||||
V(FAST_HOLEY_DOUBLE_ARRAY, KEY_VALUE, fast_holey_double_array, key_value) \
|
||||
V(GENERIC_ARRAY, KEY_VALUE, array, key_value) \
|
||||
V(UINT8_ARRAY, VALUE, uint8_array, value) \
|
||||
V(INT8_ARRAY, VALUE, int8_array, value) \
|
||||
V(UINT16_ARRAY, VALUE, uint16_array, value) \
|
||||
V(INT16_ARRAY, VALUE, int16_array, value) \
|
||||
V(UINT32_ARRAY, VALUE, uint32_array, value) \
|
||||
V(INT32_ARRAY, VALUE, int32_array, value) \
|
||||
V(FLOAT32_ARRAY, VALUE, float32_array, value) \
|
||||
V(FLOAT64_ARRAY, VALUE, float64_array, value) \
|
||||
V(UINT8_CLAMPED_ARRAY, VALUE, uint8_clamped_array, value) \
|
||||
V(BIGUINT64_ARRAY, VALUE, biguint64_array, value) \
|
||||
V(BIGINT64_ARRAY, VALUE, bigint64_array, value) \
|
||||
V(FAST_SMI_ARRAY, VALUE, fast_smi_array, value) \
|
||||
V(FAST_HOLEY_SMI_ARRAY, VALUE, fast_holey_smi_array, value) \
|
||||
V(FAST_ARRAY, VALUE, fast_array, value) \
|
||||
V(FAST_HOLEY_ARRAY, VALUE, fast_holey_array, value) \
|
||||
V(FAST_DOUBLE_ARRAY, VALUE, fast_double_array, value) \
|
||||
V(FAST_HOLEY_DOUBLE_ARRAY, VALUE, fast_holey_double_array, value) \
|
||||
V(GENERIC_ARRAY, VALUE, array, value)
|
||||
|
||||
#define CREATE_ARRAY_ITERATOR_MAP(PREFIX, SUFFIX, prefix, suffix) \
|
||||
do { \
|
||||
const InstanceType type = JS_##PREFIX##_##SUFFIX##_ITERATOR_TYPE; \
|
||||
Handle<Map> map = \
|
||||
Map::Copy(initial_map, "JS_" #PREFIX "_" #SUFFIX "_ITERATOR_TYPE"); \
|
||||
map->set_instance_type(type); \
|
||||
native_context()->set_##prefix##_##suffix##_iterator_map(*map); \
|
||||
} while (0);
|
||||
|
||||
ARRAY_ITERATOR_LIST(CREATE_ARRAY_ITERATOR_MAP)
|
||||
|
||||
#undef CREATE_ARRAY_ITERATOR_MAP
|
||||
#undef ARRAY_ITERATOR_LIST
|
||||
}
|
||||
|
||||
{ // --- N u m b e r ---
|
||||
@ -1792,8 +1708,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
isolate->initial_object_prototype(), Builtins::kNumberConstructor);
|
||||
number_fun->shared()->set_builtin_function_id(kNumberConstructor);
|
||||
number_fun->shared()->DontAdaptArguments();
|
||||
number_fun->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate, NumberConstructor_ConstructStub));
|
||||
number_fun->shared()->set_length(1);
|
||||
InstallWithIntrinsicDefaultProto(isolate, number_fun,
|
||||
Context::NUMBER_FUNCTION_INDEX);
|
||||
@ -1908,8 +1822,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
global, "Boolean", JS_VALUE_TYPE, JSValue::kSize, 0,
|
||||
isolate->initial_object_prototype(), Builtins::kBooleanConstructor);
|
||||
boolean_fun->shared()->DontAdaptArguments();
|
||||
boolean_fun->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate, BooleanConstructor_ConstructStub));
|
||||
boolean_fun->shared()->set_length(1);
|
||||
InstallWithIntrinsicDefaultProto(isolate, boolean_fun,
|
||||
Context::BOOLEAN_FUNCTION_INDEX);
|
||||
@ -1936,8 +1848,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
global, "String", JS_VALUE_TYPE, JSValue::kSize, 0,
|
||||
isolate->initial_object_prototype(), Builtins::kStringConstructor);
|
||||
string_fun->shared()->set_builtin_function_id(kStringConstructor);
|
||||
string_fun->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate, StringConstructor_ConstructStub));
|
||||
string_fun->shared()->DontAdaptArguments();
|
||||
string_fun->shared()->set_length(1);
|
||||
InstallWithIntrinsicDefaultProto(isolate, string_fun,
|
||||
@ -2118,8 +2028,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
global, "Symbol", JS_VALUE_TYPE, JSValue::kSize, 0,
|
||||
factory->the_hole_value(), Builtins::kSymbolConstructor);
|
||||
symbol_fun->shared()->set_builtin_function_id(kSymbolConstructor);
|
||||
symbol_fun->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate, SymbolConstructor_ConstructStub));
|
||||
symbol_fun->shared()->set_length(0);
|
||||
symbol_fun->shared()->DontAdaptArguments();
|
||||
native_context()->set_symbol_function(*symbol_fun);
|
||||
@ -2186,8 +2094,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
factory->the_hole_value(), Builtins::kDateConstructor);
|
||||
InstallWithIntrinsicDefaultProto(isolate, date_fun,
|
||||
Context::DATE_FUNCTION_INDEX);
|
||||
date_fun->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate, DateConstructor_ConstructStub));
|
||||
date_fun->shared()->set_length(7);
|
||||
date_fun->shared()->DontAdaptArguments();
|
||||
|
||||
@ -2311,7 +2217,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
}
|
||||
|
||||
{
|
||||
Handle<SharedFunctionInfo> info = SimpleCreateConstructorSharedFunctionInfo(
|
||||
Handle<SharedFunctionInfo> info = SimpleCreateBuiltinSharedFunctionInfo(
|
||||
isolate, Builtins::kPromiseGetCapabilitiesExecutor,
|
||||
factory->empty_string(), 2);
|
||||
native_context()->set_promise_get_capabilities_executor_shared_fun(*info);
|
||||
@ -2325,7 +2231,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
Context::PROMISE_FUNCTION_INDEX);
|
||||
|
||||
Handle<SharedFunctionInfo> shared(promise_fun->shared(), isolate);
|
||||
shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub));
|
||||
shared->set_internal_formal_parameter_count(1);
|
||||
shared->set_length(1);
|
||||
|
||||
@ -2422,7 +2327,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
Context::REGEXP_FUNCTION_INDEX);
|
||||
|
||||
Handle<SharedFunctionInfo> shared(regexp_fun->shared(), isolate);
|
||||
shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub));
|
||||
shared->set_internal_formal_parameter_count(2);
|
||||
shared->set_length(2);
|
||||
|
||||
@ -2649,8 +2553,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
}
|
||||
|
||||
// Initialize the embedder data slot.
|
||||
Handle<FixedArray> embedder_data = factory->NewFixedArray(3);
|
||||
native_context()->set_embedder_data(*embedder_data);
|
||||
native_context()->set_embedder_data(*factory->empty_fixed_array());
|
||||
|
||||
{ // -- J S O N
|
||||
Handle<String> name = factory->InternalizeUtf8String("JSON");
|
||||
@ -2927,11 +2830,12 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
}
|
||||
|
||||
{ // -- T y p e d A r r a y
|
||||
Handle<JSFunction> typed_array_fun =
|
||||
CreateFunction(isolate, factory->InternalizeUtf8String("TypedArray"),
|
||||
JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize, 0,
|
||||
factory->the_hole_value(), Builtins::kIllegal);
|
||||
Handle<JSFunction> typed_array_fun = CreateFunction(
|
||||
isolate, factory->InternalizeUtf8String("TypedArray"),
|
||||
JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize, 0, factory->the_hole_value(),
|
||||
Builtins::kTypedArrayBaseConstructor);
|
||||
typed_array_fun->shared()->set_native(false);
|
||||
typed_array_fun->shared()->set_length(0);
|
||||
InstallSpeciesGetter(typed_array_fun);
|
||||
native_context()->set_typed_array_function(*typed_array_fun);
|
||||
|
||||
@ -3034,8 +2938,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
Builtins::kDataViewConstructor);
|
||||
InstallWithIntrinsicDefaultProto(isolate, data_view_fun,
|
||||
Context::DATA_VIEW_FUN_INDEX);
|
||||
data_view_fun->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate, DataViewConstructor_ConstructStub));
|
||||
data_view_fun->shared()->set_length(3);
|
||||
data_view_fun->shared()->DontAdaptArguments();
|
||||
|
||||
@ -3114,7 +3016,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
Context::JS_MAP_FUN_INDEX);
|
||||
|
||||
Handle<SharedFunctionInfo> shared(js_map_fun->shared(), isolate);
|
||||
shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub));
|
||||
shared->DontAdaptArguments();
|
||||
shared->set_length(0);
|
||||
|
||||
@ -3172,7 +3073,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
Context::JS_SET_FUN_INDEX);
|
||||
|
||||
Handle<SharedFunctionInfo> shared(js_set_fun->shared(), isolate);
|
||||
shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub));
|
||||
shared->DontAdaptArguments();
|
||||
shared->set_length(0);
|
||||
|
||||
@ -3268,7 +3168,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
Context::JS_WEAK_MAP_FUN_INDEX);
|
||||
|
||||
Handle<SharedFunctionInfo> shared(cons->shared(), isolate);
|
||||
shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub));
|
||||
shared->DontAdaptArguments();
|
||||
shared->set_length(0);
|
||||
|
||||
@ -3299,7 +3198,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
Context::JS_WEAK_SET_FUN_INDEX);
|
||||
|
||||
Handle<SharedFunctionInfo> shared(cons->shared(), isolate);
|
||||
shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub));
|
||||
shared->DontAdaptArguments();
|
||||
shared->set_length(0);
|
||||
|
||||
@ -3340,17 +3238,14 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
proxy_function_map->SetInObjectUnusedPropertyFields(unused_property_fields);
|
||||
|
||||
Handle<String> name = factory->Proxy_string();
|
||||
Handle<Code> code(BUILTIN_CODE(isolate, ProxyConstructor));
|
||||
|
||||
NewFunctionArgs args = NewFunctionArgs::ForBuiltin(
|
||||
name, code, proxy_function_map, Builtins::kProxyConstructor);
|
||||
name, proxy_function_map, Builtins::kProxyConstructor);
|
||||
Handle<JSFunction> proxy_function = factory->NewFunction(args);
|
||||
|
||||
JSFunction::SetInitialMap(proxy_function, isolate->proxy_map(),
|
||||
factory->null_value());
|
||||
|
||||
proxy_function->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate, ProxyConstructor_ConstructStub));
|
||||
proxy_function->shared()->set_internal_formal_parameter_count(2);
|
||||
proxy_function->shared()->set_length(2);
|
||||
|
||||
@ -3447,9 +3342,9 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
{ // --- sloppy arguments map
|
||||
Handle<String> arguments_string = factory->Arguments_string();
|
||||
NewFunctionArgs args = NewFunctionArgs::ForBuiltinWithPrototype(
|
||||
arguments_string, BUILTIN_CODE(isolate, Illegal),
|
||||
isolate->initial_object_prototype(), JS_ARGUMENTS_TYPE,
|
||||
JSSloppyArgumentsObject::kSize, 2, Builtins::kIllegal, MUTABLE);
|
||||
arguments_string, isolate->initial_object_prototype(),
|
||||
JS_ARGUMENTS_TYPE, JSSloppyArgumentsObject::kSize, 2,
|
||||
Builtins::kIllegal, MUTABLE);
|
||||
Handle<JSFunction> function = factory->NewFunction(args);
|
||||
Handle<Map> map(function->initial_map());
|
||||
|
||||
@ -3577,8 +3472,6 @@ Handle<JSFunction> Genesis::InstallTypedArray(const char* name,
|
||||
|
||||
result->shared()->DontAdaptArguments();
|
||||
result->shared()->set_length(3);
|
||||
result->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate_, TypedArrayConstructor_ConstructStub));
|
||||
|
||||
CHECK(JSObject::SetPrototype(result, typed_array_function, false, kDontThrow)
|
||||
.FromJust());
|
||||
@ -3853,8 +3746,6 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
|
||||
generator_function_function->set_prototype_or_initial_map(
|
||||
native_context->generator_function_map());
|
||||
generator_function_function->shared()->DontAdaptArguments();
|
||||
generator_function_function->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate, GeneratorFunctionConstructor));
|
||||
generator_function_function->shared()->set_length(1);
|
||||
InstallWithIntrinsicDefaultProto(
|
||||
isolate, generator_function_function,
|
||||
@ -3883,8 +3774,6 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
|
||||
async_generator_function_function->set_prototype_or_initial_map(
|
||||
native_context->async_generator_function_map());
|
||||
async_generator_function_function->shared()->DontAdaptArguments();
|
||||
async_generator_function_function->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate, AsyncGeneratorFunctionConstructor));
|
||||
async_generator_function_function->shared()->set_length(1);
|
||||
InstallWithIntrinsicDefaultProto(
|
||||
isolate, async_generator_function_function,
|
||||
@ -4096,8 +3985,6 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
|
||||
async_function_constructor->set_prototype_or_initial_map(
|
||||
native_context->async_function_map());
|
||||
async_function_constructor->shared()->DontAdaptArguments();
|
||||
async_function_constructor->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate, AsyncFunctionConstructor));
|
||||
async_function_constructor->shared()->set_length(1);
|
||||
native_context->set_async_function_constructor(*async_function_constructor);
|
||||
JSObject::ForceSetPrototype(async_function_constructor,
|
||||
@ -4214,6 +4101,9 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_import_meta)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrict_constructor_return)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_optional_catch_binding)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_subsume_json)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_numeric_separator)
|
||||
|
||||
#undef EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE
|
||||
|
||||
void InstallPublicSymbol(Factory* factory, Handle<Context> native_context,
|
||||
const char* name, Handle<Symbol> value) {
|
||||
@ -4269,7 +4159,7 @@ void Genesis::InitializeGlobal_harmony_string_trimming() {
|
||||
.ToHandleChecked());
|
||||
JSObject::AddProperty(string_prototype, trim_start_name, trim_left_fun,
|
||||
DONT_ENUM);
|
||||
trim_left_fun->shared()->set_name(*trim_start_name);
|
||||
trim_left_fun->shared()->SetName(*trim_start_name);
|
||||
}
|
||||
|
||||
{
|
||||
@ -4281,7 +4171,7 @@ void Genesis::InitializeGlobal_harmony_string_trimming() {
|
||||
.ToHandleChecked());
|
||||
JSObject::AddProperty(string_prototype, trim_end_name, trim_right_fun,
|
||||
DONT_ENUM);
|
||||
trim_right_fun->shared()->set_name(*trim_end_name);
|
||||
trim_right_fun->shared()->SetName(*trim_end_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4306,6 +4196,75 @@ void Genesis::InitializeGlobal_harmony_array_prototype_values() {
|
||||
NONE);
|
||||
}
|
||||
|
||||
void Genesis::InitializeGlobal_harmony_array_flatten() {
|
||||
if (!FLAG_harmony_array_flatten) return;
|
||||
Handle<JSFunction> array_constructor(native_context()->array_function());
|
||||
Handle<JSObject> array_prototype(
|
||||
JSObject::cast(array_constructor->instance_prototype()));
|
||||
SimpleInstallFunction(array_prototype, "flatten",
|
||||
Builtins::kArrayPrototypeFlatten, 0, false, DONT_ENUM);
|
||||
SimpleInstallFunction(array_prototype, "flatMap",
|
||||
Builtins::kArrayPrototypeFlatMap, 1, false, DONT_ENUM);
|
||||
}
|
||||
|
||||
void Genesis::InitializeGlobal_harmony_string_matchall() {
|
||||
if (!FLAG_harmony_string_matchall) return;
|
||||
|
||||
{ // String.prototype.matchAll
|
||||
Handle<JSFunction> string_fun(native_context()->string_function());
|
||||
Handle<JSObject> string_prototype(
|
||||
JSObject::cast(string_fun->instance_prototype()));
|
||||
|
||||
SimpleInstallFunction(string_prototype, "matchAll",
|
||||
Builtins::kStringPrototypeMatchAll, 1, true);
|
||||
}
|
||||
|
||||
{ // RegExp.prototype[@@matchAll]
|
||||
Handle<JSFunction> regexp_fun(native_context()->regexp_function());
|
||||
Handle<JSObject> regexp_prototype(
|
||||
JSObject::cast(regexp_fun->instance_prototype()));
|
||||
SimpleInstallFunction(regexp_prototype, factory()->match_all_symbol(),
|
||||
"[Symbol.matchAll]",
|
||||
Builtins::kRegExpPrototypeMatchAll, 1, true);
|
||||
Handle<Map> regexp_prototype_map(regexp_prototype->map());
|
||||
Map::SetShouldBeFastPrototypeMap(regexp_prototype_map, true, isolate());
|
||||
native_context()->set_regexp_prototype_map(*regexp_prototype_map);
|
||||
}
|
||||
|
||||
{ // --- R e g E x p S t r i n g I t e r a t o r ---
|
||||
Handle<JSObject> iterator_prototype(
|
||||
native_context()->initial_iterator_prototype());
|
||||
|
||||
Handle<JSObject> regexp_string_iterator_prototype =
|
||||
factory()->NewJSObject(isolate()->object_function(), TENURED);
|
||||
JSObject::ForceSetPrototype(regexp_string_iterator_prototype,
|
||||
iterator_prototype);
|
||||
|
||||
JSObject::AddProperty(
|
||||
regexp_string_iterator_prototype, factory()->to_string_tag_symbol(),
|
||||
factory()->NewStringFromAsciiChecked("RegExp String Iterator"),
|
||||
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
|
||||
|
||||
SimpleInstallFunction(regexp_string_iterator_prototype, "next",
|
||||
Builtins::kRegExpStringIteratorPrototypeNext, 0,
|
||||
true);
|
||||
|
||||
Handle<JSFunction> regexp_string_iterator_function = CreateFunction(
|
||||
isolate(), factory()->NewStringFromAsciiChecked("RegExpStringIterator"),
|
||||
JS_REGEXP_STRING_ITERATOR_TYPE, JSRegExpStringIterator::kSize, 0,
|
||||
regexp_string_iterator_prototype, Builtins::kIllegal);
|
||||
regexp_string_iterator_function->shared()->set_native(false);
|
||||
native_context()->set_initial_regexp_string_iterator_prototype_map_index(
|
||||
regexp_string_iterator_function->initial_map());
|
||||
}
|
||||
|
||||
{ // @@matchAll Symbol
|
||||
Handle<JSFunction> symbol_fun(native_context()->symbol_function());
|
||||
InstallConstant(isolate(), symbol_fun, "matchAll",
|
||||
factory()->match_all_symbol());
|
||||
}
|
||||
}
|
||||
|
||||
void Genesis::InitializeGlobal_harmony_promise_finally() {
|
||||
if (!FLAG_harmony_promise_finally) return;
|
||||
|
||||
@ -4368,8 +4327,6 @@ void Genesis::InitializeGlobal_harmony_bigint() {
|
||||
factory->the_hole_value(), Builtins::kBigIntConstructor);
|
||||
bigint_fun->shared()->set_builtin_function_id(kBigIntConstructor);
|
||||
bigint_fun->shared()->DontAdaptArguments();
|
||||
bigint_fun->shared()->SetConstructStub(
|
||||
*BUILTIN_CODE(isolate(), BigIntConstructor_ConstructStub));
|
||||
bigint_fun->shared()->set_length(1);
|
||||
InstallWithIntrinsicDefaultProto(isolate(), bigint_fun,
|
||||
Context::BIGINT_FUNCTION_INDEX);
|
||||
@ -4463,9 +4420,6 @@ Handle<JSFunction> Genesis::CreateArrayBuffer(
|
||||
CreateFunction(isolate(), name, JS_ARRAY_BUFFER_TYPE,
|
||||
JSArrayBuffer::kSizeWithEmbedderFields, 0, prototype,
|
||||
Builtins::kArrayBufferConstructor);
|
||||
Handle<Code> code =
|
||||
BUILTIN_CODE(isolate(), ArrayBufferConstructor_ConstructStub);
|
||||
array_buffer_fun->shared()->SetConstructStub(*code);
|
||||
array_buffer_fun->shared()->DontAdaptArguments();
|
||||
array_buffer_fun->shared()->set_length(1);
|
||||
|
||||
@ -4520,9 +4474,6 @@ Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target,
|
||||
InstallFunction(target, name, JS_ARRAY_TYPE, JSArray::kSize, 0, prototype,
|
||||
Builtins::kInternalArrayConstructor);
|
||||
|
||||
InternalArrayConstructorStub internal_array_constructor_stub(isolate());
|
||||
Handle<Code> code = internal_array_constructor_stub.GetCode();
|
||||
array_function->shared()->SetConstructStub(*code);
|
||||
array_function->shared()->DontAdaptArguments();
|
||||
|
||||
Handle<Map> original_map(array_function->initial_map());
|
||||
@ -5485,6 +5436,11 @@ Genesis::Genesis(
|
||||
|
||||
ConfigureUtilsObject(context_type);
|
||||
|
||||
// We created new functions, which may require debug instrumentation.
|
||||
if (isolate->debug()->is_active()) {
|
||||
isolate->debug()->InstallDebugBreakTrampoline();
|
||||
}
|
||||
|
||||
native_context()->ResetErrorsThrown();
|
||||
result_ = native_context();
|
||||
}
|
||||
|
2
deps/v8/src/bootstrapper.h
vendored
2
deps/v8/src/bootstrapper.h
vendored
@ -5,7 +5,7 @@
|
||||
#ifndef V8_BOOTSTRAPPER_H_
|
||||
#define V8_BOOTSTRAPPER_H_
|
||||
|
||||
#include "src/factory.h"
|
||||
#include "src/heap/factory.h"
|
||||
#include "src/objects/shared-function-info.h"
|
||||
#include "src/snapshot/natives.h"
|
||||
#include "src/visitors.h"
|
||||
|
6
deps/v8/src/boxed-float.h
vendored
6
deps/v8/src/boxed-float.h
vendored
@ -51,8 +51,7 @@ class Float32 {
|
||||
: bit_pattern_(bit_pattern) {}
|
||||
};
|
||||
|
||||
static_assert(IS_TRIVIALLY_COPYABLE(Float32),
|
||||
"Float32 should be trivially copyable");
|
||||
ASSERT_TRIVIALLY_COPYABLE(Float32);
|
||||
|
||||
// Safety wrapper for a 64-bit floating-point value to make sure we don't lose
|
||||
// the exact bit pattern during deoptimization when passing this value.
|
||||
@ -91,8 +90,7 @@ class Float64 {
|
||||
: bit_pattern_(bit_pattern) {}
|
||||
};
|
||||
|
||||
static_assert(IS_TRIVIALLY_COPYABLE(Float64),
|
||||
"Float64 should be trivially copyable");
|
||||
ASSERT_TRIVIALLY_COPYABLE(Float64);
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
319
deps/v8/src/builtins/arm/builtins-arm.cc
vendored
319
deps/v8/src/builtins/arm/builtins-arm.cc
vendored
@ -88,19 +88,6 @@ void Builtins::Generate_AdaptorWithBuiltinExitFrame(MacroAssembler* masm) {
|
||||
AdaptorWithExitFrameType(masm, BUILTIN_EXIT);
|
||||
}
|
||||
|
||||
// Load the built-in InternalArray function from the current context.
|
||||
static void GenerateLoadInternalArrayFunction(MacroAssembler* masm,
|
||||
Register result) {
|
||||
// Load the InternalArray function from the current native context.
|
||||
__ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result);
|
||||
}
|
||||
|
||||
// Load the built-in Array function from the current context.
|
||||
static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) {
|
||||
// Load the Array function from the current native context.
|
||||
__ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, result);
|
||||
}
|
||||
|
||||
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- r0 : number of arguments
|
||||
@ -109,9 +96,6 @@ void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
|
||||
// -----------------------------------
|
||||
Label generic_array_code, one_or_more_arguments, two_or_more_arguments;
|
||||
|
||||
// Get the InternalArray function.
|
||||
GenerateLoadInternalArrayFunction(masm, r1);
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
// Initial map for the builtin InternalArray functions should be maps.
|
||||
__ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset));
|
||||
@ -124,6 +108,7 @@ void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
|
||||
// Run the native code for the InternalArray function called as a normal
|
||||
// function.
|
||||
// tail call a stub
|
||||
__ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
|
||||
InternalArrayConstructorStub stub(masm->isolate());
|
||||
__ TailCallStub(&stub);
|
||||
}
|
||||
@ -131,27 +116,30 @@ void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
|
||||
void Builtins::Generate_ArrayConstructor(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- r0 : number of arguments
|
||||
// -- r1 : array function
|
||||
// -- lr : return address
|
||||
// -- sp[...]: constructor arguments
|
||||
// -----------------------------------
|
||||
Label generic_array_code, one_or_more_arguments, two_or_more_arguments;
|
||||
|
||||
// Get the Array function.
|
||||
GenerateLoadArrayFunction(masm, r1);
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
// Initial map for the builtin Array functions should be maps.
|
||||
__ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset));
|
||||
__ SmiTst(r2);
|
||||
__ ldr(r7, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset));
|
||||
__ SmiTst(r7);
|
||||
__ Assert(ne, AbortReason::kUnexpectedInitialMapForArrayFunction);
|
||||
__ CompareObjectType(r2, r3, r4, MAP_TYPE);
|
||||
__ CompareObjectType(r7, r8, r9, MAP_TYPE);
|
||||
__ Assert(eq, AbortReason::kUnexpectedInitialMapForArrayFunction);
|
||||
}
|
||||
|
||||
__ mov(r3, r1);
|
||||
// r2 is the AllocationSite - here undefined.
|
||||
__ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
|
||||
// If r3 (new target) is undefined, then this is the 'Call' case, so move
|
||||
// r1 (the constructor) to r3.
|
||||
__ cmp(r3, r2);
|
||||
__ mov(r3, r1, LeaveCC, eq);
|
||||
|
||||
// Run the native code for the Array function called as a normal function.
|
||||
// tail call a stub
|
||||
__ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
|
||||
ArrayConstructorStub stub(masm->isolate());
|
||||
__ TailCallStub(&stub);
|
||||
}
|
||||
@ -290,7 +278,7 @@ void Generate_JSConstructStubGeneric(MacroAssembler* masm,
|
||||
// -----------------------------------
|
||||
|
||||
__ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kCompilerHintsOffset));
|
||||
__ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kFlagsOffset));
|
||||
__ tst(r4, Operand(SharedFunctionInfo::IsDerivedConstructorBit::kMask));
|
||||
__ b(ne, ¬_create_implicit_receiver);
|
||||
|
||||
@ -410,7 +398,7 @@ void Generate_JSConstructStubGeneric(MacroAssembler* masm,
|
||||
__ bind(&other_result);
|
||||
__ ldr(r4, MemOperand(fp, ConstructFrameConstants::kConstructorOffset));
|
||||
__ ldr(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kCompilerHintsOffset));
|
||||
__ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kFlagsOffset));
|
||||
__ tst(r4, Operand(SharedFunctionInfo::IsClassConstructorBit::kMask));
|
||||
|
||||
if (restrict_constructor_return) {
|
||||
@ -453,13 +441,23 @@ void Builtins::Generate_JSConstructStubGenericUnrestrictedReturn(
|
||||
MacroAssembler* masm) {
|
||||
Generate_JSConstructStubGeneric(masm, false);
|
||||
}
|
||||
void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) {
|
||||
Generate_JSBuiltinsConstructStubHelper(masm);
|
||||
}
|
||||
void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) {
|
||||
Generate_JSBuiltinsConstructStubHelper(masm);
|
||||
}
|
||||
|
||||
static void GetSharedFunctionInfoBytecode(MacroAssembler* masm,
|
||||
Register sfi_data,
|
||||
Register scratch1) {
|
||||
Label done;
|
||||
|
||||
__ CompareObjectType(sfi_data, scratch1, scratch1, INTERPRETER_DATA_TYPE);
|
||||
__ b(ne, &done);
|
||||
__ ldr(sfi_data,
|
||||
FieldMemOperand(sfi_data, InterpreterData::kBytecodeArrayOffset));
|
||||
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
// static
|
||||
void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
@ -539,6 +537,7 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
|
||||
if (FLAG_debug_code) {
|
||||
__ ldr(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset));
|
||||
GetSharedFunctionInfoBytecode(masm, r3, r0);
|
||||
__ CompareObjectType(r3, r3, r3, BYTECODE_ARRAY_TYPE);
|
||||
__ Assert(eq, AbortReason::kMissingBytecodeArray);
|
||||
}
|
||||
@ -752,7 +751,7 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
|
||||
DCHECK(
|
||||
!AreAliased(feedback_vector, r0, r1, r3, scratch1, scratch2, scratch3));
|
||||
|
||||
Label optimized_code_slot_is_cell, fallthrough;
|
||||
Label optimized_code_slot_is_weak_ref, fallthrough;
|
||||
|
||||
Register closure = r1;
|
||||
Register optimized_code_entry = scratch1;
|
||||
@ -762,9 +761,9 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
|
||||
FieldMemOperand(feedback_vector, FeedbackVector::kOptimizedCodeOffset));
|
||||
|
||||
// Check if the code entry is a Smi. If yes, we interpret it as an
|
||||
// optimisation marker. Otherwise, interpret is as a weak cell to a code
|
||||
// optimisation marker. Otherwise, interpret it as a weak reference to a code
|
||||
// object.
|
||||
__ JumpIfNotSmi(optimized_code_entry, &optimized_code_slot_is_cell);
|
||||
__ JumpIfNotSmi(optimized_code_entry, &optimized_code_slot_is_weak_ref);
|
||||
|
||||
{
|
||||
// Optimized code slot is a Smi optimization marker.
|
||||
@ -799,12 +798,10 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
|
||||
}
|
||||
|
||||
{
|
||||
// Optimized code slot is a WeakCell.
|
||||
__ bind(&optimized_code_slot_is_cell);
|
||||
// Optimized code slot is a weak reference.
|
||||
__ bind(&optimized_code_slot_is_weak_ref);
|
||||
|
||||
__ ldr(optimized_code_entry,
|
||||
FieldMemOperand(optimized_code_entry, WeakCell::kValueOffset));
|
||||
__ JumpIfSmi(optimized_code_entry, &fallthrough);
|
||||
__ LoadWeakValue(optimized_code_entry, optimized_code_entry, &fallthrough);
|
||||
|
||||
// Check if the optimized code is marked for deopt. If it is, call the
|
||||
// runtime to clear it.
|
||||
@ -936,6 +933,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
||||
__ ldr(r0, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ ldr(kInterpreterBytecodeArrayRegister,
|
||||
FieldMemOperand(r0, SharedFunctionInfo::kFunctionDataOffset));
|
||||
GetSharedFunctionInfoBytecode(masm, kInterpreterBytecodeArrayRegister, r4);
|
||||
__ ldr(r4, FieldMemOperand(r0, SharedFunctionInfo::kDebugInfoOffset));
|
||||
__ SmiTst(r4);
|
||||
__ b(ne, &maybe_load_debug_bytecode_array);
|
||||
@ -1055,11 +1053,31 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
||||
// kInterpreterBytecodeArrayRegister is already loaded with
|
||||
// SharedFunctionInfo::kFunctionDataOffset.
|
||||
__ bind(&maybe_load_debug_bytecode_array);
|
||||
__ ldr(r9, FieldMemOperand(r4, DebugInfo::kDebugBytecodeArrayOffset), ne);
|
||||
__ JumpIfRoot(r9, Heap::kUndefinedValueRootIndex, &bytecode_array_loaded);
|
||||
|
||||
__ mov(kInterpreterBytecodeArrayRegister, r9);
|
||||
__ ldr(r9, FieldMemOperand(r4, DebugInfo::kFlagsOffset));
|
||||
__ SmiUntag(r9);
|
||||
__ tst(r9, Operand(DebugInfo::kHasBreakInfo));
|
||||
__ ldr(kInterpreterBytecodeArrayRegister,
|
||||
FieldMemOperand(r4, DebugInfo::kDebugBytecodeArrayOffset), ne);
|
||||
__ And(r9, r9, Operand(DebugInfo::kDebugExecutionMode));
|
||||
|
||||
ExternalReference debug_execution_mode =
|
||||
ExternalReference::debug_execution_mode_address(masm->isolate());
|
||||
__ mov(r4, Operand(debug_execution_mode));
|
||||
__ ldrsb(r4, MemOperand(r4));
|
||||
STATIC_ASSERT(static_cast<int>(DebugInfo::kDebugExecutionMode) ==
|
||||
static_cast<int>(DebugInfo::kSideEffects));
|
||||
__ cmp(r4, r9);
|
||||
__ b(eq, &bytecode_array_loaded);
|
||||
|
||||
__ push(closure);
|
||||
__ push(feedback_vector);
|
||||
__ push(kInterpreterBytecodeArrayRegister);
|
||||
__ push(closure);
|
||||
__ CallRuntime(Runtime::kDebugApplyInstrumentation);
|
||||
__ pop(kInterpreterBytecodeArrayRegister);
|
||||
__ pop(feedback_vector);
|
||||
__ pop(closure);
|
||||
__ b(&bytecode_array_loaded);
|
||||
}
|
||||
|
||||
@ -1085,6 +1103,7 @@ static void Generate_InterpreterPushArgs(MacroAssembler* masm,
|
||||
void Builtins::Generate_InterpreterPushArgsThenCallImpl(
|
||||
MacroAssembler* masm, ConvertReceiverMode receiver_mode,
|
||||
InterpreterPushArgsMode mode) {
|
||||
DCHECK(mode != InterpreterPushArgsMode::kArrayFunction);
|
||||
// ----------- S t a t e -------------
|
||||
// -- r0 : the number of arguments (not including the receiver)
|
||||
// -- r2 : the address of the first argument to be pushed. Subsequent
|
||||
@ -1113,11 +1132,7 @@ void Builtins::Generate_InterpreterPushArgsThenCallImpl(
|
||||
}
|
||||
|
||||
// Call the target.
|
||||
if (mode == InterpreterPushArgsMode::kJSFunction) {
|
||||
__ Jump(
|
||||
masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny),
|
||||
RelocInfo::CODE_TARGET);
|
||||
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
|
||||
if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
|
||||
__ Jump(BUILTIN_CODE(masm->isolate(), CallWithSpread),
|
||||
RelocInfo::CODE_TARGET);
|
||||
} else {
|
||||
@ -1161,15 +1176,13 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
|
||||
__ AssertUndefinedOrAllocationSite(r2, r5);
|
||||
}
|
||||
|
||||
if (mode == InterpreterPushArgsMode::kJSFunction) {
|
||||
if (mode == InterpreterPushArgsMode::kArrayFunction) {
|
||||
__ AssertFunction(r1);
|
||||
|
||||
// Tail call to the function-specific construct stub (still in the caller
|
||||
// Tail call to the array construct stub (still in the caller
|
||||
// context at this point).
|
||||
__ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kConstructStubOffset));
|
||||
// Jump to the construct function.
|
||||
__ add(pc, r4, Operand(Code::kHeaderSize - kHeapObjectTag));
|
||||
ArrayConstructorStub array_constructor_stub(masm->isolate());
|
||||
__ Jump(array_constructor_stub.GetCode(), RelocInfo::CODE_TARGET);
|
||||
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
|
||||
// Call the constructor with r0, r1, and r3 unmodified.
|
||||
__ Jump(BUILTIN_CODE(masm->isolate(), ConstructWithSpread),
|
||||
@ -1191,10 +1204,29 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
|
||||
static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) {
|
||||
// Set the return address to the correct point in the interpreter entry
|
||||
// trampoline.
|
||||
Label builtin_trampoline, trampoline_loaded;
|
||||
Smi* interpreter_entry_return_pc_offset(
|
||||
masm->isolate()->heap()->interpreter_entry_return_pc_offset());
|
||||
DCHECK_NE(interpreter_entry_return_pc_offset, Smi::kZero);
|
||||
|
||||
// If the SFI function_data is an InterpreterData, get the trampoline stored
|
||||
// in it, otherwise get the trampoline from the builtins list.
|
||||
__ ldr(r2, MemOperand(fp, StandardFrameConstants::kFunctionOffset));
|
||||
__ ldr(r2, FieldMemOperand(r2, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kFunctionDataOffset));
|
||||
__ CompareObjectType(r2, kInterpreterDispatchTableRegister,
|
||||
kInterpreterDispatchTableRegister,
|
||||
INTERPRETER_DATA_TYPE);
|
||||
__ b(ne, &builtin_trampoline);
|
||||
|
||||
__ ldr(r2,
|
||||
FieldMemOperand(r2, InterpreterData::kInterpreterTrampolineOffset));
|
||||
__ b(&trampoline_loaded);
|
||||
|
||||
__ bind(&builtin_trampoline);
|
||||
__ Move(r2, BUILTIN_CODE(masm->isolate(), InterpreterEntryTrampoline));
|
||||
|
||||
__ bind(&trampoline_loaded);
|
||||
__ add(lr, r2, Operand(interpreter_entry_return_pc_offset->value() +
|
||||
Code::kHeaderSize - kHeapObjectTag));
|
||||
|
||||
@ -1267,42 +1299,9 @@ void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
|
||||
Generate_InterpreterEnterBytecode(masm);
|
||||
}
|
||||
|
||||
void Builtins::Generate_CheckOptimizationMarker(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- r0 : argument count (preserved for callee)
|
||||
// -- r3 : new target (preserved for callee)
|
||||
// -- r1 : target function (preserved for callee)
|
||||
// -----------------------------------
|
||||
Register closure = r1;
|
||||
|
||||
// Get the feedback vector.
|
||||
Register feedback_vector = r2;
|
||||
__ ldr(feedback_vector,
|
||||
FieldMemOperand(closure, JSFunction::kFeedbackCellOffset));
|
||||
__ ldr(feedback_vector, FieldMemOperand(feedback_vector, Cell::kValueOffset));
|
||||
|
||||
// The feedback vector must be defined.
|
||||
if (FLAG_debug_code) {
|
||||
__ CompareRoot(feedback_vector, Heap::kUndefinedValueRootIndex);
|
||||
__ Assert(ne, AbortReason::kExpectedFeedbackVector);
|
||||
}
|
||||
|
||||
// Is there an optimization marker or optimized code in the feedback vector?
|
||||
MaybeTailCallOptimizedCodeSlot(masm, feedback_vector, r4, r6, r5);
|
||||
|
||||
// Otherwise, tail call the SFI code.
|
||||
static_assert(kJavaScriptCallCodeStartRegister == r2, "ABI mismatch");
|
||||
__ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset));
|
||||
__ add(r2, r2, Operand(Code::kHeaderSize - kHeapObjectTag));
|
||||
__ Jump(r2);
|
||||
}
|
||||
|
||||
void Builtins::Generate_CompileLazyDeoptimizedCode(MacroAssembler* masm) {
|
||||
// Set the code slot inside the JSFunction to the trampoline to the
|
||||
// interpreter entry.
|
||||
__ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset));
|
||||
// Set the code slot inside the JSFunction to CompileLazy.
|
||||
__ Move(r2, BUILTIN_CODE(masm->isolate(), CompileLazy));
|
||||
__ str(r2, FieldMemOperand(r1, JSFunction::kCodeOffset));
|
||||
__ RecordWriteField(r1, JSFunction::kCodeOffset, r2, r4, kLRHasNotBeenSaved,
|
||||
kDontSaveFPRegs, OMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
|
||||
@ -1310,6 +1309,76 @@ void Builtins::Generate_CompileLazyDeoptimizedCode(MacroAssembler* masm) {
|
||||
Generate_CompileLazy(masm);
|
||||
}
|
||||
|
||||
static void GetSharedFunctionInfoCode(MacroAssembler* masm, Register sfi_data,
|
||||
Register scratch1) {
|
||||
// Figure out the SFI's code object.
|
||||
Label done;
|
||||
Label check_is_bytecode_array;
|
||||
Label check_is_code;
|
||||
Label check_is_fixed_array;
|
||||
Label check_is_pre_parsed_scope_data;
|
||||
Label check_is_function_template_info;
|
||||
Label check_is_interpreter_data;
|
||||
|
||||
Register data_type = scratch1;
|
||||
|
||||
// IsSmi: Is builtin
|
||||
__ JumpIfNotSmi(sfi_data, &check_is_bytecode_array);
|
||||
__ Move(scratch1,
|
||||
Operand(ExternalReference::builtins_address(masm->isolate())));
|
||||
__ ldr(sfi_data, MemOperand::PointerAddressFromSmiKey(scratch1, sfi_data));
|
||||
__ b(&done);
|
||||
|
||||
// Get map for subsequent checks.
|
||||
__ bind(&check_is_bytecode_array);
|
||||
__ ldr(data_type, FieldMemOperand(sfi_data, HeapObject::kMapOffset));
|
||||
__ ldrh(data_type, FieldMemOperand(data_type, Map::kInstanceTypeOffset));
|
||||
|
||||
// IsBytecodeArray: Interpret bytecode
|
||||
__ cmp(data_type, Operand(BYTECODE_ARRAY_TYPE));
|
||||
__ b(ne, &check_is_code);
|
||||
__ Move(sfi_data, BUILTIN_CODE(masm->isolate(), InterpreterEntryTrampoline));
|
||||
__ b(&done);
|
||||
|
||||
// IsCode: Run code
|
||||
__ bind(&check_is_code);
|
||||
__ cmp(data_type, Operand(CODE_TYPE));
|
||||
__ b(eq, &done);
|
||||
|
||||
// IsFixedArray: Instantiate using AsmWasmData,
|
||||
__ bind(&check_is_fixed_array);
|
||||
__ cmp(data_type, Operand(FIXED_ARRAY_TYPE));
|
||||
__ b(ne, &check_is_pre_parsed_scope_data);
|
||||
__ Move(sfi_data, BUILTIN_CODE(masm->isolate(), InstantiateAsmJs));
|
||||
__ b(&done);
|
||||
|
||||
// IsPreParsedScopeData: Compile lazy
|
||||
__ bind(&check_is_pre_parsed_scope_data);
|
||||
__ cmp(data_type, Operand(TUPLE2_TYPE));
|
||||
__ b(ne, &check_is_function_template_info);
|
||||
__ Move(sfi_data, BUILTIN_CODE(masm->isolate(), CompileLazy));
|
||||
__ b(&done);
|
||||
|
||||
// IsFunctionTemplateInfo: API call
|
||||
__ bind(&check_is_function_template_info);
|
||||
__ cmp(data_type, Operand(FUNCTION_TEMPLATE_INFO_TYPE));
|
||||
__ b(ne, &check_is_interpreter_data);
|
||||
__ Move(sfi_data, BUILTIN_CODE(masm->isolate(), HandleApiCall));
|
||||
__ b(&done);
|
||||
|
||||
// IsInterpreterData: Interpret bytecode
|
||||
__ bind(&check_is_interpreter_data);
|
||||
if (FLAG_debug_code) {
|
||||
__ cmp(data_type, Operand(INTERPRETER_DATA_TYPE));
|
||||
__ Assert(eq, AbortReason::kInvalidSharedFunctionInfoData);
|
||||
}
|
||||
__ ldr(
|
||||
sfi_data,
|
||||
FieldMemOperand(sfi_data, InterpreterData::kInterpreterTrampolineOffset));
|
||||
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- r0 : argument count (preserved for callee)
|
||||
@ -1332,13 +1401,15 @@ void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
||||
// Is there an optimization marker or optimized code in the feedback vector?
|
||||
MaybeTailCallOptimizedCodeSlot(masm, feedback_vector, r4, r6, r5);
|
||||
|
||||
// We found no optimized code.
|
||||
// We found no optimized code. Infer the code object needed for the SFI.
|
||||
Register entry = r4;
|
||||
__ ldr(entry,
|
||||
FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ ldr(entry,
|
||||
FieldMemOperand(entry, SharedFunctionInfo::kFunctionDataOffset));
|
||||
GetSharedFunctionInfoCode(masm, entry, r5);
|
||||
|
||||
// If SFI points to anything other than CompileLazy, install that.
|
||||
__ ldr(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset));
|
||||
// If code entry points to anything other than CompileLazy, install that.
|
||||
__ Move(r5, masm->CodeObject());
|
||||
__ cmp(entry, r5);
|
||||
__ b(eq, &gotta_call_runtime);
|
||||
@ -1408,25 +1479,9 @@ void Builtins::Generate_DeserializeLazy(MacroAssembler* masm) {
|
||||
|
||||
{
|
||||
// If we've reached this spot, the target builtin has been deserialized and
|
||||
// we simply need to copy it over. First to the shared function info.
|
||||
// we simply need to copy it over to the target function.
|
||||
|
||||
Register target_builtin = scratch1;
|
||||
Register shared = scratch0;
|
||||
|
||||
__ ldr(shared,
|
||||
FieldMemOperand(target, JSFunction::kSharedFunctionInfoOffset));
|
||||
|
||||
CHECK(r5 != target && r5 != scratch0 && r5 != scratch1);
|
||||
CHECK(r9 != target && r9 != scratch0 && r9 != scratch1);
|
||||
|
||||
__ str(target_builtin,
|
||||
FieldMemOperand(shared, SharedFunctionInfo::kCodeOffset));
|
||||
__ mov(r9, target_builtin); // Write barrier clobbers r9 below.
|
||||
__ RecordWriteField(shared, SharedFunctionInfo::kCodeOffset, r9, r5,
|
||||
kLRHasNotBeenSaved, kDontSaveFPRegs,
|
||||
OMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
|
||||
|
||||
// And second to the target function.
|
||||
|
||||
__ str(target_builtin, FieldMemOperand(target, JSFunction::kCodeOffset));
|
||||
__ mov(r9, target_builtin); // Write barrier clobbers r9 below.
|
||||
@ -1998,7 +2053,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
|
||||
// Check that the function is not a "classConstructor".
|
||||
Label class_constructor;
|
||||
__ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset));
|
||||
__ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kFlagsOffset));
|
||||
__ tst(r3, Operand(SharedFunctionInfo::IsClassConstructorBit::kMask));
|
||||
__ b(ne, &class_constructor);
|
||||
|
||||
@ -2008,7 +2063,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
|
||||
__ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
|
||||
// We need to convert the receiver for non-native sloppy mode functions.
|
||||
Label done_convert;
|
||||
__ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset));
|
||||
__ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kFlagsOffset));
|
||||
__ tst(r3, Operand(SharedFunctionInfo::IsNativeBit::kMask |
|
||||
SharedFunctionInfo::IsStrictBit::kMask));
|
||||
__ b(ne, &done_convert);
|
||||
@ -2243,17 +2298,27 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
|
||||
// -- r1 : the constructor to call (checked to be a JSFunction)
|
||||
// -- r3 : the new target (checked to be a constructor)
|
||||
// -----------------------------------
|
||||
__ AssertConstructor(r1);
|
||||
__ AssertFunction(r1);
|
||||
|
||||
// Calling convention for function specific ConstructStubs require
|
||||
// r2 to contain either an AllocationSite or undefined.
|
||||
__ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
|
||||
|
||||
// Tail call to the function-specific construct stub (still in the caller
|
||||
// context at this point).
|
||||
Label call_generic_stub;
|
||||
|
||||
// Jump to JSBuiltinsConstructStub or JSConstructStubGeneric.
|
||||
__ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kConstructStubOffset));
|
||||
__ add(pc, r4, Operand(Code::kHeaderSize - kHeapObjectTag));
|
||||
__ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kFlagsOffset));
|
||||
__ tst(r4, Operand(SharedFunctionInfo::ConstructAsBuiltinBit::kMask));
|
||||
__ b(eq, &call_generic_stub);
|
||||
|
||||
__ Jump(BUILTIN_CODE(masm->isolate(), JSBuiltinsConstructStub),
|
||||
RelocInfo::CODE_TARGET);
|
||||
|
||||
__ bind(&call_generic_stub);
|
||||
__ Jump(masm->isolate()->builtins()->JSConstructStubGeneric(),
|
||||
RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
// static
|
||||
@ -2263,6 +2328,7 @@ void Builtins::Generate_ConstructBoundFunction(MacroAssembler* masm) {
|
||||
// -- r1 : the function to call (checked to be a JSBoundFunction)
|
||||
// -- r3 : the new target (checked to be a constructor)
|
||||
// -----------------------------------
|
||||
__ AssertConstructor(r1);
|
||||
__ AssertBoundFunction(r1);
|
||||
|
||||
// Push the [[BoundArguments]] onto the stack.
|
||||
@ -2291,16 +2357,17 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
|
||||
Label non_constructor, non_proxy;
|
||||
__ JumpIfSmi(r1, &non_constructor);
|
||||
|
||||
// Dispatch based on instance type.
|
||||
__ CompareObjectType(r1, r4, r5, JS_FUNCTION_TYPE);
|
||||
__ Jump(BUILTIN_CODE(masm->isolate(), ConstructFunction),
|
||||
RelocInfo::CODE_TARGET, eq);
|
||||
|
||||
// Check if target has a [[Construct]] internal method.
|
||||
__ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset));
|
||||
__ ldrb(r2, FieldMemOperand(r4, Map::kBitFieldOffset));
|
||||
__ tst(r2, Operand(Map::IsConstructorBit::kMask));
|
||||
__ b(eq, &non_constructor);
|
||||
|
||||
// Dispatch based on instance type.
|
||||
__ CompareInstanceType(r4, r5, JS_FUNCTION_TYPE);
|
||||
__ Jump(BUILTIN_CODE(masm->isolate(), ConstructFunction),
|
||||
RelocInfo::CODE_TARGET, eq);
|
||||
|
||||
// Only dispatch to bound functions after checking whether they are
|
||||
// constructors.
|
||||
__ cmp(r5, Operand(JS_BOUND_FUNCTION_TYPE));
|
||||
@ -2503,28 +2570,34 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
|
||||
{
|
||||
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
|
||||
|
||||
auto wasm_instance_reg = r3; // TODO(titzer): put in a common place.
|
||||
|
||||
// Save all parameter registers (see wasm-linkage.cc). They might be
|
||||
// overwritten in the runtime call below. We don't have any callee-saved
|
||||
// registers in wasm, so no need to store anything else.
|
||||
constexpr RegList gp_regs = Register::ListOf<r0, r1, r2, r3>();
|
||||
constexpr RegList gp_regs = Register::ListOf<r0, r1, r2>();
|
||||
constexpr DwVfpRegister lowest_fp_reg = d0;
|
||||
constexpr DwVfpRegister highest_fp_reg = d7;
|
||||
|
||||
__ stm(db_w, sp, gp_regs);
|
||||
__ vstm(db_w, sp, lowest_fp_reg, highest_fp_reg);
|
||||
|
||||
// Initialize cp register with kZero, CEntryStub will use it to set the
|
||||
// current context on the isolate.
|
||||
// Pass the WASM instance as an explicit argument to WasmCompileLazy.
|
||||
__ push(wasm_instance_reg);
|
||||
// Initialize the JavaScript context with 0. CEntryStub will use it to
|
||||
// set the current context on the isolate.
|
||||
__ Move(cp, Smi::kZero);
|
||||
__ CallRuntime(Runtime::kWasmCompileLazy);
|
||||
// Store returned instruction start in r8.
|
||||
__ add(r8, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
|
||||
// The entrypoint address is the first return value.
|
||||
__ mov(r8, kReturnRegister0);
|
||||
// The WASM instance is the second return value.
|
||||
__ mov(wasm_instance_reg, kReturnRegister1);
|
||||
|
||||
// Restore registers.
|
||||
__ vldm(ia_w, sp, lowest_fp_reg, highest_fp_reg);
|
||||
__ ldm(ia_w, sp, gp_regs);
|
||||
}
|
||||
// Now jump to the instructions of the returned code object.
|
||||
// Finally, jump to the entrypoint.
|
||||
__ Jump(r8);
|
||||
}
|
||||
#undef __
|
||||
|
315
deps/v8/src/builtins/arm64/builtins-arm64.cc
vendored
315
deps/v8/src/builtins/arm64/builtins-arm64.cc
vendored
@ -19,19 +19,6 @@ namespace internal {
|
||||
|
||||
#define __ ACCESS_MASM(masm)
|
||||
|
||||
// Load the built-in Array function from the current context.
|
||||
static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) {
|
||||
// Load the InternalArray function from the native context.
|
||||
__ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, result);
|
||||
}
|
||||
|
||||
// Load the built-in InternalArray function from the current context.
|
||||
static void GenerateLoadInternalArrayFunction(MacroAssembler* masm,
|
||||
Register result) {
|
||||
// Load the InternalArray function from the native context.
|
||||
__ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result);
|
||||
}
|
||||
|
||||
void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address,
|
||||
ExitFrameType exit_frame_type) {
|
||||
__ Mov(x5, ExternalReference(address, masm->isolate()));
|
||||
@ -104,9 +91,6 @@ void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
|
||||
ASM_LOCATION("Builtins::Generate_InternalArrayConstructor");
|
||||
Label generic_array_code;
|
||||
|
||||
// Get the InternalArray function.
|
||||
GenerateLoadInternalArrayFunction(masm, x1);
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
// Initial map for the builtin InternalArray functions should be maps.
|
||||
__ Ldr(x10, FieldMemOperand(x1, JSFunction::kPrototypeOrInitialMapOffset));
|
||||
@ -118,6 +102,7 @@ void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
|
||||
|
||||
// Run the native code for the InternalArray function called as a normal
|
||||
// function.
|
||||
__ LoadRoot(x2, Heap::kUndefinedValueRootIndex);
|
||||
InternalArrayConstructorStub stub(masm->isolate());
|
||||
__ TailCallStub(&stub);
|
||||
}
|
||||
@ -125,15 +110,13 @@ void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
|
||||
void Builtins::Generate_ArrayConstructor(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- x0 : number of arguments
|
||||
// -- x1 : array function
|
||||
// -- lr : return address
|
||||
// -- sp[...]: constructor arguments
|
||||
// -----------------------------------
|
||||
ASM_LOCATION("Builtins::Generate_ArrayConstructor");
|
||||
Label generic_array_code, one_or_more_arguments, two_or_more_arguments;
|
||||
|
||||
// Get the Array function.
|
||||
GenerateLoadArrayFunction(masm, x1);
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
// Initial map for the builtin Array functions should be maps.
|
||||
__ Ldr(x10, FieldMemOperand(x1, JSFunction::kPrototypeOrInitialMapOffset));
|
||||
@ -143,9 +126,14 @@ void Builtins::Generate_ArrayConstructor(MacroAssembler* masm) {
|
||||
__ Assert(eq, AbortReason::kUnexpectedInitialMapForArrayFunction);
|
||||
}
|
||||
|
||||
// Run the native code for the Array function called as a normal function.
|
||||
// x2 is the AllocationSite - here undefined.
|
||||
__ LoadRoot(x2, Heap::kUndefinedValueRootIndex);
|
||||
__ Mov(x3, x1);
|
||||
// If x3 (new target) is undefined, then this is the 'Call' case, so move
|
||||
// x1 (the constructor) to x3.
|
||||
__ Cmp(x3, x2);
|
||||
__ CmovX(x3, x1, eq);
|
||||
|
||||
// Run the native code for the Array function called as a normal function.
|
||||
ArrayConstructorStub stub(masm->isolate());
|
||||
__ TailCallStub(&stub);
|
||||
}
|
||||
@ -325,7 +313,7 @@ void Generate_JSConstructStubGeneric(MacroAssembler* masm,
|
||||
// -----------------------------------
|
||||
|
||||
__ Ldr(x4, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ Ldr(w4, FieldMemOperand(x4, SharedFunctionInfo::kCompilerHintsOffset));
|
||||
__ Ldr(w4, FieldMemOperand(x4, SharedFunctionInfo::kFlagsOffset));
|
||||
__ TestAndBranchIfAnySet(w4,
|
||||
SharedFunctionInfo::IsDerivedConstructorBit::kMask,
|
||||
¬_create_implicit_receiver);
|
||||
@ -451,7 +439,7 @@ void Generate_JSConstructStubGeneric(MacroAssembler* masm,
|
||||
__ Bind(&other_result);
|
||||
__ Ldr(x4, MemOperand(fp, ConstructFrameConstants::kConstructorOffset));
|
||||
__ Ldr(x4, FieldMemOperand(x4, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ Ldr(w4, FieldMemOperand(x4, SharedFunctionInfo::kCompilerHintsOffset));
|
||||
__ Ldr(w4, FieldMemOperand(x4, SharedFunctionInfo::kFlagsOffset));
|
||||
|
||||
if (restrict_constructor_return) {
|
||||
// Throw if constructor function is a class constructor
|
||||
@ -495,9 +483,6 @@ void Builtins::Generate_JSConstructStubGenericUnrestrictedReturn(
|
||||
MacroAssembler* masm) {
|
||||
Generate_JSConstructStubGeneric(masm, false);
|
||||
}
|
||||
void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) {
|
||||
Generate_JSBuiltinsConstructStubHelper(masm);
|
||||
}
|
||||
void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) {
|
||||
Generate_JSBuiltinsConstructStubHelper(masm);
|
||||
}
|
||||
@ -596,8 +581,13 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
|
||||
|
||||
// Underlying function needs to have bytecode available.
|
||||
if (FLAG_debug_code) {
|
||||
Label check_has_bytecode_array;
|
||||
__ Ldr(x3, FieldMemOperand(x4, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ Ldr(x3, FieldMemOperand(x3, SharedFunctionInfo::kFunctionDataOffset));
|
||||
__ CompareObjectType(x3, x0, x0, INTERPRETER_DATA_TYPE);
|
||||
__ B(ne, &check_has_bytecode_array);
|
||||
__ Ldr(x3, FieldMemOperand(x3, InterpreterData::kBytecodeArrayOffset));
|
||||
__ Bind(&check_has_bytecode_array);
|
||||
__ CompareObjectType(x3, x3, x3, BYTECODE_ARRAY_TYPE);
|
||||
__ Assert(eq, AbortReason::kMissingBytecodeArray);
|
||||
}
|
||||
@ -845,7 +835,7 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
|
||||
DCHECK(
|
||||
!AreAliased(feedback_vector, x0, x1, x3, scratch1, scratch2, scratch3));
|
||||
|
||||
Label optimized_code_slot_is_cell, fallthrough;
|
||||
Label optimized_code_slot_is_weak_ref, fallthrough;
|
||||
|
||||
Register closure = x1;
|
||||
Register optimized_code_entry = scratch1;
|
||||
@ -855,9 +845,9 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
|
||||
FieldMemOperand(feedback_vector, FeedbackVector::kOptimizedCodeOffset));
|
||||
|
||||
// Check if the code entry is a Smi. If yes, we interpret it as an
|
||||
// optimisation marker. Otherwise, interpret is as a weak cell to a code
|
||||
// optimisation marker. Otherwise, interpret is at a weak reference to a code
|
||||
// object.
|
||||
__ JumpIfNotSmi(optimized_code_entry, &optimized_code_slot_is_cell);
|
||||
__ JumpIfNotSmi(optimized_code_entry, &optimized_code_slot_is_weak_ref);
|
||||
|
||||
{
|
||||
// Optimized code slot is a Smi optimization marker.
|
||||
@ -892,12 +882,10 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
|
||||
}
|
||||
|
||||
{
|
||||
// Optimized code slot is a WeakCell.
|
||||
__ bind(&optimized_code_slot_is_cell);
|
||||
// Optimized code slot is a weak reference.
|
||||
__ bind(&optimized_code_slot_is_weak_ref);
|
||||
|
||||
__ Ldr(optimized_code_entry,
|
||||
FieldMemOperand(optimized_code_entry, WeakCell::kValueOffset));
|
||||
__ JumpIfSmi(optimized_code_entry, &fallthrough);
|
||||
__ LoadWeakValue(optimized_code_entry, optimized_code_entry, &fallthrough);
|
||||
|
||||
// Check if the optimized code is marked for deopt. If it is, call the
|
||||
// runtime to clear it.
|
||||
@ -1025,10 +1013,18 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
||||
|
||||
// Get the bytecode array from the function object (or from the DebugInfo if
|
||||
// it is present) and load it into kInterpreterBytecodeArrayRegister.
|
||||
Label maybe_load_debug_bytecode_array, bytecode_array_loaded;
|
||||
Label maybe_load_debug_bytecode_array, bytecode_array_loaded,
|
||||
has_bytecode_array;
|
||||
__ Ldr(x0, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ Ldr(kInterpreterBytecodeArrayRegister,
|
||||
FieldMemOperand(x0, SharedFunctionInfo::kFunctionDataOffset));
|
||||
__ CompareObjectType(kInterpreterBytecodeArrayRegister, x11, x11,
|
||||
INTERPRETER_DATA_TYPE);
|
||||
__ B(ne, &has_bytecode_array);
|
||||
__ Ldr(kInterpreterBytecodeArrayRegister,
|
||||
FieldMemOperand(kInterpreterBytecodeArrayRegister,
|
||||
InterpreterData::kBytecodeArrayOffset));
|
||||
__ Bind(&has_bytecode_array);
|
||||
__ Ldr(x11, FieldMemOperand(x0, SharedFunctionInfo::kDebugInfoOffset));
|
||||
__ JumpIfNotSmi(x11, &maybe_load_debug_bytecode_array);
|
||||
__ Bind(&bytecode_array_loaded);
|
||||
@ -1149,12 +1145,26 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
||||
// kInterpreterBytecodeArrayRegister is already loaded with
|
||||
// SharedFunctionInfo::kFunctionDataOffset.
|
||||
__ Bind(&maybe_load_debug_bytecode_array);
|
||||
__ Ldrsw(x10, UntagSmiFieldMemOperand(x11, DebugInfo::kFlagsOffset));
|
||||
__ TestAndBranchIfAllClear(x10, DebugInfo::kHasBreakInfo,
|
||||
&bytecode_array_loaded);
|
||||
__ Ldr(kInterpreterBytecodeArrayRegister,
|
||||
FieldMemOperand(x11, DebugInfo::kDebugBytecodeArrayOffset));
|
||||
__ B(&bytecode_array_loaded);
|
||||
__ Ldr(x10, FieldMemOperand(x11, DebugInfo::kDebugBytecodeArrayOffset));
|
||||
__ JumpIfRoot(x10, Heap::kUndefinedValueRootIndex, &bytecode_array_loaded);
|
||||
|
||||
__ Mov(kInterpreterBytecodeArrayRegister, x10);
|
||||
__ Ldr(x10, UntagSmiFieldMemOperand(x11, DebugInfo::kFlagsOffset));
|
||||
__ And(x10, x10, Immediate(DebugInfo::kDebugExecutionMode));
|
||||
|
||||
STATIC_ASSERT(static_cast<int>(DebugInfo::kDebugExecutionMode) ==
|
||||
static_cast<int>(DebugInfo::kSideEffects));
|
||||
ExternalReference debug_execution_mode =
|
||||
ExternalReference::debug_execution_mode_address(masm->isolate());
|
||||
__ Mov(x11, Operand(debug_execution_mode));
|
||||
__ Ldrsb(x11, MemOperand(x11));
|
||||
__ CompareAndBranch(x10, x11, eq, &bytecode_array_loaded);
|
||||
|
||||
__ Push(closure, feedback_vector);
|
||||
__ PushArgument(closure);
|
||||
__ CallRuntime(Runtime::kDebugApplyInstrumentation);
|
||||
__ Pop(feedback_vector, closure);
|
||||
__ jmp(&bytecode_array_loaded);
|
||||
}
|
||||
|
||||
static void Generate_InterpreterPushArgs(MacroAssembler* masm,
|
||||
@ -1236,6 +1246,7 @@ static void Generate_InterpreterPushArgs(MacroAssembler* masm,
|
||||
void Builtins::Generate_InterpreterPushArgsThenCallImpl(
|
||||
MacroAssembler* masm, ConvertReceiverMode receiver_mode,
|
||||
InterpreterPushArgsMode mode) {
|
||||
DCHECK(mode != InterpreterPushArgsMode::kArrayFunction);
|
||||
// ----------- S t a t e -------------
|
||||
// -- x0 : the number of arguments (not including the receiver)
|
||||
// -- x2 : the address of the first argument to be pushed. Subsequent
|
||||
@ -1255,11 +1266,7 @@ void Builtins::Generate_InterpreterPushArgsThenCallImpl(
|
||||
receiver_mode, mode);
|
||||
|
||||
// Call the target.
|
||||
if (mode == InterpreterPushArgsMode::kJSFunction) {
|
||||
__ Jump(
|
||||
masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny),
|
||||
RelocInfo::CODE_TARGET);
|
||||
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
|
||||
if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
|
||||
__ Jump(BUILTIN_CODE(masm->isolate(), CallWithSpread),
|
||||
RelocInfo::CODE_TARGET);
|
||||
} else {
|
||||
@ -1290,15 +1297,13 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
|
||||
Generate_InterpreterPushArgs(masm, num_args, first_arg_index, spread_arg_out,
|
||||
ConvertReceiverMode::kNullOrUndefined, mode);
|
||||
|
||||
if (mode == InterpreterPushArgsMode::kJSFunction) {
|
||||
if (mode == InterpreterPushArgsMode::kArrayFunction) {
|
||||
__ AssertFunction(x1);
|
||||
|
||||
// Tail call to the function-specific construct stub (still in the caller
|
||||
// Tail call to the array construct stub (still in the caller
|
||||
// context at this point).
|
||||
__ Ldr(x4, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset));
|
||||
__ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag);
|
||||
__ Br(x4);
|
||||
ArrayConstructorStub array_constructor_stub(masm->isolate());
|
||||
__ Jump(array_constructor_stub.GetCode(), RelocInfo::CODE_TARGET);
|
||||
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
|
||||
// Call the constructor with x0, x1, and x3 unmodified.
|
||||
__ Jump(BUILTIN_CODE(masm->isolate(), ConstructWithSpread),
|
||||
@ -1313,10 +1318,29 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
|
||||
static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) {
|
||||
// Set the return address to the correct point in the interpreter entry
|
||||
// trampoline.
|
||||
Label builtin_trampoline, trampoline_loaded;
|
||||
Smi* interpreter_entry_return_pc_offset(
|
||||
masm->isolate()->heap()->interpreter_entry_return_pc_offset());
|
||||
DCHECK_NE(interpreter_entry_return_pc_offset, Smi::kZero);
|
||||
|
||||
// If the SFI function_data is an InterpreterData, get the trampoline stored
|
||||
// in it, otherwise get the trampoline from the builtins list.
|
||||
__ Ldr(x1, MemOperand(fp, StandardFrameConstants::kFunctionOffset));
|
||||
__ Ldr(x1, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ Ldr(x1, FieldMemOperand(x1, SharedFunctionInfo::kFunctionDataOffset));
|
||||
__ CompareObjectType(x1, kInterpreterDispatchTableRegister,
|
||||
kInterpreterDispatchTableRegister,
|
||||
INTERPRETER_DATA_TYPE);
|
||||
__ B(ne, &builtin_trampoline);
|
||||
|
||||
__ Ldr(x1,
|
||||
FieldMemOperand(x1, InterpreterData::kInterpreterTrampolineOffset));
|
||||
__ B(&trampoline_loaded);
|
||||
|
||||
__ Bind(&builtin_trampoline);
|
||||
__ LoadObject(x1, BUILTIN_CODE(masm->isolate(), InterpreterEntryTrampoline));
|
||||
|
||||
__ Bind(&trampoline_loaded);
|
||||
__ Add(lr, x1, Operand(interpreter_entry_return_pc_offset->value() +
|
||||
Code::kHeaderSize - kHeapObjectTag));
|
||||
|
||||
@ -1387,42 +1411,9 @@ void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
|
||||
Generate_InterpreterEnterBytecode(masm);
|
||||
}
|
||||
|
||||
void Builtins::Generate_CheckOptimizationMarker(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- x0 : argument count (preserved for callee)
|
||||
// -- x3 : new target (preserved for callee)
|
||||
// -- x1 : target function (preserved for callee)
|
||||
// -----------------------------------
|
||||
Register closure = x1;
|
||||
|
||||
// Get the feedback vector.
|
||||
Register feedback_vector = x2;
|
||||
__ Ldr(feedback_vector,
|
||||
FieldMemOperand(closure, JSFunction::kFeedbackCellOffset));
|
||||
__ Ldr(feedback_vector, FieldMemOperand(feedback_vector, Cell::kValueOffset));
|
||||
|
||||
// The feedback vector must be defined.
|
||||
if (FLAG_debug_code) {
|
||||
__ CompareRoot(feedback_vector, Heap::kUndefinedValueRootIndex);
|
||||
__ Assert(ne, AbortReason::kExpectedFeedbackVector);
|
||||
}
|
||||
|
||||
// Is there an optimization marker or optimized code in the feedback vector?
|
||||
MaybeTailCallOptimizedCodeSlot(masm, feedback_vector, x7, x4, x5);
|
||||
|
||||
// Otherwise, tail call the SFI code.
|
||||
static_assert(kJavaScriptCallCodeStartRegister == x2, "ABI mismatch");
|
||||
__ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ Ldr(x2, FieldMemOperand(x2, SharedFunctionInfo::kCodeOffset));
|
||||
__ Add(x2, x2, Code::kHeaderSize - kHeapObjectTag);
|
||||
__ Br(x2);
|
||||
}
|
||||
|
||||
void Builtins::Generate_CompileLazyDeoptimizedCode(MacroAssembler* masm) {
|
||||
// Set the code slot inside the JSFunction to the trampoline to the
|
||||
// interpreter entry.
|
||||
__ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ Ldr(x2, FieldMemOperand(x2, SharedFunctionInfo::kCodeOffset));
|
||||
// Set the code slot inside the JSFunction to CompileLazy.
|
||||
__ Mov(x2, BUILTIN_CODE(masm->isolate(), CompileLazy));
|
||||
__ Str(x2, FieldMemOperand(x1, JSFunction::kCodeOffset));
|
||||
__ RecordWriteField(x1, JSFunction::kCodeOffset, x2, x5, kLRHasNotBeenSaved,
|
||||
kDontSaveFPRegs, OMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
|
||||
@ -1430,6 +1421,76 @@ void Builtins::Generate_CompileLazyDeoptimizedCode(MacroAssembler* masm) {
|
||||
Generate_CompileLazy(masm);
|
||||
}
|
||||
|
||||
static void GetSharedFunctionInfoCode(MacroAssembler* masm, Register sfi_data,
|
||||
Register scratch1) {
|
||||
// Figure out the SFI's code object.
|
||||
Label done;
|
||||
Label check_is_bytecode_array;
|
||||
Label check_is_code;
|
||||
Label check_is_fixed_array;
|
||||
Label check_is_pre_parsed_scope_data;
|
||||
Label check_is_function_template_info;
|
||||
Label check_is_interpreter_data;
|
||||
|
||||
Register data_type = scratch1;
|
||||
|
||||
// IsSmi: Is builtin
|
||||
__ JumpIfNotSmi(sfi_data, &check_is_bytecode_array);
|
||||
__ Mov(scratch1, ExternalReference::builtins_address(masm->isolate()));
|
||||
__ Mov(sfi_data, Operand::UntagSmiAndScale(sfi_data, kPointerSizeLog2));
|
||||
__ Ldr(sfi_data, MemOperand(scratch1, sfi_data));
|
||||
__ B(&done);
|
||||
|
||||
// Get map for subsequent checks.
|
||||
__ Bind(&check_is_bytecode_array);
|
||||
__ Ldr(data_type, FieldMemOperand(sfi_data, HeapObject::kMapOffset));
|
||||
__ Ldrh(data_type, FieldMemOperand(data_type, Map::kInstanceTypeOffset));
|
||||
|
||||
// IsBytecodeArray: Interpret bytecode
|
||||
__ Cmp(data_type, Operand(BYTECODE_ARRAY_TYPE));
|
||||
__ B(ne, &check_is_code);
|
||||
__ Move(sfi_data, BUILTIN_CODE(masm->isolate(), InterpreterEntryTrampoline));
|
||||
__ B(&done);
|
||||
|
||||
// IsCode: Run code
|
||||
__ Bind(&check_is_code);
|
||||
__ Cmp(data_type, Operand(CODE_TYPE));
|
||||
__ B(eq, &done);
|
||||
|
||||
// IsFixedArray: Instantiate using AsmWasmData,
|
||||
__ Bind(&check_is_fixed_array);
|
||||
__ Cmp(data_type, Operand(FIXED_ARRAY_TYPE));
|
||||
__ B(ne, &check_is_pre_parsed_scope_data);
|
||||
__ Move(sfi_data, BUILTIN_CODE(masm->isolate(), InstantiateAsmJs));
|
||||
__ B(&done);
|
||||
|
||||
// IsPreParsedScopeData: Compile lazy
|
||||
__ Bind(&check_is_pre_parsed_scope_data);
|
||||
__ Cmp(data_type, Operand(TUPLE2_TYPE));
|
||||
__ B(ne, &check_is_function_template_info);
|
||||
__ Move(sfi_data, BUILTIN_CODE(masm->isolate(), CompileLazy));
|
||||
__ B(&done);
|
||||
|
||||
// IsFunctionTemplateInfo: API call
|
||||
__ Bind(&check_is_function_template_info);
|
||||
__ Cmp(data_type, Operand(FUNCTION_TEMPLATE_INFO_TYPE));
|
||||
__ B(ne, &check_is_interpreter_data);
|
||||
__ Move(sfi_data, BUILTIN_CODE(masm->isolate(), HandleApiCall));
|
||||
__ B(&done);
|
||||
|
||||
// IsInterpreterData: Interpret bytecode
|
||||
__ Bind(&check_is_interpreter_data);
|
||||
if (FLAG_debug_code) {
|
||||
__ Cmp(data_type, Operand(INTERPRETER_DATA_TYPE));
|
||||
__ Assert(eq, AbortReason::kInvalidSharedFunctionInfoData);
|
||||
}
|
||||
__ Ldr(
|
||||
sfi_data,
|
||||
FieldMemOperand(sfi_data, InterpreterData::kInterpreterTrampolineOffset));
|
||||
|
||||
__ Bind(&done);
|
||||
}
|
||||
|
||||
void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- x0 : argument count (preserved for callee)
|
||||
@ -1452,13 +1513,15 @@ void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
||||
// Is there an optimization marker or optimized code in the feedback vector?
|
||||
MaybeTailCallOptimizedCodeSlot(masm, feedback_vector, x7, x4, x5);
|
||||
|
||||
// We found no optimized code.
|
||||
// We found no optimized code. Infer the code object needed for the SFI.
|
||||
Register entry = x7;
|
||||
__ Ldr(entry,
|
||||
FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ Ldr(entry,
|
||||
FieldMemOperand(entry, SharedFunctionInfo::kFunctionDataOffset));
|
||||
GetSharedFunctionInfoCode(masm, entry, x5);
|
||||
|
||||
// If SFI points to anything other than CompileLazy, install that.
|
||||
__ Ldr(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset));
|
||||
// If code entry points to anything other than CompileLazy, install that.
|
||||
__ Move(x5, masm->CodeObject());
|
||||
__ Cmp(entry, x5);
|
||||
__ B(eq, &gotta_call_runtime);
|
||||
@ -1527,25 +1590,9 @@ void Builtins::Generate_DeserializeLazy(MacroAssembler* masm) {
|
||||
|
||||
{
|
||||
// If we've reached this spot, the target builtin has been deserialized and
|
||||
// we simply need to copy it over. First to the shared function info.
|
||||
// we simply need to copy it over to the target function.
|
||||
|
||||
Register target_builtin = scratch1;
|
||||
Register shared = scratch0;
|
||||
|
||||
__ Ldr(shared,
|
||||
FieldMemOperand(target, JSFunction::kSharedFunctionInfoOffset));
|
||||
|
||||
CHECK(!x5.is(target) && !x5.is(scratch0) && !x5.is(scratch1));
|
||||
CHECK(!x9.is(target) && !x9.is(scratch0) && !x9.is(scratch1));
|
||||
|
||||
__ Str(target_builtin,
|
||||
FieldMemOperand(shared, SharedFunctionInfo::kCodeOffset));
|
||||
__ Mov(x9, target_builtin); // Write barrier clobbers x9 below.
|
||||
__ RecordWriteField(shared, SharedFunctionInfo::kCodeOffset, x9, x5,
|
||||
kLRHasNotBeenSaved, kDontSaveFPRegs,
|
||||
OMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
|
||||
|
||||
// And second to the target function.
|
||||
|
||||
__ Str(target_builtin, FieldMemOperand(target, JSFunction::kCodeOffset));
|
||||
__ Mov(x9, target_builtin); // Write barrier clobbers x9 below.
|
||||
@ -2360,7 +2407,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
|
||||
// Check that function is not a "classConstructor".
|
||||
Label class_constructor;
|
||||
__ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ Ldr(w3, FieldMemOperand(x2, SharedFunctionInfo::kCompilerHintsOffset));
|
||||
__ Ldr(w3, FieldMemOperand(x2, SharedFunctionInfo::kFlagsOffset));
|
||||
__ TestAndBranchIfAnySet(w3, SharedFunctionInfo::IsClassConstructorBit::kMask,
|
||||
&class_constructor);
|
||||
|
||||
@ -2647,18 +2694,27 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
|
||||
// -- x1 : the constructor to call (checked to be a JSFunction)
|
||||
// -- x3 : the new target (checked to be a constructor)
|
||||
// -----------------------------------
|
||||
__ AssertConstructor(x1);
|
||||
__ AssertFunction(x1);
|
||||
|
||||
// Calling convention for function specific ConstructStubs require
|
||||
// x2 to contain either an AllocationSite or undefined.
|
||||
__ LoadRoot(x2, Heap::kUndefinedValueRootIndex);
|
||||
|
||||
// Tail call to the function-specific construct stub (still in the caller
|
||||
// context at this point).
|
||||
Label call_generic_stub;
|
||||
|
||||
// Jump to JSBuiltinsConstructStub or JSConstructStubGeneric.
|
||||
__ Ldr(x4, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset));
|
||||
__ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag);
|
||||
__ Br(x4);
|
||||
__ Ldr(w4, FieldMemOperand(x4, SharedFunctionInfo::kFlagsOffset));
|
||||
__ TestAndBranchIfAllClear(
|
||||
w4, SharedFunctionInfo::ConstructAsBuiltinBit::kMask, &call_generic_stub);
|
||||
|
||||
__ Jump(BUILTIN_CODE(masm->isolate(), JSBuiltinsConstructStub),
|
||||
RelocInfo::CODE_TARGET);
|
||||
|
||||
__ bind(&call_generic_stub);
|
||||
__ Jump(masm->isolate()->builtins()->JSConstructStubGeneric(),
|
||||
RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
// static
|
||||
@ -2668,6 +2724,7 @@ void Builtins::Generate_ConstructBoundFunction(MacroAssembler* masm) {
|
||||
// -- x1 : the function to call (checked to be a JSBoundFunction)
|
||||
// -- x3 : the new target (checked to be a constructor)
|
||||
// -----------------------------------
|
||||
__ AssertConstructor(x1);
|
||||
__ AssertBoundFunction(x1);
|
||||
|
||||
// Push the [[BoundArguments]] onto the stack.
|
||||
@ -2701,16 +2758,17 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
|
||||
Label non_constructor, non_proxy;
|
||||
__ JumpIfSmi(x1, &non_constructor);
|
||||
|
||||
// Dispatch based on instance type.
|
||||
__ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE);
|
||||
__ Jump(BUILTIN_CODE(masm->isolate(), ConstructFunction),
|
||||
RelocInfo::CODE_TARGET, eq);
|
||||
|
||||
// Check if target has a [[Construct]] internal method.
|
||||
__ Ldr(x4, FieldMemOperand(x1, HeapObject::kMapOffset));
|
||||
__ Ldrb(x2, FieldMemOperand(x4, Map::kBitFieldOffset));
|
||||
__ TestAndBranchIfAllClear(x2, Map::IsConstructorBit::kMask,
|
||||
&non_constructor);
|
||||
|
||||
// Dispatch based on instance type.
|
||||
__ CompareInstanceType(x4, x5, JS_FUNCTION_TYPE);
|
||||
__ Jump(BUILTIN_CODE(masm->isolate(), ConstructFunction),
|
||||
RelocInfo::CODE_TARGET, eq);
|
||||
|
||||
// Only dispatch to bound functions after checking whether they are
|
||||
// constructors.
|
||||
__ Cmp(x5, JS_BOUND_FUNCTION_TYPE);
|
||||
@ -2977,28 +3035,35 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
|
||||
{
|
||||
FrameScope scope(masm, StackFrame::INTERNAL);
|
||||
|
||||
auto wasm_instance_reg = x7; // TODO(titzer): put in a common place.
|
||||
|
||||
// Save all parameter registers (see wasm-linkage.cc). They might be
|
||||
// overwritten in the runtime call below. We don't have any callee-saved
|
||||
// registers in wasm, so no need to store anything else.
|
||||
constexpr RegList gp_regs =
|
||||
Register::ListOf<x0, x1, x2, x3, x4, x5, x6, x7>();
|
||||
constexpr RegList gp_regs = Register::ListOf<x0, x1, x2, x3, x4, x5>();
|
||||
constexpr RegList fp_regs =
|
||||
Register::ListOf<d0, d1, d2, d3, d4, d5, d6, d7>();
|
||||
__ PushXRegList(gp_regs);
|
||||
__ PushDRegList(fp_regs);
|
||||
__ Push(x5, x6); // note: pushed twice because alignment required
|
||||
|
||||
// Initialize cp register with kZero, CEntryStub will use it to set the
|
||||
// current context on the isolate.
|
||||
// Pass the WASM instance as an explicit argument to WasmCompileLazy.
|
||||
__ PushArgument(wasm_instance_reg);
|
||||
// Initialize the JavaScript context with 0. CEntryStub will use it to
|
||||
// set the current context on the isolate.
|
||||
__ Move(cp, Smi::kZero);
|
||||
__ CallRuntime(Runtime::kWasmCompileLazy);
|
||||
// Store returned instruction start in x8.
|
||||
__ Add(x8, x0, Code::kHeaderSize - kHeapObjectTag);
|
||||
// The entrypoint address is the first return value.
|
||||
__ mov(x8, kReturnRegister0);
|
||||
// The WASM instance is the second return value.
|
||||
__ mov(wasm_instance_reg, kReturnRegister1);
|
||||
|
||||
// Restore registers.
|
||||
__ Pop(x6, x5); // note: pushed twice because alignment required
|
||||
__ PopDRegList(fp_regs);
|
||||
__ PopXRegList(gp_regs);
|
||||
}
|
||||
// Now jump to the instructions of the returned code object.
|
||||
// Finally, jump to the entrypoint.
|
||||
__ Jump(x8);
|
||||
}
|
||||
|
||||
|
67
deps/v8/src/builtins/builtins-api.cc
vendored
67
deps/v8/src/builtins/builtins-api.cc
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
#include "src/builtins/builtins.h"
|
||||
|
||||
#include "src/api-arguments.h"
|
||||
#include "src/api-arguments-inl.h"
|
||||
#include "src/api-natives.h"
|
||||
#include "src/builtins/builtins-utils.h"
|
||||
#include "src/counters.h"
|
||||
@ -21,21 +21,17 @@ namespace {
|
||||
// Returns the holder JSObject if the function can legally be called with this
|
||||
// receiver. Returns nullptr if the call is illegal.
|
||||
// TODO(dcarney): CallOptimization duplicates this logic, merge.
|
||||
JSReceiver* GetCompatibleReceiver(Isolate* isolate, FunctionTemplateInfo* info,
|
||||
JSReceiver* receiver) {
|
||||
JSObject* GetCompatibleReceiver(Isolate* isolate, FunctionTemplateInfo* info,
|
||||
JSObject* receiver) {
|
||||
Object* recv_type = info->signature();
|
||||
// No signature, return holder.
|
||||
if (!recv_type->IsFunctionTemplateInfo()) return receiver;
|
||||
// A Proxy cannot have been created from the signature template.
|
||||
if (!receiver->IsJSObject()) return nullptr;
|
||||
|
||||
JSObject* js_obj_receiver = JSObject::cast(receiver);
|
||||
FunctionTemplateInfo* signature = FunctionTemplateInfo::cast(recv_type);
|
||||
|
||||
// Check the receiver. Fast path for receivers with no hidden prototypes.
|
||||
if (signature->IsTemplateFor(js_obj_receiver)) return receiver;
|
||||
if (!js_obj_receiver->map()->has_hidden_prototype()) return nullptr;
|
||||
for (PrototypeIterator iter(isolate, js_obj_receiver, kStartAtPrototype,
|
||||
if (signature->IsTemplateFor(receiver)) return receiver;
|
||||
if (!receiver->map()->has_hidden_prototype()) return nullptr;
|
||||
for (PrototypeIterator iter(isolate, receiver, kStartAtPrototype,
|
||||
PrototypeIterator::END_AT_NON_HIDDEN);
|
||||
!iter.IsAtEnd(); iter.Advance()) {
|
||||
JSObject* current = iter.GetCurrent<JSObject>();
|
||||
@ -45,12 +41,12 @@ JSReceiver* GetCompatibleReceiver(Isolate* isolate, FunctionTemplateInfo* info,
|
||||
}
|
||||
|
||||
template <bool is_construct>
|
||||
MUST_USE_RESULT MaybeHandle<Object> HandleApiCallHelper(
|
||||
V8_WARN_UNUSED_RESULT MaybeHandle<Object> HandleApiCallHelper(
|
||||
Isolate* isolate, Handle<HeapObject> function,
|
||||
Handle<HeapObject> new_target, Handle<FunctionTemplateInfo> fun_data,
|
||||
Handle<Object> receiver, BuiltinArguments args) {
|
||||
Handle<JSReceiver> js_receiver;
|
||||
JSReceiver* raw_holder;
|
||||
Handle<JSObject> js_receiver;
|
||||
JSObject* raw_holder;
|
||||
if (is_construct) {
|
||||
DCHECK(args.receiver()->IsTheHole(isolate));
|
||||
if (fun_data->instance_template()->IsUndefined(isolate)) {
|
||||
@ -72,18 +68,21 @@ MUST_USE_RESULT MaybeHandle<Object> HandleApiCallHelper(
|
||||
raw_holder = *js_receiver;
|
||||
} else {
|
||||
DCHECK(receiver->IsJSReceiver());
|
||||
js_receiver = Handle<JSReceiver>::cast(receiver);
|
||||
|
||||
if (!receiver->IsJSObject()) {
|
||||
// This function cannot be called with the given receiver. Abort!
|
||||
THROW_NEW_ERROR(
|
||||
isolate, NewTypeError(MessageTemplate::kIllegalInvocation), Object);
|
||||
}
|
||||
|
||||
js_receiver = Handle<JSObject>::cast(receiver);
|
||||
|
||||
if (!fun_data->accept_any_receiver() &&
|
||||
js_receiver->IsAccessCheckNeeded()) {
|
||||
// Proxies never need access checks.
|
||||
DCHECK(js_receiver->IsJSObject());
|
||||
Handle<JSObject> js_obj_receiver = Handle<JSObject>::cast(js_receiver);
|
||||
if (!isolate->MayAccess(handle(isolate->context()), js_obj_receiver)) {
|
||||
isolate->ReportFailedAccessCheck(js_obj_receiver);
|
||||
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
|
||||
return isolate->factory()->undefined_value();
|
||||
}
|
||||
js_receiver->IsAccessCheckNeeded() &&
|
||||
!isolate->MayAccess(handle(isolate->context()), js_receiver)) {
|
||||
isolate->ReportFailedAccessCheck(js_receiver);
|
||||
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
|
||||
return isolate->factory()->undefined_value();
|
||||
}
|
||||
|
||||
raw_holder = GetCompatibleReceiver(isolate, *fun_data, *js_receiver);
|
||||
@ -180,6 +179,25 @@ MaybeHandle<Object> Builtins::InvokeApiFunction(Isolate* isolate,
|
||||
}
|
||||
}
|
||||
|
||||
if (function->IsFunctionTemplateInfo()) {
|
||||
Handle<FunctionTemplateInfo> info =
|
||||
Handle<FunctionTemplateInfo>::cast(function);
|
||||
// If we need to break at function entry, go the long way. Instantiate the
|
||||
// function, use the DebugBreakTrampoline, and call it through JS.
|
||||
if (info->BreakAtEntry()) {
|
||||
DCHECK(!is_construct);
|
||||
DCHECK(new_target->IsUndefined(isolate));
|
||||
Handle<JSFunction> function;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(isolate, function,
|
||||
ApiNatives::InstantiateFunction(
|
||||
info, MaybeHandle<v8::internal::Name>()),
|
||||
Object);
|
||||
Handle<Code> trampoline = BUILTIN_CODE(isolate, DebugBreakTrampoline);
|
||||
function->set_code(*trampoline);
|
||||
return Execution::Call(isolate, function, receiver, argc, args);
|
||||
}
|
||||
}
|
||||
|
||||
Handle<FunctionTemplateInfo> fun_data =
|
||||
function->IsFunctionTemplateInfo()
|
||||
? Handle<FunctionTemplateInfo>::cast(function)
|
||||
@ -224,7 +242,7 @@ MaybeHandle<Object> Builtins::InvokeApiFunction(Isolate* isolate,
|
||||
// Helper function to handle calls to non-function objects created through the
|
||||
// API. The object can be called as either a constructor (using new) or just as
|
||||
// a function (without new).
|
||||
MUST_USE_RESULT static Object* HandleApiCallAsFunctionOrConstructor(
|
||||
V8_WARN_UNUSED_RESULT static Object* HandleApiCallAsFunctionOrConstructor(
|
||||
Isolate* isolate, bool is_construct_call, BuiltinArguments args) {
|
||||
Handle<Object> receiver = args.receiver();
|
||||
|
||||
@ -259,7 +277,6 @@ MUST_USE_RESULT static Object* HandleApiCallAsFunctionOrConstructor(
|
||||
{
|
||||
HandleScope scope(isolate);
|
||||
LOG(isolate, ApiObjectAccess("call non-function", obj));
|
||||
|
||||
FunctionCallbackArguments custom(isolate, call_data->data(), constructor,
|
||||
obj, new_target, &args[0] - 1,
|
||||
args.length() - 1);
|
||||
|
1665
deps/v8/src/builtins/builtins-array-gen.cc
vendored
1665
deps/v8/src/builtins/builtins-array-gen.cc
vendored
File diff suppressed because it is too large
Load Diff
19
deps/v8/src/builtins/builtins-array-gen.h
vendored
19
deps/v8/src/builtins/builtins-array-gen.h
vendored
@ -73,8 +73,8 @@ class ArrayBuiltinsAssembler : public CodeStubAssembler {
|
||||
TNode<Object> receiver() { return receiver_; }
|
||||
Node* new_target() { return new_target_; }
|
||||
TNode<IntPtrT> argc() { return argc_; }
|
||||
Node* o() { return o_; }
|
||||
Node* len() { return len_; }
|
||||
TNode<JSReceiver> o() { return o_; }
|
||||
TNode<Number> len() { return len_; }
|
||||
Node* callbackfn() { return callbackfn_; }
|
||||
Node* this_arg() { return this_arg_; }
|
||||
Node* k() { return k_.value(); }
|
||||
@ -95,7 +95,8 @@ class ArrayBuiltinsAssembler : public CodeStubAssembler {
|
||||
ForEachDirection direction = ForEachDirection::kForward);
|
||||
void InitIteratingArrayBuiltinLoopContinuation(
|
||||
TNode<Context> context, TNode<Object> receiver, Node* callbackfn,
|
||||
Node* this_arg, Node* a, Node* o, Node* initial_k, Node* len, Node* to);
|
||||
Node* this_arg, Node* a, TNode<JSReceiver> o, Node* initial_k,
|
||||
TNode<Number> len, Node* to);
|
||||
|
||||
void GenerateIteratingTypedArrayBuiltinBody(
|
||||
const char* name, const BuiltinResultGenerator& generator,
|
||||
@ -112,13 +113,15 @@ class ArrayBuiltinsAssembler : public CodeStubAssembler {
|
||||
|
||||
void VisitAllTypedArrayElements(Node* array_buffer,
|
||||
const CallResultProcessor& processor,
|
||||
Label* detached, ForEachDirection direction);
|
||||
Label* detached, ForEachDirection direction,
|
||||
TNode<JSTypedArray> typed_array);
|
||||
|
||||
void VisitAllFastElementsOneKind(ElementsKind kind,
|
||||
const CallResultProcessor& processor,
|
||||
Label* array_changed, ParameterMode mode,
|
||||
ForEachDirection direction,
|
||||
MissingPropertyMode missing_property_mode);
|
||||
MissingPropertyMode missing_property_mode,
|
||||
TNode<Smi> length);
|
||||
|
||||
void HandleFastElements(const CallResultProcessor& processor,
|
||||
const PostLoopAction& action, Label* slow,
|
||||
@ -131,12 +134,12 @@ class ArrayBuiltinsAssembler : public CodeStubAssembler {
|
||||
void GenerateArraySpeciesCreate();
|
||||
|
||||
// Perform ArraySpeciesCreate (ES6 #sec-arrayspeciescreate).
|
||||
void GenerateArraySpeciesCreate(SloppyTNode<Smi> len);
|
||||
void GenerateArraySpeciesCreate(TNode<Number> len);
|
||||
|
||||
Node* callbackfn_ = nullptr;
|
||||
Node* o_ = nullptr;
|
||||
TNode<JSReceiver> o_;
|
||||
Node* this_arg_ = nullptr;
|
||||
Node* len_ = nullptr;
|
||||
TNode<Number> len_;
|
||||
TNode<Context> context_;
|
||||
TNode<Object> receiver_;
|
||||
Node* new_target_ = nullptr;
|
||||
|
84
deps/v8/src/builtins/builtins-array.cc
vendored
84
deps/v8/src/builtins/builtins-array.cc
vendored
@ -78,7 +78,7 @@ inline bool HasOnlySimpleElements(Isolate* isolate, JSReceiver* receiver) {
|
||||
}
|
||||
|
||||
// Returns |false| if not applicable.
|
||||
MUST_USE_RESULT
|
||||
V8_WARN_UNUSED_RESULT
|
||||
inline bool EnsureJSArrayWithWritableFastElements(Isolate* isolate,
|
||||
Handle<Object> receiver,
|
||||
BuiltinArguments* args,
|
||||
@ -128,9 +128,8 @@ inline bool EnsureJSArrayWithWritableFastElements(Isolate* isolate,
|
||||
return true;
|
||||
}
|
||||
|
||||
MUST_USE_RESULT static Object* CallJsIntrinsic(Isolate* isolate,
|
||||
Handle<JSFunction> function,
|
||||
BuiltinArguments args) {
|
||||
V8_WARN_UNUSED_RESULT static Object* CallJsIntrinsic(
|
||||
Isolate* isolate, Handle<JSFunction> function, BuiltinArguments args) {
|
||||
HandleScope handleScope(isolate);
|
||||
int argc = args.length() - 1;
|
||||
ScopedVector<Handle<Object>> argv(argc);
|
||||
@ -240,75 +239,6 @@ BUILTIN(ArrayUnshift) {
|
||||
return Smi::FromInt(new_length);
|
||||
}
|
||||
|
||||
BUILTIN(ArraySlice) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver = args.receiver();
|
||||
int len = -1;
|
||||
int relative_start = 0;
|
||||
int relative_end = 0;
|
||||
|
||||
if (receiver->IsJSArray()) {
|
||||
DisallowHeapAllocation no_gc;
|
||||
JSArray* array = JSArray::cast(*receiver);
|
||||
if (V8_UNLIKELY(!array->HasFastElements() ||
|
||||
!IsJSArrayFastElementMovingAllowed(isolate, array) ||
|
||||
!isolate->IsSpeciesLookupChainIntact() ||
|
||||
// If this is a subclass of Array, then call out to JS
|
||||
!array->HasArrayPrototype(isolate))) {
|
||||
AllowHeapAllocation allow_allocation;
|
||||
return CallJsIntrinsic(isolate, isolate->array_slice(), args);
|
||||
}
|
||||
len = Smi::ToInt(array->length());
|
||||
} else if (receiver->IsJSObject() &&
|
||||
JSSloppyArgumentsObject::GetSloppyArgumentsLength(
|
||||
isolate, Handle<JSObject>::cast(receiver), &len)) {
|
||||
// Array.prototype.slice.call(arguments, ...) is quite a common idiom
|
||||
// (notably more than 50% of invocations in Web apps).
|
||||
// Treat it in C++ as well.
|
||||
DCHECK(JSObject::cast(*receiver)->HasFastElements() ||
|
||||
JSObject::cast(*receiver)->HasFastArgumentsElements());
|
||||
} else {
|
||||
AllowHeapAllocation allow_allocation;
|
||||
return CallJsIntrinsic(isolate, isolate->array_slice(), args);
|
||||
}
|
||||
DCHECK_LE(0, len);
|
||||
int argument_count = args.length() - 1;
|
||||
// Note carefully chosen defaults---if argument is missing,
|
||||
// it's undefined which gets converted to 0 for relative_start
|
||||
// and to len for relative_end.
|
||||
relative_start = 0;
|
||||
relative_end = len;
|
||||
if (argument_count > 0) {
|
||||
DisallowHeapAllocation no_gc;
|
||||
if (!ClampedToInteger(isolate, args[1], &relative_start)) {
|
||||
AllowHeapAllocation allow_allocation;
|
||||
return CallJsIntrinsic(isolate, isolate->array_slice(), args);
|
||||
}
|
||||
if (argument_count > 1) {
|
||||
Object* end_arg = args[2];
|
||||
// slice handles the end_arg specially
|
||||
if (end_arg->IsUndefined(isolate)) {
|
||||
relative_end = len;
|
||||
} else if (!ClampedToInteger(isolate, end_arg, &relative_end)) {
|
||||
AllowHeapAllocation allow_allocation;
|
||||
return CallJsIntrinsic(isolate, isolate->array_slice(), args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ECMAScript 232, 3rd Edition, Section 15.4.4.10, step 6.
|
||||
uint32_t actual_start = (relative_start < 0) ? Max(len + relative_start, 0)
|
||||
: Min(relative_start, len);
|
||||
|
||||
// ECMAScript 232, 3rd Edition, Section 15.4.4.10, step 8.
|
||||
uint32_t actual_end =
|
||||
(relative_end < 0) ? Max(len + relative_end, 0) : Min(relative_end, len);
|
||||
|
||||
Handle<JSObject> object = Handle<JSObject>::cast(receiver);
|
||||
ElementsAccessor* accessor = object->GetElementsAccessor();
|
||||
return *accessor->Slice(object, actual_start, actual_end);
|
||||
}
|
||||
|
||||
BUILTIN(ArraySplice) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver = args.receiver();
|
||||
@ -317,7 +247,7 @@ BUILTIN(ArraySplice) {
|
||||
// If this is a subclass of Array, then call out to JS.
|
||||
!Handle<JSArray>::cast(receiver)->HasArrayPrototype(isolate) ||
|
||||
// If anything with @@species has been messed with, call out to JS.
|
||||
!isolate->IsSpeciesLookupChainIntact())) {
|
||||
!isolate->IsArraySpeciesLookupChainIntact())) {
|
||||
return CallJsIntrinsic(isolate, isolate->array_splice(), args);
|
||||
}
|
||||
Handle<JSArray> array = Handle<JSArray>::cast(receiver);
|
||||
@ -403,7 +333,7 @@ class ArrayConcatVisitor {
|
||||
|
||||
~ArrayConcatVisitor() { clear_storage(); }
|
||||
|
||||
MUST_USE_RESULT bool visit(uint32_t i, Handle<Object> elm) {
|
||||
V8_WARN_UNUSED_RESULT bool visit(uint32_t i, Handle<Object> elm) {
|
||||
uint32_t index = index_offset_ + i;
|
||||
|
||||
if (i >= JSObject::kMaxElementCount - index_offset_) {
|
||||
@ -481,7 +411,7 @@ class ArrayConcatVisitor {
|
||||
return array;
|
||||
}
|
||||
|
||||
MUST_USE_RESULT MaybeHandle<JSReceiver> ToJSReceiver() {
|
||||
V8_WARN_UNUSED_RESULT MaybeHandle<JSReceiver> ToJSReceiver() {
|
||||
DCHECK(!is_fixed_array());
|
||||
Handle<JSReceiver> result = Handle<JSReceiver>::cast(storage_);
|
||||
Handle<Object> length =
|
||||
@ -1187,7 +1117,7 @@ BUILTIN(ArrayConcat) {
|
||||
// Avoid a real species read to avoid extra lookups to the array constructor
|
||||
if (V8_LIKELY(receiver->IsJSArray() &&
|
||||
Handle<JSArray>::cast(receiver)->HasArrayPrototype(isolate) &&
|
||||
isolate->IsSpeciesLookupChainIntact())) {
|
||||
isolate->IsArraySpeciesLookupChainIntact())) {
|
||||
if (Fast_ArrayConcat(isolate, &args).ToHandle(&result_array)) {
|
||||
return *result_array;
|
||||
}
|
||||
|
41
deps/v8/src/builtins/builtins-arraybuffer.cc
vendored
41
deps/v8/src/builtins/builtins-arraybuffer.cc
vendored
@ -23,17 +23,6 @@ namespace internal {
|
||||
// -----------------------------------------------------------------------------
|
||||
// ES6 section 21.1 ArrayBuffer Objects
|
||||
|
||||
// ES6 section 24.1.2.1 ArrayBuffer ( length ) for the [[Call]] case.
|
||||
BUILTIN(ArrayBufferConstructor) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<JSFunction> target = args.target();
|
||||
DCHECK(*target == target->native_context()->array_buffer_fun() ||
|
||||
*target == target->native_context()->shared_array_buffer_fun());
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(
|
||||
isolate, NewTypeError(MessageTemplate::kConstructorNotFunction,
|
||||
handle(target->shared()->name(), isolate)));
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
Object* ConstructBuffer(Isolate* isolate, Handle<JSFunction> target,
|
||||
@ -62,24 +51,30 @@ Object* ConstructBuffer(Isolate* isolate, Handle<JSFunction> target,
|
||||
|
||||
} // namespace
|
||||
|
||||
// ES6 section 24.1.2.1 ArrayBuffer ( length ) for the [[Construct]] case.
|
||||
BUILTIN(ArrayBufferConstructor_ConstructStub) {
|
||||
// ES #sec-arraybuffer-constructor
|
||||
BUILTIN(ArrayBufferConstructor) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<JSFunction> target = args.target();
|
||||
Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target());
|
||||
Handle<Object> length = args.atOrUndefined(isolate, 1);
|
||||
DCHECK(*target == target->native_context()->array_buffer_fun() ||
|
||||
*target == target->native_context()->shared_array_buffer_fun());
|
||||
|
||||
Handle<Object> number_length;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, number_length,
|
||||
Object::ToInteger(isolate, length));
|
||||
if (number_length->Number() < 0.0) {
|
||||
if (args.new_target()->IsUndefined(isolate)) { // [[Call]]
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(
|
||||
isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength));
|
||||
}
|
||||
isolate, NewTypeError(MessageTemplate::kConstructorNotFunction,
|
||||
handle(target->shared()->Name(), isolate)));
|
||||
} else { // [[Construct]]
|
||||
Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target());
|
||||
Handle<Object> length = args.atOrUndefined(isolate, 1);
|
||||
|
||||
return ConstructBuffer(isolate, target, new_target, number_length, true);
|
||||
Handle<Object> number_length;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, number_length,
|
||||
Object::ToInteger(isolate, length));
|
||||
if (number_length->Number() < 0.0) {
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(
|
||||
isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength));
|
||||
}
|
||||
|
||||
return ConstructBuffer(isolate, target, new_target, number_length, true);
|
||||
}
|
||||
}
|
||||
|
||||
// This is a helper to construct an ArrayBuffer with uinitialized memory.
|
||||
|
4
deps/v8/src/builtins/builtins-async-gen.cc
vendored
4
deps/v8/src/builtins/builtins-async-gen.cc
vendored
@ -5,7 +5,7 @@
|
||||
#include "src/builtins/builtins-async-gen.h"
|
||||
|
||||
#include "src/builtins/builtins-utils-gen.h"
|
||||
#include "src/factory-inl.h"
|
||||
#include "src/heap/factory-inl.h"
|
||||
#include "src/objects/shared-function-info.h"
|
||||
|
||||
namespace v8 {
|
||||
@ -44,7 +44,7 @@ void AsyncBuiltinsAssembler::Await(Node* context, Node* generator, Node* value,
|
||||
// When debugging, we need to link from the {generator} to the
|
||||
// {outer_promise} of the async function/generator.
|
||||
Label done(this);
|
||||
GotoIfNot(IsDebugActive(), &done);
|
||||
GotoIfNot(IsPromiseHookEnabledOrDebugIsActive(), &done);
|
||||
CallRuntime(Runtime::kSetProperty, native_context, generator,
|
||||
LoadRoot(Heap::kgenerator_outer_promise_symbolRootIndex),
|
||||
outer_promise, SmiConstant(LanguageMode::kStrict));
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user