deps: update V8 to 7.7.299.4

PR-URL: https://github.com/nodejs/node/pull/28918
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Michaël Zasso 2019-08-16 11:32:46 +02:00
parent ec16fdae54
commit e31f0a7d25
No known key found for this signature in database
GPG Key ID: 770F7A9A5AE15600
2612 changed files with 78087 additions and 81494 deletions

11
deps/v8/.flake8 vendored Normal file
View File

@ -0,0 +1,11 @@
[flake8]
ignore = E111,E114,E310 # We use 2-space indentation
exclude =
./third_party/, # third-party code
./build/, # third-party code
./buildtools/, # third-party code
./tools/swarming_client/, # third-party code
./test/wasm-js/, # third-party code
./test/wasm-js/data/, # third-party code
./test/test262/data/, # third-party code
./test/test262/harness/, # third-party code

18
deps/v8/.gitignore vendored
View File

@ -26,7 +26,6 @@
.ccls-cache
.cpplint-cache
.cproject
.d8_history
.gclient_entries
.gdb_history
.landmines
@ -39,8 +38,7 @@
/build
/buildtools
/check-header-includes
/hydrogen.cfg
/obj
/Default/
/out
/out.gn
/perf.data
@ -72,6 +70,7 @@
/third_party/googletest/src/googletest/include/gtest/*
!/third_party/googletest/src/googletest/include/gtest/gtest_prod.h
!/third_party/v8
!/third_party/wasm-api
/tools/clang
/tools/gcmole/gcmole-tools
/tools/gcmole/gcmole-tools.tar.gz
@ -83,6 +82,9 @@
/tools/oom_dump/oom_dump
/tools/oom_dump/oom_dump.o
/tools/swarming_client
/tools/turbolizer/build
/tools/turbolizer/.rpt2_cache
/tools/turbolizer/deploy
/tools/visual_studio/Debug
/tools/visual_studio/Release
/v8.log.ll
@ -94,23 +96,15 @@ GTAGS
TAGS
bsuite
compile_commands.json
!/test/mjsunit/d8
d8_g
gccauses
gcsuspects
gtags.files
shell
shell_g
node_modules
tags
turbo*.cfg
turbo*.dot
turbo*.json
v8.ignition_dispatches_table.json
/Default/
node_modules
tools/turbolizer/build
tools/turbolizer/.rpt2_cache
tools/turbolizer/deploy
!/third_party/jinja2
!/third_party/markupsafe

5
deps/v8/AUTHORS vendored
View File

@ -128,17 +128,20 @@ Matthew Sporleder <msporleder@gmail.com>
Maxim Mazurok <maxim@mazurok.com>
Maxim Mossienko <maxim.mossienko@gmail.com>
Michael Lutz <michi@icosahedron.de>
Michael Mclaughlin <m8ch88l@gmail.com>
Michael Smith <mike@w3.org>
Michaël Zasso <mic.besace@gmail.com>
Mike Gilbert <floppymaster@gmail.com>
Mike Pennisi <mike@mikepennisi.com>
Mikhail Gusarov <dottedmag@dottedmag.net>
Milton Chiang <milton.chiang@mediatek.com>
Mu Tao <pamilty@gmail.com>
Myeong-bo Shim <m0609.shim@samsung.com>
Nicolas Antonius Ernst Leopold Maria Kaiser <nikai@nikai.net>
Niklas Hambüchen <mail@nh2.me>
Noj Vek <nojvek@gmail.com>
Oleksandr Chekhovskyi <oleksandr.chekhovskyi@gmail.com>
Oliver Dunk <oliver@oliverdunk.com>
Paolo Giarrusso <p.giarrusso@gmail.com>
Patrick Gansterer <paroga@paroga.com>
Peng Fei <pfgenyun@gmail.com>
@ -160,6 +163,7 @@ Rob Wu <rob@robwu.nl>
Robert Meijer <robert.s.meijer@gmail.com>
Robert Mustacchi <rm@fingolfin.org>
Robert Nagy <robert.nagy@gmail.com>
Ross Kirsling <rkirsling@gmail.com>
Ruben Bridgewater <ruben@bridgewater.de>
Ryan Dahl <ry@tinyclouds.org>
Sakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com>
@ -168,6 +172,7 @@ Sandro Santilli <strk@keybit.net>
Sanjoy Das <sanjoy@playingwithpointers.com>
Seo Sanghyeon <sanxiyn@gmail.com>
Shawn Anastasio <shawnanastasio@gmail.com>
Shawn Presser <shawnpresser@gmail.com>
Stefan Penner <stefan.penner@gmail.com>
Sylvestre Ledru <sledru@mozilla.com>
Taketoshi Aono <brn@b6n.ch>

252
deps/v8/BUILD.gn vendored
View File

@ -225,7 +225,7 @@ if (v8_enable_snapshot_native_code_counters == "") {
v8_enable_snapshot_native_code_counters = v8_enable_debugging_features
}
if (v8_enable_shared_ro_heap == "") {
v8_enable_shared_ro_heap = v8_enable_lite_mode
v8_enable_shared_ro_heap = !v8_enable_pointer_compression && v8_use_snapshot
}
if (v8_enable_fast_torque == "") {
v8_enable_fast_torque = v8_enable_fast_mksnapshot
@ -242,6 +242,8 @@ assert(!v8_enable_lite_mode || v8_use_snapshot,
assert(
!v8_enable_pointer_compression || !v8_enable_shared_ro_heap,
"Pointer compression is not supported with shared read-only heap enabled")
assert(v8_use_snapshot || !v8_enable_shared_ro_heap,
"Shared read-only heap requires snapshot")
v8_random_seed = "314159265"
v8_toolset_for_shell = "host"
@ -408,6 +410,7 @@ config("features") {
if (v8_enable_test_features) {
defines += [ "V8_ENABLE_ALLOCATION_TIMEOUT" ]
defines += [ "V8_ENABLE_FORCE_SLOW_PATH" ]
defines += [ "V8_ENABLE_DOUBLE_CONST_STORE_CHECK" ]
}
if (v8_enable_i18n_support) {
defines += [ "V8_INTL_SUPPORT" ]
@ -940,6 +943,7 @@ torque_files = [
"src/builtins/array-unshift.tq",
"src/builtins/array.tq",
"src/builtins/base.tq",
"src/builtins/bigint.tq",
"src/builtins/boolean.tq",
"src/builtins/collections.tq",
"src/builtins/data-view.tq",
@ -950,13 +954,20 @@ torque_files = [
"src/builtins/iterator.tq",
"src/builtins/math.tq",
"src/builtins/object-fromentries.tq",
"src/builtins/object.tq",
"src/builtins/proxy-constructor.tq",
"src/builtins/proxy-delete-property.tq",
"src/builtins/proxy-get-property.tq",
"src/builtins/proxy-get-prototype-of.tq",
"src/builtins/proxy-has-property.tq",
"src/builtins/proxy-is-extensible.tq",
"src/builtins/proxy-prevent-extensions.tq",
"src/builtins/proxy-revocable.tq",
"src/builtins/proxy-revoke.tq",
"src/builtins/proxy-set-property.tq",
"src/builtins/proxy-set-prototype-of.tq",
"src/builtins/proxy.tq",
"src/builtins/reflect.tq",
"src/builtins/regexp-replace.tq",
"src/builtins/regexp.tq",
"src/builtins/string.tq",
@ -988,57 +999,6 @@ if (!v8_enable_i18n_support) {
torque_files -= [ "src/objects/intl-objects.tq" ]
}
torque_namespaces = [
"arguments",
"array",
"array-copywithin",
"array-filter",
"array-find",
"array-findindex",
"array-foreach",
"array-join",
"array-map",
"array-of",
"array-reverse",
"array-shift",
"array-slice",
"array-splice",
"array-unshift",
"array-lastindexof",
"base",
"boolean",
"collections",
"data-view",
"extras-utils",
"growable-fixed-array",
"internal-coverage",
"iterator",
"math",
"object",
"proxy",
"regexp",
"regexp-replace",
"string",
"string-html",
"string-iterator",
"string-repeat",
"string-slice",
"string-substring",
"test",
"typed-array",
"typed-array-createtypedarray",
"typed-array-every",
"typed-array-filter",
"typed-array-find",
"typed-array-findindex",
"typed-array-foreach",
"typed-array-reduce",
"typed-array-reduceright",
"typed-array-slice",
"typed-array-some",
"typed-array-subarray",
]
action("run_torque") {
visibility = [
":*",
@ -1066,11 +1026,13 @@ action("run_torque") {
"$target_gen_dir/torque-generated/exported-macros-assembler-tq.cc",
"$target_gen_dir/torque-generated/exported-macros-assembler-tq.h",
"$target_gen_dir/torque-generated/csa-types-tq.h",
"$target_gen_dir/torque-generated/instance-types-tq.h",
]
foreach(namespace, torque_namespaces) {
foreach(file, torque_files) {
filetq = string_replace(file, ".tq", "-tq-csa")
outputs += [
"$target_gen_dir/torque-generated/builtins-$namespace-gen-tq.cc",
"$target_gen_dir/torque-generated/builtins-$namespace-gen-tq.h",
"$target_gen_dir/torque-generated/$filetq.cc",
"$target_gen_dir/torque-generated/$filetq.h",
]
}
@ -1080,11 +1042,10 @@ action("run_torque") {
root_build_dir),
"-o",
rebase_path("$target_gen_dir/torque-generated", root_build_dir),
"-v8-root",
rebase_path(".", root_build_dir),
]
foreach(file, torque_files) {
args += [ rebase_path(file, root_build_dir) ]
}
args += torque_files
}
group("v8_maybe_icu") {
@ -1112,10 +1073,11 @@ v8_source_set("torque_generated_initializers") {
"$target_gen_dir/torque-generated/exported-macros-assembler-tq.cc",
"$target_gen_dir/torque-generated/exported-macros-assembler-tq.h",
]
foreach(namespace, torque_namespaces) {
foreach(file, torque_files) {
filetq = string_replace(file, ".tq", "-tq-csa")
sources += [
"$target_gen_dir/torque-generated/builtins-$namespace-gen-tq.cc",
"$target_gen_dir/torque-generated/builtins-$namespace-gen-tq.h",
"$target_gen_dir/torque-generated/$filetq.cc",
"$target_gen_dir/torque-generated/$filetq.h",
]
}
@ -1515,6 +1477,7 @@ v8_source_set("v8_initializers") {
"src/builtins/builtins-async-generator-gen.cc",
"src/builtins/builtins-async-iterator-gen.cc",
"src/builtins/builtins-bigint-gen.cc",
"src/builtins/builtins-bigint-gen.h",
"src/builtins/builtins-boolean-gen.cc",
"src/builtins/builtins-call-gen.cc",
"src/builtins/builtins-call-gen.h",
@ -1776,6 +1739,8 @@ v8_compiler_sources = [
"src/compiler/control-equivalence.h",
"src/compiler/control-flow-optimizer.cc",
"src/compiler/control-flow-optimizer.h",
"src/compiler/csa-load-elimination.cc",
"src/compiler/csa-load-elimination.h",
"src/compiler/dead-code-elimination.cc",
"src/compiler/dead-code-elimination.h",
"src/compiler/decompression-elimination.cc",
@ -1913,6 +1878,8 @@ v8_compiler_sources = [
"src/compiler/state-values-utils.h",
"src/compiler/store-store-elimination.cc",
"src/compiler/store-store-elimination.h",
"src/compiler/add-type-assertions-reducer.cc",
"src/compiler/add-type-assertions-reducer.h",
"src/compiler/type-cache.cc",
"src/compiler/type-cache.h",
"src/compiler/type-narrowing-reducer.cc",
@ -2123,6 +2090,8 @@ v8_source_set("v8_base_without_compiler") {
"src/codegen/macro-assembler.h",
"src/codegen/optimized-compilation-info.cc",
"src/codegen/optimized-compilation-info.h",
"src/codegen/pending-optimization-table.cc",
"src/codegen/pending-optimization-table.h",
"src/codegen/register-arch.h",
"src/codegen/register-configuration.cc",
"src/codegen/register-configuration.h",
@ -2139,6 +2108,8 @@ v8_source_set("v8_base_without_compiler") {
"src/codegen/source-position.h",
"src/codegen/string-constants.cc",
"src/codegen/string-constants.h",
"src/codegen/tick-counter.cc",
"src/codegen/tick-counter.h",
"src/codegen/turbo-assembler.cc",
"src/codegen/turbo-assembler.h",
"src/codegen/unoptimized-compilation-info.cc",
@ -2148,7 +2119,6 @@ v8_source_set("v8_base_without_compiler") {
"src/common/checks.h",
"src/common/ptr-compr-inl.h",
"src/common/ptr-compr.h",
"src/common/v8memory.h",
"src/compiler-dispatcher/compiler-dispatcher.cc",
"src/compiler-dispatcher/compiler-dispatcher.h",
"src/compiler-dispatcher/optimizing-compile-dispatcher.cc",
@ -2212,8 +2182,11 @@ v8_source_set("v8_base_without_compiler") {
"src/execution/frames.h",
"src/execution/futex-emulation.cc",
"src/execution/futex-emulation.h",
"src/execution/interrupts-scope.cc",
"src/execution/interrupts-scope.h",
"src/execution/isolate-data.h",
"src/execution/isolate-inl.h",
"src/execution/isolate-utils.h",
"src/execution/isolate.cc",
"src/execution/isolate.h",
"src/execution/message-template.h",
@ -2226,6 +2199,8 @@ v8_source_set("v8_base_without_compiler") {
"src/execution/simulator-base.cc",
"src/execution/simulator-base.h",
"src/execution/simulator.h",
"src/execution/stack-guard.cc",
"src/execution/stack-guard.h",
"src/execution/thread-id.cc",
"src/execution/thread-id.h",
"src/execution/thread-local-top.cc",
@ -2234,6 +2209,8 @@ v8_source_set("v8_base_without_compiler") {
"src/execution/v8threads.h",
"src/execution/vm-state-inl.h",
"src/execution/vm-state.h",
"src/extensions/cputracemark-extension.cc",
"src/extensions/cputracemark-extension.h",
"src/extensions/externalize-string-extension.cc",
"src/extensions/externalize-string-extension.h",
"src/extensions/free-buffer-extension.cc",
@ -2262,6 +2239,8 @@ v8_source_set("v8_base_without_compiler") {
"src/heap/array-buffer-tracker.cc",
"src/heap/array-buffer-tracker.h",
"src/heap/barrier.h",
"src/heap/basic-memory-chunk.cc",
"src/heap/basic-memory-chunk.h",
"src/heap/code-stats.cc",
"src/heap/code-stats.h",
"src/heap/combined-heap.cc",
@ -2308,6 +2287,7 @@ v8_source_set("v8_base_without_compiler") {
"src/heap/objects-visiting-inl.h",
"src/heap/objects-visiting.cc",
"src/heap/objects-visiting.h",
"src/heap/read-only-heap-inl.h",
"src/heap/read-only-heap.cc",
"src/heap/read-only-heap.h",
"src/heap/remembered-set.h",
@ -2623,6 +2603,8 @@ v8_source_set("v8_base_without_compiler") {
"src/objects/slots-atomic-inl.h",
"src/objects/slots-inl.h",
"src/objects/slots.h",
"src/objects/source-text-module.cc",
"src/objects/source-text-module.h",
"src/objects/stack-frame-info-inl.h",
"src/objects/stack-frame-info.cc",
"src/objects/stack-frame-info.h",
@ -2635,6 +2617,10 @@ v8_source_set("v8_base_without_compiler") {
"src/objects/string.h",
"src/objects/struct-inl.h",
"src/objects/struct.h",
"src/objects/synthetic-module.cc",
"src/objects/synthetic-module.h",
"src/objects/tagged-field-inl.h",
"src/objects/tagged-field.h",
"src/objects/tagged-impl-inl.h",
"src/objects/tagged-impl.cc",
"src/objects/tagged-impl.h",
@ -2709,23 +2695,27 @@ v8_source_set("v8_base_without_compiler") {
"src/profiler/tick-sample.h",
"src/profiler/tracing-cpu-profiler.cc",
"src/profiler/tracing-cpu-profiler.h",
"src/regexp/bytecodes-irregexp.h",
"src/regexp/interpreter-irregexp.cc",
"src/regexp/interpreter-irregexp.h",
"src/regexp/jsregexp-inl.h",
"src/regexp/jsregexp.cc",
"src/regexp/jsregexp.h",
"src/regexp/property-sequences.cc",
"src/regexp/property-sequences.h",
"src/regexp/regexp-ast.cc",
"src/regexp/regexp-ast.h",
"src/regexp/regexp-macro-assembler-irregexp-inl.h",
"src/regexp/regexp-macro-assembler-irregexp.cc",
"src/regexp/regexp-macro-assembler-irregexp.h",
"src/regexp/regexp-bytecode-generator-inl.h",
"src/regexp/regexp-bytecode-generator.cc",
"src/regexp/regexp-bytecode-generator.h",
"src/regexp/regexp-bytecodes.h",
"src/regexp/regexp-compiler-tonode.cc",
"src/regexp/regexp-compiler.cc",
"src/regexp/regexp-compiler.h",
"src/regexp/regexp-dotprinter.cc",
"src/regexp/regexp-dotprinter.h",
"src/regexp/regexp-interpreter.cc",
"src/regexp/regexp-interpreter.h",
"src/regexp/regexp-macro-assembler-arch.h",
"src/regexp/regexp-macro-assembler-tracer.cc",
"src/regexp/regexp-macro-assembler-tracer.h",
"src/regexp/regexp-macro-assembler.cc",
"src/regexp/regexp-macro-assembler.h",
"src/regexp/regexp-nodes.h",
"src/regexp/regexp-parser.cc",
"src/regexp/regexp-parser.h",
"src/regexp/regexp-special-case.h",
@ -2733,6 +2723,8 @@ v8_source_set("v8_base_without_compiler") {
"src/regexp/regexp-stack.h",
"src/regexp/regexp-utils.cc",
"src/regexp/regexp-utils.h",
"src/regexp/regexp.cc",
"src/regexp/regexp.h",
"src/roots/roots-inl.h",
"src/roots/roots.cc",
"src/roots/roots.h",
@ -2866,8 +2858,6 @@ v8_source_set("v8_base_without_compiler") {
"src/utils/ostreams.cc",
"src/utils/ostreams.h",
"src/utils/pointer-with-payload.h",
"src/utils/splay-tree-inl.h",
"src/utils/splay-tree.h",
"src/utils/utils-inl.h",
"src/utils/utils.cc",
"src/utils/utils.h",
@ -2889,7 +2879,6 @@ v8_source_set("v8_base_without_compiler") {
"src/wasm/function-compiler.h",
"src/wasm/graph-builder-interface.cc",
"src/wasm/graph-builder-interface.h",
"src/wasm/js-to-wasm-wrapper-cache.h",
"src/wasm/jump-table-assembler.cc",
"src/wasm/jump-table-assembler.h",
"src/wasm/leb-helper.h",
@ -2909,6 +2898,7 @@ v8_source_set("v8_base_without_compiler") {
"src/wasm/streaming-decoder.cc",
"src/wasm/streaming-decoder.h",
"src/wasm/value-type.h",
"src/wasm/wasm-arguments.h",
"src/wasm/wasm-code-manager.cc",
"src/wasm/wasm-code-manager.h",
"src/wasm/wasm-constants.h",
@ -2956,7 +2946,6 @@ v8_source_set("v8_base_without_compiler") {
"src/zone/zone-list-inl.h",
"src/zone/zone-segment.cc",
"src/zone/zone-segment.h",
"src/zone/zone-splay-tree.h",
"src/zone/zone.cc",
"src/zone/zone.h",
]
@ -3348,6 +3337,7 @@ v8_source_set("torque_base") {
"src/torque/declarations.h",
"src/torque/earley-parser.cc",
"src/torque/earley-parser.h",
"src/torque/global-context.cc",
"src/torque/global-context.h",
"src/torque/implementation-visitor.cc",
"src/torque/implementation-visitor.h",
@ -3379,6 +3369,9 @@ v8_source_set("torque_base") {
":v8_libbase",
]
# The use of exceptions for Torque in violation of the Chromium style-guide
# is justified by the fact that it is only used from the non-essential
# language server and can be removed anytime if it causes problems.
configs = [
":internal_config",
"//build/config/compiler:exceptions",
@ -3421,6 +3414,9 @@ v8_source_set("torque_ls_base") {
":torque_base",
]
# The use of exceptions for Torque in violation of the Chromium style-guide
# is justified by the fact that it is only used from the non-essential
# language server and can be removed anytime if it causes problems.
configs = [
":internal_config",
"//build/config/compiler:exceptions",
@ -3476,7 +3472,9 @@ v8_component("v8_libbase") {
"src/base/list.h",
"src/base/logging.cc",
"src/base/logging.h",
"src/base/lsan.h",
"src/base/macros.h",
"src/base/memory.h",
"src/base/once.cc",
"src/base/once.h",
"src/base/optional.h",
@ -3506,6 +3504,8 @@ v8_component("v8_libbase") {
"src/base/type-traits.h",
"src/base/utils/random-number-generator.cc",
"src/base/utils/random-number-generator.h",
"src/base/vlq-base64.cc",
"src/base/vlq-base64.h",
]
configs = [ ":internal_config_base" ]
@ -3671,21 +3671,15 @@ v8_component("v8_libplatform") {
sources += [
"src/libplatform/tracing/json-trace-event-listener.cc",
"src/libplatform/tracing/json-trace-event-listener.h",
"src/libplatform/tracing/perfetto-consumer.cc",
"src/libplatform/tracing/perfetto-consumer.h",
"src/libplatform/tracing/perfetto-producer.cc",
"src/libplatform/tracing/perfetto-producer.h",
"src/libplatform/tracing/perfetto-shared-memory.cc",
"src/libplatform/tracing/perfetto-shared-memory.h",
"src/libplatform/tracing/perfetto-tasks.cc",
"src/libplatform/tracing/perfetto-tasks.h",
"src/libplatform/tracing/perfetto-tracing-controller.cc",
"src/libplatform/tracing/perfetto-tracing-controller.h",
"src/libplatform/tracing/trace-event-listener.cc",
"src/libplatform/tracing/trace-event-listener.h",
]
deps += [
"//third_party/perfetto:libperfetto",
"//third_party/perfetto/protos/perfetto/trace:lite",
"//third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite",
"//third_party/perfetto/protos/perfetto/trace/chrome:zero",
"//third_party/perfetto/src/tracing:client_api",
"//third_party/perfetto/src/tracing:platform_posix",
]
}
}
@ -3846,6 +3840,9 @@ if (current_toolchain == v8_snapshot_toolchain) {
"//build/win:default_exe_manifest",
]
# The use of exceptions for Torque in violation of the Chromium style-guide
# is justified by the fact that it is only used from the non-essential
# language server and can be removed anytime if it causes problems.
configs = [
":internal_config",
"//build/config/compiler:exceptions",
@ -3876,6 +3873,9 @@ v8_executable("torque-language-server") {
"//build/win:default_exe_manifest",
]
# The use of exceptions for Torque in violation of the Chromium style-guide
# is justified by the fact that it is only used from the non-essential
# language server and can be removed anytime if it causes problems.
configs = [
":internal_config",
"//build/config/compiler:exceptions",
@ -3892,50 +3892,53 @@ v8_executable("torque-language-server") {
}
}
if (current_toolchain == v8_generator_toolchain) {
v8_executable("gen-regexp-special-case") {
if (v8_enable_i18n_support) {
if (current_toolchain == v8_generator_toolchain) {
v8_executable("gen-regexp-special-case") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
sources = [
"src/regexp/gen-regexp-special-case.cc",
]
deps = [
":v8_libbase",
"//build/win:default_exe_manifest",
"//third_party/icu",
]
configs = [ ":internal_config" ]
}
}
action("run_gen-regexp-special-case") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
sources = [
"src/regexp/gen-regexp-special-case.cc",
]
script = "tools/run.py"
sources = v8_extra_library_files
deps = [
":v8_libbase",
"//build/win:default_exe_manifest",
"//third_party/icu",
":gen-regexp-special-case($v8_generator_toolchain)",
]
configs = [ ":internal_config" ]
output_file = "$target_gen_dir/src/regexp/special-case.cc"
outputs = [
output_file,
]
args = [
"./" + rebase_path(
get_label_info(
":gen-regexp-special-case($v8_generator_toolchain)",
"root_out_dir") + "/gen-regexp-special-case",
root_build_dir),
rebase_path(output_file, root_build_dir),
]
}
}
action("run_gen-regexp-special-case") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
script = "tools/run.py"
sources = v8_extra_library_files
deps = [
":gen-regexp-special-case($v8_generator_toolchain)",
]
output_file = "$target_gen_dir/src/regexp/special-case.cc"
outputs = [
output_file,
]
args = [
"./" + rebase_path(
get_label_info(":gen-regexp-special-case($v8_generator_toolchain)",
"root_out_dir") + "/gen-regexp-special-case",
root_build_dir),
rebase_path(output_file, root_build_dir),
]
}
###############################################################################
# Public targets
#
@ -4146,6 +4149,10 @@ v8_executable("d8") {
if (v8_enable_vtunejit) {
deps += [ "src/third_party/vtune:v8_vtune" ]
}
if (v8_use_perfetto) {
deps += [ "//third_party/perfetto/include/perfetto/tracing" ]
}
}
v8_executable("v8_hello_world") {
@ -4451,7 +4458,6 @@ group("v8_generated_cc_files") {
":js2c_extras",
":run_torque",
"src/inspector:v8_generated_cc_files",
"test/cctest:v8_generated_cc_files",
]
}

1535
deps/v8/ChangeLog vendored

File diff suppressed because it is too large Load Diff

44
deps/v8/DEPS vendored
View File

@ -12,10 +12,10 @@ vars = {
'check_v8_header_includes': False,
# GN CIPD package version.
'gn_version': 'git_revision:81ee1967d3fcbc829bac1c005c3da59739c88df9',
'gn_version': 'git_revision:972ed755f8e6d31cae9ba15fcd08136ae1a7886f',
# luci-go CIPD package version.
'luci_go': 'git_revision:25958d48e89e980e2a97daeddc977fb5e2e1fb8c',
'luci_go': 'git_revision:7d11fd9e66407c49cb6c8546a2ae45ea993a240c',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling android_sdk_build-tools_version
@ -24,11 +24,11 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling android_sdk_emulator_version
# and whatever else without interference from each other.
'android_sdk_emulator_version': 'ki7EDQRAiZAUYlnTWR1XmI6cJTk65fJ-DNZUU1zrtS8C',
'android_sdk_emulator_version': 'xhyuoquVvBTcJelgRjMKZeoBVSQRjB7pLVJPt5C9saIC',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling android_sdk_extras_version
# and whatever else without interference from each other.
'android_sdk_extras_version': 'iIwhhDox5E-mHgwUhCz8JACWQCpUjdqt5KTY9VLugKQC',
'android_sdk_extras_version': 'ppQ4TnqDvBHQ3lXx5KPq97egzF5X2FFyOrVHkGmiTMQC',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling android_sdk_patcher_version
# and whatever else without interference from each other.
@ -36,7 +36,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling android_sdk_platform-tools_version
# and whatever else without interference from each other.
'android_sdk_platform-tools_version': '4Y2Cb2LGzoc-qt-oIUIlhySotJaKeE3ELFedSVe6Uk8C',
'android_sdk_platform-tools_version': 'MSnxgXN7IurL-MQs1RrTkSFSb8Xd1UtZjLArI8Ty1FgC',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling android_sdk_platforms_version
# and whatever else without interference from each other.
@ -57,15 +57,15 @@ vars = {
deps = {
'v8/build':
Var('chromium_url') + '/chromium/src/build.git' + '@' + '4cebfa34c79bcfbce6a3f55d1b4f7628bb70ea8a',
Var('chromium_url') + '/chromium/src/build.git' + '@' + '1e5d7d692f816af8136c738b79fe9e8dde8057f6',
'v8/third_party/depot_tools':
Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '26af0d34d281440ad0dc6d2e43fe60f32ef62da0',
Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + 'ee7b9dda90e409fb92031d511151debe5db7db9f',
'v8/third_party/icu':
Var('chromium_url') + '/chromium/deps/icu.git' + '@' + '64e5d7d43a1ff205e3787ab6150bbc1a1837332b',
Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'fd97d4326fac6da84452b2d5fe75ff0949368dab',
'v8/third_party/instrumented_libraries':
Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + 'a959e4f0cb643003f2d75d179cede449979e3e77',
Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + 'b1c3ca20848c117eb935b02c25d441f03e6fbc5e',
'v8/buildtools':
Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '0218c0f9ac9fdba00e5c27b5aca94d3a64c74f34',
Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '67b293ca1316d06f7f00160ce35c92b8849a9dc9',
'v8/buildtools/clang_format/script':
Var('chromium_url') + '/chromium/llvm-project/cfe/tools/clang-format.git' + '@' + '96636aa0e9f047f17447f2d45a094d0b59ed7917',
'v8/buildtools/linux64': {
@ -110,11 +110,6 @@ deps = {
'url': Var('chromium_url') + '/android_ndk.git' + '@' + '4e2cea441bfd43f0863d14f57b1e1844260b9884',
'condition': 'checkout_android',
},
# This is deprecated.
'v8/third_party/android_tools': {
'url': Var('chromium_url') + '/android_tools.git' + '@' + '347a7c8078a009e98995985b7ab6ec6b35696dea',
'condition': 'checkout_android',
},
'v8/third_party/android_sdk/public': {
'packages': [
{
@ -158,7 +153,7 @@ deps = {
'dep_type': 'cipd',
},
'v8/third_party/catapult': {
'url': Var('chromium_url') + '/catapult.git' + '@' + 'a7b33124672f301cebe0ca94a67ca7d0362e3d6a',
'url': Var('chromium_url') + '/catapult.git' + '@' + '53913cecb11a3ef993f6496b9110964e2e2aeec3',
'condition': 'checkout_android',
},
'v8/third_party/colorama/src': {
@ -166,23 +161,23 @@ deps = {
'condition': 'checkout_android',
},
'v8/third_party/fuchsia-sdk': {
'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-sdk.git' + '@' + 'ae68779f84fc36bd88ba4fe0ff78ed9ea3c91d73',
'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-sdk.git' + '@' + '5fd29151cf35c0813c33cc368a7c78389e3f5caa',
'condition': 'checkout_fuchsia',
},
'v8/third_party/googletest/src':
Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + 'f71fb4f9a912ec945401cc49a287a759b6131026',
Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '6077f444da944d96d311d358d761164261f1cdd0',
'v8/third_party/jinja2':
Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + 'b41863e42637544c2941b574c7877d3e1f663e25',
'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' + '@' + '779c4f0f8488c64587b75dbb001d18c3c0c4cda9',
Var('chromium_url') + '/infra/luci/client-py.git' + '@' + '96f125709acfd0b48fc1e5dae7d6ea42291726ac',
'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' + '@' + 'a9abd418ccc7999b00b8c7df60b25620a7d3c541',
Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + '26a2268436f28f64c4539d9aab9ebd0f0b7c99c5',
'v8/test/test262/harness':
Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '4555345a943d0c99a9461182705543fb171dda4b',
'v8/third_party/qemu-linux-x64': {
@ -206,7 +201,7 @@ deps = {
'dep_type': 'cipd',
},
'v8/tools/clang':
Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'fe8ba88894e4b3927d3cd9e24274a0f1a688cf71',
Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'f485a21a9cb05494161d97d545c3b29447610ffb',
'v8/tools/luci-go': {
'packages': [
{
@ -236,15 +231,12 @@ deps = {
'dep_type': 'cipd',
},
'v8/test/wasm-js/data':
Var('chromium_url') + '/external/github.com/WebAssembly/spec.git' + '@' + 'bc7d3006bbda0de5031c2a1b9266a62fa7895019',
Var('chromium_url') + '/external/github.com/WebAssembly/spec.git' + '@' + '1a411f713d9850ce7da24719aba5bb80c535f562',
'v8/third_party/perfetto':
Var('android_url') + '/platform/external/perfetto.git' + '@' + '10c98fe0cfae669f71610d97e9da94260a6da173',
Var('android_url') + '/platform/external/perfetto.git' + '@' + '0e8281399fd854de13461f2c1c9f2fb0b8e9c3ae',
'v8/third_party/protobuf':
Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + 'b68a347f56137b4b1a746e8c7438495a6ac1bd91',
}
recursedeps = [
'v8/third_party/android_tools',
]
include_rules = [
# Everybody can use some things.

3
deps/v8/INTL_OWNERS vendored Normal file
View File

@ -0,0 +1,3 @@
cira@chromium.org
mnita@google.com
jshin@chromium.org

8
deps/v8/OWNERS vendored
View File

@ -2,20 +2,20 @@
# Disagreement among owners should be escalated to eng reviewers.
file://ENG_REVIEW_OWNERS
# TODO(9247) remove this.
file://COMMON_OWNERS
per-file .clang-format=file://INFRA_OWNERS
per-file .clang-tidy=file://INFRA_OWNERS
per-file .editorconfig=file://INFRA_OWNERS
per-file .flake8=file://INFRA_OWNERS
per-file .git-blame-ignore-revs=file://INFRA_OWNERS
per-file .gitattributes=file://INFRA_OWNERS
per-file .gitignore=file://INFRA_OWNERS
per-file .gn=file://INFRA_OWNERS
per-file .vpython=file://INFRA_OWNERS
per-file .ycm_extra_conf.py=file://INFRA_OWNERS
per-file BUILD.gn=file://INFRA_OWNERS
per-file BUILD.gn=file://COMMON_OWNERS
per-file DEPS=file://INFRA_OWNERS
# For Test262 rolls.
per-file DEPS=mathias@chromium.org
per-file PRESUBMIT=file://INFRA_OWNERS
per-file codereview.settings=file://INFRA_OWNERS

View File

@ -187,7 +187,10 @@ template("proto_library") {
"visibility",
])
# Exclude the config.descriptor file which is an output for some reason.
set_sources_assignment_filter([ "*.descriptor" ])
sources = get_target_outputs(":$action_name")
set_sources_assignment_filter(sources_assignment_filter)
# configs -= [ "//gn/standalone:extra_warnings" ]
if (defined(invoker.extra_configs)) {

2
deps/v8/gni/v8.gni vendored
View File

@ -92,7 +92,7 @@ if (v8_enable_backtrace == "") {
# subdirectories.
v8_path_prefix = get_path_info("../", "abspath")
v8_inspector_js_protocol = v8_path_prefix + "/src/inspector/js_protocol.pdl"
v8_inspector_js_protocol = v8_path_prefix + "/include/js_protocol.pdl"
###############################################################################
# Templates

View File

@ -67,3 +67,6 @@ which in turn guarantees long-term stability of the API.
# The V8 inspector
All debugging capabilities of V8 should be exposed via the inspector protocol.
The exception to this are profiling features exposed via v8-profiler.h.
Changes to the inspector protocol need to ensure backwards compatibility and
commitment to maintain.

View File

@ -1,16 +1,17 @@
set noparent
adamk@chromium.org
danno@chromium.org
ulan@chromium.org
yangguo@chromium.org
per-file v8-internal.h=file://OWNERS
per-file *DEPS=file://COMMON_OWNERS
per-file v8-internal.h=file://COMMON_OWNERS
per-file v8-inspector.h=dgozman@chromium.org
per-file v8-inspector.h=pfeldman@chromium.org
per-file v8-inspector.h=kozyatinskiy@chromium.org
per-file v8-inspector-protocol.h=dgozman@chromium.org
per-file v8-inspector-protocol.h=pfeldman@chromium.org
per-file v8-inspector-protocol.h=kozyatinskiy@chromium.org
per-file js_protocol.pdl=dgozman@chromium.org
per-file js_protocol.pdl=pfeldman@chromium.org
# COMPONENT: Blink>JavaScript>API

View File

@ -14,6 +14,10 @@
#include "libplatform/libplatform-export.h"
#include "v8-platform.h" // NOLINT(build/include)
namespace perfetto {
class TracingSession;
}
namespace v8 {
namespace base {
@ -23,8 +27,8 @@ class Mutex;
namespace platform {
namespace tracing {
class PerfettoTracingController;
class TraceEventListener;
class JSONTraceEventListener;
const int kTraceMaxNumArgs = 2;
@ -292,11 +296,10 @@ class V8_PLATFORM_EXPORT TracingController
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
std::atomic_bool recording_{false};
#ifdef V8_USE_PERFETTO
std::atomic_bool perfetto_recording_{false};
std::unique_ptr<PerfettoTracingController> perfetto_tracing_controller_;
std::ostream* output_stream_ = nullptr;
std::unique_ptr<TraceEventListener> json_listener_;
std::unique_ptr<JSONTraceEventListener> json_listener_;
TraceEventListener* listener_for_testing_ = nullptr;
std::unique_ptr<perfetto::TracingSession> tracing_session_;
#endif
// Disallow copy and assign

View File

@ -109,6 +109,8 @@ class V8_EXPORT V8StackTrace {
virtual ~V8StackTrace() = default;
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
buildInspectorObject() const = 0;
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
buildInspectorObject(int maxAsyncDepth) const = 0;
virtual std::unique_ptr<StringBuffer> toString() const = 0;
// Safe to pass between threads, drops async chain.
@ -130,10 +132,6 @@ class V8_EXPORT V8InspectorSession {
// Dispatching protocol messages.
static bool canDispatchMethod(const StringView& method);
virtual void dispatchProtocolMessage(const StringView& message) = 0;
virtual V8_DEPRECATED("Use state() instead",
std::unique_ptr<StringBuffer> stateJSON()) {
return nullptr;
}
virtual std::vector<uint8_t> state() = 0;
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
supportedDomains() = 0;

View File

@ -439,6 +439,14 @@ class Platform {
*/
virtual void DumpWithoutCrashing() {}
/**
* Lets the embedder to add crash keys.
*/
virtual void AddCrashKey(int id, const char* name, uintptr_t value) {
// "noop" is a valid implementation if the embedder doesn't care to log
// additional data for crashes.
}
protected:
/**
* Default implementation of current wall-clock time in milliseconds

View File

@ -9,9 +9,9 @@
// NOTE these macros are used by some of the tool scripts and the build
// system so their names cannot be changed without changing the scripts.
#define V8_MAJOR_VERSION 7
#define V8_MINOR_VERSION 6
#define V8_BUILD_NUMBER 303
#define V8_PATCH_LEVEL 28
#define V8_MINOR_VERSION 7
#define V8_BUILD_NUMBER 299
#define V8_PATCH_LEVEL 4
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)

190
deps/v8/include/v8.h vendored
View File

@ -1326,6 +1326,37 @@ class V8_EXPORT Module {
* kEvaluated or kErrored.
*/
Local<UnboundModuleScript> GetUnboundModuleScript();
/*
* Callback defined in the embedder. This is responsible for setting
* the module's exported values with calls to SetSyntheticModuleExport().
* The callback must return a Value to indicate success (where no
* exception was thrown) and return an empy MaybeLocal to indicate falure
* (where an exception was thrown).
*/
typedef MaybeLocal<Value> (*SyntheticModuleEvaluationSteps)(
Local<Context> context, Local<Module> module);
/**
* Creates a new SyntheticModule with the specified export names, where
* evaluation_steps will be executed upon module evaluation.
* export_names must not contain duplicates.
* module_name is used solely for logging/debugging and doesn't affect module
* behavior.
*/
static Local<Module> CreateSyntheticModule(
Isolate* isolate, Local<String> module_name,
const std::vector<Local<String>>& export_names,
SyntheticModuleEvaluationSteps evaluation_steps);
/**
* Set this module's exported value for the name export_name to the specified
* export_value. This method must be called only on Modules created via
* CreateSyntheticModule. export_name must be one of the export_names that
* were passed in that CreateSyntheticModule call.
*/
void SetSyntheticModuleExport(Local<String> export_name,
Local<Value> export_value);
};
/**
@ -3289,8 +3320,6 @@ enum class IntegrityLevel { kFrozen, kSealed };
*/
class V8_EXPORT Object : public Value {
public:
V8_DEPRECATED("Use maybe version",
bool Set(Local<Value> key, Local<Value> value));
/**
* Set only return Just(true) or Empty(), so if it should never fail, use
* result.Check().
@ -3298,8 +3327,6 @@ class V8_EXPORT Object : public Value {
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
Local<Value> key, Local<Value> value);
V8_DEPRECATED("Use maybe version",
bool Set(uint32_t index, Local<Value> value));
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
Local<Value> value);
@ -3341,13 +3368,12 @@ class V8_EXPORT Object : public Value {
//
// Returns true on success.
V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty(
Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
Local<Context> context, Local<Name> key,
PropertyDescriptor& descriptor); // NOLINT(runtime/references)
V8_DEPRECATED("Use maybe version", Local<Value> Get(Local<Value> key));
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
Local<Value> key);
V8_DEPRECATED("Use maybe version", Local<Value> Get(uint32_t index));
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
uint32_t index);
@ -5320,6 +5346,8 @@ class V8_EXPORT RegExp : public Object {
kDotAll = 1 << 5,
};
static constexpr int kFlagCount = 6;
/**
* Creates a regular expression from the given pattern string and
* the flags bit field. May throw a JavaScript exception as
@ -6406,7 +6434,19 @@ V8_INLINE Local<Boolean> False(Isolate* isolate);
*/
class V8_EXPORT ResourceConstraints {
public:
ResourceConstraints();
/**
* Configures the constraints with reasonable default values based on the
* provided heap size limit. The heap size includes both the young and
* the old generation.
*
* \param maximum_heap_size_in_bytes The hard limit for the heap size.
* When the heap size approaches this limit, V8 will perform series of
* garbage collections and invoke the NearHeapLimitCallback.
* If the garbage collections do not help and the callback does not
* increase the limit, then V8 will crash with V8::FatalProcessOutOfMemory.
*/
void ConfigureDefaultsFromHeapSize(size_t initial_heap_size_in_bytes,
size_t maximum_heap_size_in_bytes);
/**
* Configures the constraints with reasonable default values based on the
@ -6420,26 +6460,81 @@ class V8_EXPORT ResourceConstraints {
void ConfigureDefaults(uint64_t physical_memory,
uint64_t virtual_memory_limit);
// Returns the max semi-space size in KB.
size_t max_semi_space_size_in_kb() const {
return max_semi_space_size_in_kb_;
}
// Sets the max semi-space size in KB.
void set_max_semi_space_size_in_kb(size_t limit_in_kb) {
max_semi_space_size_in_kb_ = limit_in_kb;
}
size_t max_old_space_size() const { return max_old_space_size_; }
void set_max_old_space_size(size_t limit_in_mb) {
max_old_space_size_ = limit_in_mb;
}
/**
* The address beyond which the VM's stack may not grow.
*/
uint32_t* stack_limit() const { return stack_limit_; }
// Sets an address beyond which the VM's stack may not grow.
void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
size_t code_range_size() const { return code_range_size_; }
void set_code_range_size(size_t limit_in_mb) {
code_range_size_ = limit_in_mb;
/**
* The amount of virtual memory reserved for generated code. This is relevant
* for 64-bit architectures that rely on code range for calls in code.
*/
size_t code_range_size_in_bytes() const { return code_range_size_; }
void set_code_range_size_in_bytes(size_t limit) { code_range_size_ = limit; }
/**
* The maximum size of the old generation.
* When the old generation approaches this limit, V8 will perform series of
* garbage collections and invoke the NearHeapLimitCallback.
* If the garbage collections do not help and the callback does not
* increase the limit, then V8 will crash with V8::FatalProcessOutOfMemory.
*/
size_t max_old_generation_size_in_bytes() const {
return max_old_generation_size_;
}
void set_max_old_generation_size_in_bytes(size_t limit) {
max_old_generation_size_ = limit;
}
/**
* The maximum size of the young generation, which consists of two semi-spaces
* and a large object space. This affects frequency of Scavenge garbage
* collections and should be typically much smaller that the old generation.
*/
size_t max_young_generation_size_in_bytes() const {
return max_young_generation_size_;
}
void set_max_young_generation_size_in_bytes(size_t limit) {
max_young_generation_size_ = limit;
}
size_t initial_old_generation_size_in_bytes() const {
return initial_old_generation_size_;
}
void set_initial_old_generation_size_in_bytes(size_t initial_size) {
initial_old_generation_size_ = initial_size;
}
size_t initial_young_generation_size_in_bytes() const {
return initial_young_generation_size_;
}
void set_initial_young_generation_size_in_bytes(size_t initial_size) {
initial_young_generation_size_ = initial_size;
}
/**
* Deprecated functions. Do not use in new code.
*/
V8_DEPRECATE_SOON("Use code_range_size_in_bytes.",
size_t code_range_size() const) {
return code_range_size_ / kMB;
}
V8_DEPRECATE_SOON("Use set_code_range_size_in_bytes.",
void set_code_range_size(size_t limit_in_mb)) {
code_range_size_ = limit_in_mb * kMB;
}
V8_DEPRECATE_SOON("Use max_young_generation_size_in_bytes.",
size_t max_semi_space_size_in_kb() const);
V8_DEPRECATE_SOON("Use set_max_young_generation_size_in_bytes.",
void set_max_semi_space_size_in_kb(size_t limit_in_kb));
V8_DEPRECATE_SOON("Use max_old_generation_size_in_bytes.",
size_t max_old_space_size() const) {
return max_old_generation_size_ / kMB;
}
V8_DEPRECATE_SOON("Use set_max_old_generation_size_in_bytes.",
void set_max_old_space_size(size_t limit_in_mb)) {
max_old_generation_size_ = limit_in_mb * kMB;
}
V8_DEPRECATE_SOON("Zone does not pool memory any more.",
size_t max_zone_pool_size() const) {
@ -6451,14 +6546,14 @@ class V8_EXPORT ResourceConstraints {
}
private:
// max_semi_space_size_ is in KB
size_t max_semi_space_size_in_kb_;
// The remaining limits are in MB
size_t max_old_space_size_;
uint32_t* stack_limit_;
size_t code_range_size_;
size_t max_zone_pool_size_;
static constexpr size_t kMB = 1048576u;
size_t code_range_size_ = 0;
size_t max_old_generation_size_ = 0;
size_t max_young_generation_size_ = 0;
size_t max_zone_pool_size_ = 0;
size_t initial_old_generation_size_ = 0;
size_t initial_young_generation_size_ = 0;
uint32_t* stack_limit_ = nullptr;
};
@ -6617,7 +6712,8 @@ class PromiseRejectMessage {
typedef void (*PromiseRejectCallback)(PromiseRejectMessage message);
// --- Microtasks Callbacks ---
typedef void (*MicrotasksCompletedCallback)(Isolate*);
V8_DEPRECATE_SOON("Use *WithData version.",
typedef void (*MicrotasksCompletedCallback)(Isolate*));
typedef void (*MicrotasksCompletedCallbackWithData)(Isolate*, void*);
typedef void (*MicrotaskCallback)(void* data);
@ -6770,6 +6866,8 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
*/
typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context,
Local<String> source);
typedef MaybeLocal<String> (*ModifyCodeGenerationFromStringsCallback)(
Local<Context> context, Local<Value> source);
// --- WebAssembly compilation callbacks ---
typedef bool (*ExtensionCallback)(const FunctionCallbackInfo<Value>&);
@ -7230,12 +7328,13 @@ class V8_EXPORT EmbedderHeapTracer {
void GarbageCollectionForTesting(EmbedderStackState stack_state);
/*
* Called by the embedder to signal newly allocated memory. Not bound to
* tracing phases. Embedders should trade off when increments are reported as
* V8 may consult global heuristics on whether to trigger garbage collection
* on this change.
* Called by the embedder to signal newly allocated or freed memory. Not bound
* to tracing phases. Embedders should trade off when increments are reported
* as V8 may consult global heuristics on whether to trigger garbage
* collection on this change.
*/
void IncreaseAllocatedSize(size_t bytes);
void DecreaseAllocatedSize(size_t bytes);
/*
* Returns the v8::Isolate this tracer is attached too and |nullptr| if it
@ -7563,6 +7662,8 @@ class V8_EXPORT Isolate {
kRegExpMatchIsFalseishOnJSRegExp = 73,
kDateGetTimezoneOffset = 74,
kStringNormalize = 75,
kCallSiteAPIGetFunctionSloppyCall = 76,
kCallSiteAPIGetThisSloppyCall = 77,
// If you add new values here, you'll also need to update Chromium's:
// web_feature.mojom, UseCounterCallback.cpp, and enums.xml. V8 changes to
@ -8367,6 +8468,8 @@ class V8_EXPORT Isolate {
*/
void SetAllowCodeGenerationFromStringsCallback(
AllowCodeGenerationFromStringsCallback callback);
void SetModifyCodeGenerationFromStringsCallback(
ModifyCodeGenerationFromStringsCallback callback);
/**
* Set the callback to invoke to check if wasm code generation should
@ -9401,6 +9504,15 @@ class V8_EXPORT Context {
template <class T>
V8_INLINE MaybeLocal<T> GetDataFromSnapshotOnce(size_t index);
/**
* If callback is set, abort any attempt to execute JavaScript in this
* context, call the specified callback, and throw an exception.
* To unset abort, pass nullptr as callback.
*/
typedef void (*AbortScriptExecutionCallback)(Isolate* isolate,
Local<Context> context);
void SetAbortScriptExecution(AbortScriptExecutionCallback callback);
/**
* Stack-allocated class which sets the execution context for all
* operations executed within a local scope.

View File

@ -353,6 +353,12 @@
#define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
#endif
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error Inconsistent build configuration: To build the V8 shared library \
set BUILDING_V8_SHARED, to include its headers for linking against the \
V8 shared library set USING_V8_SHARED.
#endif
#ifdef V8_OS_WIN
// Setup for Windows DLL export/import. When building the V8 DLL the

View File

@ -31,6 +31,10 @@
"label": "//test:v8_d8_default",
"type": "script",
},
"generate-bytecode-expectations": {
"label": "//test/cctest:generate-bytecode-expectations",
"type": "script",
},
"mjsunit": {
"label": "//test/mjsunit:v8_mjsunit",
"type": "script",

View File

@ -95,6 +95,8 @@
'V8 iOS - sim': 'release_x64_ios_simulator',
'V8 Linux64 - debug - perfetto - builder': 'debug_x64_perfetto',
'V8 Linux64 - pointer compression': 'release_x64_pointer_compression',
'V8 Linux64 - pointer compression without dchecks':
'release_x64_pointer_compression_without_dchecks',
'V8 Linux64 - arm64 - sim - pointer compression - builder':
'release_simulate_arm64_pointer_compression',
'V8 Linux - noembed': 'release_x86_noembed',
@ -201,6 +203,7 @@
'v8_linux_verify_csa_rel_ng': 'release_x86_verify_csa',
'v8_linux_nodcheck_rel_ng': 'release_x86_minimal_symbols',
'v8_linux_dbg_ng': 'debug_x86_trybot',
'v8_linux_noi18n_compile_dbg': 'debug_x86_no_i18n',
'v8_linux_noi18n_rel_ng': 'release_x86_no_i18n_trybot',
'v8_linux_gc_stress_dbg': 'debug_x86_trybot',
'v8_linux_nosnap_rel': 'release_x86_no_snap_trybot',
@ -458,6 +461,8 @@
'release_x64_pointer_compression': [
'release_bot', 'x64', 'dcheck_always_on', 'v8_enable_slow_dchecks',
'v8_enable_pointer_compression'],
'release_x64_pointer_compression_without_dchecks': [
'release_bot', 'x64', 'v8_enable_pointer_compression'],
'release_x64_trybot': [
'release_trybot', 'x64'],
'release_x64_test_features_trybot': [
@ -491,7 +496,7 @@
'debug_x64_fuchsia': [
'debug_bot', 'x64', 'fuchsia'],
'debug_x64_gcc': [
'debug_bot', 'x64', 'gcc'],
'debug_bot', 'x64', 'gcc', 'v8_check_header_includes'],
'debug_x64_header_includes': [
'debug_bot', 'x64', 'v8_check_header_includes'],
'debug_x64_jumbo': [
@ -535,9 +540,10 @@
'release_x86_noembed_trybot': [
'release_trybot', 'x86', 'v8_no_enable_embedded_builtins'],
'release_x86_gcc': [
'release_bot', 'x86', 'gcc'],
'release_bot', 'x86', 'gcc', 'v8_check_header_includes'],
'release_x86_gcc_minimal_symbols': [
'release_bot', 'x86', 'gcc', 'minimal_symbols'],
'release_bot', 'x86', 'gcc', 'minimal_symbols',
'v8_check_header_includes'],
'release_x86_gcmole': [
'release_bot', 'x86', 'gcmole'],
'release_x86_gcmole_trybot': [

View File

@ -33,7 +33,9 @@ SUPPORTED_SWARMING_DIMENSIONS = [
]
# This is not an exhaustive list. It only reflects what we currently use. If
# there's need to specify a different property, just add it here.
# there's need to specify a different property, add it here and update the
# properties passed to swarming in:
# //build/scripts/slave/recipe_modules/v8/testing.py.
SUPPORTED_SWARMING_TASK_ATTRS = [
'expiration',
'hard_timeout',

View File

@ -51,7 +51,7 @@
'v8_linux_dbg_ng_triggered': {
'swarming_dimensions' : {
'cpu': 'x86-64-avx2',
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
@ -67,7 +67,7 @@
},
'v8_linux_gc_stress_dbg': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mjsunit', 'variant': 'slow_path', 'test_args': ['--gc-stress'], 'shards': 2},
@ -85,7 +85,7 @@
'v8_linux_nodcheck_rel_ng_triggered': {
'swarming_dimensions' : {
'cpu': 'x86-64-avx2',
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
@ -100,7 +100,7 @@
},
'v8_linux_noembed_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'shards': 2},
@ -108,7 +108,7 @@
},
'v8_linux_noi18n_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla', 'variant': 'default'},
@ -118,7 +118,7 @@
},
'v8_linux_nosnap_rel': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'variant': 'default', 'shards': 6},
@ -135,7 +135,7 @@
'v8_linux_rel_ng_triggered': {
'swarming_dimensions' : {
'cpu': 'x86-64-avx2',
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
@ -155,7 +155,7 @@
'v8_linux_optional_rel_ng_triggered': {
'swarming_dimensions' : {
'cpu': 'x86-64-avx2',
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
# Code serializer.
@ -210,7 +210,7 @@
},
'v8_linux_verify_csa_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'shards': 2},
@ -220,7 +220,7 @@
# Linux32 with arm simulators
'v8_linux_arm_dbg': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mjsunit_sp_frame_access'},
@ -233,7 +233,7 @@
},
'v8_linux_arm_lite_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'variant': 'default', 'shards': 4},
@ -241,7 +241,7 @@
},
'v8_linux_arm_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mjsunit_sp_frame_access', 'shards': 2},
@ -256,7 +256,7 @@
# Linux64
'v8_linux64_asan_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'test262_variants', 'shards': 7},
@ -267,7 +267,7 @@
},
'v8_linux64_cfi_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
@ -280,7 +280,7 @@
'v8_linux64_dbg_ng_triggered': {
'swarming_dimensions' : {
'cpu': 'x86-64-avx2',
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
@ -297,7 +297,7 @@
},
'v8_linux64_gc_stress_custom_snapshot_dbg_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{
@ -309,7 +309,7 @@
},
'v8_linux64_fyi_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
# Stress sampling.
@ -322,7 +322,7 @@
},
'v8_linux64_msan_rel': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'test262', 'shards': 2},
@ -332,23 +332,28 @@
'v8_linux64_nodcheck_rel_ng_triggered': {
'swarming_dimensions' : {
'cpu': 'x86-64-avx2',
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
{'name': 'benchmarks', 'variant': 'assert_types'},
{'name': 'benchmarks', 'variant': 'extra'},
{'name': 'check-bytecode-baseline'},
{'name': 'mozilla'},
{'name': 'mozilla', 'variant': 'assert_types'},
{'name': 'mozilla', 'variant': 'extra'},
{'name': 'perf_integration'},
{'name': 'test262_variants', 'shards': 2},
{'name': 'test262_variants', 'variant': 'assert_types', 'shards': 2},
{'name': 'test262_variants', 'variant': 'extra', 'shards': 2},
{'name': 'v8testing', 'shards': 2},
{'name': 'v8testing', 'variant': 'assert_types'},
{'name': 'v8testing', 'variant': 'extra'},
],
},
'v8_linux64_perfetto_dbg_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'shards': 3},
@ -356,7 +361,7 @@
},
'v8_linux64_pointer_compression_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'shards': 3},
@ -365,7 +370,7 @@
'v8_linux64_rel_ng_triggered': {
'swarming_dimensions' : {
'cpu': 'x86-64-avx2',
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
# TODO(machenbach): Add benchmarks.
@ -386,7 +391,7 @@
'v8_linux64_rel_xg': {
'swarming_dimensions' : {
'cpu': 'x86-64-avx2',
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8initializers'},
@ -395,7 +400,7 @@
},
'v8_linux64_sanitizer_coverage_rel': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'shards': 3},
@ -403,7 +408,7 @@
},
'v8_linux64_tsan_rel': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
@ -416,7 +421,7 @@
},
'v8_linux64_tsan_isolates_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'test_args': ['--isolates'], 'shards': 7},
@ -424,7 +429,7 @@
},
'v8_linux64_ubsan_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'shards': 2},
@ -432,7 +437,7 @@
},
'v8_linux64_verify_csa_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'shards': 2},
@ -442,7 +447,7 @@
# Linux64 with arm64 simulators
'v8_linux_arm64_dbg': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mjsunit_sp_frame_access'},
@ -455,7 +460,7 @@
},
'v8_linux_arm64_gc_stress_dbg': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 10},
@ -463,7 +468,7 @@
},
'v8_linux_arm64_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mjsunit_sp_frame_access', 'shards': 2},
@ -476,7 +481,7 @@
},
'v8_linux64_arm64_pointer_compression_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -632,7 +637,7 @@
# Main.
'V8 Fuzzer': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -646,7 +651,7 @@
'V8 Linux': {
'swarming_dimensions': {
'cpu': 'x86-64-avx2',
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
@ -688,7 +693,7 @@
},
'V8 Linux - arm64 - sim - MSAN': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'test262', 'shards': 3},
@ -698,7 +703,7 @@
'V8 Linux - debug': {
'swarming_dimensions': {
'cpu': 'x86-64-avx2',
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
@ -759,7 +764,7 @@
},
'V8 Linux - noembed': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing'},
@ -767,7 +772,7 @@
},
'V8 Linux - noembed - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'shards': 3},
@ -775,7 +780,7 @@
},
'V8 Linux - full debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -788,7 +793,7 @@
},
'V8 Linux - gc stress': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{
@ -806,7 +811,7 @@
},
'V8 Linux - noi18n - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla', 'variant': 'default'},
@ -816,7 +821,7 @@
},
'V8 Linux - nosnap': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -831,7 +836,7 @@
},
'V8 Linux - nosnap - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -844,7 +849,7 @@
},
'V8 Linux - predictable': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
@ -854,7 +859,7 @@
},
'V8 Linux - shared': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -864,7 +869,7 @@
},
'V8 Linux - verify csa': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing'},
@ -881,20 +886,25 @@
'V8 Linux64': {
'swarming_dimensions': {
'cpu': 'x86-64-avx2',
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
{'name': 'benchmarks', 'variant': 'assert_types'},
{'name': 'benchmarks', 'variant': 'extra'},
{'name': 'check-bytecode-baseline'},
{'name': 'mjsunit_sp_frame_access'},
{'name': 'mozilla'},
{'name': 'mozilla', 'variant': 'assert_types'},
{'name': 'mozilla', 'variant': 'extra'},
{'name': 'optimize_for_size'},
{'name': 'perf_integration'},
{'name': 'test262_variants', 'shards': 2},
{'name': 'test262_variants', 'variant': 'assert_types'},
{'name': 'test262_variants', 'variant': 'extra'},
{'name': 'v8initializers'},
{'name': 'v8testing'},
{'name': 'v8testing', 'variant': 'assert_types'},
{'name': 'v8testing', 'variant': 'extra'},
{'name': 'v8testing', 'variant': 'minor_mc', 'shards': 1},
# Noavx.
@ -917,7 +927,7 @@
},
'V8 Linux64 - cfi': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
@ -929,7 +939,7 @@
},
'V8 Linux64 - custom snapshot - debug': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mjsunit', 'test_args': ['--no-harness']},
@ -938,7 +948,7 @@
'V8 Linux64 - debug': {
'swarming_dimensions': {
'cpu': 'x86-64-avx2',
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
@ -974,7 +984,7 @@
},
'V8 Linux64 - debug - fyi': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
# Infra staging.
@ -986,7 +996,7 @@
},
'V8 Linux64 - debug - perfetto': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -999,7 +1009,7 @@
},
'V8 Linux64 - fyi': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
# Infra staging.
@ -1011,7 +1021,7 @@
},
'V8 Linux64 - gcov coverage': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing'},
@ -1019,7 +1029,7 @@
},
'V8 Linux64 - internal snapshot': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing'},
@ -1027,7 +1037,7 @@
},
'V8 Linux64 - pointer compression': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'shards': 2},
@ -1035,7 +1045,7 @@
},
'V8 Linux64 - shared': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1045,7 +1055,7 @@
},
'V8 Linux64 - verify csa': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing'},
@ -1053,7 +1063,7 @@
},
'V8 Linux64 ASAN': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'test262_variants', 'shards': 5},
@ -1064,7 +1074,7 @@
},
'V8 Linux64 GC Stress - custom snapshot': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{
@ -1076,7 +1086,7 @@
},
'V8 Linux64 TSAN': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'benchmarks'},
@ -1089,7 +1099,7 @@
},
'V8 Linux64 TSAN - concurrent marking': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -1119,7 +1129,7 @@
},
'V8 Linux64 TSAN - isolates': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'test_args': ['--isolates'], 'shards': 7},
@ -1127,7 +1137,7 @@
},
'V8 Linux64 UBSan': {
'swarming_dimensions' : {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1156,8 +1166,8 @@
'tests': [
{'name': 'mozilla'},
{'name': 'test262', 'shards': 2},
{'name': 'v8testing', 'shards': 3},
{'name': 'v8testing', 'variant': 'extra'},
{'name': 'v8testing', 'shards': 4},
{'name': 'v8testing', 'variant': 'extra', 'shards': 2},
],
},
'V8 Mac64 ASAN': {
@ -1266,74 +1276,44 @@
},
'V8 Arm': {
'swarming_dimensions': {
'cores': '2',
'cpu': 'armv7l',
'os': 'Ubuntu-14.04',
'cores': '8',
'cpu': 'armv7l-32-ODROID-XU4',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 21600,
'hard_timeout': 5400,
},
'tests': [
{'name': 'benchmarks'},
{'name': 'optimize_for_size'},
{'name': 'v8testing', 'shards': 2},
# Odroid.
{
'name': 'benchmarks',
'suffix': 'ODROID',
'swarming_dimensions': {
'cores': '8',
'os': 'Ubuntu-16.04',
'cpu': 'armv7l-32-ODROID-XU4',
},
# Less parallelism to prevent OOMs in benchmarks.
'test_args': ['-j2'],
},
{
'name': 'optimize_for_size',
'suffix': 'ODROID',
'swarming_dimensions': {
'cores': '8',
'os': 'Ubuntu-16.04',
'cpu': 'armv7l-32-ODROID-XU4',
}
},
{
'name': 'v8testing',
'suffix': 'ODROID',
'shards': 2,
'swarming_dimensions': {
'cores': '8',
'os': 'Ubuntu-16.04',
'cpu': 'armv7l-32-ODROID-XU4',
}
},
],
},
'V8 Arm - debug': {
'swarming_dimensions': {
'cores': '2',
'cpu': 'armv7l',
'os': 'Ubuntu-14.04',
'cores': '8',
'cpu': 'armv7l-32-ODROID-XU4',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 21600,
'hard_timeout': 3600,
},
'tests': [
{
'name': 'optimize_for_size',
'variant': 'default',
'test_args': ['--extra-flags=--verify-heap-skip-remembered-set'],
'shards': 2
},
{
'name': 'v8testing',
'variant': 'default',
'test_args': ['--extra-flags=--verify-heap-skip-remembered-set'],
'shards': 3
},
# Odroid.
{
'name': 'optimize_for_size',
@ -1341,11 +1321,6 @@
'variant': 'default',
'test_args': ['--extra-flags=--verify-heap-skip-remembered-set'],
'shards': 2,
'swarming_dimensions': {
'cores': '8',
'os': 'Ubuntu-16.04',
'cpu': 'armv7l-32-ODROID-XU4',
}
},
{
'name': 'v8testing',
@ -1353,48 +1328,32 @@
'variant': 'default',
'test_args': ['--extra-flags=--verify-heap-skip-remembered-set'],
'shards': 3,
'swarming_dimensions': {
'cores': '8',
'os': 'Ubuntu-16.04',
'cpu': 'armv7l-32-ODROID-XU4',
}
},
],
},
'V8 Arm GC Stress': {
'swarming_dimensions': {
'cores': '2',
'cpu': 'armv7l',
'os': 'Ubuntu-14.04',
'cores': '8',
'cpu': 'armv7l-32-ODROID-XU4',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 21600,
'hard_timeout': 7200,
},
'tests': [
{
'name': 'd8testing',
'variant': 'default',
'test_args': ['--gc-stress', '--extra-flags=--verify-heap-skip-remembered-set'],
'shards': 3
},
{
'name': 'd8testing',
'suffix': 'ODROID',
'variant': 'default',
'test_args': ['--gc-stress', '--extra-flags=--verify-heap-skip-remembered-set'],
'shards': 3,
'swarming_dimensions': {
'cores': '8',
'os': 'Ubuntu-16.04',
'cpu': 'armv7l-32-ODROID-XU4',
}
},
],
},
'V8 Linux - arm - sim': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mjsunit_sp_frame_access'},
@ -1433,7 +1392,7 @@
},
'V8 Linux - arm - sim - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mjsunit_sp_frame_access'},
@ -1446,12 +1405,14 @@
{
'name': 'mozilla',
'suffix': 'armv8-a',
'test_args': ['--extra-flags', '--enable-armv8']
'test_args': ['--extra-flags', '--enable-armv8'],
'shards': 2,
},
{
'name': 'test262',
'suffix': 'armv8-a',
'test_args': ['--extra-flags', '--enable-armv8']
'test_args': ['--extra-flags', '--enable-armv8'],
'shards': 2,
},
{
'name': 'v8testing',
@ -1483,7 +1444,7 @@
},
'V8 Linux - arm - sim - lite': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'variant': 'default', 'shards': 2},
@ -1491,7 +1452,7 @@
},
'V8 Linux - arm - sim - lite - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'variant': 'default', 'shards': 4},
@ -1499,7 +1460,7 @@
},
'V8 Linux - arm64 - sim': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mjsunit_sp_frame_access'},
@ -1512,7 +1473,7 @@
},
'V8 Linux - arm64 - sim - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
# TODO(machenbach): Remove longer timeout when this builder scales better.
'swarming_task_attrs': {
@ -1529,7 +1490,7 @@
},
'V8 Linux - arm64 - sim - gc stress': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -1546,7 +1507,7 @@
},
'V8 Linux - mips64el - sim': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -1560,7 +1521,7 @@
},
'V8 Linux - mipsel - sim': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -1574,7 +1535,7 @@
},
'V8 Linux - ppc64 - sim': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -1587,7 +1548,7 @@
},
'V8 Linux - s390x - sim': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -1600,7 +1561,7 @@
},
'V8 Linux64 - arm64 - sim - pointer compression': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 14400,
@ -1628,7 +1589,7 @@
# Clusterfuzz.
'V8 NumFuzz': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 13800,
@ -1645,7 +1606,7 @@
},
'V8 NumFuzz - TSAN': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 13800,
@ -1693,7 +1654,7 @@
},
'V8 NumFuzz - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'swarming_task_attrs': {
'expiration': 13800,
@ -1750,7 +1711,7 @@
# Branches.
'V8 Linux - beta branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1760,7 +1721,7 @@
},
'V8 Linux - beta branch - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1770,7 +1731,7 @@
},
'V8 Linux - stable branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1780,7 +1741,7 @@
},
'V8 Linux - stable branch - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1790,7 +1751,7 @@
},
'V8 Linux64 - beta branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1800,7 +1761,7 @@
},
'V8 Linux64 - beta branch - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1810,7 +1771,7 @@
},
'V8 Linux64 - stable branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1820,7 +1781,7 @@
},
'V8 Linux64 - stable branch - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1830,7 +1791,7 @@
},
'V8 arm - sim - beta branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1840,7 +1801,7 @@
},
'V8 arm - sim - beta branch - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1850,7 +1811,7 @@
},
'V8 arm - sim - stable branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1860,7 +1821,7 @@
},
'V8 arm - sim - stable branch - debug': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'mozilla'},
@ -1870,7 +1831,7 @@
},
'V8 mips64el - sim - beta branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'unittests'},
@ -1878,7 +1839,7 @@
},
'V8 mips64el - sim - stable branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'unittests'},
@ -1886,7 +1847,7 @@
},
'V8 mipsel - sim - beta branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'shards': 4},
@ -1894,7 +1855,7 @@
},
'V8 mipsel - sim - stable branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'v8testing', 'shards': 4},
@ -1902,7 +1863,7 @@
},
'V8 ppc64 - sim - beta branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'unittests'},
@ -1910,7 +1871,7 @@
},
'V8 ppc64 - sim - stable branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'unittests'},
@ -1918,7 +1879,7 @@
},
'V8 s390x - sim - beta branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'unittests'},
@ -1926,7 +1887,7 @@
},
'V8 s390x - sim - stable branch': {
'swarming_dimensions': {
'os': 'Ubuntu-14.04',
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'unittests'},

View File

@ -676,19 +676,17 @@ StringHttpRequest kSampleRequests[kSampleSize] = {
StringHttpRequest("/", "localhost", "yahoo.com", "firefox")
};
bool ProcessEntries(v8::Platform* platform, HttpRequestProcessor* processor,
int count, StringHttpRequest* reqs) {
bool ProcessEntries(v8::Isolate* isolate, v8::Platform* platform,
HttpRequestProcessor* processor, int count,
StringHttpRequest* reqs) {
for (int i = 0; i < count; i++) {
bool result = processor->Process(&reqs[i]);
while (v8::platform::PumpMessageLoop(platform, Isolate::GetCurrent()))
continue;
while (v8::platform::PumpMessageLoop(platform, isolate)) continue;
if (!result) return false;
}
return true;
}
void PrintMap(map<string, string>* m) {
for (map<string, string>::iterator i = m->begin(); i != m->end(); i++) {
pair<string, string> entry = *i;
@ -727,7 +725,9 @@ int main(int argc, char* argv[]) {
fprintf(stderr, "Error initializing processor.\n");
return 1;
}
if (!ProcessEntries(platform.get(), &processor, kSampleSize, kSampleRequests))
if (!ProcessEntries(isolate, platform.get(), &processor, kSampleSize,
kSampleRequests)) {
return 1;
}
PrintMap(&output);
}

6
deps/v8/src/DEPS vendored
View File

@ -16,6 +16,7 @@ include_rules = [
"+src/heap/heap-inl.h",
"+src/heap/heap-write-barrier-inl.h",
"+src/heap/heap-write-barrier.h",
"+src/heap/read-only-heap-inl.h",
"+src/heap/read-only-heap.h",
"-src/inspector",
"-src/interpreter",
@ -29,6 +30,10 @@ include_rules = [
"+src/interpreter/interpreter.h",
"+src/interpreter/interpreter-generator.h",
"+src/interpreter/setup-interpreter.h",
"-src/regexp",
"+src/regexp/regexp.h",
"+src/regexp/regexp-stack.h",
"+src/regexp/regexp-utils.h",
"-src/trap-handler",
"+src/trap-handler/handler-inside-posix.h",
"+src/trap-handler/handler-inside-win.h",
@ -44,5 +49,6 @@ specific_include_rules = {
"d8\.cc": [
"+include/libplatform/libplatform.h",
"+include/libplatform/v8-tracing.h",
"+perfetto/tracing.h"
],
}

10
deps/v8/src/OWNERS vendored
View File

@ -1,9 +1,5 @@
per-file intl.*=cira@chromium.org
per-file intl.*=mnita@google.com
per-file intl.*=jshin@chromium.org
per-file typing-asm.*=aseemgarg@chromium.org
per-file objects-body-descriptors*=hpayer@chromium.org
per-file objects-body-descriptors*=mlippautz@chromium.org
per-file objects-body-descriptors*=ulan@chromium.org
per-file *DEPS=file://COMMON_OWNERS
per-file intl-*=file://INTL_OWNERS
per-file *-intl*=file://INTL_OWNERS
# COMPONENT: Blink>JavaScript

11
deps/v8/src/api/OWNERS vendored Normal file
View File

@ -0,0 +1,11 @@
file://include/OWNERS
clemensh@chromium.org
ishell@chromium.org
jkummerow@chromium.org
leszeks@chromium.org
mlippautz@chromium.org
mslekova@chromium.org
mstarzinger@chromium.org
verwaest@chromium.org
# COMPONENT: Blink>JavaScript>API

View File

@ -5,8 +5,8 @@
#include "src/api/api-natives.h"
#include "src/api/api-inl.h"
#include "src/common/message-template.h"
#include "src/execution/isolate-inl.h"
#include "src/execution/message-template.h"
#include "src/objects/api-callbacks.h"
#include "src/objects/hash-table-inl.h"
#include "src/objects/lookup.h"
@ -39,7 +39,6 @@ class InvokeScope {
MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
Handle<ObjectTemplateInfo> data,
Handle<JSReceiver> new_target,
bool is_hidden_prototype,
bool is_prototype);
MaybeHandle<JSFunction> InstantiateFunction(
@ -54,7 +53,7 @@ MaybeHandle<Object> Instantiate(
isolate, Handle<FunctionTemplateInfo>::cast(data), maybe_name);
} else if (data->IsObjectTemplateInfo()) {
return InstantiateObject(isolate, Handle<ObjectTemplateInfo>::cast(data),
Handle<JSReceiver>(), false, false);
Handle<JSReceiver>(), false);
} else {
return data;
}
@ -129,7 +128,7 @@ void DisableAccessChecks(Isolate* isolate, Handle<JSObject> object) {
// Copy map so it won't interfere constructor's initial map.
Handle<Map> new_map = Map::Copy(isolate, old_map, "DisableAccessChecks");
new_map->set_is_access_check_needed(false);
JSObject::MigrateToMap(Handle<JSObject>::cast(object), new_map);
JSObject::MigrateToMap(isolate, Handle<JSObject>::cast(object), new_map);
}
void EnableAccessChecks(Isolate* isolate, Handle<JSObject> object) {
@ -138,7 +137,7 @@ void EnableAccessChecks(Isolate* isolate, Handle<JSObject> object) {
Handle<Map> new_map = Map::Copy(isolate, old_map, "EnableAccessChecks");
new_map->set_is_access_check_needed(true);
new_map->set_may_have_interesting_symbols(true);
JSObject::MigrateToMap(object, new_map);
JSObject::MigrateToMap(isolate, object, new_map);
}
class AccessCheckDisableScope {
@ -178,8 +177,7 @@ Object GetIntrinsic(Isolate* isolate, v8::Intrinsic intrinsic) {
template <typename TemplateInfoT>
MaybeHandle<JSObject> ConfigureInstance(Isolate* isolate, Handle<JSObject> obj,
Handle<TemplateInfoT> data,
bool is_hidden_prototype) {
Handle<TemplateInfoT> data) {
HandleScope scope(isolate);
// Disable access checks while instantiating the object.
AccessCheckDisableScope access_check_scope(isolate, obj);
@ -246,11 +244,10 @@ MaybeHandle<JSObject> ConfigureInstance(Isolate* isolate, Handle<JSObject> obj,
} else {
auto getter = handle(properties->get(i++), isolate);
auto setter = handle(properties->get(i++), isolate);
RETURN_ON_EXCEPTION(
isolate,
DefineAccessorProperty(isolate, obj, name, getter, setter,
attributes, is_hidden_prototype),
JSObject);
RETURN_ON_EXCEPTION(isolate,
DefineAccessorProperty(isolate, obj, name, getter,
setter, attributes, false),
JSObject);
}
} else {
// Intrinsic data property --- Get appropriate value from the current
@ -364,7 +361,6 @@ bool IsSimpleInstantiation(Isolate* isolate, ObjectTemplateInfo info,
MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
Handle<ObjectTemplateInfo> info,
Handle<JSReceiver> new_target,
bool is_hidden_prototype,
bool is_prototype) {
Handle<JSFunction> constructor;
int serial_number = Smi::ToInt(info->serial_number());
@ -413,8 +409,7 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
if (is_prototype) JSObject::OptimizeAsPrototype(object);
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
ConfigureInstance(isolate, object, info, is_hidden_prototype), JSObject);
isolate, result, ConfigureInstance(isolate, object, info), JSObject);
if (info->immutable_proto()) {
JSObject::SetImmutableProto(object);
}
@ -486,7 +481,7 @@ MaybeHandle<JSFunction> InstantiateFunction(Isolate* isolate,
InstantiateObject(
isolate,
handle(ObjectTemplateInfo::cast(prototype_templ), isolate),
Handle<JSReceiver>(), false, true),
Handle<JSReceiver>(), true),
JSFunction);
}
Object parent = data->GetParentTemplate();
@ -514,8 +509,7 @@ MaybeHandle<JSFunction> InstantiateFunction(Isolate* isolate,
CacheTemplateInstantiation(isolate, serial_number, CachingMode::kUnlimited,
function);
}
MaybeHandle<JSObject> result =
ConfigureInstance(isolate, function, data, false);
MaybeHandle<JSObject> result = ConfigureInstance(isolate, function, data);
if (result.is_null()) {
// Uncache on error.
if (serial_number) {
@ -560,8 +554,7 @@ MaybeHandle<JSObject> ApiNatives::InstantiateObject(
Isolate* isolate, Handle<ObjectTemplateInfo> data,
Handle<JSReceiver> new_target) {
InvokeScope invoke_scope(isolate);
return ::v8::internal::InstantiateObject(isolate, data, new_target, false,
false);
return ::v8::internal::InstantiateObject(isolate, data, new_target, false);
}
MaybeHandle<JSObject> ApiNatives::InstantiateRemoteObject(

436
deps/v8/src/api/api.cc vendored
View File

@ -237,18 +237,10 @@ namespace v8 {
#define RETURN_ON_FAILED_EXECUTION_PRIMITIVE(T) \
EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, Nothing<T>())
#define RETURN_TO_LOCAL_UNCHECKED(maybe_local, T) \
return maybe_local.FromMaybe(Local<T>());
#define RETURN_ESCAPED(value) return handle_scope.Escape(value);
namespace {
Local<Context> ContextFromNeverReadOnlySpaceObject(
i::Handle<i::JSReceiver> obj) {
return reinterpret_cast<v8::Isolate*>(obj->GetIsolate())->GetCurrentContext();
}
class InternalEscapableScope : public v8::EscapableHandleScope {
public:
explicit inline InternalEscapableScope(i::Isolate* isolate)
@ -447,7 +439,7 @@ void i::V8::FatalProcessOutOfMemory(i::Isolate* isolate, const char* location,
heap_stats.end_marker = &end_marker;
if (isolate->heap()->HasBeenSetUp()) {
// BUG(1718): Don't use the take_snapshot since we don't support
// HeapIterator here without doing a special GC.
// HeapObjectIterator here without doing a special GC.
isolate->heap()->RecordStats(&heap_stats, false);
char* first_newline = strchr(last_few_messages, '\n');
if (first_newline == nullptr || first_newline[1] == '\0')
@ -764,9 +756,9 @@ StartupData SnapshotCreator::CreateBlob(
std::vector<i::Handle<i::SharedFunctionInfo>> sfis_to_clear;
{ // Heap allocation is disallowed within this scope.
i::HeapIterator heap_iterator(isolate->heap());
for (i::HeapObject current_obj = heap_iterator.next();
!current_obj.is_null(); current_obj = heap_iterator.next()) {
i::HeapObjectIterator heap_iterator(isolate->heap());
for (i::HeapObject current_obj = heap_iterator.Next();
!current_obj.is_null(); current_obj = heap_iterator.Next()) {
if (current_obj.IsSharedFunctionInfo()) {
i::SharedFunctionInfo shared =
i::SharedFunctionInfo::cast(current_obj);
@ -810,17 +802,19 @@ StartupData SnapshotCreator::CreateBlob(
i::SerializedHandleChecker handle_checker(isolate, &contexts);
CHECK(handle_checker.CheckGlobalAndEternalHandles());
i::HeapIterator heap_iterator(isolate->heap());
for (i::HeapObject current_obj = heap_iterator.next(); !current_obj.is_null();
current_obj = heap_iterator.next()) {
i::HeapObjectIterator heap_iterator(isolate->heap());
for (i::HeapObject current_obj = heap_iterator.Next(); !current_obj.is_null();
current_obj = heap_iterator.Next()) {
if (current_obj.IsJSFunction()) {
i::JSFunction fun = i::JSFunction::cast(current_obj);
// Complete in-object slack tracking for all functions.
fun.CompleteInobjectSlackTrackingIfActive();
fun.ResetIfBytecodeFlushed();
// Also, clear out feedback vectors, or any optimized code.
if (!fun.raw_feedback_cell().value().IsUndefined()) {
if (fun.IsOptimized() || fun.IsInterpreted()) {
fun.raw_feedback_cell().set_value(
i::ReadOnlyRoots(isolate).undefined_value());
fun.set_code(isolate->builtins()->builtin(i::Builtins::kCompileLazy));
@ -963,44 +957,59 @@ Extension::Extension(const char* name, const char* source, int dep_count,
CHECK(source != nullptr || source_length_ == 0);
}
ResourceConstraints::ResourceConstraints()
: max_semi_space_size_in_kb_(0),
max_old_space_size_(0),
stack_limit_(nullptr),
code_range_size_(0),
max_zone_pool_size_(0) {}
void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
uint64_t virtual_memory_limit) {
set_max_semi_space_size_in_kb(
i::Heap::ComputeMaxSemiSpaceSize(physical_memory));
set_max_old_space_size(i::Heap::ComputeMaxOldGenerationSize(physical_memory));
if (virtual_memory_limit > 0 && i::kRequiresCodeRange) {
// Reserve no more than 1/8 of the memory for the code range, but at most
// kMaximalCodeRangeSize.
set_code_range_size(
i::Min(i::kMaximalCodeRangeSize / i::MB,
static_cast<size_t>((virtual_memory_limit >> 3) / i::MB)));
void ResourceConstraints::ConfigureDefaultsFromHeapSize(
size_t initial_heap_size_in_bytes, size_t maximum_heap_size_in_bytes) {
CHECK_LE(initial_heap_size_in_bytes, maximum_heap_size_in_bytes);
if (maximum_heap_size_in_bytes == 0) {
return;
}
size_t young_generation, old_generation;
i::Heap::GenerationSizesFromHeapSize(maximum_heap_size_in_bytes,
&young_generation, &old_generation);
set_max_young_generation_size_in_bytes(
i::Max(young_generation, i::Heap::MinYoungGenerationSize()));
set_max_old_generation_size_in_bytes(
i::Max(old_generation, i::Heap::MinOldGenerationSize()));
if (initial_heap_size_in_bytes > 0) {
i::Heap::GenerationSizesFromHeapSize(initial_heap_size_in_bytes,
&young_generation, &old_generation);
// We do not set lower bounds for the initial sizes.
set_initial_young_generation_size_in_bytes(young_generation);
set_initial_old_generation_size_in_bytes(old_generation);
}
if (i::kRequiresCodeRange) {
set_code_range_size_in_bytes(
i::Min(i::kMaximalCodeRangeSize, maximum_heap_size_in_bytes));
}
}
void SetResourceConstraints(i::Isolate* isolate,
const ResourceConstraints& constraints) {
size_t semi_space_size = constraints.max_semi_space_size_in_kb();
size_t old_space_size = constraints.max_old_space_size();
size_t code_range_size = constraints.code_range_size();
if (semi_space_size != 0 || old_space_size != 0 || code_range_size != 0) {
isolate->heap()->ConfigureHeap(semi_space_size, old_space_size,
code_range_size);
}
void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
uint64_t virtual_memory_limit) {
size_t heap_size = i::Heap::HeapSizeFromPhysicalMemory(physical_memory);
size_t young_generation, old_generation;
i::Heap::GenerationSizesFromHeapSize(heap_size, &young_generation,
&old_generation);
set_max_young_generation_size_in_bytes(young_generation);
set_max_old_generation_size_in_bytes(old_generation);
if (constraints.stack_limit() != nullptr) {
uintptr_t limit = reinterpret_cast<uintptr_t>(constraints.stack_limit());
isolate->stack_guard()->SetStackLimit(limit);
if (virtual_memory_limit > 0 && i::kRequiresCodeRange) {
set_code_range_size_in_bytes(
i::Min(i::kMaximalCodeRangeSize,
static_cast<size_t>(virtual_memory_limit / 8)));
}
}
size_t ResourceConstraints::max_semi_space_size_in_kb() const {
return i::Heap::SemiSpaceSizeFromYoungGenerationSize(
max_young_generation_size_) /
i::KB;
}
void ResourceConstraints::set_max_semi_space_size_in_kb(size_t limit_in_kb) {
set_max_young_generation_size_in_bytes(
i::Heap::YoungGenerationSizeFromSemiSpaceSize(limit_in_kb * i::KB));
}
i::Address* V8::GlobalizeReference(i::Isolate* isolate, i::Address* obj) {
LOG_API(isolate, Persistent, New);
i::Handle<i::Object> result = isolate->global_handles()->Create(*obj);
@ -1369,29 +1378,28 @@ static Local<ObjectTemplate> ObjectTemplateNew(
bool do_not_cache);
Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
i::Isolate* i_isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
i::Handle<i::Object> result(Utils::OpenHandle(this)->GetPrototypeTemplate(),
i_isolate);
i::Handle<i::Object> result(self->GetPrototypeTemplate(), i_isolate);
if (result->IsUndefined(i_isolate)) {
// Do not cache prototype objects.
result = Utils::OpenHandle(
*ObjectTemplateNew(i_isolate, Local<FunctionTemplate>(), true));
i::FunctionTemplateInfo::SetPrototypeTemplate(
i_isolate, Utils::OpenHandle(this), result);
i::FunctionTemplateInfo::SetPrototypeTemplate(i_isolate, self, result);
}
return ToApiHandle<ObjectTemplate>(result);
}
void FunctionTemplate::SetPrototypeProviderTemplate(
Local<FunctionTemplate> prototype_provider) {
i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
i::Isolate* i_isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
i::Handle<i::Object> result = Utils::OpenHandle(*prototype_provider);
auto info = Utils::OpenHandle(this);
CHECK(info->GetPrototypeTemplate().IsUndefined(i_isolate));
CHECK(info->GetParentTemplate().IsUndefined(i_isolate));
i::FunctionTemplateInfo::SetPrototypeProviderTemplate(i_isolate, info,
CHECK(self->GetPrototypeTemplate().IsUndefined(i_isolate));
CHECK(self->GetParentTemplate().IsUndefined(i_isolate));
i::FunctionTemplateInfo::SetPrototypeProviderTemplate(i_isolate, self,
result);
}
@ -1420,17 +1428,21 @@ static Local<FunctionTemplate> FunctionTemplateNew(
i::FUNCTION_TEMPLATE_INFO_TYPE, i::AllocationType::kOld);
i::Handle<i::FunctionTemplateInfo> obj =
i::Handle<i::FunctionTemplateInfo>::cast(struct_obj);
InitializeFunctionTemplate(obj);
obj->set_do_not_cache(do_not_cache);
int next_serial_number = i::FunctionTemplateInfo::kInvalidSerialNumber;
if (!do_not_cache) {
next_serial_number = isolate->heap()->GetNextTemplateSerialNumber();
{
// Disallow GC until all fields of obj have acceptable types.
i::DisallowHeapAllocation no_gc;
InitializeFunctionTemplate(obj);
obj->set_length(length);
obj->set_do_not_cache(do_not_cache);
int next_serial_number = i::FunctionTemplateInfo::kInvalidSerialNumber;
if (!do_not_cache) {
next_serial_number = isolate->heap()->GetNextTemplateSerialNumber();
}
obj->set_serial_number(i::Smi::FromInt(next_serial_number));
}
obj->set_serial_number(i::Smi::FromInt(next_serial_number));
if (callback != nullptr) {
Utils::ToLocal(obj)->SetCallHandler(callback, data, side_effect_type);
}
obj->set_length(length);
obj->set_undetectable(false);
obj->set_needs_access_check(false);
obj->set_accept_any_receiver(true);
@ -2000,9 +2012,10 @@ bool ObjectTemplate::IsImmutableProto() {
}
void ObjectTemplate::SetImmutableProto() {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
Utils::OpenHandle(this)->set_immutable_proto(true);
self->set_immutable_proto(true);
}
// --- S c r i p t s ---
@ -2222,29 +2235,40 @@ Local<Value> Module::GetException() const {
int Module::GetModuleRequestsLength() const {
i::Handle<i::Module> self = Utils::OpenHandle(this);
return self->info().module_requests().length();
if (self->IsSyntheticModule()) return 0;
return i::Handle<i::SourceTextModule>::cast(self)
->info()
.module_requests()
.length();
}
Local<String> Module::GetModuleRequest(int i) const {
CHECK_GE(i, 0);
i::Handle<i::Module> self = Utils::OpenHandle(this);
CHECK(self->IsSourceTextModule());
i::Isolate* isolate = self->GetIsolate();
i::Handle<i::FixedArray> module_requests(self->info().module_requests(),
isolate);
i::Handle<i::FixedArray> module_requests(
i::Handle<i::SourceTextModule>::cast(self)->info().module_requests(),
isolate);
CHECK_LT(i, module_requests->length());
return ToApiHandle<String>(i::handle(module_requests->get(i), isolate));
}
Location Module::GetModuleRequestLocation(int i) const {
CHECK_GE(i, 0);
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
i::HandleScope scope(isolate);
i::Handle<i::Module> self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
i::HandleScope scope(isolate);
CHECK(self->IsSourceTextModule());
i::Handle<i::FixedArray> module_request_positions(
self->info().module_request_positions(), isolate);
i::Handle<i::SourceTextModule>::cast(self)
->info()
.module_request_positions(),
isolate);
CHECK_LT(i, module_request_positions->length());
int position = i::Smi::ToInt(module_request_positions->get(i));
i::Handle<i::Script> script(self->script(), isolate);
i::Handle<i::Script> script(
i::Handle<i::SourceTextModule>::cast(self)->script(), isolate);
i::Script::PositionInfo info;
i::Script::GetPositionInfo(script, position, &info, i::Script::WITH_OFFSET);
return v8::Location(info.line, info.column);
@ -2265,8 +2289,10 @@ Local<UnboundModuleScript> Module::GetUnboundModuleScript() {
GetStatus() < kEvaluating, "v8::Module::GetUnboundScript",
"v8::Module::GetUnboundScript must be used on an unevaluated module");
i::Handle<i::Module> self = Utils::OpenHandle(this);
CHECK(self->IsSourceTextModule());
return ToApiHandle<UnboundModuleScript>(i::Handle<i::SharedFunctionInfo>(
self->GetSharedFunctionInfo(), self->GetIsolate()));
i::Handle<i::SourceTextModule>::cast(self)->GetSharedFunctionInfo(),
self->GetIsolate()));
}
int Module::GetIdentityHash() const { return Utils::OpenHandle(this)->hash(); }
@ -2301,6 +2327,37 @@ MaybeLocal<Value> Module::Evaluate(Local<Context> context) {
RETURN_ESCAPED(result);
}
Local<Module> Module::CreateSyntheticModule(
Isolate* isolate, Local<String> module_name,
const std::vector<Local<v8::String>>& export_names,
v8::Module::SyntheticModuleEvaluationSteps evaluation_steps) {
auto i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::Handle<i::String> i_module_name = Utils::OpenHandle(*module_name);
i::Handle<i::FixedArray> i_export_names = i_isolate->factory()->NewFixedArray(
static_cast<int>(export_names.size()));
for (int i = 0; i < i_export_names->length(); ++i) {
i::Handle<i::String> str = Utils::OpenHandle(*export_names[i]);
i_export_names->set(i, *str);
}
return v8::Utils::ToLocal(
i::Handle<i::Module>(i_isolate->factory()->NewSyntheticModule(
i_module_name, i_export_names, evaluation_steps)));
}
void Module::SetSyntheticModuleExport(Local<String> export_name,
Local<v8::Value> export_value) {
i::Handle<i::String> i_export_name = Utils::OpenHandle(*export_name);
i::Handle<i::Object> i_export_value = Utils::OpenHandle(*export_value);
i::Handle<i::Module> self = Utils::OpenHandle(this);
Utils::ApiCheck(self->IsSyntheticModule(),
"v8::Module::SetSyntheticModuleExport",
"v8::Module::SetSyntheticModuleExport must only be called on "
"a SyntheticModule");
i::SyntheticModule::SetExport(self->GetIsolate(),
i::Handle<i::SyntheticModule>::cast(self),
i_export_name, i_export_value);
}
namespace {
i::Compiler::ScriptDetails GetScriptDetails(
@ -2411,7 +2468,7 @@ MaybeLocal<Module> ScriptCompiler::CompileModule(
if (!maybe.ToLocal(&unbound)) return MaybeLocal<Module>();
i::Handle<i::SharedFunctionInfo> shared = Utils::OpenHandle(*unbound);
return ToApiHandle<Module>(i_isolate->factory()->NewModule(shared));
return ToApiHandle<Module>(i_isolate->factory()->NewSourceTextModule(shared));
}
namespace {
@ -2745,11 +2802,12 @@ void v8::TryCatch::SetCaptureMessage(bool value) { capture_message_ = value; }
// --- M e s s a g e ---
Local<String> Message::Get() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(isolate, obj);
i::Handle<i::String> raw_result =
i::MessageHandler::GetMessage(isolate, self);
Local<String> result = Utils::ToLocal(raw_result);
return scope.Escape(result);
}
@ -2760,10 +2818,10 @@ v8::Isolate* Message::GetIsolate() const {
}
ScriptOrigin Message::GetScriptOrigin() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
auto message = i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
i::Handle<i::Script> script(message->script(), isolate);
i::Handle<i::Script> script(self->script(), isolate);
return GetScriptOriginForScript(isolate, script);
}
@ -2772,11 +2830,11 @@ v8::Local<Value> Message::GetScriptResourceName() const {
}
v8::Local<v8::StackTrace> Message::GetStackTrace() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
auto message = i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
i::Handle<i::Object> stackFramesObj(message->stack_frames(), isolate);
i::Handle<i::Object> stackFramesObj(self->stack_frames(), isolate);
if (!stackFramesObj->IsFixedArray()) return v8::Local<v8::StackTrace>();
auto stackTrace = i::Handle<i::FixedArray>::cast(stackFramesObj);
return scope.Escape(Utils::StackTraceToLocal(stackTrace));
@ -2845,18 +2903,17 @@ Maybe<int> Message::GetEndColumn(Local<Context> context) const {
}
bool Message::IsSharedCrossOrigin() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
return Utils::OpenHandle(this)
->script()
.origin_options()
.IsSharedCrossOrigin();
return self->script().origin_options().IsSharedCrossOrigin();
}
bool Message::IsOpaque() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
return Utils::OpenHandle(this)->script().origin_options().IsOpaque();
return self->script().origin_options().IsOpaque();
}
MaybeLocal<String> Message::GetSourceLine(Local<Context> context) const {
@ -2903,11 +2960,11 @@ Local<StackTrace> StackTrace::CurrentStackTrace(Isolate* isolate,
// --- S t a c k F r a m e ---
int StackFrame::GetLineNumber() const {
return i::StackTraceFrame::GetLineNumber(Utils::OpenHandle(this));
return i::StackTraceFrame::GetOneBasedLineNumber(Utils::OpenHandle(this));
}
int StackFrame::GetColumn() const {
return i::StackTraceFrame::GetColumnNumber(Utils::OpenHandle(this));
return i::StackTraceFrame::GetOneBasedColumnNumber(Utils::OpenHandle(this));
}
int StackFrame::GetScriptId() const {
@ -2915,30 +2972,31 @@ int StackFrame::GetScriptId() const {
}
Local<String> StackFrame::GetScriptName() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::Object> name =
i::StackTraceFrame::GetFileName(Utils::OpenHandle(this));
i::Handle<i::Object> name = i::StackTraceFrame::GetFileName(self);
return name->IsString()
? scope.Escape(Local<String>::Cast(Utils::ToLocal(name)))
: Local<String>();
}
Local<String> StackFrame::GetScriptNameOrSourceURL() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::Object> name =
i::StackTraceFrame::GetScriptNameOrSourceUrl(Utils::OpenHandle(this));
i::StackTraceFrame::GetScriptNameOrSourceUrl(self);
return name->IsString()
? scope.Escape(Local<String>::Cast(Utils::ToLocal(name)))
: Local<String>();
}
Local<String> StackFrame::GetFunctionName() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::Object> name =
i::StackTraceFrame::GetFunctionName(Utils::OpenHandle(this));
i::Handle<i::Object> name = i::StackTraceFrame::GetFunctionName(self);
return name->IsString()
? scope.Escape(Local<String>::Cast(Utils::ToLocal(name)))
: Local<String>();
@ -3518,8 +3576,7 @@ MaybeLocal<Uint32> Value::ToUint32(Local<Context> context) const {
}
i::Isolate* i::IsolateFromNeverReadOnlySpaceObject(i::Address obj) {
return i::NeverReadOnlySpaceObject::GetIsolate(
i::HeapObject::cast(i::Object(obj)));
return i::GetIsolateFromWritableObject(i::HeapObject::cast(i::Object(obj)));
}
bool i::ShouldThrowOnError(i::Isolate* isolate) {
@ -3866,11 +3923,6 @@ Maybe<bool> v8::Object::Set(v8::Local<v8::Context> context,
return Just(true);
}
bool v8::Object::Set(v8::Local<Value> key, v8::Local<Value> value) {
auto context = ContextFromNeverReadOnlySpaceObject(Utils::OpenHandle(this));
return Set(context, key, value).FromMaybe(false);
}
Maybe<bool> v8::Object::Set(v8::Local<v8::Context> context, uint32_t index,
v8::Local<Value> value) {
auto isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
@ -3884,11 +3936,6 @@ Maybe<bool> v8::Object::Set(v8::Local<v8::Context> context, uint32_t index,
return Just(true);
}
bool v8::Object::Set(uint32_t index, v8::Local<Value> value) {
auto context = ContextFromNeverReadOnlySpaceObject(Utils::OpenHandle(this));
return Set(context, index, value).FromMaybe(false);
}
Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context,
v8::Local<Name> key,
v8::Local<Value> value) {
@ -4106,11 +4153,6 @@ MaybeLocal<Value> v8::Object::Get(Local<v8::Context> context,
RETURN_ESCAPED(Utils::ToLocal(result));
}
Local<Value> v8::Object::Get(v8::Local<Value> key) {
auto context = ContextFromNeverReadOnlySpaceObject(Utils::OpenHandle(this));
RETURN_TO_LOCAL_UNCHECKED(Get(context, key), Value);
}
MaybeLocal<Value> v8::Object::Get(Local<Context> context, uint32_t index) {
PREPARE_FOR_EXECUTION(context, Object, Get, Value);
auto self = Utils::OpenHandle(this);
@ -4121,11 +4163,6 @@ MaybeLocal<Value> v8::Object::Get(Local<Context> context, uint32_t index) {
RETURN_ESCAPED(Utils::ToLocal(result));
}
Local<Value> v8::Object::Get(uint32_t index) {
auto context = ContextFromNeverReadOnlySpaceObject(Utils::OpenHandle(this));
RETURN_TO_LOCAL_UNCHECKED(Get(context, index), Value);
}
MaybeLocal<Value> v8::Object::GetPrivate(Local<Context> context,
Local<Private> key) {
return Get(context, Local<Value>(reinterpret_cast<Value*>(*key)));
@ -4171,8 +4208,8 @@ MaybeLocal<Value> v8::Object::GetOwnPropertyDescriptor(Local<Context> context,
}
Local<Value> v8::Object::GetPrototype() {
auto isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
auto isolate = self->GetIsolate();
i::PrototypeIterator iter(isolate, self);
return Utils::ToLocal(i::PrototypeIterator::GetCurrent(iter));
}
@ -4424,10 +4461,10 @@ void Object::SetAccessorProperty(Local<Name> name, Local<Function> getter,
AccessControl settings) {
// TODO(verwaest): Remove |settings|.
DCHECK_EQ(v8::DEFAULT, settings);
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
i::HandleScope scope(isolate);
auto self = Utils::OpenHandle(this);
if (!self->IsJSObject()) return;
i::Handle<i::Object> getter_i = v8::Utils::OpenHandle(*getter);
i::Handle<i::Object> setter_i = v8::Utils::OpenHandle(*setter, true);
@ -4637,9 +4674,9 @@ Local<v8::Context> v8::Object::CreationContext() {
int v8::Object::GetIdentityHash() {
i::DisallowHeapAllocation no_gc;
auto isolate = Utils::OpenHandle(this)->GetIsolate();
i::HandleScope scope(isolate);
auto self = Utils::OpenHandle(this);
auto isolate = self->GetIsolate();
i::HandleScope scope(isolate);
return self->GetOrCreateIdentityHash(isolate).value();
}
@ -4825,9 +4862,9 @@ Local<Value> Function::GetDebugName() const {
}
Local<Value> Function::GetDisplayName() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
if (!self->IsJSFunction()) {
return ToApiHandle<Primitive>(isolate->factory()->undefined_value());
}
@ -5358,20 +5395,15 @@ Local<Value> Symbol::Name() const {
i::Handle<i::Symbol> sym = Utils::OpenHandle(this);
i::Isolate* isolate;
if (!i::GetIsolateFromWritableObject(*sym, &isolate)) {
// If the Symbol is in RO_SPACE, then its name must be too. Since RO_SPACE
// objects are immovable we can use the Handle(Address*) constructor with
// the address of the name field in the Symbol object without needing an
// isolate.
#ifdef V8_COMPRESS_POINTERS
// Compressed fields can't serve as handle locations.
// TODO(ishell): get Isolate as a parameter.
isolate = i::Isolate::Current();
#else
if (!i::GetIsolateFromHeapObject(*sym, &isolate)) {
// Symbol is in RO_SPACE, which means that its name is also in RO_SPACE.
// Since RO_SPACE objects are immovable we can use the Handle(Address*)
// constructor with the address of the name field in the Symbol object
// without needing an isolate.
DCHECK(!COMPRESS_POINTERS_BOOL);
i::Handle<i::HeapObject> ro_name(reinterpret_cast<i::Address*>(
sym->GetFieldAddress(i::Symbol::kNameOffset)));
return Utils::ToLocal(ro_name);
#endif
}
i::Handle<i::Object> name(sym->name(), isolate);
@ -5917,6 +5949,19 @@ void Context::SetErrorMessageForCodeGenerationFromStrings(Local<String> error) {
context->set_error_message_for_code_gen_from_strings(*error_handle);
}
void Context::SetAbortScriptExecution(
Context::AbortScriptExecutionCallback callback) {
i::Handle<i::Context> context = Utils::OpenHandle(this);
i::Isolate* isolate = context->GetIsolate();
if (callback == nullptr) {
context->set_script_execution_callback(
i::ReadOnlyRoots(isolate).undefined_value());
} else {
SET_FIELD_WRAPPED(isolate, context, set_script_execution_callback,
callback);
}
}
namespace {
i::Address* GetSerializedDataFromFixedArray(i::Isolate* isolate,
i::FixedArray list, size_t index) {
@ -6218,8 +6263,7 @@ bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
// It is safe to call GetIsolateFromWritableHeapObject because
// SupportsExternalization already checked that the object is writable.
i::Isolate* isolate;
i::GetIsolateFromWritableObject(obj, &isolate);
i::Isolate* isolate = i::GetIsolateFromWritableObject(obj);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
CHECK(resource && resource->data());
@ -6246,8 +6290,7 @@ bool v8::String::MakeExternal(
// It is safe to call GetIsolateFromWritableHeapObject because
// SupportsExternalization already checked that the object is writable.
i::Isolate* isolate;
i::GetIsolateFromWritableObject(obj, &isolate);
i::Isolate* isolate = i::GetIsolateFromWritableObject(obj);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
CHECK(resource && resource->data());
@ -6364,10 +6407,11 @@ Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) {
double v8::NumberObject::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();
i::Handle<i::JSPrimitiveWrapper> js_primitive_wrapper =
i::Handle<i::JSPrimitiveWrapper>::cast(obj);
i::Isolate* isolate = js_primitive_wrapper->GetIsolate();
LOG_API(isolate, NumberObject, NumberValue);
return jsvalue->value().Number();
return js_primitive_wrapper->value().Number();
}
Local<v8::Value> v8::BigIntObject::New(Isolate* isolate, int64_t value) {
@ -6382,11 +6426,12 @@ Local<v8::Value> v8::BigIntObject::New(Isolate* isolate, int64_t value) {
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();
i::Handle<i::JSPrimitiveWrapper> js_primitive_wrapper =
i::Handle<i::JSPrimitiveWrapper>::cast(obj);
i::Isolate* isolate = js_primitive_wrapper->GetIsolate();
LOG_API(isolate, BigIntObject, BigIntValue);
return Utils::ToLocal(
i::Handle<i::BigInt>(i::BigInt::cast(jsvalue->value()), isolate));
return Utils::ToLocal(i::Handle<i::BigInt>(
i::BigInt::cast(js_primitive_wrapper->value()), isolate));
}
Local<v8::Value> v8::BooleanObject::New(Isolate* isolate, bool value) {
@ -6404,10 +6449,11 @@ Local<v8::Value> v8::BooleanObject::New(Isolate* isolate, bool value) {
bool v8::BooleanObject::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();
i::Handle<i::JSPrimitiveWrapper> js_primitive_wrapper =
i::Handle<i::JSPrimitiveWrapper>::cast(obj);
i::Isolate* isolate = js_primitive_wrapper->GetIsolate();
LOG_API(isolate, BooleanObject, BooleanValue);
return jsvalue->value().IsTrue(isolate);
return js_primitive_wrapper->value().IsTrue(isolate);
}
Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate,
@ -6423,11 +6469,12 @@ Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate,
Local<v8::String> v8::StringObject::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();
i::Handle<i::JSPrimitiveWrapper> js_primitive_wrapper =
i::Handle<i::JSPrimitiveWrapper>::cast(obj);
i::Isolate* isolate = js_primitive_wrapper->GetIsolate();
LOG_API(isolate, StringObject, StringValue);
return Utils::ToLocal(
i::Handle<i::String>(i::String::cast(jsvalue->value()), isolate));
return Utils::ToLocal(i::Handle<i::String>(
i::String::cast(js_primitive_wrapper->value()), isolate));
}
Local<v8::Value> v8::SymbolObject::New(Isolate* isolate, Local<Symbol> value) {
@ -6442,11 +6489,12 @@ Local<v8::Value> v8::SymbolObject::New(Isolate* isolate, Local<Symbol> value) {
Local<v8::Symbol> v8::SymbolObject::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();
i::Handle<i::JSPrimitiveWrapper> js_primitive_wrapper =
i::Handle<i::JSPrimitiveWrapper>::cast(obj);
i::Isolate* isolate = js_primitive_wrapper->GetIsolate();
LOG_API(isolate, SymbolObject, SymbolValue);
return Utils::ToLocal(
i::Handle<i::Symbol>(i::Symbol::cast(jsvalue->value()), isolate));
return Utils::ToLocal(i::Handle<i::Symbol>(
i::Symbol::cast(js_primitive_wrapper->value()), isolate));
}
MaybeLocal<v8::Value> v8::Date::New(Local<Context> context, double time) {
@ -7839,7 +7887,12 @@ void Isolate::Initialize(Isolate* isolate,
i_isolate->set_api_external_references(params.external_references);
i_isolate->set_allow_atomics_wait(params.allow_atomics_wait);
SetResourceConstraints(i_isolate, params.constraints);
i_isolate->heap()->ConfigureHeap(params.constraints);
if (params.constraints.stack_limit() != nullptr) {
uintptr_t limit =
reinterpret_cast<uintptr_t>(params.constraints.stack_limit());
i_isolate->stack_guard()->SetStackLimit(limit);
}
// TODO(jochen): Once we got rid of Isolate::Current(), we can remove this.
Isolate::Scope isolate_scope(isolate);
if (!i::Snapshot::Initialize(i_isolate)) {
@ -8291,9 +8344,9 @@ void Isolate::LowMemoryNotification() {
i::GarbageCollectionReason::kLowMemoryNotification);
}
{
i::HeapIterator iterator(isolate->heap());
for (i::HeapObject obj = iterator.next(); !obj.is_null();
obj = iterator.next()) {
i::HeapObjectIterator iterator(isolate->heap());
for (i::HeapObject obj = iterator.Next(); !obj.is_null();
obj = iterator.Next()) {
if (obj.IsAbstractCode()) {
i::AbstractCode::cast(obj).DropStackFrameCache();
}
@ -8304,9 +8357,14 @@ void Isolate::LowMemoryNotification() {
int Isolate::ContextDisposedNotification(bool dependant_context) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
if (!dependant_context) {
// We left the current context, we can abort all WebAssembly compilations on
// that isolate.
isolate->wasm_engine()->DeleteCompileJobsOnIsolate(isolate);
if (!isolate->context().is_null()) {
// We left the current context, we can abort all WebAssembly compilations
// of that context.
// A handle scope for the native context.
i::HandleScope handle_scope(isolate);
isolate->wasm_engine()->DeleteCompileJobsOnContext(
isolate->native_context());
}
}
// TODO(ahaas): move other non-heap activity out of the heap call.
return isolate->heap()->NotifyContextDisposed(dependant_context);
@ -8408,6 +8466,9 @@ CALLBACK_SETTER(FatalErrorHandler, FatalErrorCallback, exception_behavior)
CALLBACK_SETTER(OOMErrorHandler, OOMErrorCallback, oom_behavior)
CALLBACK_SETTER(AllowCodeGenerationFromStringsCallback,
AllowCodeGenerationFromStringsCallback, allow_code_gen_callback)
CALLBACK_SETTER(ModifyCodeGenerationFromStringsCallback,
ModifyCodeGenerationFromStringsCallback,
modify_code_gen_callback)
CALLBACK_SETTER(AllowWasmCodeGenerationCallback,
AllowWasmCodeGenerationCallback, allow_wasm_code_gen_callback)
@ -8839,9 +8900,9 @@ std::vector<int> debug::Script::LineEnds() const {
}
MaybeLocal<String> debug::Script::Name() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
i::HandleScope handle_scope(isolate);
i::Handle<i::Script> script = Utils::OpenHandle(this);
i::Isolate* isolate = script->GetIsolate();
i::HandleScope handle_scope(isolate);
i::Handle<i::Object> value(script->name(), isolate);
if (!value->IsString()) return MaybeLocal<String>();
return Utils::ToLocal(
@ -8849,9 +8910,9 @@ MaybeLocal<String> debug::Script::Name() const {
}
MaybeLocal<String> debug::Script::SourceURL() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
i::HandleScope handle_scope(isolate);
i::Handle<i::Script> script = Utils::OpenHandle(this);
i::Isolate* isolate = script->GetIsolate();
i::HandleScope handle_scope(isolate);
i::Handle<i::Object> value(script->source_url(), isolate);
if (!value->IsString()) return MaybeLocal<String>();
return Utils::ToLocal(
@ -8859,9 +8920,9 @@ MaybeLocal<String> debug::Script::SourceURL() const {
}
MaybeLocal<String> debug::Script::SourceMappingURL() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
i::HandleScope handle_scope(isolate);
i::Handle<i::Script> script = Utils::OpenHandle(this);
i::Isolate* isolate = script->GetIsolate();
i::HandleScope handle_scope(isolate);
i::Handle<i::Object> value(script->source_mapping_url(), isolate);
if (!value->IsString()) return MaybeLocal<String>();
return Utils::ToLocal(
@ -8869,18 +8930,18 @@ MaybeLocal<String> debug::Script::SourceMappingURL() const {
}
Maybe<int> debug::Script::ContextId() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
i::HandleScope handle_scope(isolate);
i::Handle<i::Script> script = Utils::OpenHandle(this);
i::Isolate* isolate = script->GetIsolate();
i::HandleScope handle_scope(isolate);
i::Object value = script->context_data();
if (value.IsSmi()) return Just(i::Smi::ToInt(value));
return Nothing<int>();
}
MaybeLocal<String> debug::Script::Source() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
i::HandleScope handle_scope(isolate);
i::Handle<i::Script> script = Utils::OpenHandle(this);
i::Isolate* isolate = script->GetIsolate();
i::HandleScope handle_scope(isolate);
i::Handle<i::Object> value(script->source(), isolate);
if (!value->IsString()) return MaybeLocal<String>();
return Utils::ToLocal(
@ -10171,6 +10232,17 @@ void EmbedderHeapTracer::IncreaseAllocatedSize(size_t bytes) {
}
}
void EmbedderHeapTracer::DecreaseAllocatedSize(size_t bytes) {
if (isolate_) {
i::LocalEmbedderHeapTracer* const tracer =
reinterpret_cast<i::Isolate*>(isolate_)
->heap()
->local_embedder_heap_tracer();
DCHECK_NOT_NULL(tracer);
tracer->DecreaseAllocatedSize(bytes);
}
}
void EmbedderHeapTracer::RegisterEmbedderReference(
const TracedGlobal<v8::Value>& ref) {
if (ref.IsEmpty()) return;
@ -10360,8 +10432,7 @@ void InvokeAccessorGetterCallback(
void InvokeFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
v8::FunctionCallback callback) {
Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
RuntimeCallTimerScope timer(isolate,
RuntimeCallCounterId::kInvokeFunctionCallback);
RuntimeCallTimerScope timer(isolate, RuntimeCallCounterId::kFunctionCallback);
Address callback_address = reinterpret_cast<Address>(callback);
VMState<EXTERNAL> state(isolate);
ExternalCallbackScope call_scope(isolate, callback_address);
@ -10382,7 +10453,6 @@ void InvokeFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
#undef EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE
#undef RETURN_ON_FAILED_EXECUTION
#undef RETURN_ON_FAILED_EXECUTION_PRIMITIVE
#undef RETURN_TO_LOCAL_UNCHECKED
#undef RETURN_ESCAPED
#undef SET_FIELD_WRAPPED
#undef NEW_STRING

View File

@ -14,9 +14,9 @@
#include "src/objects/js-generator.h"
#include "src/objects/js-promise.h"
#include "src/objects/js-proxy.h"
#include "src/objects/module.h"
#include "src/objects/objects.h"
#include "src/objects/shared-function-info.h"
#include "src/objects/source-text-module.h"
#include "src/utils/detachable-vector.h"
#include "src/objects/templates.h"

View File

@ -1,5 +1,3 @@
set noparent
ahaas@chromium.org
clemensh@chromium.org
mstarzinger@chromium.org

View File

@ -12,9 +12,9 @@
#include "src/codegen/compiler.h"
#include "src/codegen/unoptimized-compilation-info.h"
#include "src/common/assert-scope.h"
#include "src/common/message-template.h"
#include "src/execution/execution.h"
#include "src/execution/isolate.h"
#include "src/execution/message-template.h"
#include "src/handles/handles.h"
#include "src/heap/factory.h"
#include "src/logging/counters.h"
@ -249,9 +249,9 @@ UnoptimizedCompilationJob::Status AsmJsCompilationJob::ExecuteJobImpl() {
return FAILED;
}
module_ = new (compile_zone) wasm::ZoneBuffer(compile_zone);
parser.module_builder()->WriteTo(*module_);
parser.module_builder()->WriteTo(module_);
asm_offsets_ = new (compile_zone) wasm::ZoneBuffer(compile_zone);
parser.module_builder()->WriteAsmJsOffsetTable(*asm_offsets_);
parser.module_builder()->WriteAsmJsOffsetTable(asm_offsets_);
stdlib_uses_ = *parser.stdlib_uses();
size_t compile_zone_size =
@ -287,7 +287,7 @@ UnoptimizedCompilationJob::Status AsmJsCompilationJob::FinalizeJobImpl(
isolate, &thrower,
wasm::ModuleWireBytes(module_->begin(), module_->end()),
Vector<const byte>(asm_offsets_->begin(), asm_offsets_->size()),
uses_bitset)
uses_bitset, shared_info->language_mode())
.ToHandleChecked();
DCHECK(!thrower.error());
compile_time_ = compile_timer.Elapsed().InMillisecondsF();
@ -319,10 +319,10 @@ void AsmJsCompilationJob::RecordHistograms(Isolate* isolate) {
translation_throughput);
}
UnoptimizedCompilationJob* AsmJs::NewCompilationJob(
std::unique_ptr<UnoptimizedCompilationJob> AsmJs::NewCompilationJob(
ParseInfo* parse_info, FunctionLiteral* literal,
AccountingAllocator* allocator) {
return new AsmJsCompilationJob(parse_info, literal, allocator);
return base::make_unique<AsmJsCompilationJob>(parse_info, literal, allocator);
}
namespace {

View File

@ -23,7 +23,7 @@ class UnoptimizedCompilationJob;
// Interface to compile and instantiate for asm.js modules.
class AsmJs {
public:
static UnoptimizedCompilationJob* NewCompilationJob(
static std::unique_ptr<UnoptimizedCompilationJob> NewCompilationJob(
ParseInfo* parse_info, FunctionLiteral* literal,
AccountingAllocator* allocator);
static MaybeHandle<Object> InstantiateAsmWasm(Isolate* isolate,

View File

@ -253,7 +253,7 @@ void AsmJsParser::DeclareGlobal(VarInfo* info, bool mutable_variable,
const WasmInitExpr& init) {
info->kind = VarKind::kGlobal;
info->type = type;
info->index = module_builder_->AddGlobal(vtype, false, true, init);
info->index = module_builder_->AddGlobal(vtype, true, init);
info->mutable_variable = mutable_variable;
}
@ -385,7 +385,8 @@ void AsmJsParser::ValidateModule() {
module_builder_->MarkStartFunction(start);
for (auto& global_import : global_imports_) {
uint32_t import_index = module_builder_->AddGlobalImport(
global_import.import_name, global_import.value_type);
global_import.import_name, global_import.value_type,
false /* mutability */);
start->EmitWithI32V(kExprGetGlobal, import_index);
start->EmitWithI32V(kExprSetGlobal, VarIndex(global_import.var_info));
}
@ -754,7 +755,7 @@ void AsmJsParser::ValidateFunction() {
// Record start of the function, used as position for the stack check.
current_function_builder_->SetAsmFunctionStartPosition(scanner_.Position());
CachedVector<AsmType*> params(cached_asm_type_p_vectors_);
CachedVector<AsmType*> params(&cached_asm_type_p_vectors_);
ValidateFunctionParams(&params);
// Check against limit on number of parameters.
@ -762,7 +763,7 @@ void AsmJsParser::ValidateFunction() {
FAIL("Number of parameters exceeds internal limit");
}
CachedVector<ValueType> locals(cached_valuetype_vectors_);
CachedVector<ValueType> locals(&cached_valuetype_vectors_);
ValidateFunctionLocals(params.size(), &locals);
function_temp_locals_offset_ = static_cast<uint32_t>(
@ -837,7 +838,7 @@ void AsmJsParser::ValidateFunctionParams(ZoneVector<AsmType*>* params) {
scanner_.EnterLocalScope();
EXPECT_TOKEN('(');
CachedVector<AsmJsScanner::token_t> function_parameters(
cached_token_t_vectors_);
&cached_token_t_vectors_);
while (!failed_ && !Peek(')')) {
if (!scanner_.IsLocal()) {
FAIL("Expected parameter name");
@ -969,7 +970,8 @@ void AsmJsParser::ValidateFunctionLocals(size_t param_count,
if (negate) {
dvalue = -dvalue;
}
current_function_builder_->EmitF32Const(dvalue);
float fvalue = DoubleToFloat32(dvalue);
current_function_builder_->EmitF32Const(fvalue);
current_function_builder_->EmitSetLocal(info->index);
} else if (CheckForUnsigned(&uvalue)) {
if (uvalue > 0x7FFFFFFF) {
@ -1314,7 +1316,7 @@ void AsmJsParser::SwitchStatement() {
Begin(pending_label_);
pending_label_ = 0;
// TODO(bradnelson): Make less weird.
CachedVector<int32_t> cases(cached_int_vectors_);
CachedVector<int32_t> cases(&cached_int_vectors_);
GatherCases(&cases);
EXPECT_TOKEN('{');
size_t count = cases.size() + 1;
@ -2108,7 +2110,11 @@ AsmType* AsmJsParser::ValidateCall() {
// need to match the information stored at this point.
base::Optional<TemporaryVariableScope> tmp;
if (Check('[')) {
RECURSEn(EqualityExpression());
AsmType* index = nullptr;
RECURSEn(index = EqualityExpression());
if (!index->IsA(AsmType::Intish())) {
FAILn("Expected intish index");
}
EXPECT_TOKENn('&');
uint32_t mask = 0;
if (!CheckForUnsigned(&mask)) {
@ -2161,8 +2167,8 @@ AsmType* AsmJsParser::ValidateCall() {
}
// Parse argument list and gather types.
CachedVector<AsmType*> param_types(cached_asm_type_p_vectors_);
CachedVector<AsmType*> param_specific_types(cached_asm_type_p_vectors_);
CachedVector<AsmType*> param_types(&cached_asm_type_p_vectors_);
CachedVector<AsmType*> param_specific_types(&cached_asm_type_p_vectors_);
EXPECT_TOKENn('(');
while (!failed_ && !Peek(')')) {
AsmType* t;

View File

@ -154,9 +154,9 @@ class AsmJsParser {
template <typename T>
class CachedVector final : public ZoneVector<T> {
public:
explicit CachedVector(CachedVectors<T>& cache)
: ZoneVector<T>(cache.zone()), cache_(&cache) {
cache.fill(this);
explicit CachedVector(CachedVectors<T>* cache)
: ZoneVector<T>(cache->zone()), cache_(cache) {
cache->fill(this);
}
~CachedVector() { cache_->reuse(this); }

View File

@ -1,5 +1,3 @@
set noparent
adamk@chromium.org
bmeurer@chromium.org
gsathya@chromium.org

View File

@ -49,8 +49,6 @@ static const char* NameForNativeContextIntrinsicIndex(uint32_t idx) {
return "UnknownIntrinsicIndex";
}
void AstNode::Print() { Print(Isolate::Current()); }
void AstNode::Print(Isolate* isolate) {
AllowHandleDereference allow_deref;
AstPrinter::PrintOut(isolate, this);
@ -132,6 +130,10 @@ bool Expression::ToBooleanIsFalse() const {
return IsLiteral() && AsLiteral()->ToBooleanIsFalse();
}
bool Expression::IsPrivateName() const {
return IsVariableProxy() && AsVariableProxy()->IsPrivateName();
}
bool Expression::IsValidReferenceExpression() const {
return IsProperty() ||
(IsVariableProxy() && AsVariableProxy()->IsValidReferenceExpression());
@ -176,7 +178,7 @@ void VariableProxy::BindTo(Variable* var) {
set_var(var);
set_is_resolved();
var->set_is_used();
if (is_assigned()) var->set_maybe_assigned();
if (is_assigned()) var->SetMaybeAssigned();
}
Assignment::Assignment(NodeType node_type, Token::Value op, Expression* target,
@ -601,8 +603,8 @@ void ArrayLiteral::BuildBoilerplateDescription(Isolate* isolate) {
boilerplate_value = handle(Smi::kZero, isolate);
}
kind = GetMoreGeneralElementsKind(kind,
boilerplate_value->OptimalElementsKind());
kind = GetMoreGeneralElementsKind(
kind, boilerplate_value->OptimalElementsKind(isolate));
fixed_array->set(array_index, *boilerplate_value);
}
@ -832,6 +834,9 @@ Call::CallType Call::GetCallType() const {
Property* property = expression()->AsProperty();
if (property != nullptr) {
if (property->IsPrivateReference()) {
return PRIVATE_CALL;
}
bool is_super = property->IsSuperAccess();
if (property->key()->IsPropertyName()) {
return is_super ? NAMED_SUPER_PROPERTY_CALL : NAMED_PROPERTY_CALL;

53
deps/v8/src/ast/ast.h vendored
View File

@ -147,7 +147,6 @@ class AstNode: public ZoneObject {
int position() const { return position_; }
#ifdef DEBUG
void Print();
void Print(Isolate* isolate);
#endif // DEBUG
@ -205,6 +204,9 @@ class Expression : public AstNode {
// True iff the expression is a valid reference expression.
bool IsValidReferenceExpression() const;
// True iff the expression is a private name.
bool IsPrivateName() const;
// Helpers for ToBoolean conversion.
bool ToBooleanIsTrue() const;
bool ToBooleanIsFalse() const;
@ -1421,32 +1423,6 @@ class ObjectLiteral final : public AggregateLiteral {
: public BitField<bool, FastElementsField::kNext, 1> {};
};
// A map from property names to getter/setter pairs allocated in the zone.
class AccessorTable
: public base::TemplateHashMap<Literal, ObjectLiteral::Accessors,
bool (*)(void*, void*),
ZoneAllocationPolicy> {
public:
explicit AccessorTable(Zone* zone)
: base::TemplateHashMap<Literal, ObjectLiteral::Accessors,
bool (*)(void*, void*), ZoneAllocationPolicy>(
Literal::Match, ZoneAllocationPolicy(zone)),
zone_(zone) {}
Iterator lookup(Literal* literal) {
Iterator it = find(literal, true, ZoneAllocationPolicy(zone_));
if (it->second == nullptr) {
it->second = new (zone_) ObjectLiteral::Accessors();
}
return it;
}
private:
Zone* zone_;
};
// An array literal has a literals object that is used
// for minimizing the work when constructing it at runtime.
class ArrayLiteral final : public AggregateLiteral {
@ -1533,7 +1509,7 @@ class VariableProxy final : public Expression {
void set_is_assigned() {
bit_field_ = IsAssignedField::update(bit_field_, true);
if (is_resolved()) {
var()->set_maybe_assigned();
var()->SetMaybeAssigned();
}
}
@ -1635,11 +1611,12 @@ class VariableProxy final : public Expression {
// Otherwise, the assignment is to a non-property (a global, a local slot, a
// parameter slot, or a destructuring pattern).
enum AssignType {
NON_PROPERTY,
NAMED_PROPERTY,
KEYED_PROPERTY,
NAMED_SUPER_PROPERTY,
KEYED_SUPER_PROPERTY
NON_PROPERTY, // destructuring
NAMED_PROPERTY, // obj.key
KEYED_PROPERTY, // obj[key]
NAMED_SUPER_PROPERTY, // super.key
KEYED_SUPER_PROPERTY, // super[key]
PRIVATE_METHOD // obj.#key: #key is a private method
};
class Property final : public Expression {
@ -1650,10 +1627,19 @@ class Property final : public Expression {
Expression* key() const { return key_; }
bool IsSuperAccess() { return obj()->IsSuperPropertyReference(); }
bool IsPrivateReference() const { return key()->IsPrivateName(); }
// Returns the properties assign type.
static AssignType GetAssignType(Property* property) {
if (property == nullptr) return NON_PROPERTY;
if (property->IsPrivateReference()) {
DCHECK(!property->IsSuperAccess());
VariableProxy* proxy = property->key()->AsVariableProxy();
DCHECK_NOT_NULL(proxy);
Variable* var = proxy->var();
// Use KEYED_PROPERTY for private fields.
return var->requires_brand_check() ? PRIVATE_METHOD : KEYED_PROPERTY;
}
bool super_access = property->IsSuperAccess();
return (property->key()->IsPropertyName())
? (super_access ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY)
@ -1715,6 +1701,7 @@ class Call final : public Expression {
KEYED_PROPERTY_CALL,
NAMED_SUPER_PROPERTY_CALL,
KEYED_SUPER_PROPERTY_CALL,
PRIVATE_CALL,
SUPER_CALL,
RESOLVED_PROPERTY_CALL,
OTHER_CALL

View File

@ -12,7 +12,7 @@
namespace v8 {
namespace internal {
bool ModuleDescriptor::AstRawStringComparer::operator()(
bool SourceTextModuleDescriptor::AstRawStringComparer::operator()(
const AstRawString* lhs, const AstRawString* rhs) const {
// Fast path for equal pointers: a pointer is not strictly less than itself.
if (lhs == rhs) return false;
@ -27,12 +27,10 @@ bool ModuleDescriptor::AstRawStringComparer::operator()(
return memcmp(lhs->raw_data(), rhs->raw_data(), lhs->byte_length()) < 0;
}
void ModuleDescriptor::AddImport(const AstRawString* import_name,
const AstRawString* local_name,
const AstRawString* module_request,
const Scanner::Location loc,
const Scanner::Location specifier_loc,
Zone* zone) {
void SourceTextModuleDescriptor::AddImport(
const AstRawString* import_name, const AstRawString* local_name,
const AstRawString* module_request, const Scanner::Location loc,
const Scanner::Location specifier_loc, Zone* zone) {
Entry* entry = new (zone) Entry(loc);
entry->local_name = local_name;
entry->import_name = import_name;
@ -40,38 +38,34 @@ void ModuleDescriptor::AddImport(const AstRawString* import_name,
AddRegularImport(entry);
}
void ModuleDescriptor::AddStarImport(const AstRawString* local_name,
const AstRawString* module_request,
const Scanner::Location loc,
const Scanner::Location specifier_loc,
Zone* zone) {
void SourceTextModuleDescriptor::AddStarImport(
const AstRawString* local_name, const AstRawString* module_request,
const Scanner::Location loc, const Scanner::Location specifier_loc,
Zone* zone) {
Entry* entry = new (zone) Entry(loc);
entry->local_name = local_name;
entry->module_request = AddModuleRequest(module_request, specifier_loc);
AddNamespaceImport(entry, zone);
}
void ModuleDescriptor::AddEmptyImport(const AstRawString* module_request,
const Scanner::Location specifier_loc) {
void SourceTextModuleDescriptor::AddEmptyImport(
const AstRawString* module_request, const Scanner::Location specifier_loc) {
AddModuleRequest(module_request, specifier_loc);
}
void ModuleDescriptor::AddExport(
const AstRawString* local_name, const AstRawString* export_name,
Scanner::Location loc, Zone* zone) {
void SourceTextModuleDescriptor::AddExport(const AstRawString* local_name,
const AstRawString* export_name,
Scanner::Location loc, Zone* zone) {
Entry* entry = new (zone) Entry(loc);
entry->export_name = export_name;
entry->local_name = local_name;
AddRegularExport(entry);
}
void ModuleDescriptor::AddExport(const AstRawString* import_name,
const AstRawString* export_name,
const AstRawString* module_request,
const Scanner::Location loc,
const Scanner::Location specifier_loc,
Zone* zone) {
void SourceTextModuleDescriptor::AddExport(
const AstRawString* import_name, const AstRawString* export_name,
const AstRawString* module_request, const Scanner::Location loc,
const Scanner::Location specifier_loc, Zone* zone) {
DCHECK_NOT_NULL(import_name);
DCHECK_NOT_NULL(export_name);
Entry* entry = new (zone) Entry(loc);
@ -81,10 +75,9 @@ void ModuleDescriptor::AddExport(const AstRawString* import_name,
AddSpecialExport(entry, zone);
}
void ModuleDescriptor::AddStarExport(const AstRawString* module_request,
const Scanner::Location loc,
const Scanner::Location specifier_loc,
Zone* zone) {
void SourceTextModuleDescriptor::AddStarExport(
const AstRawString* module_request, const Scanner::Location loc,
const Scanner::Location specifier_loc, Zone* zone) {
Entry* entry = new (zone) Entry(loc);
entry->module_request = AddModuleRequest(module_request, specifier_loc);
AddSpecialExport(entry, zone);
@ -98,24 +91,25 @@ Handle<Object> ToStringOrUndefined(Isolate* isolate, const AstRawString* s) {
}
} // namespace
Handle<ModuleInfoEntry> ModuleDescriptor::Entry::Serialize(
Handle<SourceTextModuleInfoEntry> SourceTextModuleDescriptor::Entry::Serialize(
Isolate* isolate) const {
CHECK(Smi::IsValid(module_request)); // TODO(neis): Check earlier?
return ModuleInfoEntry::New(
return SourceTextModuleInfoEntry::New(
isolate, ToStringOrUndefined(isolate, export_name),
ToStringOrUndefined(isolate, local_name),
ToStringOrUndefined(isolate, import_name), module_request, cell_index,
location.beg_pos, location.end_pos);
}
Handle<FixedArray> ModuleDescriptor::SerializeRegularExports(Isolate* isolate,
Zone* zone) const {
Handle<FixedArray> SourceTextModuleDescriptor::SerializeRegularExports(
Isolate* isolate, Zone* zone) const {
// We serialize regular exports in a way that lets us later iterate over their
// local names and for each local name immediately access all its export
// names. (Regular exports have neither import name nor module request.)
ZoneVector<Handle<Object>> data(
ModuleInfo::kRegularExportLength * regular_exports_.size(), zone);
SourceTextModuleInfo::kRegularExportLength * regular_exports_.size(),
zone);
int index = 0;
for (auto it = regular_exports_.begin(); it != regular_exports_.end();) {
@ -130,12 +124,13 @@ Handle<FixedArray> ModuleDescriptor::SerializeRegularExports(Isolate* isolate,
} while (next != regular_exports_.end() && next->first == it->first);
Handle<FixedArray> export_names = isolate->factory()->NewFixedArray(count);
data[index + ModuleInfo::kRegularExportLocalNameOffset] =
data[index + SourceTextModuleInfo::kRegularExportLocalNameOffset] =
it->second->local_name->string();
data[index + ModuleInfo::kRegularExportCellIndexOffset] =
data[index + SourceTextModuleInfo::kRegularExportCellIndexOffset] =
handle(Smi::FromInt(it->second->cell_index), isolate);
data[index + ModuleInfo::kRegularExportExportNamesOffset] = export_names;
index += ModuleInfo::kRegularExportLength;
data[index + SourceTextModuleInfo::kRegularExportExportNamesOffset] =
export_names;
index += SourceTextModuleInfo::kRegularExportLength;
// Collect the export names.
int i = 0;
@ -159,7 +154,7 @@ Handle<FixedArray> ModuleDescriptor::SerializeRegularExports(Isolate* isolate,
return result;
}
void ModuleDescriptor::MakeIndirectExportsExplicit(Zone* zone) {
void SourceTextModuleDescriptor::MakeIndirectExportsExplicit(Zone* zone) {
for (auto it = regular_exports_.begin(); it != regular_exports_.end();) {
Entry* entry = it->second;
DCHECK_NOT_NULL(entry->local_name);
@ -191,14 +186,14 @@ void ModuleDescriptor::MakeIndirectExportsExplicit(Zone* zone) {
}
}
ModuleDescriptor::CellIndexKind ModuleDescriptor::GetCellIndexKind(
int cell_index) {
SourceTextModuleDescriptor::CellIndexKind
SourceTextModuleDescriptor::GetCellIndexKind(int cell_index) {
if (cell_index > 0) return kExport;
if (cell_index < 0) return kImport;
return kInvalid;
}
void ModuleDescriptor::AssignCellIndices() {
void SourceTextModuleDescriptor::AssignCellIndices() {
int export_index = 1;
for (auto it = regular_exports_.begin(); it != regular_exports_.end();) {
auto current_key = it->first;
@ -230,10 +225,11 @@ void ModuleDescriptor::AssignCellIndices() {
namespace {
const ModuleDescriptor::Entry* BetterDuplicate(
const ModuleDescriptor::Entry* candidate,
ZoneMap<const AstRawString*, const ModuleDescriptor::Entry*>& export_names,
const ModuleDescriptor::Entry* current_duplicate) {
const SourceTextModuleDescriptor::Entry* BetterDuplicate(
const SourceTextModuleDescriptor::Entry* candidate,
ZoneMap<const AstRawString*, const SourceTextModuleDescriptor::Entry*>&
export_names,
const SourceTextModuleDescriptor::Entry* current_duplicate) {
DCHECK_NOT_NULL(candidate->export_name);
DCHECK(candidate->location.IsValid());
auto insert_result =
@ -249,11 +245,11 @@ const ModuleDescriptor::Entry* BetterDuplicate(
} // namespace
const ModuleDescriptor::Entry* ModuleDescriptor::FindDuplicateExport(
Zone* zone) const {
const ModuleDescriptor::Entry* duplicate = nullptr;
ZoneMap<const AstRawString*, const ModuleDescriptor::Entry*> export_names(
zone);
const SourceTextModuleDescriptor::Entry*
SourceTextModuleDescriptor::FindDuplicateExport(Zone* zone) const {
const SourceTextModuleDescriptor::Entry* duplicate = nullptr;
ZoneMap<const AstRawString*, const SourceTextModuleDescriptor::Entry*>
export_names(zone);
for (const auto& elem : regular_exports_) {
duplicate = BetterDuplicate(elem.second, export_names, duplicate);
}
@ -264,9 +260,9 @@ const ModuleDescriptor::Entry* ModuleDescriptor::FindDuplicateExport(
return duplicate;
}
bool ModuleDescriptor::Validate(ModuleScope* module_scope,
PendingCompilationErrorHandler* error_handler,
Zone* zone) {
bool SourceTextModuleDescriptor::Validate(
ModuleScope* module_scope, PendingCompilationErrorHandler* error_handler,
Zone* zone) {
DCHECK_EQ(this, module_scope->module());
DCHECK_NOT_NULL(error_handler);

View File

@ -13,13 +13,13 @@ namespace internal {
class AstRawString;
class ModuleInfo;
class ModuleInfoEntry;
class SourceTextModuleInfo;
class SourceTextModuleInfoEntry;
class PendingCompilationErrorHandler;
class ModuleDescriptor : public ZoneObject {
class SourceTextModuleDescriptor : public ZoneObject {
public:
explicit ModuleDescriptor(Zone* zone)
explicit SourceTextModuleDescriptor(Zone* zone)
: module_requests_(zone),
special_exports_(zone),
namespace_imports_(zone),
@ -84,9 +84,9 @@ class ModuleDescriptor : public ZoneObject {
const AstRawString* import_name;
// The module_request value records the order in which modules are
// requested. It also functions as an index into the ModuleInfo's array of
// module specifiers and into the Module's array of requested modules. A
// negative value means no module request.
// requested. It also functions as an index into the SourceTextModuleInfo's
// array of module specifiers and into the Module's array of requested
// modules. A negative value means no module request.
int module_request;
// Import/export entries that are associated with a MODULE-allocated
@ -107,7 +107,7 @@ class ModuleDescriptor : public ZoneObject {
module_request(-1),
cell_index(0) {}
Handle<ModuleInfoEntry> Serialize(Isolate* isolate) const;
Handle<SourceTextModuleInfoEntry> Serialize(Isolate* isolate) const;
};
enum CellIndexKind { kInvalid, kExport, kImport };

View File

@ -1278,14 +1278,24 @@ void AstPrinter::VisitProperty(Property* node) {
IndentedScope indent(this, buf.begin(), node->position());
Visit(node->obj());
AssignType property_kind = Property::GetAssignType(node);
if (property_kind == NAMED_PROPERTY ||
property_kind == NAMED_SUPER_PROPERTY) {
PrintLiteralIndented("NAME", node->key()->AsLiteral(), false);
} else {
DCHECK(property_kind == KEYED_PROPERTY ||
property_kind == KEYED_SUPER_PROPERTY);
PrintIndentedVisit("KEY", node->key());
AssignType type = Property::GetAssignType(node);
switch (type) {
case NAMED_PROPERTY:
case NAMED_SUPER_PROPERTY: {
PrintLiteralIndented("NAME", node->key()->AsLiteral(), false);
break;
}
case PRIVATE_METHOD: {
PrintIndentedVisit("PRIVATE_METHOD", node->key());
break;
}
case KEYED_PROPERTY:
case KEYED_SUPER_PROPERTY: {
PrintIndentedVisit("KEY", node->key());
break;
}
case NON_PROPERTY:
UNREACHABLE();
}
}

View File

@ -9,7 +9,7 @@
#include "src/ast/ast.h"
#include "src/base/optional.h"
#include "src/builtins/accessors.h"
#include "src/execution/message-template.h"
#include "src/common/message-template.h"
#include "src/init/bootstrapper.h"
#include "src/logging/counters.h"
#include "src/objects/module-inl.h"
@ -40,6 +40,7 @@ Variable* VariableMap::Declare(Zone* zone, Scope* scope,
VariableKind kind,
InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag,
RequiresBrandCheckFlag requires_brand_check,
bool* was_added) {
// AstRawStrings are unambiguous, i.e., the same string is always represented
// by the same AstRawString*.
@ -51,8 +52,9 @@ Variable* VariableMap::Declare(Zone* zone, Scope* scope,
if (*was_added) {
// The variable has not been declared yet -> insert it.
DCHECK_EQ(name, p->key);
Variable* variable = new (zone) Variable(
scope, name, mode, kind, initialization_flag, maybe_assigned_flag);
Variable* variable =
new (zone) Variable(scope, name, mode, kind, initialization_flag,
maybe_assigned_flag, requires_brand_check);
p->value = variable;
}
return reinterpret_cast<Variable*>(p->value);
@ -128,7 +130,7 @@ ModuleScope::ModuleScope(DeclarationScope* script_scope,
AstValueFactory* avfactory)
: DeclarationScope(avfactory->zone(), script_scope, MODULE_SCOPE, kModule),
module_descriptor_(new (avfactory->zone())
ModuleDescriptor(avfactory->zone())) {
SourceTextModuleDescriptor(avfactory->zone())) {
set_language_mode(LanguageMode::kStrict);
DeclareThis(avfactory);
}
@ -262,7 +264,6 @@ void Scope::SetDefaults() {
is_debug_evaluate_scope_ = false;
inner_scope_calls_eval_ = false;
force_context_allocation_ = false;
force_context_allocation_for_parameters_ = false;
is_declaration_scope_ = false;
@ -506,8 +507,9 @@ void DeclarationScope::HoistSloppyBlockFunctions(AstNodeFactory* factory) {
DCHECK(is_being_lazily_parsed_);
bool was_added;
Variable* var = DeclareVariableName(name, VariableMode::kVar, &was_added);
if (sloppy_block_function->init() == Token::ASSIGN)
var->set_maybe_assigned();
if (sloppy_block_function->init() == Token::ASSIGN) {
var->SetMaybeAssigned();
}
}
}
}
@ -785,11 +787,13 @@ Variable* Scope::LookupInScopeInfo(const AstRawString* name, Scope* cache) {
VariableMode mode;
InitializationFlag init_flag;
MaybeAssignedFlag maybe_assigned_flag;
RequiresBrandCheckFlag requires_brand_check = kNoBrandCheck;
{
location = VariableLocation::CONTEXT;
index = ScopeInfo::ContextSlotIndex(*scope_info_, name_handle, &mode,
&init_flag, &maybe_assigned_flag);
&init_flag, &maybe_assigned_flag,
&requires_brand_check);
found = index >= 0;
}
@ -814,9 +818,9 @@ Variable* Scope::LookupInScopeInfo(const AstRawString* name, Scope* cache) {
}
bool was_added;
Variable* var =
cache->variables_.Declare(zone(), this, name, mode, NORMAL_VARIABLE,
init_flag, maybe_assigned_flag, &was_added);
Variable* var = cache->variables_.Declare(
zone(), this, name, mode, NORMAL_VARIABLE, init_flag, maybe_assigned_flag,
requires_brand_check, &was_added);
DCHECK(was_added);
var->AllocateTo(location, index);
return var;
@ -889,7 +893,7 @@ Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode,
// assigned because they might be accessed by a lazily parsed top-level
// function, which, for efficiency, we preparse without variable tracking.
if (is_script_scope() || is_module_scope()) {
if (mode != VariableMode::kConst) var->set_maybe_assigned();
if (mode != VariableMode::kConst) var->SetMaybeAssigned();
var->set_is_used();
}
@ -938,7 +942,7 @@ Variable* Scope::DeclareVariable(
DCHECK(*was_added);
}
} else {
var->set_maybe_assigned();
var->SetMaybeAssigned();
if (V8_UNLIKELY(IsLexicalVariableMode(mode) ||
IsLexicalVariableMode(var->mode()))) {
// The name was declared in this scope before; check for conflicting
@ -1009,7 +1013,7 @@ Variable* Scope::DeclareVariableName(const AstRawString* name,
}
// Sloppy block function redefinition.
}
var->set_maybe_assigned();
var->SetMaybeAssigned();
}
var->set_is_used();
return var;
@ -1040,7 +1044,7 @@ Variable* DeclarationScope::DeclareDynamicGlobal(const AstRawString* name,
bool was_added;
return cache->variables_.Declare(
zone(), this, name, VariableMode::kDynamicGlobal, kind,
kCreatedInitialized, kNotAssigned, &was_added);
kCreatedInitialized, kNotAssigned, kNoBrandCheck, &was_added);
// TODO(neis): Mark variable as maybe-assigned?
}
@ -1063,7 +1067,7 @@ Variable* Scope::NewTemporary(const AstRawString* name,
Variable* var = new (zone()) Variable(scope, name, VariableMode::kTemporary,
NORMAL_VARIABLE, kCreatedInitialized);
scope->AddLocal(var);
if (maybe_assigned == kMaybeAssigned) var->set_maybe_assigned();
if (maybe_assigned == kMaybeAssigned) var->SetMaybeAssigned();
return var;
}
@ -1401,7 +1405,7 @@ void Scope::AnalyzePartially(DeclarationScope* max_outer_scope,
}
} else {
var->set_is_used();
if (proxy->is_assigned()) var->set_maybe_assigned();
if (proxy->is_assigned()) var->SetMaybeAssigned();
}
}
@ -1592,6 +1596,10 @@ void PrintVar(int indent, Variable* var) {
if (comma) PrintF(", ");
PrintF("hole initialization elided");
}
if (var->requires_brand_check()) {
if (comma) PrintF(", ");
PrintF("requires brand check");
}
PrintF("\n");
}
@ -1766,9 +1774,9 @@ Variable* Scope::NonLocal(const AstRawString* name, VariableMode mode) {
// Declare a new non-local.
DCHECK(IsDynamicVariableMode(mode));
bool was_added;
Variable* var =
variables_.Declare(zone(), this, name, mode, NORMAL_VARIABLE,
kCreatedInitialized, kNotAssigned, &was_added);
Variable* var = variables_.Declare(zone(), this, name, mode, NORMAL_VARIABLE,
kCreatedInitialized, kNotAssigned,
kNoBrandCheck, &was_added);
// Allocate it by giving it a dynamic lookup.
var->AllocateTo(VariableLocation::LOOKUP, -1);
return var;
@ -1879,11 +1887,14 @@ Variable* Scope::LookupWith(VariableProxy* proxy, Scope* scope,
DCHECK(!scope->already_resolved_);
var->set_is_used();
var->ForceContextAllocation();
if (proxy->is_assigned()) var->set_maybe_assigned();
if (proxy->is_assigned()) var->SetMaybeAssigned();
}
if (entry_point != nullptr) entry_point->variables_.Remove(var);
Scope* target = entry_point == nullptr ? scope : entry_point;
return target->NonLocal(proxy->raw_name(), VariableMode::kDynamic);
Variable* dynamic =
target->NonLocal(proxy->raw_name(), VariableMode::kDynamic);
dynamic->set_local_if_not_shadowed(var);
return dynamic;
}
Variable* Scope::LookupSloppyEval(VariableProxy* proxy, Scope* scope,
@ -1912,7 +1923,7 @@ Variable* Scope::LookupSloppyEval(VariableProxy* proxy, Scope* scope,
// script scope are always dynamic.
if (var->IsGlobalObjectProperty()) {
Scope* target = entry_point == nullptr ? scope : entry_point;
return target->NonLocal(proxy->raw_name(), VariableMode::kDynamicGlobal);
var = target->NonLocal(proxy->raw_name(), VariableMode::kDynamicGlobal);
}
if (var->is_dynamic()) return var;
@ -2010,7 +2021,7 @@ void Scope::ResolvePreparsedVariable(VariableProxy* proxy, Scope* scope,
var->set_is_used();
if (!var->is_dynamic()) {
var->ForceContextAllocation();
if (proxy->is_assigned()) var->set_maybe_assigned();
if (proxy->is_assigned()) var->SetMaybeAssigned();
return;
}
}
@ -2054,7 +2065,7 @@ bool Scope::MustAllocate(Variable* var) {
if (!var->raw_name()->IsEmpty() &&
(inner_scope_calls_eval_ || is_catch_scope() || is_script_scope())) {
var->set_is_used();
if (inner_scope_calls_eval_) var->set_maybe_assigned();
if (inner_scope_calls_eval_) var->SetMaybeAssigned();
}
DCHECK(!var->has_forced_context_allocation() || var->is_used());
// Global variables do not need to be allocated.
@ -2124,7 +2135,7 @@ void DeclarationScope::AllocateParameterLocals() {
DCHECK_EQ(this, var->scope());
if (has_mapped_arguments) {
var->set_is_used();
var->set_maybe_assigned();
var->SetMaybeAssigned();
var->ForceContextAllocation();
}
AllocateParameter(var, i);
@ -2315,12 +2326,13 @@ int Scope::ContextLocalCount() const {
(is_function_var_in_context ? 1 : 0);
}
Variable* ClassScope::DeclarePrivateName(const AstRawString* name,
bool* was_added) {
Variable* ClassScope::DeclarePrivateName(
const AstRawString* name, RequiresBrandCheckFlag requires_brand_check,
bool* was_added) {
Variable* result = EnsureRareData()->private_name_map.Declare(
zone(), this, name, VariableMode::kConst, NORMAL_VARIABLE,
InitializationFlag::kNeedsInitialization,
MaybeAssignedFlag::kMaybeAssigned, was_added);
MaybeAssignedFlag::kMaybeAssigned, requires_brand_check, was_added);
if (*was_added) {
locals_.Add(result);
}
@ -2404,8 +2416,10 @@ Variable* ClassScope::LookupPrivateNameInScopeInfo(const AstRawString* name) {
VariableMode mode;
InitializationFlag init_flag;
MaybeAssignedFlag maybe_assigned_flag;
int index = ScopeInfo::ContextSlotIndex(*scope_info_, name_handle, &mode,
&init_flag, &maybe_assigned_flag);
RequiresBrandCheckFlag requires_brand_check;
int index =
ScopeInfo::ContextSlotIndex(*scope_info_, name_handle, &mode, &init_flag,
&maybe_assigned_flag, &requires_brand_check);
if (index < 0) {
return nullptr;
}
@ -2417,7 +2431,7 @@ Variable* ClassScope::LookupPrivateNameInScopeInfo(const AstRawString* name) {
// Add the found private name to the map to speed up subsequent
// lookups for the same name.
bool was_added;
Variable* var = DeclarePrivateName(name, &was_added);
Variable* var = DeclarePrivateName(name, requires_brand_check, &was_added);
DCHECK(was_added);
var->AllocateTo(VariableLocation::CONTEXT, index);
return var;
@ -2454,8 +2468,7 @@ bool ClassScope::ResolvePrivateNames(ParseInfo* info) {
Scanner::Location loc = proxy->location();
info->pending_error_handler()->ReportMessageAt(
loc.beg_pos, loc.end_pos,
MessageTemplate::kInvalidPrivateFieldResolution, proxy->raw_name(),
kSyntaxError);
MessageTemplate::kInvalidPrivateFieldResolution, proxy->raw_name());
return false;
} else {
var->set_is_used();

View File

@ -41,7 +41,9 @@ class VariableMap : public ZoneHashMap {
Variable* Declare(Zone* zone, Scope* scope, const AstRawString* name,
VariableMode mode, VariableKind kind,
InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag, bool* was_added);
MaybeAssignedFlag maybe_assigned_flag,
RequiresBrandCheckFlag requires_brand_check,
bool* was_added);
V8_EXPORT_PRIVATE Variable* Lookup(const AstRawString* name);
void Remove(Variable* var);
@ -556,7 +558,7 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
MaybeAssignedFlag maybe_assigned_flag, bool* was_added) {
Variable* result =
variables_.Declare(zone, this, name, mode, kind, initialization_flag,
maybe_assigned_flag, was_added);
maybe_assigned_flag, kNoBrandCheck, was_added);
if (*was_added) locals_.Add(result);
return result;
}
@ -712,7 +714,6 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
// True if one of the inner scopes or the scope itself calls eval.
bool inner_scope_calls_eval_ : 1;
bool force_context_allocation_ : 1;
bool force_context_allocation_for_parameters_ : 1;
// True if it holds 'var' declarations.
@ -1155,14 +1156,14 @@ class ModuleScope final : public DeclarationScope {
AstValueFactory* avfactory);
// Returns nullptr in a deserialized scope.
ModuleDescriptor* module() const { return module_descriptor_; }
SourceTextModuleDescriptor* module() const { return module_descriptor_; }
// Set MODULE as VariableLocation for all variables that will live in a
// module's export table.
void AllocateModuleVariables();
private:
ModuleDescriptor* const module_descriptor_;
SourceTextModuleDescriptor* const module_descriptor_;
};
class V8_EXPORT_PRIVATE ClassScope : public Scope {
@ -1174,7 +1175,9 @@ class V8_EXPORT_PRIVATE ClassScope : public Scope {
// Declare a private name in the private name map and add it to the
// local variables of this scope.
Variable* DeclarePrivateName(const AstRawString* name, bool* was_added);
Variable* DeclarePrivateName(const AstRawString* name,
RequiresBrandCheckFlag requires_brand_check,
bool* was_added);
void AddUnresolvedPrivateName(VariableProxy* proxy);

View File

@ -21,7 +21,8 @@ class Variable final : public ZoneObject {
public:
Variable(Scope* scope, const AstRawString* name, VariableMode mode,
VariableKind kind, InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag = kNotAssigned)
MaybeAssignedFlag maybe_assigned_flag = kNotAssigned,
RequiresBrandCheckFlag requires_brand_check = kNoBrandCheck)
: scope_(scope),
name_(name),
local_if_not_shadowed_(nullptr),
@ -31,6 +32,7 @@ class Variable final : public ZoneObject {
bit_field_(MaybeAssignedFlagField::encode(maybe_assigned_flag) |
InitializationFlagField::encode(initialization_flag) |
VariableModeField::encode(mode) |
RequiresBrandCheckField::encode(requires_brand_check) |
IsUsedField::encode(false) |
ForceContextAllocationField::encode(false) |
ForceHoleInitializationField::encode(false) |
@ -69,8 +71,31 @@ class Variable final : public ZoneObject {
MaybeAssignedFlag maybe_assigned() const {
return MaybeAssignedFlagField::decode(bit_field_);
}
void set_maybe_assigned() {
bit_field_ = MaybeAssignedFlagField::update(bit_field_, kMaybeAssigned);
void SetMaybeAssigned() {
// If this variable is dynamically shadowing another variable, then that
// variable could also be assigned (in the non-shadowing case).
if (has_local_if_not_shadowed()) {
// Avoid repeatedly marking the same tree of variables by only recursing
// when this variable's maybe_assigned status actually changes.
if (!maybe_assigned()) {
local_if_not_shadowed()->SetMaybeAssigned();
}
DCHECK(local_if_not_shadowed()->maybe_assigned());
}
set_maybe_assigned();
}
RequiresBrandCheckFlag get_requires_brand_check_flag() const {
return RequiresBrandCheckField::decode(bit_field_);
}
bool requires_brand_check() const {
return get_requires_brand_check_flag() == kRequiresBrandCheck;
}
void set_requires_brand_check() {
bit_field_ =
RequiresBrandCheckField::update(bit_field_, kRequiresBrandCheck);
}
int initializer_position() { return initializer_position_; }
@ -143,11 +168,16 @@ class Variable final : public ZoneObject {
}
Variable* local_if_not_shadowed() const {
DCHECK(mode() == VariableMode::kDynamicLocal &&
local_if_not_shadowed_ != nullptr);
DCHECK((mode() == VariableMode::kDynamicLocal ||
mode() == VariableMode::kDynamic) &&
has_local_if_not_shadowed());
return local_if_not_shadowed_;
}
bool has_local_if_not_shadowed() const {
return local_if_not_shadowed_ != nullptr;
}
void set_local_if_not_shadowed(Variable* local) {
local_if_not_shadowed_ = local;
}
@ -200,15 +230,19 @@ class Variable final : public ZoneObject {
const AstRawString* name_;
// If this field is set, this variable references the stored locally bound
// variable, but it might be shadowed by variable bindings introduced by
// sloppy 'eval' calls between the reference scope (inclusive) and the
// binding scope (exclusive).
// variable, but it might be shadowed by variable bindings introduced by with
// blocks or sloppy 'eval' calls between the reference scope (inclusive) and
// the binding scope (exclusive).
Variable* local_if_not_shadowed_;
Variable* next_;
int index_;
int initializer_position_;
uint16_t bit_field_;
void set_maybe_assigned() {
bit_field_ = MaybeAssignedFlagField::update(bit_field_, kMaybeAssigned);
}
class VariableModeField : public BitField16<VariableMode, 0, 3> {};
class VariableKindField
: public BitField16<VariableKind, VariableModeField::kNext, 3> {};
@ -225,6 +259,9 @@ class Variable final : public ZoneObject {
class MaybeAssignedFlagField
: public BitField16<MaybeAssignedFlag,
ForceHoleInitializationField::kNext, 1> {};
class RequiresBrandCheckField
: public BitField16<RequiresBrandCheckFlag, MaybeAssignedFlagField::kNext,
1> {};
Variable** next() { return &next_; }
friend List;
friend base::ThreadedListTraits<Variable>;

View File

@ -45,7 +45,7 @@ class ReversedAdapter {
// // iterates through v from back to front
// }
template <typename T>
ReversedAdapter<T> Reversed(T& t) {
ReversedAdapter<T> Reversed(T&& t) {
return ReversedAdapter<T>(t);
}

29
deps/v8/src/base/lsan.h vendored Normal file
View File

@ -0,0 +1,29 @@
// Copyright 2019 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.
// LeakSanitizer support.
#ifndef V8_BASE_LSAN_H_
#define V8_BASE_LSAN_H_
#include <type_traits>
// There is no compile time flag for LSan, to enable this whenever ASan is
// enabled. Note that LSan can be used as part of ASan with 'detect_leaks=1'.
// On windows, LSan is not implemented yet, so disable it there.
#if defined(V8_USE_ADDRESS_SANITIZER) && !defined(V8_OS_WIN)
#include <sanitizer/lsan_interface.h>
#define LSAN_IGNORE_OBJECT(ptr) __lsan_ignore_object(ptr)
#else // defined(V8_USE_ADDRESS_SANITIZER) && !defined(V8_OS_WIN)
#define LSAN_IGNORE_OBJECT(ptr) \
static_assert(std::is_convertible<decltype(ptr), const void*>::value, \
"LSAN_IGNORE_OBJECT can only be used with pointer types")
#endif // defined(V8_USE_ADDRESS_SANITIZER) && !defined(V8_OS_WIN)
#endif // V8_BASE_LSAN_H_

View File

@ -2,14 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_COMMON_V8MEMORY_H_
#define V8_COMMON_V8MEMORY_H_
#ifndef V8_BASE_MEMORY_H_
#define V8_BASE_MEMORY_H_
#include "src/base/macros.h"
#include "src/common/globals.h"
namespace v8 {
namespace internal {
namespace base {
using Address = uintptr_t;
using byte = uint8_t;
// Memory provides an interface to 'raw' memory. It encapsulates the casts
// that typically are needed when incompatible pointer types are used.
@ -39,22 +41,6 @@ static inline void WriteUnalignedValue(Address p, V value) {
memcpy(reinterpret_cast<void*>(p), &value, sizeof(V));
}
static inline uint16_t ReadUnalignedUInt16(Address p) {
return ReadUnalignedValue<uint16_t>(p);
}
static inline void WriteUnalignedUInt16(Address p, uint16_t value) {
WriteUnalignedValue(p, value);
}
static inline uint32_t ReadUnalignedUInt32(Address p) {
return ReadUnalignedValue<uint32_t>(p);
}
static inline void WriteUnalignedUInt32(Address p, uint32_t value) {
WriteUnalignedValue(p, value);
}
template <typename V>
static inline V ReadLittleEndianValue(Address p) {
#if defined(V8_TARGET_LITTLE_ENDIAN)
@ -93,7 +79,7 @@ static inline void WriteLittleEndianValue(V* p, V value) {
WriteLittleEndianValue<V>(reinterpret_cast<Address>(p), value);
}
} // namespace internal
} // namespace base
} // namespace v8
#endif // V8_COMMON_V8MEMORY_H_
#endif // V8_BASE_MEMORY_H_

View File

@ -1,5 +1,3 @@
set noparent
hpayer@chromium.org
mlippautz@chromium.org
ulan@chromium.org

View File

@ -48,7 +48,7 @@ void* OS::Allocate(void* address, size_t size, size_t alignment,
size_t request_size = size + (alignment - page_size);
zx_handle_t vmo;
if (zx_vmo_create(request_size, ZX_VMO_NON_RESIZABLE, &vmo) != ZX_OK) {
if (zx_vmo_create(request_size, 0, &vmo) != ZX_OK) {
return nullptr;
}
static const char kVirtualMemoryName[] = "v8-virtualmem";
@ -152,7 +152,7 @@ int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) {
const auto kMicrosPerSecond = 1000000ULL;
zx_time_t nanos_since_thread_started;
zx_status_t status =
zx_clock_get_new(ZX_CLOCK_THREAD, &nanos_since_thread_started);
zx_clock_get(ZX_CLOCK_THREAD, &nanos_since_thread_started);
if (status != ZX_OK) {
return -1;
}

View File

@ -199,6 +199,12 @@ void* OS::GetRandomMmapAddr() {
MutexGuard guard(rng_mutex.Pointer());
GetPlatformRandomNumberGenerator()->NextBytes(&raw_addr, sizeof(raw_addr));
}
#if defined(__APPLE__)
#if V8_TARGET_ARCH_ARM64
DCHECK_EQ(1 << 14, AllocatePageSize());
raw_addr = RoundDown(raw_addr, 1 << 14);
#endif
#endif
#if defined(V8_USE_ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \
defined(THREAD_SANITIZER) || defined(LEAK_SANITIZER)
// If random hint addresses interfere with address ranges hard coded in

View File

@ -88,22 +88,29 @@ class SmallVector {
DCHECK_NE(0, size());
return end_[-1];
}
const T& back() const {
DCHECK_NE(0, size());
return end_[-1];
}
T& operator[](size_t index) {
DCHECK_GT(size(), index);
return begin_[index];
}
const T& operator[](size_t index) const {
const T& at(size_t index) const {
DCHECK_GT(size(), index);
return begin_[index];
}
const T& operator[](size_t index) const { return at(index); }
template <typename... Args>
void emplace_back(Args&&... args) {
if (V8_UNLIKELY(end_ == end_of_storage_)) Grow();
new (end_) T(std::forward<Args>(args)...);
++end_;
T* end = end_;
if (V8_UNLIKELY(end == end_of_storage_)) end = Grow();
new (end) T(std::forward<Args>(args)...);
end_ = end + 1;
}
void pop_back(size_t count = 1) {
@ -135,7 +142,12 @@ class SmallVector {
typename std::aligned_storage<sizeof(T) * kInlineSize, alignof(T)>::type
inline_storage_;
void Grow(size_t min_capacity = 0) {
// Grows the backing store by a factor of two. Returns the new end of the used
// storage (this reduces binary size).
V8_NOINLINE T* Grow() { return Grow(0); }
// Grows the backing store by a factor of two, and at least to {min_capacity}.
V8_NOINLINE T* Grow(size_t min_capacity) {
size_t in_use = end_ - begin_;
size_t new_capacity =
base::bits::RoundUpToPowerOfTwo(std::max(min_capacity, 2 * capacity()));
@ -145,6 +157,7 @@ class SmallVector {
begin_ = new_storage;
end_ = new_storage + in_use;
end_of_storage_ = new_storage + new_capacity;
return end_;
}
bool is_big() const { return begin_ != inline_storage_begin(); }

58
deps/v8/src/base/vlq-base64.cc vendored Normal file
View File

@ -0,0 +1,58 @@
// Copyright 2019 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 <climits>
#include <limits>
#include "src/base/logging.h"
#include "src/base/vlq-base64.h"
namespace v8 {
namespace base {
namespace {
constexpr int8_t kCharToDigit[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 0x3e, -1, -1, -1, 0x3f,
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, -1, -1,
-1, -1, -1, -1, -1, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, -1, -1, -1, -1, -1,
-1, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24,
0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
0x31, 0x32, 0x33, -1, -1, -1, -1, -1};
constexpr uint32_t kContinueShift = 5;
constexpr uint32_t kContinueMask = 1 << kContinueShift;
constexpr uint32_t kDataMask = kContinueMask - 1;
int8_t charToDigitDecode(uint8_t c) { return c < 128u ? kCharToDigit[c] : -1; }
} // namespace
int8_t charToDigitDecodeForTesting(uint8_t c) { return charToDigitDecode(c); }
int32_t VLQBase64Decode(const char* start, size_t sz, size_t* pos) {
uint32_t res = 0;
uint64_t shift = 0;
int32_t digit;
do {
if (*pos >= sz) {
return std::numeric_limits<int32_t>::min();
}
digit = static_cast<int>(charToDigitDecode(start[*pos]));
bool is_last_byte = (shift + kContinueShift >= 32);
if (digit == -1 || (is_last_byte && (digit >> 2) != 0)) {
return std::numeric_limits<int32_t>::min();
}
res += (digit & kDataMask) << shift;
shift += kContinueShift;
(*pos)++;
} while (digit & kContinueMask);
return (res & 1) ? -static_cast<int32_t>(res >> 1) : (res >> 1);
}
} // namespace base
} // namespace v8

23
deps/v8/src/base/vlq-base64.h vendored Normal file
View File

@ -0,0 +1,23 @@
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_BASE_VLQ_BASE64_H_
#define V8_BASE_VLQ_BASE64_H_
#include <string>
#include "src/base/base-export.h"
namespace v8 {
namespace base {
V8_BASE_EXPORT int8_t charToDigitDecodeForTesting(uint8_t c);
// Decodes a VLQ-Base64-encoded string into 32bit digits. A valid return value
// is within [-2^31+1, 2^31-1]. This function returns -2^31
// (std::numeric_limits<int32_t>::min()) when bad input s is passed.
V8_BASE_EXPORT int32_t VLQBase64Decode(const char* start, size_t sz,
size_t* pos);
} // namespace base
} // namespace v8
#endif // V8_BASE_VLQ_BASE64_H_

3
deps/v8/src/builtins/OWNERS vendored Normal file
View File

@ -0,0 +1,3 @@
file://COMMON_OWNERS
# COMPONENT: Blink>JavaScript>Runtime

View File

@ -287,7 +287,8 @@ void Accessors::StringLengthGetter(
if (!value.IsString()) {
// Not a string value. That means that we either got a String wrapper or
// a Value with a String wrapper in its prototype chain.
value = JSValue::cast(*Utils::OpenHandle(*info.Holder())).value();
value =
JSPrimitiveWrapper::cast(*Utils::OpenHandle(*info.Holder())).value();
}
Object result = Smi::FromInt(String::cast(value).length());
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(result, isolate)));
@ -305,7 +306,7 @@ Handle<AccessorInfo> Accessors::MakeStringLengthInfo(Isolate* isolate) {
static Handle<Object> GetFunctionPrototype(Isolate* isolate,
Handle<JSFunction> function) {
if (!function->has_prototype()) {
Handle<Object> proto = isolate->factory()->NewFunctionPrototype(function);
Handle<JSObject> proto = isolate->factory()->NewFunctionPrototype(function);
JSFunction::SetPrototype(function, proto);
}
return Handle<Object>(function->prototype(), isolate);

View File

@ -34,13 +34,13 @@ namespace arguments {
@export
macro GetArgumentsFrameAndCount(implicit context: Context)(f: JSFunction):
ArgumentsInfo {
let frame: Frame = LoadParentFramePointer();
const frame: Frame = LoadParentFramePointer();
assert(frame.function == f);
const shared: SharedFunctionInfo = f.shared_function_info;
const formalParameterCount: bint =
Convert<bint>(Convert<int32>(shared.formal_parameter_count));
let argumentCount: bint = formalParameterCount;
const argumentCount: bint = formalParameterCount;
const adaptor: ArgumentsAdaptorFrame =
Cast<ArgumentsAdaptorFrame>(frame.caller)

View File

@ -1093,11 +1093,11 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// 8-bit fields next to each other, so we could just optimize by writing a
// 16-bit. These static asserts guard our assumption is valid.
STATIC_ASSERT(BytecodeArray::kBytecodeAgeOffset ==
BytecodeArray::kOSRNestingLevelOffset + kCharSize);
BytecodeArray::kOsrNestingLevelOffset + kCharSize);
STATIC_ASSERT(BytecodeArray::kNoAgeBytecodeAge == 0);
__ mov(r9, Operand(0));
__ strh(r9, FieldMemOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kOSRNestingLevelOffset));
BytecodeArray::kOsrNestingLevelOffset));
// Load the initial bytecode offset.
__ mov(kInterpreterBytecodeOffsetRegister,
@ -1509,13 +1509,16 @@ void Generate_ContinueToBuiltinHelper(MacroAssembler* masm,
__ ldr(fp, MemOperand(
sp, BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp));
// Load builtin index (stored as a Smi) and use it to get the builtin start
// address from the builtins table.
UseScratchRegisterScope temps(masm);
Register scratch = temps.Acquire();
__ Pop(scratch);
Register builtin = temps.Acquire();
__ Pop(builtin);
__ add(sp, sp,
Operand(BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp));
__ Pop(lr);
__ add(pc, scratch, Operand(Code::kHeaderSize - kHeapObjectTag));
__ LoadEntryFromBuiltinIndex(builtin);
__ bx(builtin);
}
} // namespace
@ -2577,7 +2580,7 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
__ tst(sp, Operand(frame_alignment_mask));
__ b(eq, &alignment_as_expected);
// Don't use Check here, as it will call Runtime_Abort re-entering here.
__ stop("Unexpected alignment");
__ stop();
__ bind(&alignment_as_expected);
}
}
@ -2606,7 +2609,7 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
__ CompareRoot(r3, RootIndex::kTheHoleValue);
// Cannot use check here as it attempts to generate call into runtime.
__ b(eq, &okay);
__ stop("Unexpected pending exception");
__ stop();
__ bind(&okay);
}
@ -2835,19 +2838,25 @@ void CallApiFunctionAndReturn(MacroAssembler* masm, Register function_address,
DCHECK(function_address == r1 || function_address == r2);
Label profiler_disabled;
Label end_profiler_check;
Label profiler_enabled, end_profiler_check;
__ Move(r9, ExternalReference::is_profiling_address(isolate));
__ ldrb(r9, MemOperand(r9, 0));
__ cmp(r9, Operand(0));
__ b(eq, &profiler_disabled);
// Additional parameter is the address of the actual callback.
__ Move(r3, thunk_ref);
__ jmp(&end_profiler_check);
__ bind(&profiler_disabled);
__ Move(r3, function_address);
__ b(ne, &profiler_enabled);
__ Move(r9, ExternalReference::address_of_runtime_stats_flag());
__ ldr(r9, MemOperand(r9, 0));
__ cmp(r9, Operand(0));
__ b(ne, &profiler_enabled);
{
// Call the api function directly.
__ Move(r3, function_address);
__ b(&end_profiler_check);
}
__ bind(&profiler_enabled);
{
// Additional parameter is the address of the actual callback.
__ Move(r3, thunk_ref);
}
__ bind(&end_profiler_check);
// Allocate HandleScope in callee-save registers.

View File

@ -1201,10 +1201,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// 8-bit fields next to each other, so we could just optimize by writing a
// 16-bit. These static asserts guard our assumption is valid.
STATIC_ASSERT(BytecodeArray::kBytecodeAgeOffset ==
BytecodeArray::kOSRNestingLevelOffset + kCharSize);
BytecodeArray::kOsrNestingLevelOffset + kCharSize);
STATIC_ASSERT(BytecodeArray::kNoAgeBytecodeAge == 0);
__ Strh(wzr, FieldMemOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kOSRNestingLevelOffset));
BytecodeArray::kOsrNestingLevelOffset));
// Load the initial bytecode offset.
__ Mov(kInterpreterBytecodeOffsetRegister,
@ -1683,18 +1683,20 @@ void Generate_ContinueToBuiltinHelper(MacroAssembler* masm,
if (java_script_builtin) __ SmiUntag(kJavaScriptCallArgCountRegister);
// Load builtin object.
// Load builtin index (stored as a Smi) and use it to get the builtin start
// address from the builtins table.
UseScratchRegisterScope temps(masm);
Register builtin = temps.AcquireX();
__ Ldr(builtin,
MemOperand(fp, BuiltinContinuationFrameConstants::kBuiltinOffset));
__ Ldr(
builtin,
MemOperand(fp, BuiltinContinuationFrameConstants::kBuiltinIndexOffset));
// Restore fp, lr.
__ Mov(sp, fp);
__ Pop(fp, lr);
// Call builtin.
__ JumpCodeObject(builtin);
__ LoadEntryFromBuiltinIndex(builtin);
__ Jump(builtin);
}
} // namespace
@ -3400,16 +3402,23 @@ void CallApiFunctionAndReturn(MacroAssembler* masm, Register function_address,
DCHECK(function_address.is(x1) || function_address.is(x2));
Label profiler_disabled;
Label end_profiler_check;
Label profiler_enabled, end_profiler_check;
__ Mov(x10, ExternalReference::is_profiling_address(isolate));
__ Ldrb(w10, MemOperand(x10));
__ Cbz(w10, &profiler_disabled);
__ Mov(x3, thunk_ref);
__ B(&end_profiler_check);
__ Bind(&profiler_disabled);
__ Mov(x3, function_address);
__ Cbnz(w10, &profiler_enabled);
__ Mov(x10, ExternalReference::address_of_runtime_stats_flag());
__ Ldrsw(w10, MemOperand(x10));
__ Cbnz(w10, &profiler_enabled);
{
// Call the api function directly.
__ Mov(x3, function_address);
__ B(&end_profiler_check);
}
__ Bind(&profiler_enabled);
{
// Additional parameter is the address of the actual callback.
__ Mov(x3, thunk_ref);
}
__ Bind(&end_profiler_check);
// Save the callee-save registers we are going to use.

View File

@ -9,7 +9,7 @@ namespace array_copywithin {
// https://tc39.github.io/ecma262/#sec-array.prototype.copyWithin
transitioning javascript builtin ArrayPrototypeCopyWithin(
context: Context, receiver: Object, ...arguments): Object {
js-implicit context: Context, receiver: Object)(...arguments): Object {
// 1. Let O be ? ToObject(this value).
const object: JSReceiver = ToObject_Inline(context, receiver);

View File

@ -4,8 +4,9 @@
namespace array {
transitioning javascript builtin
ArrayEveryLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
ArrayEveryLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, initialK: Object,
length: Object): Object {
// All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a
@ -25,9 +26,10 @@ namespace array {
}
transitioning javascript builtin
ArrayEveryLoopLazyDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
length: Object, result: Object): Object {
ArrayEveryLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, initialK: Object, length: Object,
result: Object): Object {
// All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
@ -51,9 +53,9 @@ namespace array {
}
transitioning builtin ArrayEveryLoopContinuation(implicit context: Context)(
receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
array: Object, o: JSReceiver, initialK: Number, length: Number,
initialTo: Object): Object {
_receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
_array: Object, o: JSReceiver, initialK: Number, length: Number,
_initialTo: Object): Object {
// 5. Let k be 0.
// 6. Repeat, while k < len
for (let k: Number = initialK; k < length; k++) {
@ -88,7 +90,7 @@ namespace array {
labels Bailout(Smi) {
let k: Smi = 0;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(k);
let fastO: FastJSArray = Cast<FastJSArray>(o) otherwise goto Bailout(k);
const fastO: FastJSArray = Cast<FastJSArray>(o) otherwise goto Bailout(k);
let fastOW = NewFastJSArrayWitness(fastO);
// Build a fast loop over the smi array.
@ -109,12 +111,10 @@ namespace array {
// https://tc39.github.io/ecma262/#sec-array.prototype.every
transitioning javascript builtin
ArrayEvery(implicit context: Context)(receiver: Object, ...arguments):
ArrayEvery(js-implicit context: Context, receiver: Object)(...arguments):
Object {
try {
if (IsNullOrUndefined(receiver)) {
goto NullOrUndefinedError;
}
RequireObjectCoercible(receiver, 'Array.prototype.every');
// 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject_Inline(context, receiver);
@ -144,8 +144,5 @@ namespace array {
label TypeError deferred {
ThrowTypeError(kCalledNonCallable, arguments[0]);
}
label NullOrUndefinedError deferred {
ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.every');
}
}
}

View File

@ -4,9 +4,10 @@
namespace array_filter {
transitioning javascript builtin
ArrayFilterLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, array: Object,
initialK: Object, length: Object, initialTo: Object): Object {
ArrayFilterLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, array: Object, initialK: Object,
length: Object, initialTo: Object): Object {
// All continuation points in the optimized filter implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
@ -27,9 +28,10 @@ namespace array_filter {
}
transitioning javascript builtin
ArrayFilterLoopLazyDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, array: Object,
initialK: Object, length: Object, valueK: Object, initialTo: Object,
ArrayFilterLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, array: Object, initialK: Object,
length: Object, valueK: Object, initialTo: Object,
result: Object): Object {
// All continuation points in the optimized filter implementation are
// after the ToObject(O) call that ensures we are dealing with a
@ -42,9 +44,9 @@ namespace array_filter {
const numberLength = Cast<Number>(length) otherwise unreachable;
// This custom lazy deopt point is right after the callback. filter() needs
// to pick up at the next step, which is setting the callback result in
// the output array. After incrementing k and to, we can glide into the loop
// continuation builtin.
// to pick up at the next step, which is setting the callback
// result in the output array. After incrementing k and to, we can glide
// into the loop continuation builtin.
if (ToBoolean(result)) {
FastCreateDataProperty(outputArray, numberTo, valueK);
numberTo = numberTo + 1;
@ -58,7 +60,7 @@ namespace array_filter {
}
transitioning builtin ArrayFilterLoopContinuation(implicit context: Context)(
receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
_receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
array: JSReceiver, o: JSReceiver, initialK: Number, length: Number,
initialTo: Number): Object {
let to: Number = initialTo;
@ -145,12 +147,10 @@ namespace array_filter {
// https://tc39.github.io/ecma262/#sec-array.prototype.filter
transitioning javascript builtin
ArrayFilter(implicit context: Context)(receiver: Object, ...arguments):
ArrayFilter(js-implicit context: Context, receiver: Object)(...arguments):
Object {
try {
if (IsNullOrUndefined(receiver)) {
goto NullOrUndefinedError;
}
RequireObjectCoercible(receiver, 'Array.prototype.filter');
// 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject_Inline(context, receiver);
@ -199,8 +199,5 @@ namespace array_filter {
label TypeError deferred {
ThrowTypeError(kCalledNonCallable, arguments[0]);
}
label NullOrUndefinedError deferred {
ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.filter');
}
}
}

View File

@ -4,8 +4,9 @@
namespace array_find {
transitioning javascript builtin
ArrayFindLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
ArrayFindLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, initialK: Object,
length: Object): Object {
// All continuation points in the optimized find implementation are
// after the ToObject(O) call that ensures we are dealing with a
@ -24,9 +25,10 @@ namespace array_find {
}
transitioning javascript builtin
ArrayFindLoopLazyDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
length: Object, result: Object): Object {
ArrayFindLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: Object)(
_callback: Object, _thisArg: Object, _initialK: Object, _length: Object,
_result: Object): Object {
// This deopt continuation point is never actually called, it just
// exists to make stack traces correct from a ThrowTypeError if the
// callback was found to be non-callable.
@ -37,15 +39,16 @@ namespace array_find {
// happens right after the callback and it's returned value must be handled
// before iteration continues.
transitioning javascript builtin
ArrayFindLoopAfterCallbackLazyDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
length: Object, foundValue: Object, isFound: Object): Object {
ArrayFindLoopAfterCallbackLazyDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, initialK: Object, length: Object,
foundValue: Object, isFound: Object): Object {
// All continuation points in the optimized find implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable;
let numberK = Cast<Number>(initialK) otherwise unreachable;
const numberK = Cast<Number>(initialK) otherwise unreachable;
const numberLength = Cast<Number>(length) otherwise unreachable;
// This custom lazy deopt point is right after the callback. find() needs
@ -62,7 +65,7 @@ namespace array_find {
}
transitioning builtin ArrayFindLoopContinuation(implicit context: Context)(
receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
_receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
o: JSReceiver, initialK: Number, length: Number): Object {
// 5. Let k be 0.
// 6. Repeat, while k < len
@ -116,12 +119,10 @@ namespace array_find {
// https://tc39.github.io/ecma262/#sec-array.prototype.find
transitioning javascript builtin
ArrayPrototypeFind(implicit context: Context)(receiver: Object, ...arguments):
Object {
ArrayPrototypeFind(js-implicit context: Context, receiver: Object)(
...arguments): Object {
try {
if (IsNullOrUndefined(receiver)) {
goto NullOrUndefinedError;
}
RequireObjectCoercible(receiver, 'Array.prototype.find');
// 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject_Inline(context, receiver);
@ -151,8 +152,5 @@ namespace array_find {
label NotCallableError deferred {
ThrowTypeError(kCalledNonCallable, arguments[0]);
}
label NullOrUndefinedError deferred {
ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.find');
}
}
}

View File

@ -4,8 +4,9 @@
namespace array_findindex {
transitioning javascript builtin
ArrayFindIndexLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
ArrayFindIndexLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, initialK: Object,
length: Object): Object {
// All continuation points in the optimized findIndex implementation are
// after the ToObject(O) call that ensures we are dealing with a
@ -24,9 +25,10 @@ namespace array_findindex {
}
transitioning javascript builtin
ArrayFindIndexLoopLazyDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
length: Object, result: Object): Object {
ArrayFindIndexLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: Object)(
_callback: Object, _thisArg: Object, _initialK: Object, _length: Object,
_result: Object): Object {
// This deopt continuation point is never actually called, it just
// exists to make stack traces correct from a ThrowTypeError if the
// callback was found to be non-callable.
@ -37,16 +39,16 @@ namespace array_findindex {
// happens right after the callback and it's returned value must be handled
// before iteration continues.
transitioning javascript builtin
ArrayFindIndexLoopAfterCallbackLazyDeoptContinuation(implicit context:
Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
length: Object, foundValue: Object, isFound: Object): Object {
ArrayFindIndexLoopAfterCallbackLazyDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, initialK: Object, length: Object,
foundValue: Object, isFound: Object): Object {
// All continuation points in the optimized findIndex implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable;
let numberK = Cast<Number>(initialK) otherwise unreachable;
const numberK = Cast<Number>(initialK) otherwise unreachable;
const numberLength = Cast<Number>(length) otherwise unreachable;
// This custom lazy deopt point is right after the callback. find() needs
@ -64,7 +66,7 @@ namespace array_findindex {
transitioning builtin ArrayFindIndexLoopContinuation(implicit context:
Context)(
receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
_receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
o: JSReceiver, initialK: Number, length: Number): Number {
// 5. Let k be 0.
// 6. Repeat, while k < len
@ -118,12 +120,10 @@ namespace array_findindex {
// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
transitioning javascript builtin
ArrayPrototypeFindIndex(implicit context:
Context)(receiver: Object, ...arguments): Object {
ArrayPrototypeFindIndex(js-implicit context: Context, receiver: Object)(
...arguments): Object {
try {
if (IsNullOrUndefined(receiver)) {
goto NullOrUndefinedError;
}
RequireObjectCoercible(receiver, 'Array.prototype.findIndex');
// 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject_Inline(context, receiver);
@ -154,8 +154,5 @@ namespace array_findindex {
label NotCallableError deferred {
ThrowTypeError(kCalledNonCallable, arguments[0]);
}
label NullOrUndefinedError deferred {
ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.findIndex');
}
}
}

View File

@ -4,8 +4,9 @@
namespace array_foreach {
transitioning javascript builtin
ArrayForEachLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
ArrayForEachLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, initialK: Object,
length: Object): Object {
// All continuation points in the optimized forEach implemntation are
// after the ToObject(O) call that ensures we are dealing with a
@ -21,9 +22,10 @@ namespace array_foreach {
}
transitioning javascript builtin
ArrayForEachLoopLazyDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
length: Object, result: Object): Object {
ArrayForEachLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, initialK: Object, length: Object,
_result: Object): Object {
// All continuation points in the optimized forEach implemntation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
@ -38,9 +40,9 @@ namespace array_foreach {
}
transitioning builtin ArrayForEachLoopContinuation(implicit context: Context)(
receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
array: Object, o: JSReceiver, initialK: Number, len: Number,
to: Object): Object {
_receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
_array: Object, o: JSReceiver, initialK: Number, len: Number,
_to: Object): Object {
// variables {array} and {to} are ignored.
// 5. Let k be 0.
@ -72,7 +74,7 @@ namespace array_foreach {
labels Bailout(Smi) {
let k: Smi = 0;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(k);
let fastO = Cast<FastJSArray>(o) otherwise goto Bailout(k);
const fastO = Cast<FastJSArray>(o) otherwise goto Bailout(k);
let fastOW = NewFastJSArrayWitness(fastO);
// Build a fast loop over the smi array.
@ -90,11 +92,10 @@ namespace array_foreach {
// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
transitioning javascript builtin
ArrayForEach(context: Context, receiver: Object, ...arguments): Object {
ArrayForEach(js-implicit context: Context, receiver: Object)(...arguments):
Object {
try {
if (IsNullOrUndefined(receiver)) {
goto NullOrUndefinedError;
}
RequireObjectCoercible(receiver, 'Array.prototype.forEach');
// 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject_Inline(context, receiver);
@ -127,8 +128,5 @@ namespace array_foreach {
label TypeError deferred {
ThrowTypeError(kCalledNonCallable, arguments[0]);
}
label NullOrUndefinedError deferred {
ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.forEach');
}
}
}

View File

@ -37,7 +37,7 @@ namespace array_join {
const array: JSArray = UnsafeCast<JSArray>(receiver);
const fixedArray: FixedArray = UnsafeCast<FixedArray>(array.elements);
const element: Object = fixedArray.objects[UnsafeCast<Smi>(k)];
return element == Hole ? kEmptyString : element;
return element == TheHole ? kEmptyString : element;
}
LoadJoinElement<array::FastDoubleElements>(
@ -56,7 +56,7 @@ namespace array_join {
assert(!IsDetachedBuffer(typedArray.buffer));
return typed_array::LoadFixedTypedArrayElementAsTagged(
typedArray.data_ptr, UnsafeCast<Smi>(k),
typed_array::KindForArrayType<T>(), SMI_PARAMETERS);
typed_array::KindForArrayType<T>());
}
transitioning builtin ConvertToLocaleString(
@ -103,8 +103,8 @@ namespace array_join {
}
CannotUseSameArrayAccessor<JSTypedArray>(implicit context: Context)(
loadFn: LoadJoinElementFn, receiver: JSReceiver, initialMap: Map,
initialLen: Number): never
_loadFn: LoadJoinElementFn, receiver: JSReceiver, _initialMap: Map,
_initialLen: Number): never
labels Cannot, Can {
const typedArray: JSTypedArray = UnsafeCast<JSTypedArray>(receiver);
if (IsDetachedBuffer(typedArray.buffer)) goto Cannot;
@ -246,7 +246,7 @@ namespace array_join {
case (nofSeparators: Number): {
return StringRepeat(context, sep, nofSeparators);
}
case (obj: Object): {
case (Object): {
unreachable;
}
}
@ -448,7 +448,7 @@ namespace array_join {
const previouslyVisited: Object = stack.objects[i];
// Add `receiver` to the first open slot
if (previouslyVisited == Hole) {
if (previouslyVisited == TheHole) {
stack.objects[i] = receiver;
return True;
}
@ -473,7 +473,7 @@ namespace array_join {
try {
const stack: FixedArray = LoadJoinStack()
otherwise IfUninitialized;
if (stack.objects[0] == Hole) {
if (stack.objects[0] == TheHole) {
stack.objects[0] = receiver;
} else if (JoinStackPush(stack, receiver) == False)
deferred {
@ -504,7 +504,7 @@ namespace array_join {
SetJoinStack(newStack);
}
else {
stack.objects[i] = Hole;
stack.objects[i] = TheHole;
}
return Undefined;
}
@ -521,7 +521,7 @@ namespace array_join {
// Builtin call was not nested (receiver is the first entry) and
// did not contain other nested arrays that expanded the stack.
if (stack.objects[0] == receiver && len == kMinJoinStackSize) {
StoreFixedArrayElement(stack, 0, Hole, SKIP_WRITE_BARRIER);
StoreFixedArrayElement(stack, 0, TheHole, SKIP_WRITE_BARRIER);
} else
deferred {
JoinStackPop(stack, receiver);
@ -535,7 +535,7 @@ namespace array_join {
sepObj: Object, locales: Object, options: Object): Object {
// 3. If separator is undefined, let sep be the single-element String ",".
// 4. Else, let sep be ? ToString(separator).
let sep: String =
const sep: String =
sepObj == Undefined ? ',' : ToString_Inline(context, sepObj);
// If the receiver is not empty and not already being joined, continue with
@ -557,7 +557,8 @@ namespace array_join {
// https://tc39.github.io/ecma262/#sec-array.prototype.join
transitioning javascript builtin
ArrayPrototypeJoin(context: Context, receiver: Object, ...arguments): Object {
ArrayPrototypeJoin(js-implicit context: Context, receiver: Object)(
...arguments): Object {
const separator: Object = arguments[0];
// 1. Let O be ? ToObject(this value).
@ -566,8 +567,8 @@ namespace array_join {
// 2. Let len be ? ToLength(? Get(O, "length")).
const len: Number = GetLengthProperty(o);
// Only handle valid array lengths. Although the spec allows larger values,
// this matches historical V8 behavior.
// Only handle valid array lengths. Although the spec allows larger
// values, this matches historical V8 behavior.
if (len > kMaxArrayIndex + 1) ThrowTypeError(kInvalidArrayLength);
return CycleProtectedArrayJoin<JSArray>(
@ -576,7 +577,7 @@ namespace array_join {
// https://tc39.github.io/ecma262/#sec-array.prototype.tolocalestring
transitioning javascript builtin ArrayPrototypeToLocaleString(
context: Context, receiver: Object, ...arguments): Object {
js-implicit context: Context, receiver: Object)(...arguments): Object {
const locales: Object = arguments[0];
const options: Object = arguments[1];
@ -586,8 +587,8 @@ namespace array_join {
// 2. Let len be ? ToLength(? Get(O, "length")).
const len: Number = GetLengthProperty(o);
// Only handle valid array lengths. Although the spec allows larger values,
// this matches historical V8 behavior.
// Only handle valid array lengths. Although the spec allows larger
// values, this matches historical V8 behavior.
if (len > kMaxArrayIndex + 1) ThrowTypeError(kInvalidArrayLength);
return CycleProtectedArrayJoin<JSArray>(
@ -596,7 +597,7 @@ namespace array_join {
// https://tc39.github.io/ecma262/#sec-array.prototype.tostring
transitioning javascript builtin ArrayPrototypeToString(
context: Context, receiver: Object, ...arguments): Object {
js-implicit context: Context, receiver: Object)(...arguments): Object {
// 1. Let array be ? ToObject(this value).
const array: JSReceiver = ToObject_Inline(context, receiver);
@ -617,7 +618,7 @@ namespace array_join {
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.join
transitioning javascript builtin TypedArrayPrototypeJoin(
context: Context, receiver: Object, ...arguments): Object {
js-implicit context: Context, receiver: Object)(...arguments): Object {
const separator: Object = arguments[0];
// Spec: ValidateTypedArray is applied to the this value prior to evaluating
@ -632,7 +633,7 @@ namespace array_join {
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tolocalestring
transitioning javascript builtin TypedArrayPrototypeToLocaleString(
context: Context, receiver: Object, ...arguments): Object {
js-implicit context: Context, receiver: Object)(...arguments): Object {
const locales: Object = arguments[0];
const options: Object = arguments[1];

View File

@ -12,7 +12,7 @@ namespace array_lastindexof {
labels IfHole {
const elements: FixedArray = UnsafeCast<FixedArray>(elements);
const element: Object = elements.objects[index];
if (element == Hole) goto IfHole;
if (element == TheHole) goto IfHole;
return element;
}
@ -131,7 +131,7 @@ namespace array_lastindexof {
// https://tc39.github.io/ecma262/#sec-array.prototype.lastIndexOf
transitioning javascript builtin ArrayPrototypeLastIndexOf(
context: Context, receiver: Object, ...arguments): Object {
js-implicit context: Context, receiver: Object)(...arguments): Object {
// 1. Let O be ? ToObject(this value).
const object: JSReceiver = ToObject_Inline(context, receiver);

View File

@ -4,9 +4,10 @@
namespace array_map {
transitioning javascript builtin
ArrayMapLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, array: Object,
initialK: Object, length: Object): Object {
ArrayMapLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, array: Object, initialK: Object,
length: Object): Object {
// All continuation points in the optimized filter implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
@ -26,9 +27,10 @@ namespace array_map {
}
transitioning javascript builtin
ArrayMapLoopLazyDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, array: Object,
initialK: Object, length: Object, result: Object): Object {
ArrayMapLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, array: Object, initialK: Object,
length: Object, result: Object): Object {
// All continuation points in the optimized filter implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
@ -55,7 +57,7 @@ namespace array_map {
}
transitioning builtin ArrayMapLoopContinuation(implicit context: Context)(
receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
_receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
array: JSReceiver, o: JSReceiver, initialK: Number,
length: Number): Object {
// 6. Let k be 0.
@ -94,7 +96,7 @@ namespace array_map {
}
CreateJSArray(implicit context: Context)(validLength: Smi): JSArray {
let length: Smi = this.fixedArray.length;
const length: Smi = this.fixedArray.length;
assert(validLength <= length);
let kind: ElementsKind = PACKED_SMI_ELEMENTS;
if (!this.onlySmis) {
@ -114,7 +116,7 @@ namespace array_map {
kind = FastHoleyElementsKind(kind);
}
let map: Map = LoadJSArrayElementsMap(kind, LoadNativeContext(context));
const map: Map = LoadJSArrayElementsMap(kind, LoadNativeContext(context));
let a: JSArray;
if (IsDoubleElementsKind(kind)) {
@ -130,7 +132,7 @@ namespace array_map {
elements.floats[i] = Convert<float64>(n);
}
case (h: HeapObject): {
assert(h == Hole);
assert(h == TheHole);
}
}
}
@ -182,11 +184,11 @@ namespace array_map {
}
transitioning macro FastArrayMap(implicit context: Context)(
fastO: FastJSArray, len: Smi, callbackfn: Callable,
fastO: FastJSArrayForRead, len: Smi, callbackfn: Callable,
thisArg: Object): JSArray
labels Bailout(JSArray, Smi) {
let k: Smi = 0;
let fastOW = NewFastJSArrayWitness(fastO);
let fastOW = NewFastJSArrayForReadWitness(fastO);
let vector = NewVector(len);
// Build a fast loop over the smi array.
@ -220,24 +222,12 @@ namespace array_map {
return vector.CreateJSArray(len);
}
// Bails out if the slow path needs to be taken.
// It's useful to structure it this way, because the consequences of
// using the slow path on species creation are interesting to the caller.
macro FastMapSpeciesCreate(implicit context: Context)(
receiver: JSReceiver, length: Number): JSArray labels Bailout {
if (IsArraySpeciesProtectorCellInvalid()) goto Bailout;
const o = Cast<FastJSArray>(receiver) otherwise Bailout;
const smiLength = Cast<Smi>(length) otherwise Bailout;
const newMap: Map =
LoadJSArrayElementsMap(PACKED_SMI_ELEMENTS, LoadNativeContext(context));
return AllocateJSArray(PACKED_SMI_ELEMENTS, newMap, smiLength, smiLength);
}
// https://tc39.github.io/ecma262/#sec-array.prototype.map
transitioning javascript builtin
ArrayMap(implicit context: Context)(receiver: Object, ...arguments): Object {
ArrayMap(js-implicit context: Context, receiver: Object)(...arguments):
Object {
try {
if (IsNullOrUndefined(receiver)) goto NullOrUndefinedError;
RequireObjectCoercible(receiver, 'Array.prototype.map');
// 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject_Inline(context, receiver);
@ -258,7 +248,7 @@ namespace array_map {
try {
// 5. Let A be ? ArraySpeciesCreate(O, len).
if (IsArraySpeciesProtectorCellInvalid()) goto SlowSpeciesCreate;
const o: FastJSArray = Cast<FastJSArray>(receiver)
const o: FastJSArrayForRead = Cast<FastJSArrayForRead>(receiver)
otherwise SlowSpeciesCreate;
const smiLength: Smi = Cast<Smi>(len)
otherwise SlowSpeciesCreate;
@ -279,8 +269,5 @@ namespace array_map {
label TypeError deferred {
ThrowTypeError(kCalledNonCallable, arguments[0]);
}
label NullOrUndefinedError deferred {
ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.map');
}
}
}

View File

@ -5,7 +5,8 @@
namespace array_of {
// https://tc39.github.io/ecma262/#sec-array.of
transitioning javascript builtin
ArrayOf(implicit context: Context)(receiver: Object, ...arguments): Object {
ArrayOf(js-implicit context: Context, receiver: Object)(...arguments):
Object {
// 1. Let len be the actual number of arguments passed to this function.
const len: Smi = Convert<Smi>(arguments.length);
@ -35,7 +36,7 @@ namespace array_of {
// 7. Repeat, while k < len
while (k < len) {
// a. Let kValue be items[k].
let kValue: Object = items[Convert<intptr>(k)];
const kValue: Object = items[Convert<intptr>(k)];
// b. Let Pk be ! ToString(k).
// c. Perform ? CreateDataPropertyOrThrow(A, Pk, kValue).

View File

@ -4,8 +4,9 @@
namespace array {
transitioning javascript builtin
ArrayReduceRightPreLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, length: Object): Object {
ArrayReduceRightPreLoopEagerDeoptContinuation(
js-implicit context: Context,
receiver: Object)(callback: Object, length: Object): Object {
// All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
@ -21,12 +22,13 @@ namespace array {
// the hole. The continuation stub will search for the initial non-hole
// element, rightly throwing an exception if not found.
return ArrayReduceRightLoopContinuation(
jsreceiver, callbackfn, Hole, jsreceiver, 0, numberLength);
jsreceiver, callbackfn, TheHole, jsreceiver, 0, numberLength);
}
transitioning javascript builtin
ArrayReduceRightLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, initialK: Object, length: Object,
ArrayReduceRightLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, initialK: Object, length: Object,
accumulator: Object): Object {
// All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a
@ -45,27 +47,28 @@ namespace array {
}
transitioning javascript builtin
ArrayReduceRightLoopLazyDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, initialK: Object, length: Object,
ArrayReduceRightLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, initialK: Object, length: Object,
result: Object): Object {
// All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable;
let numberK = Cast<Number>(initialK) otherwise unreachable;
const numberK = Cast<Number>(initialK) otherwise unreachable;
const numberLength = Cast<Number>(length) otherwise unreachable;
// The accumulator is the result from the callback call which just occured.
let r = ArrayReduceRightLoopContinuation(
const r = ArrayReduceRightLoopContinuation(
jsreceiver, callbackfn, result, jsreceiver, numberK, numberLength);
return r;
}
transitioning builtin ArrayReduceRightLoopContinuation(implicit context:
Context)(
receiver: JSReceiver, callbackfn: Callable, initialAccumulator: Object,
o: JSReceiver, initialK: Number, length: Number): Object {
_receiver: JSReceiver, callbackfn: Callable, initialAccumulator: Object,
o: JSReceiver, initialK: Number, _length: Number): Object {
let accumulator = initialAccumulator;
// 8b and 9. Repeat, while k >= 0
@ -82,7 +85,7 @@ namespace array {
// 8b iii and 9c i. Let kValue be ? Get(O, Pk).
const value: Object = GetProperty(o, k);
if (accumulator == Hole) {
if (accumulator == TheHole) {
// 8b iii 1.
accumulator = value;
} else {
@ -99,7 +102,7 @@ namespace array {
// 8c. if kPresent is false, throw a TypeError exception.
// If the accumulator is discovered with the sentinel hole value,
// this means kPresent is false.
if (accumulator == Hole) {
if (accumulator == TheHole) {
ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduceRight');
}
return accumulator;
@ -111,9 +114,9 @@ namespace array {
labels Bailout(Number, Object) {
let accumulator = initialAccumulator;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(len - 1, accumulator);
let fastO =
Cast<FastJSArray>(o) otherwise goto Bailout(len - 1, accumulator);
let fastOW = NewFastJSArrayWitness(fastO);
const fastO = Cast<FastJSArrayForRead>(o)
otherwise goto Bailout(len - 1, accumulator);
let fastOW = NewFastJSArrayForReadWitness(fastO);
// Build a fast loop over the array.
for (let k: Smi = smiLen - 1; k >= 0; k--) {
@ -123,7 +126,7 @@ namespace array {
if (k >= fastOW.Get().length) goto Bailout(k, accumulator);
const value: Object = fastOW.LoadElementNoHole(k) otherwise continue;
if (accumulator == Hole) {
if (accumulator == TheHole) {
accumulator = value;
} else {
accumulator = Call(
@ -131,7 +134,7 @@ namespace array {
fastOW.Get());
}
}
if (accumulator == Hole) {
if (accumulator == TheHole) {
ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduceRight');
}
return accumulator;
@ -139,12 +142,10 @@ namespace array {
// https://tc39.github.io/ecma262/#sec-array.prototype.reduceRight
transitioning javascript builtin
ArrayReduceRight(implicit context: Context)(receiver: Object, ...arguments):
Object {
ArrayReduceRight(js-implicit context: Context, receiver: Object)(
...arguments): Object {
try {
if (IsNullOrUndefined(receiver)) {
goto NullOrUndefinedError;
}
RequireObjectCoercible(receiver, 'Array.prototype.reduceRight');
// 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject_Inline(context, receiver);
@ -162,7 +163,8 @@ namespace array {
// exception. (This case is handled at the end of
// ArrayReduceRightLoopContinuation).
const initialValue: Object = arguments.length > 1 ? arguments[1] : Hole;
const initialValue: Object =
arguments.length > 1 ? arguments[1] : TheHole;
try {
return FastArrayReduceRight(o, len, callbackfn, initialValue)
@ -176,8 +178,5 @@ namespace array {
label NoCallableError deferred {
ThrowTypeError(kCalledNonCallable, arguments[0]);
}
label NullOrUndefinedError deferred {
ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.reduceRight');
}
}
}

View File

@ -4,8 +4,9 @@
namespace array {
transitioning javascript builtin
ArrayReducePreLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, length: Object): Object {
ArrayReducePreLoopEagerDeoptContinuation(
js-implicit context: Context,
receiver: Object)(callback: Object, length: Object): Object {
// All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
@ -21,12 +22,13 @@ namespace array {
// the hole. The continuation stub will search for the initial non-hole
// element, rightly throwing an exception if not found.
return ArrayReduceLoopContinuation(
jsreceiver, callbackfn, Hole, jsreceiver, 0, numberLength);
jsreceiver, callbackfn, TheHole, jsreceiver, 0, numberLength);
}
transitioning javascript builtin
ArrayReduceLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, initialK: Object, length: Object,
ArrayReduceLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, initialK: Object, length: Object,
accumulator: Object): Object {
// All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a
@ -45,25 +47,26 @@ namespace array {
}
transitioning javascript builtin
ArrayReduceLoopLazyDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, initialK: Object, length: Object,
ArrayReduceLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, initialK: Object, length: Object,
result: Object): Object {
// All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable;
let numberK = Cast<Number>(initialK) otherwise unreachable;
const numberK = Cast<Number>(initialK) otherwise unreachable;
const numberLength = Cast<Number>(length) otherwise unreachable;
// The accumulator is the result from the callback call which just occured.
let r = ArrayReduceLoopContinuation(
const r = ArrayReduceLoopContinuation(
jsreceiver, callbackfn, result, jsreceiver, numberK, numberLength);
return r;
}
transitioning builtin ArrayReduceLoopContinuation(implicit context: Context)(
receiver: JSReceiver, callbackfn: Callable, initialAccumulator: Object,
_receiver: JSReceiver, callbackfn: Callable, initialAccumulator: Object,
o: JSReceiver, initialK: Number, length: Number): Object {
let accumulator = initialAccumulator;
@ -81,7 +84,7 @@ namespace array {
// 6c. i. Let kValue be ? Get(O, Pk).
const value: Object = GetProperty(o, k);
if (accumulator == Hole) {
if (accumulator == TheHole) {
// 8b.
accumulator = value;
} else {
@ -98,7 +101,7 @@ namespace array {
// 8c. if kPresent is false, throw a TypeError exception.
// If the accumulator is discovered with the sentinel hole value,
// this means kPresent is false.
if (accumulator == Hole) {
if (accumulator == TheHole) {
ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduce');
}
return accumulator;
@ -110,9 +113,10 @@ namespace array {
labels Bailout(Number, Object) {
const k = 0;
let accumulator = initialAccumulator;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(k, accumulator);
let fastO = Cast<FastJSArray>(o) otherwise goto Bailout(k, accumulator);
let fastOW = NewFastJSArrayWitness(fastO);
Cast<Smi>(len) otherwise goto Bailout(k, accumulator);
const fastO =
Cast<FastJSArrayForRead>(o) otherwise goto Bailout(k, accumulator);
let fastOW = NewFastJSArrayForReadWitness(fastO);
// Build a fast loop over the array.
for (let k: Smi = 0; k < len; k++) {
@ -122,7 +126,7 @@ namespace array {
if (k >= fastOW.Get().length) goto Bailout(k, accumulator);
const value: Object = fastOW.LoadElementNoHole(k) otherwise continue;
if (accumulator == Hole) {
if (accumulator == TheHole) {
accumulator = value;
} else {
accumulator = Call(
@ -130,7 +134,7 @@ namespace array {
fastOW.Get());
}
}
if (accumulator == Hole) {
if (accumulator == TheHole) {
ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduce');
}
return accumulator;
@ -138,12 +142,10 @@ namespace array {
// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
transitioning javascript builtin
ArrayReduce(implicit context: Context)(receiver: Object, ...arguments):
ArrayReduce(js-implicit context: Context, receiver: Object)(...arguments):
Object {
try {
if (IsNullOrUndefined(receiver)) {
goto NullOrUndefinedError;
}
RequireObjectCoercible(receiver, 'Array.prototype.reduce');
// 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject_Inline(context, receiver);
@ -161,7 +163,8 @@ namespace array {
// exception. (This case is handled at the end of
// ArrayReduceLoopContinuation).
const initialValue: Object = arguments.length > 1 ? arguments[1] : Hole;
const initialValue: Object =
arguments.length > 1 ? arguments[1] : TheHole;
try {
return FastArrayReduce(o, len, callbackfn, initialValue)
@ -175,8 +178,5 @@ namespace array {
label NoCallableError deferred {
ThrowTypeError(kCalledNonCallable, arguments[0]);
}
label NullOrUndefinedError deferred {
ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.reduce');
}
}
}

View File

@ -165,7 +165,7 @@ namespace array_reverse {
// https://tc39.github.io/ecma262/#sec-array.prototype.reverse
transitioning javascript builtin ArrayPrototypeReverse(
context: Context, receiver: Object, ...arguments): Object {
js-implicit context: Context, receiver: Object)(...arguments): Object {
try {
TryFastPackedArrayReverse(receiver) otherwise Baseline;
return receiver;

View File

@ -103,7 +103,7 @@ namespace array_shift {
// https://tc39.github.io/ecma262/#sec-array.prototype.shift
transitioning javascript builtin ArrayPrototypeShift(
implicit context: Context)(receiver: Object, ...arguments): Object {
js-implicit context: Context, receiver: Object)(...arguments): Object {
try {
return TryFastArrayShift(receiver, arguments) otherwise Slow;
}

View File

@ -63,7 +63,7 @@ namespace array_slice {
for (let current: Smi = start; current < to; ++current) {
const e: Object =
sloppyElements.objects[current + kSloppyArgumentsParameterMapStart];
const newElement: Object = e != Hole ?
const newElement: Object = e != TheHole ?
argumentsContext[UnsafeCast<Smi>(e)] :
unmappedElements.objects[current];
// It is safe to skip the write barrier here because resultElements was
@ -105,7 +105,6 @@ namespace array_slice {
return ExtractFastJSArray(context, a, start, count);
}
case (a: JSArgumentsObjectWithLength): {
const nativeContext: NativeContext = LoadNativeContext(context);
const map: Map = a.map;
if (IsFastAliasedArgumentsMap(map)) {
return HandleFastAliasedSloppyArgumentsSlice(context, a, start, count)
@ -123,8 +122,8 @@ namespace array_slice {
// https://tc39.github.io/ecma262/#sec-array.prototype.slice
transitioning javascript builtin
ArrayPrototypeSlice(context: Context, receiver: Object, ...arguments):
Object {
ArrayPrototypeSlice(js-implicit context: Context, receiver: Object)(
...arguments): Object {
// Handle array cloning case if the receiver is a fast array.
if (arguments.length == 0) {
typeswitch (receiver) {
@ -186,7 +185,7 @@ namespace array_slice {
// 10. Repeat, while k < final
while (k < final) {
// a. Let Pk be ! ToString(k).
let pK: Number = k;
const pK: Number = k;
// b. Let kPresent be ? HasProperty(O, Pk).
const fromPresent: Boolean = HasProperty(o, pK);

View File

@ -4,8 +4,9 @@
namespace array {
transitioning javascript builtin
ArraySomeLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
ArraySomeLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, initialK: Object,
length: Object): Object {
// All continuation points in the optimized some implementation are
// after the ToObject(O) call that ensures we are dealing with a
@ -25,9 +26,10 @@ namespace array {
}
transitioning javascript builtin
ArraySomeLoopLazyDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
length: Object, result: Object): Object {
ArraySomeLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: Object)(
callback: Object, thisArg: Object, initialK: Object, length: Object,
result: Object): Object {
// All continuation points in the optimized some implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
@ -51,9 +53,9 @@ namespace array {
}
transitioning builtin ArraySomeLoopContinuation(implicit context: Context)(
receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
array: Object, o: JSReceiver, initialK: Number, length: Number,
initialTo: Object): Object {
_receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
_array: Object, o: JSReceiver, initialK: Number, length: Number,
_initialTo: Object): Object {
// 5. Let k be 0.
// 6. Repeat, while k < len
for (let k: Number = initialK; k < length; k++) {
@ -88,7 +90,7 @@ namespace array {
labels Bailout(Smi) {
let k: Smi = 0;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(k);
let fastO = Cast<FastJSArray>(o) otherwise goto Bailout(k);
const fastO = Cast<FastJSArray>(o) otherwise goto Bailout(k);
let fastOW = NewFastJSArrayWitness(fastO);
// Build a fast loop over the smi array.
@ -109,11 +111,10 @@ namespace array {
// https://tc39.github.io/ecma262/#sec-array.prototype.some
transitioning javascript builtin
ArraySome(implicit context: Context)(receiver: Object, ...arguments): Object {
ArraySome(js-implicit context: Context, receiver: Object)(...arguments):
Object {
try {
if (IsNullOrUndefined(receiver)) {
goto NullOrUndefinedError;
}
RequireObjectCoercible(receiver, 'Array.prototype.some');
// 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject_Inline(context, receiver);
@ -143,8 +144,5 @@ namespace array {
label TypeError deferred {
ThrowTypeError(kCalledNonCallable, arguments[0]);
}
label NullOrUndefinedError deferred {
ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.some');
}
}
}

View File

@ -54,8 +54,7 @@ namespace array_splice {
macro FastSplice<FixedArrayType: type, ElementType: type>(implicit context:
Context)(
args: Arguments, a: JSArray, length: Smi, newLength: Smi,
lengthDelta: Smi, actualStart: Smi, insertCount: Smi,
actualDeleteCount: Smi): void labels Bailout {
actualStart: Smi, insertCount: Smi, actualDeleteCount: Smi): void {
// Make sure elements are writable.
array::EnsureWriteableFastElements(a);
@ -77,7 +76,7 @@ namespace array_splice {
UnsafeCast<FixedArrayType>(elements), dstIndex, srcIndex, count);
} else {
// Grow.
let capacity: Smi = CalculateNewElementsCapacity(newLength);
const capacity: Smi = CalculateNewElementsCapacity(newLength);
const newElements: FixedArrayType =
Extract<FixedArrayType>(elements, 0, actualStart, capacity);
a.elements = newElements;
@ -168,12 +167,12 @@ namespace array_splice {
if (IsFastSmiOrTaggedElementsKind(elementsKind)) {
FastSplice<FixedArray, Object>(
args, a, length, newLength, lengthDelta, actualStart, insertCount,
actualDeleteCount) otherwise Bailout;
args, a, length, newLength, actualStart, insertCount,
actualDeleteCount);
} else {
FastSplice<FixedDoubleArray, Number>(
args, a, length, newLength, lengthDelta, actualStart, insertCount,
actualDeleteCount) otherwise Bailout;
args, a, length, newLength, actualStart, insertCount,
actualDeleteCount);
}
return deletedResult;
@ -301,8 +300,6 @@ namespace array_splice {
context: Context, arguments: Arguments, o: JSReceiver, len: Number,
actualStart: Number, insertCount: Smi,
actualDeleteCount: Number): Object {
const affected: Number = len - actualStart - actualDeleteCount;
// 9. Let A be ? ArraySpeciesCreate(O, actualDeleteCount).
const a: JSReceiver = ArraySpeciesCreate(context, o, actualDeleteCount);
const itemCount: Number = insertCount;
@ -353,8 +350,8 @@ namespace array_splice {
// https://tc39.github.io/ecma262/#sec-array.prototype.splice
transitioning javascript builtin
ArrayPrototypeSplice(context: Context, receiver: Object, ...arguments):
Object {
ArrayPrototypeSplice(js-implicit context: Context, receiver: Object)(
...arguments): Object {
// 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject(context, receiver);

View File

@ -93,7 +93,7 @@ namespace array_unshift {
// https://tc39.github.io/ecma262/#sec-array.prototype.unshift
transitioning javascript builtin ArrayPrototypeUnshift(
context: Context, receiver: Object, ...arguments): Object {
js-implicit context: Context, receiver: Object)(...arguments): Object {
try {
TryFastArrayUnshift(context, receiver, arguments) otherwise Baseline;
}

View File

@ -33,18 +33,19 @@ namespace array {
}
macro IsJSArray(implicit context: Context)(o: Object): bool {
try {
const array: JSArray = Cast<JSArray>(o) otherwise NotArray;
return true;
}
label NotArray {
return false;
typeswitch (o) {
case (JSArray): {
return true;
}
case (Object): {
return false;
}
}
}
macro LoadElementOrUndefined(a: FixedArray, i: Smi): Object {
const e: Object = a.objects[i];
return e == Hole ? Undefined : e;
return e == TheHole ? Undefined : e;
}
macro LoadElementOrUndefined(a: FixedDoubleArray, i: Smi): NumberOrUndefined {
@ -62,26 +63,7 @@ namespace array {
}
macro StoreArrayHole(elements: FixedArray, k: Smi): void {
elements.objects[k] = Hole;
}
macro CopyArrayElement(
elements: FixedArray, newElements: FixedArray, from: Smi, to: Smi): void {
const e: Object = elements.objects[from];
newElements.objects[to] = e;
}
macro CopyArrayElement(
elements: FixedDoubleArray, newElements: FixedDoubleArray, from: Smi,
to: Smi): void {
try {
const floatValue: float64 = LoadDoubleWithHoleCheck(elements, from)
otherwise FoundHole;
newElements.floats[to] = floatValue;
}
label FoundHole {
StoreArrayHole(newElements, to);
}
elements.objects[k] = TheHole;
}
extern macro SetPropertyLength(implicit context: Context)(Object, Number);

File diff suppressed because it is too large Load Diff

206
deps/v8/src/builtins/bigint.tq vendored Normal file
View File

@ -0,0 +1,206 @@
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include 'src/builtins/builtins-bigint-gen.h'
// TODO(nicohartmann): Discuss whether types used by multiple builtins should be
// in global namespace
@noVerifier
extern class BigIntBase extends HeapObject generates 'TNode<BigInt>' {
}
type BigInt extends BigIntBase;
@noVerifier
@hasSameInstanceTypeAsParent
extern class MutableBigInt extends BigIntBase generates 'TNode<BigInt>' {
}
Convert<BigInt, MutableBigInt>(i: MutableBigInt): BigInt {
assert(bigint::IsCanonicalized(i));
return %RawDownCast<BigInt>(Convert<BigIntBase>(i));
}
namespace bigint {
const kPositiveSign: uint32 = 0;
const kNegativeSign: uint32 = 1;
extern macro BigIntBuiltinsAssembler::CppAbsoluteAddAndCanonicalize(
MutableBigInt, BigIntBase, BigIntBase): void;
extern macro BigIntBuiltinsAssembler::CppAbsoluteSubAndCanonicalize(
MutableBigInt, BigIntBase, BigIntBase): void;
extern macro BigIntBuiltinsAssembler::CppAbsoluteCompare(
BigIntBase, BigIntBase): int32;
extern macro BigIntBuiltinsAssembler::ReadBigIntSign(BigIntBase): uint32;
extern macro BigIntBuiltinsAssembler::ReadBigIntLength(BigIntBase): intptr;
extern macro BigIntBuiltinsAssembler::WriteBigIntSignAndLength(
MutableBigInt, uint32, intptr): void;
extern macro CodeStubAssembler::AllocateBigInt(intptr): MutableBigInt;
extern macro CodeStubAssembler::StoreBigIntDigit(
MutableBigInt, intptr, uintptr): void;
extern macro CodeStubAssembler::LoadBigIntDigit(BigIntBase, intptr): uintptr;
@export // Silence unused warning.
// TODO(szuend): Remove @export once macros that are only used in
// asserts are no longer detected as unused.
macro IsCanonicalized(bigint: BigIntBase): bool {
const length = ReadBigIntLength(bigint);
if (length == 0) {
return ReadBigIntSign(bigint) == kPositiveSign;
}
return LoadBigIntDigit(bigint, length - 1) != 0;
}
macro InvertSign(sign: uint32): uint32 {
return sign == kPositiveSign ? kNegativeSign : kPositiveSign;
}
macro AllocateEmptyBigIntNoThrow(implicit context: Context)(
sign: uint32, length: intptr): MutableBigInt labels BigIntTooBig {
if (length > kBigIntMaxLength) {
goto BigIntTooBig;
}
const result: MutableBigInt = AllocateBigInt(length);
WriteBigIntSignAndLength(result, sign, length);
return result;
}
macro AllocateEmptyBigInt(implicit context: Context)(
sign: uint32, length: intptr): MutableBigInt {
try {
return AllocateEmptyBigIntNoThrow(sign, length) otherwise BigIntTooBig;
}
label BigIntTooBig {
ThrowRangeError(kBigIntTooBig);
}
}
macro MutableBigIntAbsoluteCompare(x: BigIntBase, y: BigIntBase): int32 {
return CppAbsoluteCompare(x, y);
}
macro MutableBigIntAbsoluteSub(implicit context: Context)(
x: BigInt, y: BigInt, resultSign: uint32): BigInt {
const xlength = ReadBigIntLength(x);
const ylength = ReadBigIntLength(y);
const xsign = ReadBigIntSign(x);
assert(MutableBigIntAbsoluteCompare(x, y) >= 0);
if (xlength == 0) {
assert(ylength == 0);
return x;
}
if (ylength == 0) {
return resultSign == xsign ? x : BigIntUnaryMinus(x);
}
const result = AllocateEmptyBigInt(resultSign, xlength);
CppAbsoluteSubAndCanonicalize(result, x, y);
return Convert<BigInt>(result);
}
macro MutableBigIntAbsoluteAdd(implicit context: Context)(
xBigint: BigInt, yBigint: BigInt,
resultSign: uint32): BigInt labels BigIntTooBig {
let xlength = ReadBigIntLength(xBigint);
let ylength = ReadBigIntLength(yBigint);
let x = xBigint;
let y = yBigint;
if (xlength < ylength) {
// Swap x and y so that x is longer.
x = yBigint;
y = xBigint;
const tempLength = xlength;
xlength = ylength;
ylength = tempLength;
}
// case: 0n + 0n
if (xlength == 0) {
assert(ylength == 0);
return x;
}
// case: x + 0n
if (ylength == 0) {
return resultSign == ReadBigIntSign(x) ? x : BigIntUnaryMinus(x);
}
// case: x + y
const result = AllocateEmptyBigIntNoThrow(resultSign, xlength + 1)
otherwise BigIntTooBig;
CppAbsoluteAddAndCanonicalize(result, x, y);
return Convert<BigInt>(result);
}
macro BigIntAddImpl(implicit context: Context)(x: BigInt, y: BigInt): BigInt
labels BigIntTooBig {
const xsign = ReadBigIntSign(x);
const ysign = ReadBigIntSign(y);
if (xsign == ysign) {
// x + y == x + y
// -x + -y == -(x + y)
return MutableBigIntAbsoluteAdd(x, y, xsign) otherwise BigIntTooBig;
}
// x + -y == x - y == -(y - x)
// -x + y == y - x == -(x - y)
if (MutableBigIntAbsoluteCompare(x, y) >= 0) {
return MutableBigIntAbsoluteSub(x, y, xsign);
}
return MutableBigIntAbsoluteSub(y, x, InvertSign(xsign));
}
builtin BigIntAddNoThrow(implicit context: Context)(x: BigInt, y: BigInt):
Numeric {
try {
return BigIntAddImpl(x, y) otherwise BigIntTooBig;
}
label BigIntTooBig {
// Smi sentinal is used to signal BigIntTooBig exception.
return Convert<Smi>(0);
}
}
builtin BigIntAdd(implicit context: Context)(xNum: Numeric, yNum: Numeric):
BigInt {
try {
const x = Cast<BigInt>(xNum) otherwise MixedTypes;
const y = Cast<BigInt>(yNum) otherwise MixedTypes;
return BigIntAddImpl(x, y) otherwise BigIntTooBig;
}
label MixedTypes {
ThrowTypeError(kBigIntMixedTypes);
}
label BigIntTooBig {
ThrowRangeError(kBigIntTooBig);
}
}
builtin BigIntUnaryMinus(implicit context: Context)(bigint: BigInt): BigInt {
const length = ReadBigIntLength(bigint);
// There is no -0n.
if (length == 0) {
return bigint;
}
const result =
AllocateEmptyBigInt(InvertSign(ReadBigIntSign(bigint)), length);
for (let i: intptr = 0; i < length; ++i) {
StoreBigIntDigit(result, i, LoadBigIntDigit(bigint, i));
}
return Convert<BigInt>(result);
}
} // namespace bigint

View File

@ -3,39 +3,20 @@
// found in the LICENSE file.
namespace boolean {
const kNameDictionaryInitialCapacity:
constexpr int32 generates 'NameDictionary::kInitialCapacity';
extern macro ConstructorBuiltinsAssembler::IsDictionaryMap(Map): bool;
extern macro CodeStubAssembler::AllocateNameDictionary(constexpr int32):
NameDictionary;
// TODO(v8:9120): This is a workaround to get access to target and new.target
// in javascript builtins. Requires cleanup once this is fully supported by
// torque.
const NEW_TARGET_INDEX:
constexpr int32 generates 'Descriptor::kJSNewTarget';
const TARGET_INDEX: constexpr int32 generates 'Descriptor::kJSTarget';
extern macro Parameter(constexpr int32): Object;
javascript builtin
BooleanConstructor(context: Context, receiver: Object, ...arguments): Object {
BooleanConstructor(
js-implicit context: Context, receiver: Object, newTarget: Object,
target: JSFunction)(...arguments): Object {
const value = SelectBooleanConstant(ToBoolean(arguments[0]));
const newTarget = Parameter(NEW_TARGET_INDEX);
if (newTarget == Undefined) {
return value;
}
const target = UnsafeCast<JSFunction>(Parameter(TARGET_INDEX));
const map = GetDerivedMap(target, UnsafeCast<JSReceiver>(newTarget));
let properties = kEmptyFixedArray;
if (IsDictionaryMap(map)) {
properties = AllocateNameDictionary(kNameDictionaryInitialCapacity);
}
const obj = UnsafeCast<JSValue>(AllocateJSObjectFromMap(
map, properties, kEmptyFixedArray, kNone, kWithSlackTracking));
const obj =
UnsafeCast<JSPrimitiveWrapper>(AllocateFastOrSlowJSObjectFromMap(map));
obj.value = value;
return obj;
}

View File

@ -32,14 +32,16 @@ JSReceiver GetCompatibleReceiver(Isolate* isolate, FunctionTemplateInfo info,
JSObject js_obj_receiver = JSObject::cast(receiver);
FunctionTemplateInfo signature = FunctionTemplateInfo::cast(recv_type);
// Check the receiver. Fast path for receivers with no hidden prototypes.
// Check the receiver.
if (signature.IsTemplateFor(js_obj_receiver)) return receiver;
if (!js_obj_receiver.map().has_hidden_prototype()) return JSReceiver();
for (PrototypeIterator iter(isolate, js_obj_receiver, kStartAtPrototype,
PrototypeIterator::END_AT_NON_HIDDEN);
!iter.IsAtEnd(); iter.Advance()) {
JSObject current = iter.GetCurrent<JSObject>();
if (signature.IsTemplateFor(current)) return current;
// The JSGlobalProxy might have a hidden prototype.
if (V8_UNLIKELY(js_obj_receiver.IsJSGlobalProxy())) {
HeapObject prototype = js_obj_receiver.map().prototype();
if (!prototype.IsNull(isolate)) {
JSObject js_obj_prototype = JSObject::cast(prototype);
if (signature.IsTemplateFor(js_obj_prototype)) return js_obj_prototype;
}
}
return JSReceiver();
}

View File

@ -266,7 +266,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
var_list1, argument_offset, mapped_offset,
[this, elements, &current_argument](Node* offset) {
Increment(&current_argument, kSystemPointerSize);
Node* arg = LoadBufferObject(current_argument.value(), 0);
Node* arg = LoadBufferObject(
UncheckedCast<RawPtrT>(current_argument.value()), 0);
StoreNoWriteBarrier(MachineRepresentation::kTagged, elements, offset,
arg);
},

View File

@ -227,7 +227,7 @@ ArrayBuiltinsAssembler::ArrayBuiltinsAssembler(
VariableList list({&a_, &k_, &to_}, zone());
FastLoopBody body = [&](Node* index) {
GotoIf(IsDetachedBuffer(array_buffer), detached);
GotoIf(IsDetachedBuffer(CAST(array_buffer)), detached);
TNode<RawPtrT> data_ptr = LoadJSTypedArrayBackingStore(typed_array);
Node* value = LoadFixedTypedArrayElementAsTagged(
data_ptr, index, source_elements_kind_, SMI_PARAMETERS);
@ -402,7 +402,7 @@ TF_BUILTIN(ArrayPrototypePush, CodeStubAssembler) {
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
TNode<Object> receiver = args.GetReceiver();
TNode<JSArray> array_receiver;
Node* kind = nullptr;
TNode<Int32T> kind;
Label fast(this);
BranchIfFastJSArray(receiver, context, &fast, &runtime);
@ -709,19 +709,19 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) {
iterator_assembler.GetIterator(context, items, iterator_method);
TNode<Context> native_context = LoadNativeContext(context);
TNode<Object> fast_iterator_result_map =
LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX);
TNode<Map> fast_iterator_result_map = CAST(
LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX));
Goto(&loop);
BIND(&loop);
{
// Loop while iterator is not done.
TNode<Object> next = iterator_assembler.IteratorStep(
TNode<JSReceiver> next = iterator_assembler.IteratorStep(
context, iterator_record, &loop_done, fast_iterator_result_map);
TVARIABLE(Object, value,
CAST(iterator_assembler.IteratorValue(
context, next, fast_iterator_result_map)));
iterator_assembler.IteratorValue(context, next,
fast_iterator_result_map));
// If a map_function is supplied then call it (using this_arg as
// receiver), on the value returned from the iterator. Exceptions are
@ -2035,8 +2035,7 @@ void ArrayBuiltinsAssembler::CreateArrayDispatchSingleArgument(
&normal_sequence);
{
// Make elements kind holey and update elements kind in the type info.
var_elements_kind =
Signed(Word32Or(var_elements_kind.value(), Int32Constant(1)));
var_elements_kind = Word32Or(var_elements_kind.value(), Int32Constant(1));
StoreObjectFieldNoWriteBarrier(
allocation_site, AllocationSite::kTransitionInfoOrBoilerplateOffset,
SmiOr(transition_info, SmiConstant(fast_elements_kind_holey_mask)));

View File

@ -970,8 +970,9 @@ void CollectElementIndices(Isolate* isolate, Handle<JSObject> object,
}
case FAST_STRING_WRAPPER_ELEMENTS:
case SLOW_STRING_WRAPPER_ELEMENTS: {
DCHECK(object->IsJSValue());
Handle<JSValue> js_value = Handle<JSValue>::cast(object);
DCHECK(object->IsJSPrimitiveWrapper());
Handle<JSPrimitiveWrapper> js_value =
Handle<JSPrimitiveWrapper>::cast(object);
DCHECK(js_value->value().IsString());
Handle<String> string(String::cast(js_value->value()), isolate);
uint32_t length = static_cast<uint32_t>(string->length());

View File

@ -36,6 +36,21 @@ void AsyncFunctionBuiltinsAssembler::AsyncFunctionAwaitResumeClosure(
TNode<JSAsyncFunctionObject> async_function_object =
CAST(LoadContextElement(context, Context::EXTENSION_INDEX));
// Push the promise for the {async_function_object} back onto the catch
// prediction stack to handle exceptions thrown after resuming from the
// await properly.
Label if_instrumentation(this, Label::kDeferred),
if_instrumentation_done(this);
Branch(IsDebugActive(), &if_instrumentation, &if_instrumentation_done);
BIND(&if_instrumentation);
{
TNode<JSPromise> promise = LoadObjectField<JSPromise>(
async_function_object, JSAsyncFunctionObject::kPromiseOffset);
CallRuntime(Runtime::kDebugAsyncFunctionResumed, context, promise);
Goto(&if_instrumentation_done);
}
BIND(&if_instrumentation_done);
// Inline version of GeneratorPrototypeNext / GeneratorPrototypeReturn with
// unnecessary runtime checks removed.
@ -80,27 +95,19 @@ TF_BUILTIN(AsyncFunctionEnter, AsyncFunctionBuiltinsAssembler) {
Signed(IntPtrAdd(WordSar(frame_size, IntPtrConstant(kTaggedSizeLog2)),
formal_parameter_count));
// Allocate space for the promise, the async function object
// and the register file.
TNode<IntPtrT> size = IntPtrAdd(
IntPtrConstant(JSPromise::kSizeWithEmbedderFields +
JSAsyncFunctionObject::kSize + FixedArray::kHeaderSize),
Signed(WordShl(parameters_and_register_length,
IntPtrConstant(kTaggedSizeLog2))));
TNode<HeapObject> base = AllocateInNewSpace(size);
// Initialize the register file.
TNode<FixedArray> parameters_and_registers = UncheckedCast<FixedArray>(
InnerAllocate(base, JSAsyncFunctionObject::kSize +
JSPromise::kSizeWithEmbedderFields));
StoreMapNoWriteBarrier(parameters_and_registers, RootIndex::kFixedArrayMap);
StoreObjectFieldNoWriteBarrier(parameters_and_registers,
FixedArray::kLengthOffset,
SmiFromIntPtr(parameters_and_register_length));
// Allocate and initialize the register file.
TNode<FixedArrayBase> parameters_and_registers =
AllocateFixedArray(HOLEY_ELEMENTS, parameters_and_register_length,
INTPTR_PARAMETERS, kAllowLargeObjectAllocation);
FillFixedArrayWithValue(HOLEY_ELEMENTS, parameters_and_registers,
IntPtrConstant(0), parameters_and_register_length,
RootIndex::kUndefinedValue);
// Allocate space for the promise, the async function object.
TNode<IntPtrT> size = IntPtrConstant(JSPromise::kSizeWithEmbedderFields +
JSAsyncFunctionObject::kSize);
TNode<HeapObject> base = AllocateInNewSpace(size);
// Initialize the promise.
TNode<Context> native_context = LoadNativeContext(context);
TNode<JSFunction> promise_function =

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/builtins/builtins-bigint-gen.h"
#include "src/builtins/builtins-utils-gen.h"
#include "src/builtins/builtins.h"
#include "src/codegen/code-stub-assembler.h"

View File

@ -0,0 +1,80 @@
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_BUILTINS_BUILTINS_BIGINT_GEN_H_
#define V8_BUILTINS_BUILTINS_BIGINT_GEN_H_
#include "src/codegen/code-stub-assembler.h"
#include "src/objects/bigint.h"
namespace v8 {
namespace internal {
class BigIntBuiltinsAssembler : public CodeStubAssembler {
public:
explicit BigIntBuiltinsAssembler(compiler::CodeAssemblerState* state)
: CodeStubAssembler(state) {}
TNode<IntPtrT> ReadBigIntLength(TNode<BigInt> value) {
TNode<Word32T> bitfield = LoadBigIntBitfield(value);
return ChangeInt32ToIntPtr(
Signed(DecodeWord32<BigIntBase::LengthBits>(bitfield)));
}
TNode<Uint32T> ReadBigIntSign(TNode<BigInt> value) {
TNode<Word32T> bitfield = LoadBigIntBitfield(value);
return DecodeWord32<BigIntBase::SignBits>(bitfield);
}
void WriteBigIntSignAndLength(TNode<BigInt> bigint, TNode<Uint32T> sign,
TNode<IntPtrT> length) {
STATIC_ASSERT(BigIntBase::SignBits::kShift == 0);
TNode<Uint32T> bitfield = Unsigned(
Word32Or(Word32Shl(TruncateIntPtrToInt32(length),
Int32Constant(BigIntBase::LengthBits::kShift)),
Word32And(sign, Int32Constant(BigIntBase::SignBits::kMask))));
StoreBigIntBitfield(bigint, bitfield);
}
void CppAbsoluteAddAndCanonicalize(TNode<BigInt> result, TNode<BigInt> x,
TNode<BigInt> y) {
TNode<ExternalReference> mutable_big_int_absolute_add_and_canonicalize =
ExternalConstant(
ExternalReference::
mutable_big_int_absolute_add_and_canonicalize_function());
CallCFunction(mutable_big_int_absolute_add_and_canonicalize,
MachineType::AnyTagged(),
std::make_pair(MachineType::AnyTagged(), result),
std::make_pair(MachineType::AnyTagged(), x),
std::make_pair(MachineType::AnyTagged(), y));
}
void CppAbsoluteSubAndCanonicalize(TNode<BigInt> result, TNode<BigInt> x,
TNode<BigInt> y) {
TNode<ExternalReference> mutable_big_int_absolute_sub_and_canonicalize =
ExternalConstant(
ExternalReference::
mutable_big_int_absolute_sub_and_canonicalize_function());
CallCFunction(mutable_big_int_absolute_sub_and_canonicalize,
MachineType::AnyTagged(),
std::make_pair(MachineType::AnyTagged(), result),
std::make_pair(MachineType::AnyTagged(), x),
std::make_pair(MachineType::AnyTagged(), y));
}
TNode<Int32T> CppAbsoluteCompare(TNode<BigInt> x, TNode<BigInt> y) {
TNode<ExternalReference> mutable_big_int_absolute_compare =
ExternalConstant(
ExternalReference::mutable_big_int_absolute_compare_function());
TNode<Int32T> result = UncheckedCast<Int32T>(
CallCFunction(mutable_big_int_absolute_compare, MachineType::Int32(),
std::make_pair(MachineType::AnyTagged(), x),
std::make_pair(MachineType::AnyTagged(), y)));
return result;
}
};
} // namespace internal
} // namespace v8
#endif // V8_BUILTINS_BUILTINS_BIGINT_GEN_H_

View File

@ -80,10 +80,10 @@ MaybeHandle<BigInt> ThisBigIntValue(Isolate* isolate, Handle<Object> value,
// 1. If Type(value) is BigInt, return value.
if (value->IsBigInt()) return Handle<BigInt>::cast(value);
// 2. If Type(value) is Object and value has a [[BigIntData]] internal slot:
if (value->IsJSValue()) {
if (value->IsJSPrimitiveWrapper()) {
// 2a. Assert: value.[[BigIntData]] is a BigInt value.
// 2b. Return value.[[BigIntData]].
Object data = JSValue::cast(*value).value();
Object data = JSPrimitiveWrapper::cast(*value).value();
if (data.IsBigInt()) return handle(BigInt::cast(data), isolate);
}
// 3. Throw a TypeError exception.

View File

@ -15,22 +15,23 @@ namespace internal {
// ES6 #sec-boolean.prototype.tostring
TF_BUILTIN(BooleanPrototypeToString, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext);
Node* receiver = Parameter(Descriptor::kReceiver);
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
Node* value = ToThisValue(context, receiver, PrimitiveType::kBoolean,
"Boolean.prototype.toString");
Node* result = LoadObjectField(value, Oddball::kToStringOffset);
TNode<Oddball> value =
CAST(ToThisValue(context, receiver, PrimitiveType::kBoolean,
"Boolean.prototype.toString"));
TNode<String> result = CAST(LoadObjectField(value, Oddball::kToStringOffset));
Return(result);
}
// ES6 #sec-boolean.prototype.valueof
TF_BUILTIN(BooleanPrototypeValueOf, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext);
Node* receiver = Parameter(Descriptor::kReceiver);
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
Node* result = ToThisValue(context, receiver, PrimitiveType::kBoolean,
"Boolean.prototype.valueOf");
TNode<Oddball> result = CAST(ToThisValue(
context, receiver, PrimitiveType::kBoolean, "Boolean.prototype.valueOf"));
Return(result);
}

View File

@ -475,14 +475,13 @@ TNode<JSReceiver> CallOrConstructBuiltinsAssembler::GetCompatibleReceiver(
BIND(&holder_next);
{
// Continue with the hidden prototype of the {holder} if it
// has one, or throw an illegal invocation exception, since
// the receiver did not pass the {signature} check.
// Continue with the hidden prototype of the {holder} if it is a
// JSGlobalProxy (the hidden prototype can either be null or a
// JSObject in that case), or throw an illegal invocation exception,
// since the receiver did not pass the {signature} check.
TNode<Map> holder_map = LoadMap(holder);
var_holder = LoadMapPrototype(holder_map);
GotoIf(IsSetWord32(LoadMapBitField2(holder_map),
Map::HasHiddenPrototypeBit::kMask),
&holder_loop);
GotoIf(IsJSGlobalProxyMap(holder_map), &holder_loop);
ThrowTypeError(context, MessageTemplate::kIllegalInvocation);
}
}

View File

@ -8,6 +8,7 @@
#include "src/logging/counters.h"
#include "src/objects/frame-array-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/stack-frame-info.h"
namespace v8 {
namespace internal {
@ -76,6 +77,9 @@ BUILTIN(CallSitePrototypeGetFunction) {
StackFrameBase* frame = it.Frame();
if (frame->IsStrict()) return ReadOnlyRoots(isolate).undefined_value();
isolate->CountUsage(v8::Isolate::kCallSiteAPIGetFunctionSloppyCall);
return *frame->GetFunction();
}
@ -135,6 +139,9 @@ BUILTIN(CallSitePrototypeGetThis) {
StackFrameBase* frame = it.Frame();
if (frame->IsStrict()) return ReadOnlyRoots(isolate).undefined_value();
isolate->CountUsage(v8::Isolate::kCallSiteAPIGetThisSloppyCall);
return *frame->GetReceiver();
}
@ -197,9 +204,9 @@ BUILTIN(CallSitePrototypeIsToplevel) {
BUILTIN(CallSitePrototypeToString) {
HandleScope scope(isolate);
CHECK_CALLSITE(recv, "toString");
FrameArrayIterator it(isolate, GetFrameArray(isolate, recv),
GetFrameIndex(isolate, recv));
RETURN_RESULT_OR_FAILURE(isolate, it.Frame()->ToString());
Handle<StackTraceFrame> frame = isolate->factory()->NewStackTraceFrame(
GetFrameArray(isolate, recv), GetFrameIndex(isolate, recv));
RETURN_RESULT_OR_FAILURE(isolate, SerializeStackTraceFrame(isolate, frame));
}
#undef CHECK_CALLSITE

View File

@ -66,19 +66,19 @@ class BaseCollectionsAssembler : public CodeStubAssembler {
TNode<Object> iterable);
// Constructs a collection instance. Choosing a fast path when possible.
TNode<Object> AllocateJSCollection(TNode<Context> context,
TNode<JSFunction> constructor,
TNode<Object> new_target);
TNode<JSObject> AllocateJSCollection(TNode<Context> context,
TNode<JSFunction> constructor,
TNode<JSReceiver> new_target);
// Fast path for constructing a collection instance if the constructor
// function has not been modified.
TNode<Object> AllocateJSCollectionFast(TNode<HeapObject> constructor);
TNode<JSObject> AllocateJSCollectionFast(TNode<JSFunction> constructor);
// Fallback for constructing a collection instance if the constructor function
// has been modified.
TNode<Object> AllocateJSCollectionSlow(TNode<Context> context,
TNode<JSFunction> constructor,
TNode<Object> new_target);
TNode<JSObject> AllocateJSCollectionSlow(TNode<Context> context,
TNode<JSFunction> constructor,
TNode<JSReceiver> new_target);
// Allocates the backing store for a collection.
virtual TNode<Object> AllocateTable(Variant variant, TNode<Context> context,
@ -320,17 +320,17 @@ void BaseCollectionsAssembler::AddConstructorEntriesFromIterable(
CSA_ASSERT(this, Word32BinaryNot(IsUndefined(iterator.object)));
TNode<Object> fast_iterator_result_map =
LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX);
TNode<Map> fast_iterator_result_map = CAST(
LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX));
TVARIABLE(Object, var_exception);
Goto(&loop);
BIND(&loop);
{
TNode<Object> next = iterator_assembler.IteratorStep(
TNode<JSReceiver> next = iterator_assembler.IteratorStep(
context, iterator, &exit, fast_iterator_result_map);
TNode<Object> next_value = CAST(iterator_assembler.IteratorValue(
context, next, fast_iterator_result_map));
TNode<Object> next_value = iterator_assembler.IteratorValue(
context, next, fast_iterator_result_map);
AddConstructorEntry(variant, context, collection, add_func, next_value,
nullptr, &if_exception, &var_exception);
Goto(&loop);
@ -367,33 +367,33 @@ void BaseCollectionsAssembler::GotoIfInitialAddFunctionModified(
GetAddFunctionNameIndex(variant), if_modified);
}
TNode<Object> BaseCollectionsAssembler::AllocateJSCollection(
TNode<JSObject> BaseCollectionsAssembler::AllocateJSCollection(
TNode<Context> context, TNode<JSFunction> constructor,
TNode<Object> new_target) {
TNode<JSReceiver> new_target) {
TNode<BoolT> is_target_unmodified = WordEqual(constructor, new_target);
return Select<Object>(is_target_unmodified,
[=] { return AllocateJSCollectionFast(constructor); },
[=] {
return AllocateJSCollectionSlow(context, constructor,
new_target);
});
return Select<JSObject>(
is_target_unmodified,
[=] { return AllocateJSCollectionFast(constructor); },
[=] {
return AllocateJSCollectionSlow(context, constructor, new_target);
});
}
TNode<Object> BaseCollectionsAssembler::AllocateJSCollectionFast(
TNode<HeapObject> constructor) {
TNode<JSObject> BaseCollectionsAssembler::AllocateJSCollectionFast(
TNode<JSFunction> constructor) {
CSA_ASSERT(this, IsConstructorMap(LoadMap(constructor)));
TNode<Object> initial_map =
LoadObjectField(constructor, JSFunction::kPrototypeOrInitialMapOffset);
return CAST(AllocateJSObjectFromMap(initial_map));
TNode<Map> initial_map =
CAST(LoadJSFunctionPrototypeOrInitialMap(constructor));
return AllocateJSObjectFromMap(initial_map);
}
TNode<Object> BaseCollectionsAssembler::AllocateJSCollectionSlow(
TNode<JSObject> BaseCollectionsAssembler::AllocateJSCollectionSlow(
TNode<Context> context, TNode<JSFunction> constructor,
TNode<Object> new_target) {
TNode<JSReceiver> new_target) {
ConstructorBuiltinsAssembler constructor_assembler(this->state());
return CAST(constructor_assembler.EmitFastNewObject(context, constructor,
new_target));
return constructor_assembler.EmitFastNewObject(context, constructor,
new_target);
}
void BaseCollectionsAssembler::GenerateConstructor(
@ -408,7 +408,7 @@ void BaseCollectionsAssembler::GenerateConstructor(
TNode<Context> native_context = LoadNativeContext(context);
TNode<Object> collection = AllocateJSCollection(
context, GetConstructor(variant, native_context), new_target);
context, GetConstructor(variant, native_context), CAST(new_target));
AddConstructorEntries(variant, context, native_context, collection, iterable);
Return(collection);

View File

@ -39,7 +39,8 @@ namespace internal {
namespace {
void ConsoleCall(
Isolate* isolate, internal::BuiltinArguments& args,
Isolate* isolate,
internal::BuiltinArguments& args, // NOLINT(runtime/references)
void (debug::ConsoleDelegate::*func)(const v8::debug::ConsoleCallArguments&,
const v8::debug::ConsoleContext&)) {
CHECK(!isolate->has_pending_exception());

View File

@ -147,44 +147,40 @@ TF_BUILTIN(FastNewClosure, ConstructorBuiltinsAssembler) {
}
TF_BUILTIN(FastNewObject, ConstructorBuiltinsAssembler) {
Node* context = Parameter(Descriptor::kContext);
Node* target = Parameter(Descriptor::kTarget);
Node* new_target = Parameter(Descriptor::kNewTarget);
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<JSFunction> target = CAST(Parameter(Descriptor::kTarget));
TNode<JSReceiver> new_target = CAST(Parameter(Descriptor::kNewTarget));
Label call_runtime(this);
Node* result = EmitFastNewObject(context, target, new_target, &call_runtime);
TNode<JSObject> result =
EmitFastNewObject(context, target, new_target, &call_runtime);
Return(result);
BIND(&call_runtime);
TailCallRuntime(Runtime::kNewObject, context, target, new_target);
}
Node* ConstructorBuiltinsAssembler::EmitFastNewObject(Node* context,
Node* target,
Node* new_target) {
VARIABLE(var_obj, MachineRepresentation::kTagged);
compiler::TNode<JSObject> ConstructorBuiltinsAssembler::EmitFastNewObject(
SloppyTNode<Context> context, SloppyTNode<JSFunction> target,
SloppyTNode<JSReceiver> new_target) {
TVARIABLE(JSObject, var_obj);
Label call_runtime(this), end(this);
Node* result = EmitFastNewObject(context, target, new_target, &call_runtime);
var_obj.Bind(result);
var_obj = EmitFastNewObject(context, target, new_target, &call_runtime);
Goto(&end);
BIND(&call_runtime);
var_obj.Bind(CallRuntime(Runtime::kNewObject, context, target, new_target));
var_obj = CAST(CallRuntime(Runtime::kNewObject, context, target, new_target));
Goto(&end);
BIND(&end);
return var_obj.value();
}
Node* ConstructorBuiltinsAssembler::EmitFastNewObject(Node* context,
Node* target,
Node* new_target,
Label* call_runtime) {
CSA_ASSERT(this, HasInstanceType(target, JS_FUNCTION_TYPE));
CSA_ASSERT(this, IsJSReceiver(new_target));
compiler::TNode<JSObject> ConstructorBuiltinsAssembler::EmitFastNewObject(
SloppyTNode<Context> context, SloppyTNode<JSFunction> target,
SloppyTNode<JSReceiver> new_target, Label* call_runtime) {
// Verify that the new target is a JSFunction.
Label fast(this), end(this);
GotoIf(HasInstanceType(new_target, JS_FUNCTION_TYPE), &fast);
@ -732,7 +728,7 @@ TF_BUILTIN(NumberConstructor, ConstructorBuiltinsAssembler) {
TNode<JSFunction> target = LoadTargetFromFrame();
Node* result =
CallBuiltin(Builtins::kFastNewObject, context, target, new_target);
StoreObjectField(result, JSValue::kValueOffset, n_value);
StoreObjectField(result, JSPrimitiveWrapper::kValueOffset, n_value);
args.PopAndReturn(result);
}
}
@ -798,7 +794,7 @@ TF_BUILTIN(StringConstructor, ConstructorBuiltinsAssembler) {
Node* result =
CallBuiltin(Builtins::kFastNewObject, context, target, new_target);
StoreObjectField(result, JSValue::kValueOffset, s_value);
StoreObjectField(result, JSPrimitiveWrapper::kValueOffset, s_value);
args.PopAndReturn(result);
}
}

View File

@ -31,10 +31,14 @@ class ConstructorBuiltinsAssembler : public CodeStubAssembler {
Label* call_runtime);
Node* EmitCreateEmptyObjectLiteral(Node* context);
Node* EmitFastNewObject(Node* context, Node* target, Node* new_target);
TNode<JSObject> EmitFastNewObject(SloppyTNode<Context> context,
SloppyTNode<JSFunction> target,
SloppyTNode<JSReceiver> new_target);
Node* EmitFastNewObject(Node* context, Node* target, Node* new_target,
Label* call_runtime);
TNode<JSObject> EmitFastNewObject(SloppyTNode<Context> context,
SloppyTNode<JSFunction> target,
SloppyTNode<JSReceiver> new_target,
Label* call_runtime);
};
} // namespace internal

View File

@ -392,7 +392,8 @@ TF_BUILTIN(ToInteger_TruncateMinusZero, CodeStubAssembler) {
// ES6 section 7.1.13 ToObject (argument)
TF_BUILTIN(ToObject, CodeStubAssembler) {
Label if_smi(this, Label::kDeferred), if_jsreceiver(this),
if_noconstructor(this, Label::kDeferred), if_wrapjsvalue(this);
if_noconstructor(this, Label::kDeferred),
if_wrapjs_primitive_wrapper(this);
Node* context = Parameter(Descriptor::kContext);
Node* object = Parameter(Descriptor::kArgument);
@ -411,27 +412,30 @@ TF_BUILTIN(ToObject, CodeStubAssembler) {
IntPtrConstant(Map::kNoConstructorFunctionIndex)),
&if_noconstructor);
constructor_function_index_var.Bind(constructor_function_index);
Goto(&if_wrapjsvalue);
Goto(&if_wrapjs_primitive_wrapper);
BIND(&if_smi);
constructor_function_index_var.Bind(
IntPtrConstant(Context::NUMBER_FUNCTION_INDEX));
Goto(&if_wrapjsvalue);
Goto(&if_wrapjs_primitive_wrapper);
BIND(&if_wrapjsvalue);
BIND(&if_wrapjs_primitive_wrapper);
TNode<Context> native_context = LoadNativeContext(context);
Node* constructor = LoadContextElement(
native_context, constructor_function_index_var.value());
Node* initial_map =
LoadObjectField(constructor, JSFunction::kPrototypeOrInitialMapOffset);
Node* js_value = Allocate(JSValue::kSize);
StoreMapNoWriteBarrier(js_value, initial_map);
StoreObjectFieldRoot(js_value, JSValue::kPropertiesOrHashOffset,
Node* js_primitive_wrapper = Allocate(JSPrimitiveWrapper::kSize);
StoreMapNoWriteBarrier(js_primitive_wrapper, initial_map);
StoreObjectFieldRoot(js_primitive_wrapper,
JSPrimitiveWrapper::kPropertiesOrHashOffset,
RootIndex::kEmptyFixedArray);
StoreObjectFieldRoot(js_value, JSObject::kElementsOffset,
StoreObjectFieldRoot(js_primitive_wrapper,
JSPrimitiveWrapper::kElementsOffset,
RootIndex::kEmptyFixedArray);
StoreObjectField(js_value, JSValue::kValueOffset, object);
Return(js_value);
StoreObjectField(js_primitive_wrapper, JSPrimitiveWrapper::kValueOffset,
object);
Return(js_primitive_wrapper);
BIND(&if_noconstructor);
ThrowTypeError(context, MessageTemplate::kUndefinedOrNullToObject,

View File

@ -17,13 +17,13 @@ class DataViewBuiltinsAssembler : public CodeStubAssembler {
explicit DataViewBuiltinsAssembler(compiler::CodeAssemblerState* state)
: CodeStubAssembler(state) {}
TNode<Int32T> LoadUint8(TNode<RawPtrT> data_pointer, TNode<UintPtrT> offset) {
return UncheckedCast<Int32T>(
TNode<Uint8T> LoadUint8(TNode<RawPtrT> data_pointer, TNode<UintPtrT> offset) {
return UncheckedCast<Uint8T>(
Load(MachineType::Uint8(), data_pointer, offset));
}
TNode<Int32T> LoadInt8(TNode<RawPtrT> data_pointer, TNode<UintPtrT> offset) {
return UncheckedCast<Int32T>(
TNode<Int8T> LoadInt8(TNode<RawPtrT> data_pointer, TNode<UintPtrT> offset) {
return UncheckedCast<Int8T>(
Load(MachineType::Int8(), data_pointer, offset));
}

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