From 42b4168d3224eb6ce37675c37161f39c7f5c0ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Fri, 12 Mar 2021 08:24:20 +0100 Subject: [PATCH 01/15] deps: update V8 to 9.0.257.11 --- deps/v8/AUTHORS | 12 + deps/v8/BUILD.gn | 662 ++- deps/v8/COMMON_OWNERS | 1 - deps/v8/DEPS | 46 +- deps/v8/OWNERS | 1 + deps/v8/PRESUBMIT.py | 8 +- deps/v8/RISCV_OWNERS | 3 + .../trace_event/common/trace_event_common.h | 209 +- deps/v8/gni/proto_library.gni | 191 +- deps/v8/gni/protoc.py | 51 + deps/v8/gni/snapshot_toolchain.gni | 3 +- deps/v8/gni/v8.gni | 18 + deps/v8/include/DEPS | 1 + deps/v8/include/OWNERS | 1 + deps/v8/include/cppgc/allocation.h | 19 +- deps/v8/include/cppgc/common.h | 15 +- .../include/cppgc/cross-thread-persistent.h | 46 +- deps/v8/include/cppgc/custom-space.h | 14 +- deps/v8/include/cppgc/ephemeron-pair.h | 5 + deps/v8/include/cppgc/heap-consistency.h | 117 +- deps/v8/include/cppgc/heap-state.h | 59 + deps/v8/include/cppgc/heap-statistics.h | 110 + .../cppgc/internal/caged-heap-local-data.h | 3 +- .../include/cppgc/internal/persistent-node.h | 8 + .../include/cppgc/internal/pointer-policies.h | 23 +- deps/v8/include/cppgc/internal/process-heap.h | 34 - .../v8/include/cppgc/internal/write-barrier.h | 246 +- deps/v8/include/cppgc/liveness-broker.h | 6 + deps/v8/include/cppgc/macros.h | 2 + deps/v8/include/cppgc/member.h | 33 +- deps/v8/include/cppgc/object-size-trait.h | 58 + deps/v8/include/cppgc/persistent.h | 38 +- deps/v8/include/cppgc/platform.h | 11 +- deps/v8/include/cppgc/prefinalizer.h | 2 +- .../include/cppgc/process-heap-statistics.h | 36 + deps/v8/include/cppgc/sentinel-pointer.h | 32 + deps/v8/include/cppgc/testing.h | 50 + deps/v8/include/cppgc/trace-trait.h | 2 + deps/v8/include/cppgc/type-traits.h | 89 +- deps/v8/include/cppgc/visitor.h | 57 +- deps/v8/include/js_protocol.pdl | 3 + deps/v8/include/v8-cppgc.h | 140 +- deps/v8/include/v8-fast-api-calls.h | 191 +- deps/v8/include/v8-metrics.h | 64 +- deps/v8/include/v8-profiler.h | 16 +- deps/v8/include/v8-unwinder-state.h | 2 +- deps/v8/include/v8-version.h | 8 +- deps/v8/include/v8.h | 349 +- deps/v8/include/v8config.h | 8 + deps/v8/infra/mb/mb_config.pyl | 75 +- deps/v8/infra/testing/README.md | 2 +- deps/v8/infra/testing/builders.pyl | 98 +- deps/v8/samples/cppgc/cppgc-sample.cc | 6 +- deps/v8/samples/shell.cc | 2 +- deps/v8/src/DEPS | 2 + deps/v8/src/api/api-inl.h | 108 +- deps/v8/src/api/api-macros-undef.h | 20 + deps/v8/src/api/api-macros.h | 132 + deps/v8/src/api/api-natives.cc | 10 +- deps/v8/src/api/api.cc | 1897 ++----- deps/v8/src/api/api.h | 4 +- .../ast/ast-function-literal-id-reindexer.cc | 4 +- deps/v8/src/ast/ast-traversal-visitor.h | 28 +- deps/v8/src/ast/ast-value-factory.h | 108 +- deps/v8/src/ast/ast.cc | 11 - deps/v8/src/ast/ast.h | 187 +- deps/v8/src/ast/modules.cc | 61 +- deps/v8/src/ast/prettyprinter.cc | 91 +- deps/v8/src/ast/prettyprinter.h | 3 + deps/v8/src/ast/scopes.cc | 111 +- deps/v8/src/ast/scopes.h | 65 +- deps/v8/src/base/bits.h | 20 + deps/v8/src/base/build_config.h | 33 +- deps/v8/src/base/compiler-specific.h | 3 +- deps/v8/src/base/cpu.cc | 2 +- deps/v8/src/base/enum-set.h | 40 +- deps/v8/src/base/platform/platform-posix.cc | 6 + deps/v8/src/baseline/DEPS | 5 + deps/v8/src/baseline/OWNERS | 6 + .../arm64/baseline-assembler-arm64-inl.h | 544 ++ .../arm64/baseline-compiler-arm64-inl.h | 116 + deps/v8/src/baseline/baseline-assembler-inl.h | 134 + deps/v8/src/baseline/baseline-assembler.h | 187 + deps/v8/src/baseline/baseline-compiler.cc | 2180 ++++++++ deps/v8/src/baseline/baseline-compiler.h | 213 + deps/v8/src/baseline/baseline.cc | 58 + deps/v8/src/baseline/baseline.h | 25 + .../baseline/x64/baseline-assembler-x64-inl.h | 439 ++ .../baseline/x64/baseline-compiler-x64-inl.h | 92 + deps/v8/src/builtins/accessors.cc | 44 +- deps/v8/src/builtins/accessors.h | 2 - deps/v8/src/builtins/arm/builtins-arm.cc | 347 +- deps/v8/src/builtins/arm64/builtins-arm64.cc | 712 +-- deps/v8/src/builtins/array-join.tq | 2 +- deps/v8/src/builtins/array-reverse.tq | 2 +- deps/v8/src/builtins/array-slice.tq | 2 +- deps/v8/src/builtins/base.tq | 43 +- deps/v8/src/builtins/builtins-array-gen.cc | 6 +- deps/v8/src/builtins/builtins-array.cc | 4 +- .../builtins/builtins-async-generator-gen.cc | 4 +- deps/v8/src/builtins/builtins-call-gen.cc | 89 +- deps/v8/src/builtins/builtins-call-gen.h | 11 + deps/v8/src/builtins/builtins-callsite.cc | 178 +- .../src/builtins/builtins-constructor-gen.cc | 173 +- .../src/builtins/builtins-conversion-gen.cc | 29 + deps/v8/src/builtins/builtins-definitions.h | 70 +- deps/v8/src/builtins/builtins-ic-gen.cc | 20 + deps/v8/src/builtins/builtins-internal-gen.cc | 41 +- deps/v8/src/builtins/builtins-intl.cc | 12 +- deps/v8/src/builtins/builtins-lazy-gen.cc | 31 +- deps/v8/src/builtins/builtins-number-gen.cc | 173 +- deps/v8/src/builtins/builtins-object-gen.cc | 19 +- deps/v8/src/builtins/builtins-object.cc | 5 +- deps/v8/src/builtins/builtins-regexp-gen.cc | 253 +- deps/v8/src/builtins/builtins-regexp-gen.h | 27 +- .../builtins-sharedarraybuffer-gen.cc | 13 +- deps/v8/src/builtins/builtins-string-gen.cc | 456 +- deps/v8/src/builtins/builtins-string-gen.h | 49 +- deps/v8/src/builtins/builtins-string.tq | 4 +- deps/v8/src/builtins/builtins-wasm-gen.cc | 33 +- deps/v8/src/builtins/builtins.cc | 9 +- deps/v8/src/builtins/builtins.h | 6 +- deps/v8/src/builtins/cast.tq | 2 +- deps/v8/src/builtins/constructor.tq | 29 +- deps/v8/src/builtins/frame-arguments.tq | 37 +- deps/v8/src/builtins/frames.tq | 26 +- .../generate-bytecodes-builtins-list.cc | 23 +- deps/v8/src/builtins/ia32/builtins-ia32.cc | 299 +- deps/v8/src/builtins/ic-callable.tq | 25 +- deps/v8/src/builtins/ic.tq | 7 +- deps/v8/src/builtins/internal.tq | 31 +- deps/v8/src/builtins/iterator.tq | 23 + deps/v8/src/builtins/mips/builtins-mips.cc | 264 +- .../v8/src/builtins/mips64/builtins-mips64.cc | 282 +- deps/v8/src/builtins/ppc/builtins-ppc.cc | 359 +- deps/v8/src/builtins/promise-constructor.tq | 5 +- deps/v8/src/builtins/promise-finally.tq | 5 +- deps/v8/src/builtins/promise-race.tq | 5 +- deps/v8/src/builtins/regexp-match.tq | 4 +- deps/v8/src/builtins/regexp-source.tq | 1 - deps/v8/src/builtins/regexp.tq | 44 +- .../src/builtins/riscv64/builtins-riscv64.cc | 3316 ++++++++++++ deps/v8/src/builtins/s390/builtins-s390.cc | 368 +- deps/v8/src/builtins/string-endswith.tq | 2 +- deps/v8/src/builtins/string-includes.tq | 49 + deps/v8/src/builtins/string-indexof.tq | 39 + deps/v8/src/builtins/string-match-search.tq | 86 + deps/v8/src/builtins/string-replaceall.tq | 46 - deps/v8/src/builtins/wasm.tq | 38 +- deps/v8/src/builtins/x64/builtins-x64.cc | 529 +- deps/v8/src/codegen/OWNERS | 5 +- deps/v8/src/codegen/arm/assembler-arm.cc | 36 + deps/v8/src/codegen/arm/assembler-arm.h | 22 + .../codegen/arm/interface-descriptors-arm.cc | 26 +- .../v8/src/codegen/arm/macro-assembler-arm.cc | 90 +- deps/v8/src/codegen/arm/macro-assembler-arm.h | 20 +- deps/v8/src/codegen/arm64/assembler-arm64.cc | 22 +- .../arm64/interface-descriptors-arm64.cc | 24 +- .../codegen/arm64/macro-assembler-arm64-inl.h | 17 - .../codegen/arm64/macro-assembler-arm64.cc | 144 +- .../src/codegen/arm64/macro-assembler-arm64.h | 39 +- deps/v8/src/codegen/arm64/register-arm64.h | 2 - deps/v8/src/codegen/assembler-arch.h | 2 + deps/v8/src/codegen/assembler-inl.h | 2 + deps/v8/src/codegen/assembler.cc | 28 + deps/v8/src/codegen/bailout-reason.h | 1 + deps/v8/src/codegen/code-comments.cc | 15 - deps/v8/src/codegen/code-comments.h | 3 - deps/v8/src/codegen/code-factory.cc | 5 - deps/v8/src/codegen/code-factory.h | 1 - deps/v8/src/codegen/code-stub-assembler.cc | 627 ++- deps/v8/src/codegen/code-stub-assembler.h | 401 +- deps/v8/src/codegen/compilation-cache.cc | 6 +- deps/v8/src/codegen/compiler.cc | 484 +- deps/v8/src/codegen/compiler.h | 23 +- deps/v8/src/codegen/constant-pool.cc | 249 + deps/v8/src/codegen/constant-pool.h | 2 +- deps/v8/src/codegen/constants-arch.h | 2 + deps/v8/src/codegen/cpu-features.h | 9 + deps/v8/src/codegen/external-reference.cc | 131 + deps/v8/src/codegen/external-reference.h | 20 +- deps/v8/src/codegen/ia32/assembler-ia32-inl.h | 6 +- deps/v8/src/codegen/ia32/assembler-ia32.cc | 60 + deps/v8/src/codegen/ia32/assembler-ia32.h | 25 + .../ia32/interface-descriptors-ia32.cc | 26 +- .../src/codegen/ia32/macro-assembler-ia32.cc | 559 +- .../src/codegen/ia32/macro-assembler-ia32.h | 103 +- deps/v8/src/codegen/interface-descriptors.cc | 129 +- deps/v8/src/codegen/interface-descriptors.h | 334 +- deps/v8/src/codegen/machine-type.h | 6 + deps/v8/src/codegen/macro-assembler.h | 3 + deps/v8/src/codegen/mips/assembler-mips.cc | 6 + .../mips/interface-descriptors-mips.cc | 26 +- .../src/codegen/mips/macro-assembler-mips.cc | 30 +- .../src/codegen/mips/macro-assembler-mips.h | 6 +- .../v8/src/codegen/mips64/assembler-mips64.cc | 27 + deps/v8/src/codegen/mips64/assembler-mips64.h | 16 + .../mips64/interface-descriptors-mips64.cc | 26 +- .../codegen/mips64/macro-assembler-mips64.cc | 137 +- .../codegen/mips64/macro-assembler-mips64.h | 10 +- .../src/codegen/optimized-compilation-info.cc | 4 + .../src/codegen/optimized-compilation-info.h | 20 +- deps/v8/src/codegen/ppc/assembler-ppc.cc | 6 + deps/v8/src/codegen/ppc/constants-ppc.h | 4 +- .../codegen/ppc/interface-descriptors-ppc.cc | 26 +- .../v8/src/codegen/ppc/macro-assembler-ppc.cc | 67 +- deps/v8/src/codegen/ppc/macro-assembler-ppc.h | 14 +- deps/v8/src/codegen/register-arch.h | 2 + deps/v8/src/codegen/register-configuration.cc | 2 + deps/v8/src/codegen/reloc-info.cc | 3 +- deps/v8/src/codegen/reloc-info.h | 2 +- .../codegen/riscv64/assembler-riscv64-inl.h | 261 + .../src/codegen/riscv64/assembler-riscv64.cc | 3020 +++++++++++ .../src/codegen/riscv64/assembler-riscv64.h | 1243 +++++ .../src/codegen/riscv64/constants-riscv64.cc | 201 + .../src/codegen/riscv64/constants-riscv64.h | 1170 +++++ deps/v8/src/codegen/riscv64/cpu-riscv64.cc | 32 + .../riscv64/interface-descriptors-riscv64.cc | 301 ++ .../riscv64/macro-assembler-riscv64.cc | 4575 +++++++++++++++++ .../codegen/riscv64/macro-assembler-riscv64.h | 1209 +++++ .../v8/src/codegen/riscv64/register-riscv64.h | 346 ++ deps/v8/src/codegen/s390/assembler-s390.cc | 6 + .../s390/interface-descriptors-s390.cc | 26 +- .../src/codegen/s390/macro-assembler-s390.cc | 450 +- .../src/codegen/s390/macro-assembler-s390.h | 113 +- deps/v8/src/codegen/safepoint-table.cc | 3 +- deps/v8/src/codegen/safepoint-table.h | 4 +- deps/v8/src/codegen/source-position-table.cc | 11 +- deps/v8/src/codegen/tnode.h | 2 +- deps/v8/src/codegen/turbo-assembler.cc | 2 +- deps/v8/src/codegen/turbo-assembler.h | 11 +- deps/v8/src/codegen/x64/assembler-x64-inl.h | 2 +- deps/v8/src/codegen/x64/assembler-x64.cc | 37 + deps/v8/src/codegen/x64/assembler-x64.h | 9 + .../codegen/x64/interface-descriptors-x64.cc | 20 +- .../v8/src/codegen/x64/macro-assembler-x64.cc | 518 +- deps/v8/src/codegen/x64/macro-assembler-x64.h | 66 +- deps/v8/src/codegen/x64/sse-instr.h | 7 +- deps/v8/src/common/assert-scope.cc | 21 + deps/v8/src/common/assert-scope.h | 5 + deps/v8/src/common/globals.h | 25 +- deps/v8/src/common/message-template.h | 10 +- .../optimizing-compile-dispatcher.cc | 2 +- deps/v8/src/compiler/OWNERS | 11 +- deps/v8/src/compiler/access-info.cc | 21 +- deps/v8/src/compiler/allocation-builder-inl.h | 22 +- deps/v8/src/compiler/allocation-builder.h | 6 + .../backend/arm/code-generator-arm.cc | 267 +- .../backend/arm/instruction-codes-arm.h | 15 +- .../backend/arm/instruction-scheduler-arm.cc | 15 +- .../backend/arm/instruction-selector-arm.cc | 106 +- .../backend/arm64/code-generator-arm64.cc | 275 +- .../backend/arm64/instruction-codes-arm64.h | 13 +- .../arm64/instruction-scheduler-arm64.cc | 13 +- .../arm64/instruction-selector-arm64.cc | 139 +- .../compiler/backend/code-generator-impl.h | 6 +- .../v8/src/compiler/backend/code-generator.cc | 143 +- deps/v8/src/compiler/backend/code-generator.h | 19 +- .../backend/ia32/code-generator-ia32.cc | 546 +- .../backend/ia32/instruction-codes-ia32.h | 62 +- .../ia32/instruction-scheduler-ia32.cc | 62 +- .../backend/ia32/instruction-selector-ia32.cc | 269 +- .../src/compiler/backend/instruction-codes.h | 7 +- .../compiler/backend/instruction-scheduler.cc | 1 - .../compiler/backend/instruction-selector.cc | 214 +- .../compiler/backend/instruction-selector.h | 9 +- deps/v8/src/compiler/backend/instruction.cc | 39 +- deps/v8/src/compiler/backend/instruction.h | 25 +- .../backend/mid-tier-register-allocator.cc | 196 +- .../backend/mips/code-generator-mips.cc | 192 +- .../backend/mips/instruction-codes-mips.h | 24 +- .../mips/instruction-scheduler-mips.cc | 40 +- .../backend/mips/instruction-selector-mips.cc | 114 +- .../backend/mips64/code-generator-mips64.cc | 204 +- .../backend/mips64/instruction-codes-mips64.h | 26 +- .../mips64/instruction-scheduler-mips64.cc | 42 +- .../mips64/instruction-selector-mips64.cc | 166 +- .../backend/ppc/code-generator-ppc.cc | 171 +- .../backend/ppc/instruction-codes-ppc.h | 13 +- .../backend/ppc/instruction-scheduler-ppc.cc | 13 +- .../backend/ppc/instruction-selector-ppc.cc | 167 +- .../compiler/backend/register-allocator.cc | 2 +- .../backend/riscv64/code-generator-riscv64.cc | 2775 ++++++++++ .../riscv64/instruction-codes-riscv64.h | 447 ++ .../riscv64/instruction-scheduler-riscv64.cc | 1579 ++++++ .../riscv64/instruction-selector-riscv64.cc | 3034 +++++++++++ .../backend/s390/code-generator-s390.cc | 540 +- .../backend/s390/instruction-codes-s390.h | 25 +- .../s390/instruction-scheduler-s390.cc | 25 +- .../backend/s390/instruction-selector-s390.cc | 139 +- .../backend/x64/code-generator-x64.cc | 350 +- .../backend/x64/instruction-codes-x64.h | 26 +- .../backend/x64/instruction-scheduler-x64.cc | 28 +- .../backend/x64/instruction-selector-x64.cc | 170 +- .../src/compiler/basic-block-instrumentor.cc | 38 +- deps/v8/src/compiler/bytecode-analysis.cc | 11 +- deps/v8/src/compiler/bytecode-analysis.h | 6 +- .../v8/src/compiler/bytecode-graph-builder.cc | 273 +- deps/v8/src/compiler/bytecode-graph-builder.h | 7 +- deps/v8/src/compiler/c-linkage.cc | 42 +- deps/v8/src/compiler/code-assembler.cc | 14 +- deps/v8/src/compiler/code-assembler.h | 18 +- deps/v8/src/compiler/common-operator.cc | 13 +- deps/v8/src/compiler/common-operator.h | 126 +- .../src/compiler/compilation-dependencies.cc | 26 +- .../src/compiler/compilation-dependencies.h | 35 +- .../src/compiler/effect-control-linearizer.cc | 209 +- .../src/compiler/escape-analysis-reducer.cc | 20 +- deps/v8/src/compiler/escape-analysis.cc | 8 +- deps/v8/src/compiler/escape-analysis.h | 2 +- deps/v8/src/compiler/frame-states.cc | 55 +- deps/v8/src/compiler/frame-states.h | 48 +- deps/v8/src/compiler/frame.h | 8 +- deps/v8/src/compiler/functional-list.h | 2 +- deps/v8/src/compiler/graph-assembler.h | 51 +- deps/v8/src/compiler/graph-reducer.cc | 19 +- deps/v8/src/compiler/graph-reducer.h | 10 +- deps/v8/src/compiler/graph-visualizer.cc | 2 + deps/v8/src/compiler/heap-refs.h | 262 +- deps/v8/src/compiler/js-call-reducer.cc | 199 +- deps/v8/src/compiler/js-call-reducer.h | 7 + .../src/compiler/js-context-specialization.cc | 10 +- deps/v8/src/compiler/js-create-lowering.cc | 364 +- deps/v8/src/compiler/js-create-lowering.h | 29 +- deps/v8/src/compiler/js-generic-lowering.cc | 15 +- deps/v8/src/compiler/js-graph.cc | 7 +- deps/v8/src/compiler/js-heap-broker.cc | 1437 ++++-- deps/v8/src/compiler/js-heap-broker.h | 45 +- deps/v8/src/compiler/js-heap-copy-reducer.cc | 6 +- deps/v8/src/compiler/js-inlining-heuristic.cc | 81 +- deps/v8/src/compiler/js-inlining-heuristic.h | 13 +- deps/v8/src/compiler/js-inlining.cc | 159 +- deps/v8/src/compiler/js-inlining.h | 22 +- .../js-native-context-specialization.cc | 134 +- deps/v8/src/compiler/js-operator.cc | 55 + deps/v8/src/compiler/js-operator.h | 74 +- deps/v8/src/compiler/js-typed-lowering.cc | 33 +- deps/v8/src/compiler/linkage.cc | 63 +- deps/v8/src/compiler/linkage.h | 11 +- deps/v8/src/compiler/load-elimination.cc | 5 +- deps/v8/src/compiler/loop-analysis.cc | 87 +- deps/v8/src/compiler/loop-analysis.h | 82 +- deps/v8/src/compiler/loop-peeling.cc | 116 +- deps/v8/src/compiler/loop-peeling.h | 4 +- .../v8/src/compiler/machine-graph-verifier.cc | 4 +- .../src/compiler/machine-operator-reducer.cc | 75 +- deps/v8/src/compiler/machine-operator.cc | 1286 ++--- deps/v8/src/compiler/machine-operator.h | 17 +- deps/v8/src/compiler/memory-optimizer.cc | 2 +- deps/v8/src/compiler/node-matchers.h | 2 +- deps/v8/src/compiler/node-observer.cc | 61 + deps/v8/src/compiler/node-observer.h | 130 + deps/v8/src/compiler/node-properties.cc | 3 +- deps/v8/src/compiler/node-properties.h | 6 +- deps/v8/src/compiler/node.cc | 4 + deps/v8/src/compiler/node.h | 19 - deps/v8/src/compiler/opcodes.h | 19 +- deps/v8/src/compiler/operator-properties.cc | 1 + deps/v8/src/compiler/operator.h | 2 + deps/v8/src/compiler/osr.cc | 4 +- deps/v8/src/compiler/persistent-map.h | 4 +- deps/v8/src/compiler/pipeline.cc | 211 +- deps/v8/src/compiler/pipeline.h | 2 +- deps/v8/src/compiler/processed-feedback.h | 2 +- .../src/compiler/property-access-builder.cc | 89 +- deps/v8/src/compiler/raw-machine-assembler.cc | 2 + deps/v8/src/compiler/raw-machine-assembler.h | 2 +- deps/v8/src/compiler/representation-change.cc | 2 +- .../compiler/scheduled-machine-lowering.cc | 2 +- .../serializer-for-background-compilation.cc | 85 +- .../serializer-for-background-compilation.h | 4 +- deps/v8/src/compiler/simd-scalar-lowering.cc | 50 +- deps/v8/src/compiler/simplified-lowering.cc | 424 +- deps/v8/src/compiler/simplified-lowering.h | 18 +- deps/v8/src/compiler/simplified-operator.cc | 31 +- deps/v8/src/compiler/simplified-operator.h | 12 +- deps/v8/src/compiler/state-values-utils.h | 11 + deps/v8/src/compiler/typer.cc | 24 +- deps/v8/src/compiler/types.cc | 11 + deps/v8/src/compiler/verifier.cc | 49 +- deps/v8/src/compiler/wasm-compiler.cc | 2064 ++++---- deps/v8/src/compiler/wasm-compiler.h | 99 +- deps/v8/src/d8/d8-console.cc | 1 + deps/v8/src/d8/d8.cc | 381 +- deps/v8/src/d8/d8.h | 10 +- deps/v8/src/debug/arm/debug-arm.cc | 9 +- deps/v8/src/debug/arm64/debug-arm64.cc | 10 +- deps/v8/src/debug/debug-coverage.cc | 10 +- deps/v8/src/debug/debug-evaluate.cc | 25 +- deps/v8/src/debug/debug-frames.cc | 5 +- deps/v8/src/debug/debug-frames.h | 4 +- deps/v8/src/debug/debug-interface.cc | 1176 +++++ deps/v8/src/debug/debug-interface.h | 28 +- deps/v8/src/debug/debug-property-iterator.cc | 53 +- deps/v8/src/debug/debug-property-iterator.h | 10 +- .../src/debug/debug-stack-trace-iterator.cc | 2 +- deps/v8/src/debug/debug-wasm-objects-inl.h | 30 + ...-wasm-support.cc => debug-wasm-objects.cc} | 518 +- deps/v8/src/debug/debug-wasm-objects.h | 75 + deps/v8/src/debug/debug-wasm-objects.tq | 7 + deps/v8/src/debug/debug-wasm-support.h | 29 - deps/v8/src/debug/debug.cc | 211 +- deps/v8/src/debug/debug.h | 3 + deps/v8/src/debug/ia32/debug-ia32.cc | 12 +- deps/v8/src/debug/liveedit.cc | 2 +- deps/v8/src/debug/mips/debug-mips.cc | 6 +- deps/v8/src/debug/mips64/debug-mips64.cc | 6 +- deps/v8/src/debug/ppc/debug-ppc.cc | 9 +- deps/v8/src/debug/riscv64/debug-riscv64.cc | 55 + deps/v8/src/debug/s390/debug-s390.cc | 9 +- .../wasm/gdb-server/wasm-module-debug.cc | 2 + deps/v8/src/debug/x64/debug-x64.cc | 12 +- deps/v8/src/deoptimizer/DEPS | 5 + deps/v8/src/deoptimizer/OWNERS | 1 - .../src/deoptimizer/deoptimized-frame-info.cc | 74 + .../src/deoptimizer/deoptimized-frame-info.h | 70 + .../deoptimizer/deoptimizer-cfi-builtins.cc | 2 - deps/v8/src/deoptimizer/deoptimizer.cc | 2590 +--------- deps/v8/src/deoptimizer/deoptimizer.h | 855 +-- deps/v8/src/deoptimizer/frame-description.h | 230 + .../deoptimizer/materialized-object-store.cc | 90 + .../deoptimizer/materialized-object-store.h | 40 + .../src/deoptimizer/mips/deoptimizer-mips.cc | 7 - .../deoptimizer/mips64/deoptimizer-mips64.cc | 7 - .../riscv64/deoptimizer-riscv64.cc | 41 + deps/v8/src/deoptimizer/translated-state.cc | 2100 ++++++++ deps/v8/src/deoptimizer/translated-state.h | 451 ++ deps/v8/src/deoptimizer/translation-array.cc | 356 ++ deps/v8/src/deoptimizer/translation-array.h | 125 + deps/v8/src/deoptimizer/translation-opcode.h | 71 + deps/v8/src/diagnostics/arm/disasm-arm.cc | 4 + deps/v8/src/diagnostics/arm/unwinder-arm.cc | 2 +- .../src/diagnostics/basic-block-profiler.cc | 21 +- .../v8/src/diagnostics/basic-block-profiler.h | 4 +- deps/v8/src/diagnostics/ia32/disasm-ia32.cc | 58 +- deps/v8/src/diagnostics/objects-debug.cc | 153 +- deps/v8/src/diagnostics/objects-printer.cc | 284 +- deps/v8/src/diagnostics/perf-jit.cc | 19 +- deps/v8/src/diagnostics/perf-jit.h | 3 + .../src/diagnostics/riscv64/disasm-riscv64.cc | 1862 +++++++ .../diagnostics/riscv64/unwinder-riscv64.cc | 12 + .../src/diagnostics/unwinding-info-win64.cc | 31 - deps/v8/src/diagnostics/x64/disasm-x64.cc | 76 +- .../src/execution/arm/frame-constants-arm.cc | 2 +- .../src/execution/arm/frame-constants-arm.h | 42 +- deps/v8/src/execution/arm/simulator-arm.cc | 53 +- .../execution/arm64/frame-constants-arm64.cc | 2 +- .../execution/arm64/frame-constants-arm64.h | 36 +- .../v8/src/execution/arm64/simulator-arm64.cc | 580 ++- deps/v8/src/execution/arm64/simulator-arm64.h | 14 +- .../execution/arm64/simulator-logic-arm64.cc | 1 + deps/v8/src/execution/frame-constants.h | 83 +- deps/v8/src/execution/frames-inl.h | 70 +- deps/v8/src/execution/frames.cc | 232 +- deps/v8/src/execution/frames.h | 169 +- .../execution/ia32/frame-constants-ia32.cc | 2 +- deps/v8/src/execution/isolate-data.h | 2 +- deps/v8/src/execution/isolate-inl.h | 5 + deps/v8/src/execution/isolate.cc | 491 +- deps/v8/src/execution/isolate.h | 160 +- deps/v8/src/execution/local-isolate.cc | 3 +- deps/v8/src/execution/local-isolate.h | 8 +- deps/v8/src/execution/messages.cc | 605 +-- deps/v8/src/execution/messages.h | 212 - .../execution/mips/frame-constants-mips.cc | 2 +- .../mips64/frame-constants-mips64.cc | 2 +- .../execution/mips64/frame-constants-mips64.h | 3 +- .../src/execution/ppc/frame-constants-ppc.cc | 2 +- .../src/execution/ppc/frame-constants-ppc.h | 6 +- deps/v8/src/execution/protectors-inl.h | 1 - deps/v8/src/execution/protectors.cc | 4 +- .../riscv64/frame-constants-riscv64.cc | 32 + .../riscv64/frame-constants-riscv64.h | 86 + .../execution/riscv64/simulator-riscv64.cc | 3750 ++++++++++++++ .../src/execution/riscv64/simulator-riscv64.h | 820 +++ deps/v8/src/execution/runtime-profiler.cc | 77 +- deps/v8/src/execution/runtime-profiler.h | 7 +- .../execution/s390/frame-constants-s390.cc | 2 +- .../src/execution/s390/frame-constants-s390.h | 5 +- deps/v8/src/execution/s390/simulator-s390.cc | 313 +- deps/v8/src/execution/s390/simulator-s390.h | 46 +- deps/v8/src/execution/simulator-base.h | 7 +- deps/v8/src/execution/simulator.h | 2 + .../src/execution/x64/frame-constants-x64.cc | 2 +- deps/v8/src/flags/flag-definitions.h | 239 +- deps/v8/src/handles/handles-inl.h | 2 + deps/v8/src/handles/handles.cc | 32 +- deps/v8/src/handles/handles.h | 1 + deps/v8/src/handles/persistent-handles.cc | 2 +- .../base/asm/riscv64/push_registers_asm.cc | 45 + deps/v8/src/heap/collection-barrier.cc | 10 +- deps/v8/src/heap/concurrent-allocator-inl.h | 2 - deps/v8/src/heap/concurrent-allocator.cc | 1 - deps/v8/src/heap/concurrent-marking.cc | 33 +- deps/v8/src/heap/concurrent-marking.h | 4 +- deps/v8/src/heap/cppgc-js/cpp-heap.cc | 192 +- deps/v8/src/heap/cppgc-js/cpp-heap.h | 42 +- deps/v8/src/heap/cppgc-js/cpp-snapshot.cc | 8 +- .../cppgc-js/unified-heap-marking-visitor.cc | 3 +- .../cppgc-js/unified-heap-marking-visitor.h | 2 +- deps/v8/src/heap/cppgc/caged-heap.cc | 2 + deps/v8/src/heap/cppgc/compaction-worklists.h | 7 +- deps/v8/src/heap/cppgc/compactor.cc | 6 +- deps/v8/src/heap/cppgc/compactor.h | 7 +- deps/v8/src/heap/cppgc/concurrent-marker.cc | 12 +- deps/v8/src/heap/cppgc/default-platform.cc | 9 - deps/v8/src/heap/cppgc/free-list.cc | 21 + deps/v8/src/heap/cppgc/free-list.h | 3 + deps/v8/src/heap/cppgc/garbage-collector.h | 7 + deps/v8/src/heap/cppgc/gc-info-table.cc | 25 +- deps/v8/src/heap/cppgc/gc-info-table.h | 11 +- deps/v8/src/heap/cppgc/heap-base.cc | 68 +- deps/v8/src/heap/cppgc/heap-base.h | 57 +- deps/v8/src/heap/cppgc/heap-consistency.cc | 66 + deps/v8/src/heap/cppgc/heap-object-header.h | 8 + deps/v8/src/heap/cppgc/heap-page.cc | 17 +- deps/v8/src/heap/cppgc/heap-page.h | 5 +- deps/v8/src/heap/cppgc/heap-state.cc | 32 + .../heap/cppgc/heap-statistics-collector.cc | 158 + .../heap/cppgc/heap-statistics-collector.h | 35 + deps/v8/src/heap/cppgc/heap.cc | 33 +- deps/v8/src/heap/cppgc/heap.h | 4 - .../cppgc/incremental-marking-schedule.cc | 7 +- .../heap/cppgc/incremental-marking-schedule.h | 4 +- deps/v8/src/heap/cppgc/marker.cc | 116 +- deps/v8/src/heap/cppgc/marker.h | 28 +- deps/v8/src/heap/cppgc/marking-state.cc | 3 +- deps/v8/src/heap/cppgc/marking-state.h | 19 +- deps/v8/src/heap/cppgc/marking-verifier.cc | 3 + deps/v8/src/heap/cppgc/marking-visitor.cc | 8 +- deps/v8/src/heap/cppgc/marking-visitor.h | 2 +- deps/v8/src/heap/cppgc/marking-worklists.h | 1 + deps/v8/src/heap/cppgc/metric-recorder.h | 69 + deps/v8/src/heap/cppgc/object-allocator.cc | 36 +- deps/v8/src/heap/cppgc/object-allocator.h | 28 +- deps/v8/src/heap/cppgc/object-size-trait.cc | 36 + deps/v8/src/heap/cppgc/object-start-bitmap.h | 4 +- deps/v8/src/heap/cppgc/persistent-node.cc | 22 +- deps/v8/src/heap/cppgc/platform.cc | 10 +- deps/v8/src/heap/cppgc/pointer-policies.cc | 10 +- .../v8/src/heap/cppgc/prefinalizer-handler.cc | 2 +- .../src/heap/cppgc/process-heap-statistics.cc | 12 + .../src/heap/cppgc/process-heap-statistics.h | 73 + deps/v8/src/heap/cppgc/process-heap.cc | 4 - deps/v8/src/heap/cppgc/stats-collector.cc | 139 + deps/v8/src/heap/cppgc/stats-collector.h | 111 +- deps/v8/src/heap/cppgc/sweeper.cc | 160 +- deps/v8/src/heap/cppgc/sweeper.h | 8 + deps/v8/src/heap/cppgc/testing.cc | 27 + deps/v8/src/heap/cppgc/trace-event.h | 2 +- deps/v8/src/heap/cppgc/write-barrier.cc | 79 +- deps/v8/src/heap/cppgc/write-barrier.h | 22 + deps/v8/src/heap/embedder-tracing.cc | 47 +- deps/v8/src/heap/embedder-tracing.h | 34 +- deps/v8/src/heap/factory-base.cc | 59 +- deps/v8/src/heap/factory-base.h | 11 + deps/v8/src/heap/factory.cc | 215 +- deps/v8/src/heap/factory.h | 50 +- deps/v8/src/heap/gc-tracer.cc | 26 +- deps/v8/src/heap/heap-inl.h | 13 + deps/v8/src/heap/heap.cc | 50 +- deps/v8/src/heap/heap.h | 22 +- deps/v8/src/heap/incremental-marking.cc | 36 +- deps/v8/src/heap/local-heap-inl.h | 3 + deps/v8/src/heap/local-heap.cc | 34 +- deps/v8/src/heap/local-heap.h | 13 + deps/v8/src/heap/mark-compact.cc | 100 +- deps/v8/src/heap/mark-compact.h | 10 +- deps/v8/src/heap/marking-barrier.cc | 27 +- deps/v8/src/heap/memory-allocator.cc | 21 +- deps/v8/src/heap/memory-chunk-layout.cc | 2 +- deps/v8/src/heap/new-spaces.cc | 2 +- deps/v8/src/heap/object-stats.cc | 30 +- deps/v8/src/heap/object-stats.h | 1 - deps/v8/src/heap/objects-visiting.h | 81 +- deps/v8/src/heap/paged-spaces.h | 4 +- deps/v8/src/heap/safepoint.cc | 9 +- deps/v8/src/heap/scavenger.cc | 8 +- deps/v8/src/heap/setup-heap-internal.cc | 237 +- deps/v8/src/ic/accessor-assembler.cc | 392 +- deps/v8/src/ic/accessor-assembler.h | 15 +- deps/v8/src/ic/binary-op-assembler.cc | 123 +- deps/v8/src/ic/binary-op-assembler.h | 114 +- deps/v8/src/ic/call-optimization.cc | 15 +- deps/v8/src/ic/call-optimization.h | 9 +- deps/v8/src/ic/ic.cc | 39 +- deps/v8/src/ic/keyed-store-generic.cc | 23 +- deps/v8/src/ic/unary-op-assembler.cc | 63 +- deps/v8/src/ic/unary-op-assembler.h | 12 +- deps/v8/src/init/bootstrapper.cc | 175 +- deps/v8/src/init/heap-symbols.h | 77 +- deps/v8/src/init/v8.cc | 40 +- deps/v8/src/inspector/custom-preview.cc | 6 +- deps/v8/src/inspector/search-util.cc | 1 + deps/v8/src/inspector/v8-console-message.cc | 7 +- deps/v8/src/inspector/v8-console.cc | 1 + deps/v8/src/inspector/v8-debugger.cc | 6 +- .../inspector/v8-heap-profiler-agent-impl.cc | 12 +- deps/v8/src/inspector/v8-inspector-impl.cc | 12 +- deps/v8/src/inspector/v8-inspector-impl.h | 2 +- deps/v8/src/inspector/v8-regex.cc | 13 +- deps/v8/src/inspector/v8-stack-trace-impl.cc | 7 +- deps/v8/src/inspector/value-mirror.cc | 50 +- .../interpreter/bytecode-array-accessor.cc | 170 +- .../src/interpreter/bytecode-array-accessor.h | 89 +- .../src/interpreter/bytecode-array-builder.cc | 36 +- .../src/interpreter/bytecode-array-builder.h | 10 +- .../interpreter/bytecode-array-iterator.cc | 12 - .../src/interpreter/bytecode-array-iterator.h | 5 - .../bytecode-array-random-iterator.cc | 2 +- .../src/interpreter/bytecode-array-writer.cc | 3 +- deps/v8/src/interpreter/bytecode-generator.cc | 495 +- deps/v8/src/interpreter/bytecode-generator.h | 9 +- deps/v8/src/interpreter/bytecode-node.h | 14 +- deps/v8/src/interpreter/bytecode-operands.cc | 27 +- deps/v8/src/interpreter/bytecode-operands.h | 54 +- .../interpreter/bytecode-register-optimizer.h | 6 +- deps/v8/src/interpreter/bytecode-register.cc | 9 + deps/v8/src/interpreter/bytecode-register.h | 31 +- deps/v8/src/interpreter/bytecode-traits.h | 59 +- deps/v8/src/interpreter/bytecodes.cc | 21 +- deps/v8/src/interpreter/bytecodes.h | 589 ++- .../src/interpreter/constant-array-builder.h | 1 - .../src/interpreter/interpreter-assembler.cc | 170 +- .../src/interpreter/interpreter-assembler.h | 34 +- .../src/interpreter/interpreter-generator.cc | 98 +- .../interpreter-intrinsics-generator.cc | 55 +- deps/v8/src/interpreter/interpreter.cc | 58 +- deps/v8/src/interpreter/interpreter.h | 7 +- deps/v8/src/json/json-parser.cc | 15 +- deps/v8/src/libsampler/sampler.cc | 31 +- deps/v8/src/logging/code-events.h | 12 +- deps/v8/src/logging/counters-definitions.h | 27 +- deps/v8/src/logging/counters.h | 5 + deps/v8/src/logging/log-utils.cc | 2 +- deps/v8/src/logging/log-utils.h | 9 - deps/v8/src/logging/log.cc | 112 +- deps/v8/src/logging/log.h | 21 +- deps/v8/src/objects/all-objects-inl.h | 4 +- deps/v8/src/objects/arguments.tq | 17 +- deps/v8/src/objects/backing-store.cc | 3 + deps/v8/src/objects/code-inl.h | 87 +- deps/v8/src/objects/code-kind.cc | 2 + deps/v8/src/objects/code-kind.h | 59 +- deps/v8/src/objects/code.cc | 267 +- deps/v8/src/objects/code.h | 19 +- deps/v8/src/objects/compressed-slots.h | 8 +- deps/v8/src/objects/contexts-inl.h | 37 +- deps/v8/src/objects/contexts.h | 24 +- deps/v8/src/objects/contexts.tq | 2 +- deps/v8/src/objects/debug-objects.cc | 35 +- deps/v8/src/objects/debug-objects.h | 7 - deps/v8/src/objects/dictionary-inl.h | 11 +- deps/v8/src/objects/feedback-cell-inl.h | 5 +- deps/v8/src/objects/feedback-cell.h | 6 +- deps/v8/src/objects/feedback-vector-inl.h | 30 +- deps/v8/src/objects/feedback-vector.cc | 54 +- deps/v8/src/objects/feedback-vector.h | 28 +- deps/v8/src/objects/feedback-vector.tq | 3 +- deps/v8/src/objects/field-index-inl.h | 2 +- deps/v8/src/objects/fixed-array-inl.h | 41 +- deps/v8/src/objects/fixed-array.h | 30 +- deps/v8/src/objects/fixed-array.tq | 8 +- deps/v8/src/objects/frame-array-inl.h | 60 - deps/v8/src/objects/frame-array.h | 116 - deps/v8/src/objects/function-kind.h | 64 +- deps/v8/src/objects/heap-object.h | 1 + deps/v8/src/objects/instance-type.h | 83 +- deps/v8/src/objects/intl-objects.cc | 14 +- deps/v8/src/objects/js-array-buffer-inl.h | 26 +- deps/v8/src/objects/js-array-buffer.h | 17 +- deps/v8/src/objects/js-array-buffer.tq | 43 +- deps/v8/src/objects/js-array-inl.h | 14 +- deps/v8/src/objects/js-array.h | 10 + deps/v8/src/objects/js-array.tq | 4 + deps/v8/src/objects/js-date-time-format.cc | 8 +- deps/v8/src/objects/js-display-names.cc | 7 + deps/v8/src/objects/js-function-inl.h | 29 +- deps/v8/src/objects/js-function.cc | 231 +- deps/v8/src/objects/js-function.h | 33 +- deps/v8/src/objects/js-locale.cc | 56 +- deps/v8/src/objects/js-objects-inl.h | 72 +- deps/v8/src/objects/js-objects.cc | 349 +- deps/v8/src/objects/js-objects.h | 27 +- deps/v8/src/objects/js-promise.tq | 4 + deps/v8/src/objects/js-regexp-inl.h | 6 + deps/v8/src/objects/js-regexp.cc | 92 +- deps/v8/src/objects/js-regexp.h | 45 +- deps/v8/src/objects/js-regexp.tq | 10 +- deps/v8/src/objects/layout-descriptor-inl.h | 255 - deps/v8/src/objects/layout-descriptor.cc | 288 -- deps/v8/src/objects/layout-descriptor.h | 175 - deps/v8/src/objects/literal-objects-inl.h | 6 + deps/v8/src/objects/literal-objects.cc | 62 +- deps/v8/src/objects/literal-objects.h | 12 + deps/v8/src/objects/literal-objects.tq | 7 + deps/v8/src/objects/lookup.cc | 247 +- deps/v8/src/objects/lookup.h | 31 +- deps/v8/src/objects/map-inl.h | 108 +- deps/v8/src/objects/map-updater.cc | 55 +- deps/v8/src/objects/map.cc | 188 +- deps/v8/src/objects/map.h | 291 +- deps/v8/src/objects/map.tq | 2 - deps/v8/src/objects/module-inl.h | 3 +- deps/v8/src/objects/module.cc | 49 +- deps/v8/src/objects/module.h | 7 + deps/v8/src/objects/module.tq | 1 + deps/v8/src/objects/object-list-macros.h | 22 +- deps/v8/src/objects/object-macros.h | 61 +- .../objects/objects-body-descriptors-inl.h | 80 +- deps/v8/src/objects/objects-definitions.h | 13 +- deps/v8/src/objects/objects-inl.h | 38 +- deps/v8/src/objects/objects.cc | 214 +- deps/v8/src/objects/objects.h | 3 +- .../src/objects/osr-optimized-code-cache.cc | 15 +- .../v8/src/objects/osr-optimized-code-cache.h | 15 +- deps/v8/src/objects/property-cell-inl.h | 34 +- deps/v8/src/objects/property-cell.h | 43 +- deps/v8/src/objects/property-details.h | 103 +- deps/v8/src/objects/scope-info-inl.h | 82 + deps/v8/src/objects/scope-info.cc | 224 +- deps/v8/src/objects/scope-info.h | 98 +- deps/v8/src/objects/scope-info.tq | 157 +- deps/v8/src/objects/script-inl.h | 6 + deps/v8/src/objects/script.h | 7 + deps/v8/src/objects/script.tq | 2 + .../v8/src/objects/shared-function-info-inl.h | 94 +- deps/v8/src/objects/shared-function-info.cc | 5 +- deps/v8/src/objects/shared-function-info.h | 35 +- deps/v8/src/objects/shared-function-info.tq | 11 +- deps/v8/src/objects/source-text-module.cc | 34 - deps/v8/src/objects/source-text-module.h | 4 - deps/v8/src/objects/source-text-module.tq | 1 - deps/v8/src/objects/stack-frame-info-inl.h | 24 +- deps/v8/src/objects/stack-frame-info.cc | 719 ++- deps/v8/src/objects/stack-frame-info.h | 134 +- deps/v8/src/objects/stack-frame-info.tq | 41 +- deps/v8/src/objects/string-inl.h | 152 +- deps/v8/src/objects/string-table.cc | 6 +- deps/v8/src/objects/string.cc | 19 +- deps/v8/src/objects/string.h | 38 +- deps/v8/src/objects/string.tq | 86 + .../v8/src/objects/swiss-hash-table-helpers.h | 363 ++ .../src/objects/swiss-name-dictionary-inl.h | 659 +++ deps/v8/src/objects/swiss-name-dictionary.cc | 37 + deps/v8/src/objects/swiss-name-dictionary.h | 284 + deps/v8/src/objects/swiss-name-dictionary.tq | 15 + deps/v8/src/objects/synthetic-module.cc | 22 +- deps/v8/src/objects/tagged-field.h | 2 +- deps/v8/src/objects/templates.tq | 2 +- deps/v8/src/objects/transitions-inl.h | 2 +- deps/v8/src/objects/transitions.cc | 7 +- deps/v8/src/objects/value-serializer.cc | 3 + deps/v8/src/parsing/parser-base.h | 206 +- deps/v8/src/parsing/parser.cc | 59 +- deps/v8/src/parsing/parser.h | 15 +- deps/v8/src/parsing/preparse-data.cc | 6 +- deps/v8/src/parsing/preparser.h | 18 +- deps/v8/src/parsing/rewriter.cc | 5 + deps/v8/src/profiler/cpu-profiler-inl.h | 4 + deps/v8/src/profiler/cpu-profiler.cc | 26 +- deps/v8/src/profiler/cpu-profiler.h | 20 +- .../src/profiler/heap-snapshot-generator.cc | 66 +- deps/v8/src/profiler/profile-generator-inl.h | 45 +- deps/v8/src/profiler/profile-generator.cc | 159 +- deps/v8/src/profiler/profile-generator.h | 91 +- deps/v8/src/profiler/profiler-listener.cc | 45 +- deps/v8/src/profiler/profiler-listener.h | 1 + deps/v8/src/profiler/strings-storage.cc | 1 + deps/v8/src/profiler/tick-sample.cc | 7 + .../src/regexp/experimental/experimental.cc | 16 +- .../v8/src/regexp/experimental/experimental.h | 10 +- .../regexp/regexp-bytecode-generator-inl.h | 14 +- .../src/regexp/regexp-bytecode-generator.cc | 6 +- .../v8/src/regexp/regexp-bytecode-generator.h | 1 + deps/v8/src/regexp/regexp-compiler.cc | 90 +- .../src/regexp/regexp-macro-assembler-arch.h | 2 + deps/v8/src/regexp/regexp-macro-assembler.h | 1 + deps/v8/src/regexp/regexp-parser.cc | 9 + deps/v8/src/regexp/regexp-parser.h | 6 + deps/v8/src/regexp/regexp.cc | 26 +- deps/v8/src/regexp/regexp.h | 16 +- .../riscv64/regexp-macro-assembler-riscv64.cc | 1269 +++++ .../riscv64/regexp-macro-assembler-riscv64.h | 214 + .../s390/regexp-macro-assembler-s390.cc | 24 +- deps/v8/src/roots/roots-inl.h | 1 + deps/v8/src/roots/roots.h | 14 +- deps/v8/src/runtime/runtime-atomics.cc | 5 +- deps/v8/src/runtime/runtime-classes.cc | 94 +- deps/v8/src/runtime/runtime-compiler.cc | 125 +- deps/v8/src/runtime/runtime-debug.cc | 42 +- deps/v8/src/runtime/runtime-internal.cc | 73 +- deps/v8/src/runtime/runtime-literals.cc | 47 +- deps/v8/src/runtime/runtime-module.cc | 15 +- deps/v8/src/runtime/runtime-object.cc | 39 +- deps/v8/src/runtime/runtime-regexp.cc | 89 +- deps/v8/src/runtime/runtime-scopes.cc | 10 - deps/v8/src/runtime/runtime-strings.cc | 66 - deps/v8/src/runtime/runtime-test.cc | 134 +- ...untime-interpreter.cc => runtime-trace.cc} | 66 +- deps/v8/src/runtime/runtime-wasm.cc | 150 +- deps/v8/src/runtime/runtime.h | 113 +- deps/v8/src/snapshot/context-serializer.cc | 4 +- deps/v8/src/snapshot/deserializer.cc | 4 +- deps/v8/src/snapshot/deserializer.h | 7 +- .../snapshot/embedded/embedded-file-writer.cc | 13 +- .../snapshot/embedded/embedded-file-writer.h | 8 +- .../platform-embedded-file-writer-win.cc | 9 +- deps/v8/src/snapshot/serializer.cc | 8 +- deps/v8/src/snapshot/snapshot.cc | 2 +- deps/v8/src/snapshot/startup-deserializer.cc | 2 +- deps/v8/src/strings/string-stream.cc | 9 +- deps/v8/src/torque/OWNERS | 6 +- deps/v8/src/torque/ast.h | 3 +- deps/v8/src/torque/cc-generator.cc | 129 +- deps/v8/src/torque/cc-generator.h | 7 +- deps/v8/src/torque/cfg.h | 11 +- .../torque/class-debug-reader-generator.cc | 87 +- deps/v8/src/torque/constants.h | 14 + deps/v8/src/torque/csa-generator.cc | 97 +- deps/v8/src/torque/declarable.cc | 12 + deps/v8/src/torque/declarable.h | 26 + deps/v8/src/torque/declaration-visitor.cc | 8 +- deps/v8/src/torque/declarations.h | 9 + deps/v8/src/torque/implementation-visitor.cc | 700 ++- deps/v8/src/torque/implementation-visitor.h | 35 +- deps/v8/src/torque/instance-type-generator.cc | 47 +- deps/v8/src/torque/instructions.cc | 38 +- deps/v8/src/torque/instructions.h | 19 + deps/v8/src/torque/runtime-macro-shims.h | 28 +- deps/v8/src/torque/source-positions.cc | 1 + deps/v8/src/torque/torque-compiler.cc | 2 + deps/v8/src/torque/torque-parser.cc | 40 +- deps/v8/src/torque/type-oracle.h | 4 + deps/v8/src/torque/type-visitor.cc | 13 +- deps/v8/src/torque/types.cc | 37 + deps/v8/src/torque/types.h | 24 +- deps/v8/src/tracing/trace-event.h | 3 + .../src/trap-handler/handler-inside-posix.cc | 18 +- deps/v8/src/trap-handler/trap-handler.h | 2 + deps/v8/src/utils/allocation.h | 8 + deps/v8/src/utils/memcopy.h | 5 + deps/v8/src/utils/utils.cc | 4 +- deps/v8/src/utils/utils.h | 38 +- .../wasm/baseline/arm/liftoff-assembler-arm.h | 437 +- .../baseline/arm64/liftoff-assembler-arm64.h | 414 +- .../baseline/ia32/liftoff-assembler-ia32.h | 531 +- .../wasm/baseline/liftoff-assembler-defs.h | 21 +- .../v8/src/wasm/baseline/liftoff-assembler.cc | 284 +- deps/v8/src/wasm/baseline/liftoff-assembler.h | 320 +- deps/v8/src/wasm/baseline/liftoff-compiler.cc | 2092 +++++--- deps/v8/src/wasm/baseline/liftoff-compiler.h | 6 +- deps/v8/src/wasm/baseline/liftoff-register.h | 51 +- .../baseline/mips/liftoff-assembler-mips.h | 344 +- .../mips64/liftoff-assembler-mips64.h | 375 +- .../wasm/baseline/ppc/liftoff-assembler-ppc.h | 184 +- .../riscv64/liftoff-assembler-riscv64.h | 2516 +++++++++ .../baseline/s390/liftoff-assembler-s390.h | 1113 +++- .../wasm/baseline/x64/liftoff-assembler-x64.h | 471 +- deps/v8/src/wasm/c-api.cc | 101 +- deps/v8/src/wasm/compilation-environment.h | 2 + deps/v8/src/wasm/decoder.h | 1 + deps/v8/src/wasm/function-body-decoder-impl.h | 478 +- deps/v8/src/wasm/function-body-decoder.cc | 3 + deps/v8/src/wasm/function-body-decoder.h | 3 + deps/v8/src/wasm/function-compiler.cc | 12 +- deps/v8/src/wasm/graph-builder-interface.cc | 410 +- deps/v8/src/wasm/jump-table-assembler.cc | 40 + deps/v8/src/wasm/jump-table-assembler.h | 5 + deps/v8/src/wasm/local-decl-encoder.cc | 17 +- deps/v8/src/wasm/module-compiler.cc | 162 +- deps/v8/src/wasm/module-compiler.h | 8 +- deps/v8/src/wasm/module-decoder.cc | 143 +- deps/v8/src/wasm/module-decoder.h | 7 - deps/v8/src/wasm/module-instantiate.cc | 262 +- deps/v8/src/wasm/value-type.cc | 34 + deps/v8/src/wasm/value-type.h | 343 +- deps/v8/src/wasm/wasm-code-manager.cc | 82 +- deps/v8/src/wasm/wasm-code-manager.h | 41 +- deps/v8/src/wasm/wasm-constants.h | 6 +- deps/v8/src/wasm/wasm-debug.cc | 241 +- deps/v8/src/wasm/wasm-debug.h | 102 +- deps/v8/src/wasm/wasm-engine.cc | 107 +- deps/v8/src/wasm/wasm-engine.h | 8 +- deps/v8/src/wasm/wasm-feature-flags.h | 8 +- deps/v8/src/wasm/wasm-features.cc | 6 +- deps/v8/src/wasm/wasm-features.h | 2 +- deps/v8/src/wasm/wasm-js.cc | 134 +- deps/v8/src/wasm/wasm-linkage.h | 12 + deps/v8/src/wasm/wasm-module-builder.cc | 58 +- deps/v8/src/wasm/wasm-module-builder.h | 8 + deps/v8/src/wasm/wasm-module.cc | 25 +- deps/v8/src/wasm/wasm-module.h | 30 +- deps/v8/src/wasm/wasm-objects-inl.h | 12 +- deps/v8/src/wasm/wasm-objects.cc | 202 +- deps/v8/src/wasm/wasm-objects.h | 49 +- deps/v8/src/wasm/wasm-objects.tq | 2 - deps/v8/src/wasm/wasm-opcodes-inl.h | 113 +- deps/v8/src/wasm/wasm-opcodes.cc | 3 +- deps/v8/src/wasm/wasm-opcodes.h | 99 +- deps/v8/src/wasm/wasm-serialization.cc | 316 +- deps/v8/src/wasm/wasm-serialization.h | 3 + deps/v8/src/wasm/wasm-subtyping.cc | 46 +- deps/v8/src/wasm/wasm-subtyping.h | 22 +- .../benchmarks/cpp/cppgc/allocation_perf.cc | 5 +- .../test/benchmarks/cpp/cppgc/trace_perf.cc | 1 + deps/v8/test/benchmarks/csuite/csuite.py | 13 +- deps/v8/test/cctest/BUILD.gn | 26 +- deps/v8/test/cctest/cctest-utils.h | 3 + deps/v8/test/cctest/cctest.cc | 6 +- deps/v8/test/cctest/cctest.h | 16 +- deps/v8/test/cctest/cctest.status | 93 +- deps/v8/test/cctest/compiler/c-signature.h | 6 +- .../test/cctest/compiler/function-tester.cc | 4 +- .../cctest/compiler/node-observer-tester.h | 92 + .../test/cctest/compiler/serializer-tester.cc | 4 - .../compiler/test-basic-block-profiler.cc | 31 +- .../cctest/compiler/test-code-generator.cc | 108 +- .../test-concurrent-shared-function-info.cc | 2 +- .../cctest/compiler/test-js-typed-lowering.cc | 4 +- .../test-run-bytecode-graph-builder.cc | 2 +- .../test/cctest/compiler/test-run-machops.cc | 2 + .../cctest/compiler/test-run-retpoline.cc | 7 +- .../cctest/compiler/test-run-tail-calls.cc | 7 +- .../cctest/compiler/test-sloppy-equality.cc | 141 + deps/v8/test/cctest/heap/heap-utils.cc | 6 - deps/v8/test/cctest/heap/heap-utils.h | 2 - .../cctest/heap/test-concurrent-allocation.cc | 21 +- .../test/cctest/heap/test-embedder-tracing.cc | 28 +- deps/v8/test/cctest/heap/test-heap.cc | 86 +- deps/v8/test/cctest/heap/test-spaces.cc | 10 + .../bytecode-expectations-printer.cc | 4 +- .../ArrayLiterals.golden | 60 +- .../AssignmentsInBinaryExpression.golden | 124 +- .../AsyncGenerators.golden | 360 +- .../bytecode_expectations/AsyncModules.golden | 130 +- .../BasicBlockToBoolean.golden | 14 +- .../bytecode_expectations/BasicLoops.golden | 226 +- .../BreakableBlocks.golden | 40 +- .../CallAndSpread.golden | 42 +- .../bytecode_expectations/CallGlobal.golden | 14 +- .../CallLookupSlot.golden | 16 +- .../bytecode_expectations/CallNew.golden | 20 +- .../bytecode_expectations/CallRuntime.golden | 6 +- .../ClassAndSuperClass.golden | 59 +- .../ClassDeclarations.golden | 68 +- .../bytecode_expectations/CompareNil.golden | 56 +- .../CompoundExpressions.golden | 22 +- .../bytecode_expectations/Conditional.golden | 8 +- .../ConstVariable.golden | 20 +- .../ConstVariableContextSlot.golden | 4 +- .../ContextParameters.golden | 4 +- .../ContextVariables.golden | 8 +- .../CountOperators.golden | 82 +- .../CreateArguments.golden | 24 +- .../CreateRestParameter.golden | 22 +- .../DeadCodeRemoval.golden | 8 +- .../DeclareGlobals.golden | 22 +- .../bytecode_expectations/Delete.golden | 20 +- .../DeleteLookupSlotInEval.golden | 8 +- .../DestructuringAssignment.golden | 224 +- .../bytecode_expectations/Eval.golden | 14 +- .../bytecode_expectations/ForAwaitOf.golden | 332 +- .../bytecode_expectations/ForIn.golden | 88 +- .../bytecode_expectations/ForOf.golden | 216 +- .../bytecode_expectations/ForOfLoop.golden | 478 +- .../FunctionLiterals.golden | 10 +- .../GenerateTestUndetectable.golden | 80 +- .../bytecode_expectations/Generators.golden | 152 +- .../GlobalCountOperators.golden | 8 +- .../bytecode_expectations/GlobalDelete.golden | 16 +- .../HeapNumberConstants.golden | 8 +- .../IIFEWithOneshotOpt.golden | 230 +- .../IIFEWithoutOneshotOpt.golden | 120 +- .../bytecode_expectations/IfConditions.golden | 24 +- .../IntegerConstants.golden | 8 +- .../bytecode_expectations/LetVariable.golden | 20 +- .../LetVariableContextSlot.golden | 4 +- .../bytecode_expectations/LoadGlobal.golden | 4 +- .../LogicalExpressions.golden | 592 ++- .../bytecode_expectations/LookupSlot.golden | 70 +- .../bytecode_expectations/Modules.golden | 138 +- .../bytecode_expectations/NewAndSpread.golden | 54 +- .../ObjectLiterals.golden | 102 +- .../OuterContextVariables.golden | 4 +- .../PrimitiveExpressions.golden | 110 +- .../PrivateAccessorAccess.golden | 62 +- .../PrivateAccessorDeclaration.golden | 140 +- .../PrivateClassFieldAccess.golden | 16 +- .../PrivateClassFields.golden | 92 +- .../PrivateMethodAccess.golden | 36 +- .../PrivateMethodDeclaration.golden | 85 +- .../bytecode_expectations/PropertyCall.golden | 38 +- .../PropertyLoadStoreOneShot.golden | 144 +- .../PropertyLoadStoreWithoutOneShot.golden | 34 +- .../PropertyLoads.golden | 266 +- .../PropertyStores.golden | 12 +- .../PublicClassFields.golden | 76 +- .../RegExpLiterals.golden | 8 +- .../RemoveRedundantLdar.golden | 20 +- .../StandardForLoop.golden | 190 +- .../StaticClassFields.golden | 110 +- .../StaticPrivateMethodAccess.golden | 104 +- .../StaticPrivateMethodDeclaration.golden | 80 +- .../bytecode_expectations/StoreGlobal.golden | 8 +- .../bytecode_expectations/StringConcat.golden | 64 +- .../StringConstants.golden | 8 +- .../SuperCallAndSpread.golden | 36 +- .../bytecode_expectations/Switch.golden | 234 +- .../TemplateLiterals.golden | 72 +- .../bytecode_expectations/Throw.golden | 4 +- .../TopLevelObjectLiterals.golden | 6 +- .../bytecode_expectations/TryCatch.golden | 30 +- .../bytecode_expectations/TryFinally.golden | 94 +- .../bytecode_expectations/Typeof.golden | 4 +- .../UnaryOperators.golden | 40 +- .../WideRegisters.golden | 268 +- .../generate-bytecode-expectations.cc | 2 +- .../interpreter/test-bytecode-generator.cc | 4 - .../cctest/interpreter/test-interpreter.cc | 47 +- .../v8/test/cctest/test-accessor-assembler.cc | 2 +- deps/v8/test/cctest/test-api-interceptors.cc | 13 - deps/v8/test/cctest/test-api-stack-traces.cc | 38 +- deps/v8/test/cctest/test-api-wasm.cc | 64 +- deps/v8/test/cctest/test-api.cc | 673 +-- deps/v8/test/cctest/test-api.h | 131 + deps/v8/test/cctest/test-assembler-arm64.cc | 22 +- deps/v8/test/cctest/test-assembler-riscv64.cc | 1874 +++++++ .../test/cctest/test-code-stub-assembler.cc | 25 +- deps/v8/test/cctest/test-compiler.cc | 24 +- .../test-concurrent-descriptor-array.cc | 2 - .../cctest/test-concurrent-feedback-vector.cc | 1 - .../test/cctest/test-concurrent-js-array.cc | 137 + .../test/cctest/test-concurrent-prototype.cc | 3 - deps/v8/test/cctest/test-concurrent-string.cc | 12 +- deps/v8/test/cctest/test-cpu-profiler.cc | 148 +- deps/v8/test/cctest/test-debug-helper.cc | 41 + deps/v8/test/cctest/test-debug.cc | 5 +- deps/v8/test/cctest/test-disasm-ia32.cc | 20 + deps/v8/test/cctest/test-disasm-riscv64.cc | 523 ++ deps/v8/test/cctest/test-disasm-x64.cc | 5 + .../test/cctest/test-field-type-tracking.cc | 64 +- deps/v8/test/cctest/test-heap-profiler.cc | 3 +- deps/v8/test/cctest/test-helper-riscv64.cc | 49 + deps/v8/test/cctest/test-helper-riscv64.h | 334 ++ deps/v8/test/cctest/test-icache.cc | 7 +- .../cctest/test-inobject-slack-tracking.cc | 12 +- deps/v8/test/cctest/test-js-to-wasm.cc | 999 ++++ deps/v8/test/cctest/test-local-handles.cc | 4 - deps/v8/test/cctest/test-log.cc | 127 +- .../cctest/test-macro-assembler-riscv64.cc | 1556 ++++++ .../test/cctest/test-macro-assembler-x64.cc | 21 +- deps/v8/test/cctest/test-modules.cc | 107 +- deps/v8/test/cctest/test-object.cc | 17 + deps/v8/test/cctest/test-parsing.cc | 10 +- .../v8/test/cctest/test-persistent-handles.cc | 3 - .../v8/test/cctest/test-pointer-auth-arm64.cc | 2 - .../test/cctest/test-poison-disasm-arm64.cc | 4 - deps/v8/test/cctest/test-profile-generator.cc | 111 + deps/v8/test/cctest/test-property-details.cc | 72 + deps/v8/test/cctest/test-regexp.cc | 95 +- deps/v8/test/cctest/test-sampler-api.cc | 4 - deps/v8/test/cctest/test-serialize.cc | 34 +- deps/v8/test/cctest/test-simple-riscv64.cc | 253 + deps/v8/test/cctest/test-strings.cc | 87 +- .../test/cctest/test-swiss-name-dictionary.cc | 81 + deps/v8/test/cctest/test-unboxed-doubles.cc | 1642 ------ .../test/cctest/test-unwinder-code-pages.cc | 40 +- deps/v8/test/cctest/torque/test-torque.cc | 52 + deps/v8/test/cctest/wasm/test-gc.cc | 714 +-- .../cctest/wasm/test-jump-table-assembler.cc | 8 +- .../cctest/wasm/test-liftoff-inspection.cc | 255 +- .../cctest/wasm/test-run-wasm-bulk-memory.cc | 22 - .../cctest/wasm/test-run-wasm-exceptions.cc | 318 +- .../cctest/wasm/test-run-wasm-memory64.cc | 44 + .../test/cctest/wasm/test-run-wasm-module.cc | 35 - .../test-run-wasm-simd-scalar-lowering.cc | 6 +- .../v8/test/cctest/wasm/test-run-wasm-simd.cc | 234 +- .../cctest/wasm/test-streaming-compilation.cc | 22 + .../test/cctest/wasm/test-wasm-breakpoints.cc | 8 +- .../cctest/wasm/test-wasm-serialization.cc | 18 - deps/v8/test/cctest/wasm/test-wasm-stack.cc | 6 +- deps/v8/test/cctest/wasm/wasm-run-utils.cc | 1 + deps/v8/test/cctest/wasm/wasm-run-utils.h | 8 +- deps/v8/test/common/assembler-tester.h | 42 +- deps/v8/test/common/wasm/test-signatures.h | 3 + deps/v8/test/common/wasm/wasm-interpreter.cc | 677 ++- deps/v8/test/common/wasm/wasm-interpreter.h | 12 +- deps/v8/test/common/wasm/wasm-macro-gen.h | 41 +- .../v8/test/common/wasm/wasm-module-runner.cc | 58 +- ...bled-tier-down-wasm-unsupported-liftoff.js | 9 +- deps/v8/test/debugger/debugger.status | 15 +- deps/v8/test/fuzzer/inspector/regress-1166549 | 189 + deps/v8/test/fuzzer/regexp-builtins.cc | 6 +- deps/v8/test/fuzzer/wasm-compile.cc | 1435 +++--- deps/v8/test/fuzzer/wasm-fuzzer-common.cc | 14 +- .../console-profile-asm-js-expected.txt | 9 + .../cpu-profiler/console-profile-asm-js.js | 94 + .../cpu-profiler/console-profile-wasm.js | 2 +- .../debugger/destructuring-expected.txt | 34 + .../test/inspector/debugger/destructuring.js | 47 + .../debugger/for-of-loops-expected.txt | 26 +- .../test/inspector/debugger/for-of-loops.js | 25 +- .../set-breakpoint-after-gc-expected.txt | 5 + .../debugger/set-breakpoint-after-gc.js | 52 + ...de-effect-free-debug-evaluate-expected.txt | 18 +- .../side-effect-free-debug-evaluate.js | 78 +- .../wasm-conditional-breakpoints-expected.txt | 66 + .../debugger/wasm-conditional-breakpoints.js | 75 + .../wasm-evaluate-on-call-frame-expected.txt | 96 +- .../debugger/wasm-evaluate-on-call-frame.js | 31 +- .../wasm-inspect-many-registers-expected.txt | 160 +- .../debugger/wasm-inspect-many-registers.js | 5 +- ...sm-instrumentation-breakpoint-expected.txt | 37 + .../wasm-instrumentation-breakpoint.js | 68 + .../inspector/debugger/wasm-memory-names.js | 31 +- .../debugger/wasm-scope-info-expected.txt | 306 +- .../debugger/wasm-set-breakpoint-expected.txt | 127 +- .../debugger/wasm-stack-check-expected.txt | 10 +- .../inspector/debugger/wasm-stack-check.js | 5 +- .../debugger/wasm-step-a-lot-expected.txt | 28 + .../inspector/debugger/wasm-step-a-lot.js | 56 + .../wasm-step-after-trap-expected.txt | 20 +- .../debugger/wasm-step-after-trap.js | 5 +- ...sm-stepping-no-opcode-merging-expected.txt | 22 +- .../wasm-stepping-no-opcode-merging.js | 4 +- ...wasm-stepping-with-source-map-expected.txt | 89 +- .../debugger/wasm-stepping-with-source-map.js | 13 +- deps/v8/test/inspector/inspector.status | 36 +- deps/v8/test/inspector/isolate-data.cc | 4 +- .../regress-crbug-1080638-expected.txt | 0 .../regress/regress-crbug-1080638.js | 28 + ...onsole-message-omit-data-urls-expected.txt | 6 + .../runtime/console-message-omit-data-urls.js | 63 + .../runtime/get-properties-expected.txt | 10 + .../test/inspector/runtime/get-properties.js | 19 + deps/v8/test/inspector/tasks.cc | 4 +- deps/v8/test/inspector/wasm-inspector-test.js | 95 +- ...rapDateTimeFormatUseOrdinaryHasInstance.js | 15 + .../intl/displaynames/languagecanonical.js | 71 + deps/v8/test/intl/intl.status | 5 + ...nwrapNumberFormatUseOrdinaryHasInstance.js | 15 + .../number-format/wont-crash-by-1-or-false.js | 6 +- deps/v8/test/intl/regress-11350.js | 49 + deps/v8/test/intl/regress-1170305.js | 16 + deps/v8/test/intl/regress-1177623.js | 5 + deps/v8/test/intl/regress-1177812.js | 7 + .../fail/class-fields-static-throw.out | 4 +- .../fail/modules-import-assertions-fail-1.mjs | 9 + .../fail/modules-import-assertions-fail-1.out | 1 + .../fail/modules-import-assertions-fail-2.mjs | 9 + .../fail/modules-import-assertions-fail-2.out | 4 + .../fail/modules-import-assertions-fail-3.mjs | 9 + .../fail/modules-import-assertions-fail-3.out | 4 + .../modules-skip-1-import-assertions-fail.mjs | 7 + ...modules-skip-3-import-assertions-fail.json | 1 + deps/v8/test/message/message.status | 15 +- deps/v8/test/message/wasm-trace-memory.js | 1 + deps/v8/test/mjsunit/BUILD.gn | 1 - .../mjsunit/array-bounds-check-removal.js | 80 +- deps/v8/test/mjsunit/baseline/cross-realm.js | 68 + .../baseline/test-baseline-module-helper.mjs | 5 + .../mjsunit/baseline/test-baseline-module.mjs | 24 + .../v8/test/mjsunit/baseline/test-baseline.js | 315 ++ .../mjsunit/compiler/array-slice-clone.js | 2 +- .../v8/test/mjsunit/compiler/number-divide.js | 2 + .../test/mjsunit/compiler/regress-1177368.js | 20 + .../test/mjsunit/compiler/regress-1177369.js | 28 + ... concurrent-initial-prototype-change-1.js} | 8 +- .../concurrent-initial-prototype-change-2.js | 69 + deps/v8/test/mjsunit/const-dict-tracking.js | 262 + .../v8/test/mjsunit/const-field-tracking-2.js | 2 +- deps/v8/test/mjsunit/d8/d8-fuzzable-worker.js | 69 + deps/v8/test/mjsunit/dictionary-properties.js | 18 +- deps/v8/test/mjsunit/dictionary-prototypes.js | 3 +- .../es6/block-let-crankshaft-sloppy.js | 9 +- .../class-computed-property-names-super.js | 2 - ...ctions-constructor-iterator-side-effect.js | 2 + .../es6/computed-property-names-super.js | 2 - .../mjsunit/es6/home-object-in-context.js | 196 + .../es6/map-constructor-entry-side-effect3.js | 3 + .../test/mjsunit/es6/object-literals-super.js | 53 - .../mjsunit/es6/super-ic-opt-no-turboprop.js | 2 +- deps/v8/test/mjsunit/es6/super-ic-opt.js | 6 +- deps/v8/test/mjsunit/fast-prototype.js | 20 +- .../mjsunit/harmony/atomics-value-check.js | 11 +- .../atomics-waitasync-1thread-2timeout.js | 7 +- ...ync-1thread-buffer-out-of-scope-timeout.js | 7 +- .../atomics-waitasync-1thread-timeout.js | 7 +- ...tasync-1thread-timeouts-and-no-timeouts.js | 11 +- .../harmony/atomics-waitasync-helpers.js | 4 +- ...r-shutdown-before-wait-finished-2-waits.js | 20 +- ...shutdown-before-wait-finished-2-workers.js | 17 +- ...hutdown-before-wait-finished-no-timeout.js | 16 +- ...r-shutdown-before-wait-finished-timeout.js | 16 +- .../mjsunit/harmony/class-static-blocks.js | 134 + deps/v8/test/mjsunit/harmony/futex.js | 27 +- .../harmony/import-from-fetch-errored.js | 4 +- .../modules-import-15-top-level-await.mjs | 2 +- .../mjsunit/harmony/modules-import-15.mjs | 2 +- .../harmony/modules-import-assertions-1.mjs | 9 + .../harmony/modules-import-assertions-2.mjs | 9 + .../harmony/modules-import-assertions-3.mjs | 9 + .../harmony/modules-import-assertions-4.mjs | 9 + .../modules-import-assertions-dynamic-1.mjs | 12 + .../modules-import-assertions-dynamic-10.mjs | 19 + .../modules-import-assertions-dynamic-11.mjs | 19 + .../modules-import-assertions-dynamic-2.mjs | 13 + .../modules-import-assertions-dynamic-3.mjs | 13 + .../modules-import-assertions-dynamic-4.mjs | 14 + .../modules-import-assertions-dynamic-5.mjs | 12 + .../modules-import-assertions-dynamic-6.mjs | 13 + .../modules-import-assertions-dynamic-7.mjs | 63 + .../modules-import-assertions-dynamic-8.mjs | 13 + .../modules-import-assertions-dynamic-9.mjs | 13 + .../test/mjsunit/harmony/modules-skip-1.json | 1 + .../harmony/modules-skip-imports-json-1.mjs | 6 + .../mjsunit/harmony/private-brand-checks.js | 567 ++ .../harmony/regexp-match-indices-no-flag.js | 13 + .../mjsunit/harmony/regexp-match-indices.js | 64 +- deps/v8/test/mjsunit/json2.js | 4 +- deps/v8/test/mjsunit/mjsunit.js | 16 +- deps/v8/test/mjsunit/mjsunit.status | 355 +- deps/v8/test/mjsunit/object-seal.js | 8 +- deps/v8/test/mjsunit/regexp-linear-flag.js | 7 + deps/v8/test/mjsunit/regexp-no-linear-flag.js | 4 +- .../regress/{ => asm}/regress-575364.js | 0 .../regress/{ => asm}/regress-592352.js | 0 .../regress/{ => asm}/regress-599719.js | 0 .../regress/{ => asm}/regress-599825.js | 0 .../regress/{ => asm}/regress-608630.js | 0 .../regress/{ => asm}/regress-613928.js | 0 .../regress/{ => asm}/regress-617525.js | 0 .../regress/{ => asm}/regress-617526.js | 0 .../regress/{ => asm}/regress-617529.js | 0 .../regress/{ => asm}/regress-618608.js | 0 .../mjsunit/regress/{ => asm}/regress-6196.js | 0 .../mjsunit/regress/{ => asm}/regress-6298.js | 0 .../mjsunit/regress/{ => asm}/regress-6431.js | 0 .../mjsunit/regress/{ => asm}/regress-6700.js | 0 .../regress/{ => asm}/regress-6838-1.js | 0 .../regress/{ => asm}/regress-6838-2.js | 0 .../regress/{ => asm}/regress-6838-3.js | 0 .../regress/{ => asm}/regress-6838-4.js | 0 .../regress/{wasm => asm}/regress-775710.js | 0 .../mjsunit/regress/{ => asm}/regress-7893.js | 0 .../mjsunit/regress/{ => asm}/regress-8377.js | 0 .../regress/{wasm => asm}/regress-8505.js | 0 .../mjsunit/regress/{ => asm}/regress-9022.js | 0 .../{ => asm}/regress-crbug-1006592.js | 0 .../regress/{ => asm}/regress-crbug-714971.js | 0 .../regress/{ => asm}/regress-crbug-715455.js | 0 .../regress/{ => asm}/regress-crbug-719384.js | 0 .../regress/{ => asm}/regress-crbug-721835.js | 0 .../regress/{ => asm}/regress-crbug-722348.js | 0 .../regress/{ => asm}/regress-crbug-759327.js | 0 .../regress/{ => asm}/regress-crbug-771428.js | 0 .../regress/{ => asm}/regress-crbug-898974.js | 0 .../regress/{ => asm}/regress-crbug-934138.js | 0 .../regress/{ => asm}/regress-crbug-969368.js | 0 .../regress/{ => asm}/regress-crbug-976934.js | 0 .../{ => asm}/regress-wasm-crbug-599413.js | 0 .../{ => asm}/regress-wasm-crbug-618602.js | 0 .../regress/async-generator-is-awaiting.js | 43 + .../test/mjsunit/regress/regress-1034322.js | 30 + .../test/mjsunit/regress/regress-1075514.js | 21 + .../test/mjsunit/regress/regress-1163715.js | 27 + .../test/mjsunit/regress/regress-1166138.js | 2 + .../test/mjsunit/regress/regress-1168435.js | 22 + .../test/mjsunit/regress/regress-1170261.js | 25 + .../test/mjsunit/regress/regress-1172797.js | 48 + .../test/mjsunit/regress/regress-1176318.js | 59 + .../test/mjsunit/regress/regress-1176504.js | 15 + .../test/mjsunit/regress/regress-1180012.js | 16 + .../test/mjsunit/regress/regress-1181246.js | 19 + deps/v8/test/mjsunit/regress/regress-2326.js | 4 +- deps/v8/test/mjsunit/regress/regress-5902.js | 3 +- .../v8/test/mjsunit/regress/regress-666046.js | 7 +- deps/v8/test/mjsunit/regress/regress-7115.js | 13 +- .../v8/test/mjsunit/regress/regress-740694.js | 2 +- .../mjsunit/regress/regress-crbug-1158138.js | 11 + .../regress/regress-crbug-1161847-1.js | 19 + .../regress/regress-crbug-1161847-2.js | 19 + .../mjsunit/regress/regress-crbug-1162473.js | 7 + .../mjsunit/regress/regress-crbug-1166095.js | 13 + .../mjsunit/regress/regress-crbug-1167918.js | 17 + .../mjsunit/regress/regress-crbug-1167981.js | 12 + .../mjsunit/regress/regress-crbug-1167988.js | 20 + .../mjsunit/regress/regress-crbug-1168055.js | 11 + .../mjsunit/regress/regress-crbug-1171195.js | 160 + .../mjsunit/regress/regress-crbug-1171600.js | 21 + .../mjsunit/regress/regress-crbug-1177058.js | 15 + .../mjsunit/regress/regress-crbug-605060.js | 3 +- .../test/mjsunit/regress/regress-v8-11360.js | 212 + .../regress/{ => wasm}/regress-1034394.js | 0 .../mjsunit/regress/wasm/regress-1054466.js | 2 +- .../mjsunit/regress/wasm/regress-1065599.js | 2 +- .../mjsunit/regress/wasm/regress-1070078.js | 2 +- .../mjsunit/regress/wasm/regress-1081030.js | 2 +- .../mjsunit/regress/wasm/regress-11335.js | 56 + .../mjsunit/regress/wasm/regress-1161555.js | 38 + .../mjsunit/regress/wasm/regress-1168116.js | 48 + .../mjsunit/regress/wasm/regress-1171788.js | 46 + .../mjsunit/regress/wasm/regress-1179025.js | 42 + .../mjsunit/regress/wasm/regress-1179065.js | 21 + .../mjsunit/regress/wasm/regress-1179182.js | 28 + .../mjsunit/regress/wasm/regress-1180690.js | 29 + .../regress/{ => wasm}/regress-5888.js | 0 .../regress/{ => wasm}/regress-5911.js | 0 .../regress/{ => wasm}/regress-813440.js | 0 .../regress/{ => wasm}/regress-863810.js | 0 .../test/mjsunit/regress/wasm/regress-8896.js | 2 + .../regress/{ => wasm}/regress-8947.js | 0 .../regress/{ => wasm}/regress-9209.js | 0 .../regress/{ => wasm}/regress-9832.js | 1 - .../{ => wasm}/regress-crbug-1047368.js | 0 .../regress/wasm/regress-crbug-1168386.js | 26 + .../regress/wasm/regress-crbug-1172912.js | 49 + .../{ => wasm}/regress-crbug-746835.js | 0 .../{ => wasm}/regress-crbug-772056.js | 0 .../{ => wasm}/regress-crbug-816961.js | 0 .../{ => wasm}/regress-crbug-969498.js | 0 .../regress/{ => wasm}/regress-v8-9106.js | 0 deps/v8/test/mjsunit/smi-mul-const.js | 1 + .../test/mjsunit/stack-traces-class-fields.js | 4 +- deps/v8/test/mjsunit/stack-traces-custom.js | 51 +- .../v8/test/mjsunit/string-external-cached.js | 2 +- deps/v8/test/mjsunit/wasm/atomics-stress.js | 36 +- deps/v8/test/mjsunit/wasm/embenchen/box2d.js | 2 +- .../mjsunit/wasm/embenchen/corrections.js | 2 +- .../mjsunit/wasm/embenchen/lua_binarytrees.js | 2 +- .../v8/test/mjsunit/wasm/exceptions-global.js | 54 - deps/v8/test/mjsunit/wasm/exceptions.js | 17 +- deps/v8/test/mjsunit/wasm/externref.js | 62 +- .../test/mjsunit/wasm/grow-memory-in-call.js | 2 +- .../test/mjsunit/wasm/grow-shared-memory.js | 249 +- deps/v8/test/mjsunit/wasm/js-api.js | 2 +- deps/v8/test/mjsunit/wasm/loop-unrolling.js | 146 + deps/v8/test/mjsunit/wasm/memory64.js | 83 + deps/v8/test/mjsunit/wasm/module-memory.js | 2 +- deps/v8/test/mjsunit/wasm/multi-value.js | 3 +- .../test/mjsunit/wasm/origin-trial-flags.js | 34 - .../shared-arraybuffer-worker-simple-gc.js | 15 +- .../mjsunit/wasm/shared-memory-worker-gc.js | 15 +- deps/v8/test/mjsunit/wasm/stack.js | 40 +- .../test/mjsunit/wasm/tier-down-to-liftoff.js | 4 +- deps/v8/test/mjsunit/wasm/trap-location.js | 10 +- .../wasm/type-reflection-with-exnref.js | 21 - .../test/mjsunit/wasm/wasm-module-builder.js | 63 +- deps/v8/test/mjsunit/wasm/worker-memory.js | 64 +- deps/v8/test/mjsunit/wasm/worker-module.js | 6 +- deps/v8/test/mjsunit/worker-ping-test.js | 74 +- deps/v8/test/mozilla/mozilla.status | 6 + deps/v8/test/test262/OWNERS | 1 - deps/v8/test/test262/test262.status | 10 +- deps/v8/test/torque/test-torque.tq | 63 +- deps/v8/test/unittests/BUILD.gn | 33 +- .../unittests/api/remote-object-unittest.cc | 4 +- .../test/unittests/api/v8-object-unittest.cc | 5 +- .../turbo-assembler-riscv64-unittest.cc | 64 + .../codegen/source-position-table-unittest.cc | 10 +- .../optimizing-compile-dispatcher-unittest.cc | 4 +- .../backend/instruction-selector-unittest.cc | 16 +- .../backend/instruction-sequence-unittest.cc | 3 + .../backend/instruction-sequence-unittest.h | 7 +- .../compiler/bytecode-analysis-unittest.cc | 5 +- .../decompression-optimizer-unittest.cc | 2 +- .../test/unittests/compiler/graph-unittest.cc | 6 +- .../compiler/js-create-lowering-unittest.cc | 4 +- .../compiler/linkage-tail-call-unittest.cc | 16 +- .../machine-operator-reducer-unittest.cc | 11 +- .../mid-tier-register-allocator-unittest.cc | 26 + .../instruction-selector-riscv64-unittest.cc | 1589 ++++++ .../heap/cppgc/concurrent-marking-unittest.cc | 6 +- .../heap/cppgc/ephemeron-pair-unittest.cc | 70 +- .../heap/cppgc/garbage-collected-unittest.cc | 48 +- .../unittests/heap/cppgc/gc-info-unittest.cc | 2 +- .../heap/cppgc/heap-growing-unittest.cc | 18 +- .../heap-statistics-collector-unittest.cc | 130 + .../unittests/heap/cppgc/heap-unittest.cc | 171 +- .../incremental-marking-schedule-unittest.cc | 8 +- .../unittests/heap/cppgc/marker-unittest.cc | 15 +- .../unittests/heap/cppgc/member-unittest.cc | 6 + .../heap/cppgc/metric-recorder-unittest.cc | 324 ++ .../unittests/heap/cppgc/minor-gc-unittest.cc | 4 +- .../heap/cppgc/object-size-trait-unittest.cc | 51 + .../heap/cppgc/persistent-family-unittest.cc | 72 +- .../heap/cppgc/prefinalizer-unittest.cc | 71 + .../unittests/heap/cppgc/run-all-unittests.cc | 23 + .../cppgc/stats-collector-scopes-unittest.cc | 57 +- .../heap/cppgc/stats-collector-unittest.cc | 17 + .../unittests/heap/cppgc/sweeper-unittest.cc | 57 + .../unittests/heap/cppgc/testing-unittest.cc | 55 + deps/v8/test/unittests/heap/cppgc/tests.cc | 4 +- deps/v8/test/unittests/heap/cppgc/tests.h | 7 +- .../heap/cppgc/write-barrier-unittest.cc | 28 +- deps/v8/test/unittests/heap/heap-utils.cc | 44 + deps/v8/test/unittests/heap/heap-utils.h | 12 +- .../unittests/heap/local-factory-unittest.cc | 1 - .../unittests/heap/local-heap-unittest.cc | 113 + .../test/unittests/heap/safepoint-unittest.cc | 9 - .../heap/unified-heap-snapshot-unittest.cc | 10 +- .../unittests/heap/unified-heap-unittest.cc | 113 +- .../test/unittests/heap/unified-heap-utils.cc | 45 +- .../test/unittests/heap/unified-heap-utils.h | 32 +- .../bytecode-array-builder-unittest.cc | 16 +- .../bytecode-array-iterator-unittest.cc | 40 +- ...bytecode-array-random-iterator-unittest.cc | 118 +- .../bytecode-register-optimizer-unittest.cc | 34 +- .../interpreter/bytecodes-unittest.cc | 35 +- .../interpreter-assembler-unittest.cc | 3 + .../unittests/logging/counters-unittest.cc | 14 + .../test/unittests/objects/object-unittest.cc | 20 +- .../osr-optimized-code-cache-unittest.cc | 41 +- .../objects/value-serializer-unittest.cc | 21 + deps/v8/test/unittests/run-all-unittests.cc | 2 + .../test/unittests/torque/torque-unittest.cc | 1 + deps/v8/test/unittests/unittests.status | 20 +- .../wasm/control-transfer-unittest.cc | 8 +- .../wasm/function-body-decoder-unittest.cc | 338 +- .../unittests/wasm/module-decoder-unittest.cc | 173 +- .../test/unittests/wasm/subtyping-unittest.cc | 112 +- .../wasm/trap-handler-posix-unittest.cc | 3 +- .../wasm/trap-handler-win-unittest.cc | 14 +- .../wasm/trap-handler-x64-unittest.cc | 30 +- .../wasm/wasm-code-manager-unittest.cc | 22 +- .../unittests/wasm/wasm-compiler-unittest.cc | 12 +- deps/v8/test/wasm-js/testcfg.py | 5 + deps/v8/test/wasm-js/tests.tar.gz.sha1 | 2 +- deps/v8/test/wasm-js/wasm-js.status | 6 +- deps/v8/test/wasm-spec-tests/testcfg.py | 5 + .../v8/test/wasm-spec-tests/tests.tar.gz.sha1 | 2 +- .../wasm-spec-tests/wasm-spec-tests.status | 83 +- deps/v8/third_party/v8/builtins/OWNERS | 1 - deps/v8/third_party/v8/builtins/array-sort.tq | 2 +- deps/v8/third_party/zlib/adler32.c | 4 +- .../third_party/zlib/google/zip_internal.cc | 6 +- deps/v8/third_party/zlib/google/zip_reader.cc | 12 +- deps/v8/tools/SourceMap.js | 382 -- deps/v8/tools/arguments.js | 78 - deps/v8/tools/callstats-from-telemetry.sh | 42 +- deps/v8/tools/callstats.html | 632 ++- deps/v8/tools/check-static-initializers.sh | 7 +- deps/v8/tools/clusterfuzz/v8_fuzz_flags.json | 3 - deps/v8/tools/codemap.js | 320 -- deps/v8/tools/consarray.js | 92 - deps/v8/tools/csvparser.js | 105 - deps/v8/tools/debug_helper/BUILD.gn | 4 + .../v8/tools/debug_helper/debug-macro-shims.h | 103 + deps/v8/tools/dev/gm.py | 4 +- deps/v8/tools/dev/v8gen.py | 8 +- deps/v8/tools/gcmole/bootstrap.sh | 2 +- deps/v8/tools/gdbinit | 27 +- deps/v8/tools/gen-v8-gn.py | 85 + .../tools/generate-header-include-checks.py | 2 +- deps/v8/tools/grokdump.py | 5 - deps/v8/tools/heap-stats/categories.js | 2 + deps/v8/tools/inspect-d8.js | 30 - deps/v8/tools/lldb_commands.py | 5 - deps/v8/tools/logreader.js | 247 - deps/v8/tools/mb/mb.py | 93 +- deps/v8/tools/mb/mb_unittest.py | 39 +- deps/v8/tools/parse-processor.html | 66 +- deps/v8/tools/parse-processor.mjs | 90 +- deps/v8/tools/profile.js | 1172 ----- deps/v8/tools/profile.mjs | 49 +- deps/v8/tools/splaytree.js | 327 -- deps/v8/tools/system-analyzer/index.html | 10 +- deps/v8/tools/system-analyzer/index.mjs | 2 +- .../view/log-file-reader-template.html | 1 + .../timeline/timeline-track-template.html | 2 +- deps/v8/tools/testrunner/base_runner.py | 28 +- .../v8/tools/testrunner/local/junit_output.py | 49 - deps/v8/tools/testrunner/local/statusfile.py | 2 +- deps/v8/tools/testrunner/local/variants.py | 21 +- deps/v8/tools/testrunner/standard_runner.py | 2 +- deps/v8/tools/testrunner/testproc/fuzzer.py | 8 +- deps/v8/tools/testrunner/testproc/progress.py | 40 - deps/v8/tools/tickprocessor-driver.js | 83 - deps/v8/tools/tickprocessor.js | 977 ---- deps/v8/tools/tickprocessor.mjs | 1286 +++-- deps/v8/tools/unittests/run_tests_test.py | 1 + .../testdata/testroot1/v8_build_config.json | 4 +- .../testdata/testroot2/v8_build_config.json | 4 +- deps/v8/tools/v8heapconst.py | 811 +-- deps/v8/tools/wasm/update-wasm-spec-tests.sh | 2 +- deps/v8/tools/whitespace.txt | 3 +- 1487 files changed, 108640 insertions(+), 44453 deletions(-) create mode 100644 deps/v8/RISCV_OWNERS create mode 100755 deps/v8/gni/protoc.py create mode 100644 deps/v8/include/cppgc/heap-state.h create mode 100644 deps/v8/include/cppgc/heap-statistics.h delete mode 100644 deps/v8/include/cppgc/internal/process-heap.h create mode 100644 deps/v8/include/cppgc/object-size-trait.h create mode 100644 deps/v8/include/cppgc/process-heap-statistics.h create mode 100644 deps/v8/include/cppgc/sentinel-pointer.h create mode 100644 deps/v8/include/cppgc/testing.h create mode 100644 deps/v8/src/api/api-macros-undef.h create mode 100644 deps/v8/src/api/api-macros.h create mode 100644 deps/v8/src/baseline/DEPS create mode 100644 deps/v8/src/baseline/OWNERS create mode 100644 deps/v8/src/baseline/arm64/baseline-assembler-arm64-inl.h create mode 100644 deps/v8/src/baseline/arm64/baseline-compiler-arm64-inl.h create mode 100644 deps/v8/src/baseline/baseline-assembler-inl.h create mode 100644 deps/v8/src/baseline/baseline-assembler.h create mode 100644 deps/v8/src/baseline/baseline-compiler.cc create mode 100644 deps/v8/src/baseline/baseline-compiler.h create mode 100644 deps/v8/src/baseline/baseline.cc create mode 100644 deps/v8/src/baseline/baseline.h create mode 100644 deps/v8/src/baseline/x64/baseline-assembler-x64-inl.h create mode 100644 deps/v8/src/baseline/x64/baseline-compiler-x64-inl.h create mode 100644 deps/v8/src/builtins/riscv64/builtins-riscv64.cc create mode 100644 deps/v8/src/builtins/string-includes.tq create mode 100644 deps/v8/src/builtins/string-indexof.tq create mode 100644 deps/v8/src/builtins/string-match-search.tq create mode 100644 deps/v8/src/codegen/riscv64/assembler-riscv64-inl.h create mode 100644 deps/v8/src/codegen/riscv64/assembler-riscv64.cc create mode 100644 deps/v8/src/codegen/riscv64/assembler-riscv64.h create mode 100644 deps/v8/src/codegen/riscv64/constants-riscv64.cc create mode 100644 deps/v8/src/codegen/riscv64/constants-riscv64.h create mode 100644 deps/v8/src/codegen/riscv64/cpu-riscv64.cc create mode 100644 deps/v8/src/codegen/riscv64/interface-descriptors-riscv64.cc create mode 100644 deps/v8/src/codegen/riscv64/macro-assembler-riscv64.cc create mode 100644 deps/v8/src/codegen/riscv64/macro-assembler-riscv64.h create mode 100644 deps/v8/src/codegen/riscv64/register-riscv64.h create mode 100644 deps/v8/src/compiler/backend/riscv64/code-generator-riscv64.cc create mode 100644 deps/v8/src/compiler/backend/riscv64/instruction-codes-riscv64.h create mode 100644 deps/v8/src/compiler/backend/riscv64/instruction-scheduler-riscv64.cc create mode 100644 deps/v8/src/compiler/backend/riscv64/instruction-selector-riscv64.cc create mode 100644 deps/v8/src/compiler/node-observer.cc create mode 100644 deps/v8/src/compiler/node-observer.h create mode 100644 deps/v8/src/debug/debug-interface.cc create mode 100644 deps/v8/src/debug/debug-wasm-objects-inl.h rename deps/v8/src/debug/{debug-wasm-support.cc => debug-wasm-objects.cc} (62%) create mode 100644 deps/v8/src/debug/debug-wasm-objects.h create mode 100644 deps/v8/src/debug/debug-wasm-objects.tq delete mode 100644 deps/v8/src/debug/debug-wasm-support.h create mode 100644 deps/v8/src/debug/riscv64/debug-riscv64.cc create mode 100644 deps/v8/src/deoptimizer/DEPS create mode 100644 deps/v8/src/deoptimizer/deoptimized-frame-info.cc create mode 100644 deps/v8/src/deoptimizer/deoptimized-frame-info.h create mode 100644 deps/v8/src/deoptimizer/frame-description.h create mode 100644 deps/v8/src/deoptimizer/materialized-object-store.cc create mode 100644 deps/v8/src/deoptimizer/materialized-object-store.h create mode 100644 deps/v8/src/deoptimizer/riscv64/deoptimizer-riscv64.cc create mode 100644 deps/v8/src/deoptimizer/translated-state.cc create mode 100644 deps/v8/src/deoptimizer/translated-state.h create mode 100644 deps/v8/src/deoptimizer/translation-array.cc create mode 100644 deps/v8/src/deoptimizer/translation-array.h create mode 100644 deps/v8/src/deoptimizer/translation-opcode.h create mode 100644 deps/v8/src/diagnostics/riscv64/disasm-riscv64.cc create mode 100644 deps/v8/src/diagnostics/riscv64/unwinder-riscv64.cc create mode 100644 deps/v8/src/execution/riscv64/frame-constants-riscv64.cc create mode 100644 deps/v8/src/execution/riscv64/frame-constants-riscv64.h create mode 100644 deps/v8/src/execution/riscv64/simulator-riscv64.cc create mode 100644 deps/v8/src/execution/riscv64/simulator-riscv64.h create mode 100644 deps/v8/src/heap/base/asm/riscv64/push_registers_asm.cc create mode 100644 deps/v8/src/heap/cppgc/heap-consistency.cc create mode 100644 deps/v8/src/heap/cppgc/heap-state.cc create mode 100644 deps/v8/src/heap/cppgc/heap-statistics-collector.cc create mode 100644 deps/v8/src/heap/cppgc/heap-statistics-collector.h create mode 100644 deps/v8/src/heap/cppgc/metric-recorder.h create mode 100644 deps/v8/src/heap/cppgc/object-size-trait.cc create mode 100644 deps/v8/src/heap/cppgc/process-heap-statistics.cc create mode 100644 deps/v8/src/heap/cppgc/process-heap-statistics.h create mode 100644 deps/v8/src/heap/cppgc/testing.cc create mode 100644 deps/v8/src/heap/cppgc/write-barrier.h delete mode 100644 deps/v8/src/objects/frame-array-inl.h delete mode 100644 deps/v8/src/objects/frame-array.h delete mode 100644 deps/v8/src/objects/layout-descriptor-inl.h delete mode 100644 deps/v8/src/objects/layout-descriptor.cc delete mode 100644 deps/v8/src/objects/layout-descriptor.h create mode 100644 deps/v8/src/objects/scope-info-inl.h create mode 100644 deps/v8/src/objects/swiss-hash-table-helpers.h create mode 100644 deps/v8/src/objects/swiss-name-dictionary-inl.h create mode 100644 deps/v8/src/objects/swiss-name-dictionary.cc create mode 100644 deps/v8/src/objects/swiss-name-dictionary.h create mode 100644 deps/v8/src/objects/swiss-name-dictionary.tq create mode 100644 deps/v8/src/regexp/riscv64/regexp-macro-assembler-riscv64.cc create mode 100644 deps/v8/src/regexp/riscv64/regexp-macro-assembler-riscv64.h rename deps/v8/src/runtime/{runtime-interpreter.cc => runtime-trace.cc} (77%) create mode 100644 deps/v8/src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h create mode 100644 deps/v8/src/wasm/value-type.cc create mode 100644 deps/v8/test/cctest/compiler/node-observer-tester.h create mode 100644 deps/v8/test/cctest/compiler/test-sloppy-equality.cc create mode 100644 deps/v8/test/cctest/test-assembler-riscv64.cc create mode 100644 deps/v8/test/cctest/test-concurrent-js-array.cc create mode 100644 deps/v8/test/cctest/test-disasm-riscv64.cc create mode 100644 deps/v8/test/cctest/test-helper-riscv64.cc create mode 100644 deps/v8/test/cctest/test-helper-riscv64.h create mode 100644 deps/v8/test/cctest/test-js-to-wasm.cc create mode 100644 deps/v8/test/cctest/test-macro-assembler-riscv64.cc create mode 100644 deps/v8/test/cctest/test-property-details.cc create mode 100644 deps/v8/test/cctest/test-simple-riscv64.cc create mode 100644 deps/v8/test/cctest/test-swiss-name-dictionary.cc delete mode 100644 deps/v8/test/cctest/test-unboxed-doubles.cc create mode 100644 deps/v8/test/fuzzer/inspector/regress-1166549 create mode 100644 deps/v8/test/inspector/cpu-profiler/console-profile-asm-js-expected.txt create mode 100644 deps/v8/test/inspector/cpu-profiler/console-profile-asm-js.js create mode 100644 deps/v8/test/inspector/debugger/destructuring-expected.txt create mode 100644 deps/v8/test/inspector/debugger/destructuring.js create mode 100644 deps/v8/test/inspector/debugger/set-breakpoint-after-gc-expected.txt create mode 100644 deps/v8/test/inspector/debugger/set-breakpoint-after-gc.js create mode 100644 deps/v8/test/inspector/debugger/wasm-conditional-breakpoints-expected.txt create mode 100644 deps/v8/test/inspector/debugger/wasm-conditional-breakpoints.js create mode 100644 deps/v8/test/inspector/debugger/wasm-instrumentation-breakpoint-expected.txt create mode 100644 deps/v8/test/inspector/debugger/wasm-instrumentation-breakpoint.js create mode 100644 deps/v8/test/inspector/debugger/wasm-step-a-lot-expected.txt create mode 100644 deps/v8/test/inspector/debugger/wasm-step-a-lot.js create mode 100644 deps/v8/test/inspector/regress/regress-crbug-1080638-expected.txt create mode 100644 deps/v8/test/inspector/regress/regress-crbug-1080638.js create mode 100644 deps/v8/test/inspector/runtime/console-message-omit-data-urls-expected.txt create mode 100644 deps/v8/test/inspector/runtime/console-message-omit-data-urls.js create mode 100644 deps/v8/test/intl/date-format/UnwrapDateTimeFormatUseOrdinaryHasInstance.js create mode 100644 deps/v8/test/intl/displaynames/languagecanonical.js create mode 100644 deps/v8/test/intl/number-format/UnwrapNumberFormatUseOrdinaryHasInstance.js create mode 100644 deps/v8/test/intl/regress-11350.js create mode 100644 deps/v8/test/intl/regress-1170305.js create mode 100644 deps/v8/test/intl/regress-1177623.js create mode 100644 deps/v8/test/intl/regress-1177812.js create mode 100644 deps/v8/test/message/fail/modules-import-assertions-fail-1.mjs create mode 100644 deps/v8/test/message/fail/modules-import-assertions-fail-1.out create mode 100644 deps/v8/test/message/fail/modules-import-assertions-fail-2.mjs create mode 100644 deps/v8/test/message/fail/modules-import-assertions-fail-2.out create mode 100644 deps/v8/test/message/fail/modules-import-assertions-fail-3.mjs create mode 100644 deps/v8/test/message/fail/modules-import-assertions-fail-3.out create mode 100644 deps/v8/test/message/fail/modules-skip-1-import-assertions-fail.mjs create mode 100644 deps/v8/test/message/fail/modules-skip-3-import-assertions-fail.json create mode 100644 deps/v8/test/mjsunit/baseline/cross-realm.js create mode 100644 deps/v8/test/mjsunit/baseline/test-baseline-module-helper.mjs create mode 100644 deps/v8/test/mjsunit/baseline/test-baseline-module.mjs create mode 100644 deps/v8/test/mjsunit/baseline/test-baseline.js create mode 100644 deps/v8/test/mjsunit/compiler/regress-1177368.js create mode 100644 deps/v8/test/mjsunit/compiler/regress-1177369.js rename deps/v8/test/mjsunit/{concurrent-initial-prototype-change.js => concurrent-initial-prototype-change-1.js} (92%) create mode 100644 deps/v8/test/mjsunit/concurrent-initial-prototype-change-2.js create mode 100644 deps/v8/test/mjsunit/const-dict-tracking.js create mode 100644 deps/v8/test/mjsunit/d8/d8-fuzzable-worker.js create mode 100644 deps/v8/test/mjsunit/es6/home-object-in-context.js create mode 100644 deps/v8/test/mjsunit/harmony/class-static-blocks.js create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-1.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-2.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-3.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-4.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-dynamic-1.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-dynamic-10.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-dynamic-11.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-dynamic-2.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-dynamic-3.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-dynamic-4.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-dynamic-5.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-dynamic-6.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-dynamic-7.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-dynamic-8.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-assertions-dynamic-9.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-skip-1.json create mode 100644 deps/v8/test/mjsunit/harmony/modules-skip-imports-json-1.mjs create mode 100644 deps/v8/test/mjsunit/harmony/private-brand-checks.js create mode 100644 deps/v8/test/mjsunit/harmony/regexp-match-indices-no-flag.js rename deps/v8/test/mjsunit/regress/{ => asm}/regress-575364.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-592352.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-599719.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-599825.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-608630.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-613928.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-617525.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-617526.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-617529.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-618608.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-6196.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-6298.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-6431.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-6700.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-6838-1.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-6838-2.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-6838-3.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-6838-4.js (100%) rename deps/v8/test/mjsunit/regress/{wasm => asm}/regress-775710.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-7893.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-8377.js (100%) rename deps/v8/test/mjsunit/regress/{wasm => asm}/regress-8505.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-9022.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-crbug-1006592.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-crbug-714971.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-crbug-715455.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-crbug-719384.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-crbug-721835.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-crbug-722348.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-crbug-759327.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-crbug-771428.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-crbug-898974.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-crbug-934138.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-crbug-969368.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-crbug-976934.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-wasm-crbug-599413.js (100%) rename deps/v8/test/mjsunit/regress/{ => asm}/regress-wasm-crbug-618602.js (100%) create mode 100644 deps/v8/test/mjsunit/regress/async-generator-is-awaiting.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1034322.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1075514.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1163715.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1168435.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1170261.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1172797.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1176318.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1176504.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1180012.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1181246.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1158138.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1161847-1.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1161847-2.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1162473.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1166095.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1167918.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1167981.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1167988.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1168055.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1171195.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1171600.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1177058.js create mode 100644 deps/v8/test/mjsunit/regress/regress-v8-11360.js rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-1034394.js (100%) create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-11335.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-1161555.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-1168116.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-1171788.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-1179025.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-1179065.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-1179182.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-1180690.js rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-5888.js (100%) rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-5911.js (100%) rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-813440.js (100%) rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-863810.js (100%) rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-8947.js (100%) rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-9209.js (100%) rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-9832.js (96%) rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-crbug-1047368.js (100%) create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-crbug-1168386.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-crbug-1172912.js rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-crbug-746835.js (100%) rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-crbug-772056.js (100%) rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-crbug-816961.js (100%) rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-crbug-969498.js (100%) rename deps/v8/test/mjsunit/regress/{ => wasm}/regress-v8-9106.js (100%) delete mode 100644 deps/v8/test/mjsunit/wasm/exceptions-global.js create mode 100644 deps/v8/test/mjsunit/wasm/loop-unrolling.js create mode 100644 deps/v8/test/mjsunit/wasm/memory64.js delete mode 100644 deps/v8/test/mjsunit/wasm/origin-trial-flags.js delete mode 100644 deps/v8/test/mjsunit/wasm/type-reflection-with-exnref.js create mode 100644 deps/v8/test/unittests/assembler/turbo-assembler-riscv64-unittest.cc create mode 100644 deps/v8/test/unittests/compiler/riscv64/instruction-selector-riscv64-unittest.cc create mode 100644 deps/v8/test/unittests/heap/cppgc/heap-statistics-collector-unittest.cc create mode 100644 deps/v8/test/unittests/heap/cppgc/metric-recorder-unittest.cc create mode 100644 deps/v8/test/unittests/heap/cppgc/object-size-trait-unittest.cc create mode 100644 deps/v8/test/unittests/heap/cppgc/testing-unittest.cc create mode 100644 deps/v8/test/unittests/heap/heap-utils.cc delete mode 100644 deps/v8/tools/SourceMap.js delete mode 100644 deps/v8/tools/arguments.js delete mode 100644 deps/v8/tools/codemap.js delete mode 100644 deps/v8/tools/consarray.js delete mode 100644 deps/v8/tools/csvparser.js create mode 100644 deps/v8/tools/debug_helper/debug-macro-shims.h create mode 100755 deps/v8/tools/gen-v8-gn.py delete mode 100644 deps/v8/tools/inspect-d8.js delete mode 100644 deps/v8/tools/logreader.js delete mode 100644 deps/v8/tools/profile.js delete mode 100644 deps/v8/tools/splaytree.js delete mode 100644 deps/v8/tools/testrunner/local/junit_output.py delete mode 100644 deps/v8/tools/tickprocessor-driver.js delete mode 100644 deps/v8/tools/tickprocessor.js diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index 2721a0015f4b4e..42a9f29d89aa93 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -69,8 +69,10 @@ Ben Newman Ben Noordhuis Benjamin Tan Bert Belder +Brice Dobry Burcu Dogan Caitlin Potter +Chao Wang Craig Schlenter Charles Kerr Chengzhong Wu @@ -86,6 +88,7 @@ David Carlier David Manouchehri Deepak Mohan Deon Dior +Derek Tu Dominic Farolini Douglas Crosher Dusan Milosavljevic @@ -101,6 +104,7 @@ Gergely Nagy Gilang Mentari Hamidy Gus Caplan Gwang Yoon Hwang +Haichuan Wang Hannu Trey Henrique Ferreiro Hirofumi Mako @@ -119,6 +123,7 @@ Jay Freeman James Pike James M Snell Javad Amiri +Ji Qiu Jianghua Yang Jiawen Geng Jiaxun Yang @@ -169,6 +174,7 @@ Oliver Dunk Paolo Giarrusso Patrick Gansterer Peng Fei +Peng Wu Peng-Yu Chen Peter Rybin Peter Varga @@ -183,6 +189,7 @@ Raul Tambre Ray Glover Refael Ackermann Rene Rebe +Reza Yazdani Rick Waldron Rob Wu Robert Meijer @@ -203,7 +210,9 @@ Shawn Presser Stefan Penner Sylvestre Ledru Taketoshi Aono +Tao Liqiang Teddy Katz +Thomas Young Tiancheng "Timothy" Gu Tobias Burnus Tobias Nießen @@ -214,12 +223,15 @@ Victor Costan Vlad Burlik Vladimir Krivosheev Vladimir Shutoff +Wei Wu Wenlu Wang Wiktor Garbacz Wouter Vermeiren +Xiaofang Zou Xiaoyin Liu Yanbo Li Yannic Bonenberger +Yi Wang Yong Wang Youfeng Hao Yu Yin diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index f39529a3a953a3..a9ab6783fa6b04 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -40,11 +40,6 @@ declare_args() { # Sets -DV8_ENABLE_FUTURE. v8_enable_future = false - # Lite mode disables a number of performance optimizations to reduce memory - # at the cost of performance. - # Sets --DV8_LITE_MODE. - v8_enable_lite_mode = false - # Sets -DSYSTEM_INSTRUMENTATION. Enables OS-dependent event tracing v8_enable_system_instrumentation = false @@ -115,13 +110,6 @@ declare_args() { v8_enable_pointer_compression = "" v8_enable_31bit_smis_on_64bit_arch = false - # Disable arguments adaptor frame (sets -dV8_NO_ARGUMENTS_ADAPTOR). - v8_disable_arguments_adaptor = - v8_current_cpu == "x86" || v8_current_cpu == "x64" || - v8_current_cpu == "arm" || v8_current_cpu == "arm64" || - v8_current_cpu == "mipsel" || v8_current_cpu == "mips64el" || - v8_current_cpu == "ppc64" || v8_current_cpu == "s390x" - # Sets -dOBJECT_PRINT. v8_enable_object_print = "" @@ -131,8 +119,10 @@ declare_args() { # Sets -dV8_ENABLE_CHECKS. v8_enable_v8_checks = "" - # Sets -dV8_TRACE_IGNITION. + # Sets -dV8_TRACE_UNOPTIMIZED. + v8_enable_trace_unoptimized = "" v8_enable_trace_ignition = false + v8_enable_trace_baseline_exec = false # Sets -dV8_TRACE_FEEDBACK_UPDATES. v8_enable_trace_feedback_updates = false @@ -292,6 +282,16 @@ declare_args() { # Experimental feature for always keeping prototypes in dict/"slow" mode # Sets -DV8_DICT_MODE_PROTOTYPES v8_dict_mode_prototypes = false + + # If enabled then macro definitions that are used in externally visible + # header files are placed in a separate header file v8-gn.h. + v8_generate_external_defines_header = false + + # Experimental feature for tracking constness of properties in non-global + # dictionaries. Enabling this also always keeps prototypes in dict mode, + # meaning that they are not switched to fast mode. + # Sets -DV8_DICT_PROPERTY_CONST_TRACKING + v8_dict_property_const_tracking = false } # Derived defaults. @@ -346,6 +346,14 @@ assert(!v8_enable_concurrent_marking || v8_enable_atomic_object_field_writes, "Concurrent marking requires atomic object field writes.") assert(!v8_enable_concurrent_marking || v8_enable_atomic_marking_state, "Concurrent marking requires atomic marking state.") +if (v8_enable_trace_unoptimized == "") { + v8_enable_trace_unoptimized = + v8_enable_trace_ignition || v8_enable_trace_baseline_exec +} +assert(!v8_enable_trace_ignition || v8_enable_trace_unoptimized, + "Ignition tracing requires unoptimized tracing to be enabled.") +assert(!v8_enable_trace_baseline_exec || v8_enable_trace_unoptimized, + "Baseline tracing requires unoptimized tracing to be enabled.") # Toggle pointer compression for correctness fuzzing when building the # clang_x64_pointer_compression toolchain. We'll correctness-compare the @@ -416,6 +424,7 @@ config("internal_config_base") { ".", "include", "$target_gen_dir", + "$target_gen_dir/include", ] } @@ -465,6 +474,7 @@ config("libbase_config") { if (is_android && current_toolchain != host_toolchain) { libs += [ "log" ] } + include_dirs = [ "$target_gen_dir/include" ] } # Standalone cppgc cannot be built within chrome or with perfetto. @@ -484,23 +494,31 @@ config("libsampler_config") { include_dirs = [ "include" ] } -# This config should only be applied to code using V8 and not any V8 code -# itself. -config("external_config") { +# This config is only applied to v8_headers and is the basis for external_config +# but without setting the USING_V8_SHARED define, which means v8_headers can be +# used inside v8 itself. +config("headers_config") { defines = [] configs = [ ":v8_header_features", ":cppgc_header_features", ] - if (is_component_build) { - defines += [ "USING_V8_SHARED" ] - } include_dirs = [ "include", "$target_gen_dir/include", ] } +# This config should only be applied to code using V8 and not any V8 code +# itself. +config("external_config") { + configs = [ ":headers_config" ] + defines = [] + if (is_component_build) { + defines += [ "USING_V8_SHARED" ] + } +} + # This config should only be applied to code that needs to be explicitly # aware of whether we are using startup data or not. config("external_startup_data") { @@ -509,58 +527,99 @@ config("external_startup_data") { } } +# List of defines that can appear in externally visible header files and that +# are controlled by args.gn. +external_v8_defines = [ + "V8_ENABLE_CHECKS", + "V8_COMPRESS_POINTERS", + "V8_31BIT_SMIS_ON_64BIT_ARCH", + "V8_COMPRESS_ZONES", + "V8_HEAP_SANDBOX", + "V8_DEPRECATION_WARNINGS", + "V8_IMMINENT_DEPRECATION_WARNINGS", + "V8_NO_ARGUMENTS_ADAPTOR", + "V8_USE_PERFETTO", +] + +enabled_external_v8_defines = [] + +if (v8_enable_v8_checks) { + enabled_external_v8_defines += [ "V8_ENABLE_CHECKS" ] +} +if (v8_enable_pointer_compression) { + enabled_external_v8_defines += [ "V8_COMPRESS_POINTERS" ] +} +if (v8_enable_pointer_compression || v8_enable_31bit_smis_on_64bit_arch) { + enabled_external_v8_defines += [ "V8_31BIT_SMIS_ON_64BIT_ARCH" ] +} +if (v8_enable_zone_compression) { + enabled_external_v8_defines += [ "V8_COMPRESS_ZONES" ] +} +if (v8_enable_heap_sandbox) { + enabled_external_v8_defines += [ "V8_HEAP_SANDBOX" ] +} +if (v8_deprecation_warnings) { + enabled_external_v8_defines += [ "V8_DEPRECATION_WARNINGS" ] +} +if (v8_imminent_deprecation_warnings) { + enabled_external_v8_defines += [ "V8_IMMINENT_DEPRECATION_WARNINGS" ] +} +if (v8_use_perfetto) { + enabled_external_v8_defines += [ "V8_USE_PERFETTO" ] +} + +disabled_external_v8_defines = external_v8_defines - enabled_external_v8_defines + # Put defines that are used in public headers here; public headers are # defined in "v8_headers" and are included by embedders of V8. config("v8_header_features") { visibility = [ ":*" ] - defines = [] - - if (v8_enable_v8_checks) { - defines += [ "V8_ENABLE_CHECKS" ] # Used in "include/v8.h". - } - if (v8_enable_pointer_compression) { - defines += [ "V8_COMPRESS_POINTERS" ] - } - if (v8_enable_pointer_compression || v8_enable_31bit_smis_on_64bit_arch) { - defines += [ "V8_31BIT_SMIS_ON_64BIT_ARCH" ] - } - if (v8_enable_zone_compression) { - defines += [ "V8_COMPRESS_ZONES" ] - } - if (v8_enable_heap_sandbox) { - defines += [ "V8_HEAP_SANDBOX" ] - } - if (v8_deprecation_warnings) { - defines += [ "V8_DEPRECATION_WARNINGS" ] - } - if (v8_imminent_deprecation_warnings) { - defines += [ "V8_IMMINENT_DEPRECATION_WARNINGS" ] - } - if (v8_disable_arguments_adaptor) { - defines += [ "V8_NO_ARGUMENTS_ADAPTOR" ] - } - if (v8_use_perfetto) { - defines += [ "V8_USE_PERFETTO" ] + if (v8_generate_external_defines_header) { + defines = [ "V8_GN_HEADER" ] + } else { + defines = enabled_external_v8_defines } } +# List of defines that can appear in externally visible cppgc header files and +# that are controlled by args.gn. +external_cppgc_defines = [ + "CPPGC_SUPPORTS_OBJECT_NAMES", + "CPPGC_CAGED_HEAP", + "CPPGC_YOUNG_GENERATION", +] + +enabled_external_cppgc_defines = [] + +if (cppgc_enable_object_names) { + enabled_external_cppgc_defines += [ "CPPGC_SUPPORTS_OBJECT_NAMES" ] +} +if (cppgc_enable_caged_heap) { + enabled_external_cppgc_defines += [ "CPPGC_CAGED_HEAP" ] +} +if (cppgc_enable_young_generation) { + enabled_external_cppgc_defines += [ "CPPGC_YOUNG_GENERATION" ] +} + +disabled_external_cppgc_defines = + external_cppgc_defines - enabled_external_cppgc_defines + config("cppgc_header_features") { visibility = [ ":*" ] - defines = [] - - if (cppgc_enable_object_names) { - defines += [ "CPPGC_SUPPORTS_OBJECT_NAMES" ] - } - if (cppgc_enable_caged_heap) { - defines += [ "CPPGC_CAGED_HEAP" ] - } - if (cppgc_enable_young_generation) { - defines += [ "CPPGC_YOUNG_GENERATION" ] + if (v8_generate_external_defines_header) { + defines = [ "V8_GN_HEADER" ] + } else { + defines = enabled_external_cppgc_defines } } +enabled_external_defines = + enabled_external_v8_defines + enabled_external_cppgc_defines +disabled_external_defines = + disabled_external_v8_defines + disabled_external_cppgc_defines + # Put defines here that are only used in our internal files and NEVER in # external headers that embedders (such as chromium and node) might include. config("features") { @@ -621,8 +680,8 @@ config("features") { if (v8_enable_trace_maps) { defines += [ "V8_TRACE_MAPS" ] } - if (v8_enable_trace_ignition) { - defines += [ "V8_TRACE_IGNITION" ] + if (v8_enable_trace_unoptimized) { + defines += [ "V8_TRACE_UNOPTIMIZED" ] } if (v8_enable_trace_feedback_updates) { defines += [ "V8_TRACE_FEEDBACK_UPDATES" ] @@ -707,6 +766,12 @@ config("features") { if (v8_etw_guid != "") { defines += [ "V8_ETW_GUID=\"$v8_etw_guid\"" ] } + if (v8_enable_webassembly) { + defines += [ "V8_ENABLE_WEBASSEMBLY" ] + } + if (v8_dict_property_const_tracking) { + defines += [ "V8_DICT_PROPERTY_CONST_TRACKING" ] + } } config("toolchain") { @@ -865,6 +930,15 @@ config("toolchain") { } } + # Under simulator build, compiler will not provide __riscv_xlen. Define here + if (v8_current_cpu == "riscv64") { + defines += [ "V8_TARGET_ARCH_RISCV64" ] + defines += [ "__riscv_xlen=64" ] + + #FIXME: Temporarily use MIPS macro for the building. + defines += [ "CAN_USE_FPU_INSTRUCTIONS" ] + } + if (v8_current_cpu == "x86") { defines += [ "V8_TARGET_ARCH_IA32" ] if (is_win) { @@ -953,7 +1027,7 @@ config("toolchain") { } if (v8_current_cpu == "x64" || v8_current_cpu == "arm64" || - v8_current_cpu == "mips64el") { + v8_current_cpu == "mips64el" || v8_current_cpu == "riscv64") { cflags += [ "-Wshorten-64-to-32" ] } } @@ -1144,6 +1218,7 @@ action("postmortem-metadata") { "src/objects/primitive-heap-object.h", "src/objects/primitive-heap-object-inl.h", "src/objects/scope-info.h", + "src/objects/scope-info-inl.h", "src/objects/script.h", "src/objects/script-inl.h", "src/objects/shared-function-info.cc", @@ -1254,7 +1329,10 @@ torque_files = [ "src/builtins/string-at.tq", "src/builtins/string-endswith.tq", "src/builtins/string-html.tq", + "src/builtins/string-includes.tq", + "src/builtins/string-indexof.tq", "src/builtins/string-iterator.tq", + "src/builtins/string-match-search.tq", "src/builtins/string-pad.tq", "src/builtins/string-repeat.tq", "src/builtins/string-replaceall.tq", @@ -1287,6 +1365,7 @@ torque_files = [ "src/builtins/typed-array.tq", "src/builtins/wasm.tq", "src/builtins/weak-ref.tq", + "src/debug/debug-wasm-objects.tq", "src/ic/handler-configuration.tq", "src/objects/allocation-site.tq", "src/objects/api-callbacks.tq", @@ -1339,6 +1418,7 @@ torque_files = [ "src/objects/stack-frame-info.tq", "src/objects/string.tq", "src/objects/struct.tq", + "src/objects/swiss-name-dictionary.tq", "src/objects/synthetic-module.tq", "src/objects/template-objects.tq", "src/objects/templates.tq", @@ -1397,22 +1477,24 @@ template("run_torque") { files = [ "$target_gen_dir/torque-generated/bit-fields.h", "$target_gen_dir/torque-generated/builtin-definitions.h", - "$target_gen_dir/torque-generated/interface-descriptors.inc", - "$target_gen_dir/torque-generated/factory.cc", - "$target_gen_dir/torque-generated/factory.inc", - "$target_gen_dir/torque-generated/field-offsets.h", + "$target_gen_dir/torque-generated/class-debug-readers.cc", + "$target_gen_dir/torque-generated/class-debug-readers.h", + "$target_gen_dir/torque-generated/class-forward-declarations.h", "$target_gen_dir/torque-generated/class-verifiers.cc", "$target_gen_dir/torque-generated/class-verifiers.h", + "$target_gen_dir/torque-generated/csa-types.h", + "$target_gen_dir/torque-generated/debug-macros.cc", + "$target_gen_dir/torque-generated/debug-macros.h", "$target_gen_dir/torque-generated/enum-verifiers.cc", - "$target_gen_dir/torque-generated/objects-printer.cc", - "$target_gen_dir/torque-generated/objects-body-descriptors-inl.inc", - "$target_gen_dir/torque-generated/class-debug-readers.cc", - "$target_gen_dir/torque-generated/class-debug-readers.h", "$target_gen_dir/torque-generated/exported-macros-assembler.cc", "$target_gen_dir/torque-generated/exported-macros-assembler.h", - "$target_gen_dir/torque-generated/csa-types.h", + "$target_gen_dir/torque-generated/factory.cc", + "$target_gen_dir/torque-generated/factory.inc", + "$target_gen_dir/torque-generated/field-offsets.h", "$target_gen_dir/torque-generated/instance-types.h", - "$target_gen_dir/torque-generated/class-forward-declarations.h", + "$target_gen_dir/torque-generated/interface-descriptors.inc", + "$target_gen_dir/torque-generated/objects-body-descriptors-inl.inc", + "$target_gen_dir/torque-generated/objects-printer.cc", ] outputs = [] @@ -1758,6 +1840,8 @@ action("v8_dump_build_config") { "v8_enable_verify_csa=$v8_enable_verify_csa", "v8_enable_lite_mode=$v8_enable_lite_mode", "v8_enable_pointer_compression=$v8_enable_pointer_compression", + "v8_enable_webassembly=$v8_enable_webassembly", + "v8_control_flow_integrity=$v8_control_flow_integrity", "v8_target_cpu=\"$v8_target_cpu\"", ] @@ -1832,6 +1916,8 @@ v8_source_set("v8_initializers") { deps = [ ":torque_generated_initializers", + ":v8_base_without_compiler", + ":v8_shared_internal_headers", ":v8_tracing", ] @@ -1954,6 +2040,11 @@ v8_source_set("v8_initializers") { ### gcmole(arch:s390) ### "src/builtins/s390/builtins-s390.cc", ] + } else if (v8_current_cpu == "riscv64") { + sources += [ + ### gcmole(arch:riscv64) ### + "src/builtins/riscv64/builtins-riscv64.cc", + ] } if (!v8_enable_i18n_support) { @@ -1967,6 +2058,7 @@ v8_source_set("v8_init") { visibility = [ ":*" ] # Only targets in this file can depend on this. deps = [ + ":v8_base_without_compiler", ":v8_initializers", ":v8_tracing", ] @@ -1993,21 +2085,35 @@ v8_header_set("v8_version") { ] } +v8_header_set("v8_config_headers") { + configs = [ ":internal_config" ] + + sources = [ + "include/v8-platform.h", + "include/v8config.h", + ] + + deps = [] + + if (v8_generate_external_defines_header) { + sources += [ "$target_gen_dir/include/v8-gn.h" ] + deps += [ ":gen_v8_gn" ] + } +} + # This is split out to be a non-code containing target that the Chromium browser # can depend upon to get basic v8 types. v8_header_set("v8_headers") { configs = [ ":internal_config" ] - public_configs = [ - ":v8_header_features", - ":cppgc_header_features", - ] + public_configs = [ ":headers_config" ] sources = [ "include/v8-cppgc.h", "include/v8-fast-api-calls.h", "include/v8-internal.h", + "include/v8-profiler.h", + "include/v8-util.h", "include/v8.h", - "include/v8config.h", ] sources += [ @@ -2018,23 +2124,59 @@ v8_header_set("v8_headers") { "include/v8-wasm-trap-handler-win.h", ] + public_deps = [ ":v8_config_headers" ] + deps = [ ":v8_version" ] } -v8_source_set("v8_wrappers") { +if (v8_generate_external_defines_header) { + action("gen_v8_gn") { + visibility = [ ":*" ] + + script = "tools/gen-v8-gn.py" + outputs = [ "$target_gen_dir/include/v8-gn.h" ] + + args = [ + "-o", + rebase_path("$target_gen_dir/include/v8-gn.h", root_build_dir), + ] + foreach(define, enabled_external_defines) { + args += [ + "-p", + define, + ] + } + foreach(define, disabled_external_defines) { + args += [ + "-n", + define, + ] + } + } +} + +v8_header_set("v8_wrappers") { configs = [ ":internal_config" ] sources = [ "src/base/platform/wrappers.h" ] } -# This is split out to share basic headers with Torque. +# This is split out to share basic headers with Torque and everything else:( v8_header_set("v8_shared_internal_headers") { - visibility = [ ":*" ] # Only targets in this file can depend on this. + visibility = [ + ":*", + "test/cctest:*", + "test/unittests:*", + "tools/debug_helper/:*", + ] configs = [ ":internal_config" ] sources = [ "src/common/globals.h" ] - deps = [ ":v8_headers" ] + deps = [ + ":v8_headers", + ":v8_libbase", + ] } v8_compiler_sources = [ @@ -2202,6 +2344,8 @@ v8_compiler_sources = [ "src/compiler/node-marker.h", "src/compiler/node-matchers.cc", "src/compiler/node-matchers.h", + "src/compiler/node-observer.cc", + "src/compiler/node-observer.h", "src/compiler/node-origin-table.cc", "src/compiler/node-origin-table.h", "src/compiler/node-properties.cc", @@ -2291,6 +2435,12 @@ v8_source_set("v8_compiler_opt") { ":v8_tracing", ] + deps = [ + ":v8_base_without_compiler", + ":v8_libbase", + ":v8_shared_internal_headers", + ] + if (is_debug && !v8_optimized_debug && v8_enable_fast_mksnapshot) { # The :no_optimize config is added to v8_add_configs in v8.gni. remove_configs = [ "//build/config/compiler:no_optimize" ] @@ -2316,6 +2466,12 @@ v8_source_set("v8_compiler") { ":v8_tracing", ] + deps = [ + ":v8_base_without_compiler", + ":v8_libbase", + ":v8_shared_internal_headers", + ] + configs = [ ":internal_config" ] } @@ -2351,35 +2507,20 @@ v8_source_set("v8_base_without_compiler") { ### gcmole(all) ### "$target_gen_dir/builtins-generated/bytecodes-builtins-list.h", "include/cppgc/common.h", - "include/v8-cppgc.h", - "include/v8-fast-api-calls.h", "include/v8-inspector-protocol.h", "include/v8-inspector.h", - "include/v8-internal.h", "include/v8-metrics.h", - "include/v8-platform.h", - "include/v8-profiler.h", "include/v8-unwinder-state.h", - "include/v8-util.h", "include/v8-wasm-trap-handler-posix.h", - "include/v8.h", - "include/v8config.h", "src/api/api-arguments-inl.h", "src/api/api-arguments.cc", "src/api/api-arguments.h", + "src/api/api-inl.h", + "src/api/api-macros.h", "src/api/api-natives.cc", "src/api/api-natives.h", "src/api/api.cc", "src/api/api.h", - "src/asmjs/asm-js.cc", - "src/asmjs/asm-js.h", - "src/asmjs/asm-names.h", - "src/asmjs/asm-parser.cc", - "src/asmjs/asm-parser.h", - "src/asmjs/asm-scanner.cc", - "src/asmjs/asm-scanner.h", - "src/asmjs/asm-types.cc", - "src/asmjs/asm-types.h", "src/ast/ast-function-literal-id-reindexer.cc", "src/ast/ast-function-literal-id-reindexer.h", "src/ast/ast-source-ranges.h", @@ -2398,6 +2539,12 @@ v8_source_set("v8_base_without_compiler") { "src/ast/source-range-ast-visitor.h", "src/ast/variables.cc", "src/ast/variables.h", + "src/baseline/baseline-assembler-inl.h", + "src/baseline/baseline-assembler.h", + "src/baseline/baseline-compiler.cc", + "src/baseline/baseline-compiler.h", + "src/baseline/baseline.cc", + "src/baseline/baseline.h", "src/builtins/accessors.cc", "src/builtins/accessors.h", "src/builtins/builtins-api.cc", @@ -2529,6 +2676,7 @@ v8_source_set("v8_base_without_compiler") { "src/debug/debug-evaluate.h", "src/debug/debug-frames.cc", "src/debug/debug-frames.h", + "src/debug/debug-interface.cc", "src/debug/debug-interface.h", "src/debug/debug-property-iterator.cc", "src/debug/debug-property-iterator.h", @@ -2540,8 +2688,9 @@ v8_source_set("v8_base_without_compiler") { "src/debug/debug-stack-trace-iterator.h", "src/debug/debug-type-profile.cc", "src/debug/debug-type-profile.h", - "src/debug/debug-wasm-support.cc", - "src/debug/debug-wasm-support.h", + "src/debug/debug-wasm-objects-inl.h", + "src/debug/debug-wasm-objects.cc", + "src/debug/debug-wasm-objects.h", "src/debug/debug.cc", "src/debug/debug.h", "src/debug/interface-types.h", @@ -2549,8 +2698,18 @@ v8_source_set("v8_base_without_compiler") { "src/debug/liveedit.h", "src/deoptimizer/deoptimize-reason.cc", "src/deoptimizer/deoptimize-reason.h", + "src/deoptimizer/deoptimized-frame-info.cc", + "src/deoptimizer/deoptimized-frame-info.h", "src/deoptimizer/deoptimizer.cc", "src/deoptimizer/deoptimizer.h", + "src/deoptimizer/frame-description.h", + "src/deoptimizer/materialized-object-store.cc", + "src/deoptimizer/materialized-object-store.h", + "src/deoptimizer/translated-state.cc", + "src/deoptimizer/translated-state.h", + "src/deoptimizer/translation-array.cc", + "src/deoptimizer/translation-array.h", + "src/deoptimizer/translation-opcode.h", "src/diagnostics/basic-block-profiler.cc", "src/diagnostics/basic-block-profiler.h", "src/diagnostics/code-tracer.h", @@ -2959,8 +3118,6 @@ v8_source_set("v8_base_without_compiler") { "src/objects/fixed-array.h", "src/objects/foreign-inl.h", "src/objects/foreign.h", - "src/objects/frame-array-inl.h", - "src/objects/frame-array.h", "src/objects/free-space-inl.h", "src/objects/free-space.h", "src/objects/function-kind.h", @@ -3040,9 +3197,6 @@ v8_source_set("v8_base_without_compiler") { "src/objects/js-weak-refs.h", "src/objects/keys.cc", "src/objects/keys.h", - "src/objects/layout-descriptor-inl.h", - "src/objects/layout-descriptor.cc", - "src/objects/layout-descriptor.h", "src/objects/literal-objects-inl.h", "src/objects/literal-objects.cc", "src/objects/literal-objects.h", @@ -3103,6 +3257,7 @@ v8_source_set("v8_base_without_compiler") { "src/objects/prototype-info.h", "src/objects/prototype.h", "src/objects/regexp-match-info.h", + "src/objects/scope-info-inl.h", "src/objects/scope-info.cc", "src/objects/scope-info.h", "src/objects/script-inl.h", @@ -3130,6 +3285,10 @@ v8_source_set("v8_base_without_compiler") { "src/objects/string.h", "src/objects/struct-inl.h", "src/objects/struct.h", + "src/objects/swiss-hash-table-helpers.h", + "src/objects/swiss-name-dictionary-inl.h", + "src/objects/swiss-name-dictionary.cc", + "src/objects/swiss-name-dictionary.h", "src/objects/synthetic-module-inl.h", "src/objects/synthetic-module.cc", "src/objects/synthetic-module.h", @@ -3275,7 +3434,6 @@ v8_source_set("v8_base_without_compiler") { "src/runtime/runtime-futex.cc", "src/runtime/runtime-generator.cc", "src/runtime/runtime-internal.cc", - "src/runtime/runtime-interpreter.cc", "src/runtime/runtime-intl.cc", "src/runtime/runtime-literals.cc", "src/runtime/runtime-module.cc", @@ -3289,6 +3447,7 @@ v8_source_set("v8_base_without_compiler") { "src/runtime/runtime-strings.cc", "src/runtime/runtime-symbol.cc", "src/runtime/runtime-test.cc", + "src/runtime/runtime-trace.cc", "src/runtime/runtime-typedarray.cc", "src/runtime/runtime-utils.h", "src/runtime/runtime-wasm.cc", @@ -3439,6 +3598,7 @@ v8_source_set("v8_base_without_compiler") { "src/wasm/streaming-decoder.h", "src/wasm/struct-types.h", "src/wasm/sync-streaming-decoder.cc", + "src/wasm/value-type.cc", "src/wasm/value-type.h", "src/wasm/wasm-arguments.h", "src/wasm/wasm-code-manager.cc", @@ -3498,6 +3658,20 @@ v8_source_set("v8_base_without_compiler") { "src/zone/zone.h", ] + if (v8_enable_webassembly) { + sources += [ + "src/asmjs/asm-js.cc", + "src/asmjs/asm-js.h", + "src/asmjs/asm-names.h", + "src/asmjs/asm-parser.cc", + "src/asmjs/asm-parser.h", + "src/asmjs/asm-scanner.cc", + "src/asmjs/asm-scanner.h", + "src/asmjs/asm-types.cc", + "src/asmjs/asm-types.h", + ] + } + if (!v8_control_flow_integrity) { sources += [ "src/execution/pointer-authentication-dummy.h" ] } @@ -3546,6 +3720,8 @@ v8_source_set("v8_base_without_compiler") { if (v8_current_cpu == "x86") { sources += [ ### gcmole(arch:ia32) ### + "src/baseline/ia32/baseline-assembler-ia32-inl.h", + "src/baseline/ia32/baseline-compiler-ia32-inl.h", "src/codegen/ia32/assembler-ia32-inl.h", "src/codegen/ia32/assembler-ia32.cc", "src/codegen/ia32/assembler-ia32.h", @@ -3572,6 +3748,8 @@ v8_source_set("v8_base_without_compiler") { ] } else if (v8_current_cpu == "x64") { sources += [ ### gcmole(arch:x64) ### + "src/baseline/x64/baseline-assembler-x64-inl.h", + "src/baseline/x64/baseline-compiler-x64-inl.h", "src/codegen/x64/assembler-x64-inl.h", "src/codegen/x64/assembler-x64.cc", "src/codegen/x64/assembler-x64.h", @@ -3622,6 +3800,8 @@ v8_source_set("v8_base_without_compiler") { } } else if (v8_current_cpu == "arm") { sources += [ ### gcmole(arch:arm) ### + "src/baseline/arm/baseline-assembler-arm-inl.h", + "src/baseline/arm/baseline-compiler-arm-inl.h", "src/codegen/arm/assembler-arm-inl.h", "src/codegen/arm/assembler-arm.cc", "src/codegen/arm/assembler-arm.h", @@ -3653,6 +3833,8 @@ v8_source_set("v8_base_without_compiler") { ] } else if (v8_current_cpu == "arm64") { sources += [ ### gcmole(arch:arm64) ### + "src/baseline/arm64/baseline-assembler-arm64-inl.h", + "src/baseline/arm64/baseline-compiler-arm64-inl.h", "src/codegen/arm64/assembler-arm64-inl.h", "src/codegen/arm64/assembler-arm64.cc", "src/codegen/arm64/assembler-arm64.h", @@ -3697,6 +3879,13 @@ v8_source_set("v8_base_without_compiler") { if (v8_control_flow_integrity) { sources += [ "src/execution/arm64/pointer-authentication-arm64.h" ] } + if (current_cpu == "arm64" && is_mac) { + sources += [ + "src/trap-handler/handler-inside-posix.cc", + "src/trap-handler/handler-inside-posix.h", + "src/trap-handler/handler-outside-posix.cc", + ] + } if (is_win) { sources += [ "src/diagnostics/unwinding-info-win64.cc", @@ -3705,6 +3894,8 @@ v8_source_set("v8_base_without_compiler") { } } else if (v8_current_cpu == "mips" || v8_current_cpu == "mipsel") { sources += [ ### gcmole(arch:mipsel) ### + "src/baseline/mips/baseline-assembler-mips-inl.h", + "src/baseline/mips/baseline-compiler-mips-inl.h", "src/codegen/mips/assembler-mips-inl.h", "src/codegen/mips/assembler-mips.cc", "src/codegen/mips/assembler-mips.h", @@ -3733,6 +3924,8 @@ v8_source_set("v8_base_without_compiler") { ] } else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") { sources += [ ### gcmole(arch:mips64el) ### + "src/baseline/mips64/baseline-assembler-mips64-inl.h", + "src/baseline/mips64/baseline-compiler-mips64-inl.h", "src/codegen/mips64/assembler-mips64-inl.h", "src/codegen/mips64/assembler-mips64.cc", "src/codegen/mips64/assembler-mips64.h", @@ -3761,6 +3954,8 @@ v8_source_set("v8_base_without_compiler") { ] } else if (v8_current_cpu == "ppc") { sources += [ ### gcmole(arch:ppc) ### + "src/baseline/ppc/baseline-assembler-ppc-inl.h", + "src/baseline/ppc/baseline-compiler-ppc-inl.h", "src/codegen/ppc/assembler-ppc-inl.h", "src/codegen/ppc/assembler-ppc.cc", "src/codegen/ppc/assembler-ppc.h", @@ -3792,6 +3987,8 @@ v8_source_set("v8_base_without_compiler") { ] } else if (v8_current_cpu == "ppc64") { sources += [ ### gcmole(arch:ppc64) ### + "src/baseline/ppc/baseline-assembler-ppc-inl.h", + "src/baseline/ppc/baseline-compiler-ppc-inl.h", "src/codegen/ppc/assembler-ppc-inl.h", "src/codegen/ppc/assembler-ppc.cc", "src/codegen/ppc/assembler-ppc.h", @@ -3823,6 +4020,8 @@ v8_source_set("v8_base_without_compiler") { ] } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") { sources += [ ### gcmole(arch:s390) ### + "src/baseline/s390/baseline-assembler-s390-inl.h", + "src/baseline/s390/baseline-compiler-s390-inl.h", "src/codegen/s390/assembler-s390-inl.h", "src/codegen/s390/assembler-s390.cc", "src/codegen/s390/assembler-s390.h", @@ -3852,6 +4051,34 @@ v8_source_set("v8_base_without_compiler") { "src/regexp/s390/regexp-macro-assembler-s390.h", "src/wasm/baseline/s390/liftoff-assembler-s390.h", ] + } else if (v8_current_cpu == "riscv64") { + sources += [ ### gcmole(arch:riscv64) ### + "src/codegen/riscv64/assembler-riscv64-inl.h", + "src/codegen/riscv64/assembler-riscv64.cc", + "src/codegen/riscv64/assembler-riscv64.h", + "src/codegen/riscv64/constants-riscv64.cc", + "src/codegen/riscv64/constants-riscv64.h", + "src/codegen/riscv64/cpu-riscv64.cc", + "src/codegen/riscv64/interface-descriptors-riscv64.cc", + "src/codegen/riscv64/macro-assembler-riscv64.cc", + "src/codegen/riscv64/macro-assembler-riscv64.h", + "src/codegen/riscv64/register-riscv64.h", + "src/compiler/backend/riscv64/code-generator-riscv64.cc", + "src/compiler/backend/riscv64/instruction-codes-riscv64.h", + "src/compiler/backend/riscv64/instruction-scheduler-riscv64.cc", + "src/compiler/backend/riscv64/instruction-selector-riscv64.cc", + "src/debug/riscv64/debug-riscv64.cc", + "src/deoptimizer/riscv64/deoptimizer-riscv64.cc", + "src/diagnostics/riscv64/disasm-riscv64.cc", + "src/diagnostics/riscv64/unwinder-riscv64.cc", + "src/execution/riscv64/frame-constants-riscv64.cc", + "src/execution/riscv64/frame-constants-riscv64.h", + "src/execution/riscv64/simulator-riscv64.cc", + "src/execution/riscv64/simulator-riscv64.h", + "src/regexp/riscv64/regexp-macro-assembler-riscv64.cc", + "src/regexp/riscv64/regexp-macro-assembler-riscv64.h", + "src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h", + ] } configs = [ @@ -3876,6 +4103,7 @@ v8_source_set("v8_base_without_compiler") { ":cppgc_base", ":generate_bytecode_builtins_list", ":run_torque", + ":v8_headers", ":v8_maybe_icu", ] @@ -3952,7 +4180,8 @@ v8_source_set("v8_base_without_compiler") { if (v8_current_cpu == "mips" || v8_current_cpu == "mipsel" || v8_current_cpu == "mips64" || v8_current_cpu == "mips64el" || v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" || - v8_current_cpu == "s390" || v8_current_cpu == "s390x") { + v8_current_cpu == "s390" || v8_current_cpu == "s390x" || + v8_current_cpu == "riscv64") { libs += [ "atomic" ] } @@ -4297,8 +4526,15 @@ v8_component("v8_libbase") { sources += [ "src/base/ubsan.cc" ] } + if (v8_current_cpu == "riscv64") { + libs += [ "atomic" ] + } + if (is_tsan && !build_with_chromium) { data += [ "tools/sanitizers/tsan_suppressions.txt" ] + + # llvm-symbolizer uses libstdc++ from the clang package. + data += [ "//third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6" ] } # TODO(jochen): Add support for qnx, freebsd, openbsd, netbsd, and solaris. @@ -4413,6 +4649,7 @@ v8_source_set("v8_cppgc_shared") { "src/heap/base/stack.h", "src/heap/base/worklist.cc", "src/heap/base/worklist.h", + "src/heap/cppgc/sanitizers.h", ] if (is_clang || !is_win) { @@ -4432,6 +4669,8 @@ v8_source_set("v8_cppgc_shared") { sources += [ "src/heap/base/asm/mips/push_registers_asm.cc" ] } else if (current_cpu == "mips64el") { sources += [ "src/heap/base/asm/mips64/push_registers_asm.cc" ] + } else if (current_cpu == "riscv64") { + sources += [ "src/heap/base/asm/riscv64/push_registers_asm.cc" ] } } else if (is_win) { if (current_cpu == "x64") { @@ -4465,6 +4704,7 @@ v8_header_set("cppgc_headers") { "include/cppgc/visitor.h", ] + deps = [ ":cppgc_base" ] public_deps = [ ":v8_headers" ] } @@ -4479,6 +4719,8 @@ v8_source_set("cppgc_base") { "include/cppgc/ephemeron-pair.h", "include/cppgc/garbage-collected.h", "include/cppgc/heap-consistency.h", + "include/cppgc/heap-state.h", + "include/cppgc/heap-statistics.h", "include/cppgc/heap.h", "include/cppgc/internal/api-constants.h", "include/cppgc/internal/atomic-entry-flag.h", @@ -4489,20 +4731,21 @@ v8_source_set("cppgc_base") { "include/cppgc/internal/persistent-node.h", "include/cppgc/internal/pointer-policies.h", "include/cppgc/internal/prefinalizer-handler.h", - "include/cppgc/internal/process-heap.h", "include/cppgc/internal/write-barrier.h", "include/cppgc/liveness-broker.h", "include/cppgc/macros.h", "include/cppgc/member.h", "include/cppgc/name-provider.h", + "include/cppgc/object-size-trait.h", "include/cppgc/persistent.h", "include/cppgc/platform.h", "include/cppgc/prefinalizer.h", + "include/cppgc/process-heap-statistics.h", + "include/cppgc/sentinel-pointer.h", "include/cppgc/source-location.h", "include/cppgc/trace-trait.h", "include/cppgc/type-traits.h", "include/cppgc/visitor.h", - "include/v8config.h", "src/heap/cppgc/allocation.cc", "src/heap/cppgc/compaction-worklists.cc", "src/heap/cppgc/compaction-worklists.h", @@ -4521,6 +4764,7 @@ v8_source_set("cppgc_base") { "src/heap/cppgc/gc-invoker.h", "src/heap/cppgc/heap-base.cc", "src/heap/cppgc/heap-base.h", + "src/heap/cppgc/heap-consistency.cc", "src/heap/cppgc/heap-growing.cc", "src/heap/cppgc/heap-growing.h", "src/heap/cppgc/heap-object-header.cc", @@ -4529,6 +4773,9 @@ v8_source_set("cppgc_base") { "src/heap/cppgc/heap-page.h", "src/heap/cppgc/heap-space.cc", "src/heap/cppgc/heap-space.h", + "src/heap/cppgc/heap-state.cc", + "src/heap/cppgc/heap-statistics-collector.cc", + "src/heap/cppgc/heap-statistics-collector.h", "src/heap/cppgc/heap-visitor.h", "src/heap/cppgc/heap.cc", "src/heap/cppgc/heap.h", @@ -4547,9 +4794,11 @@ v8_source_set("cppgc_base") { "src/heap/cppgc/marking-visitor.h", "src/heap/cppgc/marking-worklists.cc", "src/heap/cppgc/marking-worklists.h", + "src/heap/cppgc/metric-recorder.h", "src/heap/cppgc/name-trait.cc", "src/heap/cppgc/object-allocator.cc", "src/heap/cppgc/object-allocator.h", + "src/heap/cppgc/object-size-trait.cc", "src/heap/cppgc/object-start-bitmap.h", "src/heap/cppgc/page-memory.cc", "src/heap/cppgc/page-memory.h", @@ -4558,11 +4807,12 @@ v8_source_set("cppgc_base") { "src/heap/cppgc/pointer-policies.cc", "src/heap/cppgc/prefinalizer-handler.cc", "src/heap/cppgc/prefinalizer-handler.h", + "src/heap/cppgc/process-heap-statistics.cc", + "src/heap/cppgc/process-heap-statistics.h", "src/heap/cppgc/process-heap.cc", "src/heap/cppgc/process-heap.h", "src/heap/cppgc/raw-heap.cc", "src/heap/cppgc/raw-heap.h", - "src/heap/cppgc/sanitizers.h", "src/heap/cppgc/source-location.cc", "src/heap/cppgc/stats-collector.cc", "src/heap/cppgc/stats-collector.h", @@ -4575,6 +4825,7 @@ v8_source_set("cppgc_base") { "src/heap/cppgc/virtual-memory.h", "src/heap/cppgc/visitor.cc", "src/heap/cppgc/write-barrier.cc", + "src/heap/cppgc/write-barrier.h", ] if (cppgc_is_standalone) { @@ -4598,12 +4849,29 @@ v8_source_set("cppgc_base") { ] public_deps = [ + ":v8_config_headers", ":v8_cppgc_shared", ":v8_libbase", ":v8_libplatform", ] } +v8_source_set("cppgc_base_for_testing") { + visibility = [ ":*" ] + + sources = [ + "include/cppgc/testing.h", + "src/heap/cppgc/testing.cc", + ] + + configs = [ + ":internal_config", + ":cppgc_base_config", + ] + + public_deps = [ ":cppgc_base" ] +} + ############################################################################### # Produce a single static library for embedders # @@ -4633,6 +4901,7 @@ v8_static_library("wee8") { ":v8_libbase", ":v8_libplatform", ":v8_libsampler", + ":v8_shared_internal_headers", ":v8_snapshot", "//build/win:default_exe_manifest", ] @@ -4664,6 +4933,7 @@ if (current_toolchain == v8_generator_toolchain) { "src/builtins/generate-bytecodes-builtins-list.cc", "src/interpreter/bytecode-operands.cc", "src/interpreter/bytecode-operands.h", + "src/interpreter/bytecode-traits.h", "src/interpreter/bytecodes.cc", "src/interpreter/bytecodes.h", ] @@ -4672,6 +4942,7 @@ if (current_toolchain == v8_generator_toolchain) { deps = [ ":v8_libbase", + ":v8_shared_internal_headers", "//build/win:default_exe_manifest", ] } @@ -4712,6 +4983,7 @@ if (current_toolchain == v8_snapshot_toolchain) { ":v8_libbase", ":v8_libplatform", ":v8_maybe_icu", + ":v8_shared_internal_headers", ":v8_tracing", ":v8_wrappers", "//build/win:default_exe_manifest", @@ -4785,10 +5057,14 @@ if (v8_enable_i18n_support) { v8_executable("gen-regexp-special-case") { visibility = [ ":*" ] # Only targets in this file can depend on this. - sources = [ "src/regexp/gen-regexp-special-case.cc" ] + sources = [ + "src/regexp/gen-regexp-special-case.cc", + "src/regexp/special-case.h", + ] deps = [ ":v8_libbase", + ":v8_shared_internal_headers", "//build/win:default_exe_manifest", "//third_party/icu", ] @@ -4893,6 +5169,7 @@ if (is_fuchsia && !build_with_chromium) { cr_fuchsia_package("d8_fuchsia_pkg") { testonly = true binary = ":d8" + manifest = "//build/config/fuchsia/tests-with-exec.cmx" package_name_override = "d8" } @@ -4939,6 +5216,7 @@ if (is_component_build) { sources = [ "src/utils/v8dll-main.cc" ] public_deps = [ + ":cppgc_base_for_testing", ":torque_base", ":torque_ls_base", ":v8_base", @@ -4955,12 +5233,11 @@ if (is_component_build) { v8_component("cppgc") { public_deps = [ ":cppgc_base" ] - configs = [ ":internal_config" ] - if (!cppgc_is_standalone) { deps = [ ":v8" ] } + configs = [] public_configs = [ ":external_config" ] } @@ -4968,9 +5245,12 @@ if (is_component_build) { v8_component("cppgc_for_testing") { testonly = true - public_deps = [ ":cppgc_base" ] + public_deps = [ + ":cppgc_base", + ":cppgc_base_for_testing", + ] - configs = [ ":internal_config" ] + configs = [] public_configs = [ ":external_config" ] } } @@ -4980,7 +5260,7 @@ if (is_component_build) { public_deps = [ ":v8_cppgc_shared" ] - configs = [ ":internal_config" ] + configs = [] public_configs = [ ":external_config" ] } } else { @@ -4997,6 +5277,7 @@ if (is_component_build) { testonly = true public_deps = [ + ":cppgc_base_for_testing", ":torque_base", ":torque_ls_base", ":v8_base", @@ -5021,7 +5302,10 @@ if (is_component_build) { group("cppgc_for_testing") { testonly = true - public_deps = [ ":cppgc_base" ] + public_deps = [ + ":cppgc_base", + ":cppgc_base_for_testing", + ] public_configs = [ ":external_config" ] } @@ -5149,6 +5433,10 @@ if (want_v8_shell) { v8_executable("cppgc_sample") { sources = [ "samples/cppgc/cppgc-sample.cc" ] + if (v8_current_cpu == "riscv64") { + libs = [ "atomic" ] + } + configs = [ # Note: don't use :internal_config here because this target will get # the :external_config applied to it by virtue of depending on :cppgc, and @@ -5277,6 +5565,8 @@ v8_source_set("wasm_test_common") { deps = [ ":generate_bytecode_builtins_list", ":run_torque", + ":v8_libbase", + ":v8_shared_internal_headers", ":v8_tracing", ] @@ -5358,6 +5648,7 @@ v8_source_set("lib_wasm_fuzzer_common") { ":generate_bytecode_builtins_list", ":run_torque", ":v8_tracing", + ":wasm_test_common", ] public_deps = [ ":v8_maybe_icu" ] @@ -5468,28 +5759,77 @@ if (!build_with_chromium && v8_use_perfetto) { sources = [ "third_party/protobuf/src/google/protobuf/any_lite.cc", "third_party/protobuf/src/google/protobuf/arena.cc", + "third_party/protobuf/src/google/protobuf/arena.h", + "third_party/protobuf/src/google/protobuf/arena_impl.h", + "third_party/protobuf/src/google/protobuf/arenastring.h", "third_party/protobuf/src/google/protobuf/extension_set.cc", + "third_party/protobuf/src/google/protobuf/extension_set.h", + "third_party/protobuf/src/google/protobuf/generated_enum_util.cc", + "third_party/protobuf/src/google/protobuf/generated_enum_util.h", "third_party/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc", + "third_party/protobuf/src/google/protobuf/generated_message_table_driven_lite.h", "third_party/protobuf/src/google/protobuf/generated_message_util.cc", + "third_party/protobuf/src/google/protobuf/generated_message_util.h", + "third_party/protobuf/src/google/protobuf/has_bits.h", "third_party/protobuf/src/google/protobuf/implicit_weak_message.cc", + "third_party/protobuf/src/google/protobuf/implicit_weak_message.h", + "third_party/protobuf/src/google/protobuf/inlined_string_field.h", "third_party/protobuf/src/google/protobuf/io/coded_stream.cc", + "third_party/protobuf/src/google/protobuf/io/coded_stream.h", + "third_party/protobuf/src/google/protobuf/io/coded_stream_inl.h", + "third_party/protobuf/src/google/protobuf/io/io_win32.cc", + "third_party/protobuf/src/google/protobuf/io/io_win32.h", "third_party/protobuf/src/google/protobuf/io/strtod.cc", + "third_party/protobuf/src/google/protobuf/io/strtod.h", "third_party/protobuf/src/google/protobuf/io/zero_copy_stream.cc", + "third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h", + "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc", + "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h", "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc", + "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h", + "third_party/protobuf/src/google/protobuf/map.h", + "third_party/protobuf/src/google/protobuf/map_entry_lite.h", + "third_party/protobuf/src/google/protobuf/map_field_lite.h", + "third_party/protobuf/src/google/protobuf/map_type_handler.h", "third_party/protobuf/src/google/protobuf/message_lite.cc", + "third_party/protobuf/src/google/protobuf/message_lite.h", "third_party/protobuf/src/google/protobuf/repeated_field.cc", + "third_party/protobuf/src/google/protobuf/repeated_field.h", "third_party/protobuf/src/google/protobuf/stubs/bytestream.cc", + "third_party/protobuf/src/google/protobuf/stubs/bytestream.h", + "third_party/protobuf/src/google/protobuf/stubs/callback.h", + "third_party/protobuf/src/google/protobuf/stubs/casts.h", "third_party/protobuf/src/google/protobuf/stubs/common.cc", + "third_party/protobuf/src/google/protobuf/stubs/common.h", + "third_party/protobuf/src/google/protobuf/stubs/fastmem.h", + "third_party/protobuf/src/google/protobuf/stubs/hash.h", "third_party/protobuf/src/google/protobuf/stubs/int128.cc", - "third_party/protobuf/src/google/protobuf/stubs/io_win32.cc", + "third_party/protobuf/src/google/protobuf/stubs/int128.h", + "third_party/protobuf/src/google/protobuf/stubs/logging.h", + "third_party/protobuf/src/google/protobuf/stubs/macros.h", + "third_party/protobuf/src/google/protobuf/stubs/map_util.h", + "third_party/protobuf/src/google/protobuf/stubs/mutex.h", + "third_party/protobuf/src/google/protobuf/stubs/once.h", + "third_party/protobuf/src/google/protobuf/stubs/platform_macros.h", + "third_party/protobuf/src/google/protobuf/stubs/port.h", "third_party/protobuf/src/google/protobuf/stubs/status.cc", + "third_party/protobuf/src/google/protobuf/stubs/status.h", + "third_party/protobuf/src/google/protobuf/stubs/status_macros.h", "third_party/protobuf/src/google/protobuf/stubs/statusor.cc", + "third_party/protobuf/src/google/protobuf/stubs/statusor.h", + "third_party/protobuf/src/google/protobuf/stubs/stl_util.h", "third_party/protobuf/src/google/protobuf/stubs/stringpiece.cc", + "third_party/protobuf/src/google/protobuf/stubs/stringpiece.h", "third_party/protobuf/src/google/protobuf/stubs/stringprintf.cc", + "third_party/protobuf/src/google/protobuf/stubs/stringprintf.h", "third_party/protobuf/src/google/protobuf/stubs/structurally_valid.cc", "third_party/protobuf/src/google/protobuf/stubs/strutil.cc", + "third_party/protobuf/src/google/protobuf/stubs/strutil.h", + "third_party/protobuf/src/google/protobuf/stubs/template_util.h", "third_party/protobuf/src/google/protobuf/stubs/time.cc", + "third_party/protobuf/src/google/protobuf/stubs/time.h", "third_party/protobuf/src/google/protobuf/wire_format_lite.cc", + "third_party/protobuf/src/google/protobuf/wire_format_lite.h", ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ @@ -5507,59 +5847,119 @@ if (!build_with_chromium && v8_use_perfetto) { deps = [ ":protobuf_lite" ] sources = [ "third_party/protobuf/src/google/protobuf/any.cc", + "third_party/protobuf/src/google/protobuf/any.h", "third_party/protobuf/src/google/protobuf/any.pb.cc", + "third_party/protobuf/src/google/protobuf/any.pb.h", "third_party/protobuf/src/google/protobuf/api.pb.cc", + "third_party/protobuf/src/google/protobuf/api.pb.h", "third_party/protobuf/src/google/protobuf/compiler/importer.cc", + "third_party/protobuf/src/google/protobuf/compiler/importer.h", "third_party/protobuf/src/google/protobuf/compiler/parser.cc", + "third_party/protobuf/src/google/protobuf/compiler/parser.h", "third_party/protobuf/src/google/protobuf/descriptor.cc", + "third_party/protobuf/src/google/protobuf/descriptor.h", "third_party/protobuf/src/google/protobuf/descriptor.pb.cc", + "third_party/protobuf/src/google/protobuf/descriptor.pb.h", "third_party/protobuf/src/google/protobuf/descriptor_database.cc", + "third_party/protobuf/src/google/protobuf/descriptor_database.h", "third_party/protobuf/src/google/protobuf/duration.pb.cc", + "third_party/protobuf/src/google/protobuf/duration.pb.h", "third_party/protobuf/src/google/protobuf/dynamic_message.cc", + "third_party/protobuf/src/google/protobuf/dynamic_message.h", "third_party/protobuf/src/google/protobuf/empty.pb.cc", + "third_party/protobuf/src/google/protobuf/empty.pb.h", "third_party/protobuf/src/google/protobuf/extension_set_heavy.cc", "third_party/protobuf/src/google/protobuf/field_mask.pb.cc", + "third_party/protobuf/src/google/protobuf/field_mask.pb.h", + "third_party/protobuf/src/google/protobuf/generated_enum_reflection.h", "third_party/protobuf/src/google/protobuf/generated_message_reflection.cc", - "third_party/protobuf/src/google/protobuf/generated_message_table_driven.cc", + "third_party/protobuf/src/google/protobuf/generated_message_reflection.h", "third_party/protobuf/src/google/protobuf/io/gzip_stream.cc", + "third_party/protobuf/src/google/protobuf/io/gzip_stream.h", "third_party/protobuf/src/google/protobuf/io/printer.cc", + "third_party/protobuf/src/google/protobuf/io/printer.h", "third_party/protobuf/src/google/protobuf/io/tokenizer.cc", - "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc", + "third_party/protobuf/src/google/protobuf/io/tokenizer.h", + "third_party/protobuf/src/google/protobuf/map_entry.h", "third_party/protobuf/src/google/protobuf/map_field.cc", + "third_party/protobuf/src/google/protobuf/map_field.h", + "third_party/protobuf/src/google/protobuf/map_field_inl.h", "third_party/protobuf/src/google/protobuf/message.cc", + "third_party/protobuf/src/google/protobuf/message.h", + "third_party/protobuf/src/google/protobuf/metadata.h", + "third_party/protobuf/src/google/protobuf/reflection.h", + "third_party/protobuf/src/google/protobuf/reflection_internal.h", "third_party/protobuf/src/google/protobuf/reflection_ops.cc", + "third_party/protobuf/src/google/protobuf/reflection_ops.h", "third_party/protobuf/src/google/protobuf/service.cc", + "third_party/protobuf/src/google/protobuf/service.h", "third_party/protobuf/src/google/protobuf/source_context.pb.cc", + "third_party/protobuf/src/google/protobuf/source_context.pb.h", "third_party/protobuf/src/google/protobuf/struct.pb.cc", + "third_party/protobuf/src/google/protobuf/struct.pb.h", "third_party/protobuf/src/google/protobuf/stubs/mathlimits.cc", + "third_party/protobuf/src/google/protobuf/stubs/mathlimits.h", + "third_party/protobuf/src/google/protobuf/stubs/mathutil.h", "third_party/protobuf/src/google/protobuf/stubs/substitute.cc", + "third_party/protobuf/src/google/protobuf/stubs/substitute.h", "third_party/protobuf/src/google/protobuf/text_format.cc", + "third_party/protobuf/src/google/protobuf/text_format.h", "third_party/protobuf/src/google/protobuf/timestamp.pb.cc", + "third_party/protobuf/src/google/protobuf/timestamp.pb.h", "third_party/protobuf/src/google/protobuf/type.pb.cc", + "third_party/protobuf/src/google/protobuf/type.pb.h", "third_party/protobuf/src/google/protobuf/unknown_field_set.cc", - "third_party/protobuf/src/google/protobuf/util/delimited_message_util.cc", + "third_party/protobuf/src/google/protobuf/unknown_field_set.h", "third_party/protobuf/src/google/protobuf/util/field_comparator.cc", + "third_party/protobuf/src/google/protobuf/util/field_comparator.h", "third_party/protobuf/src/google/protobuf/util/field_mask_util.cc", + "third_party/protobuf/src/google/protobuf/util/field_mask_util.h", + "third_party/protobuf/src/google/protobuf/util/internal/constants.h", "third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc", + "third_party/protobuf/src/google/protobuf/util/internal/datapiece.h", "third_party/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc", + "third_party/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h", "third_party/protobuf/src/google/protobuf/util/internal/error_listener.cc", + "third_party/protobuf/src/google/protobuf/util/internal/error_listener.h", "third_party/protobuf/src/google/protobuf/util/internal/field_mask_utility.cc", + "third_party/protobuf/src/google/protobuf/util/internal/field_mask_utility.h", "third_party/protobuf/src/google/protobuf/util/internal/json_escaping.cc", + "third_party/protobuf/src/google/protobuf/util/internal/json_escaping.h", "third_party/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc", + "third_party/protobuf/src/google/protobuf/util/internal/json_objectwriter.h", "third_party/protobuf/src/google/protobuf/util/internal/json_stream_parser.cc", + "third_party/protobuf/src/google/protobuf/util/internal/json_stream_parser.h", + "third_party/protobuf/src/google/protobuf/util/internal/location_tracker.h", + "third_party/protobuf/src/google/protobuf/util/internal/object_location_tracker.h", + "third_party/protobuf/src/google/protobuf/util/internal/object_source.h", "third_party/protobuf/src/google/protobuf/util/internal/object_writer.cc", + "third_party/protobuf/src/google/protobuf/util/internal/object_writer.h", "third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc", + "third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h", "third_party/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc", + "third_party/protobuf/src/google/protobuf/util/internal/protostream_objectsource.h", "third_party/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc", + "third_party/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.h", + "third_party/protobuf/src/google/protobuf/util/internal/structured_objectwriter.h", "third_party/protobuf/src/google/protobuf/util/internal/type_info.cc", + "third_party/protobuf/src/google/protobuf/util/internal/type_info.h", "third_party/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc", + "third_party/protobuf/src/google/protobuf/util/internal/type_info_test_helper.h", "third_party/protobuf/src/google/protobuf/util/internal/utility.cc", + "third_party/protobuf/src/google/protobuf/util/internal/utility.h", "third_party/protobuf/src/google/protobuf/util/json_util.cc", + "third_party/protobuf/src/google/protobuf/util/json_util.h", "third_party/protobuf/src/google/protobuf/util/message_differencer.cc", + "third_party/protobuf/src/google/protobuf/util/message_differencer.h", "third_party/protobuf/src/google/protobuf/util/time_util.cc", + "third_party/protobuf/src/google/protobuf/util/time_util.h", + "third_party/protobuf/src/google/protobuf/util/type_resolver.h", "third_party/protobuf/src/google/protobuf/util/type_resolver_util.cc", + "third_party/protobuf/src/google/protobuf/util/type_resolver_util.h", "third_party/protobuf/src/google/protobuf/wire_format.cc", + "third_party/protobuf/src/google/protobuf/wire_format.h", "third_party/protobuf/src/google/protobuf/wrappers.pb.cc", + "third_party/protobuf/src/google/protobuf/wrappers.pb.h", ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ @@ -5577,25 +5977,47 @@ if (!build_with_chromium && v8_use_perfetto) { deps = [ ":protobuf_full" ] sources = [ "third_party/protobuf/src/google/protobuf/compiler/code_generator.cc", + "third_party/protobuf/src/google/protobuf/compiler/code_generator.h", "third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc", + "third_party/protobuf/src/google/protobuf/compiler/command_line_interface.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.h", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_service.h", "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc", + "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.h", "third_party/protobuf/src/google/protobuf/compiler/plugin.cc", + "third_party/protobuf/src/google/protobuf/compiler/plugin.h", "third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc", + "third_party/protobuf/src/google/protobuf/compiler/plugin.pb.h", "third_party/protobuf/src/google/protobuf/compiler/subprocess.cc", + "third_party/protobuf/src/google/protobuf/compiler/subprocess.h", "third_party/protobuf/src/google/protobuf/compiler/zip_writer.cc", + "third_party/protobuf/src/google/protobuf/compiler/zip_writer.h", ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ @@ -5632,7 +6054,7 @@ if (!build_with_chromium && v8_use_perfetto) { "//third_party/perfetto/protos/perfetto/config:cpp", "//third_party/perfetto/protos/perfetto/trace/track_event:zero", "//third_party/perfetto/src/tracing:in_process_backend", - "//third_party/perfetto/src/tracing:platform_posix", + "//third_party/perfetto/src/tracing:platform_impl", ] } } # if (!build_with_chromium && v8_use_perfetto) diff --git a/deps/v8/COMMON_OWNERS b/deps/v8/COMMON_OWNERS index 74026eaeffd497..a6aff24098864d 100644 --- a/deps/v8/COMMON_OWNERS +++ b/deps/v8/COMMON_OWNERS @@ -34,7 +34,6 @@ sigurds@chromium.org solanes@chromium.org syg@chromium.org szuend@chromium.org -tebbi@chromium.org thibaudm@chromium.org ulan@chromium.org vahl@chromium.org diff --git a/deps/v8/DEPS b/deps/v8/DEPS index e6c2e762e01392..48ddbad6af96f1 100644 --- a/deps/v8/DEPS +++ b/deps/v8/DEPS @@ -47,10 +47,10 @@ vars = { 'checkout_google_benchmark' : False, # GN CIPD package version. - 'gn_version': 'git_revision:595e3be7c8381d4eeefce62a63ec12bae9ce5140', + 'gn_version': 'git_revision:dfcbc6fed0a8352696f92d67ccad54048ad182b3', # luci-go CIPD package version. - 'luci_go': 'git_revision:67aba6e3373bb0b9e3ef9871362045736cd29b6e', + 'luci_go': 'git_revision:fd10124659e991321df2f8a5d3749687b54ceb0a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_build-tools_version @@ -88,17 +88,17 @@ vars = { deps = { 'build': - Var('chromium_url') + '/chromium/src/build.git' + '@' + 'd5995537211ebc4d1bc37f215c25fa3781ba9d6e', + Var('chromium_url') + '/chromium/src/build.git' + '@' + '446bf3e5a00bfe4fd99d91cb76ec3b3a7b34d226', 'third_party/depot_tools': - Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '82b992a1656d7d1cd0ee3cbea8ff609ffdfed380', + Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '5fe664f150beaf71104ce7787560fabdb55ebf5b', 'third_party/icu': - Var('chromium_url') + '/chromium/deps/icu.git' + '@' + '899e18383fd732b47e6978db2b960a1b2a80179b', + Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'e05b663d1c50b4e9ecc3ff9325f5158f1d071471', 'third_party/instrumented_libraries': - Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + '4d3867052d35b2171f2edbb3466fa8f7e2d11319', + Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + '0964a78c832d1d0f2669b020b073c38f67509cf2', 'buildtools': - Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '235cfe435ca5a9826569ee4ef603e226216bd768', + Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '4c78ef9c38b683c5c5cbac70445378c2362cebfc', 'buildtools/clang_format/script': - Var('chromium_url') + '/chromium/llvm-project/cfe/tools/clang-format.git' + '@' + '96636aa0e9f047f17447f2d45a094d0b59ed7917', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/clang/tools/clang-format.git' + '@' + '99803d74e35962f63a775f29477882afd4d57d94', 'buildtools/linux64': { 'packages': [ { @@ -120,11 +120,11 @@ deps = { 'condition': 'host_os == "mac"', }, 'buildtools/third_party/libc++/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + 'd9040c75cfea5928c804ab7c235fed06a63f743a', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + '8fa87946779682841e21e2da977eccfb6cb3bded', 'buildtools/third_party/libc++abi/trunk': Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + '196ba1aaa8ac285d94f4ea8d9836390a45360533', 'buildtools/third_party/libunwind/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + 'd999d54f4bca789543a2eb6c995af2d9b5a1f3ed', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + 'a2cc4f8c554dedcb0c64cac5511b19c43f1f3d32', 'buildtools/win': { 'packages': [ { @@ -136,13 +136,13 @@ deps = { 'condition': 'host_os == "win"', }, 'base/trace_event/common': - Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + 'eb94f1c7aa96207f469008f29989a43feb2718f8', + Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + '7af6071eddf11ad91fbd5df54138f9d3c6d980d5', 'third_party/android_ndk': { - 'url': Var('chromium_url') + '/android_ndk.git' + '@' + '27c0a8d090c666a50e40fceb4ee5b40b1a2d3f87', + 'url': Var('chromium_url') + '/android_ndk.git' + '@' + '401019bf85744311b26c88ced255cd53401af8b7', 'condition': 'checkout_android', }, 'third_party/android_platform': { - 'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + 'ef64306e7772dea22df5f98102e6288da3510843', + 'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + 'fdaa5e5b9f6384c3011ca8479d672e47528f743f', 'condition': 'checkout_android', }, 'third_party/android_sdk/public': { @@ -184,7 +184,7 @@ deps = { 'dep_type': 'cipd', }, 'third_party/catapult': { - 'url': Var('chromium_url') + '/catapult.git' + '@' + 'd1a3011cd91205aa96b74b5dfc227d391e88108d', + 'url': Var('chromium_url') + '/catapult.git' + '@' + '81c9d30d7f1b3c1ab0f1856761f738cc81741322', 'condition': 'checkout_android', }, 'third_party/colorama/src': { @@ -196,7 +196,7 @@ deps = { 'condition': 'checkout_fuchsia', }, 'third_party/googletest/src': - Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '1b0cdaae57c046c87fb99cb4f69c312a7e794adb', + Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '1e315c5b1a62707fac9b8f1d4e03180ee7507f98', 'third_party/google_benchmark/src': { 'url': Var('chromium_url') + '/external/github.com/google/benchmark.git' + '@' + '7f27afe83b82f3a98baf58ef595814b9d42a5b2b', 'condition': 'checkout_google_benchmark', @@ -206,15 +206,15 @@ deps = { 'third_party/markupsafe': Var('chromium_url') + '/chromium/src/third_party/markupsafe.git' + '@' + '0944e71f4b2cb9a871bcbe353f95e889b64a611a', 'tools/swarming_client': - Var('chromium_url') + '/infra/luci/client-py.git' + '@' + '1a072711d4388c62e02480fabc26c68c24494be9', + Var('chromium_url') + '/infra/luci/client-py.git' + '@' + 'a32a1607f6093d338f756c7e7c7b4333b0c50c9c', 'test/benchmarks/data': Var('chromium_url') + '/v8/deps/third_party/benchmarks.git' + '@' + '05d7188267b4560491ff9155c5ee13e207ecd65f', 'test/mozilla/data': Var('chromium_url') + '/v8/deps/third_party/mozilla-tests.git' + '@' + 'f6c578a10ea707b1a8ab0b88943fe5115ce2b9be', 'test/test262/data': - Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + 'b2e9dff2816cceb5ee84c0c226c50a31d01a7297', + Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + 'f6034ebe9fb92d4d3dea644b9225bdc18b44a7ab', 'test/test262/harness': - Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '4555345a943d0c99a9461182705543fb171dda4b', + Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '278bcfaed0dcaa13936831fb1769d15e7c1e3b2b', 'third_party/qemu-linux-x64': { 'packages': [ { @@ -239,7 +239,7 @@ deps = { 'packages': [ { 'package': 'fuchsia/third_party/aemu/linux-amd64', - 'version': 'xAHa1IXmKteChkPvba9ezjSnKL7IyDePQRzWVUEAx9UC' + 'version': 'qI8e328VwkWv64EapCvG3Xj9_hDpKQFuJWeVdUHz7W0C' }, ], 'condition': 'host_os == "linux" and checkout_fuchsia', @@ -256,7 +256,7 @@ deps = { 'dep_type': 'cipd', }, 'tools/clang': - Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '2246bee280e908ac1fd27ab75e7d0021b14d875c', + Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'cfd0f628093b7382ac054fb33e23fa9d9a278bc3', 'tools/luci-go': { 'packages': [ { @@ -286,11 +286,11 @@ deps = { 'dep_type': 'cipd', }, 'third_party/perfetto': - Var('android_url') + '/platform/external/perfetto.git' + '@' + '7cdc44f903d3bcfd1d0f67188bfa797a24756868', + Var('android_url') + '/platform/external/perfetto.git' + '@' + 'aa4385bc5997ecad4c633885e1b331b1115012fb', 'third_party/protobuf': - Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + 'b68a347f56137b4b1a746e8c7438495a6ac1bd91', + Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + '6a59a2ad1f61d9696092f79b6d74368b4d7970a3', 'third_party/zlib': - Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '2c183c9f93a328bfb3121284da13cf89a0f7e64a', + Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '348acca950b1d6de784a954f4fda0952046c652c', 'third_party/jsoncpp/source': Var('chromium_url') + '/external/github.com/open-source-parsers/jsoncpp.git'+ '@' + '9059f5cad030ba11d37818847443a53918c327b1', 'third_party/ittapi': { diff --git a/deps/v8/OWNERS b/deps/v8/OWNERS index 3698d14dd923b9..2a478dbdc5c689 100644 --- a/deps/v8/OWNERS +++ b/deps/v8/OWNERS @@ -26,4 +26,5 @@ per-file WATCHLIST=file:COMMON_OWNERS per-file *-mips*=file:MIPS_OWNERS per-file *-mips64*=file:MIPS_OWNERS per-file *-ppc*=file:PPC_OWNERS +per-file *-riscv64*=file:RISCV_OWNERS per-file *-s390*=file:S390_OWNERS diff --git a/deps/v8/PRESUBMIT.py b/deps/v8/PRESUBMIT.py index 113ed2fd61fa69..2ee14d545ee66e 100644 --- a/deps/v8/PRESUBMIT.py +++ b/deps/v8/PRESUBMIT.py @@ -64,6 +64,8 @@ r'src[\\\/]extensions[\\\/]gc-extension\.cc', # Runtime functions used for testing. r'src[\\\/]runtime[\\\/]runtime-test\.cc', + # Testing helpers. + r'src[\\\/]heap[\\\/]cppgc[\\\/]testing\.cc', ) @@ -480,8 +482,10 @@ def _CheckNoexceptAnnotations(input_api, output_api): def FilterFile(affected_file): return input_api.FilterSourceFile( affected_file, - files_to_check=(r'src/.*', r'test/.*')) - + files_to_check=(r'src[\\\/].*', r'test[\\\/].*'), + # Skip api.cc since we cannot easily add the 'noexcept' annotation to + # public methods. + files_to_skip=(r'src[\\\/]api[\\\/]api\.cc',)) # matches any class name. class_name = r'\b([A-Z][A-Za-z0-9_:]*)(?:::\1)?' diff --git a/deps/v8/RISCV_OWNERS b/deps/v8/RISCV_OWNERS new file mode 100644 index 00000000000000..f3240b500b196f --- /dev/null +++ b/deps/v8/RISCV_OWNERS @@ -0,0 +1,3 @@ +brice.dobry@futurewei.com +lazyparser@gmail.com +peng.w@rioslab.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 120481f30fad6e..9b6783bb3535ce 100644 --- a/deps/v8/base/trace_event/common/trace_event_common.h +++ b/deps/v8/base/trace_event/common/trace_event_common.h @@ -5,16 +5,6 @@ #ifndef BASE_TRACE_EVENT_COMMON_TRACE_EVENT_COMMON_H_ #define BASE_TRACE_EVENT_COMMON_TRACE_EVENT_COMMON_H_ -// This header file defines the set of trace_event macros without specifying -// how the events actually get collected and stored. If you need to expose trace -// events to some other universe, you can copy-and-paste this file as well as -// trace_event.h, modifying the macros contained there as necessary for the -// target platform. The end result is that multiple libraries can funnel events -// through to a shared trace event collector. - -// IMPORTANT: To avoid conflicts, if you need to modify this file for a library, -// land your change in base/ first, and then copy-and-paste it. - // Trace events are for tracking application performance and resource usage. // Macros are provided to track: // Begin and end of function calls @@ -194,6 +184,100 @@ // trace points would carry a significant performance cost of acquiring a lock // and resolving the category. +// There are currently two implementations of the tracing macros. Firstly, +// Perfetto (https://perfetto.dev/) implements a compatible set of macros which +// we are migrating to. The Perfetto implementation is enabled through the +// use_perfetto_client_library GN arg. If that flag is disabled, we fall back to +// the legacy implementation in the latter half of this file (and +// trace_event.h). +// TODO(skyostil): Remove the legacy macro implementation. + +// Normally we'd use BUILDFLAG(USE_PERFETTO_CLIENT_LIBRARY) for this, but +// because v8 includes trace_event_common.h directly (in non-Perfetto mode), we +// can't depend on any other header files here. +#if defined(BASE_USE_PERFETTO_CLIENT_LIBRARY) +//////////////////////////////////////////////////////////////////////////////// +// Perfetto trace macros + +#include "base/threading/platform_thread.h" +#include "base/time/time.h" + +// Export Perfetto symbols in the same way as //base symbols. +#define PERFETTO_COMPONENT_EXPORT BASE_EXPORT + +// Enable legacy trace event macros (e.g., TRACE_EVENT{0,1,2}). +#define PERFETTO_ENABLE_LEGACY_TRACE_EVENTS 1 + +// Macros for reading the current trace time (bypassing any virtual time +// overrides). +#define TRACE_TIME_TICKS_NOW() ::base::subtle::TimeTicksNowIgnoringOverride() +#define TRACE_TIME_NOW() ::base::subtle::TimeNowIgnoringOverride() + +// Implementation detail: trace event macros create temporary variables +// to keep instrumentation overhead low. These macros give each temporary +// variable a unique name based on the line number to prevent name collisions. +#define INTERNAL_TRACE_EVENT_UID(name_prefix) PERFETTO_UID(name_prefix) + +// Special trace event macro to trace task execution with the location where it +// was posted from. +// TODO(skyostil): Convert this into a regular typed trace event. +#define TRACE_TASK_EXECUTION(run_function, task) \ + INTERNAL_TRACE_TASK_EXECUTION(run_function, task) + +// Special trace event macro to trace log messages. +// TODO(skyostil): Convert this into a regular typed trace event. +#define TRACE_LOG_MESSAGE(file, message, line) \ + INTERNAL_TRACE_LOG_MESSAGE(file, message, line) + +// Declare debug annotation converters for base time types, so they can be +// passed as trace event arguments. +// TODO(skyostil): Serialize timestamps using perfetto::TracedValue instead. +namespace perfetto { +namespace protos { +namespace pbzero { +class DebugAnnotation; +} // namespace pbzero +} // namespace protos +namespace internal { + +void BASE_EXPORT +WriteDebugAnnotation(protos::pbzero::DebugAnnotation* annotation, + ::base::TimeTicks); +void BASE_EXPORT +WriteDebugAnnotation(protos::pbzero::DebugAnnotation* annotation, ::base::Time); + +} // namespace internal +} // namespace perfetto + +// Pull in the tracing macro definitions from Perfetto. +#include "third_party/perfetto/include/perfetto/tracing.h" + +namespace perfetto { +namespace legacy { + +template <> +bool BASE_EXPORT ConvertThreadId(const ::base::PlatformThreadId& thread, + uint64_t* track_uuid_out, + int32_t* pid_override_out, + int32_t* tid_override_out); + +} // namespace legacy + +template <> +BASE_EXPORT TraceTimestamp +ConvertTimestampToTraceTimeNs(const ::base::TimeTicks& ticks); + +} // namespace perfetto + +#else // !defined(BASE_USE_PERFETTO_CLIENT_LIBRARY) +//////////////////////////////////////////////////////////////////////////////// +// Legacy trace macros + +// What follows is the legacy TRACE_EVENT macro implementation, which is being +// replaced by the Perfetto-based implementation above. New projects wishing to +// enable tracing should use the Perfetto SDK. See +// https://perfetto.dev/docs/instrumentation/tracing-sdk. + // Check that nobody includes this file directly. Clients are supposed to // include the surrounding "trace_event.h" of their project instead. #if defined(TRACE_EVENT0) @@ -861,109 +945,6 @@ category_group, name, id, \ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_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. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - |id| is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW -// events are considered to match if their category_group, name and id values -// all match. |id| must either be a pointer or an integer value up to 64 bits. -// If it's a pointer, the bits will be xored with a hash of the process ID so -// that the same pointer on two different processes will not collide. -// FLOW events are different from ASYNC events in how they are drawn by the -// tracing UI. A FLOW defines asynchronous data flow, such as posting a task -// (FLOW_BEGIN) and later executing that task (FLOW_END). Expect FLOWs to be -// drawn as lines or arrows from FLOW_BEGIN scopes to FLOW_END scopes. Similar -// to ASYNC, a FLOW can consist of multiple phases. The first phase is defined -// by the FLOW_BEGIN calls. Additional phases can be defined using the FLOW_STEP -// macros. When the operation completes, call FLOW_END. An async operation can -// span threads and processes, but all events in that operation must use the -// same |name| and |id|. Each event can have its own args. -#define TRACE_EVENT_FLOW_BEGIN0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_FLOW_BEGIN1(category_group, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_FLOW_BEGIN2(category_group, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_FLOW_BEGIN, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) -#define TRACE_EVENT_COPY_FLOW_BEGIN0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_FLOW_BEGIN1(category_group, name, id, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_FLOW_BEGIN2(category_group, name, id, arg1_name, \ - arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_FLOW_BEGIN, category_group, name, id, \ - TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, arg2_val) - -// Records a single FLOW_STEP event for |step| immediately. If the category -// is not enabled, then this does nothing. The |name| and |id| must match the -// FLOW_BEGIN event above. The |step| param identifies this step within the -// async event. This should be called at the beginning of the next phase of an -// asynchronous operation. -#define TRACE_EVENT_FLOW_STEP0(category_group, name, id, step) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, "step", step) -#define TRACE_EVENT_FLOW_STEP1(category_group, name, id, step, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_FLOW_STEP, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, "step", step, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_FLOW_STEP0(category_group, name, id, step) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_COPY, "step", step) -#define TRACE_EVENT_COPY_FLOW_STEP1(category_group, name, id, step, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_FLOW_STEP, category_group, name, id, \ - TRACE_EVENT_FLAG_COPY, "step", step, arg1_name, arg1_val) - -// Records a single FLOW_END event for "name" immediately. If the category -// is not enabled, then this does nothing. -#define TRACE_EVENT_FLOW_END0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_FLOW_END_BIND_TO_ENCLOSING0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, \ - TRACE_EVENT_FLAG_BIND_TO_ENCLOSING) -#define TRACE_EVENT_FLOW_END1(category_group, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, TRACE_EVENT_FLAG_NONE, arg1_name, \ - arg1_val) -#define TRACE_EVENT_FLOW_END2(category_group, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, TRACE_EVENT_FLAG_NONE, arg1_name, \ - arg1_val, arg2_name, arg2_val) -#define TRACE_EVENT_COPY_FLOW_END0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_FLOW_END1(category_group, name, id, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, TRACE_EVENT_FLAG_COPY, arg1_name, \ - arg1_val) -#define TRACE_EVENT_COPY_FLOW_END2(category_group, name, id, arg1_name, \ - arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, TRACE_EVENT_FLAG_COPY, arg1_name, \ - arg1_val, arg2_name, arg2_val) - // Special trace event macro to trace task execution with the location where it // was posted from. #define TRACE_TASK_EXECUTION(run_function, task) \ @@ -1126,6 +1107,7 @@ #define TRACE_VALUE_TYPE_STRING (static_cast(6)) #define TRACE_VALUE_TYPE_COPY_STRING (static_cast(7)) #define TRACE_VALUE_TYPE_CONVERTABLE (static_cast(8)) +#define TRACE_VALUE_TYPE_PROTO (static_cast(9)) // Enum reflecting the scope of an INSTANT event. Must fit within // TRACE_EVENT_FLAG_SCOPE_MASK. @@ -1137,4 +1119,5 @@ #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p') #define TRACE_EVENT_SCOPE_NAME_THREAD ('t') +#endif // !defined(BASE_USE_PERFETTO_CLIENT_LIBRARY) #endif // BASE_TRACE_EVENT_COMMON_TRACE_EVENT_COMMON_H_ diff --git a/deps/v8/gni/proto_library.gni b/deps/v8/gni/proto_library.gni index 0b72d7b8a4533c..583057e0a5a3e8 100644 --- a/deps/v8/gni/proto_library.gni +++ b/deps/v8/gni/proto_library.gni @@ -7,16 +7,16 @@ import("//build_overrides/build.gni") # This file should not be pulled in chromium builds. assert(!build_with_chromium) +if (host_os == "win") { + _host_executable_suffix = ".exe" +} else { + _host_executable_suffix = "" +} + template("proto_library") { assert(defined(invoker.sources)) proto_sources = invoker.sources - if (host_os == "win") { - host_executable_suffix = ".exe" - } else { - host_executable_suffix = "" - } - # All the proto imports should be relative to the project root. proto_in_dir = "//" if (defined(invoker.proto_in_dir)) { @@ -32,6 +32,11 @@ template("proto_library") { # generate_python = true. assert(defined(invoker.generate_python) && !invoker.generate_python) + import_dirs = [] + if (defined(invoker.import_dirs)) { + import_dirs = invoker.import_dirs + } + # If false will not generate the default .pb.{cc,h} files. Used for custom # codegen plugins. generate_cc = true @@ -48,7 +53,7 @@ template("proto_library") { plugin_host_label = invoker.generator_plugin_label + "($host_toolchain)" plugin_path = get_label_info(plugin_host_label, "root_out_dir") + "/" + - get_label_info(plugin_host_label, "name") + host_executable_suffix + get_label_info(plugin_host_label, "name") + _host_executable_suffix generate_with_plugin = true } else if (defined(invoker.generator_plugin_script)) { plugin_path = invoker.generator_plugin_script @@ -68,14 +73,19 @@ template("proto_library") { } } - cc_out_dir = "$root_gen_dir/" + proto_out_dir - rel_cc_out_dir = rebase_path(cc_out_dir, root_build_dir) + out_dir = "$root_gen_dir/" + proto_out_dir + rel_out_dir = rebase_path(out_dir, root_build_dir) + + # Prevent unused errors when generating descriptor only. + if (generate_descriptor != "") { + not_needed([ "rel_out_dir" ]) + } protos = rebase_path(proto_sources, proto_in_dir) protogens = [] if (generate_descriptor != "") { - protogens += [ "$root_gen_dir/" + generate_descriptor ] + protogens += [ "$out_dir/${generate_descriptor}" ] } foreach(proto, protos) { @@ -83,44 +93,64 @@ template("proto_library") { proto_name = get_path_info(proto, "name") proto_path = proto_dir + "/" + proto_name + # Prevent unused errors when generating descriptor only. + if (generate_descriptor != "") { + not_needed([ "proto_path" ]) + } + if (generate_cc) { protogens += [ - "$cc_out_dir/$proto_path.pb.h", - "$cc_out_dir/$proto_path.pb.cc", + "$out_dir/$proto_path.pb.h", + "$out_dir/$proto_path.pb.cc", ] } if (generate_with_plugin) { foreach(suffix, generator_plugin_suffixes) { - protogens += [ "$cc_out_dir/${proto_path}${suffix}" ] + protogens += [ "$out_dir/${proto_path}${suffix}" ] } } } config_name = "${target_name}_config" - action_name = "${target_name}_gen" - source_set_name = target_name + if (generate_descriptor == "") { + action_name = "${target_name}_gen" + source_set_name = target_name + } else { + action_name = target_name + } config(config_name) { - include_dirs = [ cc_out_dir ] + include_dirs = [ out_dir ] } # The XXX_gen action that generates the .pb.{cc,h} files. action(action_name) { - visibility = [ ":$source_set_name" ] - script = "//build/gn_run_binary.py" + if (generate_descriptor == "") { + visibility = [ ":$source_set_name" ] + } sources = proto_sources outputs = get_path_info(protogens, "abspath") protoc_label = "//:protoc($host_toolchain)" protoc_path = get_label_info(protoc_label, "root_out_dir") + "/protoc" + - host_executable_suffix + _host_executable_suffix + protoc_rebased_path = "./" + rebase_path(protoc_path, root_build_dir) + script = "//gni/protoc.py" args = [ # Path should be rebased because |root_build_dir| for current toolchain # may be different from |root_out_dir| of protoc built on host toolchain. - "./" + rebase_path(protoc_path, root_build_dir), + protoc_rebased_path, "--proto_path", rebase_path(proto_in_dir, root_build_dir), ] + + foreach(path, import_dirs) { + args += [ + "--proto_path", + rebase_path(path, root_build_dir), + ] + } + if (generate_cc) { cc_generator_options_ = "" if (defined(invoker.cc_generator_options)) { @@ -128,30 +158,27 @@ template("proto_library") { } args += [ "--cpp_out", - cc_generator_options_ + rel_cc_out_dir, + cc_generator_options_ + rel_out_dir, ] } if (generate_descriptor != "") { + depfile = "$out_dir/$generate_descriptor.d" args += [ "--include_imports", "--descriptor_set_out", - rebase_path("$root_gen_dir/" + generate_descriptor, root_build_dir), + rebase_path("$out_dir/$generate_descriptor", root_build_dir), + "--dependency_out", + rebase_path(depfile, root_build_dir), ] } - if (defined(invoker.import_dirs)) { - foreach(path, invoker.import_dirs) { - args += [ "--import-dir=" + rebase_path(path, root_build_dir) ] - } - } - if (generate_with_plugin) { plugin_path_rebased = rebase_path(plugin_path, root_build_dir) plugin_out_args = "" if (defined(invoker.generator_plugin_options)) { plugin_out_args += invoker.generator_plugin_options } - plugin_out_args += ":$rel_cc_out_dir" + plugin_out_args += ":$rel_out_dir" args += [ "--plugin=protoc-gen-plugin=$plugin_path_rebased", @@ -162,8 +189,15 @@ template("proto_library") { args += rebase_path(proto_sources, root_build_dir) inputs = [ protoc_path ] - deps = [ protoc_label ] + + # TODO(hjd): Avoid adding to deps here this. + # When we generate BUILD files we need find the transitive proto, + # dependencies, so also add link_deps to actual deps so they show up + # in gn desc. + if (defined(invoker.link_deps)) { + deps += invoker.link_deps + } if (generate_with_plugin) { inputs += [ plugin_path ] if (defined(plugin_host_label)) { @@ -172,61 +206,64 @@ template("proto_library") { } } - if (defined(invoker.proto_deps)) { - deps += invoker.proto_deps - } if (defined(invoker.deps)) { deps += invoker.deps } - } # action "${target_name}_gen" + } # action(action_name) # The source_set that builds the generated .pb.cc files. - source_set(target_name) { - forward_variables_from(invoker, - [ - "defines", - "include_dirs", - "public_configs", - "testonly", - "visibility", - ]) - - sources = get_target_outputs(":$action_name") - - # configs -= [ "//gn/standalone:extra_warnings" ] - if (defined(invoker.extra_configs)) { - configs += invoker.extra_configs - } + if (generate_descriptor == "") { + source_set(source_set_name) { + forward_variables_from(invoker, + [ + "defines", + "include_dirs", + "public_configs", + "testonly", + "visibility", + ]) + + sources = get_target_outputs(":$action_name") + + if (defined(invoker.extra_configs)) { + configs += invoker.extra_configs + } - if (!defined(invoker.public_configs)) { - public_configs = [] - } + if (!defined(invoker.public_configs)) { + public_configs = [] + } - public_configs += [ "//:protobuf_gen_config" ] + public_configs += [ + "//:protobuf_gen_config", + ":$config_name", + ] - propagate_imports_configs = !defined(invoker.propagate_imports_configs) || - invoker.propagate_imports_configs - if (propagate_imports_configs) { - public_configs += [ ":$config_name" ] - } else { - # Embedder handles include directory propagation to dependents. - configs += [ ":$config_name" ] - } + # By default, propagate the config for |include_dirs| to dependent + # targets, so that public imports can be resolved to corresponding header + # files. In some cases, the embedder target handles include directory + # propagation itself, e.g. via a common config. + propagate_imports_configs = !defined(invoker.propagate_imports_configs) || + invoker.propagate_imports_configs + if (propagate_imports_configs) { + public_configs += [ ":$config_name" ] + } else { + configs += [ ":$config_name" ] + } - # Use protobuf_full only for tests. - if (defined(invoker.use_protobuf_full) && - invoker.use_protobuf_full == true) { - deps = [ "//:protobuf_full" ] - } else { - deps = [ "//:protobuf_lite" ] - } + # Use protobuf_full only for tests. + if (defined(invoker.use_protobuf_full) && + invoker.use_protobuf_full == true) { + deps = [ "//:protobuf_full" ] + } else if (generate_cc) { + deps = [ "//:protobuf_lite" ] + } else { + deps = [] + } - deps += [ ":$action_name" ] - if (defined(invoker.deps)) { - deps += invoker.deps - } - if (defined(invoker.link_deps)) { - deps += invoker.link_deps - } - } # source_set(target_name) + deps += [ ":$action_name" ] + if (defined(invoker.deps)) { + deps += invoker.deps + } + } # source_set(source_set_name) + } } # template diff --git a/deps/v8/gni/protoc.py b/deps/v8/gni/protoc.py new file mode 100755 index 00000000000000..dc8920009dede0 --- /dev/null +++ b/deps/v8/gni/protoc.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# Copyright 2021 the V8 project authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +"""Script to wrap protoc execution. + +This script exists to work-around the bad depfile generation by protoc when +generating descriptors.""" + +from __future__ import print_function +import argparse +import os +import sys +import subprocess +import tempfile +import uuid + +from codecs import open + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--descriptor_set_out', default=None) + parser.add_argument('--dependency_out', default=None) + parser.add_argument('protoc') + args, remaining = parser.parse_known_args() + + if args.dependency_out and args.descriptor_set_out: + tmp_path = os.path.join(tempfile.gettempdir(), str(uuid.uuid4())) + custom = [ + '--descriptor_set_out', args.descriptor_set_out, '--dependency_out', + tmp_path + ] + try: + cmd = [args.protoc] + custom + remaining + subprocess.check_call(cmd) + with open(tmp_path, 'rb') as tmp_rd: + dependency_data = tmp_rd.read().decode('utf-8') + finally: + if os.path.exists(tmp_path): + os.unlink(tmp_path) + + with open(args.dependency_out, 'w', encoding='utf-8') as f: + f.write(args.descriptor_set_out + ":") + f.write(dependency_data) + else: + subprocess.check_call(sys.argv[1:]) + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/deps/v8/gni/snapshot_toolchain.gni b/deps/v8/gni/snapshot_toolchain.gni index b5fb1823b382e0..53963a048bf012 100644 --- a/deps/v8/gni/snapshot_toolchain.gni +++ b/deps/v8/gni/snapshot_toolchain.gni @@ -79,7 +79,8 @@ if (v8_snapshot_toolchain == "") { if (v8_current_cpu == "x64" || v8_current_cpu == "x86") { _cpus = v8_current_cpu - } else if (v8_current_cpu == "arm64" || v8_current_cpu == "mips64el") { + } else if (v8_current_cpu == "arm64" || v8_current_cpu == "mips64el" || + v8_current_cpu == "riscv64") { if (is_win && v8_current_cpu == "arm64") { # set _cpus to blank for Windows ARM64 so host_toolchain could be # selected as snapshot toolchain later. diff --git a/deps/v8/gni/v8.gni b/deps/v8/gni/v8.gni index 5651a178c283df..9325baf996e666 100644 --- a/deps/v8/gni/v8.gni +++ b/deps/v8/gni/v8.gni @@ -64,6 +64,17 @@ declare_args() { # Enable WebAssembly debugging via GDB-remote protocol. v8_enable_wasm_gdb_remote_debugging = false + # Lite mode disables a number of performance optimizations to reduce memory + # at the cost of performance. + # Sets -DV8_LITE_MODE. + v8_enable_lite_mode = false + + # Include support for WebAssembly. If disabled, the 'WebAssembly' global + # will not be available, and embedder APIs to generate WebAssembly modules + # will fail. Also, asm.js will not be translated to WebAssembly and will be + # executed as standard JavaScript instead. + v8_enable_webassembly = "" + # Add fuzzilli fuzzer support. v8_fuzzilli = false @@ -98,6 +109,13 @@ if (build_with_chromium && use_perfetto_client_library) { v8_use_perfetto = true } +# WebAssembly is enabled by default, except in lite mode. +if (v8_enable_webassembly == "") { + v8_enable_webassembly = !v8_enable_lite_mode +} +assert(!(v8_enable_webassembly && v8_enable_lite_mode), + "Webassembly is not available in lite mode.") + # Points to // in v8 stand-alone or to //v8/ in chromium. We need absolute # paths for all configs in templates as they are shared in different # subdirectories. diff --git a/deps/v8/include/DEPS b/deps/v8/include/DEPS index 9f4002059b3051..21ce3d964593c8 100644 --- a/deps/v8/include/DEPS +++ b/deps/v8/include/DEPS @@ -4,6 +4,7 @@ include_rules = [ "+cppgc/common.h", # Used by v8-cppgc.h to bridge to cppgc. "+cppgc/custom-space.h", + "+cppgc/heap-statistics.h", "+cppgc/internal/write-barrier.h", "+cppgc/visitor.h", ] diff --git a/deps/v8/include/OWNERS b/deps/v8/include/OWNERS index 19c21fbf52c6e2..cd5fd0535e44cc 100644 --- a/deps/v8/include/OWNERS +++ b/deps/v8/include/OWNERS @@ -16,6 +16,7 @@ per-file v8-inspector-protocol.h=pfeldman@chromium.org per-file v8-inspector-protocol.h=kozyatinskiy@chromium.org per-file js_protocol.pdl=dgozman@chromium.org per-file js_protocol.pdl=pfeldman@chromium.org +per-file js_protocol.pdl=bmeurer@chromium.org # For branch updates: per-file v8-version.h=file:../INFRA_OWNERS diff --git a/deps/v8/include/cppgc/allocation.h b/deps/v8/include/cppgc/allocation.h index 1164f6925cdcf7..b6f9d3902ba1c4 100644 --- a/deps/v8/include/cppgc/allocation.h +++ b/deps/v8/include/cppgc/allocation.h @@ -64,6 +64,13 @@ template class MakeGarbageCollectedTraitBase : private internal::MakeGarbageCollectedTraitInternal { private: + static_assert(internal::IsGarbageCollectedType::value, + "T needs to be a garbage collected object"); + static_assert(!IsGarbageCollectedWithMixinTypeV || + sizeof(T) <= + internal::api_constants::kLargeObjectSizeThreshold, + "GarbageCollectedMixin may not be a large object"); + template struct SpacePolicy { static void* Allocate(AllocationHandle& handle, size_t size) { @@ -153,12 +160,6 @@ class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase { public: template static T* Call(AllocationHandle& handle, Args&&... args) { - static_assert(internal::IsGarbageCollectedType::value, - "T needs to be a garbage collected object"); - static_assert( - !internal::IsGarbageCollectedMixinType::value || - sizeof(T) <= internal::api_constants::kLargeObjectSizeThreshold, - "GarbageCollectedMixin may not be a large object"); void* memory = MakeGarbageCollectedTraitBase::Allocate(handle, sizeof(T)); T* object = ::new (memory) T(std::forward(args)...); @@ -169,12 +170,6 @@ class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase { template static T* Call(AllocationHandle& handle, AdditionalBytes additional_bytes, Args&&... args) { - static_assert(internal::IsGarbageCollectedType::value, - "T needs to be a garbage collected object"); - static_assert( - !internal::IsGarbageCollectedMixinType::value || - sizeof(T) <= internal::api_constants::kLargeObjectSizeThreshold, - "GarbageCollectedMixin may not be a large object"); void* memory = MakeGarbageCollectedTraitBase::Allocate( handle, sizeof(T) + additional_bytes.value); T* object = ::new (memory) T(std::forward(args)...); diff --git a/deps/v8/include/cppgc/common.h b/deps/v8/include/cppgc/common.h index 1fff1a03fe369f..b6dbff3dd6f007 100644 --- a/deps/v8/include/cppgc/common.h +++ b/deps/v8/include/cppgc/common.h @@ -10,15 +10,18 @@ namespace cppgc { -// Indicator for the stack state of the embedder. +/** + * Indicator for the stack state of the embedder. + */ enum class EmbedderStackState { + /** + * Stack may contain interesting heap pointers. + */ kMayContainHeapPointers, + /** + * Stack does not contain any interesting heap pointers. + */ kNoHeapPointers, - kUnknown V8_ENUM_DEPRECATED("Use kMayContainHeapPointers") = - kMayContainHeapPointers, - kNonEmpty V8_ENUM_DEPRECATED("Use kMayContainHeapPointers") = - kMayContainHeapPointers, - kEmpty V8_ENUM_DEPRECATED("Use kNoHeapPointers") = kNoHeapPointers, }; } // namespace cppgc diff --git a/deps/v8/include/cppgc/cross-thread-persistent.h b/deps/v8/include/cppgc/cross-thread-persistent.h index 3d49d557c2beb3..1f509d4b007e14 100644 --- a/deps/v8/include/cppgc/cross-thread-persistent.h +++ b/deps/v8/include/cppgc/cross-thread-persistent.h @@ -44,7 +44,6 @@ class BasicCrossThreadPersistent final : public PersistentBase, T* raw, const SourceLocation& loc = SourceLocation::Current()) : PersistentBase(raw), LocationPolicy(loc) { if (!IsValid(raw)) return; - PersistentRegionLock guard; PersistentRegion& region = this->GetPersistentRegion(raw); SetNode(region.AllocateNode(this, &Trace)); this->CheckPointer(raw); @@ -162,13 +161,24 @@ class BasicCrossThreadPersistent final : public PersistentBase, // heterogeneous assignments between different Member and Persistent handles // based on their actual types. V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") T* Get() const { - return static_cast(GetValue()); + return static_cast(const_cast(GetValue())); } /** * Clears the stored object. */ - void Clear() { Assign(nullptr); } + void Clear() { + // Simplified version of `Assign()` to allow calling without a complete type + // `T`. + const void* old_value = GetValue(); + if (IsValid(old_value)) { + PersistentRegionLock guard; + PersistentRegion& region = this->GetPersistentRegion(old_value); + region.FreeNode(GetNode()); + SetNode(nullptr); + } + SetValue(nullptr); + } /** * Returns a pointer to the stored object and releases it. @@ -209,8 +219,31 @@ class BasicCrossThreadPersistent final : public PersistentBase, T* operator->() const { return Get(); } T& operator*() const { return *Get(); } + template + BasicCrossThreadPersistent + To() const { + PersistentRegionLock guard; + return BasicCrossThreadPersistent( + static_cast(Get())); + } + + template ::IsStrongPersistent::value>::type> + BasicCrossThreadPersistent + Lock() const { + return BasicCrossThreadPersistent< + U, internal::StrongCrossThreadPersistentPolicy>(*this); + } + private: - static bool IsValid(void* ptr) { return ptr && ptr != kSentinelPointer; } + static bool IsValid(const void* ptr) { + return ptr && ptr != kSentinelPointer; + } static void Trace(Visitor* v, const void* ptr) { const auto* handle = static_cast(ptr); @@ -218,7 +251,7 @@ class BasicCrossThreadPersistent final : public PersistentBase, } void Assign(T* ptr) { - void* old_value = GetValue(); + const void* old_value = GetValue(); if (IsValid(old_value)) { PersistentRegionLock guard; PersistentRegion& region = this->GetPersistentRegion(old_value); @@ -238,7 +271,8 @@ class BasicCrossThreadPersistent final : public PersistentBase, } void AssignUnsafe(T* ptr) { - void* old_value = GetValue(); + PersistentRegionLock::AssertLocked(); + const void* old_value = GetValue(); if (IsValid(old_value)) { PersistentRegion& region = this->GetPersistentRegion(old_value); if (IsValid(ptr) && (®ion == &this->GetPersistentRegion(ptr))) { diff --git a/deps/v8/include/cppgc/custom-space.h b/deps/v8/include/cppgc/custom-space.h index 9a8cd876c3af35..757c4fde15ea7c 100644 --- a/deps/v8/include/cppgc/custom-space.h +++ b/deps/v8/include/cppgc/custom-space.h @@ -9,8 +9,11 @@ namespace cppgc { +/** + * Index identifying a custom space. + */ struct CustomSpaceIndex { - CustomSpaceIndex(size_t value) : value(value) {} // NOLINT + constexpr CustomSpaceIndex(size_t value) : value(value) {} // NOLINT size_t value; }; @@ -45,15 +48,18 @@ class CustomSpaceBase { template class CustomSpace : public CustomSpaceBase { public: + /** + * Compaction is only supported on spaces that manually manage slots + * recording. + */ + static constexpr bool kSupportsCompaction = false; + CustomSpaceIndex GetCustomSpaceIndex() const final { return ConcreteCustomSpace::kSpaceIndex; } bool IsCompactable() const final { return ConcreteCustomSpace::kSupportsCompaction; } - - protected: - static constexpr bool kSupportsCompaction = false; }; /** diff --git a/deps/v8/include/cppgc/ephemeron-pair.h b/deps/v8/include/cppgc/ephemeron-pair.h index 47163d30710b0e..e16cf1f0aa2acc 100644 --- a/deps/v8/include/cppgc/ephemeron-pair.h +++ b/deps/v8/include/cppgc/ephemeron-pair.h @@ -5,6 +5,7 @@ #ifndef INCLUDE_CPPGC_EPHEMERON_PAIR_H_ #define INCLUDE_CPPGC_EPHEMERON_PAIR_H_ +#include "cppgc/liveness-broker.h" #include "cppgc/member.h" namespace cppgc { @@ -18,6 +19,10 @@ struct EphemeronPair { EphemeronPair(K* k, V* v) : key(k), value(v) {} WeakMember key; Member value; + + void ClearValueIfKeyIsDead(const LivenessBroker& broker) { + if (!broker.IsHeapObjectAlive(key)) value = nullptr; + } }; } // namespace cppgc diff --git a/deps/v8/include/cppgc/heap-consistency.h b/deps/v8/include/cppgc/heap-consistency.h index 4a4eb103817e6e..47caea18470a0c 100644 --- a/deps/v8/include/cppgc/heap-consistency.h +++ b/deps/v8/include/cppgc/heap-consistency.h @@ -8,6 +8,7 @@ #include #include "cppgc/internal/write-barrier.h" +#include "cppgc/macros.h" #include "cppgc/trace-trait.h" #include "v8config.h" // NOLINT(build/include_directory) @@ -49,17 +50,22 @@ class HeapConsistency final { /** * Gets the required write barrier type for a specific write. * - * \param slot Slot containing the pointer to some part of an object object - * that has been allocated using `MakeGarbageCollected()`. Does not consider - * the value of `slot`. + * \param slot Slot to some part of an object. The object must not necessarily + have been allocated using `MakeGarbageCollected()` but can also live + off-heap or on stack. * \param params Parameters that may be used for actual write barrier calls. * Only filled if return value indicates that a write barrier is needed. The * contents of the `params` are an implementation detail. + * \param callback Callback returning the corresponding heap handle. The + * callback is only invoked if the heap cannot otherwise be figured out. The + * callback must not allocate. * \returns whether a write barrier is needed and which barrier to invoke. */ + template static V8_INLINE WriteBarrierType - GetWriteBarrierType(const void* slot, WriteBarrierParams& params) { - return internal::WriteBarrier::GetWriteBarrierType(slot, params); + GetWriteBarrierType(const void* slot, WriteBarrierParams& params, + HeapHandleCallback callback) { + return internal::WriteBarrier::GetWriteBarrierType(slot, params, callback); } /** @@ -80,7 +86,6 @@ class HeapConsistency final { * elements if they have not yet been processed. * * \param params The parameters retrieved from `GetWriteBarrierType()`. - * \param heap The corresponding heap. * \param first_element Pointer to the first element that should be processed. * The slot itself must reside in an object that has been allocated using * `MakeGarbageCollected()`. @@ -91,11 +96,11 @@ class HeapConsistency final { * element if necessary. */ static V8_INLINE void DijkstraWriteBarrierRange( - const WriteBarrierParams& params, HeapHandle& heap, - const void* first_element, size_t element_size, size_t number_of_elements, + const WriteBarrierParams& params, const void* first_element, + size_t element_size, size_t number_of_elements, TraceCallback trace_callback) { internal::WriteBarrier::DijkstraMarkingBarrierRange( - params, heap, first_element, element_size, number_of_elements, + params, first_element, element_size, number_of_elements, trace_callback); } @@ -131,6 +136,100 @@ class HeapConsistency final { HeapConsistency() = delete; }; +/** + * Disallows garbage collection finalizations. Any garbage collection triggers + * result in a crash when in this scope. + * + * Note that the garbage collector already covers paths that can lead to garbage + * collections, so user code does not require checking + * `IsGarbageCollectionAllowed()` before allocations. + */ +class V8_EXPORT V8_NODISCARD DisallowGarbageCollectionScope final { + CPPGC_STACK_ALLOCATED(); + + public: + /** + * \returns whether garbage collections are currently allowed. + */ + static bool IsGarbageCollectionAllowed(HeapHandle& heap_handle); + + /** + * Enters a disallow garbage collection scope. Must be paired with `Leave()`. + * Prefer a scope instance of `DisallowGarbageCollectionScope`. + * + * \param heap_handle The corresponding heap. + */ + static void Enter(HeapHandle& heap_handle); + + /** + * Leaves a disallow garbage collection scope. Must be paired with `Enter()`. + * Prefer a scope instance of `DisallowGarbageCollectionScope`. + * + * \param heap_handle The corresponding heap. + */ + static void Leave(HeapHandle& heap_handle); + + /** + * Constructs a scoped object that automatically enters and leaves a disallow + * garbage collection scope based on its lifetime. + * + * \param heap_handle The corresponding heap. + */ + explicit DisallowGarbageCollectionScope(HeapHandle& heap_handle); + ~DisallowGarbageCollectionScope(); + + DisallowGarbageCollectionScope(const DisallowGarbageCollectionScope&) = + delete; + DisallowGarbageCollectionScope& operator=( + const DisallowGarbageCollectionScope&) = delete; + + private: + HeapHandle& heap_handle_; +}; + +/** + * Avoids invoking garbage collection finalizations. Already running garbage + * collection phase are unaffected by this scope. + * + * Should only be used temporarily as the scope has an impact on memory usage + * and follow up garbage collections. + */ +class V8_EXPORT V8_NODISCARD NoGarbageCollectionScope final { + CPPGC_STACK_ALLOCATED(); + + public: + /** + * Enters a no garbage collection scope. Must be paired with `Leave()`. Prefer + * a scope instance of `NoGarbageCollectionScope`. + * + * \param heap_handle The corresponding heap. + */ + static void Enter(HeapHandle& heap_handle); + + /** + * Leaves a no garbage collection scope. Must be paired with `Enter()`. Prefer + * a scope instance of `NoGarbageCollectionScope`. + * + * \param heap_handle The corresponding heap. + */ + static void Leave(HeapHandle& heap_handle); + + /** + * Constructs a scoped object that automatically enters and leaves a no + * garbage collection scope based on its lifetime. + * + * \param heap_handle The corresponding heap. + */ + explicit NoGarbageCollectionScope(HeapHandle& heap_handle); + ~NoGarbageCollectionScope(); + + NoGarbageCollectionScope(const NoGarbageCollectionScope&) = delete; + NoGarbageCollectionScope& operator=(const NoGarbageCollectionScope&) = delete; + + private: + HeapHandle& heap_handle_; +}; + } // namespace subtle } // namespace cppgc diff --git a/deps/v8/include/cppgc/heap-state.h b/deps/v8/include/cppgc/heap-state.h new file mode 100644 index 00000000000000..0157282a5603fc --- /dev/null +++ b/deps/v8/include/cppgc/heap-state.h @@ -0,0 +1,59 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_HEAP_STATE_H_ +#define INCLUDE_CPPGC_HEAP_STATE_H_ + +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { + +class HeapHandle; + +namespace subtle { + +/** + * Helpers to peek into heap-internal state. + */ +class V8_EXPORT HeapState final { + public: + /** + * Returns whether the garbage collector is marking. This API is experimental + * and is expected to be removed in future. + * + * \param heap_handle The corresponding heap. + * \returns true if the garbage collector is currently marking, and false + * otherwise. + */ + static bool IsMarking(const HeapHandle& heap_handle); + + /* + * Returns whether the garbage collector is sweeping. This API is experimental + * and is expected to be removed in future. + * + * \param heap_handle The corresponding heap. + * \returns true if the garbage collector is currently sweeping, and false + * otherwise. + */ + static bool IsSweeping(const HeapHandle& heap_handle); + + /** + * Returns whether the garbage collector is in the atomic pause, i.e., the + * mutator is stopped from running. This API is experimental and is expected + * to be removed in future. + * + * \param heap_handle The corresponding heap. + * \returns true if the garbage collector is currently in the atomic pause, + * and false otherwise. + */ + static bool IsInAtomicPause(const HeapHandle& heap_handle); + + private: + HeapState() = delete; +}; + +} // namespace subtle +} // namespace cppgc + +#endif // INCLUDE_CPPGC_HEAP_STATE_H_ diff --git a/deps/v8/include/cppgc/heap-statistics.h b/deps/v8/include/cppgc/heap-statistics.h new file mode 100644 index 00000000000000..cf8d6633cc2751 --- /dev/null +++ b/deps/v8/include/cppgc/heap-statistics.h @@ -0,0 +1,110 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_HEAP_STATISTICS_H_ +#define INCLUDE_CPPGC_HEAP_STATISTICS_H_ + +#include +#include +#include + +namespace cppgc { + +/** + * `HeapStatistics` contains memory consumption and utilization statistics for a + * cppgc heap. + */ +struct HeapStatistics final { + /** + * Specifies the detail level of the heap statistics. Brief statistics contain + * only the top-level allocated and used memory statistics for the entire + * heap. Detailed statistics also contain a break down per space and page, as + * well as freelist statistics and object type histograms. Note that used + * memory reported by brief statistics and detailed statistics might differ + * slightly. + */ + enum DetailLevel : uint8_t { + kBrief, + kDetailed, + }; + + /** + * Statistics of object types. For each type the statistics record its name, + * how many objects of that type were allocated, and the overall size used by + * these objects. + */ + struct ObjectStatistics { + /** Number of distinct types in the heap. */ + size_t num_types = 0; + /** Name of each type in the heap. */ + std::vector type_name; + /** Number of allocated objects per each type. */ + std::vector type_count; + /** Overall size of allocated objects per each type. */ + std::vector type_bytes; + }; + + /** + * Page granularity statistics. For each page the statistics record the + * allocated memory size and overall used memory size for the page. + */ + struct PageStatistics { + /** Overall amount of memory allocated for the page. */ + size_t physical_size_bytes = 0; + /** Amount of memory actually used on the page. */ + size_t used_size_bytes = 0; + }; + + /** + * Stastistics of the freelist (used only in non-large object spaces). For + * each bucket in the freelist the statistics record the bucket size, the + * number of freelist entries in the bucket, and the overall allocated memory + * consumed by these freelist entries. + */ + struct FreeListStatistics { + /** bucket sizes in the freelist. */ + std::vector bucket_size; + /** number of freelist entries per bucket. */ + std::vector free_count; + /** memory size concumed by freelist entries per size. */ + std::vector free_size; + }; + + /** + * Space granularity statistics. For each space the statistics record the + * space name, the amount of allocated memory and overall used memory for the + * space. The statistics also contain statistics for each of the space's + * pages, its freelist and the objects allocated on the space. + */ + struct SpaceStatistics { + /** The space name */ + std::string name; + /** Overall amount of memory allocated for the space. */ + size_t physical_size_bytes = 0; + /** Amount of memory actually used on the space. */ + size_t used_size_bytes = 0; + /** Statistics for each of the pages in the space. */ + std::vector page_stats; + /** Statistics for the freelist of the space. */ + FreeListStatistics free_list_stats; + /** Statistics for object allocated on the space. Filled only when + * NameProvider::HideInternalNames() is false. */ + ObjectStatistics object_stats; + }; + + /** Overall amount of memory allocated for the heap. */ + size_t physical_size_bytes = 0; + /** Amount of memory actually used on the heap. */ + size_t used_size_bytes = 0; + /** Detail level of this HeapStatistics. */ + DetailLevel detail_level; + + /** Statistics for each of the spaces in the heap. Filled only when + * detail_level is kDetailed. */ + std::vector space_stats; +}; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_HEAP_STATISTICS_H_ diff --git a/deps/v8/include/cppgc/internal/caged-heap-local-data.h b/deps/v8/include/cppgc/internal/caged-heap-local-data.h index 8c421477384c2e..1fa60b69536112 100644 --- a/deps/v8/include/cppgc/internal/caged-heap-local-data.h +++ b/deps/v8/include/cppgc/internal/caged-heap-local-data.h @@ -10,6 +10,7 @@ #include "cppgc/internal/api-constants.h" #include "cppgc/internal/logging.h" #include "cppgc/platform.h" +#include "v8config.h" // NOLINT(build/include_directory) namespace cppgc { namespace internal { @@ -54,7 +55,7 @@ static_assert(sizeof(AgeTable) == 1 * api_constants::kMB, struct CagedHeapLocalData final { explicit CagedHeapLocalData(HeapBase* heap_base) : heap_base(heap_base) {} - bool is_marking_in_progress = false; + bool is_incremental_marking_in_progress = false; HeapBase* heap_base = nullptr; #if defined(CPPGC_YOUNG_GENERATION) AgeTable age_table; diff --git a/deps/v8/include/cppgc/internal/persistent-node.h b/deps/v8/include/cppgc/internal/persistent-node.h index 685d8a2d6ad1f4..6524f326a56695 100644 --- a/deps/v8/include/cppgc/internal/persistent-node.h +++ b/deps/v8/include/cppgc/internal/persistent-node.h @@ -90,23 +90,29 @@ class V8_EXPORT PersistentRegion final { PersistentNode* node = free_list_head_; free_list_head_ = free_list_head_->FreeListNext(); node->InitializeAsUsedNode(owner, trace); + nodes_in_use_++; return node; } void FreeNode(PersistentNode* node) { node->InitializeAsFreeNode(free_list_head_); free_list_head_ = node; + CPPGC_DCHECK(nodes_in_use_ > 0); + nodes_in_use_--; } void Trace(Visitor*); size_t NodesInUse() const; + void ClearAllUsedNodes(); + private: void EnsureNodeSlots(); std::vector> nodes_; PersistentNode* free_list_head_ = nullptr; + size_t nodes_in_use_ = 0; }; // CrossThreadPersistent uses PersistentRegion but protects it using this lock @@ -115,6 +121,8 @@ class V8_EXPORT PersistentRegionLock final { public: PersistentRegionLock(); ~PersistentRegionLock(); + + static void AssertLocked(); }; } // namespace internal diff --git a/deps/v8/include/cppgc/internal/pointer-policies.h b/deps/v8/include/cppgc/internal/pointer-policies.h index 58f2515a3d7e1b..ea86a0a7057f45 100644 --- a/deps/v8/include/cppgc/internal/pointer-policies.h +++ b/deps/v8/include/cppgc/internal/pointer-policies.h @@ -105,22 +105,22 @@ using DefaultLocationPolicy = IgnoreLocationPolicy; struct StrongPersistentPolicy { using IsStrongPersistent = std::true_type; - static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object); + static V8_EXPORT PersistentRegion& GetPersistentRegion(const void* object); }; struct WeakPersistentPolicy { using IsStrongPersistent = std::false_type; - static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object); + static V8_EXPORT PersistentRegion& GetPersistentRegion(const void* object); }; struct StrongCrossThreadPersistentPolicy { using IsStrongPersistent = std::true_type; - static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object); + static V8_EXPORT PersistentRegion& GetPersistentRegion(const void* object); }; struct WeakCrossThreadPersistentPolicy { using IsStrongPersistent = std::false_type; - static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object); + static V8_EXPORT PersistentRegion& GetPersistentRegion(const void* object); }; // Forward declarations setting up the default policies. @@ -136,23 +136,8 @@ template class BasicMember; -// Special tag type used to denote some sentinel member. The semantics of the -// sentinel is defined by the embedder. -struct SentinelPointer { - template - operator T*() const { // NOLINT - static constexpr intptr_t kSentinelValue = 1; - return reinterpret_cast(kSentinelValue); - } - // Hidden friends. - friend bool operator==(SentinelPointer, SentinelPointer) { return true; } - friend bool operator!=(SentinelPointer, SentinelPointer) { return false; } -}; - } // namespace internal -constexpr internal::SentinelPointer kSentinelPointer; - } // namespace cppgc #endif // INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_ diff --git a/deps/v8/include/cppgc/internal/process-heap.h b/deps/v8/include/cppgc/internal/process-heap.h deleted file mode 100644 index 0f742a50a9cb97..00000000000000 --- a/deps/v8/include/cppgc/internal/process-heap.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_PROCESS_HEAP_H_ -#define INCLUDE_CPPGC_INTERNAL_PROCESS_HEAP_H_ - -#include "cppgc/internal/atomic-entry-flag.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { -namespace internal { - -class V8_EXPORT ProcessHeap final { - public: - static void EnterIncrementalOrConcurrentMarking() { - concurrent_marking_flag_.Enter(); - } - static void ExitIncrementalOrConcurrentMarking() { - concurrent_marking_flag_.Exit(); - } - - static bool IsAnyIncrementalOrConcurrentMarking() { - return concurrent_marking_flag_.MightBeEntered(); - } - - private: - static AtomicEntryFlag concurrent_marking_flag_; -}; - -} // namespace internal -} // namespace cppgc - -#endif // INCLUDE_CPPGC_INTERNAL_PROCESS_HEAP_H_ diff --git a/deps/v8/include/cppgc/internal/write-barrier.h b/deps/v8/include/cppgc/internal/write-barrier.h index e3cc4c989d89dd..f3aaedb1b837b6 100644 --- a/deps/v8/include/cppgc/internal/write-barrier.h +++ b/deps/v8/include/cppgc/internal/write-barrier.h @@ -5,8 +5,10 @@ #ifndef INCLUDE_CPPGC_INTERNAL_WRITE_BARRIER_H_ #define INCLUDE_CPPGC_INTERNAL_WRITE_BARRIER_H_ +#include "cppgc/heap-state.h" #include "cppgc/internal/api-constants.h" -#include "cppgc/internal/process-heap.h" +#include "cppgc/internal/atomic-entry-flag.h" +#include "cppgc/sentinel-pointer.h" #include "cppgc/trace-trait.h" #include "v8config.h" // NOLINT(build/include_directory) @@ -32,17 +34,17 @@ class V8_EXPORT WriteBarrier final { }; struct Params { + HeapHandle* heap = nullptr; #if V8_ENABLE_CHECKS Type type = Type::kNone; #endif // !V8_ENABLE_CHECKS #if defined(CPPGC_CAGED_HEAP) - uintptr_t start; - + uintptr_t start = 0; CagedHeapLocalData& caged_heap() const { return *reinterpret_cast(start); } - uintptr_t slot_offset; - uintptr_t value_offset; + uintptr_t slot_offset = 0; + uintptr_t value_offset = 0; #endif // CPPGC_CAGED_HEAP }; @@ -55,14 +57,19 @@ class V8_EXPORT WriteBarrier final { static V8_INLINE Type GetWriteBarrierType(const void* slot, const void* value, Params& params); // Returns the required write barrier for a given `slot`. - static V8_INLINE Type GetWriteBarrierType(const void* slot, Params& params); + template + static V8_INLINE Type GetWriteBarrierType(const void* slot, Params& params, + HeapHandleCallback callback); + + template + static V8_INLINE Type GetWriteBarrierTypeForExternallyReferencedObject( + const void* value, Params& params, HeapHandleCallback callback); static V8_INLINE void DijkstraMarkingBarrier(const Params& params, const void* object); static V8_INLINE void DijkstraMarkingBarrierRange( - const Params& params, HeapHandle& heap, const void* first_element, - size_t element_size, size_t number_of_elements, - TraceCallback trace_callback); + const Params& params, const void* first_element, size_t element_size, + size_t number_of_elements, TraceCallback trace_callback); static V8_INLINE void SteeleMarkingBarrier(const Params& params, const void* object); #if defined(CPPGC_YOUNG_GENERATION) @@ -79,6 +86,13 @@ class V8_EXPORT WriteBarrier final { static void CheckParams(Type expected_type, const Params& params) {} #endif // !V8_ENABLE_CHECKS + // The IncrementalOrConcurrentUpdater class allows cppgc internal to update + // |incremental_or_concurrent_marking_flag_|. + class IncrementalOrConcurrentMarkingFlagUpdater; + static bool IsAnyIncrementalOrConcurrentMarking() { + return incremental_or_concurrent_marking_flag_.MightBeEntered(); + } + private: WriteBarrier() = delete; @@ -99,50 +113,52 @@ class V8_EXPORT WriteBarrier final { static void SteeleMarkingBarrierSlowWithSentinelCheck(const void* value); #if defined(CPPGC_YOUNG_GENERATION) + static CagedHeapLocalData& GetLocalData(HeapHandle&); static void GenerationalBarrierSlow(const CagedHeapLocalData& local_data, const AgeTable& ageTable, const void* slot, uintptr_t value_offset); #endif // CPPGC_YOUNG_GENERATION + + static AtomicEntryFlag incremental_or_concurrent_marking_flag_; }; +template +V8_INLINE WriteBarrier::Type SetAndReturnType(WriteBarrier::Params& params) { + if (type == WriteBarrier::Type::kNone) return WriteBarrier::Type::kNone; +#if V8_ENABLE_CHECKS + params.type = type; +#endif // !V8_ENABLE_CHECKS + return type; +} + #if defined(CPPGC_CAGED_HEAP) -class WriteBarrierTypeForCagedHeapPolicy final { +class V8_EXPORT WriteBarrierTypeForCagedHeapPolicy final { public: - template + template static V8_INLINE WriteBarrier::Type Get(const void* slot, const void* value, - WriteBarrier::Params& params) { - const bool have_caged_heap = - value_mode == WriteBarrier::ValueMode::kValuePresent - ? TryGetCagedHeap(slot, value, params) - : TryGetCagedHeap(slot, slot, params); - if (!have_caged_heap) { + WriteBarrier::Params& params, + HeapHandleCallback callback) { + return ValueModeDispatch::Get(slot, value, params, callback); + } + + template + static V8_INLINE WriteBarrier::Type GetForExternallyReferenced( + const void* value, WriteBarrier::Params& params, HeapHandleCallback) { + if (!TryGetCagedHeap(value, value, params)) { return WriteBarrier::Type::kNone; } - if (V8_UNLIKELY(params.caged_heap().is_marking_in_progress)) { -#if V8_ENABLE_CHECKS - params.type = WriteBarrier::Type::kMarking; -#endif // !V8_ENABLE_CHECKS - return WriteBarrier::Type::kMarking; - } -#if defined(CPPGC_YOUNG_GENERATION) - params.slot_offset = reinterpret_cast(slot) - params.start; - if (value_mode == WriteBarrier::ValueMode::kValuePresent) { - params.value_offset = reinterpret_cast(value) - params.start; - } else { - params.value_offset = 0; + if (V8_UNLIKELY(params.caged_heap().is_incremental_marking_in_progress)) { + return SetAndReturnType(params); } -#if V8_ENABLE_CHECKS - params.type = WriteBarrier::Type::kGenerational; -#endif // !V8_ENABLE_CHECKS - return WriteBarrier::Type::kGenerational; -#else // !CPPGC_YOUNG_GENERATION - return WriteBarrier::Type::kNone; -#endif // !CPPGC_YOUNG_GENERATION + return SetAndReturnType(params); } private: WriteBarrierTypeForCagedHeapPolicy() = delete; + template + struct ValueModeDispatch; + static V8_INLINE bool TryGetCagedHeap(const void* slot, const void* value, WriteBarrier::Params& params) { params.start = reinterpret_cast(value) & @@ -156,40 +172,165 @@ class WriteBarrierTypeForCagedHeapPolicy final { } return true; } + + // Returns whether marking is in progress. If marking is not in progress + // sets the start of the cage accordingly. + // + // TODO(chromium:1056170): Create fast path on API. + static bool IsMarking(const HeapHandle&, WriteBarrier::Params&); +}; + +template <> +struct WriteBarrierTypeForCagedHeapPolicy::ValueModeDispatch< + WriteBarrier::ValueMode::kValuePresent> { + template + static V8_INLINE WriteBarrier::Type Get(const void* slot, const void* value, + WriteBarrier::Params& params, + HeapHandleCallback) { + bool within_cage = TryGetCagedHeap(slot, value, params); + if (!within_cage) { + return WriteBarrier::Type::kNone; + } + if (V8_LIKELY(!params.caged_heap().is_incremental_marking_in_progress)) { +#if defined(CPPGC_YOUNG_GENERATION) + params.heap = reinterpret_cast(params.start); + params.slot_offset = reinterpret_cast(slot) - params.start; + params.value_offset = reinterpret_cast(value) - params.start; + return SetAndReturnType(params); +#else // !CPPGC_YOUNG_GENERATION + return SetAndReturnType(params); +#endif // !CPPGC_YOUNG_GENERATION + } + params.heap = reinterpret_cast(params.start); + return SetAndReturnType(params); + } }; + +template <> +struct WriteBarrierTypeForCagedHeapPolicy::ValueModeDispatch< + WriteBarrier::ValueMode::kNoValuePresent> { + template + static V8_INLINE WriteBarrier::Type Get(const void* slot, const void*, + WriteBarrier::Params& params, + HeapHandleCallback callback) { +#if defined(CPPGC_YOUNG_GENERATION) + HeapHandle& handle = callback(); + if (V8_LIKELY(!IsMarking(handle, params))) { + // params.start is populated by IsMarking(). + params.heap = &handle; + params.slot_offset = reinterpret_cast(slot) - params.start; + // params.value_offset stays 0. + if (params.slot_offset > api_constants::kCagedHeapReservationSize) { + // Check if slot is on stack. + return SetAndReturnType(params); + } + return SetAndReturnType(params); + } +#else // !CPPGC_YOUNG_GENERATION + if (V8_LIKELY(!WriteBarrier::IsAnyIncrementalOrConcurrentMarking())) { + return SetAndReturnType(params); + } + HeapHandle& handle = callback(); + if (V8_UNLIKELY(!subtle::HeapState::IsMarking(handle))) { + return SetAndReturnType(params); + } +#endif // !CPPGC_YOUNG_GENERATION + params.heap = &handle; + return SetAndReturnType(params); + } +}; + #endif // CPPGC_CAGED_HEAP -class WriteBarrierTypeForNonCagedHeapPolicy final { +class V8_EXPORT WriteBarrierTypeForNonCagedHeapPolicy final { public: - template + template static V8_INLINE WriteBarrier::Type Get(const void* slot, const void* value, - WriteBarrier::Params& params) { - WriteBarrier::Type type = - V8_LIKELY(!ProcessHeap::IsAnyIncrementalOrConcurrentMarking()) - ? WriteBarrier::Type::kNone - : WriteBarrier::Type::kMarking; -#if V8_ENABLE_CHECKS - params.type = type; -#endif // !V8_ENABLE_CHECKS - return type; + WriteBarrier::Params& params, + HeapHandleCallback callback) { + return ValueModeDispatch::Get(slot, value, params, callback); + } + + template + static V8_INLINE WriteBarrier::Type GetForExternallyReferenced( + const void* value, WriteBarrier::Params& params, + HeapHandleCallback callback) { + // The slot will never be used in `Get()` below. + return Get(nullptr, value, params, + callback); } private: + template + struct ValueModeDispatch; + + // TODO(chromium:1056170): Create fast path on API. + static bool IsMarking(const void*, HeapHandle**); + // TODO(chromium:1056170): Create fast path on API. + static bool IsMarking(HeapHandle&); + WriteBarrierTypeForNonCagedHeapPolicy() = delete; }; +template <> +struct WriteBarrierTypeForNonCagedHeapPolicy::ValueModeDispatch< + WriteBarrier::ValueMode::kValuePresent> { + template + static V8_INLINE WriteBarrier::Type Get(const void*, const void* object, + WriteBarrier::Params& params, + HeapHandleCallback callback) { + // The following check covers nullptr as well as sentinel pointer. + if (object <= static_cast(kSentinelPointer)) { + return WriteBarrier::Type::kNone; + } + if (IsMarking(object, ¶ms.heap)) { + return SetAndReturnType(params); + } + return SetAndReturnType(params); + } +}; + +template <> +struct WriteBarrierTypeForNonCagedHeapPolicy::ValueModeDispatch< + WriteBarrier::ValueMode::kNoValuePresent> { + template + static V8_INLINE WriteBarrier::Type Get(const void*, const void*, + WriteBarrier::Params& params, + HeapHandleCallback callback) { + if (V8_UNLIKELY(WriteBarrier::IsAnyIncrementalOrConcurrentMarking())) { + HeapHandle& handle = callback(); + if (IsMarking(handle)) { + params.heap = &handle; + return SetAndReturnType(params); + } + } + return WriteBarrier::Type::kNone; + } +}; + // static WriteBarrier::Type WriteBarrier::GetWriteBarrierType( const void* slot, const void* value, WriteBarrier::Params& params) { return WriteBarrierTypePolicy::Get(slot, value, - params); + params, []() {}); } // static +template WriteBarrier::Type WriteBarrier::GetWriteBarrierType( - const void* slot, WriteBarrier::Params& params) { - return WriteBarrierTypePolicy::Get(slot, nullptr, - params); + const void* slot, WriteBarrier::Params& params, + HeapHandleCallback callback) { + return WriteBarrierTypePolicy::Get( + slot, nullptr, params, callback); +} + +// static +template +WriteBarrier::Type +WriteBarrier::GetWriteBarrierTypeForExternallyReferencedObject( + const void* value, Params& params, HeapHandleCallback callback) { + return WriteBarrierTypePolicy::GetForExternallyReferenced(value, params, + callback); } // static @@ -206,13 +347,12 @@ void WriteBarrier::DijkstraMarkingBarrier(const Params& params, // static void WriteBarrier::DijkstraMarkingBarrierRange(const Params& params, - HeapHandle& heap, const void* first_element, size_t element_size, size_t number_of_elements, TraceCallback trace_callback) { CheckParams(Type::kMarking, params); - DijkstraMarkingBarrierRangeSlow(heap, first_element, element_size, + DijkstraMarkingBarrierRangeSlow(*params.heap, first_element, element_size, number_of_elements, trace_callback); } diff --git a/deps/v8/include/cppgc/liveness-broker.h b/deps/v8/include/cppgc/liveness-broker.h index b69a69535b6c8a..e449091280d9d7 100644 --- a/deps/v8/include/cppgc/liveness-broker.h +++ b/deps/v8/include/cppgc/liveness-broker.h @@ -49,6 +49,12 @@ class V8_EXPORT LivenessBroker final { TraceTrait::GetTraceDescriptor(object).base_object_payload); } + template + bool IsHeapObjectAlive(const WeakMember& weak_member) const { + return (weak_member != kSentinelPointer) && + IsHeapObjectAlive(weak_member.Get()); + } + template bool IsHeapObjectAlive(const UntracedMember& untraced_member) const { return (untraced_member != kSentinelPointer) && diff --git a/deps/v8/include/cppgc/macros.h b/deps/v8/include/cppgc/macros.h index c0b1814e294cfa..70ab44c65759f1 100644 --- a/deps/v8/include/cppgc/macros.h +++ b/deps/v8/include/cppgc/macros.h @@ -5,6 +5,8 @@ #ifndef INCLUDE_CPPGC_MACROS_H_ #define INCLUDE_CPPGC_MACROS_H_ +#include + #include "cppgc/internal/compiler-specific.h" namespace cppgc { diff --git a/deps/v8/include/cppgc/member.h b/deps/v8/include/cppgc/member.h index 84e81251c25ddf..7b76bc4f7556fa 100644 --- a/deps/v8/include/cppgc/member.h +++ b/deps/v8/include/cppgc/member.h @@ -10,6 +10,7 @@ #include #include "cppgc/internal/pointer-policies.h" +#include "cppgc/sentinel-pointer.h" #include "cppgc/type-traits.h" #include "v8config.h" // NOLINT(build/include_directory) @@ -19,28 +20,30 @@ class Visitor; namespace internal { +// MemberBase always refers to the object as const object and defers to +// BasicMember on casting to the right type as needed. class MemberBase { protected: MemberBase() = default; - explicit MemberBase(void* value) : raw_(value) {} + explicit MemberBase(const void* value) : raw_(value) {} - void** GetRawSlot() const { return &raw_; } - void* GetRaw() const { return raw_; } + const void** GetRawSlot() const { return &raw_; } + const void* GetRaw() const { return raw_; } void SetRaw(void* value) { raw_ = value; } - void* GetRawAtomic() const { - return reinterpret_cast*>(&raw_)->load( + const void* GetRawAtomic() const { + return reinterpret_cast*>(&raw_)->load( std::memory_order_relaxed); } - void SetRawAtomic(void* value) { - reinterpret_cast*>(&raw_)->store( + void SetRawAtomic(const void* value) { + reinterpret_cast*>(&raw_)->store( value, std::memory_order_relaxed); } void ClearFromGC() const { raw_ = nullptr; } private: - mutable void* raw_ = nullptr; + mutable const void* raw_ = nullptr; }; // The basic class from which all Member classes are 'generated'. @@ -167,7 +170,11 @@ class BasicMember final : private MemberBase, private CheckingPolicy { // based on their actual types. V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") T* Get() const { // Executed by the mutator, hence non atomic load. - return static_cast(MemberBase::GetRaw()); + // + // The const_cast below removes the constness from MemberBase storage. The + // following static_cast re-adds any constness if specified through the + // user-visible template parameter T. + return static_cast(const_cast(MemberBase::GetRaw())); } void Clear() { SetRawAtomic(nullptr); } @@ -179,12 +186,12 @@ class BasicMember final : private MemberBase, private CheckingPolicy { } const T** GetSlotForTesting() const { - return reinterpret_cast(const_cast(GetRawSlot())); + return reinterpret_cast(GetRawSlot()); } private: - T* GetRawAtomic() const { - return static_cast(MemberBase::GetRawAtomic()); + const T* GetRawAtomic() const { + return static_cast(MemberBase::GetRawAtomic()); } void InitializingWriteBarrier() const { @@ -197,6 +204,8 @@ class BasicMember final : private MemberBase, private CheckingPolicy { void ClearFromGC() const { MemberBase::ClearFromGC(); } friend class cppgc::Visitor; + template + friend struct cppgc::TraceTrait; }; template + +#include "cppgc/type-traits.h" +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { + +namespace internal { + +struct V8_EXPORT BaseObjectSizeTrait { + protected: + static size_t GetObjectSizeForGarbageCollected(const void*); + static size_t GetObjectSizeForGarbageCollectedMixin(const void*); +}; + +} // namespace internal + +namespace subtle { + +/** + * Trait specifying how to get the size of an object that was allocated using + * `MakeGarbageCollected()`. Also supports querying the size with an inner + * pointer to a mixin. + */ +template > +struct ObjectSizeTrait; + +template +struct ObjectSizeTrait : cppgc::internal::BaseObjectSizeTrait { + static_assert(sizeof(T), "T must be fully defined"); + static_assert(IsGarbageCollectedTypeV, + "T must be of type GarbageCollected or GarbageCollectedMixin"); + + static size_t GetSize(const T& object) { + return GetObjectSizeForGarbageCollected(&object); + } +}; + +template +struct ObjectSizeTrait : cppgc::internal::BaseObjectSizeTrait { + static_assert(sizeof(T), "T must be fully defined"); + + static size_t GetSize(const T& object) { + return GetObjectSizeForGarbageCollectedMixin(&object); + } +}; + +} // namespace subtle +} // namespace cppgc + +#endif // INCLUDE_CPPGC_OBJECT_SIZE_TRAIT_H_ diff --git a/deps/v8/include/cppgc/persistent.h b/deps/v8/include/cppgc/persistent.h index c2d8a7a5a642c6..d7aac723c0d24d 100644 --- a/deps/v8/include/cppgc/persistent.h +++ b/deps/v8/include/cppgc/persistent.h @@ -9,6 +9,7 @@ #include "cppgc/internal/persistent-node.h" #include "cppgc/internal/pointer-policies.h" +#include "cppgc/sentinel-pointer.h" #include "cppgc/source-location.h" #include "cppgc/type-traits.h" #include "cppgc/visitor.h" @@ -20,13 +21,15 @@ class Visitor; namespace internal { +// PersistentBase always refers to the object as const object and defers to +// BasicPersistent on casting to the right type as needed. class PersistentBase { protected: PersistentBase() = default; - explicit PersistentBase(void* raw) : raw_(raw) {} + explicit PersistentBase(const void* raw) : raw_(raw) {} - void* GetValue() const { return raw_; } - void SetValue(void* value) { raw_ = value; } + const void* GetValue() const { return raw_; } + void SetValue(const void* value) { raw_ = value; } PersistentNode* GetNode() const { return node_; } void SetNode(PersistentNode* node) { node_ = node; } @@ -39,7 +42,7 @@ class PersistentBase { } private: - mutable void* raw_ = nullptr; + mutable const void* raw_ = nullptr; mutable PersistentNode* node_ = nullptr; friend class PersistentRegion; @@ -178,7 +181,7 @@ class BasicPersistent final : public PersistentBase, } explicit operator bool() const { return Get(); } - operator T*() const { return Get(); } + operator T*() const { return Get(); } // NOLINT T* operator->() const { return Get(); } T& operator*() const { return *Get(); } @@ -186,10 +189,21 @@ class BasicPersistent final : public PersistentBase, // heterogeneous assignments between different Member and Persistent handles // based on their actual types. V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") T* Get() const { - return static_cast(GetValue()); + // The const_cast below removes the constness from PersistentBase storage. + // The following static_cast re-adds any constness if specified through the + // user-visible template parameter T. + return static_cast(const_cast(GetValue())); } - void Clear() { Assign(nullptr); } + void Clear() { + // Simplified version of `Assign()` to allow calling without a complete type + // `T`. + if (IsValid()) { + WeaknessPolicy::GetPersistentRegion(GetValue()).FreeNode(GetNode()); + SetNode(nullptr); + } + SetValue(nullptr); + } T* Release() { T* result = Get(); @@ -197,6 +211,16 @@ class BasicPersistent final : public PersistentBase, return result; } + template + BasicPersistent + To() const { + return BasicPersistent(static_cast(Get())); + } + private: static void Trace(Visitor* v, const void* ptr) { const auto* persistent = static_cast(ptr); diff --git a/deps/v8/include/cppgc/platform.h b/deps/v8/include/cppgc/platform.h index 571aa80c3b80f1..0d7377668cf258 100644 --- a/deps/v8/include/cppgc/platform.h +++ b/deps/v8/include/cppgc/platform.h @@ -126,11 +126,18 @@ class V8_EXPORT Platform { /** * Process-global initialization of the garbage collector. Must be called before * creating a Heap. + * + * Can be called multiple times when paired with `ShutdownProcess()`. + * + * \param page_allocator The allocator used for maintaining meta data. Must not + * change between multiple calls to InitializeProcess. */ -V8_EXPORT void InitializeProcess(PageAllocator*); +V8_EXPORT void InitializeProcess(PageAllocator* page_allocator); /** - * Must be called after destroying the last used heap. + * Must be called after destroying the last used heap. Some process-global + * metadata may not be returned and reused upon a subsequent + * `InitializeProcess()` call. */ V8_EXPORT void ShutdownProcess(); diff --git a/deps/v8/include/cppgc/prefinalizer.h b/deps/v8/include/cppgc/prefinalizer.h index 9b7bc0e5943870..29b18bef909c88 100644 --- a/deps/v8/include/cppgc/prefinalizer.h +++ b/deps/v8/include/cppgc/prefinalizer.h @@ -34,7 +34,7 @@ class PrefinalizerRegistration final { public: \ static bool InvokePreFinalizer(const cppgc::LivenessBroker& liveness_broker, \ void* object) { \ - static_assert(cppgc::IsGarbageCollectedTypeV, \ + static_assert(cppgc::IsGarbageCollectedOrMixinTypeV, \ "Only garbage collected objects can have prefinalizers"); \ Class* self = static_cast(object); \ if (liveness_broker.IsHeapObjectAlive(self)) return false; \ diff --git a/deps/v8/include/cppgc/process-heap-statistics.h b/deps/v8/include/cppgc/process-heap-statistics.h new file mode 100644 index 00000000000000..774cc92f46cd92 --- /dev/null +++ b/deps/v8/include/cppgc/process-heap-statistics.h @@ -0,0 +1,36 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_PROCESS_HEAP_STATISTICS_H_ +#define INCLUDE_CPPGC_PROCESS_HEAP_STATISTICS_H_ + +#include +#include + +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { +namespace internal { +class ProcessHeapStatisticsUpdater; +} // namespace internal + +class V8_EXPORT ProcessHeapStatistics final { + public: + static size_t TotalAllocatedObjectSize() { + return total_allocated_object_size_.load(std::memory_order_relaxed); + } + static size_t TotalAllocatedSpace() { + return total_allocated_space_.load(std::memory_order_relaxed); + } + + private: + static std::atomic_size_t total_allocated_space_; + static std::atomic_size_t total_allocated_object_size_; + + friend class internal::ProcessHeapStatisticsUpdater; +}; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_PROCESS_HEAP_STATISTICS_H_ diff --git a/deps/v8/include/cppgc/sentinel-pointer.h b/deps/v8/include/cppgc/sentinel-pointer.h new file mode 100644 index 00000000000000..f7915834e5ac2c --- /dev/null +++ b/deps/v8/include/cppgc/sentinel-pointer.h @@ -0,0 +1,32 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_SENTINEL_POINTER_H_ +#define INCLUDE_CPPGC_SENTINEL_POINTER_H_ + +#include + +namespace cppgc { +namespace internal { + +// Special tag type used to denote some sentinel member. The semantics of the +// sentinel is defined by the embedder. +struct SentinelPointer { + template + operator T*() const { // NOLINT + static constexpr intptr_t kSentinelValue = 1; + return reinterpret_cast(kSentinelValue); + } + // Hidden friends. + friend bool operator==(SentinelPointer, SentinelPointer) { return true; } + friend bool operator!=(SentinelPointer, SentinelPointer) { return false; } +}; + +} // namespace internal + +constexpr internal::SentinelPointer kSentinelPointer; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_SENTINEL_POINTER_H_ diff --git a/deps/v8/include/cppgc/testing.h b/deps/v8/include/cppgc/testing.h new file mode 100644 index 00000000000000..f93897a9aafc81 --- /dev/null +++ b/deps/v8/include/cppgc/testing.h @@ -0,0 +1,50 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_TESTING_H_ +#define INCLUDE_CPPGC_TESTING_H_ + +#include "cppgc/common.h" +#include "cppgc/macros.h" +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { + +class HeapHandle; + +/** + * Namespace contains testing helpers. + */ +namespace testing { + +/** + * Overrides the state of the stack with the provided value. Takes precedence + * over other parameters that set the stack state. Must no be nested. + */ +class V8_EXPORT V8_NODISCARD OverrideEmbedderStackStateScope final { + CPPGC_STACK_ALLOCATED(); + + public: + /** + * Constructs a scoped object that automatically enters and leaves the scope. + * + * \param heap_handle The corresponding heap. + */ + explicit OverrideEmbedderStackStateScope(HeapHandle& heap_handle, + EmbedderStackState state); + ~OverrideEmbedderStackStateScope(); + + OverrideEmbedderStackStateScope(const OverrideEmbedderStackStateScope&) = + delete; + OverrideEmbedderStackStateScope& operator=( + const OverrideEmbedderStackStateScope&) = delete; + + private: + HeapHandle& heap_handle_; +}; + +} // namespace testing +} // namespace cppgc + +#endif // INCLUDE_CPPGC_TESTING_H_ diff --git a/deps/v8/include/cppgc/trace-trait.h b/deps/v8/include/cppgc/trace-trait.h index e33d3ad36b6eb3..83619b1d51848b 100644 --- a/deps/v8/include/cppgc/trace-trait.h +++ b/deps/v8/include/cppgc/trace-trait.h @@ -96,6 +96,8 @@ namespace internal { template struct TraceTraitImpl { + static_assert(IsGarbageCollectedTypeV, + "T must be of type GarbageCollected or GarbageCollectedMixin"); static TraceDescriptor GetTraceDescriptor(const void* self) { return {self, TraceTrait::Trace}; } diff --git a/deps/v8/include/cppgc/type-traits.h b/deps/v8/include/cppgc/type-traits.h index c7d02db902389c..2b50a2164b2267 100644 --- a/deps/v8/include/cppgc/type-traits.h +++ b/deps/v8/include/cppgc/type-traits.h @@ -65,12 +65,12 @@ template constexpr bool IsTraceableV = IsTraceable::value; template -struct IsGarbageCollectedMixinType : std::false_type { +struct HasGarbageCollectedMixinTypeMarker : std::false_type { static_assert(sizeof(T), "T must be fully defined"); }; template -struct IsGarbageCollectedMixinType< +struct HasGarbageCollectedMixinTypeMarker< T, void_t::IsGarbageCollectedMixinTypeMarker>> : std::true_type { @@ -78,17 +78,56 @@ struct IsGarbageCollectedMixinType< }; template -struct IsGarbageCollectedType : IsGarbageCollectedMixinType { +struct HasGarbageCollectedTypeMarker : std::false_type { static_assert(sizeof(T), "T must be fully defined"); }; template -struct IsGarbageCollectedType< +struct HasGarbageCollectedTypeMarker< T, void_t::IsGarbageCollectedTypeMarker>> : std::true_type { static_assert(sizeof(T), "T must be fully defined"); }; +template ::value, + bool = HasGarbageCollectedMixinTypeMarker::value> +struct IsGarbageCollectedMixinType : std::false_type { + static_assert(sizeof(T), "T must be fully defined"); +}; + +template +struct IsGarbageCollectedMixinType : std::true_type { + static_assert(sizeof(T), "T must be fully defined"); +}; + +template ::value> +struct IsGarbageCollectedType : std::false_type { + static_assert(sizeof(T), "T must be fully defined"); +}; + +template +struct IsGarbageCollectedType : std::true_type { + static_assert(sizeof(T), "T must be fully defined"); +}; + +template +struct IsGarbageCollectedOrMixinType + : std::integral_constant::value || + IsGarbageCollectedMixinType::value> { + static_assert(sizeof(T), "T must be fully defined"); +}; + +template ::value && + HasGarbageCollectedMixinTypeMarker::value)> +struct IsGarbageCollectedWithMixinType : std::false_type { + static_assert(sizeof(T), "T must be fully defined"); +}; + +template +struct IsGarbageCollectedWithMixinType : std::true_type { + static_assert(sizeof(T), "T must be fully defined"); +}; + template struct IsSubclassOfBasicMemberTemplate { @@ -127,18 +166,60 @@ struct IsUntracedMemberType : std::true_type {}; } // namespace internal +/** + * Value is true for types that inherit from `GarbageCollectedMixin` but not + * `GarbageCollected` (i.e., they are free mixins), and false otherwise. + */ template constexpr bool IsGarbageCollectedMixinTypeV = internal::IsGarbageCollectedMixinType::value; + +/** + * Value is true for types that inherit from `GarbageCollected`, and false + * otherwise. + */ template constexpr bool IsGarbageCollectedTypeV = internal::IsGarbageCollectedType::value; + +/** + * Value is true for types that inherit from either `GarbageCollected` or + * `GarbageCollectedMixin`, and false otherwise. + */ +template +constexpr bool IsGarbageCollectedOrMixinTypeV = + internal::IsGarbageCollectedOrMixinType::value; + +/** + * Value is true for types that inherit from `GarbageCollected` and + * `GarbageCollectedMixin`, and false otherwise. + */ +template +constexpr bool IsGarbageCollectedWithMixinTypeV = + internal::IsGarbageCollectedWithMixinType::value; + +/** + * Value is true for types of type `Member`, and false otherwise. + */ template constexpr bool IsMemberTypeV = internal::IsMemberType::value; + +/** + * Value is true for types of type `UntracedMember`, and false otherwise. + */ template constexpr bool IsUntracedMemberTypeV = internal::IsUntracedMemberType::value; + +/** + * Value is true for types of type `WeakMember`, and false otherwise. + */ template constexpr bool IsWeakMemberTypeV = internal::IsWeakMemberType::value; + +/** + * Value is true for types that are considered weak references, and false + * otherwise. + */ template constexpr bool IsWeakV = internal::IsWeak::value; diff --git a/deps/v8/include/cppgc/visitor.h b/deps/v8/include/cppgc/visitor.h index 74024c3d0e2568..95fd5fc842c1b2 100644 --- a/deps/v8/include/cppgc/visitor.h +++ b/deps/v8/include/cppgc/visitor.h @@ -61,6 +61,22 @@ class V8_EXPORT Visitor { virtual ~Visitor() = default; + /** + * Trace method for raw pointers. Prefer the versions for managed pointers. + * + * \param member Reference retaining an object. + */ + template + void Trace(const T* t) { + static_assert(sizeof(T), "Pointee type must be fully defined."); + static_assert(internal::IsGarbageCollectedOrMixinType::value, + "T must be GarbageCollected or GarbageCollectedMixin type"); + if (!t) { + return; + } + Visit(t, TraceTrait::GetTraceDescriptor(t)); + } + /** * Trace method for Member. * @@ -81,7 +97,7 @@ class V8_EXPORT Visitor { template void Trace(const WeakMember& weak_member) { static_assert(sizeof(T), "Pointee type must be fully defined."); - static_assert(internal::IsGarbageCollectedType::value, + static_assert(internal::IsGarbageCollectedOrMixinType::value, "T must be GarbageCollected or GarbageCollectedMixin type"); static_assert(!internal::IsAllocatedOnCompactableSpace::value, "Weak references to compactable objects are not allowed"); @@ -135,7 +151,10 @@ class V8_EXPORT Visitor { */ template void Trace(const EphemeronPair& ephemeron_pair) { - TraceEphemeron(ephemeron_pair.key, ephemeron_pair.value.GetRawAtomic()); + TraceEphemeron(ephemeron_pair.key, &ephemeron_pair.value); + RegisterWeakCallbackMethod, + &EphemeronPair::ClearValueIfKeyIsDead>( + &ephemeron_pair); } /** @@ -147,8 +166,14 @@ class V8_EXPORT Visitor { */ template void TraceEphemeron(const WeakMember& key, const V* value) { + const K* k = key.GetRawAtomic(); + if (!k) return; TraceDescriptor value_desc = TraceTrait::GetTraceDescriptor(value); - VisitEphemeron(key, value_desc); + // `value` must always be non-null. `value_desc.base_object_payload` may be + // null in the case that value is not a garbage-collected object but only + // traceable. + CPPGC_DCHECK(value); + VisitEphemeron(key, value, value_desc); } /** @@ -229,7 +254,8 @@ class V8_EXPORT Visitor { virtual void VisitRoot(const void*, TraceDescriptor, const SourceLocation&) {} virtual void VisitWeakRoot(const void* self, TraceDescriptor, WeakCallback, const void* weak_root, const SourceLocation&) {} - virtual void VisitEphemeron(const void* key, TraceDescriptor value_desc) {} + virtual void VisitEphemeron(const void* key, const void* value, + TraceDescriptor value_desc) {} virtual void VisitWeakContainer(const void* self, TraceDescriptor strong_desc, TraceDescriptor weak_desc, WeakCallback callback, const void* data) {} @@ -261,7 +287,7 @@ class V8_EXPORT Visitor { using PointeeType = typename Persistent::PointeeType; static_assert(sizeof(PointeeType), "Persistent's pointee type must be fully defined"); - static_assert(internal::IsGarbageCollectedType::value, + static_assert(internal::IsGarbageCollectedOrMixinType::value, "Persistent's pointee type must be GarbageCollected or " "GarbageCollectedMixin"); if (!p.Get()) { @@ -278,7 +304,7 @@ class V8_EXPORT Visitor { using PointeeType = typename WeakPersistent::PointeeType; static_assert(sizeof(PointeeType), "Persistent's pointee type must be fully defined"); - static_assert(internal::IsGarbageCollectedType::value, + static_assert(internal::IsGarbageCollectedOrMixinType::value, "Persistent's pointee type must be GarbageCollected or " "GarbageCollectedMixin"); static_assert(!internal::IsAllocatedOnCompactableSpace::value, @@ -287,17 +313,6 @@ class V8_EXPORT Visitor { &HandleWeak, &p, loc); } - template - void Trace(const T* t) { - static_assert(sizeof(T), "Pointee type must be fully defined."); - static_assert(internal::IsGarbageCollectedType::value, - "T must be GarbageCollected or GarbageCollectedMixin type"); - if (!t) { - return; - } - Visit(t, TraceTrait::GetTraceDescriptor(t)); - } - #if V8_ENABLE_CHECKS void CheckObjectNotInConstruction(const void* address); #endif // V8_ENABLE_CHECKS @@ -312,6 +327,14 @@ class V8_EXPORT Visitor { friend class internal::VisitorBase; }; +template +struct TraceTrait> { + static TraceDescriptor GetTraceDescriptor(const void* self) { + return TraceTrait::GetTraceDescriptor( + static_cast*>(self)->GetRawAtomic()); + } +}; + } // namespace cppgc #endif // INCLUDE_CPPGC_VISITOR_H_ diff --git a/deps/v8/include/js_protocol.pdl b/deps/v8/include/js_protocol.pdl index 42470d88efd577..666952f27b97f6 100644 --- a/deps/v8/include/js_protocol.pdl +++ b/deps/v8/include/js_protocol.pdl @@ -1030,6 +1030,7 @@ domain Runtime arraybuffer dataview webassemblymemory + wasmvalue # Object class (constructor) name. Specified for `object` type values only. optional string className # Remote object value in case of primitive values or JSON values (if it was requested). @@ -1088,6 +1089,7 @@ domain Runtime arraybuffer dataview webassemblymemory + wasmvalue # String representation of the object. optional string description # True iff some of the properties or entries of the original object did not fit. @@ -1136,6 +1138,7 @@ domain Runtime arraybuffer dataview webassemblymemory + wasmvalue experimental type EntryPreview extends object properties diff --git a/deps/v8/include/v8-cppgc.h b/deps/v8/include/v8-cppgc.h index 5a3712dd632cd5..2c22193046e4a6 100644 --- a/deps/v8/include/v8-cppgc.h +++ b/deps/v8/include/v8-cppgc.h @@ -5,10 +5,12 @@ #ifndef INCLUDE_V8_CPPGC_H_ #define INCLUDE_V8_CPPGC_H_ +#include #include #include #include "cppgc/custom-space.h" +#include "cppgc/heap-statistics.h" #include "cppgc/internal/write-barrier.h" #include "cppgc/visitor.h" #include "v8-internal.h" // NOLINT(build/include_directory) @@ -25,11 +27,56 @@ namespace internal { class CppHeap; } // namespace internal +/** + * Describes how V8 wrapper objects maintain references to garbage-collected C++ + * objects. + */ +struct WrapperDescriptor final { + /** + * The index used on `v8::Ojbect::SetAlignedPointerFromInternalField()` and + * related APIs to add additional data to an object which is used to identify + * JS->C++ references. + */ + using InternalFieldIndex = int; + + /** + * Unknown embedder id. The value is reserved for internal usages and must not + * be used with `CppHeap`. + */ + static constexpr uint16_t kUnknownEmbedderId = UINT16_MAX; + + constexpr WrapperDescriptor(InternalFieldIndex wrappable_type_index, + InternalFieldIndex wrappable_instance_index, + uint16_t embedder_id_for_garbage_collected) + : wrappable_type_index(wrappable_type_index), + wrappable_instance_index(wrappable_instance_index), + embedder_id_for_garbage_collected(embedder_id_for_garbage_collected) {} + + /** + * Index of the wrappable type. + */ + InternalFieldIndex wrappable_type_index; + + /** + * Index of the wrappable instance. + */ + InternalFieldIndex wrappable_instance_index; + + /** + * Embedder id identifying instances of garbage-collected objects. It is + * expected that the first field of the wrappable type is a uint16_t holding + * the id. Only references to instances of wrappables types with an id of + * `embedder_id_for_garbage_collected` will be considered by CppHeap. + */ + uint16_t embedder_id_for_garbage_collected; +}; + struct V8_EXPORT CppHeapCreateParams { CppHeapCreateParams(const CppHeapCreateParams&) = delete; CppHeapCreateParams& operator=(const CppHeapCreateParams&) = delete; std::vector> custom_spaces; + WrapperDescriptor wrapper_descriptor; }; /** @@ -37,6 +84,9 @@ struct V8_EXPORT CppHeapCreateParams { */ class V8_EXPORT CppHeap { public: + static std::unique_ptr Create(v8::Platform* platform, + const CppHeapCreateParams& params); + virtual ~CppHeap() = default; /** @@ -51,6 +101,23 @@ class V8_EXPORT CppHeap { */ cppgc::HeapHandle& GetHeapHandle(); + /** + * Terminate clears all roots and performs multiple garbage collections to + * reclaim potentially newly created objects in destructors. + * + * After this call, object allocation is prohibited. + */ + void Terminate(); + + /** + * \param detail_level specifies whether should return detailed + * statistics or only brief summary statistics. + * \returns current CppHeap statistics regarding memory consumption + * and utilization. + */ + cppgc::HeapStatistics CollectStatistics( + cppgc::HeapStatistics::DetailLevel detail_level); + private: CppHeap() = default; @@ -78,7 +145,7 @@ class JSVisitor : public cppgc::Visitor { * Consistency helpers that aid in maintaining a consistent internal state of * the garbage collector. */ -class JSHeapConsistency final { +class V8_EXPORT JSHeapConsistency final { public: using WriteBarrierParams = cppgc::internal::WriteBarrier::Params; using WriteBarrierType = cppgc::internal::WriteBarrier::Type; @@ -86,16 +153,65 @@ class JSHeapConsistency final { /** * Gets the required write barrier type for a specific write. * + * Note: Handling for C++ to JS references. + * * \param ref The reference being written to. * \param params Parameters that may be used for actual write barrier calls. * Only filled if return value indicates that a write barrier is needed. The * contents of the `params` are an implementation detail. + * \param callback Callback returning the corresponding heap handle. The + * callback is only invoked if the heap cannot otherwise be figured out. The + * callback must not allocate. * \returns whether a write barrier is needed and which barrier to invoke. */ - static V8_INLINE WriteBarrierType GetWriteBarrierType( - const TracedReferenceBase& ref, WriteBarrierParams& params) { + template + static V8_INLINE WriteBarrierType + GetWriteBarrierType(const TracedReferenceBase& ref, + WriteBarrierParams& params, HeapHandleCallback callback) { if (ref.IsEmpty()) return WriteBarrierType::kNone; - return cppgc::internal::WriteBarrier::GetWriteBarrierType(&ref, params); + + if (V8_LIKELY(!cppgc::internal::WriteBarrier:: + IsAnyIncrementalOrConcurrentMarking())) { + return cppgc::internal::WriteBarrier::Type::kNone; + } + cppgc::HeapHandle& handle = callback(); + if (!cppgc::subtle::HeapState::IsMarking(handle)) { + return cppgc::internal::WriteBarrier::Type::kNone; + } + params.heap = &handle; +#if V8_ENABLE_CHECKS + params.type = cppgc::internal::WriteBarrier::Type::kMarking; +#endif // !V8_ENABLE_CHECKS + return cppgc::internal::WriteBarrier::Type::kMarking; + } + + /** + * Gets the required write barrier type for a specific write. + * + * Note: Handling for JS to C++ references. + * + * \param wrapper The wrapper that has been written into. + * \param wrapper_index The wrapper index in `wrapper` that has been written + * into. + * \param wrappable The value that was written. + * \param params Parameters that may be used for actual write barrier calls. + * Only filled if return value indicates that a write barrier is needed. The + * contents of the `params` are an implementation detail. + * \param callback Callback returning the corresponding heap handle. The + * callback is only invoked if the heap cannot otherwise be figured out. The + * callback must not allocate. + * \returns whether a write barrier is needed and which barrier to invoke. + */ + template + static V8_INLINE WriteBarrierType GetWriteBarrierType( + v8::Local& wrapper, int wrapper_index, const void* wrappable, + WriteBarrierParams& params, HeapHandleCallback callback) { +#if V8_ENABLE_CHECKS + CheckWrapper(wrapper, wrapper_index, wrappable); +#endif // V8_ENABLE_CHECKS + return cppgc::internal::WriteBarrier:: + GetWriteBarrierTypeForExternallyReferencedObject(wrappable, params, + callback); } /** @@ -113,6 +229,20 @@ class JSHeapConsistency final { DijkstraMarkingBarrierSlow(heap_handle, ref); } + /** + * Conservative Dijkstra-style write barrier that processes an object if it + * has not yet been processed. + * + * \param params The parameters retrieved from `GetWriteBarrierType()`. + * \param object The pointer to the object. May be an interior pointer to a + * an interface of the actual object. + */ + static V8_INLINE void DijkstraMarkingBarrier(const WriteBarrierParams& params, + cppgc::HeapHandle& heap_handle, + const void* object) { + cppgc::internal::WriteBarrier::DijkstraMarkingBarrier(params, object); + } + /** * Generational barrier for maintaining consistency when running with multiple * generations. @@ -126,6 +256,8 @@ class JSHeapConsistency final { private: JSHeapConsistency() = delete; + static void CheckWrapper(v8::Local&, int, const void*); + static void DijkstraMarkingBarrierSlow(cppgc::HeapHandle&, const TracedReferenceBase& ref); }; diff --git a/deps/v8/include/v8-fast-api-calls.h b/deps/v8/include/v8-fast-api-calls.h index 2dea8db271ad81..ca5fc764a3d525 100644 --- a/deps/v8/include/v8-fast-api-calls.h +++ b/deps/v8/include/v8-fast-api-calls.h @@ -148,7 +148,13 @@ * receiver := the {embedder_object} from above * param := 42 * - * Currently only void return types are supported. + * Currently supported return types: + * - void + * - bool + * - int32_t + * - uint32_t + * - float32_t + * - float64_t * Currently supported argument types: * - pointer to an embedder type * - bool @@ -187,7 +193,7 @@ namespace v8 { class CTypeInfo { public: - enum class Type : char { + enum class Type : uint8_t { kVoid, kBool, kInt32, @@ -199,57 +205,31 @@ class CTypeInfo { kV8Value, }; + // kCallbackOptionsType and kInvalidType are not part of the Type enum + // because they are only used internally. Use values 255 and 254 that + // are larger than any valid Type enum. + static constexpr Type kCallbackOptionsType = Type(255); + static constexpr Type kInvalidType = Type(254); + enum class ArgFlags : uint8_t { kNone = 0, - kIsArrayBit = 1 << 0, // This argument is first in an array of values. }; - static CTypeInfo FromWrapperType(ArgFlags flags = ArgFlags::kNone) { - return CTypeInfo(static_cast(flags) | kIsWrapperTypeBit); - } - - static constexpr CTypeInfo FromCType(Type ctype, - ArgFlags flags = ArgFlags::kNone) { - // TODO(mslekova): Refactor the manual bit manipulations to use - // PointerWithPayload instead. - // ctype cannot be Type::kV8Value. - return CTypeInfo( - ((static_cast(ctype) << kTypeOffset) & kTypeMask) | - static_cast(flags)); - } - - const void* GetWrapperInfo() const; + explicit constexpr CTypeInfo(Type type, ArgFlags flags = ArgFlags::kNone) + : type_(type), flags_(flags) {} - constexpr Type GetType() const { - if (payload_ & kIsWrapperTypeBit) { - return Type::kV8Value; - } - return static_cast((payload_ & kTypeMask) >> kTypeOffset); - } + constexpr Type GetType() const { return type_; } - constexpr bool IsArray() const { - return payload_ & static_cast(ArgFlags::kIsArrayBit); - } + constexpr ArgFlags GetFlags() const { return flags_; } static const CTypeInfo& Invalid() { - static CTypeInfo invalid = CTypeInfo(0); + static CTypeInfo invalid = CTypeInfo(kInvalidType); return invalid; } private: - explicit constexpr CTypeInfo(uintptr_t payload) : payload_(payload) {} - - // That must be the last bit after ArgFlags. - static constexpr uintptr_t kIsWrapperTypeBit = 1 << 1; - static constexpr uintptr_t kWrapperTypeInfoMask = static_cast(~0) - << 2; - - static constexpr unsigned int kTypeOffset = kIsWrapperTypeBit; - static constexpr unsigned int kTypeSize = 8 - kTypeOffset; - static constexpr uintptr_t kTypeMask = - (~(static_cast(~0) << kTypeSize)) << kTypeOffset; - - const uintptr_t payload_; + Type type_; + ArgFlags flags_; }; class CFunctionInfo { @@ -257,27 +237,50 @@ class CFunctionInfo { virtual const CTypeInfo& ReturnInfo() const = 0; virtual unsigned int ArgumentCount() const = 0; virtual const CTypeInfo& ArgumentInfo(unsigned int index) const = 0; + virtual bool HasOptions() const = 0; }; struct ApiObject { uintptr_t address; }; -namespace internal { +/** + * A struct which may be passed to a fast call callback, like so: + * \code + * void FastMethodWithOptions(int param, FastApiCallbackOptions& options); + * \endcode + */ +struct FastApiCallbackOptions { + /** + * If the callback wants to signal an error condition or to perform an + * allocation, it must set options.fallback to true and do an early return + * from the fast method. Then V8 checks the value of options.fallback and if + * it's true, falls back to executing the SlowCallback, which is capable of + * reporting the error (either by throwing a JS exception or logging to the + * console) or doing the allocation. It's the embedder's responsibility to + * ensure that the fast callback is idempotent up to the point where error and + * fallback conditions are checked, because otherwise executing the slow + * callback might produce visible side-effects twice. + */ + bool fallback; -template -struct GetCType { - static constexpr CTypeInfo Get() { - return CTypeInfo::FromCType(CTypeInfo::Type::kV8Value); - } + /** + * The `data` passed to the FunctionTemplate constructor, or `undefined`. + */ + const ApiObject data; }; -#define SPECIALIZE_GET_C_TYPE_FOR(ctype, ctypeinfo) \ - template <> \ - struct GetCType { \ - static constexpr CTypeInfo Get() { \ - return CTypeInfo::FromCType(CTypeInfo::Type::ctypeinfo); \ - } \ +namespace internal { + +template +struct GetCType; + +#define SPECIALIZE_GET_C_TYPE_FOR(ctype, ctypeinfo) \ + template <> \ + struct GetCType { \ + static constexpr CTypeInfo Get() { \ + return CTypeInfo(CTypeInfo::Type::ctypeinfo); \ + } \ }; #define SUPPORTED_C_TYPES(V) \ @@ -293,55 +296,45 @@ struct GetCType { SUPPORTED_C_TYPES(SPECIALIZE_GET_C_TYPE_FOR) -// T* where T is a primitive (array of primitives). -template -struct GetCTypePointerImpl { - static constexpr CTypeInfo Get() { - return CTypeInfo::FromCType(GetCType::Get().GetType(), - CTypeInfo::ArgFlags::kIsArrayBit); - } -}; - -// T* where T is an API object. -template -struct GetCTypePointerImpl { - static constexpr CTypeInfo Get() { return CTypeInfo::FromWrapperType(); } -}; - -// T** where T is a primitive. Not allowed. -template -struct GetCTypePointerPointerImpl { - static_assert(sizeof(T**) != sizeof(T**), "Unsupported type"); -}; - -// T** where T is an API object (array of API objects). -template -struct GetCTypePointerPointerImpl { +template <> +struct GetCType { static constexpr CTypeInfo Get() { - return CTypeInfo::FromWrapperType(CTypeInfo::ArgFlags::kIsArrayBit); + return CTypeInfo(CTypeInfo::kCallbackOptionsType); } }; -template -struct GetCType : public GetCTypePointerPointerImpl {}; - -template -struct GetCType : public GetCTypePointerImpl {}; +// Helper to count the number of occurances of `T` in `List` +template +struct count : std::integral_constant {}; +template +struct count + : std::integral_constant::value> {}; +template +struct count : count {}; -template +template class CFunctionInfoImpl : public CFunctionInfo { public: - static constexpr int kFallbackArgCount = (RaisesException ? 1 : 0); + static constexpr int kOptionsArgCount = + count(); static constexpr int kReceiverCount = 1; CFunctionInfoImpl() : return_info_(internal::GetCType::Get()), - arg_count_(sizeof...(Args) - kFallbackArgCount), + arg_count_(sizeof...(Args) - kOptionsArgCount), arg_info_{internal::GetCType::Get()...} { - static_assert(sizeof...(Args) >= kFallbackArgCount + kReceiverCount, + static_assert(kOptionsArgCount == 0 || kOptionsArgCount == 1, + "Only one options parameter is supported."); + static_assert(sizeof...(Args) >= kOptionsArgCount + kReceiverCount, "The receiver or the fallback argument is missing."); - static_assert( - internal::GetCType::Get().GetType() == CTypeInfo::Type::kVoid, - "Only void return types are currently supported."); + constexpr CTypeInfo::Type type = internal::GetCType::Get().GetType(); + static_assert(type == CTypeInfo::Type::kVoid || + type == CTypeInfo::Type::kBool || + type == CTypeInfo::Type::kInt32 || + type == CTypeInfo::Type::kUint32 || + type == CTypeInfo::Type::kFloat32 || + type == CTypeInfo::Type::kFloat64, + "64-bit int and api object values are not currently " + "supported return types."); } const CTypeInfo& ReturnInfo() const override { return return_info_; } @@ -352,6 +345,7 @@ class CFunctionInfoImpl : public CFunctionInfo { } return arg_info_[index]; } + bool HasOptions() const override { return kOptionsArgCount == 1; } private: const CTypeInfo return_info_; @@ -382,8 +376,9 @@ class V8_EXPORT CFunction { } template + V8_DEPRECATED("Use CFunction::Make instead.") static CFunction MakeWithFallbackSupport(F* func) { - return ArgUnwrap::MakeWithFallbackSupport(func); + return ArgUnwrap::Make(func); } template @@ -397,9 +392,9 @@ class V8_EXPORT CFunction { CFunction(const void* address, const CFunctionInfo* type_info); - template + template static CFunctionInfo* GetCFunctionInfo() { - static internal::CFunctionInfoImpl instance; + static internal::CFunctionInfoImpl instance; return &instance; } @@ -414,19 +409,11 @@ class V8_EXPORT CFunction { public: static CFunction Make(R (*func)(Args...)) { return CFunction(reinterpret_cast(func), - GetCFunctionInfo()); - } - static CFunction MakeWithFallbackSupport(R (*func)(Args...)) { - return CFunction(reinterpret_cast(func), - GetCFunctionInfo()); + GetCFunctionInfo()); } }; }; -struct FastApiCallbackOptions { - bool fallback; -}; - } // namespace v8 #endif // INCLUDE_V8_FAST_API_CALLS_H_ diff --git a/deps/v8/include/v8-metrics.h b/deps/v8/include/v8-metrics.h index 1e2bd50acf6494..0217f40d63a629 100644 --- a/deps/v8/include/v8-metrics.h +++ b/deps/v8/include/v8-metrics.h @@ -10,6 +10,58 @@ namespace v8 { namespace metrics { +struct GarbageCollectionPhases { + int64_t compact_wall_clock_duration_in_us = -1; + int64_t mark_wall_clock_duration_in_us = -1; + int64_t sweep_wall_clock_duration_in_us = -1; + int64_t weak_wall_clock_duration_in_us = -1; +}; + +struct GarbageCollectionSizes { + int64_t bytes_before = -1; + int64_t bytes_after = -1; + int64_t bytes_freed = -1; +}; + +struct GarbageCollectionFullCycle { + GarbageCollectionPhases total; + GarbageCollectionPhases total_cpp; + GarbageCollectionPhases main_thread; + GarbageCollectionPhases main_thread_cpp; + GarbageCollectionPhases main_thread_atomic; + GarbageCollectionPhases main_thread_atomic_cpp; + GarbageCollectionPhases main_thread_incremental; + GarbageCollectionPhases main_thread_incremental_cpp; + GarbageCollectionSizes objects; + GarbageCollectionSizes objects_cpp; + GarbageCollectionSizes memory; + GarbageCollectionSizes memory_cpp; + double collection_rate_in_percent; + double collection_rate_cpp_in_percent; + double efficiency_in_bytes_per_us; + double efficiency_cpp_in_bytes_per_us; + double main_thread_efficiency_in_bytes_per_us; + double main_thread_efficiency_cpp_in_bytes_per_us; +}; + +struct GarbageCollectionFullMainThreadIncrementalMark { + int64_t wall_clock_duration_in_us = -1; + int64_t cpp_wall_clock_duration_in_us = -1; +}; + +struct GarbageCollectionFullMainThreadIncrementalSweep { + int64_t wall_clock_duration_in_us = -1; + int64_t cpp_wall_clock_duration_in_us = -1; +}; + +struct GarbageCollectionYoungCycle { + int64_t total_wall_clock_duration_in_us = -1; + int64_t main_thread_wall_clock_duration_in_us = -1; + double collection_rate_in_percent; + double efficiency_in_bytes_per_us; + double main_thread_efficiency_in_bytes_per_us; +}; + struct WasmModuleDecoded { bool async = false; bool streamed = false; @@ -48,10 +100,14 @@ struct WasmModulesPerIsolate { size_t count = 0; }; -#define V8_MAIN_THREAD_METRICS_EVENTS(V) \ - V(WasmModuleDecoded) \ - V(WasmModuleCompiled) \ - V(WasmModuleInstantiated) \ +#define V8_MAIN_THREAD_METRICS_EVENTS(V) \ + V(GarbageCollectionFullCycle) \ + V(GarbageCollectionFullMainThreadIncrementalMark) \ + V(GarbageCollectionFullMainThreadIncrementalSweep) \ + V(GarbageCollectionYoungCycle) \ + V(WasmModuleDecoded) \ + V(WasmModuleCompiled) \ + V(WasmModuleInstantiated) \ V(WasmModuleTieredUp) #define V8_THREAD_SAFE_METRICS_EVENTS(V) V(WasmModulesPerIsolate) diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index 74b6df884d37a9..85d3f8a4821ab1 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -258,6 +258,17 @@ enum class CpuProfilingStatus { kErrorTooManyProfilers }; +/** + * Delegate for when max samples reached and samples are discarded. + */ +class V8_EXPORT DiscardedSamplesDelegate { + public: + DiscardedSamplesDelegate() {} + + virtual ~DiscardedSamplesDelegate() = default; + virtual void Notify() = 0; +}; + /** * Optional profiling attributes. */ @@ -346,8 +357,9 @@ class V8_EXPORT CpuProfiler { * profiles may be collected at once. Attempts to start collecting several * profiles with the same title are silently ignored. */ - CpuProfilingStatus StartProfiling(Local title, - CpuProfilingOptions options); + CpuProfilingStatus StartProfiling( + Local title, CpuProfilingOptions options, + std::unique_ptr delegate = nullptr); /** * Starts profiling with the same semantics as above, except with expanded diff --git a/deps/v8/include/v8-unwinder-state.h b/deps/v8/include/v8-unwinder-state.h index ed9988711b4707..00f8b8b176d06b 100644 --- a/deps/v8/include/v8-unwinder-state.h +++ b/deps/v8/include/v8-unwinder-state.h @@ -19,7 +19,7 @@ struct CalleeSavedRegisters { }; #elif V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 || \ V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC || \ - V8_TARGET_ARCH_PPC64 || V8_TARGET_ARCH_S390 + V8_TARGET_ARCH_PPC64 || V8_TARGET_ARCH_RISCV64 || V8_TARGET_ARCH_S390 struct CalleeSavedRegisters {}; #else #error Target architecture was not detected as supported by v8 diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 67c1c84b32b84b..ec959c40b4e2e4 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -8,10 +8,10 @@ // These macros define the version number for the current version. // 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 8 -#define V8_MINOR_VERSION 9 -#define V8_BUILD_NUMBER 255 -#define V8_PATCH_LEVEL 19 +#define V8_MAJOR_VERSION 9 +#define V8_MINOR_VERSION 0 +#define V8_BUILD_NUMBER 257 +#define V8_PATCH_LEVEL 11 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index b1cc054d767170..7cb19bbede03db 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -47,11 +47,12 @@ class BigIntObject; class Boolean; class BooleanObject; class CFunction; +class CallHandlerHelper; class Context; class CppHeap; -struct CppHeapCreateParams; class Data; class Date; +class EscapableHandleScope; class External; class Function; class FunctionTemplate; @@ -60,8 +61,7 @@ class ImplementationUtilities; class Int32; class Integer; class Isolate; -template -class Maybe; +class Isolate; class MicrotaskQueue; class Name; class Number; @@ -71,6 +71,8 @@ class ObjectOperationDescriptor; class ObjectTemplate; class Platform; class Primitive; +class PrimitiveArray; +class Private; class Promise; class PropertyDescriptor; class Proxy; @@ -78,75 +80,72 @@ class RawOperationDescriptor; class Script; class SharedArrayBuffer; class Signature; -class StartupData; class StackFrame; class StackTrace; +class StartupData; class String; class StringObject; class Symbol; class SymbolObject; class TracedReferenceBase; -class PrimitiveArray; -class Private; class Uint32; class Utils; class Value; class WasmMemoryObject; class WasmModuleObject; -template class Local; -template -class MaybeLocal; -template class Eternal; +template +class GlobalValueMap; +template +class PersistentValueMapBase; template class NonCopyablePersistentTraits; -template class PersistentBase; -template > +template > class Persistent; template +class BasicTracedReference; +template +class Eternal; +template class Global; template +class Local; +template +class Maybe; +template +class MaybeLocal; +template class TracedGlobal; template class TracedReference; -template -class BasicTracedReference; template class PersistentValueMap; -template -class PersistentValueMapBase; -template -class GlobalValueMap; -template class PersistentValueVector; template class WeakCallbackObject; -class FunctionTemplate; -class ObjectTemplate; +template +class PersistentBase; +template +class PersistentValueVector; template class FunctionCallbackInfo; template class PropertyCallbackInfo; -class StackTrace; -class StackFrame; -class Isolate; -class CallHandlerHelper; -class EscapableHandleScope; template class ReturnValue; namespace internal { -enum class ArgumentsType; -template -class Arguments; class BasicTracedReferenceExtractor; -template -class CustomArguments; +class ExternalString; class FunctionCallbackArguments; class GlobalHandles; class Heap; class HeapObject; -class ExternalString; class Isolate; class LocalEmbedderHeapTracer; class MicrotaskQueue; class PropertyCallbackArguments; class ReadOnlyHeap; class ScopedExternalStringLock; -struct ScriptStreamingData; class ThreadLocalTop; +struct ScriptStreamingData; +enum class ArgumentsType; +template +class Arguments; +template +class CustomArguments; namespace wasm { class NativeModule; @@ -1343,6 +1342,11 @@ class V8_EXPORT Data { */ bool IsFunctionTemplate() const; + /** + * Returns true if this data is a |v8::Context|. + */ + bool IsContext() const; + private: Data(); }; @@ -1423,9 +1427,7 @@ class ScriptOriginOptions { */ class ScriptOrigin { public: -#if defined(_MSC_VER) && _MSC_VER >= 1910 /* Disable on VS2015 */ - V8_DEPRECATE_SOON("Use constructor with primitvie C++ types") -#endif + V8_DEPRECATE_SOON("Use constructor with primitive C++ types") V8_INLINE explicit ScriptOrigin( Local resource_name, Local resource_line_offset, Local resource_column_offset, @@ -1436,6 +1438,7 @@ class ScriptOrigin { Local is_wasm = Local(), Local is_module = Local(), Local host_defined_options = Local()); + V8_DEPRECATE_SOON("Use constructor that takes an isolate") V8_INLINE explicit ScriptOrigin( Local resource_name, int resource_line_offset = 0, int resource_column_offset = 0, @@ -1444,6 +1447,14 @@ class ScriptOrigin { bool resource_is_opaque = false, bool is_wasm = false, bool is_module = false, Local host_defined_options = Local()); + V8_INLINE explicit ScriptOrigin( + Isolate* isolate, Local resource_name, + int resource_line_offset = 0, int resource_column_offset = 0, + bool resource_is_shared_cross_origin = false, int script_id = -1, + Local source_map_url = Local(), + bool resource_is_opaque = false, bool is_wasm = false, + bool is_module = false, + Local host_defined_options = Local()); V8_INLINE Local ResourceName() const; V8_DEPRECATE_SOON("Use getter with primitvie C++ types.") @@ -1552,6 +1563,13 @@ class V8_EXPORT ModuleRequest : public Data { * The keys and values are of type v8::String, and the source offsets are of * type Int32. Use Module::SourceOffsetToLocation to convert the source * offsets to Locations with line/column numbers. + * + * All assertions present in the module request will be supplied in this + * list, regardless of whether they are supported by the host. Per + * https://tc39.es/proposal-import-assertions/#sec-hostgetsupportedimportassertions, + * hosts are expected to ignore assertions that they do not support (as + * opposed to, for example, triggering an error if an unsupported assertion is + * present). */ Local GetImportAssertions() const; @@ -1631,7 +1649,7 @@ class V8_EXPORT Module : public Data { */ int GetIdentityHash() const; - using ResolveCallback = + using ResolveCallback V8_DEPRECATE_SOON("Use ResolveModuleCallback") = MaybeLocal (*)(Local context, Local specifier, Local referrer); using ResolveModuleCallback = MaybeLocal (*)( @@ -1706,7 +1724,7 @@ class V8_EXPORT Module : public Data { /* * Callback defined in the embedder. This is responsible for setting * the module's exported values with calls to SetSyntheticModuleExport(). - * The callback must return a Value to indicate success (where no + * The callback must return a resolved Promise to indicate success (where no * exception was thrown) and return an empy MaybeLocal to indicate falure * (where an exception was thrown). */ @@ -1920,11 +1938,9 @@ class V8_EXPORT ScriptCompiler { public: enum Encoding { ONE_BYTE, TWO_BYTE, UTF8 }; -#if defined(_MSC_VER) && _MSC_VER >= 1910 /* Disable on VS2015 */ V8_DEPRECATED( "This class takes ownership of source_stream, so use the constructor " "taking a unique_ptr to make these semantics clearer") -#endif StreamedSource(ExternalSourceStream* source_stream, Encoding encoding); StreamedSource(std::unique_ptr source_stream, Encoding encoding); @@ -3307,7 +3323,8 @@ class V8_EXPORT String : public Name { ~ExternalStringResource() override = default; /** - * The string data from the underlying buffer. + * The string data from the underlying buffer. If the resource is cacheable + * then data() must return the same value for all invocations. */ virtual const uint16_t* data() const = 0; @@ -3316,8 +3333,29 @@ class V8_EXPORT String : public Name { */ virtual size_t length() const = 0; + /** + * Returns the cached data from the underlying buffer. This method can be + * called only for cacheable resources (i.e. IsCacheable() == true) and only + * after UpdateDataCache() was called. + */ + const uint16_t* cached_data() const { + CheckCachedDataInvariants(); + return cached_data_; + } + + /** + * Update {cached_data_} with the data from the underlying buffer. This can + * be called only for cacheable resources. + */ + void UpdateDataCache(); + protected: ExternalStringResource() = default; + + private: + void CheckCachedDataInvariants() const; + + const uint16_t* cached_data_ = nullptr; }; /** @@ -3338,12 +3376,39 @@ class V8_EXPORT String : public Name { * buffer. */ ~ExternalOneByteStringResource() override = default; - /** The string data from the underlying buffer.*/ + + /** + * The string data from the underlying buffer. If the resource is cacheable + * then data() must return the same value for all invocations. + */ virtual const char* data() const = 0; + /** The number of Latin-1 characters in the string.*/ virtual size_t length() const = 0; + + /** + * Returns the cached data from the underlying buffer. If the resource is + * uncacheable or if UpdateDataCache() was not called before, it has + * undefined behaviour. + */ + const char* cached_data() const { + CheckCachedDataInvariants(); + return cached_data_; + } + + /** + * Update {cached_data_} with the data from the underlying buffer. This can + * be called only for cacheable resources. + */ + void UpdateDataCache(); + protected: ExternalOneByteStringResource() = default; + + private: + void CheckCachedDataInvariants() const; + + const char* cached_data_ = nullptr; }; /** @@ -4206,12 +4271,18 @@ class V8_EXPORT Object : public Value { /** * Returns the context in which the object was created. */ + V8_DEPRECATE_SOON("Use MaybeLocal GetCreationContext()") Local CreationContext(); + MaybeLocal GetCreationContext(); /** Same as above, but works for Persistents */ - V8_INLINE static Local CreationContext( + V8_DEPRECATE_SOON( + "Use MaybeLocal GetCreationContext(const " + "PersistentBase& object)") + static Local CreationContext(const PersistentBase& object); + V8_INLINE static MaybeLocal GetCreationContext( const PersistentBase& object) { - return object.val_->CreationContext(); + return object.val_->GetCreationContext(); } /** @@ -4684,6 +4755,11 @@ class V8_EXPORT Function : public Object { * User-defined name assigned to the "displayName" property of this function. * Used to facilitate debugging and profiling of JavaScript code. */ + V8_DEPRECATED( + "Use v8::Object::Get() instead to look up \"displayName\". " + "V8 and DevTools no longer use \"displayName\" in stack " + "traces, but the standard \"name\" property. " + "See http://crbug.com/1177685.") Local GetDisplayName() const; /** @@ -5388,7 +5464,7 @@ class V8_EXPORT ArrayBuffer : public Object { * |Allocator::Free| once all ArrayBuffers referencing it are collected by * the garbage collector. */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use the version that takes a BackingStore. " "See http://crbug.com/v8/9908.") static Local New( @@ -5437,7 +5513,7 @@ class V8_EXPORT ArrayBuffer : public Object { * Returns true if ArrayBuffer is externalized, that is, does not * own its memory block. */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "With v8::BackingStore externalized ArrayBuffers are " "the same as ordinary ArrayBuffers. See http://crbug.com/v8/9908.") bool IsExternal() const; @@ -5465,8 +5541,7 @@ class V8_EXPORT ArrayBuffer : public Object { * deleter, which will call ArrayBuffer::Allocator::Free if the buffer * was allocated with ArrayBuffer::Allocator::Allocate. */ - V8_DEPRECATE_SOON( - "Use GetBackingStore or Detach. See http://crbug.com/v8/9908.") + V8_DEPRECATED("Use GetBackingStore or Detach. See http://crbug.com/v8/9908.") Contents Externalize(); /** @@ -5476,7 +5551,7 @@ class V8_EXPORT ArrayBuffer : public Object { * With the new lifetime management of backing stores there is no need for * externalizing, so this function exists only to make the transition easier. */ - V8_DEPRECATE_SOON("This will be removed together with IsExternal.") + V8_DEPRECATED("This will be removed together with IsExternal.") void Externalize(const std::shared_ptr& backing_store); /** @@ -5487,7 +5562,7 @@ class V8_EXPORT ArrayBuffer : public Object { * The embedder should make sure to hold a strong reference to the * ArrayBuffer while accessing this pointer. */ - V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.") + V8_DEPRECATED("Use GetBackingStore. See http://crbug.com/v8/9908.") Contents GetContents(); /** @@ -5871,7 +5946,7 @@ class V8_EXPORT SharedArrayBuffer : public Object { * specified. The memory block will not be reclaimed when a created * SharedArrayBuffer is garbage-collected. */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use the version that takes a BackingStore. " "See http://crbug.com/v8/9908.") static Local New( @@ -5931,7 +6006,7 @@ class V8_EXPORT SharedArrayBuffer : public Object { * Returns true if SharedArrayBuffer is externalized, that is, does not * own its memory block. */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "With v8::BackingStore externalized SharedArrayBuffers are the same " "as ordinary SharedArrayBuffers. See http://crbug.com/v8/9908.") bool IsExternal() const; @@ -5948,8 +6023,7 @@ class V8_EXPORT SharedArrayBuffer : public Object { * v8::Isolate::CreateParams::array_buffer_allocator. * */ - V8_DEPRECATE_SOON( - "Use GetBackingStore or Detach. See http://crbug.com/v8/9908.") + V8_DEPRECATED("Use GetBackingStore or Detach. See http://crbug.com/v8/9908.") Contents Externalize(); /** @@ -5959,7 +6033,7 @@ class V8_EXPORT SharedArrayBuffer : public Object { * With the new lifetime management of backing stores there is no need for * externalizing, so this function exists only to make the transition easier. */ - V8_DEPRECATE_SOON("This will be removed together with IsExternal.") + V8_DEPRECATED("This will be removed together with IsExternal.") void Externalize(const std::shared_ptr& backing_store); /** @@ -5974,7 +6048,7 @@ class V8_EXPORT SharedArrayBuffer : public Object { * by the allocator specified in * v8::Isolate::CreateParams::array_buffer_allocator. */ - V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.") + V8_DEPRECATED("Use GetBackingStore. See http://crbug.com/v8/9908.") Contents GetContents(); /** @@ -6119,9 +6193,10 @@ class V8_EXPORT RegExp : public Object { kUnicode = 1 << 4, kDotAll = 1 << 5, kLinear = 1 << 6, + kHasIndices = 1 << 7, }; - static constexpr int kFlagCount = 7; + static constexpr int kFlagCount = 8; /** * Creates a regular expression from the given pattern string and @@ -7418,7 +7493,39 @@ using CallCompletedCallback = void (*)(Isolate*); * The specifier is the name of the module that should be imported. * * The embedder must compile, instantiate, evaluate the Module, and - * obtain it's namespace object. + * obtain its namespace object. + * + * The Promise returned from this function is forwarded to userland + * JavaScript. The embedder must resolve this promise with the module + * namespace object. In case of an exception, the embedder must reject + * this promise with the exception. If the promise creation itself + * fails (e.g. due to stack overflow), the embedder must propagate + * that exception by returning an empty MaybeLocal. + */ +using HostImportModuleDynamicallyCallback V8_DEPRECATE_SOON( + "Use HostImportModuleDynamicallyWithImportAssertionsCallback instead") = + MaybeLocal (*)(Local context, + Local referrer, + Local specifier); + +/** + * HostImportModuleDynamicallyWithImportAssertionsCallback is called when we + * require the embedder to load a module. This is used as part of the dynamic + * import syntax. + * + * The referrer contains metadata about the script/module that calls + * import. + * + * The specifier is the name of the module that should be imported. + * + * The import_assertions are import assertions for this request in the form: + * [key1, value1, key2, value2, ...] where the keys and values are of type + * v8::String. Note, unlike the FixedArray passed to ResolveModuleCallback and + * returned from ModuleRequest::GetImportAssertions(), this array does not + * contain the source Locations of the assertions. + * + * The embedder must compile, instantiate, evaluate the Module, and + * obtain its namespace object. * * The Promise returned from this function is forwarded to userland * JavaScript. The embedder must resolve this promise with the module @@ -7427,9 +7534,11 @@ using CallCompletedCallback = void (*)(Isolate*); * fails (e.g. due to stack overflow), the embedder must propagate * that exception by returning an empty MaybeLocal. */ -using HostImportModuleDynamicallyCallback = MaybeLocal (*)( - Local context, Local referrer, - Local specifier); +using HostImportModuleDynamicallyWithImportAssertionsCallback = + MaybeLocal (*)(Local context, + Local referrer, + Local specifier, + Local import_assertions); /** * HostInitializeImportMetaObjectCallback is called the first time import.meta @@ -7689,9 +7798,6 @@ using ApiImplementationCallback = void (*)(const FunctionCallbackInfo&); // --- Callback for WebAssembly.compileStreaming --- using WasmStreamingCallback = void (*)(const FunctionCallbackInfo&); -// --- Callback for checking if WebAssembly threads are enabled --- -using WasmThreadsEnabledCallback = bool (*)(Local context); - // --- Callback for loading source map file for Wasm profiling support using WasmLoadSourceMapCallback = Local (*)(Isolate* isolate, const char* name); @@ -7699,6 +7805,9 @@ using WasmLoadSourceMapCallback = Local (*)(Isolate* isolate, // --- Callback for checking if WebAssembly Simd is enabled --- using WasmSimdEnabledCallback = bool (*)(Local context); +// --- Callback for checking if WebAssembly exceptions are enabled --- +using WasmExceptionsEnabledCallback = bool (*)(Local context); + // --- Garbage Collection Callbacks --- /** @@ -8417,28 +8526,9 @@ class V8_EXPORT Isolate { int embedder_wrapper_type_index = -1; int embedder_wrapper_object_index = -1; - /** - * If parameters are set, V8 creates a managed C++ heap as extension to its - * JavaScript heap. - * - * See v8::Isolate::GetCppHeap() for working with the heap. - * - * This is an experimental feature and may still change significantly. - */ - std::shared_ptr cpp_heap_params; - - /** - * This list is provided by the embedder to indicate which import assertions - * they want to handle. Only import assertions whose keys are present in - * supported_import_assertions will be included in the import assertions - * lists of ModuleRequests that will be passed to the embedder. If - * supported_import_assertions is left empty, then the embedder will not - * receive any import assertions. - * - * This corresponds to the list returned by the HostGetSupportedAssertions - * host-defined abstract operation: - * https://tc39.es/proposal-import-assertions/#sec-hostgetsupportedimportassertions - */ + V8_DEPRECATED( + "Setting this has no effect. Embedders should ignore import assertions " + "that they do not use.") std::vector supported_import_assertions; }; @@ -8480,7 +8570,11 @@ class V8_EXPORT Isolate { private: OnFailure on_failure_; - void* internal_; + Isolate* isolate_; + + bool was_execution_allowed_assert_; + bool was_execution_allowed_throws_; + bool was_execution_allowed_dump_; }; /** @@ -8498,9 +8592,10 @@ class V8_EXPORT Isolate { const AllowJavascriptExecutionScope&) = delete; private: - void* internal_throws_; - void* internal_assert_; - void* internal_dump_; + Isolate* isolate_; + bool was_execution_allowed_assert_; + bool was_execution_allowed_throws_; + bool was_execution_allowed_dump_; }; /** @@ -8590,8 +8685,8 @@ class V8_EXPORT Isolate { kArrayInstanceProtoModified = 27, kArrayInstanceConstructorModified = 28, kLegacyFunctionDeclaration = 29, - kRegExpPrototypeSourceGetter = 30, - kRegExpPrototypeOldFlagGetter = 31, + kRegExpPrototypeSourceGetter = 30, // Unused. + kRegExpPrototypeOldFlagGetter = 31, // Unused. kDecimalWithLeadingZeroInStrictMode = 32, kLegacyDateParser = 33, kDefineGetterOrSetterWouldThrow = 34, @@ -8669,8 +8764,9 @@ class V8_EXPORT Isolate { kWasmSimdOpcodes = 106, kVarRedeclaredCatchBinding = 107, kWasmRefTypes = 108, - kWasmBulkMemory = 109, + kWasmBulkMemory = 109, // Unused. kWasmMultiValue = 110, + kWasmExceptionHandling = 111, // If you add new values here, you'll also need to update Chromium's: // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to @@ -8763,9 +8859,19 @@ class V8_EXPORT Isolate { * This specifies the callback called by the upcoming dynamic * import() language feature to load modules. */ + V8_DEPRECATE_SOON( + "Use the version of SetHostImportModuleDynamicallyCallback that takes a " + "HostImportModuleDynamicallyWithImportAssertionsCallback instead") void SetHostImportModuleDynamicallyCallback( HostImportModuleDynamicallyCallback callback); + /** + * This specifies the callback called by the upcoming dynamic + * import() language feature to load modules. + */ + void SetHostImportModuleDynamicallyCallback( + HostImportModuleDynamicallyWithImportAssertionsCallback callback); + /** * This specifies the callback called by the upcoming import.meta * language feature to retrieve host-defined meta data for a module. @@ -9041,8 +9147,26 @@ class V8_EXPORT Isolate { EmbedderHeapTracer* GetEmbedderHeapTracer(); /** - * \returns the C++ heap managed by V8. Only available if the Isolate was - * created with proper CreatePrams::cpp_heap_params option. + * Attaches a managed C++ heap as an extension to the JavaScript heap. The + * embedder maintains ownership of the CppHeap. At most one C++ heap can be + * attached to V8. + * + * This is an experimental feature and may still change significantly. + */ + void AttachCppHeap(CppHeap*); + + /** + * Detaches a managed C++ heap if one was attached using `AttachCppHeap()`. + * + * This is an experimental feature and may still change significantly. + */ + void DetachCppHeap(); + + /** + * This is an experimental feature and may still change significantly. + + * \returns the C++ heap managed by V8. Only available if such a heap has been + * attached using `AttachCppHeap()`. */ CppHeap* GetCppHeap() const; @@ -9580,12 +9704,12 @@ class V8_EXPORT Isolate { void SetWasmStreamingCallback(WasmStreamingCallback callback); - void SetWasmThreadsEnabledCallback(WasmThreadsEnabledCallback callback); - void SetWasmLoadSourceMapCallback(WasmLoadSourceMapCallback callback); void SetWasmSimdEnabledCallback(WasmSimdEnabledCallback callback); + void SetWasmExceptionsEnabledCallback(WasmExceptionsEnabledCallback callback); + /** * Check if V8 is dead and therefore unusable. This is the case after * fatal errors such as out-of-memory situations. @@ -10434,7 +10558,7 @@ class V8_EXPORT ExtensionConfiguration { * A sandboxed execution context with its own set of built-in objects * and functions. */ -class V8_EXPORT Context { +class V8_EXPORT Context : public Data { public: /** * Returns the global proxy object. @@ -10711,18 +10835,21 @@ class V8_EXPORT Context { const BackupIncumbentScope* prev_ = nullptr; }; + V8_INLINE static Context* Cast(Data* data); + private: friend class Value; friend class Script; friend class Object; friend class Function; + static void CheckCast(Data* obj); + internal::Address* GetDataFromSnapshotOnce(size_t index); Local SlowGetEmbedderData(int index); void* SlowGetAlignedPointerFromEmbedderData(int index); }; - /** * Multiple threads in V8 are allowed, but only one thread at a time is allowed * to use any given V8 isolate, see the comments in the Isolate class. The @@ -11484,7 +11611,7 @@ ScriptOrigin::ScriptOrigin( Local is_opaque, Local is_wasm, Local is_module, Local host_defined_options) : ScriptOrigin( - resource_name, + Isolate::GetCurrent(), resource_name, line_offset.IsEmpty() ? 0 : static_cast(line_offset->Value()), column_offset.IsEmpty() ? 0 : static_cast(column_offset->Value()), @@ -11508,6 +11635,21 @@ ScriptOrigin::ScriptOrigin(Local resource_name, int line_offset, source_map_url_(source_map_url), host_defined_options_(host_defined_options) {} +ScriptOrigin::ScriptOrigin(Isolate* isolate, Local resource_name, + int line_offset, int column_offset, + bool is_shared_cross_origin, int script_id, + Local source_map_url, bool is_opaque, + bool is_wasm, bool is_module, + Local host_defined_options) + : isolate_(isolate), + resource_name_(resource_name), + resource_line_offset_(line_offset), + resource_column_offset_(column_offset), + options_(is_shared_cross_origin, is_opaque, is_wasm, is_module), + script_id_(script_id), + source_map_url_(source_map_url), + host_defined_options_(host_defined_options) {} + Local ScriptOrigin::ResourceName() const { return resource_name_; } Local ScriptOrigin::HostDefinedOptions() const { @@ -11876,6 +12018,13 @@ BigInt* BigInt::Cast(v8::Data* data) { return static_cast(data); } +Context* Context::Cast(v8::Data* data) { +#ifdef V8_ENABLE_CHECKS + CheckCast(data); +#endif + return static_cast(data); +} + Date* Date::Cast(v8::Value* value) { #ifdef V8_ENABLE_CHECKS CheckCast(value); diff --git a/deps/v8/include/v8config.h b/deps/v8/include/v8config.h index 0886f691d56a19..acd34d7a1f255d 100644 --- a/deps/v8/include/v8config.h +++ b/deps/v8/include/v8config.h @@ -5,6 +5,14 @@ #ifndef V8CONFIG_H_ #define V8CONFIG_H_ +#ifdef V8_GN_HEADER +#if __cplusplus >= 201703L && !__has_include("v8-gn.h") +#error Missing v8-gn.h. The configuration for v8 is missing from the include \ +path. Add it with -I to the command line +#endif +#include "v8-gn.h" // NOLINT(build/include_directory) +#endif + // clang-format off // Platform headers for feature detection below. diff --git a/deps/v8/infra/mb/mb_config.pyl b/deps/v8/infra/mb/mb_config.pyl index b95f7d2fbf5033..2e66b1c99eaaef 100644 --- a/deps/v8/infra/mb/mb_config.pyl +++ b/deps/v8/infra/mb/mb_config.pyl @@ -7,7 +7,7 @@ # config names (where each config name is a key in the 'configs' dict, # below). MB uses this dict to look up which config to use for a given bot. # Bots are ordered by appearance on waterfall. - 'masters': { + 'builder_groups': { 'developer_default': { 'android.arm.debug': 'default_debug_android_arm', 'android.arm.optdebug': 'default_optdebug_android_arm', @@ -33,6 +33,12 @@ 'ppc64.debug.sim': 'default_debug_ppc64_sim', 'ppc64.optdebug.sim': 'default_optdebug_ppc64_sim', 'ppc64.release.sim': 'default_release_ppc64_sim', + 'riscv64.debug': 'default_debug_riscv64', + 'riscv64.optdebug': 'default_optdebug_riscv64', + 'riscv64.release': 'default_release_riscv64', + 'riscv64.debug.sim': 'default_debug_riscv64_sim', + 'riscv64.optdebug.sim': 'default_optdebug_riscv64_sim', + 'riscv64.release.sim': 'default_release_riscv64_sim', 's390x.debug': 'default_debug_s390x', 's390x.optdebug': 'default_optdebug_s390x', 's390x.release': 'default_release_s390x', @@ -57,11 +63,13 @@ # Linux64. 'V8 Linux64 - builder': 'release_x64', 'V8 Linux64 - debug builder': 'debug_x64', + 'V8 Linux64 - dict tracking - debug - builder': 'debug_x64_dict_tracking_trybot', 'V8 Linux64 - custom snapshot - debug builder': 'debug_x64_custom', 'V8 Linux64 - internal snapshot': 'release_x64_internal', 'V8 Linux64 - debug - header includes': 'debug_x64_header_includes', 'V8 Linux64 - shared': 'release_x64_shared_verify_heap', 'V8 Linux64 - verify csa': 'release_x64_verify_csa', + 'V8 Linux64 - no wasm - builder': 'release_x64_webassembly_disabled', # Windows. 'V8 Win32 - builder': 'release_x86_minimal_symbols', 'V8 Win32 - debug builder': 'debug_x86_minimal_symbols', @@ -175,38 +183,6 @@ # RISC-V 'V8 Linux - riscv64 - sim - builder': 'release_simulate_riscv64', }, - 'client.v8.branches': { - 'V8 Linux - previous branch': 'release_x86', - 'V8 Linux - previous branch - debug': 'debug_x86', - 'V8 Linux - beta branch': 'release_x86', - 'V8 Linux - beta branch - debug': 'debug_x86', - 'V8 Linux - stable branch': 'release_x86', - 'V8 Linux - stable branch - debug': 'debug_x86', - 'V8 Linux64 - previous branch': 'release_x64', - 'V8 Linux64 - previous branch - debug': 'debug_x64', - 'V8 Linux64 - beta branch': 'release_x64', - 'V8 Linux64 - beta branch - debug': 'debug_x64', - 'V8 Linux64 - stable branch': 'release_x64', - 'V8 Linux64 - stable branch - debug': 'debug_x64', - 'V8 arm - sim - previous branch': 'release_simulate_arm', - 'V8 arm - sim - previous branch - debug': 'debug_simulate_arm', - 'V8 arm - sim - beta branch': 'release_simulate_arm', - 'V8 arm - sim - beta branch - debug': 'debug_simulate_arm', - 'V8 arm - sim - stable branch': 'release_simulate_arm', - 'V8 arm - sim - stable branch - debug': 'debug_simulate_arm', - 'V8 mips64el - sim - previous branch': 'release_simulate_mips64el', - 'V8 mips64el - sim - beta branch': 'release_simulate_mips64el', - 'V8 mips64el - sim - stable branch': 'release_simulate_mips64el', - 'V8 mipsel - sim - previous branch': 'release_simulate_mipsel', - 'V8 mipsel - sim - beta branch': 'release_simulate_mipsel', - 'V8 mipsel - sim - stable branch': 'release_simulate_mipsel', - 'V8 ppc64 - sim - previous branch': 'release_simulate_ppc64', - 'V8 ppc64 - sim - beta branch': 'release_simulate_ppc64', - 'V8 ppc64 - sim - stable branch': 'release_simulate_ppc64', - 'V8 s390x - sim - previous branch': 'release_simulate_s390x', - 'V8 s390x - sim - beta branch': 'release_simulate_s390x', - 'V8 s390x - sim - stable branch': 'release_simulate_s390x', - }, 'tryserver.v8': { 'v8_android_arm_compile_rel': 'release_android_arm', 'v8_android_arm64_compile_dbg': 'debug_android_arm64', @@ -228,6 +204,7 @@ 'v8_linux64_arm64_pointer_compression_rel_ng': 'release_simulate_arm64_pointer_compression', 'v8_linux64_dbg_ng': 'debug_x64_trybot', + 'v8_linux64_dict_tracking_dbg_ng': 'debug_x64_dict_tracking_trybot', 'v8_linux64_gc_stress_custom_snapshot_dbg_ng': 'debug_x64_trybot_custom', 'v8_linux64_gcc_compile_dbg': 'debug_x64_gcc', 'v8_linux64_header_includes_dbg': 'debug_x64_header_includes', @@ -237,6 +214,7 @@ 'v8_linux64_pointer_compression_rel_ng': 'release_x64_pointer_compression', 'v8_linux64_rel_ng': 'release_x64_test_features_trybot', 'v8_linux64_shared_compile_rel': 'release_x64_shared_verify_heap', + 'v8_linux64_no_wasm_compile_rel': 'release_x64_webassembly_disabled', 'v8_linux64_verify_csa_rel_ng': 'release_x64_verify_csa', 'v8_linux64_asan_rel_ng': 'release_x64_asan_minimal_symbols', 'v8_linux64_cfi_rel_ng': 'release_x64_cfi', @@ -262,6 +240,7 @@ 'v8_mac_arm64_rel_ng': 'release_arm64', 'v8_mac_arm64_dbg_ng': 'debug_arm64', 'v8_mac_arm64_full_dbg_ng': 'full_debug_arm64', + 'v8_mac_arm64_compile_rel': 'release_arm64', 'v8_mac_arm64_sim_rel_ng': 'release_simulate_arm64_trybot', 'v8_mac_arm64_sim_dbg_ng': 'debug_simulate_arm64', 'v8_mac_arm64_sim_nodcheck_rel_ng': 'release_simulate_arm64', @@ -320,6 +299,18 @@ 'debug', 'simulate_mips64el', 'v8_enable_slow_dchecks'], 'default_release_mips64el': [ 'release', 'simulate_mips64el'], + 'default_debug_riscv64': [ + 'debug', 'riscv64', 'gcc', 'v8_enable_slow_dchecks', 'v8_full_debug'], + 'default_optdebug_riscv64': [ + 'debug', 'riscv64', 'gcc', 'v8_enable_slow_dchecks'], + 'default_release_riscv64': [ + 'release', 'riscv64', 'gcc'], + 'default_debug_riscv64_sim': [ + 'debug', 'simulate_riscv64', 'v8_enable_slow_dchecks', 'v8_full_debug'], + 'default_optdebug_riscv64_sim': [ + 'debug', 'simulate_riscv64', 'v8_enable_slow_dchecks'], + 'default_release_riscv64_sim': [ + 'release', 'simulate_riscv64'], 'default_debug_ppc64': [ 'debug', 'ppc64', 'gcc', 'v8_enable_slow_dchecks', 'v8_full_debug'], 'default_optdebug_ppc64': [ @@ -517,6 +508,8 @@ 'release_x64_verify_csa': [ 'release_bot', 'x64', 'dcheck_always_on', 'v8_enable_slow_dchecks', 'v8_verify_csa'], + 'release_x64_webassembly_disabled': [ + 'release_bot', 'x64', 'webassembly_disabled'], # Official configs for x64. 'official_x64': [ @@ -544,6 +537,8 @@ 'debug_bot', 'x64', 'perfetto'], 'debug_x64_trybot': [ 'debug_trybot', 'x64'], + 'debug_x64_dict_tracking_trybot': [ + 'debug_trybot', 'x64', 'v8_enable_dict_property_const_tracking'], 'debug_x64_trybot_custom': [ 'debug_trybot', 'x64', 'v8_snapshot_custom'], 'full_debug_x64': [ @@ -564,8 +559,6 @@ 'debug', 'x86', 'goma', 'v8_enable_slow_dchecks', 'v8_full_debug'], # Release configs for x86. - 'release_x86': [ - 'release_bot', 'x86'], 'release_x86_gcc': [ 'release_bot_no_goma', 'x86', 'gcc', 'v8_check_header_includes'], 'release_x86_gcc_minimal_symbols': [ @@ -848,6 +841,14 @@ 'gn_args': 'v8_enable_slow_dchecks=true', }, + 'webassembly_disabled': { + 'gn_args': 'v8_enable_webassembly=false', + }, + + 'v8_enable_dict_property_const_tracking': { + 'gn_args': 'v8_dict_property_const_tracking=true', + }, + 'v8_disable_pointer_compression': { 'gn_args': 'v8_enable_pointer_compression=false', }, @@ -901,6 +902,10 @@ 'gn_args': 'target_cpu="ppc64" use_custom_libcxx=false', }, + 'riscv64': { + 'gn_args': 'target_cpu="riscv64" use_custom_libcxx=false', + }, + 'x64': { 'gn_args': 'target_cpu="x64"', }, diff --git a/deps/v8/infra/testing/README.md b/deps/v8/infra/testing/README.md index 438ba2e6d064c4..67231e9d641189 100644 --- a/deps/v8/infra/testing/README.md +++ b/deps/v8/infra/testing/README.md @@ -34,7 +34,7 @@ The structure of the file is: ``` The `` is a string name of the builder to execute the tests. `` is a label defining a test specification matching the -[infra-side](https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/slave/recipe_modules/v8/testing.py#58). +[infra-side](https://chromium.googlesource.com/chromium/tools/build/+/refs/heads/master/recipes/recipe_modules/v8/testing.py). The optional `suffix` will be appended to test-step names for disambiguation. The optional `variant` is a testing variant specified [here](https://chromium.googlesource.com/v8/v8/+/master/tools/testrunner/local/variants.py). diff --git a/deps/v8/infra/testing/builders.pyl b/deps/v8/infra/testing/builders.pyl index bffd21d01b2c17..7617d885de2bc7 100644 --- a/deps/v8/infra/testing/builders.pyl +++ b/deps/v8/infra/testing/builders.pyl @@ -39,11 +39,10 @@ 'os': 'Android', }, 'tests': [ - {'name': 'benchmarks', 'variant': 'default'}, + {'name': 'mozilla', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 10}, {'name': 'v8testing', 'variant': 'default', 'shards': 4}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 4}, - {'name': 'mozilla', 'variant': 'default'}, - {'name': 'test262', 'variant': 'default', 'shards': 9}, ], }, ############################################################################## @@ -259,7 +258,7 @@ {'name': 'mozilla'}, {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 7}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 6}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 7}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 2}, ], }, @@ -280,7 +279,7 @@ {'name': 'mozilla', 'shards': 2}, {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 10}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 8}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 10}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 2}, ], }, @@ -294,7 +293,6 @@ {'name': 'test262', 'shards': 7}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, - {'name': 'v8testing', 'variant': 'no_local_heaps'}, {'name': 'v8testing', 'variant': 'slow_path'}, ], }, @@ -329,6 +327,16 @@ {'name': 'v8testing', 'variant': 'no_lfa'}, {'name': 'v8testing', 'variant': 'stress_instruction_scheduling'}, {'name': 'v8testing', 'variant': 'stress_concurrent_allocation'}, + {'name': 'v8testing', 'variant': 'stress_concurrent_inlining'}, + ], + }, + 'v8_linux64_dict_tracking_dbg_ng_triggered': { + 'swarming_dimensions' : { + 'cpu': 'x86-64-avx2', + 'os': 'Ubuntu-16.04', + }, + 'tests': [ + {'name': 'v8testing', 'shards': 3}, ], }, 'v8_linux64_fuzzilli_ng_triggered': { @@ -357,9 +365,6 @@ 'tests': [ # Infra staging. {'name': 'v8testing', 'variant': 'infra_staging', 'shards': 2}, - # Native context independent code. - {'name': 'v8testing', 'variant': 'nci'}, - {'name': 'v8testing', 'variant': 'nci_as_midtier'}, # Stress sampling. {'name': 'mjsunit', 'variant': 'stress_sampling'}, {'name': 'webkit', 'variant': 'stress_sampling'}, @@ -449,7 +454,6 @@ {'name': 'test262', 'variant': 'default', 'shards': 3}, {'name': 'v8testing', 'shards': 5}, {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, - {'name': 'v8testing', 'variant': 'no_local_heaps'}, {'name': 'v8testing', 'variant': 'slow_path'}, {'name': 'v8testing', 'variant': 'stress_concurrent_allocation'}, ], @@ -469,6 +473,7 @@ 'test_args': ['--extra-flags=--future'], 'shards': 6, }, + {'name': 'v8testing', 'variant': 'stress_concurrent_inlining'}, ], }, 'v8_linux64_tsan_isolates_rel_ng_triggered': { @@ -506,7 +511,7 @@ {'name': 'mozilla', 'shards': 4}, {'name': 'test262', 'variant': 'default', 'shards': 4}, {'name': 'v8testing', 'shards': 14}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 10}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 12}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 5}, ], }, @@ -527,7 +532,7 @@ {'name': 'mozilla', 'shards': 4}, {'name': 'test262', 'variant': 'default', 'shards': 4}, {'name': 'v8testing', 'shards': 14}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 10}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 12}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 5}, ], }, @@ -650,46 +655,42 @@ 'swarming_dimensions' : { 'cpu': 'x86-64', 'os': 'Mac-10.15', - 'gpu': 'none', }, 'tests': [ - {'name': 'v8testing', 'shards': 4}, + {'name': 'v8testing', 'shards': 8}, ], }, 'v8_mac64_dbg_ng_triggered': { 'swarming_dimensions' : { 'cpu': 'x86-64', 'os': 'Mac-10.15', - 'gpu': 'none', }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default', 'shards': 2}, - {'name': 'v8testing', 'shards': 3}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 4}, + {'name': 'v8testing', 'shards': 6}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 6}, ], }, 'v8_mac64_gc_stress_dbg_ng_triggered': { 'swarming_dimensions' : { 'cpu': 'x86-64', 'os': 'Mac-10.15', - 'gpu': 'none', }, 'tests': [ - {'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 4}, + {'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 6}, ], }, 'v8_mac64_rel_ng_triggered': { 'swarming_dimensions' : { 'cpu': 'x86-64', 'os': 'Mac-10.15', - 'gpu': 'none', }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default', 'shards': 2}, - {'name': 'v8testing', 'shards': 2}, - {'name': 'v8testing', 'variant': 'extra'}, + {'name': 'test262', 'variant': 'default', 'shards': 3}, + {'name': 'v8testing', 'shards': 3}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, ], }, 'v8_mac_arm64_rel_ng_triggered': { @@ -1093,6 +1094,7 @@ {'name': 'v8testing', 'variant': 'slow_path'}, {'name': 'v8testing', 'variant': 'stress_instruction_scheduling'}, {'name': 'v8testing', 'variant': 'stress_concurrent_allocation'}, + {'name': 'v8testing', 'variant': 'stress_concurrent_inlining'}, # Noavx. { 'name': 'mozilla', @@ -1113,6 +1115,15 @@ }, ], }, + 'V8 Linux64 - dict tracking - debug': { + 'swarming_dimensions': { + 'cpu': 'x86-64-avx2', + 'os': 'Ubuntu-16.04', + }, + 'tests': [ + {'name': 'v8testing', 'shards': 3}, + ], + }, 'V8 Linux64 - debug - fyi': { 'swarming_dimensions' : { 'os': 'Ubuntu-16.04', @@ -1120,9 +1131,6 @@ 'tests': [ # Infra staging. {'name': 'v8testing', 'variant': 'infra_staging', 'shards': 2}, - # Native context independent code. - {'name': 'v8testing', 'variant': 'nci'}, - {'name': 'v8testing', 'variant': 'nci_as_midtier'}, # Stress sampling. {'name': 'mjsunit', 'variant': 'stress_sampling'}, {'name': 'webkit', 'variant': 'stress_sampling'}, @@ -1152,9 +1160,6 @@ 'tests': [ # Infra staging. {'name': 'v8testing', 'variant': 'infra_staging'}, - # Native context independent code. - {'name': 'v8testing', 'variant': 'nci'}, - {'name': 'v8testing', 'variant': 'nci_as_midtier'}, # Stress sampling. {'name': 'mjsunit', 'variant': 'stress_sampling'}, {'name': 'webkit', 'variant': 'stress_sampling'}, @@ -1214,7 +1219,6 @@ {'name': 'test262', 'shards': 5}, {'name': 'v8testing', 'shards': 2}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, - {'name': 'v8testing', 'variant': 'no_local_heaps', 'shards': 1}, {'name': 'v8testing', 'variant': 'slow_path', 'shards': 1}, ], }, @@ -1240,7 +1244,6 @@ {'name': 'test262', 'variant': 'default', 'shards': 3}, {'name': 'v8testing', 'shards': 5}, {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, - {'name': 'v8testing', 'variant': 'no_local_heaps', 'shards': 1}, {'name': 'v8testing', 'variant': 'slow_path', 'shards': 1}, {'name': 'v8testing', 'variant': 'stress_concurrent_allocation', 'shards': 1}, ], @@ -1299,6 +1302,7 @@ 'test_args': ['--extra-flags=--future'], 'shards': 6, }, + {'name': 'v8testing', 'variant': 'stress_concurrent_inlining'}, ], }, 'V8 Linux64 UBSan': { @@ -1316,46 +1320,42 @@ 'swarming_dimensions': { 'cpu': 'x86-64', 'os': 'Mac-10.15', - 'gpu': 'none', }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default', 'shards': 2}, - {'name': 'v8testing', 'shards': 2}, - {'name': 'v8testing', 'variant': 'extra'}, + {'name': 'test262', 'variant': 'default', 'shards': 3}, + {'name': 'v8testing', 'shards': 3}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, ], }, 'V8 Mac64 - debug': { 'swarming_dimensions': { 'cpu': 'x86-64', 'os': 'Mac-10.15', - 'gpu': 'none', }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default', 'shards': 2}, - {'name': 'v8testing', 'shards': 4}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 4}, + {'name': 'v8testing', 'shards': 6}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 6}, ], }, 'V8 Mac64 ASAN': { 'swarming_dimensions': { 'cpu': 'x86-64', 'os': 'Mac-10.15', - 'gpu': 'none', }, 'tests': [ - {'name': 'v8testing', 'shards': 5}, + {'name': 'v8testing', 'shards': 10}, ], }, 'V8 Mac64 GC Stress': { 'swarming_dimensions': { 'cpu': 'x86-64', 'os': 'Mac-10.15', - 'gpu': 'none', }, 'tests': [ - {'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 4}, + {'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 6}, ], }, 'V8 Mac - arm64 - release': { @@ -1476,9 +1476,9 @@ }, 'tests': [ {'name': 'mozilla', 'variant': 'default'}, - {'name': 'test262', 'variant': 'default', 'shards': 8}, - {'name': 'v8testing', 'variant': 'default', 'shards': 3}, - {'name': 'v8testing', 'variant': 'trusted', 'shards': 3}, + {'name': 'test262', 'variant': 'default', 'shards': 10}, + {'name': 'v8testing', 'variant': 'default', 'shards': 4}, + {'name': 'v8testing', 'variant': 'trusted', 'shards': 4}, ], }, 'V8 Arm': { @@ -1616,7 +1616,7 @@ {'name': 'mozilla', 'shards': 6}, {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 10}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 8}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 10}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 4}, # Armv8-a. { @@ -1702,7 +1702,7 @@ {'name': 'mozilla', 'shards': 2}, {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 12}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 9}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 11}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 2}, ], }, diff --git a/deps/v8/samples/cppgc/cppgc-sample.cc b/deps/v8/samples/cppgc/cppgc-sample.cc index befda9619796ff..d76c16a553619f 100644 --- a/deps/v8/samples/cppgc/cppgc-sample.cc +++ b/deps/v8/samples/cppgc/cppgc-sample.cc @@ -46,11 +46,7 @@ int main(int argc, char* argv[]) { // backend allocation. auto cppgc_platform = std::make_shared(); // Initialize the process. This must happen before any cppgc::Heap::Create() - // calls. cppgc::DefaultPlatform::InitializeProcess initializes both cppgc - // and v8 (if cppgc is not used as a standalone) as needed. - // If using a platform other than cppgc::DefaultPlatform, should call - // cppgc::InitializeProcess (for standalone builds) or - // v8::V8::InitializePlatform (for non-standalone builds) directly. + // calls. cppgc::DefaultPlatform::InitializeProcess(cppgc_platform.get()); // Create a managed heap. std::unique_ptr heap = cppgc::Heap::Create(cppgc_platform); diff --git a/deps/v8/samples/shell.cc b/deps/v8/samples/shell.cc index 4cff77cc040f04..e844ca51bf3157 100644 --- a/deps/v8/samples/shell.cc +++ b/deps/v8/samples/shell.cc @@ -314,7 +314,7 @@ bool ExecuteString(v8::Isolate* isolate, v8::Local source, bool report_exceptions) { v8::HandleScope handle_scope(isolate); v8::TryCatch try_catch(isolate); - v8::ScriptOrigin origin(name); + v8::ScriptOrigin origin(isolate, name); v8::Local context(isolate->GetCurrentContext()); v8::Local script; if (!v8::Script::Compile(context, source, &origin).ToLocal(&script)) { diff --git a/deps/v8/src/DEPS b/deps/v8/src/DEPS index 42d0c2d8a40371..2bdba94b46aea0 100644 --- a/deps/v8/src/DEPS +++ b/deps/v8/src/DEPS @@ -3,6 +3,8 @@ include_rules = [ "+src", "-src/asmjs", "+src/asmjs/asm-js.h", + "-src/baseline", + "+src/baseline/baseline.h", "-src/compiler", "+src/compiler/pipeline.h", "+src/compiler/code-assembler.h", diff --git a/deps/v8/src/api/api-inl.h b/deps/v8/src/api/api-inl.h index b8a5c195324937..10c8fb064dd97f 100644 --- a/deps/v8/src/api/api-inl.h +++ b/deps/v8/src/api/api-inl.h @@ -6,6 +6,7 @@ #define V8_API_API_INL_H_ #include "src/api/api.h" +#include "src/execution/microtask-queue.h" #include "src/handles/handles-inl.h" #include "src/objects/foreign-inl.h" #include "src/objects/js-weak-refs.h" @@ -96,7 +97,7 @@ MAKE_TO_LOCAL(AccessorSignatureToLocal, FunctionTemplateInfo, AccessorSignature) MAKE_TO_LOCAL(MessageToLocal, Object, Message) MAKE_TO_LOCAL(PromiseToLocal, JSObject, Promise) MAKE_TO_LOCAL(StackTraceToLocal, FixedArray, StackTrace) -MAKE_TO_LOCAL(StackFrameToLocal, StackTraceFrame, StackFrame) +MAKE_TO_LOCAL(StackFrameToLocal, StackFrameInfo, StackFrame) MAKE_TO_LOCAL(NumberToLocal, Object, Number) MAKE_TO_LOCAL(IntegerToLocal, Object, Integer) MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32) @@ -131,6 +132,111 @@ OPEN_HANDLE_LIST(MAKE_OPEN_HANDLE) #undef MAKE_OPEN_HANDLE #undef OPEN_HANDLE_LIST +template +class V8_NODISCARD CallDepthScope { + public: + CallDepthScope(i::Isolate* isolate, Local context) + : isolate_(isolate), + context_(context), + escaped_(false), + safe_for_termination_(isolate->next_v8_call_is_safe_for_termination()), + interrupts_scope_(isolate_, i::StackGuard::TERMINATE_EXECUTION, + isolate_->only_terminate_in_safe_scope() + ? (safe_for_termination_ + ? i::InterruptsScope::kRunInterrupts + : i::InterruptsScope::kPostponeInterrupts) + : i::InterruptsScope::kNoop) { + isolate_->thread_local_top()->IncrementCallDepth(this); + isolate_->set_next_v8_call_is_safe_for_termination(false); + if (!context.IsEmpty()) { + i::Handle env = Utils::OpenHandle(*context); + i::HandleScopeImplementer* impl = isolate->handle_scope_implementer(); + if (!isolate->context().is_null() && + isolate->context().native_context() == env->native_context()) { + context_ = Local(); + } else { + impl->SaveContext(isolate->context()); + isolate->set_context(*env); + } + } + if (do_callback) isolate_->FireBeforeCallEnteredCallback(); + } + ~CallDepthScope() { + i::MicrotaskQueue* microtask_queue = isolate_->default_microtask_queue(); + if (!context_.IsEmpty()) { + i::HandleScopeImplementer* impl = isolate_->handle_scope_implementer(); + isolate_->set_context(impl->RestoreContext()); + + i::Handle env = Utils::OpenHandle(*context_); + microtask_queue = env->native_context().microtask_queue(); + } + if (!escaped_) isolate_->thread_local_top()->DecrementCallDepth(this); + if (do_callback) isolate_->FireCallCompletedCallback(microtask_queue); +// TODO(jochen): This should be #ifdef DEBUG +#ifdef V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY + if (do_callback) { + if (microtask_queue && microtask_queue->microtasks_policy() == + v8::MicrotasksPolicy::kScoped) { + DCHECK(microtask_queue->GetMicrotasksScopeDepth() || + !microtask_queue->DebugMicrotasksScopeDepthIsZero()); + } + } +#endif + DCHECK(CheckKeptObjectsClearedAfterMicrotaskCheckpoint(microtask_queue)); + isolate_->set_next_v8_call_is_safe_for_termination(safe_for_termination_); + } + + CallDepthScope(const CallDepthScope&) = delete; + CallDepthScope& operator=(const CallDepthScope&) = delete; + + void Escape() { + DCHECK(!escaped_); + escaped_ = true; + auto thread_local_top = isolate_->thread_local_top(); + thread_local_top->DecrementCallDepth(this); + bool clear_exception = thread_local_top->CallDepthIsZero() && + thread_local_top->try_catch_handler_ == nullptr; + isolate_->OptionalRescheduleException(clear_exception); + } + + private: + bool CheckKeptObjectsClearedAfterMicrotaskCheckpoint( + i::MicrotaskQueue* microtask_queue) { + bool did_perform_microtask_checkpoint = + isolate_->thread_local_top()->CallDepthIsZero() && do_callback && + microtask_queue && + microtask_queue->microtasks_policy() == MicrotasksPolicy::kAuto; + return !did_perform_microtask_checkpoint || + isolate_->heap()->weak_refs_keep_during_job().IsUndefined(isolate_); + } + + i::Isolate* const isolate_; + Local context_; + bool escaped_; + bool do_callback_; + bool safe_for_termination_; + i::InterruptsScope interrupts_scope_; + i::Address previous_stack_height_; + + friend class i::ThreadLocalTop; + + DISALLOW_NEW_AND_DELETE() +}; + +class V8_NODISCARD InternalEscapableScope : public EscapableHandleScope { + public: + explicit inline InternalEscapableScope(i::Isolate* isolate) + : EscapableHandleScope(reinterpret_cast(isolate)) {} +}; + +inline bool IsExecutionTerminatingCheck(i::Isolate* isolate) { + if (isolate->has_scheduled_exception()) { + return isolate->scheduled_exception() == + i::ReadOnlyRoots(isolate).termination_exception(); + } + return false; +} + namespace internal { Handle HandleScopeImplementer::LastEnteredContext() { diff --git a/deps/v8/src/api/api-macros-undef.h b/deps/v8/src/api/api-macros-undef.h new file mode 100644 index 00000000000000..d3eea83a5f0c21 --- /dev/null +++ b/deps/v8/src/api/api-macros-undef.h @@ -0,0 +1,20 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// PRESUBMIT_INTENTIONALLY_MISSING_INCLUDE_GUARD + +#undef LOG_API +#undef ENTER_V8_DO_NOT_USE +#undef ENTER_V8_HELPER_DO_NOT_USE +#undef PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE +#undef PREPARE_FOR_EXECUTION_WITH_CONTEXT +#undef PREPARE_FOR_EXECUTION +#undef ENTER_V8 +#undef ENTER_V8_NO_SCRIPT +#undef ENTER_V8_NO_SCRIPT_NO_EXCEPTION +#undef ENTER_V8_FOR_NEW_CONTEXT +#undef EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE +#undef RETURN_ON_FAILED_EXECUTION +#undef RETURN_ON_FAILED_EXECUTION_PRIMITIVE +#undef RETURN_ESCAPED diff --git a/deps/v8/src/api/api-macros.h b/deps/v8/src/api/api-macros.h new file mode 100644 index 00000000000000..b126e1cd5a06fd --- /dev/null +++ b/deps/v8/src/api/api-macros.h @@ -0,0 +1,132 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Note 1: Any file that includes this one should include api-macros-undef.h +// at the bottom. + +// Note 2: This file is deliberately missing the include guards (the undeffing +// approach wouldn't work otherwise). +// +// PRESUBMIT_INTENTIONALLY_MISSING_INCLUDE_GUARD + +/* + * Most API methods should use one of the three macros: + * + * ENTER_V8, ENTER_V8_NO_SCRIPT, ENTER_V8_NO_SCRIPT_NO_EXCEPTION. + * + * The latter two assume that no script is executed, and no exceptions are + * scheduled in addition (respectively). Creating a pending exception and + * removing it before returning is ok. + * + * Exceptions should be handled either by invoking one of the + * RETURN_ON_FAILED_EXECUTION* macros. + * + * Don't use macros with DO_NOT_USE in their name. + * + * TODO(jochen): Document debugger specific macros. + * TODO(jochen): Document LOG_API and other RuntimeCallStats macros. + * TODO(jochen): All API methods should invoke one of the ENTER_V8* macros. + * TODO(jochen): Remove calls form API methods to DO_NOT_USE macros. + */ + +#define LOG_API(isolate, class_name, function_name) \ + i::RuntimeCallTimerScope _runtime_timer( \ + isolate, i::RuntimeCallCounterId::kAPI_##class_name##_##function_name); \ + LOG(isolate, ApiEntryCall("v8::" #class_name "::" #function_name)) + +#define ENTER_V8_DO_NOT_USE(isolate) i::VMState __state__((isolate)) + +#define ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, \ + function_name, bailout_value, \ + HandleScopeClass, do_callback) \ + if (IsExecutionTerminatingCheck(isolate)) { \ + return bailout_value; \ + } \ + HandleScopeClass handle_scope(isolate); \ + CallDepthScope call_depth_scope(isolate, context); \ + LOG_API(isolate, class_name, function_name); \ + i::VMState __state__((isolate)); \ + bool has_pending_exception = false + +#define PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(isolate, T) \ + if (IsExecutionTerminatingCheck(isolate)) { \ + return MaybeLocal(); \ + } \ + InternalEscapableScope handle_scope(isolate); \ + CallDepthScope call_depth_scope(isolate, v8::Local()); \ + i::VMState __state__((isolate)); \ + bool has_pending_exception = false + +#define PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, class_name, function_name, \ + bailout_value, HandleScopeClass, \ + do_callback) \ + auto isolate = context.IsEmpty() \ + ? i::Isolate::Current() \ + : reinterpret_cast(context->GetIsolate()); \ + ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \ + bailout_value, HandleScopeClass, do_callback); + +#define PREPARE_FOR_EXECUTION(context, class_name, function_name, T) \ + PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, class_name, function_name, \ + MaybeLocal(), InternalEscapableScope, \ + false) + +#define ENTER_V8(isolate, context, class_name, function_name, bailout_value, \ + HandleScopeClass) \ + ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \ + bailout_value, HandleScopeClass, true) + +#ifdef DEBUG +#define ENTER_V8_NO_SCRIPT(isolate, context, class_name, function_name, \ + bailout_value, HandleScopeClass) \ + ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \ + bailout_value, HandleScopeClass, false); \ + i::DisallowJavascriptExecutionDebugOnly __no_script__((isolate)) + +// Lightweight version for APIs that don't require an active context. +#define ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate) \ + i::DisallowJavascriptExecutionDebugOnly __no_script__((isolate)); \ + i::DisallowExceptions __no_exceptions__((isolate)) + +#define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate) \ + i::VMState __state__((isolate)); \ + ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate) + +#define ENTER_V8_FOR_NEW_CONTEXT(isolate) \ + i::VMState __state__((isolate)); \ + i::DisallowExceptions __no_exceptions__((isolate)) +#else +#define ENTER_V8_NO_SCRIPT(isolate, context, class_name, function_name, \ + bailout_value, HandleScopeClass) \ + ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \ + bailout_value, HandleScopeClass, false) + +#define ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate) + +#define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate) \ + i::VMState __state__((isolate)); + +#define ENTER_V8_FOR_NEW_CONTEXT(isolate) \ + i::VMState __state__((isolate)); +#endif // DEBUG + +#define EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, value) \ + do { \ + if (has_pending_exception) { \ + call_depth_scope.Escape(); \ + return value; \ + } \ + } while (false) + +#define RETURN_ON_FAILED_EXECUTION(T) \ + EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, MaybeLocal()) + +#define RETURN_ON_FAILED_EXECUTION_PRIMITIVE(T) \ + EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, Nothing()) + +#define RETURN_ESCAPED(value) return handle_scope.Escape(value); + +// TODO(jochen): This should be #ifdef DEBUG +#ifdef V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY +#endif diff --git a/deps/v8/src/api/api-natives.cc b/deps/v8/src/api/api-natives.cc index 43d0b3a166a339..584d326aaf5e66 100644 --- a/deps/v8/src/api/api-natives.cc +++ b/deps/v8/src/api/api-natives.cc @@ -603,7 +603,7 @@ MaybeHandle ApiNatives::InstantiateRemoteObject( void ApiNatives::AddDataProperty(Isolate* isolate, Handle info, Handle name, Handle value, PropertyAttributes attributes) { - PropertyDetails details(kData, attributes, PropertyCellType::kNoCell); + PropertyDetails details(kData, attributes, PropertyConstness::kMutable); auto details_handle = handle(details.AsSmi(), isolate); Handle data[] = {name, details_handle, value}; AddPropertyToPropertyList(isolate, info, arraysize(data), data); @@ -614,7 +614,7 @@ void ApiNatives::AddDataProperty(Isolate* isolate, Handle info, PropertyAttributes attributes) { auto value = handle(Smi::FromInt(intrinsic), isolate); auto intrinsic_marker = isolate->factory()->true_value(); - PropertyDetails details(kData, attributes, PropertyCellType::kNoCell); + PropertyDetails details(kData, attributes, PropertyConstness::kMutable); auto details_handle = handle(details.AsSmi(), isolate); Handle data[] = {name, intrinsic_marker, details_handle, value}; AddPropertyToPropertyList(isolate, info, arraysize(data), data); @@ -626,7 +626,7 @@ void ApiNatives::AddAccessorProperty(Isolate* isolate, Handle getter, Handle setter, PropertyAttributes attributes) { - PropertyDetails details(kAccessor, attributes, PropertyCellType::kNoCell); + PropertyDetails details(kAccessor, attributes, PropertyConstness::kMutable); auto details_handle = handle(details.AsSmi(), isolate); Handle data[] = {name, details_handle, getter, setter}; AddPropertyToPropertyList(isolate, info, arraysize(data), data); @@ -694,8 +694,8 @@ Handle ApiNatives::CreateApiFunction( immutable_proto = GetInstanceTemplate->immutable_proto(); } - // JS_FUNCTION_TYPE requires information about the prototype slot. - DCHECK_NE(JS_FUNCTION_TYPE, type); + // JSFunction requires information about the prototype slot. + DCHECK(!InstanceTypeChecker::IsJSFunction(type)); int instance_size = JSObject::GetHeaderSize(type) + kEmbedderDataSlotSize * embedder_field_count; diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index 9b19d155bd80c4..a56b7e1a7d7922 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -34,10 +34,6 @@ #include "src/common/globals.h" #include "src/compiler-dispatcher/compiler-dispatcher.h" #include "src/date/date.h" -#include "src/debug/debug-coverage.h" -#include "src/debug/debug-evaluate.h" -#include "src/debug/debug-type-profile.h" -#include "src/debug/debug.h" #include "src/debug/liveedit.h" #include "src/deoptimizer/deoptimizer.h" #include "src/diagnostics/gdb-jit.h" @@ -68,12 +64,10 @@ #include "src/objects/contexts.h" #include "src/objects/embedder-data-array-inl.h" #include "src/objects/embedder-data-slot-inl.h" -#include "src/objects/frame-array-inl.h" #include "src/objects/hash-table-inl.h" #include "src/objects/heap-object.h" #include "src/objects/js-array-inl.h" #include "src/objects/js-collection-inl.h" -#include "src/objects/js-generator-inl.h" #include "src/objects/js-promise-inl.h" #include "src/objects/js-regexp-inl.h" #include "src/objects/js-weak-refs-inl.h" @@ -139,6 +133,9 @@ #endif // V8_OS_WIN64 #endif // V8_OS_WIN +// Has to be the last include (doesn't have include guards): +#include "src/api/api-macros.h" + #define TRACE_BS(...) \ do { \ if (i::FLAG_trace_backing_store) PrintF(__VA_ARGS__); \ @@ -146,229 +143,6 @@ namespace v8 { -/* - * Most API methods should use one of the three macros: - * - * ENTER_V8, ENTER_V8_NO_SCRIPT, ENTER_V8_NO_SCRIPT_NO_EXCEPTION. - * - * The latter two assume that no script is executed, and no exceptions are - * scheduled in addition (respectively). Creating a pending exception and - * removing it before returning is ok. - * - * Exceptions should be handled either by invoking one of the - * RETURN_ON_FAILED_EXECUTION* macros. - * - * Don't use macros with DO_NOT_USE in their name. - * - * TODO(jochen): Document debugger specific macros. - * TODO(jochen): Document LOG_API and other RuntimeCallStats macros. - * TODO(jochen): All API methods should invoke one of the ENTER_V8* macros. - * TODO(jochen): Remove calls form API methods to DO_NOT_USE macros. - */ - -#define LOG_API(isolate, class_name, function_name) \ - i::RuntimeCallTimerScope _runtime_timer( \ - isolate, i::RuntimeCallCounterId::kAPI_##class_name##_##function_name); \ - LOG(isolate, ApiEntryCall("v8::" #class_name "::" #function_name)) - -#define ENTER_V8_DO_NOT_USE(isolate) i::VMState __state__((isolate)) - -#define ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, \ - function_name, bailout_value, \ - HandleScopeClass, do_callback) \ - if (IsExecutionTerminatingCheck(isolate)) { \ - return bailout_value; \ - } \ - HandleScopeClass handle_scope(isolate); \ - CallDepthScope call_depth_scope(isolate, context); \ - LOG_API(isolate, class_name, function_name); \ - i::VMState __state__((isolate)); \ - bool has_pending_exception = false - -#define PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(isolate, T) \ - if (IsExecutionTerminatingCheck(isolate)) { \ - return MaybeLocal(); \ - } \ - InternalEscapableScope handle_scope(isolate); \ - CallDepthScope call_depth_scope(isolate, v8::Local()); \ - i::VMState __state__((isolate)); \ - bool has_pending_exception = false - -#define PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, class_name, function_name, \ - bailout_value, HandleScopeClass, \ - do_callback) \ - auto isolate = context.IsEmpty() \ - ? i::Isolate::Current() \ - : reinterpret_cast(context->GetIsolate()); \ - ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \ - bailout_value, HandleScopeClass, do_callback); - -#define PREPARE_FOR_EXECUTION(context, class_name, function_name, T) \ - PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, class_name, function_name, \ - MaybeLocal(), InternalEscapableScope, \ - false) - -#define ENTER_V8(isolate, context, class_name, function_name, bailout_value, \ - HandleScopeClass) \ - ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \ - bailout_value, HandleScopeClass, true) - -#ifdef DEBUG -#define ENTER_V8_NO_SCRIPT(isolate, context, class_name, function_name, \ - bailout_value, HandleScopeClass) \ - ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \ - bailout_value, HandleScopeClass, false); \ - i::DisallowJavascriptExecutionDebugOnly __no_script__((isolate)) - -// Lightweight version for APIs that don't require an active context. -#define ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate) \ - i::DisallowJavascriptExecutionDebugOnly __no_script__((isolate)); \ - i::DisallowExceptions __no_exceptions__((isolate)) - -#define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate) \ - i::VMState __state__((isolate)); \ - ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate) - -#define ENTER_V8_FOR_NEW_CONTEXT(isolate) \ - i::VMState __state__((isolate)); \ - i::DisallowExceptions __no_exceptions__((isolate)) -#else -#define ENTER_V8_NO_SCRIPT(isolate, context, class_name, function_name, \ - bailout_value, HandleScopeClass) \ - ENTER_V8_HELPER_DO_NOT_USE(isolate, context, class_name, function_name, \ - bailout_value, HandleScopeClass, false) - -#define ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate) - -#define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate) \ - i::VMState __state__((isolate)); - -#define ENTER_V8_FOR_NEW_CONTEXT(isolate) \ - i::VMState __state__((isolate)); -#endif // DEBUG - -#define EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, value) \ - do { \ - if (has_pending_exception) { \ - call_depth_scope.Escape(); \ - return value; \ - } \ - } while (false) - -#define RETURN_ON_FAILED_EXECUTION(T) \ - EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, MaybeLocal()) - -#define RETURN_ON_FAILED_EXECUTION_PRIMITIVE(T) \ - EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, Nothing()) - -#define RETURN_ESCAPED(value) return handle_scope.Escape(value); - -namespace { - -class V8_NODISCARD InternalEscapableScope : public v8::EscapableHandleScope { - public: - explicit inline InternalEscapableScope(i::Isolate* isolate) - : v8::EscapableHandleScope(reinterpret_cast(isolate)) {} -}; - -// TODO(jochen): This should be #ifdef DEBUG -#ifdef V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY -void CheckMicrotasksScopesConsistency(i::MicrotaskQueue* microtask_queue) { - if (microtask_queue && - microtask_queue->microtasks_policy() == v8::MicrotasksPolicy::kScoped) { - DCHECK(microtask_queue->GetMicrotasksScopeDepth() || - !microtask_queue->DebugMicrotasksScopeDepthIsZero()); - } -} -#endif - -template -class V8_NODISCARD CallDepthScope { - public: - CallDepthScope(i::Isolate* isolate, Local context) - : isolate_(isolate), - context_(context), - escaped_(false), - safe_for_termination_(isolate->next_v8_call_is_safe_for_termination()), - interrupts_scope_(isolate_, i::StackGuard::TERMINATE_EXECUTION, - isolate_->only_terminate_in_safe_scope() - ? (safe_for_termination_ - ? i::InterruptsScope::kRunInterrupts - : i::InterruptsScope::kPostponeInterrupts) - : i::InterruptsScope::kNoop) { - isolate_->thread_local_top()->IncrementCallDepth(this); - isolate_->set_next_v8_call_is_safe_for_termination(false); - if (!context.IsEmpty()) { - i::Handle env = Utils::OpenHandle(*context); - i::HandleScopeImplementer* impl = isolate->handle_scope_implementer(); - if (!isolate->context().is_null() && - isolate->context().native_context() == env->native_context()) { - context_ = Local(); - } else { - impl->SaveContext(isolate->context()); - isolate->set_context(*env); - } - } - if (do_callback) isolate_->FireBeforeCallEnteredCallback(); - } - ~CallDepthScope() { - i::MicrotaskQueue* microtask_queue = isolate_->default_microtask_queue(); - if (!context_.IsEmpty()) { - i::HandleScopeImplementer* impl = isolate_->handle_scope_implementer(); - isolate_->set_context(impl->RestoreContext()); - - i::Handle env = Utils::OpenHandle(*context_); - microtask_queue = env->native_context().microtask_queue(); - } - if (!escaped_) isolate_->thread_local_top()->DecrementCallDepth(this); - if (do_callback) isolate_->FireCallCompletedCallback(microtask_queue); -// TODO(jochen): This should be #ifdef DEBUG -#ifdef V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY - if (do_callback) CheckMicrotasksScopesConsistency(microtask_queue); -#endif - DCHECK(CheckKeptObjectsClearedAfterMicrotaskCheckpoint(microtask_queue)); - isolate_->set_next_v8_call_is_safe_for_termination(safe_for_termination_); - } - - CallDepthScope(const CallDepthScope&) = delete; - CallDepthScope& operator=(const CallDepthScope&) = delete; - - void Escape() { - DCHECK(!escaped_); - escaped_ = true; - auto thread_local_top = isolate_->thread_local_top(); - thread_local_top->DecrementCallDepth(this); - bool clear_exception = thread_local_top->CallDepthIsZero() && - thread_local_top->try_catch_handler_ == nullptr; - isolate_->OptionalRescheduleException(clear_exception); - } - - private: - bool CheckKeptObjectsClearedAfterMicrotaskCheckpoint( - i::MicrotaskQueue* microtask_queue) { - bool did_perform_microtask_checkpoint = - isolate_->thread_local_top()->CallDepthIsZero() && - do_callback && microtask_queue && - microtask_queue->microtasks_policy() == MicrotasksPolicy::kAuto; - return !did_perform_microtask_checkpoint || - isolate_->heap()->weak_refs_keep_during_job().IsUndefined(isolate_); - } - - i::Isolate* const isolate_; - Local context_; - bool escaped_; - bool do_callback_; - bool safe_for_termination_; - i::InterruptsScope interrupts_scope_; - i::Address previous_stack_height_; - - friend class i::ThreadLocalTop; - - DISALLOW_NEW_AND_DELETE() -}; - -} // namespace - static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate, i::Handle script) { i::Handle scriptName(script->GetNameOrSourceURL(), isolate); @@ -377,8 +151,9 @@ static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate, isolate); ScriptOriginOptions options(script->origin_options()); v8::ScriptOrigin origin( - Utils::ToLocal(scriptName), script->line_offset(), - script->column_offset(), options.IsSharedCrossOrigin(), script->id(), + reinterpret_cast(isolate), Utils::ToLocal(scriptName), + script->line_offset(), script->column_offset(), + options.IsSharedCrossOrigin(), script->id(), Utils::ToLocal(source_map_url), options.IsOpaque(), script->type() == i::Script::TYPE_WASM, options.IsModule(), Utils::PrimitiveArrayToLocal(host_defined_options)); @@ -533,14 +308,6 @@ void Utils::ReportOOMFailure(i::Isolate* isolate, const char* location, isolate->SignalFatalError(); } -static inline bool IsExecutionTerminatingCheck(i::Isolate* isolate) { - if (isolate->has_scheduled_exception()) { - return isolate->scheduled_exception() == - i::ReadOnlyRoots(isolate).termination_exception(); - } - return false; -} - void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { i::V8::SetSnapshotBlob(snapshot_blob); } @@ -1182,6 +949,8 @@ bool Data::IsFunctionTemplate() const { return Utils::OpenHandle(this)->IsFunctionTemplateInfo(); } +bool Data::IsContext() const { return Utils::OpenHandle(this)->IsContext(); } + void Context::Enter() { i::Handle env = Utils::OpenHandle(this); i::Isolate* isolate = env->GetIsolate(); @@ -1314,9 +1083,9 @@ void Context::SetAlignedPointerInEmbedderData(int index, void* value) { // --- T e m p l a t e --- -static void InitializeTemplate(i::Handle that, int type) { - that->set_number_of_properties(0); - that->set_tag(type); +static void InitializeTemplate(i::TemplateInfo that, int type) { + that.set_number_of_properties(0); + that.set_tag(type); } void Template::Set(v8::Local name, v8::Local value, @@ -1364,10 +1133,9 @@ void Template::SetAccessorProperty(v8::Local name, } // --- F u n c t i o n T e m p l a t e --- -static void InitializeFunctionTemplate( - i::Handle info) { +static void InitializeFunctionTemplate(i::FunctionTemplateInfo info) { InitializeTemplate(info, Consts::FUNCTION_TEMPLATE); - info->set_flag(0); + info.set_flag(0); } static Local ObjectTemplateNew( @@ -1419,7 +1187,8 @@ void FunctionTemplate::Inherit(v8::Local value) { static Local FunctionTemplateNew( i::Isolate* isolate, FunctionCallback callback, v8::Local data, - v8::Local signature, int length, bool do_not_cache, + v8::Local signature, int length, ConstructorBehavior behavior, + bool do_not_cache, v8::Local cached_property_name = v8::Local(), SideEffectType side_effect_type = SideEffectType::kHasSideEffect, const CFunction* c_function = nullptr) { @@ -1430,29 +1199,31 @@ static Local FunctionTemplateNew( { // Disallow GC until all fields of obj have acceptable types. i::DisallowGarbageCollection no_gc; - InitializeFunctionTemplate(obj); - obj->set_length(length); - obj->set_do_not_cache(do_not_cache); + i::FunctionTemplateInfo raw = *obj; + InitializeFunctionTemplate(raw); + raw.set_length(length); + raw.set_do_not_cache(do_not_cache); int next_serial_number = i::FunctionTemplateInfo::kInvalidSerialNumber; if (!do_not_cache) { next_serial_number = isolate->heap()->GetNextTemplateSerialNumber(); } - obj->set_serial_number(next_serial_number); + raw.set_serial_number(next_serial_number); + raw.set_undetectable(false); + raw.set_needs_access_check(false); + raw.set_accept_any_receiver(true); + if (!signature.IsEmpty()) { + raw.set_signature(*Utils::OpenHandle(*signature)); + } + raw.set_cached_property_name( + cached_property_name.IsEmpty() + ? i::ReadOnlyRoots(isolate).the_hole_value() + : *Utils::OpenHandle(*cached_property_name)); + if (behavior == ConstructorBehavior::kThrow) raw.set_remove_prototype(true); } if (callback != nullptr) { Utils::ToLocal(obj)->SetCallHandler(callback, data, side_effect_type, c_function); } - obj->set_undetectable(false); - obj->set_needs_access_check(false); - obj->set_accept_any_receiver(true); - if (!signature.IsEmpty()) { - obj->set_signature(*Utils::OpenHandle(*signature)); - } - obj->set_cached_property_name( - cached_property_name.IsEmpty() - ? i::ReadOnlyRoots(isolate).the_hole_value() - : *Utils::OpenHandle(*cached_property_name)); return Utils::ToLocal(obj); } @@ -1465,10 +1236,9 @@ Local FunctionTemplate::New( // function templates when the isolate is created for serialization. LOG_API(i_isolate, FunctionTemplate, New); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); - auto templ = - FunctionTemplateNew(i_isolate, callback, data, signature, length, false, - Local(), side_effect_type, c_function); - if (behavior == ConstructorBehavior::kThrow) templ->RemovePrototype(); + auto templ = FunctionTemplateNew(i_isolate, callback, data, signature, length, + behavior, false, Local(), + side_effect_type, c_function); return templ; } @@ -1480,7 +1250,8 @@ Local FunctionTemplate::NewWithCache( LOG_API(i_isolate, FunctionTemplate, NewWithCache); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); return FunctionTemplateNew(i_isolate, callback, data, signature, length, - false, cache_property, side_effect_type); + ConstructorBehavior::kAllow, false, cache_property, + side_effect_type); } Local Signature::New(Isolate* isolate, @@ -1651,16 +1422,18 @@ static Local ObjectTemplateNew( { // Disallow GC until all fields of obj have acceptable types. i::DisallowGarbageCollection no_gc; - InitializeTemplate(obj, Consts::OBJECT_TEMPLATE); + i::ObjectTemplateInfo raw = *obj; + InitializeTemplate(raw, Consts::OBJECT_TEMPLATE); + raw.set_data(0); int next_serial_number = 0; if (!do_not_cache) { next_serial_number = isolate->heap()->GetNextTemplateSerialNumber(); } - obj->set_serial_number(next_serial_number); - obj->set_data(0); + raw.set_serial_number(next_serial_number); + if (!constructor.IsEmpty()) { + raw.set_constructor(*Utils::OpenHandle(*constructor)); + } } - if (!constructor.IsEmpty()) - obj->set_constructor(*Utils::OpenHandle(*constructor)); return Utils::ToLocal(obj); } @@ -3123,11 +2896,9 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) { Local StackTrace::GetFrame(Isolate* v8_isolate, uint32_t index) const { i::Isolate* isolate = reinterpret_cast(v8_isolate); - ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); - EscapableHandleScope scope(v8_isolate); - auto obj = handle(Utils::OpenHandle(this)->get(index), isolate); - auto frame = i::Handle::cast(obj); - return scope.Escape(Utils::StackFrameToLocal(frame)); + i::Handle frame( + i::StackFrameInfo::cast(Utils::OpenHandle(this)->get(index)), isolate); + return Utils::StackFrameToLocal(frame); } int StackTrace::GetFrameCount() const { @@ -3147,65 +2918,50 @@ Local StackTrace::CurrentStackTrace(Isolate* isolate, // --- S t a c k F r a m e --- int StackFrame::GetLineNumber() const { - return i::StackTraceFrame::GetOneBasedLineNumber(Utils::OpenHandle(this)); + return i::StackFrameInfo::GetLineNumber(Utils::OpenHandle(this)); } int StackFrame::GetColumn() const { - return i::StackTraceFrame::GetOneBasedColumnNumber(Utils::OpenHandle(this)); + return i::StackFrameInfo::GetColumnNumber(Utils::OpenHandle(this)); } int StackFrame::GetScriptId() const { - return i::StackTraceFrame::GetScriptId(Utils::OpenHandle(this)); + return Utils::OpenHandle(this)->GetScriptId(); } Local StackFrame::GetScriptName() const { auto self = Utils::OpenHandle(this); - i::Isolate* isolate = self->GetIsolate(); - ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate); - EscapableHandleScope scope(reinterpret_cast(isolate)); - i::Handle name = i::StackTraceFrame::GetFileName(self); - return name->IsString() - ? scope.Escape(Local::Cast(Utils::ToLocal(name))) - : Local(); + auto isolate = self->GetIsolate(); + i::Handle name(self->GetScriptName(), isolate); + if (!name->IsString()) return {}; + return Local::Cast(Utils::ToLocal(name)); } Local StackFrame::GetScriptNameOrSourceURL() const { auto self = Utils::OpenHandle(this); - i::Isolate* isolate = self->GetIsolate(); - ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate); - EscapableHandleScope scope(reinterpret_cast(isolate)); - i::Handle name = - i::StackTraceFrame::GetScriptNameOrSourceUrl(self); - return name->IsString() - ? scope.Escape(Local::Cast(Utils::ToLocal(name))) - : Local(); + auto isolate = self->GetIsolate(); + i::Handle name_or_url(self->GetScriptNameOrSourceURL(), isolate); + if (!name_or_url->IsString()) return {}; + return Local::Cast(Utils::ToLocal(name_or_url)); } Local StackFrame::GetFunctionName() const { auto self = Utils::OpenHandle(this); - i::Isolate* isolate = self->GetIsolate(); - ASSERT_NO_SCRIPT_NO_EXCEPTION(isolate); - EscapableHandleScope scope(reinterpret_cast(isolate)); - i::Handle name = i::StackTraceFrame::GetFunctionName(self); - return name->IsString() - ? scope.Escape(Local::Cast(Utils::ToLocal(name))) - : Local(); + auto name = i::StackFrameInfo::GetFunctionName(self); + if (!name->IsString()) return {}; + return Local::Cast(Utils::ToLocal(name)); } -bool StackFrame::IsEval() const { - return i::StackTraceFrame::IsEval(Utils::OpenHandle(this)); -} +bool StackFrame::IsEval() const { return Utils::OpenHandle(this)->IsEval(); } bool StackFrame::IsConstructor() const { - return i::StackTraceFrame::IsConstructor(Utils::OpenHandle(this)); + return Utils::OpenHandle(this)->IsConstructor(); } -bool StackFrame::IsWasm() const { - return i::StackTraceFrame::IsWasm(Utils::OpenHandle(this)); -} +bool StackFrame::IsWasm() const { return Utils::OpenHandle(this)->IsWasm(); } bool StackFrame::IsUserJavaScript() const { - return i::StackTraceFrame::IsUserJavaScript(Utils::OpenHandle(this)); + return Utils::OpenHandle(this)->IsUserJavaScript(); } // --- J S O N --- @@ -3876,6 +3632,12 @@ void v8::BigInt::CheckCast(v8::Data* that) { "Value is not a BigInt"); } +void v8::Context::CheckCast(v8::Data* that) { + i::Handle obj = Utils::OpenHandle(that); + Utils::ApiCheck(obj->IsContext(), "v8::Context::Cast", + "Value is not a Context"); +} + void v8::Array::CheckCast(Value* that) { i::Handle obj = Utils::OpenHandle(that); Utils::ApiCheck(obj->IsJSArray(), "v8::Array::Cast", "Value is not an Array"); @@ -3915,12 +3677,6 @@ void v8::WasmModuleObject::CheckCast(Value* that) { "Value is not a WasmModuleObject"); } -void v8::debug::AccessorPair::CheckCast(Value* that) { - i::Handle obj = Utils::OpenHandle(that); - Utils::ApiCheck(obj->IsAccessorPair(), "v8::AccessorPair::Cast", - "Value is not a debug::AccessorPair"); -} - v8::BackingStore::~BackingStore() { auto i_this = reinterpret_cast(this); i_this->~BackingStore(); // manually call internal destructor @@ -4954,10 +4710,36 @@ Local v8::Object::Clone() { return Utils::ToLocal(result); } +namespace { +Local CreationContextImpl(i::Handle self) { + i::Handle context; + if (self->GetCreationContext().ToHandle(&context)) { + return Utils::ToLocal(context); + } + + return Local(); +} +} // namespace + Local v8::Object::CreationContext() { auto self = Utils::OpenHandle(this); - i::Handle context = self->GetCreationContext(); - return Utils::ToLocal(context); + return CreationContextImpl(self); +} + +Local v8::Object::CreationContext( + const PersistentBase& object) { + auto self = Utils::OpenHandle(object.val_); + return CreationContextImpl(self); +} + +MaybeLocal v8::Object::GetCreationContext() { + auto self = Utils::OpenHandle(this); + i::Handle context; + if (self->GetCreationContext().ToHandle(&context)) { + return Utils::ToLocal(context); + } + + return MaybeLocal(); } int v8::Object::GetIdentityHash() { @@ -5034,8 +4816,7 @@ MaybeLocal Function::New(Local context, ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); auto templ = FunctionTemplateNew(isolate, callback, data, Local(), length, - true, Local(), side_effect_type); - if (behavior == ConstructorBehavior::kThrow) templ->RemovePrototype(); + behavior, true, Local(), side_effect_type); return templ->GetFunction(context); } @@ -5172,7 +4953,7 @@ Local Function::GetDisplayName() const { } auto func = i::Handle::cast(self); i::Handle property_name = - isolate->factory()->display_name_string(); + isolate->factory()->InternalizeString(i::StaticCharVector("displayName")); i::Handle value = i::JSReceiver::GetDataProperty(func, property_name); if (value->IsString()) { @@ -5184,14 +4965,15 @@ Local Function::GetDisplayName() const { ScriptOrigin Function::GetScriptOrigin() const { auto self = Utils::OpenHandle(this); - if (!self->IsJSFunction()) return v8::ScriptOrigin(Local()); + auto isolate = reinterpret_cast(self->GetIsolate()); + if (!self->IsJSFunction()) return v8::ScriptOrigin(isolate, Local()); auto func = i::Handle::cast(self); if (func->shared().script().IsScript()) { i::Handle script(i::Script::cast(func->shared().script()), func->GetIsolate()); return GetScriptOriginForScript(func->GetIsolate(), script); } - return v8::ScriptOrigin(Local()); + return v8::ScriptOrigin(isolate, Local()); } const int Function::kLineOffsetNotFound = -1; @@ -5671,6 +5453,24 @@ String::ExternalStringResource* String::GetExternalStringResourceSlow() const { return nullptr; } +void String::ExternalStringResource::UpdateDataCache() { + DCHECK(IsCacheable()); + cached_data_ = data(); +} + +void String::ExternalStringResource::CheckCachedDataInvariants() const { + DCHECK(IsCacheable() && cached_data_ != nullptr); +} + +void String::ExternalOneByteStringResource::UpdateDataCache() { + DCHECK(IsCacheable()); + cached_data_ = data(); +} + +void String::ExternalOneByteStringResource::CheckCachedDataInvariants() const { + DCHECK(IsCacheable() && cached_data_ != nullptr); +} + String::ExternalStringResourceBase* String::GetExternalStringResourceBaseSlow( String::Encoding* encoding_out) const { i::DisallowGarbageCollection no_gc; @@ -5897,7 +5697,13 @@ bool v8::V8::Initialize(const int build_config) { #if V8_OS_LINUX || V8_OS_MACOSX bool TryHandleWebAssemblyTrapPosix(int sig_code, siginfo_t* info, void* context) { -#if V8_TARGET_ARCH_X64 && !V8_OS_ANDROID + // When the target code runs on the V8 arm simulator, the trap handler does + // not behave as expected: the instruction pointer points inside the simulator + // code rather than the wasm code, so the trap handler cannot find the landing + // pad and lets the process crash. Therefore, only enable trap handlers if + // the host and target arch are the same. +#if (V8_TARGET_ARCH_X64 && !V8_OS_ANDROID) || \ + (V8_HOST_ARCH_ARM64 && V8_TARGET_ARCH_ARM64 && V8_OS_MACOSX) return i::trap_handler::TryHandleSignal(sig_code, info, context); #else return false; @@ -7018,6 +6824,7 @@ REGEXP_FLAG_ASSERT_EQ(kIgnoreCase); REGEXP_FLAG_ASSERT_EQ(kMultiline); REGEXP_FLAG_ASSERT_EQ(kSticky); REGEXP_FLAG_ASSERT_EQ(kUnicode); +REGEXP_FLAG_ASSERT_EQ(kHasIndices); REGEXP_FLAG_ASSERT_EQ(kLinear); #undef REGEXP_FLAG_ASSERT_EQ @@ -8442,6 +8249,16 @@ EmbedderHeapTracer* Isolate::GetEmbedderHeapTracer() { return isolate->heap()->GetEmbedderHeapTracer(); } +void Isolate::AttachCppHeap(CppHeap* cpp_heap) { + i::Isolate* isolate = reinterpret_cast(this); + isolate->heap()->AttachCppHeap(cpp_heap); +} + +void Isolate::DetachCppHeap() { + i::Isolate* isolate = reinterpret_cast(this); + isolate->heap()->DetachCppHeap(); +} + CppHeap* Isolate::GetCppHeap() const { const i::Isolate* isolate = reinterpret_cast(this); return isolate->heap()->cpp_heap(); @@ -8553,13 +8370,7 @@ void Isolate::Initialize(Isolate* isolate, i_isolate->set_api_external_references(params.external_references); i_isolate->set_allow_atomics_wait(params.allow_atomics_wait); - i_isolate->set_supported_import_assertions( - params.supported_import_assertions); - i_isolate->heap()->ConfigureHeap(params.constraints); - if (params.cpp_heap_params) { - i_isolate->heap()->ConfigureCppHeap(params.cpp_heap_params); - } if (params.constraints.stack_limit() != nullptr) { uintptr_t limit = reinterpret_cast(params.constraints.stack_limit()); @@ -8641,7 +8452,13 @@ void Isolate::SetAbortOnUncaughtExceptionCallback( } void Isolate::SetHostImportModuleDynamicallyCallback( - HostImportModuleDynamicallyCallback callback) { + i::Isolate::DeprecatedHostImportModuleDynamicallyCallback callback) { + i::Isolate* isolate = reinterpret_cast(this); + isolate->SetHostImportModuleDynamicallyCallback(callback); +} + +void Isolate::SetHostImportModuleDynamicallyCallback( + HostImportModuleDynamicallyWithImportAssertionsCallback callback) { i::Isolate* isolate = reinterpret_cast(this); isolate->SetHostImportModuleDynamicallyCallback(callback); } @@ -8660,21 +8477,20 @@ void Isolate::SetPrepareStackTraceCallback(PrepareStackTraceCallback callback) { Isolate::DisallowJavascriptExecutionScope::DisallowJavascriptExecutionScope( Isolate* isolate, Isolate::DisallowJavascriptExecutionScope::OnFailure on_failure) - : on_failure_(on_failure) { + : on_failure_(on_failure), isolate_(isolate) { i::Isolate* i_isolate = reinterpret_cast(isolate); switch (on_failure_) { case CRASH_ON_FAILURE: - internal_ = reinterpret_cast( - new i::DisallowJavascriptExecution(i_isolate)); + i::DisallowJavascriptExecution::Open(i_isolate, + &was_execution_allowed_assert_); break; case THROW_ON_FAILURE: - DCHECK_EQ(THROW_ON_FAILURE, on_failure); - internal_ = - reinterpret_cast(new i::ThrowOnJavascriptExecution(i_isolate)); + i::ThrowOnJavascriptExecution::Open(i_isolate, + &was_execution_allowed_throws_); break; case DUMP_ON_FAILURE: - internal_ = - reinterpret_cast(new i::DumpOnJavascriptExecution(i_isolate)); + i::DumpOnJavascriptExecution::Open(i_isolate, + &was_execution_allowed_dump_); break; default: UNREACHABLE(); @@ -8682,15 +8498,19 @@ Isolate::DisallowJavascriptExecutionScope::DisallowJavascriptExecutionScope( } Isolate::DisallowJavascriptExecutionScope::~DisallowJavascriptExecutionScope() { + i::Isolate* i_isolate = reinterpret_cast(isolate_); switch (on_failure_) { case CRASH_ON_FAILURE: - delete reinterpret_cast(internal_); + i::DisallowJavascriptExecution::Close(i_isolate, + was_execution_allowed_assert_); break; case THROW_ON_FAILURE: - delete reinterpret_cast(internal_); + i::ThrowOnJavascriptExecution::Close(i_isolate, + was_execution_allowed_throws_); break; case DUMP_ON_FAILURE: - delete reinterpret_cast(internal_); + i::DumpOnJavascriptExecution::Close(i_isolate, + was_execution_allowed_dump_); break; default: UNREACHABLE(); @@ -8698,20 +8518,21 @@ Isolate::DisallowJavascriptExecutionScope::~DisallowJavascriptExecutionScope() { } Isolate::AllowJavascriptExecutionScope::AllowJavascriptExecutionScope( - Isolate* isolate) { + Isolate* isolate) + : isolate_(isolate) { i::Isolate* i_isolate = reinterpret_cast(isolate); - internal_assert_ = - reinterpret_cast(new i::AllowJavascriptExecution(i_isolate)); - internal_throws_ = - reinterpret_cast(new i::NoThrowOnJavascriptExecution(i_isolate)); - internal_dump_ = - reinterpret_cast(new i::NoDumpOnJavascriptExecution(i_isolate)); + i::AllowJavascriptExecution::Open(i_isolate, &was_execution_allowed_assert_); + i::NoThrowOnJavascriptExecution::Open(i_isolate, + &was_execution_allowed_throws_); + i::NoDumpOnJavascriptExecution::Open(i_isolate, &was_execution_allowed_dump_); } Isolate::AllowJavascriptExecutionScope::~AllowJavascriptExecutionScope() { - delete reinterpret_cast(internal_assert_); - delete reinterpret_cast(internal_throws_); - delete reinterpret_cast(internal_dump_); + i::Isolate* i_isolate = reinterpret_cast(isolate_); + i::AllowJavascriptExecution::Close(i_isolate, was_execution_allowed_assert_); + i::NoThrowOnJavascriptExecution::Close(i_isolate, + was_execution_allowed_throws_); + i::NoDumpOnJavascriptExecution::Close(i_isolate, was_execution_allowed_dump_); } Isolate::SuppressMicrotaskExecutionScope::SuppressMicrotaskExecutionScope( @@ -9249,15 +9070,15 @@ CALLBACK_SETTER(WasmInstanceCallback, ExtensionCallback, wasm_instance_callback) CALLBACK_SETTER(WasmStreamingCallback, WasmStreamingCallback, wasm_streaming_callback) -CALLBACK_SETTER(WasmThreadsEnabledCallback, WasmThreadsEnabledCallback, - wasm_threads_enabled_callback) - CALLBACK_SETTER(WasmLoadSourceMapCallback, WasmLoadSourceMapCallback, wasm_load_source_map_callback) CALLBACK_SETTER(WasmSimdEnabledCallback, WasmSimdEnabledCallback, wasm_simd_enabled_callback) +CALLBACK_SETTER(WasmExceptionsEnabledCallback, WasmExceptionsEnabledCallback, + wasm_exceptions_enabled_callback) + void Isolate::AddNearHeapLimitCallback(v8::NearHeapLimitCallback callback, void* data) { i::Isolate* isolate = reinterpret_cast(this); @@ -9538,1258 +9359,148 @@ Local Exception::GetStackTrace(Local exception) { return Utils::StackTraceToLocal(isolate->GetDetailedStackTrace(js_obj)); } -// --- D e b u g S u p p o r t --- +v8::MaybeLocal v8::Object::PreviewEntries(bool* is_key_value) { + if (IsMap()) { + *is_key_value = true; + return Map::Cast(this)->AsArray(); + } + if (IsSet()) { + *is_key_value = false; + return Set::Cast(this)->AsArray(); + } -void debug::SetContextId(Local context, int id) { - Utils::OpenHandle(*context)->set_debug_context_id(i::Smi::FromInt(id)); + i::Handle object = Utils::OpenHandle(this); + i::Isolate* isolate = object->GetIsolate(); + Isolate* v8_isolate = reinterpret_cast(isolate); + ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); + if (object->IsJSWeakCollection()) { + *is_key_value = object->IsJSWeakMap(); + return Utils::ToLocal(i::JSWeakCollection::GetEntries( + i::Handle::cast(object), 0)); + } + if (object->IsJSMapIterator()) { + i::Handle it = i::Handle::cast(object); + MapAsArrayKind const kind = + static_cast(it->map().instance_type()); + *is_key_value = kind == MapAsArrayKind::kEntries; + if (!it->HasMore()) return v8::Array::New(v8_isolate); + return Utils::ToLocal( + MapAsArray(isolate, it->table(), i::Smi::ToInt(it->index()), kind)); + } + if (object->IsJSSetIterator()) { + i::Handle it = i::Handle::cast(object); + SetAsArrayKind const kind = + static_cast(it->map().instance_type()); + *is_key_value = kind == SetAsArrayKind::kEntries; + if (!it->HasMore()) return v8::Array::New(v8_isolate); + return Utils::ToLocal( + SetAsArray(isolate, it->table(), i::Smi::ToInt(it->index()), kind)); + } + return v8::MaybeLocal(); } -int debug::GetContextId(Local context) { - i::Object value = Utils::OpenHandle(*context)->debug_context_id(); - return (value.IsSmi()) ? i::Smi::ToInt(value) : 0; +Local CpuProfileNode::GetFunctionName() const { + const i::ProfileNode* node = reinterpret_cast(this); + i::Isolate* isolate = node->isolate(); + const i::CodeEntry* entry = node->entry(); + i::Handle name = + isolate->factory()->InternalizeUtf8String(entry->name()); + return ToApiHandle(name); } -void debug::SetInspector(Isolate* isolate, - v8_inspector::V8Inspector* inspector) { - i::Isolate* i_isolate = reinterpret_cast(isolate); - i_isolate->set_inspector(inspector); +const char* CpuProfileNode::GetFunctionNameStr() const { + const i::ProfileNode* node = reinterpret_cast(this); + return node->entry()->name(); } -v8_inspector::V8Inspector* debug::GetInspector(Isolate* isolate) { - return reinterpret_cast(isolate)->inspector(); +int CpuProfileNode::GetScriptId() const { + const i::ProfileNode* node = reinterpret_cast(this); + const i::CodeEntry* entry = node->entry(); + return entry->script_id(); } -void debug::SetBreakOnNextFunctionCall(Isolate* isolate) { - reinterpret_cast(isolate)->debug()->SetBreakOnNextFunctionCall(); +Local CpuProfileNode::GetScriptResourceName() const { + const i::ProfileNode* node = reinterpret_cast(this); + i::Isolate* isolate = node->isolate(); + return ToApiHandle(isolate->factory()->InternalizeUtf8String( + node->entry()->resource_name())); } -void debug::ClearBreakOnNextFunctionCall(Isolate* isolate) { - reinterpret_cast(isolate) - ->debug() - ->ClearBreakOnNextFunctionCall(); +const char* CpuProfileNode::GetScriptResourceNameStr() const { + const i::ProfileNode* node = reinterpret_cast(this); + return node->entry()->resource_name(); } -MaybeLocal debug::GetInternalProperties(Isolate* v8_isolate, - Local value) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); - ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); - i::Handle val = Utils::OpenHandle(*value); - i::Handle result; - if (!i::Runtime::GetInternalProperties(isolate, val).ToHandle(&result)) - return MaybeLocal(); - return Utils::ToLocal(result); +bool CpuProfileNode::IsScriptSharedCrossOrigin() const { + const i::ProfileNode* node = reinterpret_cast(this); + return node->entry()->is_shared_cross_origin(); } -namespace { -void CollectPrivateMethodsAndAccessorsFromContext( - i::Isolate* isolate, i::Handle context, - i::IsStaticFlag is_static_flag, std::vector>* names_out, - std::vector>* values_out) { - i::Handle scope_info(context->scope_info(), isolate); - int local_count = scope_info->ContextLocalCount(); - for (int j = 0; j < local_count; ++j) { - i::VariableMode mode = scope_info->ContextLocalMode(j); - i::IsStaticFlag flag = scope_info->ContextLocalIsStaticFlag(j); - if (!i::IsPrivateMethodOrAccessorVariableMode(mode) || - flag != is_static_flag) { - continue; - } - - i::Handle name(scope_info->ContextLocalName(j), isolate); - int context_index = scope_info->ContextHeaderLength() + j; - i::Handle slot_value(context->get(context_index), isolate); - DCHECK_IMPLIES(mode == i::VariableMode::kPrivateMethod, - slot_value->IsJSFunction()); - DCHECK_IMPLIES(mode != i::VariableMode::kPrivateMethod, - slot_value->IsAccessorPair()); - names_out->push_back(Utils::ToLocal(name)); - values_out->push_back(Utils::ToLocal(slot_value)); - } +int CpuProfileNode::GetLineNumber() const { + return reinterpret_cast(this)->line_number(); } -} // anonymous namespace - -bool debug::GetPrivateMembers(Local context, Local value, - std::vector>* names_out, - std::vector>* values_out) { - i::Isolate* isolate = reinterpret_cast(context->GetIsolate()); - LOG_API(isolate, debug, GetPrivateMembers); - ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); - i::Handle receiver = Utils::OpenHandle(*value); - i::Handle names; - i::Handle values; - - i::PropertyFilter key_filter = - static_cast(i::PropertyFilter::PRIVATE_NAMES_ONLY); - i::Handle keys; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, keys, - i::KeyAccumulator::GetKeys(receiver, i::KeyCollectionMode::kOwnOnly, - key_filter, - i::GetKeysConversion::kConvertToString), - false); - - // Estimate number of private fields and private instance methods/accessors. - int private_entries_count = 0; - for (int i = 0; i < keys->length(); ++i) { - // Exclude the private brand symbols. - i::Handle key(i::Symbol::cast(keys->get(i)), isolate); - if (key->is_private_brand()) { - i::Handle value; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, value, i::Object::GetProperty(isolate, receiver, key), - false); - - i::Handle context(i::Context::cast(*value), isolate); - i::Handle scope_info(context->scope_info(), isolate); - // At least one slot contains the brand symbol so it does not count. - private_entries_count += (scope_info->ContextLocalCount() - 1); - } else { - private_entries_count++; - } - } - - // Estimate number of static private methods/accessors for classes. - bool has_static_private_methods_or_accessors = false; - if (receiver->IsJSFunction()) { - i::Handle func(i::JSFunction::cast(*receiver), isolate); - i::Handle shared(func->shared(), isolate); - if (shared->is_class_constructor() && - shared->has_static_private_methods_or_accessors()) { - has_static_private_methods_or_accessors = true; - i::Handle context(func->context(), isolate); - i::Handle scope_info(context->scope_info(), isolate); - int local_count = scope_info->ContextLocalCount(); - for (int j = 0; j < local_count; ++j) { - i::VariableMode mode = scope_info->ContextLocalMode(j); - i::IsStaticFlag is_static_flag = - scope_info->ContextLocalIsStaticFlag(j); - if (i::IsPrivateMethodOrAccessorVariableMode(mode) && - is_static_flag == i::IsStaticFlag::kStatic) { - private_entries_count += local_count; - break; - } - } - } - } - - DCHECK(names_out->empty()); - names_out->reserve(private_entries_count); - DCHECK(values_out->empty()); - values_out->reserve(private_entries_count); - - if (has_static_private_methods_or_accessors) { - i::Handle context(i::JSFunction::cast(*receiver).context(), - isolate); - CollectPrivateMethodsAndAccessorsFromContext( - isolate, context, i::IsStaticFlag::kStatic, names_out, values_out); - } - - for (int i = 0; i < keys->length(); ++i) { - i::Handle obj_key(keys->get(i), isolate); - i::Handle key(i::Symbol::cast(*obj_key), isolate); - CHECK(key->is_private_name()); - i::Handle value; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, value, i::Object::GetProperty(isolate, receiver, key), false); - - if (key->is_private_brand()) { - DCHECK(value->IsContext()); - i::Handle context(i::Context::cast(*value), isolate); - CollectPrivateMethodsAndAccessorsFromContext( - isolate, context, i::IsStaticFlag::kNotStatic, names_out, values_out); - } else { // Private fields - i::Handle name( - i::String::cast(i::Symbol::cast(*key).description()), isolate); - names_out->push_back(Utils::ToLocal(name)); - values_out->push_back(Utils::ToLocal(value)); - } - } - DCHECK_EQ(names_out->size(), values_out->size()); - DCHECK_LE(names_out->size(), private_entries_count); - return true; +int CpuProfileNode::GetColumnNumber() const { + return reinterpret_cast(this) + ->entry() + ->column_number(); } -Local debug::GetCreationContext(Local value) { - i::Handle val = Utils::OpenHandle(*value); - if (val->IsJSGlobalProxy()) { - return Local(); - } - return value->CreationContext(); +unsigned int CpuProfileNode::GetHitLineCount() const { + const i::ProfileNode* node = reinterpret_cast(this); + return node->GetHitLineCount(); } -void debug::ChangeBreakOnException(Isolate* isolate, ExceptionBreakState type) { - i::Isolate* internal_isolate = reinterpret_cast(isolate); - internal_isolate->debug()->ChangeBreakOnException( - i::BreakException, type == BreakOnAnyException); - internal_isolate->debug()->ChangeBreakOnException(i::BreakUncaughtException, - type != NoBreakOnException); +bool CpuProfileNode::GetLineTicks(LineTick* entries, + unsigned int length) const { + const i::ProfileNode* node = reinterpret_cast(this); + return node->GetLineTicks(entries, length); } -void debug::SetBreakPointsActive(Isolate* v8_isolate, bool is_active) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); - ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); - isolate->debug()->set_break_points_active(is_active); +const char* CpuProfileNode::GetBailoutReason() const { + const i::ProfileNode* node = reinterpret_cast(this); + return node->entry()->bailout_reason(); } -void debug::PrepareStep(Isolate* v8_isolate, StepAction action) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); - ENTER_V8_DO_NOT_USE(isolate); - CHECK(isolate->debug()->CheckExecutionState()); - // Clear all current stepping setup. - isolate->debug()->ClearStepping(); - // Prepare step. - isolate->debug()->PrepareStep(static_cast(action)); +unsigned CpuProfileNode::GetHitCount() const { + return reinterpret_cast(this)->self_ticks(); } -void debug::ClearStepping(Isolate* v8_isolate) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); - ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); - // Clear all current stepping setup. - isolate->debug()->ClearStepping(); +unsigned CpuProfileNode::GetNodeId() const { + return reinterpret_cast(this)->id(); } -void debug::BreakRightNow(Isolate* v8_isolate) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); - ENTER_V8_DO_NOT_USE(isolate); - isolate->debug()->HandleDebugBreak(i::kIgnoreIfAllFramesBlackboxed); +CpuProfileNode::SourceType CpuProfileNode::GetSourceType() const { + return reinterpret_cast(this)->source_type(); } -void debug::SetTerminateOnResume(Isolate* v8_isolate) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); - ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); - isolate->debug()->SetTerminateOnResume(); +int CpuProfileNode::GetChildrenCount() const { + return static_cast( + reinterpret_cast(this)->children()->size()); } -bool debug::CanBreakProgram(Isolate* v8_isolate) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); - ENTER_V8_DO_NOT_USE(isolate); - // We cannot break a program if we are currently running a regexp. - // TODO(yangguo): fix this exception. - return !isolate->regexp_stack()->is_in_use() && - isolate->debug()->AllFramesOnStackAreBlackboxed(); +const CpuProfileNode* CpuProfileNode::GetChild(int index) const { + const i::ProfileNode* child = + reinterpret_cast(this)->children()->at(index); + return reinterpret_cast(child); } -v8::Isolate* debug::Script::GetIsolate() const { - return reinterpret_cast(Utils::OpenHandle(this)->GetIsolate()); +const CpuProfileNode* CpuProfileNode::GetParent() const { + const i::ProfileNode* parent = + reinterpret_cast(this)->parent(); + return reinterpret_cast(parent); } -ScriptOriginOptions debug::Script::OriginOptions() const { - return Utils::OpenHandle(this)->origin_options(); +const std::vector& CpuProfileNode::GetDeoptInfos() const { + const i::ProfileNode* node = reinterpret_cast(this); + return node->deopt_infos(); } -bool debug::Script::WasCompiled() const { - return Utils::OpenHandle(this)->compilation_state() == - i::Script::COMPILATION_STATE_COMPILED; -} - -bool debug::Script::IsEmbedded() const { - i::Handle script = Utils::OpenHandle(this); - return script->context_data() == - script->GetReadOnlyRoots().uninitialized_symbol(); -} - -int debug::Script::Id() const { return Utils::OpenHandle(this)->id(); } - -int debug::Script::LineOffset() const { - return Utils::OpenHandle(this)->line_offset(); -} - -int debug::Script::ColumnOffset() const { - return Utils::OpenHandle(this)->column_offset(); -} - -std::vector debug::Script::LineEnds() const { - i::Handle script = Utils::OpenHandle(this); - if (script->type() == i::Script::TYPE_WASM) return std::vector(); - - i::Isolate* isolate = script->GetIsolate(); - i::HandleScope scope(isolate); - i::Script::InitLineEnds(isolate, script); - CHECK(script->line_ends().IsFixedArray()); - i::Handle line_ends(i::FixedArray::cast(script->line_ends()), - isolate); - std::vector result(line_ends->length()); - for (int i = 0; i < line_ends->length(); ++i) { - i::Smi line_end = i::Smi::cast(line_ends->get(i)); - result[i] = line_end.value(); - } - return result; -} - -MaybeLocal debug::Script::Name() const { - i::Handle script = Utils::OpenHandle(this); - i::Isolate* isolate = script->GetIsolate(); - i::HandleScope handle_scope(isolate); - i::Handle value(script->name(), isolate); - if (!value->IsString()) return MaybeLocal(); - return Utils::ToLocal( - handle_scope.CloseAndEscape(i::Handle::cast(value))); -} - -MaybeLocal debug::Script::SourceURL() const { - i::Handle script = Utils::OpenHandle(this); - i::Isolate* isolate = script->GetIsolate(); - i::HandleScope handle_scope(isolate); - i::Handle value(script->source_url(), isolate); - if (!value->IsString()) return MaybeLocal(); - return Utils::ToLocal( - handle_scope.CloseAndEscape(i::Handle::cast(value))); -} - -MaybeLocal debug::Script::SourceMappingURL() const { - i::Handle script = Utils::OpenHandle(this); - i::Isolate* isolate = script->GetIsolate(); - i::HandleScope handle_scope(isolate); - i::Handle value(script->source_mapping_url(), isolate); - if (!value->IsString()) return MaybeLocal(); - return Utils::ToLocal( - handle_scope.CloseAndEscape(i::Handle::cast(value))); -} - -Maybe debug::Script::ContextId() const { - i::Handle script = Utils::OpenHandle(this); - i::Isolate* isolate = script->GetIsolate(); - i::HandleScope handle_scope(isolate); - i::Object value = script->context_data(); - if (value.IsSmi()) return Just(i::Smi::ToInt(value)); - return Nothing(); -} - -MaybeLocal debug::Script::Source() const { - i::Handle script = Utils::OpenHandle(this); - i::Isolate* isolate = script->GetIsolate(); - i::HandleScope handle_scope(isolate); - i::Handle value(script->source(), isolate); - if (!value->IsString()) return MaybeLocal(); - return Utils::ToLocal( - handle_scope.CloseAndEscape(i::Handle::cast(value))); -} - -bool debug::Script::IsWasm() const { - return Utils::OpenHandle(this)->type() == i::Script::TYPE_WASM; -} - -bool debug::Script::IsModule() const { - return Utils::OpenHandle(this)->origin_options().IsModule(); -} - -namespace { -int GetSmiValue(i::Handle array, int index) { - return i::Smi::ToInt(array->get(index)); -} - -bool CompareBreakLocation(const i::BreakLocation& loc1, - const i::BreakLocation& loc2) { - return loc1.position() < loc2.position(); -} -} // namespace - -bool debug::Script::GetPossibleBreakpoints( - const debug::Location& start, const debug::Location& end, - bool restrict_to_function, - std::vector* locations) const { - CHECK(!start.IsEmpty()); - i::Handle script = Utils::OpenHandle(this); - if (script->type() == i::Script::TYPE_WASM) { - i::wasm::NativeModule* native_module = script->wasm_native_module(); - return i::WasmScript::GetPossibleBreakpoints(native_module, start, end, - locations); - } - - i::Isolate* isolate = script->GetIsolate(); - i::Script::InitLineEnds(isolate, script); - CHECK(script->line_ends().IsFixedArray()); - i::Handle line_ends = - i::Handle::cast(i::handle(script->line_ends(), isolate)); - CHECK(line_ends->length()); - - int start_offset = GetSourceOffset(start); - int end_offset = end.IsEmpty() - ? GetSmiValue(line_ends, line_ends->length() - 1) + 1 - : GetSourceOffset(end); - if (start_offset >= end_offset) return true; - - std::vector v8_locations; - if (!isolate->debug()->GetPossibleBreakpoints( - script, start_offset, end_offset, restrict_to_function, - &v8_locations)) { - return false; - } - - std::sort(v8_locations.begin(), v8_locations.end(), CompareBreakLocation); - int current_line_end_index = 0; - for (const auto& v8_location : v8_locations) { - int offset = v8_location.position(); - while (offset > GetSmiValue(line_ends, current_line_end_index)) { - ++current_line_end_index; - CHECK(current_line_end_index < line_ends->length()); - } - int line_offset = 0; - - if (current_line_end_index > 0) { - line_offset = GetSmiValue(line_ends, current_line_end_index - 1) + 1; - } - locations->emplace_back( - current_line_end_index + script->line_offset(), - offset - line_offset + - (current_line_end_index == 0 ? script->column_offset() : 0), - v8_location.type()); - } - return true; -} - -int debug::Script::GetSourceOffset(const debug::Location& location) const { - i::Handle script = Utils::OpenHandle(this); - if (script->type() == i::Script::TYPE_WASM) { - DCHECK_EQ(0, location.GetLineNumber()); - return location.GetColumnNumber(); - } - - int line = std::max(location.GetLineNumber() - script->line_offset(), 0); - int column = location.GetColumnNumber(); - if (line == 0) { - column = std::max(0, column - script->column_offset()); - } - - i::Script::InitLineEnds(script->GetIsolate(), script); - CHECK(script->line_ends().IsFixedArray()); - i::Handle line_ends = i::Handle::cast( - i::handle(script->line_ends(), script->GetIsolate())); - CHECK(line_ends->length()); - if (line >= line_ends->length()) - return GetSmiValue(line_ends, line_ends->length() - 1); - int line_offset = GetSmiValue(line_ends, line); - if (line == 0) return std::min(column, line_offset); - int prev_line_offset = GetSmiValue(line_ends, line - 1); - return std::min(prev_line_offset + column + 1, line_offset); -} - -v8::debug::Location debug::Script::GetSourceLocation(int offset) const { - i::Handle script = Utils::OpenHandle(this); - i::Script::PositionInfo info; - i::Script::GetPositionInfo(script, offset, &info, i::Script::WITH_OFFSET); - return debug::Location(info.line, info.column); -} - -bool debug::Script::SetScriptSource(v8::Local newSource, - bool preview, - debug::LiveEditResult* result) const { - i::Handle script = Utils::OpenHandle(this); - i::Isolate* isolate = script->GetIsolate(); - return isolate->debug()->SetScriptSource( - script, Utils::OpenHandle(*newSource), preview, result); -} - -bool debug::Script::SetBreakpoint(v8::Local condition, - debug::Location* location, - debug::BreakpointId* id) const { - i::Handle script = Utils::OpenHandle(this); - i::Isolate* isolate = script->GetIsolate(); - int offset = GetSourceOffset(*location); - if (!isolate->debug()->SetBreakPointForScript( - script, Utils::OpenHandle(*condition), &offset, id)) { - return false; - } - *location = GetSourceLocation(offset); - return true; -} - -bool debug::Script::SetBreakpointOnScriptEntry(BreakpointId* id) const { - i::Handle script = Utils::OpenHandle(this); - i::Isolate* isolate = script->GetIsolate(); - i::SharedFunctionInfo::ScriptIterator it(isolate, *script); - for (i::SharedFunctionInfo sfi = it.Next(); !sfi.is_null(); sfi = it.Next()) { - if (sfi.is_toplevel()) { - return isolate->debug()->SetBreakpointForFunction( - handle(sfi, isolate), isolate->factory()->empty_string(), id); - } - } - return false; -} - -void debug::Script::RemoveWasmBreakpoint(debug::BreakpointId id) { - i::Handle script = Utils::OpenHandle(this); - i::Isolate* isolate = script->GetIsolate(); - isolate->debug()->RemoveBreakpointForWasmScript(script, id); -} - -void debug::RemoveBreakpoint(Isolate* v8_isolate, BreakpointId id) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); - i::HandleScope handle_scope(isolate); - isolate->debug()->RemoveBreakpoint(id); -} - -v8::Platform* debug::GetCurrentPlatform() { - return i::V8::GetCurrentPlatform(); -} - -void debug::ForceGarbageCollection( - v8::Isolate* isolate, - v8::EmbedderHeapTracer::EmbedderStackState embedder_stack_state) { - i::Heap* heap = reinterpret_cast(isolate)->heap(); - heap->SetEmbedderStackStateForNextFinalization(embedder_stack_state); - isolate->LowMemoryNotification(); -} - -debug::WasmScript* debug::WasmScript::Cast(debug::Script* script) { - CHECK(script->IsWasm()); - return static_cast(script); -} - -debug::WasmScript::DebugSymbolsType debug::WasmScript::GetDebugSymbolType() - const { - i::Handle script = Utils::OpenHandle(this); - DCHECK_EQ(i::Script::TYPE_WASM, script->type()); - switch (script->wasm_native_module()->module()->debug_symbols.type) { - case i::wasm::WasmDebugSymbols::Type::None: - return debug::WasmScript::DebugSymbolsType::None; - case i::wasm::WasmDebugSymbols::Type::EmbeddedDWARF: - return debug::WasmScript::DebugSymbolsType::EmbeddedDWARF; - case i::wasm::WasmDebugSymbols::Type::ExternalDWARF: - return debug::WasmScript::DebugSymbolsType::ExternalDWARF; - case i::wasm::WasmDebugSymbols::Type::SourceMap: - return debug::WasmScript::DebugSymbolsType::SourceMap; - } -} - -MemorySpan debug::WasmScript::ExternalSymbolsURL() const { - i::Handle script = Utils::OpenHandle(this); - DCHECK_EQ(i::Script::TYPE_WASM, script->type()); - - const i::wasm::WasmDebugSymbols& symbols = - script->wasm_native_module()->module()->debug_symbols; - if (symbols.external_url.is_empty()) return {}; - - internal::wasm::ModuleWireBytes wire_bytes( - script->wasm_native_module()->wire_bytes()); - i::wasm::WasmName external_url = - wire_bytes.GetNameOrNull(symbols.external_url); - return {external_url.data(), external_url.size()}; -} - -int debug::WasmScript::NumFunctions() const { - i::DisallowGarbageCollection no_gc; - i::Handle script = Utils::OpenHandle(this); - DCHECK_EQ(i::Script::TYPE_WASM, script->type()); - i::wasm::NativeModule* native_module = script->wasm_native_module(); - const i::wasm::WasmModule* module = native_module->module(); - DCHECK_GE(i::kMaxInt, module->functions.size()); - return static_cast(module->functions.size()); -} - -int debug::WasmScript::NumImportedFunctions() const { - i::DisallowGarbageCollection no_gc; - i::Handle script = Utils::OpenHandle(this); - DCHECK_EQ(i::Script::TYPE_WASM, script->type()); - i::wasm::NativeModule* native_module = script->wasm_native_module(); - const i::wasm::WasmModule* module = native_module->module(); - DCHECK_GE(i::kMaxInt, module->num_imported_functions); - return static_cast(module->num_imported_functions); -} - -MemorySpan debug::WasmScript::Bytecode() const { - i::Handle script = Utils::OpenHandle(this); - i::Vector wire_bytes = - script->wasm_native_module()->wire_bytes(); - return {wire_bytes.begin(), wire_bytes.size()}; -} - -std::pair debug::WasmScript::GetFunctionRange( - int function_index) const { - i::DisallowGarbageCollection no_gc; - i::Handle script = Utils::OpenHandle(this); - DCHECK_EQ(i::Script::TYPE_WASM, script->type()); - i::wasm::NativeModule* native_module = script->wasm_native_module(); - const i::wasm::WasmModule* module = native_module->module(); - DCHECK_LE(0, function_index); - DCHECK_GT(module->functions.size(), function_index); - const i::wasm::WasmFunction& func = module->functions[function_index]; - DCHECK_GE(i::kMaxInt, func.code.offset()); - DCHECK_GE(i::kMaxInt, func.code.end_offset()); - return std::make_pair(static_cast(func.code.offset()), - static_cast(func.code.end_offset())); -} - -int debug::WasmScript::GetContainingFunction(int byte_offset) const { - i::DisallowGarbageCollection no_gc; - i::Handle script = Utils::OpenHandle(this); - DCHECK_EQ(i::Script::TYPE_WASM, script->type()); - i::wasm::NativeModule* native_module = script->wasm_native_module(); - const i::wasm::WasmModule* module = native_module->module(); - DCHECK_LE(0, byte_offset); - - return i::wasm::GetContainingWasmFunction(module, byte_offset); -} - -uint32_t debug::WasmScript::GetFunctionHash(int function_index) { - i::DisallowGarbageCollection no_gc; - i::Handle script = Utils::OpenHandle(this); - DCHECK_EQ(i::Script::TYPE_WASM, script->type()); - i::wasm::NativeModule* native_module = script->wasm_native_module(); - const i::wasm::WasmModule* module = native_module->module(); - DCHECK_LE(0, function_index); - DCHECK_GT(module->functions.size(), function_index); - const i::wasm::WasmFunction& func = module->functions[function_index]; - i::wasm::ModuleWireBytes wire_bytes(native_module->wire_bytes()); - i::Vector function_bytes = wire_bytes.GetFunctionBytes(&func); - // TODO(herhut): Maybe also take module, name and signature into account. - return i::StringHasher::HashSequentialString(function_bytes.begin(), - function_bytes.length(), 0); -} - -int debug::WasmScript::CodeOffset() const { - i::Handle script = Utils::OpenHandle(this); - DCHECK_EQ(i::Script::TYPE_WASM, script->type()); - i::wasm::NativeModule* native_module = script->wasm_native_module(); - const i::wasm::WasmModule* module = native_module->module(); - - // If the module contains at least one function, the code offset must have - // been initialized, and it cannot be zero. - DCHECK_IMPLIES(module->num_declared_functions > 0, - module->code.offset() != 0); - return module->code.offset(); -} - -debug::Location::Location(int line_number, int column_number) - : line_number_(line_number), - column_number_(column_number), - is_empty_(false) {} - -debug::Location::Location() - : line_number_(v8::Function::kLineOffsetNotFound), - column_number_(v8::Function::kLineOffsetNotFound), - is_empty_(true) {} - -int debug::Location::GetLineNumber() const { - DCHECK(!IsEmpty()); - return line_number_; -} - -int debug::Location::GetColumnNumber() const { - DCHECK(!IsEmpty()); - return column_number_; -} - -bool debug::Location::IsEmpty() const { return is_empty_; } - -void debug::GetLoadedScripts(v8::Isolate* v8_isolate, - PersistentValueVector& scripts) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); - ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); - { - i::DisallowGarbageCollection no_gc; - i::Script::Iterator iterator(isolate); - for (i::Script script = iterator.Next(); !script.is_null(); - script = iterator.Next()) { - if (script.type() == i::Script::TYPE_NORMAL || - script.type() == i::Script::TYPE_WASM) { - if (script.HasValidSource()) { - i::HandleScope handle_scope(isolate); - i::Handle script_handle(script, isolate); - scripts.Append(ToApiHandle