diff --git a/deps/v8/.gitignore b/deps/v8/.gitignore index ac9b0bd9ac59c4..de0a8c96dff485 100644 --- a/deps/v8/.gitignore +++ b/deps/v8/.gitignore @@ -85,12 +85,13 @@ shell_g /tools/luci-go/linux64/isolate /tools/luci-go/mac64/isolate /tools/luci-go/win64/isolate.exe -/tools/mb /tools/oom_dump/oom_dump /tools/oom_dump/oom_dump.o /tools/swarming_client /tools/visual_studio/Debug /tools/visual_studio/Release +/test/fuzzer/wasm +/test/fuzzer/wasm_asmjs /v8.log.ll /xcodebuild TAGS @@ -105,3 +106,5 @@ turbo*.cfg turbo*.dot turbo*.json v8.ignition_dispatches_table.json +/test/fuzzer/wasm.tar.gz +/test/fuzzer/wasm_asmjs.tar.gz diff --git a/deps/v8/.gn b/deps/v8/.gn index a1c0ff8dceba56..aee1752d4be65e 100644 --- a/deps/v8/.gn +++ b/deps/v8/.gn @@ -14,8 +14,7 @@ secondary_source = "//build/secondary/" # matching these patterns (see "gn help label_pattern" for format) will have # their includes checked for proper dependencies when you run either # "gn check" or "gn gen --check". -check_targets = [ -] +check_targets = [] # These are the list of GN files that run exec_script. This whitelist exists # to force additional review for new uses of exec_script, which is strongly @@ -45,7 +44,5 @@ exec_script_whitelist = [ "//build/toolchain/win/BUILD.gn", "//build/util/branding.gni", "//build/util/version.gni", - "//test/cctest/BUILD.gn", "//test/test262/BUILD.gn", - "//test/unittests/BUILD.gn", ] diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index d70be77d86dccc..02562eff766b15 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -63,6 +63,7 @@ Felix Geisendörfer Filipe David Manana Franziska Hinkelmann Geoffrey Garside +Gwang Yoon Hwang Han Choongwoo Hirofumi Mako Honggyu Kim @@ -95,9 +96,11 @@ Mike Pennisi Milton Chiang Myeong-bo Shim Nicolas Antonius Ernst Leopold Maria Kaiser +Noj Vek Oleksandr Chekhovskyi Paolo Giarrusso Patrick Gansterer +Peter Rybin Peter Varga Paul Lind Rafal Krypa diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index 94eb3897481602..e26d14e6fe2fd1 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -62,6 +62,9 @@ declare_args() { # tools/gen-postmortem-metadata.py for details. v8_postmortem_support = false + # Switches off inlining in V8. + v8_no_inline = false + # Similar to vfp but on MIPS. v8_can_use_fpu_instructions = true @@ -94,6 +97,11 @@ if (v8_enable_disassembler == "") { v8_enable_disassembler = is_debug && !v8_optimized_debug } +# Specifies if the target build is a simulator build. Comparing target cpu +# with v8 target cpu to not affect simulator builds for making cross-compile +# snapshots. +is_target_simulator = target_cpu != v8_target_cpu + v8_generated_peephole_source = "$target_gen_dir/bytecode-peephole-table.cc" v8_random_seed = "314159265" v8_toolset_for_shell = "host" @@ -140,6 +148,9 @@ config("external_config") { ] } include_dirs = [ "include" ] + if (v8_enable_inspector_override) { + include_dirs += [ "$target_gen_dir/include" ] + } libs = [] if (is_android && current_toolchain != host_toolchain) { libs += [ "log" ] @@ -200,7 +211,7 @@ config("toolchain") { if (v8_current_cpu == "arm") { defines += [ "V8_TARGET_ARCH_ARM" ] - if (arm_version == 7) { + if (arm_version >= 7) { defines += [ "CAN_USE_ARMV7_INSTRUCTIONS" ] } if (arm_fpu == "vfpv3-d16") { @@ -233,6 +244,12 @@ config("toolchain") { defines += [ "V8_TARGET_ARCH_ARM64" ] } + # Mips64el/mipsel simulators. + if (is_target_simulator && + (v8_current_cpu == "mipsel" || v8_current_cpu == "mips64el")) { + defines += [ "_MIPS_TARGET_SIMULATOR" ] + } + # TODO(jochen): Add support for mips. if (v8_current_cpu == "mipsel") { defines += [ "V8_TARGET_ARCH_MIPS" ] @@ -343,6 +360,13 @@ config("toolchain") { } else if (dcheck_always_on) { defines += [ "DEBUG" ] } + + if (v8_no_inline) { + cflags += [ + "-fno-inline-functions", + "-fno-inline", + ] + } } ############################################################################### @@ -439,8 +463,8 @@ action("js2c_experimental") { if (v8_enable_i18n_support) { sources += [ + "src/js/datetime-format-to-parts.js", "src/js/icu-case-mapping.js", - "src/js/intl-extra.js", ] } @@ -857,10 +881,14 @@ v8_source_set("v8_base") { "src/ast/ast-numbering.h", "src/ast/ast-traversal-visitor.h", "src/ast/ast-type-bounds.h", + "src/ast/ast-types.cc", + "src/ast/ast-types.h", "src/ast/ast-value-factory.cc", "src/ast/ast-value-factory.h", "src/ast/ast.cc", "src/ast/ast.h", + "src/ast/compile-time-value.cc", + "src/ast/compile-time-value.h", "src/ast/context-slot-cache.cc", "src/ast/context-slot-cache.h", "src/ast/modules.cc", @@ -868,7 +896,6 @@ v8_source_set("v8_base") { "src/ast/prettyprinter.cc", "src/ast/prettyprinter.h", "src/ast/scopeinfo.cc", - "src/ast/scopeinfo.h", "src/ast/scopes.cc", "src/ast/scopes.h", "src/ast/variables.cc", @@ -940,6 +967,8 @@ v8_source_set("v8_base") { "src/compilation-cache.h", "src/compilation-dependencies.cc", "src/compilation-dependencies.h", + "src/compilation-info.cc", + "src/compilation-info.h", "src/compilation-statistics.cc", "src/compilation-statistics.h", "src/compiler-dispatcher/compiler-dispatcher-job.cc", @@ -1132,12 +1161,18 @@ v8_source_set("v8_base") { "src/compiler/store-store-elimination.h", "src/compiler/tail-call-optimization.cc", "src/compiler/tail-call-optimization.h", + "src/compiler/type-cache.cc", + "src/compiler/type-cache.h", "src/compiler/type-hint-analyzer.cc", "src/compiler/type-hint-analyzer.h", "src/compiler/type-hints.cc", "src/compiler/type-hints.h", + "src/compiler/typed-optimization.cc", + "src/compiler/typed-optimization.h", "src/compiler/typer.cc", "src/compiler/typer.h", + "src/compiler/types.cc", + "src/compiler/types.h", "src/compiler/unwinding-info-writer.h", "src/compiler/value-numbering-reducer.cc", "src/compiler/value-numbering-reducer.h", @@ -1216,6 +1251,7 @@ v8_source_set("v8_base") { "src/crankshaft/lithium-allocator.h", "src/crankshaft/lithium-codegen.cc", "src/crankshaft/lithium-codegen.h", + "src/crankshaft/lithium-inl.h", "src/crankshaft/lithium.cc", "src/crankshaft/lithium.h", "src/crankshaft/typing.cc", @@ -1314,6 +1350,7 @@ v8_source_set("v8_base") { "src/heap/heap-inl.h", "src/heap/heap.cc", "src/heap/heap.h", + "src/heap/incremental-marking-inl.h", "src/heap/incremental-marking-job.cc", "src/heap/incremental-marking-job.h", "src/heap/incremental-marking.cc", @@ -1351,6 +1388,7 @@ v8_source_set("v8_base") { "src/ic/call-optimization.h", "src/ic/handler-compiler.cc", "src/ic/handler-compiler.h", + "src/ic/handler-configuration.h", "src/ic/ic-compiler.cc", "src/ic/ic-compiler.h", "src/ic/ic-inl.h", @@ -1422,11 +1460,16 @@ v8_source_set("v8_base") { "src/layout-descriptor.h", "src/list-inl.h", "src/list.h", + "src/locked-queue-inl.h", + "src/locked-queue.h", "src/log-inl.h", "src/log-utils.cc", "src/log-utils.h", "src/log.cc", "src/log.h", + "src/lookup-cache-inl.h", + "src/lookup-cache.cc", + "src/lookup-cache.h", "src/lookup.cc", "src/lookup.h", "src/machine-type.cc", @@ -1444,6 +1487,8 @@ v8_source_set("v8_base") { "src/objects.h", "src/ostreams.cc", "src/ostreams.h", + "src/parsing/duplicate-finder.cc", + "src/parsing/duplicate-finder.h", "src/parsing/expression-classifier.h", "src/parsing/func-name-inferrer.cc", "src/parsing/func-name-inferrer.h", @@ -1601,15 +1646,11 @@ v8_source_set("v8_base") { "src/transitions-inl.h", "src/transitions.cc", "src/transitions.h", - "src/type-cache.cc", - "src/type-cache.h", "src/type-feedback-vector-inl.h", "src/type-feedback-vector.cc", "src/type-feedback-vector.h", "src/type-info.cc", "src/type-info.h", - "src/types.cc", - "src/types.h", "src/unicode-cache-inl.h", "src/unicode-cache.h", "src/unicode-decoder.cc", @@ -1629,6 +1670,7 @@ v8_source_set("v8_base") { "src/v8threads.h", "src/value-serializer.cc", "src/value-serializer.h", + "src/vector.h", "src/version.cc", "src/version.h", "src/vm-state-inl.h", @@ -1696,6 +1738,8 @@ v8_source_set("v8_base") { "src/ia32/interface-descriptors-ia32.cc", "src/ia32/macro-assembler-ia32.cc", "src/ia32/macro-assembler-ia32.h", + "src/ia32/simulator-ia32.cc", + "src/ia32/simulator-ia32.h", "src/ic/ia32/access-compiler-ia32.cc", "src/ic/ia32/handler-compiler-ia32.cc", "src/ic/ia32/ic-compiler-ia32.cc", @@ -1744,6 +1788,9 @@ v8_source_set("v8_base") { "src/x64/interface-descriptors-x64.cc", "src/x64/macro-assembler-x64.cc", "src/x64/macro-assembler-x64.h", + "src/x64/simulator-x64.cc", + "src/x64/simulator-x64.h", + "src/x64/sse-instr.h", ] } else if (v8_current_cpu == "arm") { sources += [ @@ -2010,6 +2057,10 @@ v8_source_set("v8_base") { sources += [ "$target_gen_dir/debug-support.cc" ] deps += [ ":postmortem-metadata" ] } + + if (v8_enable_inspector_override) { + deps += [ "src/inspector:inspector" ] + } } v8_source_set("v8_libbase") { @@ -2035,6 +2086,7 @@ v8_source_set("v8_libbase") { "src/base/bits.cc", "src/base/bits.h", "src/base/build_config.h", + "src/base/compiler-specific.h", "src/base/cpu.cc", "src/base/cpu.h", "src/base/debug/stack_trace.cc", @@ -2552,6 +2604,15 @@ v8_source_set("regexp_fuzzer") { v8_fuzzer("regexp_fuzzer") { } +v8_source_set("wasm_module_runner") { + sources = [ + "test/common/wasm/wasm-module-runner.cc", + "test/common/wasm/wasm-module-runner.h", + ] + + configs = [ ":internal_config" ] +} + v8_source_set("wasm_fuzzer") { sources = [ "test/fuzzer/wasm.cc", @@ -2559,6 +2620,7 @@ v8_source_set("wasm_fuzzer") { deps = [ ":fuzzer_support", + ":wasm_module_runner", ] configs = [ ":internal_config" ] @@ -2574,6 +2636,7 @@ v8_source_set("wasm_asmjs_fuzzer") { deps = [ ":fuzzer_support", + ":wasm_module_runner", ] configs = [ ":internal_config" ] @@ -2581,3 +2644,147 @@ v8_source_set("wasm_asmjs_fuzzer") { v8_fuzzer("wasm_asmjs_fuzzer") { } + +v8_source_set("wasm_code_fuzzer") { + sources = [ + "test/fuzzer/wasm-code.cc", + ] + + deps = [ + ":fuzzer_support", + ":wasm_module_runner", + ] + + configs = [ ":internal_config" ] +} + +v8_fuzzer("wasm_code_fuzzer") { +} + +v8_source_set("lib_wasm_section_fuzzer") { + sources = [ + "test/fuzzer/wasm-section-fuzzers.cc", + "test/fuzzer/wasm-section-fuzzers.h", + ] + + configs = [ ":internal_config" ] +} + +v8_source_set("wasm_types_section_fuzzer") { + sources = [ + "test/fuzzer/wasm-types-section.cc", + ] + + deps = [ + ":fuzzer_support", + ":lib_wasm_section_fuzzer", + ":wasm_module_runner", + ] + + configs = [ ":internal_config" ] +} + +v8_fuzzer("wasm_types_section_fuzzer") { +} + +v8_source_set("wasm_names_section_fuzzer") { + sources = [ + "test/fuzzer/wasm-names-section.cc", + ] + + deps = [ + ":fuzzer_support", + ":lib_wasm_section_fuzzer", + ":wasm_module_runner", + ] + + configs = [ ":internal_config" ] +} + +v8_fuzzer("wasm_names_section_fuzzer") { +} + +v8_source_set("wasm_globals_section_fuzzer") { + sources = [ + "test/fuzzer/wasm-globals-section.cc", + ] + + deps = [ + ":fuzzer_support", + ":lib_wasm_section_fuzzer", + ":wasm_module_runner", + ] + + configs = [ ":internal_config" ] +} + +v8_fuzzer("wasm_globals_section_fuzzer") { +} + +v8_source_set("wasm_imports_section_fuzzer") { + sources = [ + "test/fuzzer/wasm-imports-section.cc", + ] + + deps = [ + ":fuzzer_support", + ":lib_wasm_section_fuzzer", + ":wasm_module_runner", + ] + + configs = [ ":internal_config" ] +} + +v8_fuzzer("wasm_imports_section_fuzzer") { +} + +v8_source_set("wasm_function_sigs_section_fuzzer") { + sources = [ + "test/fuzzer/wasm-function-sigs-section.cc", + ] + + deps = [ + ":fuzzer_support", + ":lib_wasm_section_fuzzer", + ":wasm_module_runner", + ] + + configs = [ ":internal_config" ] +} + +v8_fuzzer("wasm_function_sigs_section_fuzzer") { +} + +v8_source_set("wasm_memory_section_fuzzer") { + sources = [ + "test/fuzzer/wasm-memory-section.cc", + ] + + deps = [ + ":fuzzer_support", + ":lib_wasm_section_fuzzer", + ":wasm_module_runner", + ] + + configs = [ ":internal_config" ] +} + +v8_fuzzer("wasm_memory_section_fuzzer") { +} + +v8_source_set("wasm_data_section_fuzzer") { + sources = [ + "test/fuzzer/wasm-data-section.cc", + ] + + deps = [ + ":fuzzer_support", + ":lib_wasm_section_fuzzer", + ":wasm_module_runner", + ] + + configs = [ ":internal_config" ] +} + +v8_fuzzer("wasm_data_section_fuzzer") { +} diff --git a/deps/v8/DEPS b/deps/v8/DEPS index 6cac01d5974c44..30be5b9bb7a1da 100644 --- a/deps/v8/DEPS +++ b/deps/v8/DEPS @@ -8,27 +8,25 @@ vars = { deps = { "v8/build": - Var("git_url") + "/chromium/src/build.git" + "@" + "59daf502c36f20b5c9292f4bd9af85791f8a5884", + Var("git_url") + "/chromium/src/build.git" + "@" + "3f47a5e106127ae4e2567d64c615dc706054c819", "v8/tools/gyp": Var("git_url") + "/external/gyp.git" + "@" + "702ac58e477214c635d9b541932e75a95d349352", "v8/third_party/icu": - Var("git_url") + "/chromium/deps/icu.git" + "@" + "2341038bf72869a5683a893a2b319a48ffec7f62", + Var("git_url") + "/chromium/deps/icu.git" + "@" + "b0bd3ee50bc2e768d7a17cbc60d87f517f024dbe", "v8/third_party/instrumented_libraries": - Var("git_url") + "/chromium/src/third_party/instrumented_libraries.git" + "@" + "f15768d7fdf68c0748d20738184120c8ab2e6db7", + Var("git_url") + "/chromium/src/third_party/instrumented_libraries.git" + "@" + "45f5814b1543e41ea0be54c771e3840ea52cca4a", "v8/buildtools": - Var("git_url") + "/chromium/buildtools.git" + "@" + "adb8bf4e8fc92aa1717bf151b862d58e6f27c4f2", + Var("git_url") + "/chromium/buildtools.git" + "@" + "b97d6c93a3e805c9ba5356dca872f1801639fbc5", "v8/base/trace_event/common": - Var("git_url") + "/chromium/src/base/trace_event/common.git" + "@" + "315bf1e2d45be7d53346c31cfcc37424a32c30c8", + Var("git_url") + "/chromium/src/base/trace_event/common.git" + "@" + "26eac53e73b09625e9b8f783b479e54fcae85f58", "v8/third_party/WebKit/Source/platform/inspector_protocol": - Var("git_url") + "/chromium/src/third_party/WebKit/Source/platform/inspector_protocol.git" + "@" + "547960151fb364dd9a382fa79ffc9abfb184e3d1", + Var("git_url") + "/chromium/src/third_party/WebKit/Source/platform/inspector_protocol.git" + "@" + "e240fdcdb5880deb48156dbb9ccee0c28664cf88", "v8/third_party/jinja2": - Var("git_url") + "/chromium/src/third_party/jinja2.git" + "@" + "2222b31554f03e62600cd7e383376a7c187967a1", + Var("git_url") + "/chromium/src/third_party/jinja2.git" + "@" + "b61a2c009a579593a259c1b300e0ad02bf48fd78", "v8/third_party/markupsafe": Var("git_url") + "/chromium/src/third_party/markupsafe.git" + "@" + "484a5661041cac13bfc688a26ec5434b05d18961", - "v8/tools/mb": - Var('git_url') + '/chromium/src/tools/mb.git' + '@' + "99788b8b516c44d7db25cfb68695bc234fdee5ed", "v8/tools/swarming_client": - Var('git_url') + '/external/swarming.client.git' + '@' + "e4288c3040a32f2e7ad92f957668f2ee3d36e5a6", + Var('git_url') + '/external/swarming.client.git' + '@' + "380e32662312eb107f06fcba6409b0409f8fef72", "v8/testing/gtest": Var("git_url") + "/external/github.com/google/googletest.git" + "@" + "6f8a66431cb592dad629028a50b3dd418a408c87", "v8/testing/gmock": @@ -39,17 +37,17 @@ deps = { Var("git_url") + "/v8/deps/third_party/mozilla-tests.git" + "@" + "f6c578a10ea707b1a8ab0b88943fe5115ce2b9be", "v8/test/simdjs/data": Var("git_url") + "/external/github.com/tc39/ecmascript_simd.git" + "@" + "baf493985cb9ea7cdbd0d68704860a8156de9556", "v8/test/test262/data": - Var("git_url") + "/external/github.com/tc39/test262.git" + "@" + "88bc7fe7586f161201c5f14f55c9c489f82b1b67", + Var("git_url") + "/external/github.com/tc39/test262.git" + "@" + "29c23844494a7cc2fbebc6948d2cb0bcaddb24e7", "v8/test/test262/harness": Var("git_url") + "/external/github.com/test262-utils/test262-harness-py.git" + "@" + "cbd968f54f7a95c6556d53ba852292a4c49d11d8", "v8/tools/clang": - Var("git_url") + "/chromium/src/tools/clang.git" + "@" + "3afb04a8153e40ff00f9eaa14337851c3ab4a368", + Var("git_url") + "/chromium/src/tools/clang.git" + "@" + "bd7e80b254a93d0a5cd8ecb994e47b1c827e253c", } deps_os = { "android": { "v8/third_party/android_tools": - Var("git_url") + "/android_tools.git" + "@" + "af1c5a4cd6329ccdcf8c2bc93d9eea02f9d74869", + Var("git_url") + "/android_tools.git" + "@" + "25d57ead05d3dfef26e9c19b13ed10b0a69829cf", }, "win": { "v8/third_party/cygwin": @@ -203,6 +201,28 @@ hooks = [ "-s", "v8/buildtools/linux64/gn.sha1", ], }, + { + "name": "wasm_fuzzer", + "pattern": ".", + "action": [ "download_from_google_storage", + "--no_resume", + "--no_auth", + "-u", + "--bucket", "v8-wasm-fuzzer", + "-s", "v8/test/fuzzer/wasm.tar.gz.sha1", + ], + }, + { + "name": "wasm_asmjs_fuzzer", + "pattern": ".", + "action": [ "download_from_google_storage", + "--no_resume", + "--no_auth", + "-u", + "--bucket", "v8-wasm-asmjs-fuzzer", + "-s", "v8/test/fuzzer/wasm_asmjs.tar.gz.sha1", + ], + }, { # Downloads the current stable linux sysroot to build/linux/ if needed. # This sysroot updates at about the same rate that the chrome build deps @@ -259,6 +279,6 @@ hooks = [ { # A change to a .gyp, .gypi, or to GYP itself should run the generator. "pattern": ".", - "action": ["python", "v8/gypfiles/gyp_v8"], + "action": ["python", "v8/gypfiles/gyp_v8", "--running-as-hook"], }, ] diff --git a/deps/v8/OWNERS b/deps/v8/OWNERS index 26701eef59b1b3..028f4ff12c5c89 100644 --- a/deps/v8/OWNERS +++ b/deps/v8/OWNERS @@ -22,7 +22,6 @@ mtrofin@chromium.org mvstanton@chromium.org mythria@chromium.org neis@chromium.org -oth@chromium.org rmcilroy@chromium.org rossberg@chromium.org titzer@chromium.org diff --git a/deps/v8/WATCHLISTS b/deps/v8/WATCHLISTS index 4c6b4fa4a08718..40ce3d865dc2a0 100644 --- a/deps/v8/WATCHLISTS +++ b/deps/v8/WATCHLISTS @@ -74,7 +74,6 @@ ], 'interpreter': [ 'rmcilroy@chromium.org', - 'oth@chromium.org', ], 'feature_shipping_status': [ 'hablich@chromium.org', diff --git a/deps/v8/base/trace_event/common/trace_event_common.h b/deps/v8/base/trace_event/common/trace_event_common.h index 0c16e7b72382d3..21ac61ecd5293e 100644 --- a/deps/v8/base/trace_event/common/trace_event_common.h +++ b/deps/v8/base/trace_event/common/trace_event_common.h @@ -774,16 +774,19 @@ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) // Records a single NESTABLE_ASYNC_INSTANT event called "name" immediately, -// with one associated argument. If the category is not enabled, then this -// does nothing. +// with none, one or two associated argument. If the category is not enabled, +// then this does nothing. +#define TRACE_EVENT_NESTABLE_ASYNC_INSTANT0(category_group, name, id) \ + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, \ + category_group, name, id, \ + TRACE_EVENT_FLAG_NONE) + #define TRACE_EVENT_NESTABLE_ASYNC_INSTANT1(category_group, name, id, \ arg1_name, arg1_val) \ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, \ category_group, name, id, \ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -// Records a single NESTABLE_ASYNC_INSTANT event called "name" immediately, -// with 2 associated arguments. If the category is not enabled, then this -// does nothing. + #define TRACE_EVENT_NESTABLE_ASYNC_INSTANT2( \ category_group, name, id, arg1_name, arg1_val, arg2_name, arg2_val) \ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ @@ -828,15 +831,6 @@ TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_COPY) -// Records a single NESTABLE_ASYNC_INSTANT event called "name" immediately, -// with 2 associated arguments. If the category is not enabled, then this -// does nothing. -#define TRACE_EVENT_NESTABLE_ASYNC_INSTANT2( \ - category_group, name, id, arg1_name, arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) - // Records a single FLOW_BEGIN event called "name" immediately, with 0, 1 or 2 // associated arguments. If the category is not enabled, then this // does nothing. diff --git a/deps/v8/build_overrides/build.gni b/deps/v8/build_overrides/build.gni index da6d3e0ded6e6e..6b8a4ff21921a1 100644 --- a/deps/v8/build_overrides/build.gni +++ b/deps/v8/build_overrides/build.gni @@ -16,3 +16,11 @@ build_with_chromium = false # Some non-Chromium builds don't support building java targets. enable_java_templates = false + +# Some non-Chromium builds don't use Chromium's third_party/binutils. +linux_use_bundled_binutils_override = true + +# Allows different projects to specify their own suppressions files. +asan_suppressions_file = "//build/sanitizers/asan_suppressions.cc" +lsan_suppressions_file = "//build/sanitizers/lsan_suppressions.cc" +tsan_suppressions_file = "//build/sanitizers/tsan_suppressions.cc" diff --git a/deps/v8/build_overrides/v8.gni b/deps/v8/build_overrides/v8.gni index fc4a70e579b78d..09ea4570b02032 100644 --- a/deps/v8/build_overrides/v8.gni +++ b/deps/v8/build_overrides/v8.gni @@ -11,10 +11,8 @@ if (is_android) { import("//build/config/android/config.gni") } -if (((v8_current_cpu == "x86" || - v8_current_cpu == "x64" || - v8_current_cpu=="x87") && - (is_linux || is_mac)) || +if (((v8_current_cpu == "x86" || v8_current_cpu == "x64" || + v8_current_cpu == "x87") && (is_linux || is_mac)) || (v8_current_cpu == "ppc64" && is_linux)) { v8_enable_gdbjit_default = true } @@ -23,4 +21,12 @@ v8_imminent_deprecation_warnings_default = true # Add simple extras solely for the purpose of the cctests. v8_extra_library_files = [ "//test/cctest/test-extra.js" ] -v8_experimental_extra_library_files = [ "//test/cctest/test-experimental-extra.js" ] +v8_experimental_extra_library_files = + [ "//test/cctest/test-experimental-extra.js" ] + +declare_args() { + # Enable inspector. See include/v8-inspector.h. + v8_enable_inspector = false +} + +v8_enable_inspector_override = v8_enable_inspector diff --git a/deps/v8/gypfiles/config/win/msvs_dependencies.isolate b/deps/v8/gypfiles/config/win/msvs_dependencies.isolate deleted file mode 100644 index ff922273634a9f..00000000000000 --- a/deps/v8/gypfiles/config/win/msvs_dependencies.isolate +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2015 the V8 project authors. All rights reserved. -# Copyright 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -{ - 'conditions': [ - # Copy the VS runtime DLLs into the isolate so that they - # don't have to be preinstalled on the target machine. - # - # VS2013 runtimes - ['OS=="win" and msvs_version==2013 and component=="shared_library" and CONFIGURATION_NAME=="Debug"', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/x64/msvcp120d.dll', - '<(PRODUCT_DIR)/x64/msvcr120d.dll', - ], - }, - }], - ['OS=="win" and msvs_version==2013 and component=="shared_library" and CONFIGURATION_NAME=="Release"', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/x64/msvcp120.dll', - '<(PRODUCT_DIR)/x64/msvcr120.dll', - ], - }, - }], - ['OS=="win" and msvs_version==2013 and component=="shared_library" and (CONFIGURATION_NAME=="Debug" or CONFIGURATION_NAME=="Debug_x64")', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/msvcp120d.dll', - '<(PRODUCT_DIR)/msvcr120d.dll', - ], - }, - }], - ['OS=="win" and msvs_version==2013 and component=="shared_library" and (CONFIGURATION_NAME=="Release" or CONFIGURATION_NAME=="Release_x64")', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/msvcp120.dll', - '<(PRODUCT_DIR)/msvcr120.dll', - ], - }, - }], - # VS2015 runtimes - ['OS=="win" and msvs_version==2015 and component=="shared_library" and CONFIGURATION_NAME=="Debug"', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/x64/msvcp140d.dll', - '<(PRODUCT_DIR)/x64/vccorlib140d.dll', - ], - }, - }], - ['OS=="win" and msvs_version==2015 and component=="shared_library" and CONFIGURATION_NAME=="Release"', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/x64/msvcp140.dll', - '<(PRODUCT_DIR)/x64/vccorlib140.dll', - ], - }, - }], - ['OS=="win" and msvs_version==2015 and component=="shared_library" and (CONFIGURATION_NAME=="Debug" or CONFIGURATION_NAME=="Debug_x64")', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/msvcp140d.dll', - '<(PRODUCT_DIR)/vccorlib140d.dll', - ], - }, - }], - ['OS=="win" and msvs_version==2015 and component=="shared_library" and (CONFIGURATION_NAME=="Release" or CONFIGURATION_NAME=="Release_x64")', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/msvcp140.dll', - '<(PRODUCT_DIR)/vccorlib140.dll', - ], - }, - }], - ], -} \ No newline at end of file diff --git a/deps/v8/gypfiles/gyp_v8 b/deps/v8/gypfiles/gyp_v8 index 8be39d961536f1..b8b5f742b1e27d 100755 --- a/deps/v8/gypfiles/gyp_v8 +++ b/deps/v8/gypfiles/gyp_v8 @@ -118,10 +118,22 @@ def run_gyp(args): if __name__ == '__main__': args = sys.argv[1:] - if int(os.environ.get('GYP_CHROMIUM_NO_ACTION', 0)): + gyp_chromium_no_action = os.environ.get('GYP_CHROMIUM_NO_ACTION') + if gyp_chromium_no_action == '1': print 'Skipping gyp_v8 due to GYP_CHROMIUM_NO_ACTION env var.' sys.exit(0) + running_as_hook = '--running-as-hook' + if running_as_hook in args and gyp_chromium_no_action != '0': + print 'GYP is now disabled by default in runhooks.\n' + print 'If you really want to run this, either run ' + print '`python gypfiles/gyp_v8` explicitly by hand ' + print 'or set the environment variable GYP_CHROMIUM_NO_ACTION=0.' + sys.exit(0) + + if running_as_hook in args: + args.remove(running_as_hook) + gyp_environment.set_environment() # This could give false positives since it doesn't actually do real option diff --git a/deps/v8/gypfiles/standalone.gypi b/deps/v8/gypfiles/standalone.gypi index 6599bb83512173..7e41ce84aef96d 100644 --- a/deps/v8/gypfiles/standalone.gypi +++ b/deps/v8/gypfiles/standalone.gypi @@ -46,6 +46,7 @@ 'msvs_multi_core_compile%': '1', 'mac_deployment_target%': '10.7', 'release_extra_cflags%': '', + 'v8_enable_inspector%': 0, 'variables': { 'variables': { 'variables': { @@ -319,7 +320,7 @@ 'android_ndk_root%': '<(base_dir)/third_party/android_tools/ndk/', 'android_host_arch%': " +#include + +#include + +#include "v8.h" // NOLINT(build/include) + +namespace v8_inspector { + +namespace protocol { +namespace Debugger { +namespace API { +class SearchMatch; +} +} +namespace Runtime { +namespace API { +class RemoteObject; +class StackTrace; +} +} +namespace Schema { +namespace API { +class Domain; +} +} +} // namespace protocol + +class V8_EXPORT StringView { + public: + StringView() : m_is8Bit(true), m_length(0), m_characters8(nullptr) {} + + StringView(const uint8_t* characters, unsigned length) + : m_is8Bit(true), m_length(length), m_characters8(characters) {} + + StringView(const uint16_t* characters, unsigned length) + : m_is8Bit(false), m_length(length), m_characters16(characters) {} + + bool is8Bit() const { return m_is8Bit; } + unsigned length() const { return m_length; } + + // TODO(dgozman): add DCHECK(m_is8Bit) to accessors once platform can be used + // here. + const uint8_t* characters8() const { return m_characters8; } + const uint16_t* characters16() const { return m_characters16; } + + private: + bool m_is8Bit; + unsigned m_length; + union { + const uint8_t* m_characters8; + const uint16_t* m_characters16; + }; +}; + +class V8_EXPORT StringBuffer { + public: + virtual ~StringBuffer() {} + virtual const StringView& string() = 0; + // This method copies contents. + static std::unique_ptr create(const StringView&); +}; + +class V8_EXPORT V8ContextInfo { + public: + V8ContextInfo(v8::Local context, int contextGroupId, + const StringView& humanReadableName) + : context(context), + contextGroupId(contextGroupId), + humanReadableName(humanReadableName), + hasMemoryOnConsole(false) {} + + v8::Local context; + // Each v8::Context is a part of a group. The group id must be non-zero. + int contextGroupId; + StringView humanReadableName; + StringView origin; + StringView auxData; + bool hasMemoryOnConsole; + + private: + // Disallow copying and allocating this one. + enum NotNullTagEnum { NotNullLiteral }; + void* operator new(size_t) = delete; + void* operator new(size_t, NotNullTagEnum, void*) = delete; + void* operator new(size_t, void*) = delete; + V8ContextInfo(const V8ContextInfo&) = delete; + V8ContextInfo& operator=(const V8ContextInfo&) = delete; +}; + +class V8_EXPORT V8StackTrace { + public: + virtual bool isEmpty() const = 0; + virtual StringView topSourceURL() const = 0; + virtual int topLineNumber() const = 0; + virtual int topColumnNumber() const = 0; + virtual StringView topScriptId() const = 0; + virtual StringView topFunctionName() const = 0; + + virtual ~V8StackTrace() {} + virtual std::unique_ptr + buildInspectorObject() const = 0; + virtual std::unique_ptr toString() const = 0; + + // Safe to pass between threads, drops async chain. + virtual std::unique_ptr clone() = 0; +}; + +class V8_EXPORT V8InspectorSession { + public: + virtual ~V8InspectorSession() {} + + // Cross-context inspectable values (DOM nodes in different worlds, etc.). + class V8_EXPORT Inspectable { + public: + virtual v8::Local get(v8::Local) = 0; + virtual ~Inspectable() {} + }; + virtual void addInspectedObject(std::unique_ptr) = 0; + + // Dispatching protocol messages. + static bool canDispatchMethod(const StringView& method); + virtual void dispatchProtocolMessage(const StringView& message) = 0; + virtual std::unique_ptr stateJSON() = 0; + virtual std::vector> + supportedDomains() = 0; + + // Debugger actions. + virtual void schedulePauseOnNextStatement(const StringView& breakReason, + const StringView& breakDetails) = 0; + virtual void cancelPauseOnNextStatement() = 0; + virtual void breakProgram(const StringView& breakReason, + const StringView& breakDetails) = 0; + virtual void setSkipAllPauses(bool) = 0; + virtual void resume() = 0; + virtual void stepOver() = 0; + virtual std::vector> + searchInTextByLines(const StringView& text, const StringView& query, + bool caseSensitive, bool isRegex) = 0; + + // Remote objects. + virtual std::unique_ptr wrapObject( + v8::Local, v8::Local, + const StringView& groupName) = 0; + virtual bool unwrapObject(std::unique_ptr* error, + const StringView& objectId, v8::Local*, + v8::Local*, + std::unique_ptr* objectGroup) = 0; + virtual void releaseObjectGroup(const StringView&) = 0; +}; + +enum class V8ConsoleAPIType { kClear, kDebug, kLog, kInfo, kWarning, kError }; + +class V8_EXPORT V8InspectorClient { + public: + virtual ~V8InspectorClient() {} + + virtual void runMessageLoopOnPause(int contextGroupId) {} + virtual void quitMessageLoopOnPause() {} + virtual void runIfWaitingForDebugger(int contextGroupId) {} + + virtual void muteMetrics(int contextGroupId) {} + virtual void unmuteMetrics(int contextGroupId) {} + + virtual void beginUserGesture() {} + virtual void endUserGesture() {} + + virtual std::unique_ptr valueSubtype(v8::Local) { + return nullptr; + } + virtual bool formatAccessorsAsProperties(v8::Local) { + return false; + } + virtual bool isInspectableHeapObject(v8::Local) { return true; } + + virtual v8::Local ensureDefaultContextInGroup( + int contextGroupId) { + return v8::Local(); + } + virtual void beginEnsureAllContextsInGroup(int contextGroupId) {} + virtual void endEnsureAllContextsInGroup(int contextGroupId) {} + + virtual void installAdditionalCommandLineAPI(v8::Local, + v8::Local) {} + virtual void consoleAPIMessage(int contextGroupId, V8ConsoleAPIType, + const StringView& message, + const StringView& url, unsigned lineNumber, + unsigned columnNumber, V8StackTrace*) {} + virtual v8::MaybeLocal memoryInfo(v8::Isolate*, + v8::Local) { + return v8::MaybeLocal(); + } + + virtual void consoleTime(const StringView& title) {} + virtual void consoleTimeEnd(const StringView& title) {} + virtual void consoleTimeStamp(const StringView& title) {} + virtual double currentTimeMS() { return 0; } + typedef void (*TimerCallback)(void*); + virtual void startRepeatingTimer(double, TimerCallback, void* data) {} + virtual void cancelTimer(void* data) {} + + // TODO(dgozman): this was added to support service worker shadow page. We + // should not connect at all. + virtual bool canExecuteScripts(int contextGroupId) { return true; } +}; + +class V8_EXPORT V8Inspector { + public: + static std::unique_ptr create(v8::Isolate*, V8InspectorClient*); + virtual ~V8Inspector() {} + + // Contexts instrumentation. + virtual void contextCreated(const V8ContextInfo&) = 0; + virtual void contextDestroyed(v8::Local) = 0; + virtual void resetContextGroup(int contextGroupId) = 0; + + // Various instrumentation. + virtual void willExecuteScript(v8::Local, int scriptId) = 0; + virtual void didExecuteScript(v8::Local) = 0; + virtual void idleStarted() = 0; + virtual void idleFinished() = 0; + + // Async stack traces instrumentation. + virtual void asyncTaskScheduled(const StringView& taskName, void* task, + bool recurring) = 0; + virtual void asyncTaskCanceled(void* task) = 0; + virtual void asyncTaskStarted(void* task) = 0; + virtual void asyncTaskFinished(void* task) = 0; + virtual void allAsyncTasksCanceled() = 0; + + // Exceptions instrumentation. + virtual unsigned exceptionThrown( + v8::Local, const StringView& message, + v8::Local exception, const StringView& detailedMessage, + const StringView& url, unsigned lineNumber, unsigned columnNumber, + std::unique_ptr, int scriptId) = 0; + virtual void exceptionRevoked(v8::Local, unsigned exceptionId, + const StringView& message) = 0; + + // Connection. + class V8_EXPORT Channel { + public: + virtual ~Channel() {} + virtual void sendProtocolResponse(int callId, + const StringView& message) = 0; + virtual void sendProtocolNotification(const StringView& message) = 0; + virtual void flushProtocolNotifications() = 0; + }; + virtual std::unique_ptr connect( + int contextGroupId, Channel*, const StringView& state) = 0; + + // API methods. + virtual std::unique_ptr createStackTrace( + v8::Local) = 0; + virtual std::unique_ptr captureStackTrace(bool fullStack) = 0; +}; + +} // namespace v8_inspector + +#endif // V8_V8_INSPECTOR_H_ diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index bcb69f3763e1b7..55c8386bdeff4a 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -131,12 +131,26 @@ class V8_EXPORT CpuProfileNode { /** Returns function name (empty string for anonymous functions.) */ Local GetFunctionName() const; + /** + * Returns function name (empty string for anonymous functions.) + * The string ownership is *not* passed to the caller. It stays valid until + * profile is deleted. The function is thread safe. + */ + const char* GetFunctionNameStr() const; + /** Returns id of the script where function is located. */ int GetScriptId() const; /** Returns resource name for script from where the function originates. */ Local GetScriptResourceName() const; + /** + * Returns resource name for script from where the function originates. + * The string ownership is *not* passed to the caller. It stays valid until + * profile is deleted. The function is thread safe. + */ + const char* GetScriptResourceNameStr() const; + /** * Returns the number, 1-based, of the line where the function originates. * kNoLineNumberInfo if no line number information is available. diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 52e9d04584e4c8..e69271c00c5c62 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -9,7 +9,7 @@ // 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 5 -#define V8_MINOR_VERSION 4 +#define V8_MINOR_VERSION 5 #define V8_BUILD_NUMBER 0 #define V8_PATCH_LEVEL 0 diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index d7e39adbaee349..43325e20b201b9 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -70,6 +70,7 @@ namespace v8 { class AccessorSignature; class Array; +class ArrayBuffer; class Boolean; class BooleanObject; class Context; @@ -95,6 +96,7 @@ class ObjectTemplate; class Platform; class Primitive; class Promise; +class PropertyDescriptor; class Proxy; class RawOperationDescriptor; class Script; @@ -341,7 +343,7 @@ class Local { #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS) -// Local is an alias for Local for historical reasons. +// Handle is an alias for Local for historical reasons. template using Handle = Local; #endif @@ -615,6 +617,9 @@ template class PersistentBase { */ V8_INLINE uint16_t WrapperClassId() const; + PersistentBase(const PersistentBase& other) = delete; // NOLINT + void operator=(const PersistentBase&) = delete; + private: friend class Isolate; friend class Utils; @@ -630,8 +635,6 @@ template class PersistentBase { friend class Object; explicit V8_INLINE PersistentBase(T* val) : val_(val) {} - PersistentBase(const PersistentBase& other) = delete; // NOLINT - void operator=(const PersistentBase&) = delete; V8_INLINE static T* New(Isolate* isolate, T* that); T* val_; @@ -835,11 +838,12 @@ class Global : public PersistentBase { */ typedef void MoveOnlyTypeForCPP03; + Global(const Global&) = delete; + void operator=(const Global&) = delete; + private: template friend class ReturnValue; - Global(const Global&) = delete; - void operator=(const Global&) = delete; V8_INLINE T* operator*() const { return this->val_; } }; @@ -878,6 +882,11 @@ class V8_EXPORT HandleScope { return reinterpret_cast(isolate_); } + HandleScope(const HandleScope&) = delete; + void operator=(const HandleScope&) = delete; + void* operator new(size_t size) = delete; + void operator delete(void*, size_t) = delete; + protected: V8_INLINE HandleScope() {} @@ -891,13 +900,6 @@ class V8_EXPORT HandleScope { static internal::Object** CreateHandle(internal::HeapObject* heap_object, internal::Object* value); - // Make it hard to create heap-allocated or illegal handle scopes by - // disallowing certain operations. - HandleScope(const HandleScope&); - void operator=(const HandleScope&); - void* operator new(size_t size); - void operator delete(void*, size_t); - internal::Isolate* isolate_; internal::Object** prev_next_; internal::Object** prev_limit_; @@ -932,16 +934,13 @@ class V8_EXPORT EscapableHandleScope : public HandleScope { return Local(reinterpret_cast(slot)); } + EscapableHandleScope(const EscapableHandleScope&) = delete; + void operator=(const EscapableHandleScope&) = delete; + void* operator new(size_t size) = delete; + void operator delete(void*, size_t) = delete; + private: internal::Object** Escape(internal::Object** escape_value); - - // Make it hard to create heap-allocated or illegal handle scopes by - // disallowing certain operations. - EscapableHandleScope(const EscapableHandleScope&); - void operator=(const EscapableHandleScope&); - void* operator new(size_t size); - void operator delete(void*, size_t); - internal::Object** escape_slot_; }; @@ -950,14 +949,12 @@ class V8_EXPORT SealHandleScope { SealHandleScope(Isolate* isolate); ~SealHandleScope(); - private: - // Make it hard to create heap-allocated or illegal handle scopes by - // disallowing certain operations. - SealHandleScope(const SealHandleScope&); - void operator=(const SealHandleScope&); - void* operator new(size_t size); - void operator delete(void*, size_t); + SealHandleScope(const SealHandleScope&) = delete; + void operator=(const SealHandleScope&) = delete; + void* operator new(size_t size) = delete; + void operator delete(void*, size_t) = delete; + private: internal::Isolate* const isolate_; internal::Object** prev_limit_; int prev_sealed_level_; @@ -1148,10 +1145,9 @@ class V8_EXPORT ScriptCompiler { bool rejected; BufferPolicy buffer_policy; - private: - // Prevent copying. Not implemented. - CachedData(const CachedData&); - CachedData& operator=(const CachedData&); + // Prevent copying. + CachedData(const CachedData&) = delete; + CachedData& operator=(const CachedData&) = delete; }; /** @@ -1171,11 +1167,12 @@ class V8_EXPORT ScriptCompiler { // alive. V8_INLINE const CachedData* GetCachedData() const; + // Prevent copying. + Source(const Source&) = delete; + Source& operator=(const Source&) = delete; + private: friend class ScriptCompiler; - // Prevent copying. Not implemented. - Source(const Source&); - Source& operator=(const Source&); Local source_string; @@ -1258,11 +1255,11 @@ class V8_EXPORT ScriptCompiler { internal::StreamedSource* impl() const { return impl_; } - private: - // Prevent copying. Not implemented. - StreamedSource(const StreamedSource&); - StreamedSource& operator=(const StreamedSource&); + // Prevent copying. + StreamedSource(const StreamedSource&) = delete; + StreamedSource& operator=(const StreamedSource&) = delete; + private: internal::StreamedSource* impl_; }; @@ -1664,6 +1661,172 @@ class V8_EXPORT JSON { Local gap = Local()); }; +/** + * Value serialization compatible with the HTML structured clone algorithm. + * The format is backward-compatible (i.e. safe to store to disk). + * + * WARNING: This API is under development, and changes (including incompatible + * changes to the API or wire format) may occur without notice until this + * warning is removed. + */ +class V8_EXPORT ValueSerializer { + public: + class V8_EXPORT Delegate { + public: + virtual ~Delegate() {} + + /* + * Handles the case where a DataCloneError would be thrown in the structured + * clone spec. Other V8 embedders may throw some other appropriate exception + * type. + */ + virtual void ThrowDataCloneError(Local message) = 0; + + /* + * The embedder overrides this method to write some kind of host object, if + * possible. If not, a suitable exception should be thrown and + * Nothing() returned. + */ + virtual Maybe WriteHostObject(Isolate* isolate, Local object); + }; + + explicit ValueSerializer(Isolate* isolate); + ValueSerializer(Isolate* isolate, Delegate* delegate); + ~ValueSerializer(); + + /* + * Writes out a header, which includes the format version. + */ + void WriteHeader(); + + /* + * Serializes a JavaScript value into the buffer. + */ + V8_WARN_UNUSED_RESULT Maybe WriteValue(Local context, + Local value); + + /* + * Returns the stored data. This serializer should not be used once the buffer + * is released. The contents are undefined if a previous write has failed. + */ + std::vector ReleaseBuffer(); + + /* + * Marks an ArrayBuffer as havings its contents transferred out of band. + * Pass the corresponding JSArrayBuffer in the deserializing context to + * ValueDeserializer::TransferArrayBuffer. + */ + void TransferArrayBuffer(uint32_t transfer_id, + Local array_buffer); + + /* + * Similar to TransferArrayBuffer, but for SharedArrayBuffer. + */ + void TransferSharedArrayBuffer(uint32_t transfer_id, + Local shared_array_buffer); + + /* + * Write raw data in various common formats to the buffer. + * Note that integer types are written in base-128 varint format, not with a + * binary copy. For use during an override of Delegate::WriteHostObject. + */ + void WriteUint32(uint32_t value); + void WriteUint64(uint64_t value); + void WriteRawBytes(const void* source, size_t length); + + private: + ValueSerializer(const ValueSerializer&) = delete; + void operator=(const ValueSerializer&) = delete; + + struct PrivateData; + PrivateData* private_; +}; + +/** + * Deserializes values from data written with ValueSerializer, or a compatible + * implementation. + * + * WARNING: This API is under development, and changes (including incompatible + * changes to the API or wire format) may occur without notice until this + * warning is removed. + */ +class V8_EXPORT ValueDeserializer { + public: + class V8_EXPORT Delegate { + public: + virtual ~Delegate() {} + + /* + * The embedder overrides this method to read some kind of host object, if + * possible. If not, a suitable exception should be thrown and + * MaybeLocal() returned. + */ + virtual MaybeLocal ReadHostObject(Isolate* isolate); + }; + + ValueDeserializer(Isolate* isolate, const uint8_t* data, size_t size); + ValueDeserializer(Isolate* isolate, const uint8_t* data, size_t size, + Delegate* delegate); + ~ValueDeserializer(); + + /* + * Reads and validates a header (including the format version). + * May, for example, reject an invalid or unsupported wire format. + */ + V8_WARN_UNUSED_RESULT Maybe ReadHeader(Local context); + V8_DEPRECATE_SOON("Use Local version", Maybe ReadHeader()); + + /* + * Deserializes a JavaScript value from the buffer. + */ + V8_WARN_UNUSED_RESULT MaybeLocal ReadValue(Local context); + + /* + * Accepts the array buffer corresponding to the one passed previously to + * ValueSerializer::TransferArrayBuffer. + */ + void TransferArrayBuffer(uint32_t transfer_id, + Local array_buffer); + + /* + * Similar to TransferArrayBuffer, but for SharedArrayBuffer. + * transfer_id exists in the same namespace as unshared ArrayBuffer objects. + */ + void TransferSharedArrayBuffer(uint32_t transfer_id, + Local shared_array_buffer); + + /* + * Must be called before ReadHeader to enable support for reading the legacy + * wire format (i.e., which predates this being shipped). + * + * Don't use this unless you need to read data written by previous versions of + * blink::ScriptValueSerializer. + */ + void SetSupportsLegacyWireFormat(bool supports_legacy_wire_format); + + /* + * Reads the underlying wire format version. Likely mostly to be useful to + * legacy code reading old wire format versions. Must be called after + * ReadHeader. + */ + uint32_t GetWireFormatVersion() const; + + /* + * Reads raw data in various common formats to the buffer. + * Note that integer types are read in base-128 varint format, not with a + * binary copy. For use during an override of Delegate::ReadHostObject. + */ + V8_WARN_UNUSED_RESULT bool ReadUint32(uint32_t* value); + V8_WARN_UNUSED_RESULT bool ReadUint64(uint64_t* value); + V8_WARN_UNUSED_RESULT bool ReadRawBytes(size_t length, const void** data); + + private: + ValueDeserializer(const ValueDeserializer&) = delete; + void operator=(const ValueDeserializer&) = delete; + + struct PrivateData; + PrivateData* private_; +}; /** * A map whose keys are referenced weakly. It is similar to JavaScript WeakMap @@ -2207,11 +2370,11 @@ class V8_EXPORT String : public Name { */ virtual void Dispose() { delete this; } - private: // Disallow copying and assigning. - ExternalStringResourceBase(const ExternalStringResourceBase&); - void operator=(const ExternalStringResourceBase&); + ExternalStringResourceBase(const ExternalStringResourceBase&) = delete; + void operator=(const ExternalStringResourceBase&) = delete; + private: friend class v8::internal::Heap; }; @@ -2413,13 +2576,14 @@ class V8_EXPORT String : public Name { char* operator*() { return str_; } const char* operator*() const { return str_; } int length() const { return length_; } + + // Disallow copying and assigning. + Utf8Value(const Utf8Value&) = delete; + void operator=(const Utf8Value&) = delete; + private: char* str_; int length_; - - // Disallow copying and assigning. - Utf8Value(const Utf8Value&); - void operator=(const Utf8Value&); }; /** @@ -2435,13 +2599,14 @@ class V8_EXPORT String : public Name { uint16_t* operator*() { return str_; } const uint16_t* operator*() const { return str_; } int length() const { return length_; } + + // Disallow copying and assigning. + Value(const Value&) = delete; + void operator=(const Value&) = delete; + private: uint16_t* str_; int length_; - - // Disallow copying and assigning. - Value(const Value&); - void operator=(const Value&); }; private: @@ -2575,11 +2740,17 @@ class V8_EXPORT Uint32 : public Integer { static void CheckCast(v8::Value* obj); }; - +/** + * PropertyAttribute. + */ enum PropertyAttribute { - None = 0, - ReadOnly = 1 << 0, - DontEnum = 1 << 1, + /** None. **/ + None = 0, + /** ReadOnly, i.e., not writable. **/ + ReadOnly = 1 << 0, + /** DontEnum, i.e., not enumerable. **/ + DontEnum = 1 << 1, + /** DontDelete, i.e., not configurable. **/ DontDelete = 1 << 2 }; @@ -2693,6 +2864,22 @@ class V8_EXPORT Object : public Value { Local context, Local key, Local value, PropertyAttribute attributes = None); + // Implements Object.DefineProperty(O, P, Attributes), see Ecma-262 19.1.2.4. + // + // The defineProperty function is used to add an own property or + // update the attributes of an existing own property of an object. + // + // Both data and accessor descriptors can be used. + // + // In general, CreateDataProperty is faster, however, does not allow + // for specifying attributes or an accessor descriptor. + // + // The PropertyDescriptor can change when redefining a property. + // + // Returns true on success. + V8_WARN_UNUSED_RESULT Maybe DefineProperty( + Local context, Local key, PropertyDescriptor& descriptor); + // Sets an own property on this object bypassing interceptors and // overriding accessors or read-only properties. // @@ -3236,12 +3423,91 @@ class FunctionCallbackInfo { template class PropertyCallbackInfo { public: + /** + * \return The isolate of the property access. + */ V8_INLINE Isolate* GetIsolate() const; + + /** + * \return The data set in the configuration, i.e., in + * `NamedPropertyHandlerConfiguration` or + * `IndexedPropertyHandlerConfiguration.` + */ V8_INLINE Local Data() const; + + /** + * \return The receiver. In many cases, this is the object on which the + * property access was intercepted. When using + * `Reflect.Get`, `Function.prototype.call`, or similar functions, it is the + * object passed in as receiver or thisArg. + * + * \code + * void GetterCallback(Local name, + * const v8::PropertyCallbackInfo& info) { + * auto context = info.GetIsolate()->GetCurrentContext(); + * + * v8::Local a_this = + * info.This() + * ->GetRealNamedProperty(context, v8_str("a")) + * .ToLocalChecked(); + * v8::Local a_holder = + * info.Holder() + * ->GetRealNamedProperty(context, v8_str("a")) + * .ToLocalChecked(); + * + * CHECK(v8_str("r")->Equals(context, a_this).FromJust()); + * CHECK(v8_str("obj")->Equals(context, a_holder).FromJust()); + * + * info.GetReturnValue().Set(name); + * } + * + * v8::Local templ = + * v8::FunctionTemplate::New(isolate); + * templ->InstanceTemplate()->SetHandler( + * v8::NamedPropertyHandlerConfiguration(GetterCallback)); + * LocalContext env; + * env->Global() + * ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + * .ToLocalChecked() + * ->NewInstance(env.local()) + * .ToLocalChecked()) + * .FromJust(); + * + * CompileRun("obj.a = 'obj'; var r = {a: 'r'}; Reflect.get(obj, 'x', r)"); + * \endcode + */ V8_INLINE Local This() const; + + /** + * \return The object in the prototype chain of the receiver that has the + * interceptor. Suppose you have `x` and its prototype is `y`, and `y` + * has an interceptor. Then `info.This()` is `x` and `info.Holder()` is `y`. + * The Holder() could be a hidden object (the global object, rather + * than the global proxy). + * + * \note For security reasons, do not pass the object back into the runtime. + */ V8_INLINE Local Holder() const; + + /** + * \return The return value of the callback. + * Can be changed by calling Set(). + * \code + * info.GetReturnValue().Set(...) + * \endcode + * + */ V8_INLINE ReturnValue GetReturnValue() const; + + /** + * \return True if the intercepted function should throw if an error occurs. + * Usually, `true` corresponds to `'use strict'`. + * + * \note Always `false` when intercepting `Reflect.Set()` + * independent of the language mode. + */ V8_INLINE bool ShouldThrowOnError() const; + // This shouldn't be public, but the arm compiler needs it. static const int kArgsLength = 7; @@ -3431,6 +3697,78 @@ class V8_EXPORT Promise : public Object { static void CheckCast(Value* obj); }; +/** + * An instance of a Property Descriptor, see Ecma-262 6.2.4. + * + * Properties in a descriptor are present or absent. If you do not set + * `enumerable`, `configurable`, and `writable`, they are absent. If `value`, + * `get`, or `set` are absent, but you must specify them in the constructor, use + * empty handles. + * + * Accessors `get` and `set` must be callable or undefined if they are present. + * + * \note Only query properties if they are present, i.e., call `x()` only if + * `has_x()` returns true. + * + * \code + * // var desc = {writable: false} + * v8::PropertyDescriptor d(Local()), false); + * d.value(); // error, value not set + * if (d.has_writable()) { + * d.writable(); // false + * } + * + * // var desc = {value: undefined} + * v8::PropertyDescriptor d(v8::Undefined(isolate)); + * + * // var desc = {get: undefined} + * v8::PropertyDescriptor d(v8::Undefined(isolate), Local())); + * \endcode + */ +class V8_EXPORT PropertyDescriptor { + public: + // GenericDescriptor + PropertyDescriptor(); + + // DataDescriptor + PropertyDescriptor(Local value); + + // DataDescriptor with writable property + PropertyDescriptor(Local value, bool writable); + + // AccessorDescriptor + PropertyDescriptor(Local get, Local set); + + ~PropertyDescriptor(); + + Local value() const; + bool has_value() const; + + Local get() const; + bool has_get() const; + Local set() const; + bool has_set() const; + + void set_enumerable(bool enumerable); + bool enumerable() const; + bool has_enumerable() const; + + void set_configurable(bool configurable); + bool configurable() const; + bool has_configurable() const; + + bool writable() const; + bool has_writable() const; + + struct PrivateData; + PrivateData* get_private() const { return private_; } + + PropertyDescriptor(const PropertyDescriptor&) = delete; + void operator=(const PropertyDescriptor&) = delete; + + private: + PrivateData* private_; +}; /** * An instance of the built-in Proxy constructor (ECMA-262, 6th Edition, @@ -3444,7 +3782,7 @@ class V8_EXPORT Proxy : public Object { void Revoke(); /** - * Creates a new empty Map. + * Creates a new Proxy for the target object. */ static MaybeLocal New(Local context, Local local_target, @@ -4296,36 +4634,115 @@ typedef void (*NamedPropertyEnumeratorCallback)( // TODO(dcarney): Deprecate and remove previous typedefs, and replace // GenericNamedPropertyFooCallback with just NamedPropertyFooCallback. + /** - * GenericNamedProperty[Getter|Setter] are used as interceptors on object. - * See ObjectTemplate::SetNamedPropertyHandler. + * Interceptor for get requests on an object. + * + * Use `info.GetReturnValue().Set()` to set the return value of the + * intercepted get request. + * + * \param property The name of the property for which the request was + * intercepted. + * \param info Information about the intercepted request, such as + * isolate, receiver, return value, or whether running in `'use strict`' mode. + * See `PropertyCallbackInfo`. + * + * \code + * void GetterCallback( + * Local name, + * const v8::PropertyCallbackInfo& info) { + * info.GetReturnValue().Set(v8_num(42)); + * } + * + * v8::Local templ = + * v8::FunctionTemplate::New(isolate); + * templ->InstanceTemplate()->SetHandler( + * v8::NamedPropertyHandlerConfiguration(GetterCallback)); + * LocalContext env; + * env->Global() + * ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + * .ToLocalChecked() + * ->NewInstance(env.local()) + * .ToLocalChecked()) + * .FromJust(); + * v8::Local result = CompileRun("obj.a = 17; obj.a"); + * CHECK(v8_num(42)->Equals(env.local(), result).FromJust()); + * \endcode + * + * See also `ObjectTemplate::SetHandler`. */ typedef void (*GenericNamedPropertyGetterCallback)( Local property, const PropertyCallbackInfo& info); - /** - * Returns the value if the setter intercepts the request. - * Otherwise, returns an empty handle. + * Interceptor for set requests on an object. + * + * Use `info.GetReturnValue()` to indicate whether the request was intercepted + * or not. If the setter successfully intercepts the request, i.e., if the + * request should not be further executed, call + * `info.GetReturnValue().Set(value)`. If the setter + * did not intercept the request, i.e., if the request should be handled as + * if no interceptor is present, do not not call `Set()`. + * + * \param property The name of the property for which the request was + * intercepted. + * \param value The value which the property will have if the request + * is not intercepted. + * \param info Information about the intercepted request, such as + * isolate, receiver, return value, or whether running in `'use strict'` mode. + * See `PropertyCallbackInfo`. + * + * See also + * `ObjectTemplate::SetHandler.` */ typedef void (*GenericNamedPropertySetterCallback)( Local property, Local value, const PropertyCallbackInfo& info); - /** - * Returns a non-empty handle if the interceptor intercepts the request. - * The result is an integer encoding property attributes (like v8::None, - * v8::DontEnum, etc.) + * Intercepts all requests that query the attributes of the + * property, e.g., getOwnPropertyDescriptor(), propertyIsEnumerable(), and + * defineProperty(). + * + * Use `info.GetReturnValue().Set(value)` to set the property attributes. The + * value is an interger encoding a `v8::PropertyAttribute`. + * + * \param property The name of the property for which the request was + * intercepted. + * \param info Information about the intercepted request, such as + * isolate, receiver, return value, or whether running in `'use strict'` mode. + * See `PropertyCallbackInfo`. + * + * \note Some functions query the property attributes internally, even though + * they do not return the attributes. For example, `hasOwnProperty()` can + * trigger this interceptor depending on the state of the object. + * + * See also + * `ObjectTemplate::SetHandler.` */ typedef void (*GenericNamedPropertyQueryCallback)( Local property, const PropertyCallbackInfo& info); - /** - * Returns a non-empty handle if the deleter intercepts the request. - * The return value is true if the property could be deleted and false - * otherwise. + * Interceptor for delete requests on an object. + * + * Use `info.GetReturnValue()` to indicate whether the request was intercepted + * or not. If the deleter successfully intercepts the request, i.e., if the + * request should not be further executed, call + * `info.GetReturnValue().Set(value)` with a boolean `value`. The `value` is + * used as the return value of `delete`. + * + * \param property The name of the property for which the request was + * intercepted. + * \param info Information about the intercepted request, such as + * isolate, receiver, return value, or whether running in `'use strict'` mode. + * See `PropertyCallbackInfo`. + * + * \note If you need to mimic the behavior of `delete`, i.e., throw in strict + * mode instead of returning false, use `info.ShouldThrowOnError()` to determine + * if you are in strict mode. + * + * See also `ObjectTemplate::SetHandler.` */ typedef void (*GenericNamedPropertyDeleterCallback)( Local property, const PropertyCallbackInfo& info); @@ -4338,52 +4755,99 @@ typedef void (*GenericNamedPropertyDeleterCallback)( typedef void (*GenericNamedPropertyEnumeratorCallback)( const PropertyCallbackInfo& info); +/** + * Interceptor for defineProperty requests on an object. + * + * Use `info.GetReturnValue()` to indicate whether the request was intercepted + * or not. If the definer successfully intercepts the request, i.e., if the + * request should not be further executed, call + * `info.GetReturnValue().Set(value)`. If the definer + * did not intercept the request, i.e., if the request should be handled as + * if no interceptor is present, do not not call `Set()`. + * + * \param property The name of the property for which the request was + * intercepted. + * \param desc The property descriptor which is used to define the + * property if the request is not intercepted. + * \param info Information about the intercepted request, such as + * isolate, receiver, return value, or whether running in `'use strict'` mode. + * See `PropertyCallbackInfo`. + * + * See also `ObjectTemplate::SetHandler`. + */ +typedef void (*GenericNamedPropertyDefinerCallback)( + Local property, const PropertyDescriptor& desc, + const PropertyCallbackInfo& info); /** - * Returns the value of the property if the getter intercepts the - * request. Otherwise, returns an empty handle. + * Interceptor for getOwnPropertyDescriptor requests on an object. + * + * Use `info.GetReturnValue().Set()` to set the return value of the + * intercepted request. The return value must be an object that + * can be converted to a PropertyDescriptor, e.g., a `v8::value` returned from + * `v8::Object::getOwnPropertyDescriptor`. + * + * \param property The name of the property for which the request was + * intercepted. + * \info Information about the intercepted request, such as + * isolate, receiver, return value, or whether running in `'use strict'` mode. + * See `PropertyCallbackInfo`. + * + * \note If GetOwnPropertyDescriptor is intercepted, it will + * always return true, i.e., indicate that the property was found. + * + * See also `ObjectTemplate::SetHandler`. + */ +typedef void (*GenericNamedPropertyDescriptorCallback)( + Local property, const PropertyCallbackInfo& info); + +/** + * See `v8::GenericNamedPropertyGetterCallback`. */ typedef void (*IndexedPropertyGetterCallback)( uint32_t index, const PropertyCallbackInfo& info); - /** - * Returns the value if the setter intercepts the request. - * Otherwise, returns an empty handle. + * See `v8::GenericNamedPropertySetterCallback`. */ typedef void (*IndexedPropertySetterCallback)( uint32_t index, Local value, const PropertyCallbackInfo& info); - /** - * Returns a non-empty handle if the interceptor intercepts the request. - * The result is an integer encoding property attributes. + * See `v8::GenericNamedPropertyQueryCallback`. */ typedef void (*IndexedPropertyQueryCallback)( uint32_t index, const PropertyCallbackInfo& info); - /** - * Returns a non-empty handle if the deleter intercepts the request. - * The return value is true if the property could be deleted and false - * otherwise. + * See `v8::GenericNamedPropertyDeleterCallback`. */ typedef void (*IndexedPropertyDeleterCallback)( uint32_t index, const PropertyCallbackInfo& info); - /** - * Returns an array containing the indices of the properties the - * indexed property getter intercepts. + * See `v8::GenericNamedPropertyEnumeratorCallback`. */ typedef void (*IndexedPropertyEnumeratorCallback)( const PropertyCallbackInfo& info); +/** + * See `v8::GenericNamedPropertyDefinerCallback`. + */ +typedef void (*IndexedPropertyDefinerCallback)( + uint32_t index, const PropertyDescriptor& desc, + const PropertyCallbackInfo& info); + +/** + * See `v8::GenericNamedPropertyDescriptorCallback`. + */ +typedef void (*IndexedPropertyDescriptorCallback)( + uint32_t index, const PropertyCallbackInfo& info); /** * Access type specification. @@ -4617,23 +5081,22 @@ class V8_EXPORT FunctionTemplate : public Template { friend class ObjectTemplate; }; - enum class PropertyHandlerFlags { kNone = 0, // See ALL_CAN_READ above. kAllCanRead = 1, // Will not call into interceptor for properties on the receiver or prototype - // chain. Currently only valid for named interceptors. + // chain, i.e., only call into interceptor for properties that do not exist. + // Currently only valid for named interceptors. kNonMasking = 1 << 1, // Will not call into interceptor for symbol lookup. Only meaningful for // named interceptors. kOnlyInterceptStrings = 1 << 2, }; - struct NamedPropertyHandlerConfiguration { NamedPropertyHandlerConfiguration( - /** Note: getter is required **/ + /** Note: getter is required */ GenericNamedPropertyGetterCallback getter = 0, GenericNamedPropertySetterCallback setter = 0, GenericNamedPropertyQueryCallback query = 0, @@ -4646,6 +5109,27 @@ struct NamedPropertyHandlerConfiguration { query(query), deleter(deleter), enumerator(enumerator), + definer(0), + descriptor(0), + data(data), + flags(flags) {} + + NamedPropertyHandlerConfiguration( + GenericNamedPropertyGetterCallback getter, + GenericNamedPropertySetterCallback setter, + GenericNamedPropertyDescriptorCallback descriptor, + GenericNamedPropertyDeleterCallback deleter, + GenericNamedPropertyEnumeratorCallback enumerator, + GenericNamedPropertyDefinerCallback definer, + Local data = Local(), + PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) + : getter(getter), + setter(setter), + query(0), + deleter(deleter), + enumerator(enumerator), + definer(definer), + descriptor(descriptor), data(data), flags(flags) {} @@ -4654,6 +5138,8 @@ struct NamedPropertyHandlerConfiguration { GenericNamedPropertyQueryCallback query; GenericNamedPropertyDeleterCallback deleter; GenericNamedPropertyEnumeratorCallback enumerator; + GenericNamedPropertyDefinerCallback definer; + GenericNamedPropertyDescriptorCallback descriptor; Local data; PropertyHandlerFlags flags; }; @@ -4661,7 +5147,7 @@ struct NamedPropertyHandlerConfiguration { struct IndexedPropertyHandlerConfiguration { IndexedPropertyHandlerConfiguration( - /** Note: getter is required **/ + /** Note: getter is required */ IndexedPropertyGetterCallback getter = 0, IndexedPropertySetterCallback setter = 0, IndexedPropertyQueryCallback query = 0, @@ -4674,6 +5160,27 @@ struct IndexedPropertyHandlerConfiguration { query(query), deleter(deleter), enumerator(enumerator), + definer(0), + descriptor(0), + data(data), + flags(flags) {} + + IndexedPropertyHandlerConfiguration( + IndexedPropertyGetterCallback getter, + IndexedPropertySetterCallback setter, + IndexedPropertyDescriptorCallback descriptor, + IndexedPropertyDeleterCallback deleter, + IndexedPropertyEnumeratorCallback enumerator, + IndexedPropertyDefinerCallback definer, + Local data = Local(), + PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) + : getter(getter), + setter(setter), + query(0), + deleter(deleter), + enumerator(enumerator), + definer(definer), + descriptor(descriptor), data(data), flags(flags) {} @@ -4682,6 +5189,8 @@ struct IndexedPropertyHandlerConfiguration { IndexedPropertyQueryCallback query; IndexedPropertyDeleterCallback deleter; IndexedPropertyEnumeratorCallback enumerator; + IndexedPropertyDefinerCallback definer; + IndexedPropertyDescriptorCallback descriptor; Local data; PropertyHandlerFlags flags; }; @@ -4977,6 +5486,10 @@ class V8_EXPORT Extension { // NOLINT void set_auto_enable(bool value) { auto_enable_ = value; } bool auto_enable() { return auto_enable_; } + // Disallow copying and assigning. + Extension(const Extension&) = delete; + void operator=(const Extension&) = delete; + private: const char* name_; size_t source_length_; // expected to initialize before source_ @@ -4984,10 +5497,6 @@ class V8_EXPORT Extension { // NOLINT int dep_count_; const char** deps_; bool auto_enable_; - - // Disallow copying and assigning. - Extension(const Extension&); - void operator=(const Extension&); }; @@ -5213,13 +5722,13 @@ class V8_EXPORT MicrotasksScope { */ static bool IsRunningMicrotasks(Isolate* isolate); + // Prevent copying. + MicrotasksScope(const MicrotasksScope&) = delete; + MicrotasksScope& operator=(const MicrotasksScope&) = delete; + private: internal::Isolate* const isolate_; bool run_; - - // Prevent copying. - MicrotasksScope(const MicrotasksScope&); - MicrotasksScope& operator=(const MicrotasksScope&); }; @@ -5530,23 +6039,27 @@ enum class MemoryPressureLevel { kNone, kModerate, kCritical }; class V8_EXPORT EmbedderHeapTracer { public: enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION }; + struct AdvanceTracingActions { explicit AdvanceTracingActions(ForceCompletionAction force_completion_) : force_completion(force_completion_) {} ForceCompletionAction force_completion; }; + /** - * V8 will call this method with internal fields of found wrappers. - * Embedder is expected to store them in it's marking deque and trace - * reachable wrappers from them when asked by AdvanceTracing method. + * V8 will call this method with internal fields of found wrappers. The + * embedder is expected to store them in its marking deque and trace + * reachable wrappers from them when called through |AdvanceTracing|. */ virtual void RegisterV8References( const std::vector >& internal_fields) = 0; + /** - * V8 will call this method at the beginning of the gc cycle. + * V8 will call this method at the beginning of a GC cycle. */ virtual void TracePrologue() = 0; + /** * Embedder is expected to trace its heap starting from wrappers reported by * RegisterV8References method, and call @@ -5557,9 +6070,11 @@ class V8_EXPORT EmbedderHeapTracer { */ virtual bool AdvanceTracing(double deadline_in_ms, AdvanceTracingActions actions) = 0; + /** - * V8 will call this method at the end of the gc cycle. Allocation is *not* - * allowed in the TraceEpilogue. + * V8 will call this method at the end of a GC cycle. + * + * Note that allocation is *not* allowed within |TraceEpilogue|. */ virtual void TraceEpilogue() = 0; @@ -5574,6 +6089,11 @@ class V8_EXPORT EmbedderHeapTracer { */ virtual void AbortTracing() {} + /** + * Returns the number of wrappers that are still to be traced by the embedder. + */ + virtual size_t NumberOfWrappersToTrace() { return 0; } + protected: virtual ~EmbedderHeapTracer() = default; }; @@ -5671,12 +6191,12 @@ class V8_EXPORT Isolate { ~Scope() { isolate_->Exit(); } + // Prevent copying of Scope objects. + Scope(const Scope&) = delete; + Scope& operator=(const Scope&) = delete; + private: Isolate* const isolate_; - - // Prevent copying of Scope objects. - Scope(const Scope&); - Scope& operator=(const Scope&); }; @@ -5690,14 +6210,15 @@ class V8_EXPORT Isolate { DisallowJavascriptExecutionScope(Isolate* isolate, OnFailure on_failure); ~DisallowJavascriptExecutionScope(); + // Prevent copying of Scope objects. + DisallowJavascriptExecutionScope(const DisallowJavascriptExecutionScope&) = + delete; + DisallowJavascriptExecutionScope& operator=( + const DisallowJavascriptExecutionScope&) = delete; + private: bool on_failure_; void* internal_; - - // Prevent copying of Scope objects. - DisallowJavascriptExecutionScope(const DisallowJavascriptExecutionScope&); - DisallowJavascriptExecutionScope& operator=( - const DisallowJavascriptExecutionScope&); }; @@ -5709,14 +6230,15 @@ class V8_EXPORT Isolate { explicit AllowJavascriptExecutionScope(Isolate* isolate); ~AllowJavascriptExecutionScope(); + // Prevent copying of Scope objects. + AllowJavascriptExecutionScope(const AllowJavascriptExecutionScope&) = + delete; + AllowJavascriptExecutionScope& operator=( + const AllowJavascriptExecutionScope&) = delete; + private: void* internal_throws_; void* internal_assert_; - - // Prevent copying of Scope objects. - AllowJavascriptExecutionScope(const AllowJavascriptExecutionScope&); - AllowJavascriptExecutionScope& operator=( - const AllowJavascriptExecutionScope&); }; /** @@ -5728,13 +6250,14 @@ class V8_EXPORT Isolate { explicit SuppressMicrotaskExecutionScope(Isolate* isolate); ~SuppressMicrotaskExecutionScope(); - private: - internal::Isolate* const isolate_; - // Prevent copying of Scope objects. - SuppressMicrotaskExecutionScope(const SuppressMicrotaskExecutionScope&); + SuppressMicrotaskExecutionScope(const SuppressMicrotaskExecutionScope&) = + delete; SuppressMicrotaskExecutionScope& operator=( - const SuppressMicrotaskExecutionScope&); + const SuppressMicrotaskExecutionScope&) = delete; + + private: + internal::Isolate* const isolate_; }; /** @@ -6460,17 +6983,17 @@ class V8_EXPORT Isolate { */ bool IsInUse(); + Isolate() = delete; + ~Isolate() = delete; + Isolate(const Isolate&) = delete; + Isolate& operator=(const Isolate&) = delete; + void* operator new(size_t size) = delete; + void operator delete(void*, size_t) = delete; + private: template friend class PersistentValueMapBase; - Isolate(); - Isolate(const Isolate&); - ~Isolate(); - Isolate& operator=(const Isolate&); - void* operator new(size_t size); - void operator delete(void*, size_t); - void SetObjectGroupId(internal::Object** object, UniqueId id); void SetReferenceFromGroup(UniqueId id, internal::Object** object); void SetReference(internal::Object** parent, internal::Object** child); @@ -6925,12 +7448,12 @@ class SnapshotCreator { */ StartupData CreateBlob(FunctionCodeHandling function_code_handling); + // Disallow copying and assigning. + SnapshotCreator(const SnapshotCreator&) = delete; + void operator=(const SnapshotCreator&) = delete; + private: void* data_; - - // Disallow copying and assigning. - SnapshotCreator(const SnapshotCreator&); - void operator=(const SnapshotCreator&); }; /** @@ -7134,15 +7657,14 @@ class V8_EXPORT TryCatch { return handler->js_stack_comparable_address_; } + TryCatch(const TryCatch&) = delete; + void operator=(const TryCatch&) = delete; + void* operator new(size_t size) = delete; + void operator delete(void*, size_t) = delete; + private: void ResetInternal(); - // Make it hard to create heap-allocated TryCatch blocks. - TryCatch(const TryCatch&); - void operator=(const TryCatch&); - void* operator new(size_t size); - void operator delete(void*, size_t); - v8::internal::Isolate* isolate_; v8::TryCatch* next_; void* exception_; @@ -7498,16 +8020,16 @@ class V8_EXPORT Locker { */ static bool IsActive(); + // Disallow copying and assigning. + Locker(const Locker&) = delete; + void operator=(const Locker&) = delete; + private: void Initialize(Isolate* isolate); bool has_lock_; bool top_level_; internal::Isolate* isolate_; - - // Disallow copying and assigning. - Locker(const Locker&); - void operator=(const Locker&); }; diff --git a/deps/v8/infra/mb/mb_config.pyl b/deps/v8/infra/mb/mb_config.pyl index edfd2543167185..394bb55925f33b 100644 --- a/deps/v8/infra/mb/mb_config.pyl +++ b/deps/v8/infra/mb/mb_config.pyl @@ -9,12 +9,18 @@ # Bots are ordered by appearance on waterfall. 'masters': { 'developer_default': { + 'arm.debug': 'default_debug_arm', + 'arm.optdebug': 'default_optdebug_arm', + 'arm.release': 'default_release_arm', + 'arm64.debug': 'default_debug_arm64', + 'arm64.optdebug': 'default_optdebug_arm64', + 'arm64.release': 'default_release_arm64', + 'ia32.debug': 'default_debug_x86', + 'ia32.optdebug': 'default_optdebug_x86', + 'ia32.release': 'default_release_x86', 'x64.debug': 'default_debug_x64', 'x64.optdebug': 'default_optdebug_x64', 'x64.release': 'default_release_x64', - 'x86.debug': 'default_debug_x86', - 'x86.optdebug': 'default_optdebug_x86', - 'x86.release': 'default_release_x86', }, 'client.dart.fyi': { @@ -32,7 +38,7 @@ 'V8 Linux - nosnap builder': 'gn_release_x86_no_snap', 'V8 Linux - nosnap debug builder': 'gn_debug_x86_no_snap', 'V8 Linux - shared': 'gn_release_x86_shared_verify_heap', - 'V8 Linux - noi18n - debug': 'gyp_debug_x86_no_i18n', + 'V8 Linux - noi18n - debug': 'gn_debug_x86_no_i18n', # Linux64. 'V8 Linux64 - builder': 'gn_release_x64', 'V8 Linux64 - debug builder': 'gn_debug_x64_valgrind', @@ -40,34 +46,35 @@ 'V8 Linux64 - internal snapshot': 'gn_release_x64_internal', 'V8 Linux64 - gyp': 'gyp_release_x64', # Windows. - 'V8 Win32 - builder': 'gyp_release_x86_minimal_symbols', - 'V8 Win32 - debug builder': 'gyp_debug_x86_minimal_symbols', + 'V8 Win32 - builder': 'gn_release_x86_minimal_symbols', + 'V8 Win32 - debug builder': 'gn_debug_x86_minimal_symbols', 'V8 Win32 - nosnap - shared': - 'gyp_release_x86_no_snap_shared_minimal_symbols', - 'V8 Win64': 'gyp_release_x64_minimal_symbols', - 'V8 Win64 - debug': 'gyp_debug_x64_minimal_symbols', - 'V8 Win64 - clang': 'gyp_release_x64_clang', + 'gn_release_x86_no_snap_shared_minimal_symbols', + 'V8 Win64': 'gn_release_x64_minimal_symbols', + 'V8 Win64 - debug': 'gn_debug_x64_minimal_symbols', + # TODO(machenbach): Switch plugins on when errors are fixed. + 'V8 Win64 - clang': 'gn_release_x64_clang_no_plugins', # Mac. 'V8 Mac': 'gn_release_x86', 'V8 Mac - debug': 'gn_debug_x86', 'V8 Mac64': 'gn_release_x64', 'V8 Mac64 - debug': 'gn_debug_x64', 'V8 Mac GC Stress': 'gn_debug_x86', - 'V8 Mac64 ASAN': 'gyp_release_x64_asan', + 'V8 Mac64 ASAN': 'gn_release_x64_asan_no_lsan', # Sanitizers. - 'V8 Linux64 ASAN': 'gyp_release_x64_asan', + 'V8 Linux64 ASAN': 'gn_release_x64_asan', 'V8 Linux64 TSAN': 'gn_release_x64_tsan', 'V8 Linux - arm64 - sim - MSAN': 'gn_release_simulate_arm64_msan', # Clusterfuzz. 'V8 Linux64 ASAN no inline - release builder': - 'gyp_release_x64_asan_symbolized_edge_verify_heap', - 'V8 Linux64 ASAN - debug builder': 'gyp_debug_x64_asan_edge', + 'gn_release_x64_asan_symbolized_edge_verify_heap', + 'V8 Linux64 ASAN - debug builder': 'gn_debug_x64_asan_edge', 'V8 Linux64 ASAN arm64 - debug builder': - 'gyp_debug_simulate_arm64_asan_edge', + 'gn_debug_simulate_arm64_asan_edge', 'V8 Linux ASAN arm - debug builder': - 'gyp_debug_simulate_arm_asan_edge', + 'gn_debug_simulate_arm_asan_edge', 'V8 Linux ASAN mipsel - debug builder': - 'gyp_debug_simulate_mipsel_asan_edge', + 'gn_debug_simulate_mipsel_asan_edge', # Misc. 'V8 Linux gcc 4.8': 'gn_release_x86_gcc', # FYI. @@ -86,13 +93,13 @@ 'client.v8.ports': { # Arm. - 'V8 Arm - builder': 'gyp_release_arm', - 'V8 Arm - debug builder': 'gyp_debug_arm', - 'V8 Android Arm - builder': 'gyp_release_android_arm', - 'V8 Linux - arm - sim': 'gyp_release_simulate_arm', - 'V8 Linux - arm - sim - debug': 'gyp_debug_simulate_arm', + 'V8 Arm - builder': 'gn_release_arm', + 'V8 Arm - debug builder': 'gn_debug_arm', + 'V8 Android Arm - builder': 'gn_release_android_arm', + 'V8 Linux - arm - sim': 'gn_release_simulate_arm', + 'V8 Linux - arm - sim - debug': 'gn_debug_simulate_arm', # Arm64. - 'V8 Android Arm64 - builder': 'gyp_release_android_arm64', + 'V8 Android Arm64 - builder': 'gn_release_android_arm64', 'V8 Linux - arm64 - sim': 'gn_release_simulate_arm64', 'V8 Linux - arm64 - sim - debug': 'gn_debug_simulate_arm64', 'V8 Linux - arm64 - sim - nosnap - debug': @@ -100,8 +107,8 @@ 'V8 Linux - arm64 - sim - gc stress': 'gn_debug_simulate_arm64', # Mips. 'V8 Mips - builder': 'gyp_release_mips_no_snap_no_i18n', - 'V8 Linux - mipsel - sim - builder': 'gyp_release_simulate_mipsel', - 'V8 Linux - mips64el - sim - builder': 'gyp_release_simulate_mips64el', + 'V8 Linux - mipsel - sim - builder': 'gn_release_simulate_mipsel', + 'V8 Linux - mips64el - sim - builder': 'gn_release_simulate_mips64el', # PPC. 'V8 Linux - ppc - sim': 'gyp_release_simulate_ppc', 'V8 Linux - ppc64 - sim': 'gyp_release_simulate_ppc64', @@ -117,18 +124,18 @@ 'V8 Linux - beta branch - debug': 'gn_debug_x86', 'V8 Linux - stable branch': 'gn_release_x86', 'V8 Linux - stable branch - debug': 'gn_debug_x86', - 'V8 Linux64 - beta branch': 'gyp_release_x64', + 'V8 Linux64 - beta branch': 'gn_release_x64', 'V8 Linux64 - beta branch - debug': 'gn_debug_x64', 'V8 Linux64 - stable branch': 'gn_release_x64', 'V8 Linux64 - stable branch - debug': 'gn_debug_x64', - 'V8 arm - sim - beta branch': 'gyp_release_simulate_arm', - 'V8 arm - sim - beta branch - debug': 'gyp_debug_simulate_arm', - 'V8 arm - sim - stable branch': 'gyp_release_simulate_arm', - 'V8 arm - sim - stable branch - debug': 'gyp_debug_simulate_arm', - 'V8 mips64el - sim - beta branch': 'gyp_release_simulate_mips64el', - 'V8 mips64el - sim - stable branch': 'gyp_release_simulate_mips64el', - 'V8 mipsel - sim - beta branch': 'gyp_release_simulate_mipsel', - 'V8 mipsel - sim - stable branch': 'gyp_release_simulate_mipsel', + 'V8 arm - sim - beta branch': 'gn_release_simulate_arm', + 'V8 arm - sim - beta branch - debug': 'gn_debug_simulate_arm', + 'V8 arm - sim - stable branch': 'gn_release_simulate_arm', + 'V8 arm - sim - stable branch - debug': 'gn_debug_simulate_arm', + 'V8 mips64el - sim - beta branch': 'gn_release_simulate_mips64el', + 'V8 mips64el - sim - stable branch': 'gn_release_simulate_mips64el', + 'V8 mipsel - sim - beta branch': 'gn_release_simulate_mipsel', + 'V8 mipsel - sim - stable branch': 'gn_release_simulate_mipsel', 'V8 ppc - sim - beta branch': 'gyp_release_simulate_ppc', 'V8 ppc - sim - stable branch': 'gyp_release_simulate_ppc', 'V8 ppc64 - sim - beta branch': 'gyp_release_simulate_ppc64', @@ -143,8 +150,8 @@ 'v8_linux_avx2_dbg': 'gn_debug_x86_trybot', 'v8_linux_nodcheck_rel_ng': 'gn_release_x86_minimal_symbols', 'v8_linux_dbg_ng': 'gn_debug_x86_trybot', - 'v8_linux_noi18n_rel_ng': 'gyp_release_x86_no_i18n_trybot', - 'v8_linux_gc_stress_dbg': 'gyp_debug_x86_trybot', + 'v8_linux_noi18n_rel_ng': 'gn_release_x86_no_i18n_trybot', + 'v8_linux_gc_stress_dbg': 'gn_debug_x86_trybot', 'v8_linux_nosnap_rel': 'gn_release_x86_no_snap_trybot', 'v8_linux_nosnap_dbg': 'gn_debug_x86_no_snap_trybot', 'v8_linux_gcc_compile_rel': 'gn_release_x86_gcc_minimal_symbols', @@ -153,34 +160,34 @@ 'v8_linux64_gyp_rel_ng': 'gyp_release_x64', 'v8_linux64_avx2_rel_ng': 'gn_release_x64_trybot', 'v8_linux64_avx2_dbg': 'gn_debug_x64_trybot', - 'v8_linux64_asan_rel_ng': 'gyp_release_x64_asan_minimal_symbols', + 'v8_linux64_asan_rel_ng': 'gn_release_x64_asan_minimal_symbols', 'v8_linux64_msan_rel': 'gn_release_simulate_arm64_msan_minimal_symbols', 'v8_linux64_sanitizer_coverage_rel': 'gyp_release_x64_asan_minimal_symbols_coverage', 'v8_linux64_tsan_rel': 'gn_release_x64_tsan_minimal_symbols', - 'v8_win_dbg': 'gyp_debug_x86_trybot', - 'v8_win_compile_dbg': 'gyp_debug_x86_trybot', - 'v8_win_rel_ng': 'gyp_release_x86_trybot', + 'v8_win_dbg': 'gn_debug_x86_trybot', + 'v8_win_compile_dbg': 'gn_debug_x86_trybot', + 'v8_win_rel_ng': 'gn_release_x86_trybot', 'v8_win_nosnap_shared_rel_ng': - 'gyp_release_x86_no_snap_shared_minimal_symbols', - 'v8_win64_dbg': 'gyp_debug_x64_minimal_symbols', - 'v8_win64_rel_ng': 'gyp_release_x64_trybot', + 'gn_release_x86_no_snap_shared_minimal_symbols', + 'v8_win64_dbg': 'gn_debug_x64_minimal_symbols', + 'v8_win64_rel_ng': 'gn_release_x64_trybot', 'v8_mac_rel_ng': 'gn_release_x86_trybot', 'v8_mac_dbg': 'gn_debug_x86_trybot', 'v8_mac_gc_stress_dbg': 'gn_debug_x86_trybot', 'v8_mac64_rel': 'gn_release_x64_trybot', 'v8_mac64_dbg': 'gn_debug_x64_minimal_symbols', - 'v8_mac64_asan_rel': 'gyp_release_x64_asan', - 'v8_linux_arm_rel_ng': 'gyp_release_simulate_arm_trybot', - 'v8_linux_arm_dbg': 'gyp_debug_simulate_arm', - 'v8_linux_arm_armv8a_rel': 'gyp_release_simulate_arm_trybot', - 'v8_linux_arm_armv8a_dbg': 'gyp_debug_simulate_arm', + 'v8_mac64_asan_rel': 'gn_release_x64_asan_no_lsan', + 'v8_linux_arm_rel_ng': 'gn_release_simulate_arm_trybot', + 'v8_linux_arm_dbg': 'gn_debug_simulate_arm', + 'v8_linux_arm_armv8a_rel': 'gn_release_simulate_arm_trybot', + 'v8_linux_arm_armv8a_dbg': 'gn_debug_simulate_arm', 'v8_linux_arm64_rel_ng': 'gn_release_simulate_arm64_trybot', 'v8_linux_arm64_dbg': 'gn_debug_simulate_arm64', 'v8_linux_arm64_gc_stress_dbg': 'gn_debug_simulate_arm64', - 'v8_linux_mipsel_compile_rel': 'gyp_release_simulate_mipsel', - 'v8_linux_mips64el_compile_rel': 'gyp_release_simulate_mips64el', - 'v8_android_arm_compile_rel': 'gyp_release_android_arm', + 'v8_linux_mipsel_compile_rel': 'gn_release_simulate_mipsel', + 'v8_linux_mips64el_compile_rel': 'gn_release_simulate_mips64el', + 'v8_android_arm_compile_rel': 'gn_release_android_arm', }, }, @@ -189,6 +196,20 @@ # gyp/gn, release/debug, arch type, other values alphabetically. 'configs': { # Developer default configs. + 'default_debug_arm': [ + 'gn', 'debug', 'simulate_arm', 'v8_enable_slow_dchecks', + 'v8_full_debug'], + 'default_optdebug_arm': [ + 'gn', 'debug', 'simulate_arm', 'v8_enable_slow_dchecks'], + 'default_release_arm': [ + 'gn', 'release', 'simulate_arm'], + 'default_debug_arm64': [ + 'gn', 'debug', 'simulate_arm64', 'v8_enable_slow_dchecks', + 'v8_full_debug'], + 'default_optdebug_arm64': [ + 'gn', 'debug', 'simulate_arm64', 'v8_enable_slow_dchecks'], + 'default_release_arm64': [ + 'gn', 'release', 'simulate_arm64'], 'default_debug_x64': [ 'gn', 'debug', 'x64', 'v8_enable_slow_dchecks', 'v8_full_debug'], 'default_optdebug_x64': [ @@ -204,12 +225,24 @@ # GN debug configs for simulators. + 'gn_debug_simulate_arm': [ + 'gn', 'debug_bot', 'simulate_arm', 'swarming'], + 'gn_debug_simulate_arm_asan_edge': [ + 'gn', 'debug_bot', 'simulate_arm', 'asan', 'edge'], 'gn_debug_simulate_arm64': [ 'gn', 'debug_bot', 'simulate_arm64', 'swarming'], + 'gn_debug_simulate_arm64_asan_edge': [ + 'gn', 'debug_bot', 'simulate_arm64', 'asan', 'lsan', 'edge'], 'gn_debug_simulate_arm64_no_snap': [ 'gn', 'debug_bot', 'simulate_arm64', 'swarming', 'v8_snapshot_none'], + 'gn_debug_simulate_mipsel_asan_edge': [ + 'gn', 'debug_bot', 'simulate_mipsel', 'asan', 'edge'], # GN release configs for simulators. + 'gn_release_simulate_arm': [ + 'gn', 'release_bot', 'simulate_arm', 'swarming'], + 'gn_release_simulate_arm_trybot': [ + 'gn', 'release_trybot', 'simulate_arm', 'swarming'], 'gn_release_simulate_arm64': [ 'gn', 'release_bot', 'simulate_arm64', 'swarming'], 'gn_release_simulate_arm64_msan': [ @@ -219,12 +252,42 @@ 'swarming'], 'gn_release_simulate_arm64_trybot': [ 'gn', 'release_trybot', 'simulate_arm64', 'swarming'], + 'gn_release_simulate_mipsel': [ + 'gn', 'release_bot', 'simulate_mipsel', 'swarming'], + 'gn_release_simulate_mips64el': [ + 'gn', 'release_bot', 'simulate_mips64el', 'swarming'], + + # GN debug configs for arm. + 'gn_debug_arm': [ + 'gn', 'debug_bot', 'arm', 'crosscompile', 'hard_float', 'swarming'], + + # GN release configs for arm. + 'gn_release_arm': [ + 'gn', 'release_bot', 'arm', 'crosscompile', 'hard_float', 'swarming'], + 'gn_release_android_arm': [ + 'gn', 'release_bot', 'arm', 'android', 'crosscompile', 'swarming'], + 'gn_release_android_arm64': [ + 'gn', 'release_bot', 'arm64', 'android', 'crosscompile', 'swarming'], # GN release configs for x64. 'gn_release_x64': [ 'gn', 'release_bot', 'x64', 'swarming'], + 'gn_release_x64_asan': [ + 'gn', 'release_bot', 'x64', 'asan', 'lsan', 'swarming'], + 'gn_release_x64_asan_minimal_symbols': [ + 'gn', 'release_bot', 'x64', 'asan', 'lsan', 'minimal_symbols', + 'swarming'], + 'gn_release_x64_asan_no_lsan': [ + 'gn', 'release_bot', 'x64', 'asan', 'swarming'], + 'gn_release_x64_asan_symbolized_edge_verify_heap': [ + 'gn', 'release_bot', 'x64', 'asan', 'edge', 'lsan', 'symbolized', + 'v8_verify_heap'], + 'gn_release_x64_clang_no_plugins': [ + 'gn', 'release_bot', 'x64', 'clang', 'no_plugins', 'swarming'], 'gn_release_x64_internal': [ 'gn', 'release_bot', 'x64', 'swarming', 'v8_snapshot_internal'], + 'gn_release_x64_minimal_symbols': [ + 'gn', 'release_bot', 'x64', 'minimal_symbols', 'swarming'], 'gn_release_x64_trybot': [ 'gn', 'release_trybot', 'x64', 'swarming'], 'gn_release_x64_tsan': [ @@ -235,6 +298,8 @@ # GN debug configs for x64. 'gn_debug_x64': [ 'gn', 'debug_bot', 'x64', 'swarming'], + 'gn_debug_x64_asan_edge': [ + 'gn', 'debug_bot', 'x64', 'asan', 'lsan', 'edge'], 'gn_debug_x64_custom': [ 'gn', 'debug_bot', 'x64', 'swarming', 'v8_snapshot_custom'], 'gn_debug_x64_minimal_symbols': [ @@ -247,6 +312,10 @@ # GN debug configs for x86. 'gn_debug_x86': [ 'gn', 'debug_bot', 'x86', 'swarming'], + 'gn_debug_x86_minimal_symbols': [ + 'gn', 'debug_bot', 'x86', 'minimal_symbols', 'swarming'], + 'gn_debug_x86_no_i18n': [ + 'gn', 'debug_bot', 'x86', 'v8_no_i18n'], 'gn_debug_x86_no_snap': [ 'gn', 'debug_bot', 'x86', 'swarming', 'v8_snapshot_none'], 'gn_debug_x86_no_snap_trybot': [ @@ -267,8 +336,13 @@ 'gn', 'release_trybot', 'x86', 'gcmole', 'swarming'], 'gn_release_x86_minimal_symbols': [ 'gn', 'release_bot', 'x86', 'minimal_symbols', 'swarming'], + 'gn_release_x86_no_i18n_trybot': [ + 'gn', 'release_trybot', 'x86', 'swarming', 'v8_no_i18n'], 'gn_release_x86_no_snap': [ 'gn', 'release_bot', 'x86', 'swarming', 'v8_snapshot_none'], + 'gn_release_x86_no_snap_shared_minimal_symbols': [ + 'gn', 'release', 'x86', 'goma', 'minimal_symbols', 'shared', 'swarming', + 'v8_snapshot_none'], 'gn_release_x86_no_snap_trybot': [ 'gn', 'release_trybot', 'x86', 'swarming', 'v8_snapshot_none'], 'gn_release_x86_shared_verify_heap': [ @@ -276,65 +350,25 @@ 'gn_release_x86_trybot': [ 'gn', 'release_trybot', 'x86', 'swarming'], - # Gyp debug configs for arm. - 'gyp_debug_arm': [ - 'gyp', 'debug_bot', 'arm', 'crosscompile', 'hard_float', 'swarming'], - # Gyp debug configs for simulators. - 'gyp_debug_simulate_arm': [ - 'gyp', 'debug_bot', 'simulate_arm', 'swarming'], - 'gyp_debug_simulate_arm_asan_edge': [ - 'gyp', 'debug_bot', 'simulate_arm', 'asan', 'edge'], - 'gyp_debug_simulate_arm64_asan_edge': [ - 'gyp', 'debug_bot', 'simulate_arm64', 'asan', 'lsan', 'edge'], - 'gyp_debug_simulate_mipsel_asan_edge': [ - 'gyp', 'debug_bot', 'simulate_mipsel', 'asan', 'edge'], 'gyp_debug_simulate_x87_no_snap': [ 'gyp', 'debug_bot', 'simulate_x87', 'swarming', 'v8_snapshot_none'], - # Gyp debug configs for x64. - 'gyp_debug_x64_asan_edge': [ - 'gyp', 'debug_bot', 'x64', 'asan', 'lsan', 'edge'], - 'gyp_debug_x64_minimal_symbols': [ - 'gyp', 'debug_bot', 'x64', 'minimal_symbols', 'swarming'], - # Gyp debug configs for x86. 'gyp_debug_x86': [ 'gyp', 'debug_bot', 'x86', 'swarming'], - 'gyp_debug_x86_minimal_symbols': [ - 'gyp', 'debug_bot', 'x86', 'minimal_symbols', 'swarming'], - 'gyp_debug_x86_trybot': [ - 'gyp', 'debug_trybot', 'x86', 'swarming'], - 'gyp_debug_x86_no_i18n': [ - 'gyp', 'debug_bot', 'x86', 'v8_no_i18n'], 'gyp_debug_x86_vtunejit': [ 'gyp', 'debug_bot', 'x86', 'v8_enable_vtunejit'], 'gyp_full_debug_x86': [ 'gyp', 'debug', 'x86', 'goma', 'static', 'v8_enable_slow_dchecks', 'v8_full_debug'], - # Gyp release configs for arm. - 'gyp_release_arm': [ - 'gyp', 'release_bot', 'arm', 'crosscompile', 'hard_float', 'swarming'], - 'gyp_release_android_arm': [ - 'gyp', 'release_bot', 'arm', 'android', 'crosscompile', 'swarming'], - 'gyp_release_android_arm64': [ - 'gyp', 'release_bot', 'arm64', 'android', 'crosscompile', 'swarming'], - # Gyp release configs for mips. 'gyp_release_mips_no_snap_no_i18n': [ 'gyp', 'release', 'mips', 'crosscompile', 'static', 'v8_no_i18n', 'v8_snapshot_none'], # Gyp release configs for simulators. - 'gyp_release_simulate_arm': [ - 'gyp', 'release_bot', 'simulate_arm', 'swarming'], - 'gyp_release_simulate_arm_trybot': [ - 'gyp', 'release_trybot', 'simulate_arm', 'swarming'], - 'gyp_release_simulate_mipsel': [ - 'gyp', 'release_bot', 'simulate_mipsel', 'swarming'], - 'gyp_release_simulate_mips64el': [ - 'gyp', 'release_bot', 'simulate_mips64el', 'swarming'], 'gyp_release_simulate_ppc': [ 'gyp', 'release_bot', 'simulate_ppc', 'swarming'], 'gyp_release_simulate_ppc64': [ @@ -347,44 +381,21 @@ # Gyp release configs for x64. 'gyp_release_x64': [ 'gyp', 'release_bot', 'x64', 'swarming'], - 'gyp_release_x64_asan': [ - 'gyp', 'release_bot', 'x64', 'asan', 'lsan', 'swarming'], - 'gyp_release_x64_asan_minimal_symbols': [ - 'gyp', 'release_bot', 'x64', 'asan', 'lsan', 'minimal_symbols', - 'swarming'], 'gyp_release_x64_asan_minimal_symbols_coverage': [ 'gyp', 'release_bot', 'x64', 'asan', 'bb', 'coverage', 'lsan', 'minimal_symbols', 'swarming'], - 'gyp_release_x64_asan_symbolized_edge_verify_heap': [ - 'gyp', 'release_bot', 'x64', 'asan', 'edge', 'lsan', 'symbolized', - 'v8_verify_heap'], 'gyp_release_x64_cfi_symbolized': [ 'gyp', 'release_bot', 'x64', 'cfi', 'swarming', 'symbolized'], - 'gyp_release_x64_clang': [ - 'gyp', 'release_bot', 'x64', 'clang', 'swarming'], 'gyp_release_x64_gcc_coverage': [ 'gyp', 'release_bot', 'x64', 'coverage', 'gcc'], - 'gyp_release_x64_minimal_symbols': [ - 'gyp', 'release_bot', 'x64', 'minimal_symbols', 'swarming'], - 'gyp_release_x64_trybot': [ - 'gyp', 'release_trybot', 'x64', 'swarming'], # Gyp release configs for x86. 'gyp_release_x86_disassembler': [ 'gyp', 'release_bot', 'x86', 'v8_enable_disassembler'], 'gyp_release_x86_interpreted_regexp': [ 'gyp', 'release_bot', 'x86', 'v8_interpreted_regexp'], - 'gyp_release_x86_minimal_symbols': [ - 'gyp', 'release_bot', 'x86', 'minimal_symbols', 'swarming'], - 'gyp_release_x86_no_i18n_trybot': [ - 'gyp', 'release_trybot', 'x86', 'swarming', 'v8_no_i18n'], - 'gyp_release_x86_no_snap_shared_minimal_symbols': [ - 'gyp', 'release', 'x86', 'goma', 'minimal_symbols', 'shared', 'swarming', - 'v8_snapshot_none'], 'gyp_release_x86_predictable': [ 'gyp', 'release_bot', 'x86', 'v8_enable_verify_predictable'], - 'gyp_release_x86_trybot': [ - 'gyp', 'release_trybot', 'x86', 'swarming'], }, 'mixins': { @@ -505,6 +516,10 @@ 'use_prebuilt_instrumented_libraries=1'), }, + 'no_plugins': { + 'gn_args': 'clang_use_chrome_plugins=false', + }, + 'release': { 'gn_args': 'is_debug=false', }, @@ -533,7 +548,8 @@ }, 'simulate_mipsel': { - 'gn_args': 'target_cpu="x86" v8_target_cpu="mipsel"', + 'gn_args': + 'target_cpu="x86" v8_target_cpu="mipsel" mips_arch_variant="r2"', 'gyp_defines': 'target_arch=ia32 v8_target_arch=mipsel', }, @@ -577,9 +593,9 @@ 'gyp_defines': 'test_isolation_mode=prepare', }, - # TODO(machenbach): Remove the symbolized config after the bots are gone. + # TODO(machenbach): Remove the symbolized config after the bots are gone. 'symbolized': { - 'gn_args': 'symbolized=true', + 'gn_args': 'v8_no_inline=true', 'gyp_defines': 'release_extra_cflags="-fno-inline-functions -fno-inline"', }, @@ -595,8 +611,8 @@ }, 'v8_no_i18n': { - 'gn_args': 'v8_enable_i18n_support=false', - 'gyp_defines': 'v8_enable_i18n_support=0', + 'gn_args': 'v8_enable_i18n_support=false icu_use_data_file=false', + 'gyp_defines': 'v8_enable_i18n_support=0 icu_use_data_file_flag=0', }, 'v8_enable_disassembler': { diff --git a/deps/v8/src/api-arguments-inl.h b/deps/v8/src/api-arguments-inl.h index eefdf35adc0e1f..bf72fc4e6f44f5 100644 --- a/deps/v8/src/api-arguments-inl.h +++ b/deps/v8/src/api-arguments-inl.h @@ -20,8 +20,6 @@ namespace internal { Handle name) { \ Isolate* isolate = this->isolate(); \ RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \ - TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( \ - isolate, &tracing::TraceEventStatsTable::Function); \ VMState state(isolate); \ ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ PropertyCallbackInfo info(begin()); \ @@ -46,8 +44,6 @@ FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(WRITE_CALL_1_NAME) uint32_t index) { \ Isolate* isolate = this->isolate(); \ RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \ - TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( \ - isolate, &tracing::TraceEventStatsTable::Function); \ VMState state(isolate); \ ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ PropertyCallbackInfo info(begin()); \ @@ -68,9 +64,6 @@ Handle PropertyCallbackArguments::Call( Isolate* isolate = this->isolate(); RuntimeCallTimerScope timer( isolate, &RuntimeCallStats::GenericNamedPropertySetterCallback); - TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( - isolate, - &tracing::TraceEventStatsTable::GenericNamedPropertySetterCallback); VMState state(isolate); ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); PropertyCallbackInfo info(begin()); @@ -80,14 +73,27 @@ Handle PropertyCallbackArguments::Call( return GetReturnValue(isolate); } +Handle PropertyCallbackArguments::Call( + GenericNamedPropertyDefinerCallback f, Handle name, + const v8::PropertyDescriptor& desc) { + Isolate* isolate = this->isolate(); + RuntimeCallTimerScope timer( + isolate, &RuntimeCallStats::GenericNamedPropertyDefinerCallback); + VMState state(isolate); + ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); + PropertyCallbackInfo info(begin()); + LOG(isolate, + ApiNamedPropertyAccess("interceptor-named-define", holder(), *name)); + f(v8::Utils::ToLocal(name), desc, info); + return GetReturnValue(isolate); +} + Handle PropertyCallbackArguments::Call(IndexedPropertySetterCallback f, uint32_t index, Handle value) { Isolate* isolate = this->isolate(); RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::IndexedPropertySetterCallback); - TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( - isolate, &tracing::TraceEventStatsTable::IndexedPropertySetterCallback); VMState state(isolate); ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); PropertyCallbackInfo info(begin()); @@ -97,13 +103,26 @@ Handle PropertyCallbackArguments::Call(IndexedPropertySetterCallback f, return GetReturnValue(isolate); } +Handle PropertyCallbackArguments::Call( + IndexedPropertyDefinerCallback f, uint32_t index, + const v8::PropertyDescriptor& desc) { + Isolate* isolate = this->isolate(); + RuntimeCallTimerScope timer( + isolate, &RuntimeCallStats::IndexedPropertyDefinerCallback); + VMState state(isolate); + ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); + PropertyCallbackInfo info(begin()); + LOG(isolate, + ApiIndexedPropertyAccess("interceptor-indexed-define", holder(), index)); + f(index, desc, info); + return GetReturnValue(isolate); +} + void PropertyCallbackArguments::Call(AccessorNameSetterCallback f, Handle name, Handle value) { Isolate* isolate = this->isolate(); RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::AccessorNameSetterCallback); - TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( - isolate, &tracing::TraceEventStatsTable::AccessorNameSetterCallback); VMState state(isolate); ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); PropertyCallbackInfo info(begin()); diff --git a/deps/v8/src/api-arguments.cc b/deps/v8/src/api-arguments.cc index 6e347c7b6217c2..f8d6c8fcc3ddda 100644 --- a/deps/v8/src/api-arguments.cc +++ b/deps/v8/src/api-arguments.cc @@ -13,8 +13,6 @@ namespace internal { Handle FunctionCallbackArguments::Call(FunctionCallback f) { Isolate* isolate = this->isolate(); RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::FunctionCallback); - TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( - isolate, &internal::tracing::TraceEventStatsTable::FunctionCallback); VMState state(isolate); ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); FunctionCallbackInfo info(begin(), argv_, argc_); @@ -26,8 +24,6 @@ Handle PropertyCallbackArguments::Call( IndexedPropertyEnumeratorCallback f) { Isolate* isolate = this->isolate(); RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::PropertyCallback); - TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( - isolate, &internal::tracing::TraceEventStatsTable::PropertyCallback); VMState state(isolate); ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); PropertyCallbackInfo info(begin()); diff --git a/deps/v8/src/api-arguments.h b/deps/v8/src/api-arguments.h index 0dfe61824a9821..9e01f3ae7db0ae 100644 --- a/deps/v8/src/api-arguments.h +++ b/deps/v8/src/api-arguments.h @@ -119,9 +119,16 @@ class PropertyCallbackArguments inline Handle Call(GenericNamedPropertySetterCallback f, Handle name, Handle value); + inline Handle Call(GenericNamedPropertyDefinerCallback f, + Handle name, + const v8::PropertyDescriptor& desc); + inline Handle Call(IndexedPropertySetterCallback f, uint32_t index, Handle value); + inline Handle Call(IndexedPropertyDefinerCallback f, uint32_t index, + const v8::PropertyDescriptor& desc); + inline void Call(AccessorNameSetterCallback f, Handle name, Handle value); diff --git a/deps/v8/src/api-natives.cc b/deps/v8/src/api-natives.cc index 0f3c3b69ed85fb..4bd823684897a3 100644 --- a/deps/v8/src/api-natives.cc +++ b/deps/v8/src/api-natives.cc @@ -199,15 +199,14 @@ MaybeHandle ConfigureInstance(Isolate* isolate, Handle obj, Handle array = isolate->factory()->NewFixedArray(max_number_of_properties); - info = *data; - while (info != nullptr) { + for (Handle temp(*data); *temp != nullptr; + temp = handle(temp->GetParent(isolate), isolate)) { // Accumulate accessors. - Object* maybe_properties = info->property_accessors(); + Object* maybe_properties = temp->property_accessors(); if (!maybe_properties->IsUndefined(isolate)) { valid_descriptors = AccessorInfo::AppendUnique( handle(maybe_properties, isolate), array, valid_descriptors); } - info = info->GetParent(isolate); } // Install accumulated accessors. diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index 6858a325c40a86..67b5b1ab20c589 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -24,6 +24,7 @@ #include "src/base/functional.h" #include "src/base/platform/platform.h" #include "src/base/platform/time.h" +#include "src/base/safe_conversions.h" #include "src/base/utils/random-number-generator.h" #include "src/bootstrapper.h" #include "src/char-predicates-inl.h" @@ -68,6 +69,7 @@ #include "src/unicode-inl.h" #include "src/v8.h" #include "src/v8threads.h" +#include "src/value-serializer.h" #include "src/version.h" #include "src/vm-state-inl.h" #include "src/wasm/wasm-module.h" @@ -77,9 +79,6 @@ namespace v8 { #define LOG_API(isolate, class_name, function_name) \ i::RuntimeCallTimerScope _runtime_timer( \ isolate, &i::RuntimeCallStats::API_##class_name##_##function_name); \ - TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( \ - isolate, &internal::tracing::TraceEventStatsTable:: \ - API_##class_name##_##function_name); \ LOG(isolate, ApiEntryCall("v8::" #class_name "::" #function_name)) #define ENTER_V8(isolate) i::VMState __state__((isolate)) @@ -105,6 +104,16 @@ namespace v8 { PREPARE_FOR_EXECUTION_GENERIC(isolate, context, class_name, function_name, \ bailout_value, HandleScopeClass, do_callback); +#define PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE( \ + category, name, context, class_name, function_name, bailout_value, \ + HandleScopeClass, do_callback) \ + auto isolate = context.IsEmpty() \ + ? i::Isolate::Current() \ + : reinterpret_cast(context->GetIsolate()); \ + TRACE_EVENT_CALL_STATS_SCOPED(isolate, category, name); \ + PREPARE_FOR_EXECUTION_GENERIC(isolate, context, class_name, function_name, \ + bailout_value, HandleScopeClass, do_callback); + #define PREPARE_FOR_EXECUTION_WITH_ISOLATE(isolate, class_name, function_name, \ T) \ PREPARE_FOR_EXECUTION_GENERIC(isolate, Local(), class_name, \ @@ -513,7 +522,8 @@ StartupData SnapshotCreator::CreateBlob( // If we don't do this then we end up with a stray root pointing at the // context even after we have disposed of the context. - isolate->heap()->CollectAllAvailableGarbage("mksnapshot"); + isolate->heap()->CollectAllAvailableGarbage( + i::GarbageCollectionReason::kSnapshotCreator); isolate->heap()->CompactWeakFixedArrays(); i::DisallowHeapAllocation no_gc_from_here_on; @@ -1503,12 +1513,17 @@ void ObjectTemplate::SetAccessor(v8::Local name, signature, i::FLAG_disable_old_api_accessors); } -template +template static i::Handle CreateInterceptorInfo( i::Isolate* isolate, Getter getter, Setter setter, Query query, - Deleter remover, Enumerator enumerator, Local data, - PropertyHandlerFlags flags) { + Descriptor descriptor, Deleter remover, Enumerator enumerator, + Definer definer, Local data, PropertyHandlerFlags flags) { + DCHECK(query == nullptr || + descriptor == nullptr); // Either intercept attributes or descriptor. + DCHECK(query == nullptr || + definer == + nullptr); // Only use descriptor callback with definer callback. auto obj = i::Handle::cast( isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE)); obj->set_flags(0); @@ -1516,8 +1531,10 @@ static i::Handle CreateInterceptorInfo( if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); + if (descriptor != 0) SET_FIELD_WRAPPED(obj, set_descriptor, descriptor); if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); + if (definer != 0) SET_FIELD_WRAPPED(obj, set_definer, definer); obj->set_can_intercept_symbols( !(static_cast(flags) & static_cast(PropertyHandlerFlags::kOnlyInterceptStrings))); @@ -1533,40 +1550,37 @@ static i::Handle CreateInterceptorInfo( return obj; } -template -static void ObjectTemplateSetNamedPropertyHandler(ObjectTemplate* templ, - Getter getter, Setter setter, - Query query, Deleter remover, - Enumerator enumerator, - Local data, - PropertyHandlerFlags flags) { +template +static void ObjectTemplateSetNamedPropertyHandler( + ObjectTemplate* templ, Getter getter, Setter setter, Query query, + Descriptor descriptor, Deleter remover, Enumerator enumerator, + Definer definer, Local data, PropertyHandlerFlags flags) { i::Isolate* isolate = Utils::OpenHandle(templ)->GetIsolate(); ENTER_V8(isolate); i::HandleScope scope(isolate); auto cons = EnsureConstructor(isolate, templ); EnsureNotInstantiated(cons, "ObjectTemplateSetNamedPropertyHandler"); - auto obj = CreateInterceptorInfo(isolate, getter, setter, query, remover, - enumerator, data, flags); + auto obj = CreateInterceptorInfo(isolate, getter, setter, query, descriptor, + remover, enumerator, definer, data, flags); cons->set_named_property_handler(*obj); } - void ObjectTemplate::SetNamedPropertyHandler( NamedPropertyGetterCallback getter, NamedPropertySetterCallback setter, NamedPropertyQueryCallback query, NamedPropertyDeleterCallback remover, NamedPropertyEnumeratorCallback enumerator, Local data) { ObjectTemplateSetNamedPropertyHandler( - this, getter, setter, query, remover, enumerator, data, + this, getter, setter, query, nullptr, remover, enumerator, nullptr, data, PropertyHandlerFlags::kOnlyInterceptStrings); } - void ObjectTemplate::SetHandler( const NamedPropertyHandlerConfiguration& config) { ObjectTemplateSetNamedPropertyHandler( - this, config.getter, config.setter, config.query, config.deleter, - config.enumerator, config.data, config.flags); + this, config.getter, config.setter, config.query, config.descriptor, + config.deleter, config.enumerator, config.definer, config.data, + config.flags); } @@ -1626,13 +1640,14 @@ void ObjectTemplate::SetAccessCheckCallbackAndHandler( SET_FIELD_WRAPPED(info, set_callback, callback); auto named_interceptor = CreateInterceptorInfo( isolate, named_handler.getter, named_handler.setter, named_handler.query, - named_handler.deleter, named_handler.enumerator, named_handler.data, - named_handler.flags); + named_handler.descriptor, named_handler.deleter, named_handler.enumerator, + named_handler.definer, named_handler.data, named_handler.flags); info->set_named_interceptor(*named_interceptor); auto indexed_interceptor = CreateInterceptorInfo( isolate, indexed_handler.getter, indexed_handler.setter, - indexed_handler.query, indexed_handler.deleter, - indexed_handler.enumerator, indexed_handler.data, indexed_handler.flags); + indexed_handler.query, indexed_handler.descriptor, + indexed_handler.deleter, indexed_handler.enumerator, + indexed_handler.definer, indexed_handler.data, indexed_handler.flags); info->set_indexed_interceptor(*indexed_interceptor); if (data.IsEmpty()) { @@ -1651,9 +1666,10 @@ void ObjectTemplate::SetHandler( i::HandleScope scope(isolate); auto cons = EnsureConstructor(isolate, this); EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetHandler"); - auto obj = CreateInterceptorInfo( - isolate, config.getter, config.setter, config.query, config.deleter, - config.enumerator, config.data, config.flags); + auto obj = CreateInterceptorInfo(isolate, config.getter, config.setter, + config.query, config.descriptor, + config.deleter, config.enumerator, + config.definer, config.data, config.flags); cons->set_indexed_property_handler(*obj); } @@ -1834,17 +1850,29 @@ Local UnboundScript::GetSourceMappingURL() { MaybeLocal Script::Run(Local context) { - PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Script, Run, Value) + PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE( + "v8", "V8.Execute", context, Script, Run, MaybeLocal(), + InternalEscapableScope, true); i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true); i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy()); i::TimerEventScope timer_scope(isolate); - TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.Execute"); auto fun = i::Handle::cast(Utils::OpenHandle(this)); - i::Handle receiver = isolate->global_proxy(); + + i::Handle receiver; Local result; - has_pending_exception = - !ToLocal(i::Execution::Call(isolate, fun, receiver, 0, NULL), - &result); + + if (fun->shared()->scope_info()->scope_type() == i::MODULE_SCOPE) { + receiver = isolate->factory()->undefined_value(); + i::Handle argv[] = { + handle(isolate->native_context()->current_module())}; + has_pending_exception = !ToLocal( + i::Execution::Call(isolate, fun, receiver, 1, argv), &result); + } else { + receiver = isolate->global_proxy(); + has_pending_exception = !ToLocal( + i::Execution::Call(isolate, fun, receiver, 0, nullptr), &result); + } + RETURN_ON_FAILED_EXECUTION(Value); RETURN_ESCAPED(result); } @@ -1985,7 +2013,34 @@ MaybeLocal