From c7b329225126ad3b9eeb2408e0f0801f1aea5eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Thu, 11 Feb 2021 19:03:35 +0100 Subject: [PATCH] deps: update V8 to 8.8.278.17 PR-URL: https://github.com/nodejs/node/pull/36139 Reviewed-By: Jiawen Geng Reviewed-By: Colin Ihrig Reviewed-By: Myles Borins Reviewed-By: Shelley Vohr --- deps/v8/.gitignore | 1 + deps/v8/AUTHORS | 4 + deps/v8/BUILD.gn | 211 +- deps/v8/DEPS | 58 +- deps/v8/DIR_METADATA | 12 + deps/v8/OWNERS | 3 - deps/v8/PPC_OWNERS | 1 + deps/v8/PRESUBMIT.py | 10 + deps/v8/S390_OWNERS | 1 + .../trace_event/common/trace_event_common.h | 1 + deps/v8/gni/proto_library.gni | 11 +- deps/v8/include/DIR_METADATA | 11 + deps/v8/include/OWNERS | 2 - deps/v8/include/cppgc/DEPS | 1 + deps/v8/include/cppgc/allocation.h | 48 +- .../include/cppgc/cross-thread-persistent.h | 311 ++ deps/v8/include/cppgc/custom-space.h | 31 +- deps/v8/include/cppgc/default-platform.h | 87 +- deps/v8/include/cppgc/ephemeron-pair.h | 25 + deps/v8/include/cppgc/garbage-collected.h | 4 +- deps/v8/include/cppgc/heap.h | 14 +- deps/v8/include/cppgc/internal/gc-info.h | 6 +- deps/v8/include/cppgc/internal/name-trait.h | 111 + .../include/cppgc/internal/persistent-node.h | 10 +- .../include/cppgc/internal/pointer-policies.h | 18 +- deps/v8/include/cppgc/liveness-broker.h | 2 +- deps/v8/include/cppgc/member.h | 6 +- deps/v8/include/cppgc/name-provider.h | 65 + deps/v8/include/cppgc/platform.h | 52 +- deps/v8/include/cppgc/source-location.h | 2 +- deps/v8/include/cppgc/trace-trait.h | 9 +- deps/v8/include/cppgc/visitor.h | 122 +- deps/v8/include/js_protocol.pdl | 12 +- deps/v8/include/v8-cppgc.h | 194 +- deps/v8/include/v8-fast-api-calls.h | 62 +- deps/v8/include/v8-inspector.h | 4 + deps/v8/include/v8-internal.h | 66 +- deps/v8/include/v8-metrics.h | 5 + deps/v8/include/v8-platform.h | 29 +- deps/v8/include/v8-profiler.h | 31 +- deps/v8/include/v8-unwinder-state.h | 30 + deps/v8/include/v8-version.h | 6 +- deps/v8/include/v8.h | 417 ++- deps/v8/include/v8config.h | 9 - deps/v8/infra/mb/mb_config.pyl | 18 +- deps/v8/infra/testing/PRESUBMIT.py | 1 + deps/v8/infra/testing/builders.pyl | 133 +- .../samples/cppgc/cppgc-for-v8-embedders.cc | 40 +- deps/v8/src/DIR_METADATA | 11 + deps/v8/src/OWNERS | 2 - deps/v8/src/api/DIR_METADATA | 11 + deps/v8/src/api/OWNERS | 2 - deps/v8/src/api/api-natives.cc | 3 +- deps/v8/src/api/api.cc | 226 +- deps/v8/src/asmjs/DIR_METADATA | 11 + deps/v8/src/asmjs/OWNERS | 2 - deps/v8/src/ast/DIR_METADATA | 11 + deps/v8/src/ast/OWNERS | 2 - .../ast/ast-function-literal-id-reindexer.cc | 9 +- deps/v8/src/ast/ast-source-ranges.h | 19 - deps/v8/src/ast/ast-value-factory.cc | 67 +- deps/v8/src/ast/ast-value-factory.h | 37 +- deps/v8/src/ast/ast.cc | 8 +- deps/v8/src/ast/ast.h | 12 - deps/v8/src/ast/modules.cc | 93 +- deps/v8/src/ast/modules.h | 63 +- deps/v8/src/ast/prettyprinter.cc | 2 + deps/v8/src/ast/scopes.h | 2 - deps/v8/src/base/DIR_METADATA | 11 + deps/v8/src/base/OWNERS | 2 - deps/v8/src/base/bounded-page-allocator.h | 4 +- deps/v8/src/base/build_config.h | 4 + deps/v8/src/base/debug/stack_trace_posix.cc | 11 +- deps/v8/src/base/hashmap-entry.h | 52 +- deps/v8/src/base/hashmap.h | 46 +- deps/v8/src/base/lazy-instance.h | 5 +- deps/v8/src/base/macros.h | 4 + deps/v8/src/base/platform/DIR_METADATA | 11 + deps/v8/src/base/platform/OWNERS | 2 - .../v8/src/base/platform/condition-variable.h | 4 +- deps/v8/src/base/platform/mutex.h | 20 +- deps/v8/src/base/platform/platform-aix.cc | 2 +- deps/v8/src/base/platform/platform-freebsd.cc | 2 +- deps/v8/src/base/platform/platform-fuchsia.cc | 12 +- deps/v8/src/base/platform/platform-macos.cc | 2 +- deps/v8/src/base/platform/platform-posix.cc | 16 +- deps/v8/src/base/platform/platform-win32.cc | 4 +- deps/v8/src/base/platform/platform.h | 50 +- deps/v8/src/base/platform/semaphore.h | 4 +- deps/v8/src/base/platform/wrappers.h | 31 + .../src/base/platform/wrappers_starboard.cc | 31 + deps/v8/src/base/platform/wrappers_std.cc | 34 + deps/v8/src/base/region-allocator.h | 4 +- deps/v8/src/base/ring-buffer.h | 5 +- deps/v8/src/base/safe_conversions.h | 372 ++- deps/v8/src/base/safe_conversions_arm_impl.h | 60 + deps/v8/src/base/safe_conversions_impl.h | 822 +++++- deps/v8/src/base/threaded-list.h | 4 +- deps/v8/src/builtins/DIR_METADATA | 11 + deps/v8/src/builtins/OWNERS | 2 - deps/v8/src/builtins/accessors.cc | 11 +- deps/v8/src/builtins/accessors.h | 4 +- deps/v8/src/builtins/aggregate-error.tq | 4 - deps/v8/src/builtins/arm/builtins-arm.cc | 1032 +++---- deps/v8/src/builtins/arm64/builtins-arm64.cc | 1364 ++++----- deps/v8/src/builtins/base.tq | 28 +- deps/v8/src/builtins/builtins-api.cc | 16 +- deps/v8/src/builtins/builtins-array-gen.cc | 195 +- deps/v8/src/builtins/builtins-array.cc | 4 +- deps/v8/src/builtins/builtins-arraybuffer.cc | 10 +- .../builtins/builtins-async-function-gen.cc | 44 +- deps/v8/src/builtins/builtins-async-gen.cc | 6 +- .../builtins/builtins-async-generator-gen.cc | 86 +- .../builtins/builtins-async-iterator-gen.cc | 12 +- deps/v8/src/builtins/builtins-bigint-gen.cc | 15 +- .../{bigint.tq => builtins-bigint.tq} | 18 - deps/v8/src/builtins/builtins-call-gen.cc | 111 +- deps/v8/src/builtins/builtins-callsite.cc | 16 - .../src/builtins/builtins-collections-gen.cc | 192 +- .../src/builtins/builtins-constructor-gen.cc | 82 +- .../src/builtins/builtins-conversion-gen.cc | 14 +- deps/v8/src/builtins/builtins-dataview.cc | 2 + deps/v8/src/builtins/builtins-date-gen.cc | 82 +- deps/v8/src/builtins/builtins-definitions.h | 11 +- deps/v8/src/builtins/builtins-function.cc | 10 +- .../v8/src/builtins/builtins-generator-gen.cc | 20 +- deps/v8/src/builtins/builtins-global-gen.cc | 8 +- deps/v8/src/builtins/builtins-handler-gen.cc | 104 +- deps/v8/src/builtins/builtins-internal-gen.cc | 177 +- deps/v8/src/builtins/builtins-intl-gen.cc | 14 +- deps/v8/src/builtins/builtins-iterator-gen.cc | 46 +- deps/v8/src/builtins/builtins-lazy-gen.cc | 109 +- deps/v8/src/builtins/builtins-lazy-gen.h | 2 +- .../builtins/builtins-microtask-queue-gen.cc | 13 +- deps/v8/src/builtins/builtins-number-gen.cc | 75 +- deps/v8/src/builtins/builtins-object-gen.cc | 104 +- deps/v8/src/builtins/builtins-object.cc | 4 +- deps/v8/src/builtins/builtins-proxy-gen.cc | 16 +- deps/v8/src/builtins/builtins-reflect.cc | 6 +- deps/v8/src/builtins/builtins-regexp-gen.cc | 102 +- .../builtins-sharedarraybuffer-gen.cc | 164 +- deps/v8/src/builtins/builtins-string-gen.cc | 282 +- deps/v8/src/builtins/builtins-string-gen.h | 28 +- deps/v8/src/builtins/builtins-string.cc | 2 +- .../src/builtins/builtins-typed-array-gen.cc | 49 +- .../src/builtins/builtins-typed-array-gen.h | 1 + deps/v8/src/builtins/builtins-utils-gen.h | 51 +- deps/v8/src/builtins/builtins-utils-inl.h | 8 - deps/v8/src/builtins/builtins-utils.h | 5 - deps/v8/src/builtins/builtins-wasm-gen.cc | 61 +- deps/v8/src/builtins/builtins.cc | 5 +- deps/v8/src/builtins/cast.tq | 17 +- .../src/builtins/constants-table-builder.cc | 15 +- deps/v8/src/builtins/convert.tq | 5 + .../generate-bytecodes-builtins-list.cc | 34 +- deps/v8/src/builtins/ia32/builtins-ia32.cc | 1049 +++---- deps/v8/src/builtins/ic-dynamic-map-checks.tq | 155 + deps/v8/src/builtins/ic.tq | 4 + deps/v8/src/builtins/internal.tq | 43 + deps/v8/src/builtins/mips/builtins-mips.cc | 777 +++-- .../v8/src/builtins/mips64/builtins-mips64.cc | 769 +++-- deps/v8/src/builtins/ppc/builtins-ppc.cc | 755 ++--- deps/v8/src/builtins/regexp.tq | 10 +- deps/v8/src/builtins/s390/builtins-s390.cc | 760 ++--- .../src/builtins/setup-builtins-internal.cc | 3 +- deps/v8/src/builtins/string-trim.tq | 168 ++ deps/v8/src/builtins/torque-internal.tq | 5 + .../builtins/typed-array-createtypedarray.tq | 1 + deps/v8/src/builtins/typed-array-sort.tq | 8 + deps/v8/src/builtins/typed-array.tq | 4 + deps/v8/src/builtins/wasm.tq | 35 +- deps/v8/src/builtins/x64/builtins-x64.cc | 1117 ++++--- deps/v8/src/codegen/DIR_METADATA | 11 + deps/v8/src/codegen/OWNERS | 2 - deps/v8/src/codegen/arm/assembler-arm.cc | 53 +- deps/v8/src/codegen/arm/assembler-arm.h | 4 + .../codegen/arm/interface-descriptors-arm.cc | 48 - .../v8/src/codegen/arm/macro-assembler-arm.cc | 180 +- deps/v8/src/codegen/arm/macro-assembler-arm.h | 27 +- deps/v8/src/codegen/arm64/assembler-arm64.cc | 15 +- .../arm64/interface-descriptors-arm64.cc | 48 - .../codegen/arm64/macro-assembler-arm64.cc | 193 +- .../src/codegen/arm64/macro-assembler-arm64.h | 20 +- deps/v8/src/codegen/arm64/register-arm64.h | 2 - deps/v8/src/codegen/assembler.cc | 13 +- deps/v8/src/codegen/assembler.h | 11 +- deps/v8/src/codegen/bailout-reason.h | 2 +- deps/v8/src/codegen/code-desc.h | 34 +- deps/v8/src/codegen/code-stub-assembler.cc | 922 +++--- deps/v8/src/codegen/code-stub-assembler.h | 532 ++-- deps/v8/src/codegen/compilation-cache.cc | 12 +- deps/v8/src/codegen/compilation-cache.h | 2 +- deps/v8/src/codegen/compiler.cc | 222 +- deps/v8/src/codegen/compiler.h | 30 +- deps/v8/src/codegen/external-reference.cc | 17 + deps/v8/src/codegen/external-reference.h | 25 +- deps/v8/src/codegen/handler-table.cc | 2 +- deps/v8/src/codegen/ia32/assembler-ia32.cc | 16 +- deps/v8/src/codegen/ia32/assembler-ia32.h | 1 - .../ia32/interface-descriptors-ia32.cc | 48 - .../src/codegen/ia32/macro-assembler-ia32.cc | 169 +- .../src/codegen/ia32/macro-assembler-ia32.h | 26 +- deps/v8/src/codegen/interface-descriptors.cc | 40 + deps/v8/src/codegen/interface-descriptors.h | 33 +- deps/v8/src/codegen/mips/assembler-mips.cc | 10 + .../mips/interface-descriptors-mips.cc | 48 - .../src/codegen/mips/macro-assembler-mips.cc | 139 +- .../src/codegen/mips/macro-assembler-mips.h | 28 +- .../v8/src/codegen/mips64/assembler-mips64.cc | 14 +- .../mips64/interface-descriptors-mips64.cc | 48 - .../codegen/mips64/macro-assembler-mips64.cc | 145 +- .../codegen/mips64/macro-assembler-mips64.h | 28 +- .../src/codegen/optimized-compilation-info.cc | 7 +- .../src/codegen/optimized-compilation-info.h | 9 +- deps/v8/src/codegen/ppc/assembler-ppc.cc | 20 + deps/v8/src/codegen/ppc/assembler-ppc.h | 2 + deps/v8/src/codegen/ppc/constants-ppc.h | 48 +- .../codegen/ppc/interface-descriptors-ppc.cc | 48 - .../v8/src/codegen/ppc/macro-assembler-ppc.cc | 45 +- deps/v8/src/codegen/ppc/macro-assembler-ppc.h | 15 +- deps/v8/src/codegen/ppc/register-ppc.h | 6 +- deps/v8/src/codegen/register-configuration.cc | 4 + deps/v8/src/codegen/register-configuration.h | 5 +- deps/v8/src/codegen/reloc-info.cc | 2 +- deps/v8/src/codegen/s390/assembler-s390.cc | 9 + .../s390/interface-descriptors-s390.cc | 48 - .../src/codegen/s390/macro-assembler-s390.cc | 43 +- .../src/codegen/s390/macro-assembler-s390.h | 15 +- deps/v8/src/codegen/s390/register-s390.h | 6 +- deps/v8/src/codegen/safepoint-table.cc | 2 +- deps/v8/src/codegen/tnode.h | 19 +- deps/v8/src/codegen/x64/assembler-x64.cc | 117 +- deps/v8/src/codegen/x64/assembler-x64.h | 101 +- .../codegen/x64/interface-descriptors-x64.cc | 75 - .../v8/src/codegen/x64/macro-assembler-x64.cc | 360 ++- deps/v8/src/codegen/x64/macro-assembler-x64.h | 62 +- deps/v8/src/common/DIR_METADATA | 11 + deps/v8/src/common/OWNERS | 2 - deps/v8/src/common/assert-scope.cc | 2 + deps/v8/src/common/assert-scope.h | 24 +- deps/v8/src/common/external-pointer-inl.h | 93 +- deps/v8/src/common/external-pointer.h | 43 +- deps/v8/src/common/globals.h | 194 +- deps/v8/src/common/message-template.h | 13 +- deps/v8/src/common/ptr-compr-inl.h | 43 +- deps/v8/src/common/ptr-compr.h | 4 +- deps/v8/src/compiler-dispatcher/DIR_METADATA | 11 + deps/v8/src/compiler-dispatcher/OWNERS | 2 - .../compiler-dispatcher.cc | 2 +- .../optimizing-compile-dispatcher.cc | 15 +- .../optimizing-compile-dispatcher.h | 7 +- deps/v8/src/compiler/DIR_METADATA | 11 + deps/v8/src/compiler/OWNERS | 3 +- deps/v8/src/compiler/access-builder.cc | 84 +- deps/v8/src/compiler/access-builder.h | 3 +- deps/v8/src/compiler/access-info.cc | 67 +- deps/v8/src/compiler/access-info.h | 26 +- .../compiler/add-type-assertions-reducer.h | 5 +- deps/v8/src/compiler/allocation-builder-inl.h | 3 +- deps/v8/src/compiler/allocation-builder.h | 2 +- deps/v8/src/compiler/backend/DIR_METADATA | 11 + deps/v8/src/compiler/backend/OWNERS | 2 - .../backend/arm/code-generator-arm.cc | 131 +- .../backend/arm/instruction-codes-arm.h | 38 +- .../backend/arm/instruction-scheduler-arm.cc | 38 +- .../backend/arm/instruction-selector-arm.cc | 132 +- .../backend/arm64/code-generator-arm64.cc | 361 ++- .../backend/arm64/instruction-codes-arm64.h | 68 +- .../arm64/instruction-scheduler-arm64.cc | 64 +- .../arm64/instruction-selector-arm64.cc | 410 ++- .../compiler/backend/code-generator-impl.h | 11 - .../v8/src/compiler/backend/code-generator.cc | 20 +- deps/v8/src/compiler/backend/code-generator.h | 10 +- .../backend/ia32/code-generator-ia32.cc | 210 +- .../backend/ia32/instruction-codes-ia32.h | 52 +- .../ia32/instruction-scheduler-ia32.cc | 52 +- .../backend/ia32/instruction-selector-ia32.cc | 136 +- .../src/compiler/backend/instruction-codes.h | 200 +- .../compiler/backend/instruction-selector.cc | 244 +- .../compiler/backend/instruction-selector.h | 6 +- deps/v8/src/compiler/backend/instruction.h | 36 +- .../backend/mid-tier-register-allocator.cc | 843 +++++- .../backend/mid-tier-register-allocator.h | 9 +- .../backend/mips/code-generator-mips.cc | 124 +- .../backend/mips/instruction-codes-mips.h | 37 +- .../mips/instruction-scheduler-mips.cc | 37 +- .../backend/mips/instruction-selector-mips.cc | 132 +- .../backend/mips64/code-generator-mips64.cc | 181 +- .../backend/mips64/instruction-codes-mips64.h | 39 +- .../mips64/instruction-scheduler-mips64.cc | 39 +- .../mips64/instruction-selector-mips64.cc | 190 +- deps/v8/src/compiler/backend/move-optimizer.h | 5 +- deps/v8/src/compiler/backend/ppc/OWNERS | 1 + .../backend/ppc/code-generator-ppc.cc | 304 +- .../backend/ppc/instruction-codes-ppc.h | 20 +- .../backend/ppc/instruction-scheduler-ppc.cc | 20 +- .../backend/ppc/instruction-selector-ppc.cc | 109 +- .../backend/register-allocator-verifier.h | 25 +- .../compiler/backend/register-allocator.cc | 41 +- .../src/compiler/backend/register-allocator.h | 75 +- .../backend/s390/code-generator-s390.cc | 181 +- .../backend/s390/instruction-codes-s390.h | 27 +- .../s390/instruction-scheduler-s390.cc | 27 +- .../backend/s390/instruction-selector-s390.cc | 74 +- deps/v8/src/compiler/backend/spill-placer.h | 5 +- .../backend/x64/code-generator-x64.cc | 793 +++-- .../backend/x64/instruction-codes-x64.h | 69 +- .../backend/x64/instruction-scheduler-x64.cc | 69 +- .../backend/x64/instruction-selector-x64.cc | 641 ++-- deps/v8/src/compiler/bytecode-analysis.h | 4 +- .../v8/src/compiler/bytecode-graph-builder.cc | 230 +- deps/v8/src/compiler/bytecode-graph-builder.h | 2 +- deps/v8/src/compiler/bytecode-liveness-map.h | 4 +- deps/v8/src/compiler/c-linkage.cc | 3 +- deps/v8/src/compiler/code-assembler.cc | 65 +- deps/v8/src/compiler/code-assembler.h | 137 +- deps/v8/src/compiler/common-node-cache.h | 5 +- .../src/compiler/common-operator-reducer.cc | 19 +- deps/v8/src/compiler/common-operator.cc | 2 +- deps/v8/src/compiler/common-operator.h | 4 +- .../src/compiler/compilation-dependencies.cc | 12 +- .../compiler/compiler-source-position-table.h | 7 +- .../src/compiler/constant-folding-reducer.h | 4 +- .../v8/src/compiler/control-flow-optimizer.cc | 8 +- deps/v8/src/compiler/control-flow-optimizer.h | 4 +- deps/v8/src/compiler/csa-load-elimination.cc | 6 +- deps/v8/src/compiler/csa-load-elimination.h | 4 +- deps/v8/src/compiler/dead-code-elimination.h | 4 +- .../v8/src/compiler/decompression-optimizer.h | 4 +- .../src/compiler/effect-control-linearizer.cc | 384 +-- .../src/compiler/effect-control-linearizer.h | 4 +- .../src/compiler/escape-analysis-reducer.cc | 33 +- .../v8/src/compiler/escape-analysis-reducer.h | 4 +- deps/v8/src/compiler/escape-analysis.cc | 15 +- deps/v8/src/compiler/feedback-source.cc | 3 - deps/v8/src/compiler/feedback-source.h | 1 - deps/v8/src/compiler/frame.h | 4 +- deps/v8/src/compiler/globals.h | 9 + deps/v8/src/compiler/graph-assembler.cc | 16 + deps/v8/src/compiler/graph-assembler.h | 6 + deps/v8/src/compiler/graph-reducer.h | 5 +- deps/v8/src/compiler/graph-trimmer.h | 4 +- deps/v8/src/compiler/graph-visualizer.cc | 12 +- deps/v8/src/compiler/graph.h | 8 +- deps/v8/src/compiler/heap-refs.h | 18 +- deps/v8/src/compiler/int64-lowering.cc | 4 +- deps/v8/src/compiler/js-call-reducer.cc | 110 +- .../src/compiler/js-context-specialization.h | 4 +- deps/v8/src/compiler/js-create-lowering.cc | 3 +- deps/v8/src/compiler/js-generic-lowering.cc | 125 +- deps/v8/src/compiler/js-graph.h | 5 +- deps/v8/src/compiler/js-heap-broker.cc | 335 ++- deps/v8/src/compiler/js-heap-broker.h | 70 +- deps/v8/src/compiler/js-heap-copy-reducer.cc | 6 +- deps/v8/src/compiler/js-inlining-heuristic.cc | 4 +- deps/v8/src/compiler/js-inlining.cc | 21 +- deps/v8/src/compiler/js-inlining.h | 2 +- deps/v8/src/compiler/js-intrinsic-lowering.cc | 2 +- .../js-native-context-specialization.cc | 490 ++-- .../js-native-context-specialization.h | 58 +- deps/v8/src/compiler/js-operator.cc | 67 +- deps/v8/src/compiler/js-operator.h | 80 +- deps/v8/src/compiler/js-type-hint-lowering.cc | 10 +- deps/v8/src/compiler/js-type-hint-lowering.h | 9 +- deps/v8/src/compiler/js-typed-lowering.cc | 120 +- deps/v8/src/compiler/linkage.cc | 4 - deps/v8/src/compiler/linkage.h | 13 +- deps/v8/src/compiler/load-elimination.h | 4 +- deps/v8/src/compiler/machine-graph.h | 4 +- .../src/compiler/machine-operator-reducer.cc | 494 ++-- deps/v8/src/compiler/machine-operator.cc | 290 +- deps/v8/src/compiler/machine-operator.h | 124 +- deps/v8/src/compiler/map-inference.cc | 6 +- deps/v8/src/compiler/memory-lowering.cc | 43 +- deps/v8/src/compiler/memory-lowering.h | 7 +- deps/v8/src/compiler/node-cache.h | 4 +- deps/v8/src/compiler/node-marker.h | 4 +- deps/v8/src/compiler/node-matchers.h | 206 +- deps/v8/src/compiler/node-origin-table.h | 12 +- deps/v8/src/compiler/node-properties.cc | 28 +- deps/v8/src/compiler/node-properties.h | 31 +- deps/v8/src/compiler/node.cc | 4 +- deps/v8/src/compiler/node.h | 4 +- deps/v8/src/compiler/opcodes.h | 61 +- deps/v8/src/compiler/operator-properties.cc | 11 +- deps/v8/src/compiler/operator-properties.h | 6 +- deps/v8/src/compiler/operator.h | 4 +- deps/v8/src/compiler/pipeline-statistics.h | 13 +- deps/v8/src/compiler/pipeline.cc | 156 +- deps/v8/src/compiler/processed-feedback.h | 8 +- .../src/compiler/property-access-builder.cc | 74 +- .../v8/src/compiler/property-access-builder.h | 20 +- deps/v8/src/compiler/raw-machine-assembler.cc | 15 + deps/v8/src/compiler/raw-machine-assembler.h | 17 +- deps/v8/src/compiler/redundancy-elimination.h | 4 +- deps/v8/src/compiler/representation-change.cc | 6 +- deps/v8/src/compiler/schedule.h | 8 +- .../serializer-for-background-compilation.cc | 161 +- deps/v8/src/compiler/simd-scalar-lowering.cc | 653 +++-- deps/v8/src/compiler/simd-scalar-lowering.h | 2 + deps/v8/src/compiler/simplified-lowering.cc | 60 +- deps/v8/src/compiler/simplified-lowering.h | 4 +- .../compiler/simplified-operator-reducer.cc | 52 +- .../compiler/simplified-operator-reducer.h | 5 +- deps/v8/src/compiler/simplified-operator.cc | 13 +- deps/v8/src/compiler/simplified-operator.h | 44 +- deps/v8/src/compiler/type-narrowing-reducer.h | 4 +- deps/v8/src/compiler/typed-optimization.cc | 2 +- deps/v8/src/compiler/typed-optimization.h | 4 +- deps/v8/src/compiler/typer.cc | 6 +- deps/v8/src/compiler/typer.h | 4 +- deps/v8/src/compiler/types.cc | 47 +- deps/v8/src/compiler/verifier.cc | 2 +- deps/v8/src/compiler/verifier.h | 4 +- deps/v8/src/compiler/wasm-compiler.cc | 1187 ++++---- deps/v8/src/compiler/wasm-compiler.h | 50 +- deps/v8/src/compiler/zone-stats.h | 12 +- deps/v8/src/d8/d8.cc | 48 +- deps/v8/src/d8/d8.h | 3 +- deps/v8/src/date/DIR_METADATA | 11 + deps/v8/src/date/OWNERS | 2 - deps/v8/src/debug/DIR_METADATA | 11 + deps/v8/src/debug/OWNERS | 2 - deps/v8/src/debug/debug-evaluate.cc | 66 +- deps/v8/src/debug/debug-evaluate.h | 5 +- deps/v8/src/debug/debug-frames.cc | 10 +- deps/v8/src/debug/debug-frames.h | 8 +- deps/v8/src/debug/debug-interface.h | 10 + .../src/debug/debug-stack-trace-iterator.cc | 24 +- deps/v8/src/debug/debug.cc | 12 +- deps/v8/src/debug/liveedit.cc | 2 +- deps/v8/src/debug/ppc/OWNERS | 1 + .../v8/src/debug/wasm/gdb-server/DIR_METADATA | 11 + deps/v8/src/debug/wasm/gdb-server/OWNERS | 2 - .../wasm/gdb-server/wasm-module-debug.cc | 4 +- deps/v8/src/deoptimizer/DIR_METADATA | 11 + deps/v8/src/deoptimizer/OWNERS | 2 - .../v8/src/deoptimizer/arm/deoptimizer-arm.cc | 240 +- .../deoptimizer/arm64/deoptimizer-arm64.cc | 287 -- deps/v8/src/deoptimizer/deoptimizer.cc | 253 +- deps/v8/src/deoptimizer/deoptimizer.h | 83 +- .../src/deoptimizer/ia32/deoptimizer-ia32.cc | 195 +- .../src/deoptimizer/mips/deoptimizer-mips.cc | 209 +- .../deoptimizer/mips64/deoptimizer-mips64.cc | 209 +- .../v8/src/deoptimizer/ppc/deoptimizer-ppc.cc | 236 +- .../src/deoptimizer/s390/deoptimizer-s390.cc | 234 +- .../v8/src/deoptimizer/x64/deoptimizer-x64.cc | 211 +- deps/v8/src/diagnostics/arm/disasm-arm.cc | 1343 ++++----- deps/v8/src/diagnostics/arm/unwinder-arm.cc | 37 + .../src/diagnostics/arm64/unwinder-arm64.cc | 12 + .../src/diagnostics/basic-block-profiler.cc | 2 +- .../v8/src/diagnostics/basic-block-profiler.h | 4 +- deps/v8/src/diagnostics/disassembler.cc | 5 +- deps/v8/src/diagnostics/ia32/disasm-ia32.cc | 38 +- deps/v8/src/diagnostics/ia32/unwinder-ia32.cc | 12 + deps/v8/src/diagnostics/mips/unwinder-mips.cc | 12 + .../src/diagnostics/mips64/unwinder-mips64.cc | 12 + deps/v8/src/diagnostics/objects-debug.cc | 79 +- deps/v8/src/diagnostics/objects-printer.cc | 138 +- deps/v8/src/diagnostics/perf-jit.cc | 11 +- deps/v8/src/diagnostics/ppc/unwinder-ppc.cc | 8 + deps/v8/src/diagnostics/s390/unwinder-s390.cc | 8 + deps/v8/src/diagnostics/unwinder.cc | 28 +- deps/v8/src/diagnostics/unwinder.h | 17 + .../src/diagnostics/unwinding-info-win64.cc | 31 - deps/v8/src/diagnostics/x64/disasm-x64.cc | 906 +++--- deps/v8/src/diagnostics/x64/unwinder-x64.cc | 12 + deps/v8/src/execution/DIR_METADATA | 11 + deps/v8/src/execution/OWNERS | 2 - deps/v8/src/execution/arguments.h | 6 - .../src/execution/arm/frame-constants-arm.h | 8 +- deps/v8/src/execution/arm/simulator-arm.cc | 2577 ++++++++--------- deps/v8/src/execution/arm/simulator-arm.h | 7 + .../execution/arm64/frame-constants-arm64.h | 2 + .../src/execution/arm64/pointer-auth-arm64.cc | 3 + deps/v8/src/execution/execution.cc | 16 +- .../src/execution/external-pointer-table.cc | 22 + .../v8/src/execution/external-pointer-table.h | 80 + deps/v8/src/execution/frame-constants.h | 36 +- deps/v8/src/execution/frames-inl.h | 98 +- deps/v8/src/execution/frames.cc | 164 +- deps/v8/src/execution/frames.h | 492 ++-- deps/v8/src/execution/isolate-data.h | 22 + deps/v8/src/execution/isolate-inl.h | 4 - deps/v8/src/execution/isolate-utils-inl.h | 31 +- deps/v8/src/execution/isolate-utils.h | 2 +- deps/v8/src/execution/isolate.cc | 281 +- deps/v8/src/execution/isolate.h | 138 +- deps/v8/src/execution/local-isolate-inl.h | 4 +- deps/v8/src/execution/local-isolate.cc | 16 +- deps/v8/src/execution/local-isolate.h | 22 +- deps/v8/src/execution/messages.cc | 89 +- deps/v8/src/execution/messages.h | 27 +- .../src/execution/ppc/frame-constants-ppc.h | 4 +- deps/v8/src/execution/runtime-profiler.cc | 101 +- deps/v8/src/execution/runtime-profiler.h | 11 +- deps/v8/src/execution/s390/simulator-s390.cc | 25 +- deps/v8/src/extensions/gc-extension.cc | 2 +- deps/v8/src/flags/flag-definitions.h | 100 +- deps/v8/src/handles/DIR_METADATA | 11 + deps/v8/src/handles/OWNERS | 2 - deps/v8/src/handles/global-handles.cc | 89 +- deps/v8/src/handles/global-handles.h | 52 +- deps/v8/src/handles/handles-inl.h | 10 +- deps/v8/src/handles/handles.cc | 9 +- deps/v8/src/handles/handles.h | 9 +- deps/v8/src/handles/maybe-handles-inl.h | 34 + deps/v8/src/handles/maybe-handles.h | 13 +- deps/v8/src/heap/DIR_METADATA | 11 + deps/v8/src/heap/OWNERS | 2 - deps/v8/src/heap/array-buffer-sweeper.cc | 137 +- deps/v8/src/heap/array-buffer-sweeper.h | 45 +- deps/v8/src/heap/base/stack.cc | 16 +- deps/v8/src/heap/base/worklist.h | 14 + deps/v8/src/heap/basic-memory-chunk.h | 2 - deps/v8/src/heap/code-object-registry.cc | 70 +- deps/v8/src/heap/code-object-registry.h | 6 +- deps/v8/src/heap/code-stats.cc | 7 +- deps/v8/src/heap/collection-barrier.cc | 100 + deps/v8/src/heap/collection-barrier.h | 93 + deps/v8/src/heap/concurrent-allocator.cc | 4 +- deps/v8/src/heap/concurrent-marking.cc | 209 +- deps/v8/src/heap/concurrent-marking.h | 58 +- deps/v8/src/heap/cppgc-js/cpp-heap.cc | 91 +- deps/v8/src/heap/cppgc-js/cpp-heap.h | 8 +- deps/v8/src/heap/cppgc-js/cpp-snapshot.cc | 713 +++++ deps/v8/src/heap/cppgc-js/cpp-snapshot.h | 29 + .../cppgc-js/unified-heap-marking-state.h | 13 +- .../cppgc-js/unified-heap-marking-verifier.cc | 70 + .../cppgc-js/unified-heap-marking-verifier.h | 30 + .../cppgc-js/unified-heap-marking-visitor.cc | 92 +- .../cppgc-js/unified-heap-marking-visitor.h | 66 +- .../v8/src/heap/cppgc/compaction-worklists.cc | 14 + deps/v8/src/heap/cppgc/compaction-worklists.h | 35 + deps/v8/src/heap/cppgc/compactor.cc | 505 ++++ deps/v8/src/heap/cppgc/compactor.h | 56 + deps/v8/src/heap/cppgc/concurrent-marker.cc | 246 ++ deps/v8/src/heap/cppgc/concurrent-marker.h | 76 + deps/v8/src/heap/cppgc/default-job.h | 186 -- deps/v8/src/heap/cppgc/default-platform.cc | 143 - deps/v8/src/heap/cppgc/garbage-collector.h | 2 +- deps/v8/src/heap/cppgc/gc-info-table.h | 3 +- deps/v8/src/heap/cppgc/gc-info.cc | 5 +- deps/v8/src/heap/cppgc/globals.h | 3 + deps/v8/src/heap/cppgc/heap-base.cc | 11 +- deps/v8/src/heap/cppgc/heap-base.h | 23 +- deps/v8/src/heap/cppgc/heap-object-header.cc | 10 + deps/v8/src/heap/cppgc/heap-object-header.h | 42 +- deps/v8/src/heap/cppgc/heap-page.cc | 2 + deps/v8/src/heap/cppgc/heap-page.h | 43 +- deps/v8/src/heap/cppgc/heap-space.cc | 14 +- deps/v8/src/heap/cppgc/heap-space.h | 8 +- deps/v8/src/heap/cppgc/heap.cc | 18 +- .../cppgc/incremental-marking-schedule.cc | 25 +- .../heap/cppgc/incremental-marking-schedule.h | 10 +- deps/v8/src/heap/cppgc/marker.cc | 201 +- deps/v8/src/heap/cppgc/marker.h | 23 +- deps/v8/src/heap/cppgc/marking-state.cc | 22 +- deps/v8/src/heap/cppgc/marking-state.h | 359 ++- deps/v8/src/heap/cppgc/marking-verifier.cc | 96 +- deps/v8/src/heap/cppgc/marking-verifier.h | 49 +- deps/v8/src/heap/cppgc/marking-visitor.cc | 83 +- deps/v8/src/heap/cppgc/marking-visitor.h | 59 +- deps/v8/src/heap/cppgc/marking-worklists.cc | 7 + deps/v8/src/heap/cppgc/marking-worklists.h | 139 +- deps/v8/src/heap/cppgc/name-trait.cc | 41 + deps/v8/src/heap/cppgc/object-allocator.h | 12 +- deps/v8/src/heap/cppgc/object-start-bitmap.h | 58 +- deps/v8/src/heap/cppgc/persistent-node.cc | 9 + deps/v8/src/heap/cppgc/pointer-policies.cc | 12 + deps/v8/src/heap/cppgc/process-heap.cc | 4 + deps/v8/src/heap/cppgc/process-heap.h | 18 + deps/v8/src/heap/cppgc/raw-heap.cc | 13 +- deps/v8/src/heap/cppgc/raw-heap.h | 3 +- deps/v8/src/heap/cppgc/sanitizers.h | 31 +- deps/v8/src/heap/cppgc/sweeper.cc | 59 +- deps/v8/src/heap/cppgc/sweeper.h | 16 +- deps/v8/src/heap/cppgc/trace-trait.cc | 10 +- deps/v8/src/heap/cppgc/visitor.cc | 17 +- deps/v8/src/heap/cppgc/visitor.h | 16 +- deps/v8/src/heap/cppgc/write-barrier.cc | 9 +- deps/v8/src/heap/embedder-tracing.cc | 30 +- deps/v8/src/heap/embedder-tracing.h | 19 + deps/v8/src/heap/factory-base.cc | 54 +- deps/v8/src/heap/factory-base.h | 2 +- deps/v8/src/heap/factory.cc | 525 ++-- deps/v8/src/heap/factory.h | 70 +- deps/v8/src/heap/free-list.cc | 44 - deps/v8/src/heap/free-list.h | 25 - deps/v8/src/heap/gc-tracer.cc | 31 +- deps/v8/src/heap/heap-inl.h | 44 +- deps/v8/src/heap/heap-write-barrier-inl.h | 1 + deps/v8/src/heap/heap.cc | 425 +-- deps/v8/src/heap/heap.h | 106 +- deps/v8/src/heap/incremental-marking.cc | 108 +- deps/v8/src/heap/incremental-marking.h | 3 +- deps/v8/src/heap/local-heap-inl.h | 6 +- deps/v8/src/heap/local-heap.cc | 58 +- deps/v8/src/heap/local-heap.h | 19 +- deps/v8/src/heap/mark-compact-inl.h | 4 +- deps/v8/src/heap/mark-compact.cc | 712 ++--- deps/v8/src/heap/mark-compact.h | 65 +- deps/v8/src/heap/marking-visitor-inl.h | 85 +- deps/v8/src/heap/marking-visitor.h | 53 +- deps/v8/src/heap/memory-allocator.cc | 87 +- deps/v8/src/heap/memory-allocator.h | 18 +- deps/v8/src/heap/memory-chunk-layout.cc | 7 +- deps/v8/src/heap/memory-chunk-layout.h | 2 + deps/v8/src/heap/memory-chunk.h | 1 - deps/v8/src/heap/memory-measurement-inl.h | 6 +- deps/v8/src/heap/memory-measurement.cc | 32 +- deps/v8/src/heap/memory-measurement.h | 5 +- deps/v8/src/heap/new-spaces.cc | 2 +- deps/v8/src/heap/object-stats.cc | 11 +- deps/v8/src/heap/objects-visiting-inl.h | 6 +- deps/v8/src/heap/objects-visiting.cc | 8 +- deps/v8/src/heap/objects-visiting.h | 3 - deps/v8/src/heap/paged-spaces.cc | 61 +- deps/v8/src/heap/paged-spaces.h | 6 +- deps/v8/src/heap/parallel-work-item.h | 32 + deps/v8/src/heap/read-only-heap-inl.h | 4 +- deps/v8/src/heap/read-only-heap.cc | 35 +- deps/v8/src/heap/read-only-heap.h | 9 +- deps/v8/src/heap/read-only-spaces.cc | 21 +- deps/v8/src/heap/read-only-spaces.h | 7 +- deps/v8/src/heap/safepoint.cc | 21 +- deps/v8/src/heap/safepoint.h | 32 +- deps/v8/src/heap/scavenger-inl.h | 18 +- deps/v8/src/heap/scavenger.cc | 212 +- deps/v8/src/heap/scavenger.h | 101 +- deps/v8/src/heap/setup-heap-internal.cc | 43 +- deps/v8/src/heap/spaces.h | 6 +- deps/v8/src/heap/third-party/heap-api.h | 5 + deps/v8/src/heap/weak-object-worklists.cc | 172 ++ deps/v8/src/heap/weak-object-worklists.h | 90 + deps/v8/src/ic/DIR_METADATA | 11 + deps/v8/src/ic/OWNERS | 2 - deps/v8/src/ic/accessor-assembler.cc | 261 +- deps/v8/src/ic/call-optimization.cc | 11 +- deps/v8/src/ic/handler-configuration.cc | 4 +- deps/v8/src/ic/ic-inl.h | 3 +- deps/v8/src/ic/ic.cc | 31 +- deps/v8/src/ic/keyed-store-generic.cc | 18 +- deps/v8/src/init/DIR_METADATA | 11 + deps/v8/src/init/OWNERS | 2 - deps/v8/src/init/bootstrapper.cc | 57 +- deps/v8/src/init/heap-symbols.h | 5 +- deps/v8/src/init/isolate-allocator.cc | 20 +- deps/v8/src/init/isolate-allocator.h | 10 +- deps/v8/src/inspector/DIR_METADATA | 11 + deps/v8/src/inspector/OWNERS | 2 - deps/v8/src/inspector/injected-script.cc | 31 +- deps/v8/src/inspector/remote-object-id.cc | 81 +- deps/v8/src/inspector/remote-object-id.h | 21 +- deps/v8/src/inspector/string-16.h | 2 + deps/v8/src/inspector/v8-console.cc | 1 - .../src/inspector/v8-debugger-agent-impl.cc | 4 +- deps/v8/src/inspector/v8-debugger.cc | 4 + .../inspector/v8-inspector-session-impl.cc | 2 + .../v8/src/inspector/v8-runtime-agent-impl.cc | 80 +- deps/v8/src/inspector/v8-runtime-agent-impl.h | 9 +- deps/v8/src/inspector/v8-stack-trace-impl.cc | 12 + deps/v8/src/inspector/value-mirror.cc | 23 + deps/v8/src/interpreter/DIR_METADATA | 11 + deps/v8/src/interpreter/OWNERS | 2 - .../src/interpreter/bytecode-array-accessor.h | 5 +- .../src/interpreter/bytecode-array-builder.cc | 9 +- .../src/interpreter/bytecode-array-builder.h | 6 +- .../src/interpreter/bytecode-array-iterator.h | 6 +- .../bytecode-array-random-iterator.h | 6 +- .../src/interpreter/bytecode-array-writer.h | 3 +- deps/v8/src/interpreter/bytecode-generator.cc | 48 +- deps/v8/src/interpreter/bytecode-label.h | 4 +- .../interpreter/bytecode-register-allocator.h | 5 +- .../bytecode-register-optimizer.cc | 8 +- .../interpreter/bytecode-register-optimizer.h | 10 +- deps/v8/src/interpreter/bytecode-register.cc | 15 - deps/v8/src/interpreter/bytecodes.h | 1 + .../src/interpreter/constant-array-builder.h | 5 +- .../src/interpreter/handler-table-builder.h | 4 +- .../src/interpreter/interpreter-assembler.cc | 87 +- .../src/interpreter/interpreter-assembler.h | 14 +- .../src/interpreter/interpreter-generator.cc | 139 +- .../interpreter-intrinsics-generator.cc | 199 +- deps/v8/src/interpreter/interpreter.cc | 30 +- deps/v8/src/interpreter/interpreter.h | 4 +- deps/v8/src/json/DIR_METADATA | 11 + deps/v8/src/json/OWNERS | 2 - deps/v8/src/json/json-parser.cc | 18 +- deps/v8/src/json/json-stringifier.cc | 6 +- deps/v8/src/libplatform/DIR_METADATA | 11 + deps/v8/src/libplatform/OWNERS | 2 - deps/v8/src/libplatform/default-job.cc | 27 +- deps/v8/src/libplatform/default-job.h | 20 +- deps/v8/src/libsampler/DIR_METADATA | 11 + deps/v8/src/libsampler/OWNERS | 2 - deps/v8/src/libsampler/sampler.cc | 4 +- deps/v8/src/logging/counters-definitions.h | 11 +- deps/v8/src/logging/counters.cc | 17 +- deps/v8/src/logging/counters.h | 6 +- deps/v8/src/logging/log.cc | 111 +- deps/v8/src/logging/log.h | 2 + deps/v8/src/logging/metrics.h | 7 +- deps/v8/src/numbers/DIR_METADATA | 11 + deps/v8/src/numbers/OWNERS | 2 - deps/v8/src/objects/DIR_METADATA | 11 + deps/v8/src/objects/OWNERS | 2 - deps/v8/src/objects/all-objects-inl.h | 104 + deps/v8/src/objects/allocation-site-inl.h | 2 + deps/v8/src/objects/allocation-site.h | 2 + deps/v8/src/objects/api-callbacks-inl.h | 3 +- deps/v8/src/objects/api-callbacks.h | 3 +- deps/v8/src/objects/arguments-inl.h | 2 + deps/v8/src/objects/arguments.h | 2 + deps/v8/src/objects/backing-store.cc | 78 +- deps/v8/src/objects/backing-store.h | 4 +- deps/v8/src/objects/bigint-inl.h | 24 + deps/v8/src/objects/bigint.cc | 14 +- deps/v8/src/objects/bigint.h | 2 + deps/v8/src/objects/bigint.tq | 21 + deps/v8/src/objects/cell-inl.h | 2 + deps/v8/src/objects/cell.h | 3 +- .../objects/class-definitions-tq-deps-inl.h | 44 - deps/v8/src/objects/code-inl.h | 218 +- deps/v8/src/objects/code-kind.h | 93 +- deps/v8/src/objects/code.cc | 76 +- deps/v8/src/objects/code.h | 340 ++- ...he-inl.h => compilation-cache-table-inl.h} | 9 +- .../v8/src/objects/compilation-cache-table.cc | 447 +++ ...tion-cache.h => compilation-cache-table.h} | 62 +- deps/v8/src/objects/compressed-slots-inl.h | 18 +- deps/v8/src/objects/compressed-slots.h | 16 +- deps/v8/src/objects/contexts-inl.h | 24 +- deps/v8/src/objects/contexts.h | 7 +- deps/v8/src/objects/data-handler-inl.h | 2 + deps/v8/src/objects/data-handler.h | 3 + deps/v8/src/objects/debug-objects-inl.h | 2 + deps/v8/src/objects/debug-objects.h | 2 + deps/v8/src/objects/descriptor-array-inl.h | 23 +- deps/v8/src/objects/descriptor-array.h | 16 +- deps/v8/src/objects/descriptor-array.tq | 8 +- deps/v8/src/objects/dictionary-inl.h | 20 +- deps/v8/src/objects/dictionary.h | 40 +- deps/v8/src/objects/elements.cc | 21 +- deps/v8/src/objects/elements.h | 4 +- deps/v8/src/objects/embedder-data-array-inl.h | 5 +- deps/v8/src/objects/embedder-data-array.h | 3 +- deps/v8/src/objects/embedder-data-slot-inl.h | 90 +- deps/v8/src/objects/embedder-data-slot.h | 28 +- deps/v8/src/objects/feedback-cell-inl.h | 13 + deps/v8/src/objects/feedback-cell.h | 7 + deps/v8/src/objects/feedback-vector-inl.h | 202 +- deps/v8/src/objects/feedback-vector.cc | 381 +-- deps/v8/src/objects/feedback-vector.h | 217 +- deps/v8/src/objects/feedback-vector.tq | 18 +- deps/v8/src/objects/field-index-inl.h | 8 +- deps/v8/src/objects/field-index.h | 2 +- deps/v8/src/objects/fixed-array-inl.h | 32 +- deps/v8/src/objects/fixed-array.h | 31 +- deps/v8/src/objects/foreign-inl.h | 16 +- deps/v8/src/objects/foreign.h | 5 +- deps/v8/src/objects/foreign.tq | 3 + deps/v8/src/objects/free-space-inl.h | 2 + deps/v8/src/objects/free-space.h | 3 +- deps/v8/src/objects/hash-table-inl.h | 17 +- deps/v8/src/objects/hash-table.h | 18 +- deps/v8/src/objects/heap-number-inl.h | 2 + deps/v8/src/objects/heap-number.h | 2 + deps/v8/src/objects/heap-object.h | 16 +- deps/v8/src/objects/internal-index.h | 8 +- deps/v8/src/objects/intl-objects.cc | 69 +- deps/v8/src/objects/intl-objects.tq | 153 - deps/v8/src/objects/js-array-buffer-inl.h | 85 +- deps/v8/src/objects/js-array-buffer.cc | 1 + deps/v8/src/objects/js-array-buffer.h | 24 +- deps/v8/src/objects/js-array-buffer.tq | 5 + deps/v8/src/objects/js-break-iterator-inl.h | 2 + deps/v8/src/objects/js-break-iterator.h | 2 + deps/v8/src/objects/js-break-iterator.tq | 17 + deps/v8/src/objects/js-collator-inl.h | 2 + deps/v8/src/objects/js-collator.h | 2 + deps/v8/src/objects/js-collator.tq | 12 + deps/v8/src/objects/js-collection-inl.h | 14 +- .../src/objects/js-collection-iterator-inl.h | 26 + deps/v8/src/objects/js-collection-iterator.h | 2 + deps/v8/src/objects/js-collection.h | 2 + deps/v8/src/objects/js-date-time-format-inl.h | 2 + deps/v8/src/objects/js-date-time-format.h | 2 + deps/v8/src/objects/js-date-time-format.tq | 23 + deps/v8/src/objects/js-display-names-inl.h | 2 + deps/v8/src/objects/js-display-names.h | 2 + deps/v8/src/objects/js-display-names.tq | 19 + deps/v8/src/objects/js-function-inl.h | 23 +- deps/v8/src/objects/js-function.cc | 52 +- deps/v8/src/objects/js-function.h | 8 +- deps/v8/src/objects/js-function.tq | 34 + deps/v8/src/objects/js-generator-inl.h | 2 + deps/v8/src/objects/js-generator.h | 2 + deps/v8/src/objects/js-list-format-inl.h | 2 + deps/v8/src/objects/js-list-format.cc | 55 +- deps/v8/src/objects/js-list-format.h | 2 + deps/v8/src/objects/js-list-format.tq | 19 + deps/v8/src/objects/js-locale-inl.h | 2 + deps/v8/src/objects/js-locale.h | 2 + deps/v8/src/objects/js-locale.tq | 10 + deps/v8/src/objects/js-number-format-inl.h | 2 + deps/v8/src/objects/js-number-format.cc | 80 +- deps/v8/src/objects/js-number-format.h | 2 + deps/v8/src/objects/js-number-format.tq | 13 + deps/v8/src/objects/js-objects-inl.h | 46 +- deps/v8/src/objects/js-objects.cc | 303 +- deps/v8/src/objects/js-objects.h | 23 +- deps/v8/src/objects/js-objects.tq | 31 - deps/v8/src/objects/js-plural-rules-inl.h | 2 + deps/v8/src/objects/js-plural-rules.h | 2 + deps/v8/src/objects/js-plural-rules.tq | 19 + deps/v8/src/objects/js-promise-inl.h | 2 + deps/v8/src/objects/js-promise.h | 2 + deps/v8/src/objects/js-proxy-inl.h | 2 + deps/v8/src/objects/js-proxy.h | 2 + deps/v8/src/objects/js-regexp-inl.h | 2 + .../objects/js-regexp-string-iterator-inl.h | 2 + .../src/objects/js-regexp-string-iterator.h | 2 + deps/v8/src/objects/js-regexp.cc | 7 - deps/v8/src/objects/js-regexp.h | 9 +- deps/v8/src/objects/js-regexp.tq | 1 + .../src/objects/js-relative-time-format-inl.h | 2 + .../v8/src/objects/js-relative-time-format.cc | 9 +- deps/v8/src/objects/js-relative-time-format.h | 2 + .../v8/src/objects/js-relative-time-format.tq | 19 + deps/v8/src/objects/js-segment-iterator-inl.h | 2 + deps/v8/src/objects/js-segment-iterator.h | 2 + deps/v8/src/objects/js-segment-iterator.tq | 16 + deps/v8/src/objects/js-segmenter-inl.h | 2 + deps/v8/src/objects/js-segmenter.h | 2 + deps/v8/src/objects/js-segmenter.tq | 18 + deps/v8/src/objects/js-segments-inl.h | 2 + deps/v8/src/objects/js-segments.h | 2 + deps/v8/src/objects/js-segments.tq | 16 + deps/v8/src/objects/js-weak-refs-inl.h | 2 + deps/v8/src/objects/js-weak-refs.h | 2 + deps/v8/src/objects/keys.cc | 283 +- deps/v8/src/objects/keys.h | 89 +- deps/v8/src/objects/layout-descriptor-inl.h | 7 +- deps/v8/src/objects/layout-descriptor.cc | 16 +- deps/v8/src/objects/literal-objects-inl.h | 10 +- deps/v8/src/objects/literal-objects.cc | 5 +- deps/v8/src/objects/literal-objects.h | 6 +- deps/v8/src/objects/lookup-cache.h | 3 +- deps/v8/src/objects/lookup.cc | 119 +- deps/v8/src/objects/map-inl.h | 57 +- deps/v8/src/objects/map-updater.cc | 26 +- deps/v8/src/objects/map.cc | 155 +- deps/v8/src/objects/map.h | 21 +- deps/v8/src/objects/maybe-object-inl.h | 11 +- deps/v8/src/objects/maybe-object.h | 6 +- deps/v8/src/objects/microtask-inl.h | 2 + deps/v8/src/objects/microtask.h | 2 + deps/v8/src/objects/module-inl.h | 18 +- deps/v8/src/objects/module.cc | 38 +- deps/v8/src/objects/module.h | 8 + deps/v8/src/objects/name-inl.h | 2 + deps/v8/src/objects/name.h | 2 + deps/v8/src/objects/object-list-macros.h | 2 - deps/v8/src/objects/object-macros-undef.h | 6 +- deps/v8/src/objects/object-macros.h | 94 +- .../objects/objects-body-descriptors-inl.h | 10 +- deps/v8/src/objects/objects-definitions.h | 3 +- deps/v8/src/objects/objects-inl.h | 61 +- deps/v8/src/objects/objects.cc | 677 +---- deps/v8/src/objects/objects.h | 22 +- deps/v8/src/objects/oddball-inl.h | 2 + deps/v8/src/objects/oddball.h | 7 +- deps/v8/src/objects/oddball.tq | 6 +- deps/v8/src/objects/ordered-hash-table-inl.h | 64 +- deps/v8/src/objects/ordered-hash-table.cc | 415 ++- deps/v8/src/objects/ordered-hash-table.h | 187 +- deps/v8/src/objects/ordered-hash-table.tq | 3 - .../src/objects/primitive-heap-object-inl.h | 3 +- deps/v8/src/objects/primitive-heap-object.h | 3 +- deps/v8/src/objects/promise-inl.h | 2 + deps/v8/src/objects/promise.h | 2 + deps/v8/src/objects/property-array-inl.h | 4 +- deps/v8/src/objects/property-array.h | 2 +- .../objects/property-descriptor-object-inl.h | 2 + .../src/objects/property-descriptor-object.h | 2 + deps/v8/src/objects/property-descriptor.cc | 2 +- deps/v8/src/objects/property.cc | 2 +- deps/v8/src/objects/prototype-info-inl.h | 2 + deps/v8/src/objects/prototype-info.h | 2 + deps/v8/src/objects/prototype.h | 4 +- deps/v8/src/objects/regexp-match-info.h | 3 + deps/v8/src/objects/scope-info.cc | 22 +- deps/v8/src/objects/script-inl.h | 2 + deps/v8/src/objects/script.h | 5 +- .../v8/src/objects/shared-function-info-inl.h | 149 +- deps/v8/src/objects/shared-function-info.cc | 26 +- deps/v8/src/objects/shared-function-info.h | 31 +- deps/v8/src/objects/shared-function-info.tq | 1 - deps/v8/src/objects/slots-inl.h | 12 +- deps/v8/src/objects/slots.h | 12 +- deps/v8/src/objects/source-text-module-inl.h | 29 + deps/v8/src/objects/source-text-module.cc | 33 +- deps/v8/src/objects/source-text-module.h | 18 +- deps/v8/src/objects/source-text-module.tq | 10 + deps/v8/src/objects/stack-frame-info-inl.h | 2 + deps/v8/src/objects/stack-frame-info.cc | 3 + deps/v8/src/objects/stack-frame-info.h | 2 + deps/v8/src/objects/string-comparator.cc | 2 +- deps/v8/src/objects/string-comparator.h | 9 +- deps/v8/src/objects/string-inl.h | 164 +- deps/v8/src/objects/string-table.cc | 45 +- deps/v8/src/objects/string-table.h | 4 +- deps/v8/src/objects/string.cc | 83 +- deps/v8/src/objects/string.h | 73 +- deps/v8/src/objects/string.tq | 5 + deps/v8/src/objects/struct-inl.h | 3 +- deps/v8/src/objects/struct.h | 3 +- deps/v8/src/objects/synthetic-module-inl.h | 27 + deps/v8/src/objects/synthetic-module.cc | 3 +- deps/v8/src/objects/synthetic-module.h | 2 + deps/v8/src/objects/tagged-field-inl.h | 12 +- deps/v8/src/objects/tagged-field.h | 12 +- deps/v8/src/objects/template-objects-inl.h | 2 + deps/v8/src/objects/template-objects.h | 2 + deps/v8/src/objects/templates-inl.h | 13 + deps/v8/src/objects/templates.h | 5 + .../src/objects/{template.tq => templates.tq} | 3 +- .../src/objects/torque-defined-classes-inl.h | 23 + deps/v8/src/objects/torque-defined-classes.h | 25 + deps/v8/src/objects/torque-defined-classes.tq | 17 + deps/v8/src/objects/transitions-inl.h | 16 +- deps/v8/src/objects/transitions.cc | 7 +- deps/v8/src/objects/value-serializer.cc | 64 +- deps/v8/src/objects/value-serializer.h | 8 +- deps/v8/src/parsing/DIR_METADATA | 11 + deps/v8/src/parsing/OWNERS | 2 - deps/v8/src/parsing/parse-info.cc | 2 - deps/v8/src/parsing/parse-info.h | 2 - deps/v8/src/parsing/parser-base.h | 51 +- deps/v8/src/parsing/parser.cc | 236 +- deps/v8/src/parsing/parser.h | 16 +- deps/v8/src/parsing/rewriter.cc | 49 +- .../src/parsing/scanner-character-streams.cc | 4 +- deps/v8/src/profiler/DIR_METADATA | 11 + deps/v8/src/profiler/OWNERS | 2 - deps/v8/src/profiler/cpu-profiler.cc | 69 +- deps/v8/src/profiler/cpu-profiler.h | 26 +- deps/v8/src/profiler/heap-profiler.cc | 13 + deps/v8/src/profiler/heap-profiler.h | 10 + .../src/profiler/heap-snapshot-generator.cc | 83 +- .../v8/src/profiler/heap-snapshot-generator.h | 15 +- deps/v8/src/profiler/profile-generator-inl.h | 7 - deps/v8/src/profiler/profile-generator.cc | 198 +- deps/v8/src/profiler/profile-generator.h | 34 +- deps/v8/src/profiler/symbolizer.cc | 190 ++ deps/v8/src/profiler/symbolizer.h | 44 + deps/v8/src/regexp/DIR_METADATA | 11 + deps/v8/src/regexp/OWNERS | 2 - .../regexp/arm/regexp-macro-assembler-arm.cc | 17 +- .../regexp/arm/regexp-macro-assembler-arm.h | 1 + .../arm64/regexp-macro-assembler-arm64.cc | 17 +- .../arm64/regexp-macro-assembler-arm64.h | 1 + .../experimental/experimental-bytecode.h | 8 +- .../experimental/experimental-compiler.cc | 239 +- .../experimental/experimental-interpreter.cc | 176 +- .../experimental/experimental-interpreter.h | 18 +- .../src/regexp/experimental/experimental.cc | 220 +- .../v8/src/regexp/experimental/experimental.h | 14 +- .../ia32/regexp-macro-assembler-ia32.cc | 16 +- .../regexp/ia32/regexp-macro-assembler-ia32.h | 1 + .../mips/regexp-macro-assembler-mips.cc | 16 +- .../regexp/mips/regexp-macro-assembler-mips.h | 1 + .../mips64/regexp-macro-assembler-mips64.cc | 16 +- .../mips64/regexp-macro-assembler-mips64.h | 1 + deps/v8/src/regexp/ppc/OWNERS | 1 + .../regexp/ppc/regexp-macro-assembler-ppc.cc | 20 +- .../regexp/ppc/regexp-macro-assembler-ppc.h | 1 + .../src/regexp/regexp-bytecode-generator.cc | 8 +- deps/v8/src/regexp/regexp-compiler.cc | 6 +- deps/v8/src/regexp/regexp-error.h | 1 + deps/v8/src/regexp/regexp-interpreter.cc | 8 +- deps/v8/src/regexp/regexp-interpreter.h | 1 + deps/v8/src/regexp/regexp-macro-assembler.cc | 2 +- deps/v8/src/regexp/regexp-macro-assembler.h | 22 +- deps/v8/src/regexp/regexp-parser.cc | 9 - deps/v8/src/regexp/regexp-parser.h | 4 - deps/v8/src/regexp/regexp-stack.cc | 17 +- deps/v8/src/regexp/regexp-stack.h | 15 +- deps/v8/src/regexp/regexp-utils.cc | 7 +- deps/v8/src/regexp/regexp.cc | 83 +- deps/v8/src/regexp/regexp.h | 11 + .../s390/regexp-macro-assembler-s390.cc | 16 +- .../regexp/s390/regexp-macro-assembler-s390.h | 1 + .../regexp/x64/regexp-macro-assembler-x64.cc | 16 +- .../regexp/x64/regexp-macro-assembler-x64.h | 1 + deps/v8/src/roots/DIR_METADATA | 11 + deps/v8/src/roots/OWNERS | 2 - deps/v8/src/roots/roots.h | 7 +- deps/v8/src/runtime/DIR_METADATA | 11 + deps/v8/src/runtime/OWNERS | 2 - deps/v8/src/runtime/runtime-array.cc | 5 - deps/v8/src/runtime/runtime-classes.cc | 10 +- deps/v8/src/runtime/runtime-compiler.cc | 53 +- deps/v8/src/runtime/runtime-debug.cc | 2 +- deps/v8/src/runtime/runtime-literals.cc | 9 +- deps/v8/src/runtime/runtime-numbers.cc | 9 - deps/v8/src/runtime/runtime-object.cc | 13 +- deps/v8/src/runtime/runtime-regexp.cc | 17 + deps/v8/src/runtime/runtime-scopes.cc | 3 +- deps/v8/src/runtime/runtime-test.cc | 29 +- deps/v8/src/runtime/runtime-wasm.cc | 94 +- deps/v8/src/runtime/runtime.h | 9 +- deps/v8/src/snapshot/DIR_METADATA | 11 + deps/v8/src/snapshot/OWNERS | 2 - deps/v8/src/snapshot/code-serializer.cc | 136 +- deps/v8/src/snapshot/code-serializer.h | 26 +- deps/v8/src/snapshot/context-deserializer.cc | 37 +- deps/v8/src/snapshot/context-deserializer.h | 8 +- deps/v8/src/snapshot/context-serializer.cc | 75 +- deps/v8/src/snapshot/context-serializer.h | 7 +- .../v8/src/snapshot/deserializer-allocator.cc | 217 -- deps/v8/src/snapshot/deserializer-allocator.h | 104 - deps/v8/src/snapshot/deserializer.cc | 961 +++--- deps/v8/src/snapshot/deserializer.h | 178 +- .../v8/src/snapshot/embedded/embedded-data.cc | 240 +- deps/v8/src/snapshot/embedded/embedded-data.h | 157 +- .../src/snapshot/embedded/embedded-empty.cc | 16 +- .../snapshot/embedded/embedded-file-writer.cc | 120 +- .../snapshot/embedded/embedded-file-writer.h | 42 +- .../platform-embedded-file-writer-aix.cc | 4 + .../platform-embedded-file-writer-generic.cc | 3 + .../platform-embedded-file-writer-mac.cc | 4 + .../platform-embedded-file-writer-win.cc | 4 +- deps/v8/src/snapshot/object-deserializer.cc | 44 +- deps/v8/src/snapshot/object-deserializer.h | 4 +- .../v8/src/snapshot/read-only-deserializer.cc | 23 +- deps/v8/src/snapshot/read-only-deserializer.h | 9 +- deps/v8/src/snapshot/read-only-serializer.cc | 53 +- deps/v8/src/snapshot/read-only-serializer.h | 11 +- deps/v8/src/snapshot/references.h | 177 +- deps/v8/src/snapshot/roots-serializer.cc | 3 +- deps/v8/src/snapshot/roots-serializer.h | 6 +- deps/v8/src/snapshot/serializer-allocator.cc | 167 -- deps/v8/src/snapshot/serializer-allocator.h | 78 - .../src/snapshot/serializer-deserializer.cc | 31 +- .../v8/src/snapshot/serializer-deserializer.h | 99 +- deps/v8/src/snapshot/serializer.cc | 720 +++-- deps/v8/src/snapshot/serializer.h | 176 +- deps/v8/src/snapshot/snapshot-data.cc | 31 +- deps/v8/src/snapshot/snapshot-data.h | 30 +- deps/v8/src/snapshot/snapshot-source-sink.h | 30 +- deps/v8/src/snapshot/snapshot-utils.cc | 15 - deps/v8/src/snapshot/snapshot-utils.h | 2 - deps/v8/src/snapshot/snapshot.cc | 63 +- deps/v8/src/snapshot/startup-deserializer.cc | 65 +- deps/v8/src/snapshot/startup-deserializer.h | 10 +- deps/v8/src/snapshot/startup-serializer.cc | 76 +- deps/v8/src/snapshot/startup-serializer.h | 16 +- deps/v8/src/strings/DIR_METADATA | 11 + deps/v8/src/strings/OWNERS | 2 - deps/v8/src/strings/char-predicates-inl.h | 96 +- deps/v8/src/strings/string-stream.cc | 2 +- deps/v8/src/strings/unicode-inl.h | 19 + deps/v8/src/strings/unicode.h | 2 + deps/v8/src/torque/ast.h | 82 +- deps/v8/src/torque/cc-generator.cc | 460 +++ deps/v8/src/torque/cc-generator.h | 46 + deps/v8/src/torque/constants.h | 14 +- deps/v8/src/torque/csa-generator.cc | 83 +- deps/v8/src/torque/csa-generator.h | 76 +- deps/v8/src/torque/declarable.h | 46 +- deps/v8/src/torque/declarations.cc | 1 + deps/v8/src/torque/global-context.h | 14 + deps/v8/src/torque/implementation-visitor.cc | 773 ++--- deps/v8/src/torque/implementation-visitor.h | 48 +- deps/v8/src/torque/instance-type-generator.cc | 2 +- deps/v8/src/torque/instructions.h | 56 +- deps/v8/src/torque/runtime-macro-shims.h | 36 + deps/v8/src/torque/torque-code-generator.cc | 60 + deps/v8/src/torque/torque-code-generator.h | 93 + deps/v8/src/torque/torque-compiler.cc | 6 +- deps/v8/src/torque/torque-parser.cc | 64 +- deps/v8/src/torque/type-visitor.cc | 32 +- deps/v8/src/torque/types.cc | 252 +- deps/v8/src/torque/types.h | 47 +- deps/v8/src/tracing/DIR_METADATA | 11 + deps/v8/src/tracing/OWNERS | 2 - deps/v8/src/tracing/trace-categories.h | 1 + deps/v8/src/trap-handler/DIR_METADATA | 11 + deps/v8/src/trap-handler/OWNERS | 2 - deps/v8/src/trap-handler/handler-outside.cc | 12 +- deps/v8/src/trap-handler/trap-handler.h | 21 +- deps/v8/src/utils/DIR_METADATA | 11 + deps/v8/src/utils/OWNERS | 2 - deps/v8/src/utils/bit-vector.cc | 2 +- deps/v8/src/utils/bit-vector.h | 2 +- deps/v8/src/utils/identity-map.cc | 144 +- deps/v8/src/utils/identity-map.h | 71 +- deps/v8/src/utils/locked-queue-inl.h | 6 +- deps/v8/src/utils/locked-queue.h | 2 +- deps/v8/src/utils/utils.h | 73 +- deps/v8/src/wasm/DIR_METADATA | 11 + deps/v8/src/wasm/OWNERS | 2 - .../wasm/baseline/arm/liftoff-assembler-arm.h | 108 +- .../baseline/arm64/liftoff-assembler-arm64.h | 123 +- .../baseline/ia32/liftoff-assembler-ia32.h | 122 +- .../v8/src/wasm/baseline/liftoff-assembler.cc | 23 +- deps/v8/src/wasm/baseline/liftoff-assembler.h | 59 +- deps/v8/src/wasm/baseline/liftoff-compiler.cc | 242 +- deps/v8/src/wasm/baseline/liftoff-register.h | 4 +- .../baseline/mips/liftoff-assembler-mips.h | 76 +- .../mips64/liftoff-assembler-mips64.h | 101 +- deps/v8/src/wasm/baseline/ppc/OWNERS | 1 + .../wasm/baseline/ppc/liftoff-assembler-ppc.h | 60 +- .../baseline/s390/liftoff-assembler-s390.h | 60 +- .../wasm/baseline/x64/liftoff-assembler-x64.h | 127 +- deps/v8/src/wasm/c-api.cc | 12 +- deps/v8/src/wasm/decoder.h | 189 +- deps/v8/src/wasm/function-body-decoder-impl.h | 1221 ++++---- deps/v8/src/wasm/function-body-decoder.cc | 44 +- deps/v8/src/wasm/function-body-decoder.h | 4 +- deps/v8/src/wasm/function-compiler.cc | 22 +- deps/v8/src/wasm/function-compiler.h | 18 +- deps/v8/src/wasm/graph-builder-interface.cc | 53 +- deps/v8/src/wasm/memory-tracing.cc | 41 +- deps/v8/src/wasm/memory-tracing.h | 8 +- deps/v8/src/wasm/module-compiler.cc | 901 +++--- deps/v8/src/wasm/module-compiler.h | 3 - deps/v8/src/wasm/module-decoder.cc | 81 +- deps/v8/src/wasm/module-instantiate.cc | 62 +- deps/v8/src/wasm/streaming-decoder.cc | 13 +- deps/v8/src/wasm/value-type.h | 133 +- deps/v8/src/wasm/wasm-code-manager.cc | 50 +- deps/v8/src/wasm/wasm-code-manager.h | 25 +- deps/v8/src/wasm/wasm-constants.h | 5 + deps/v8/src/wasm/wasm-debug-evaluate.cc | 8 +- deps/v8/src/wasm/wasm-debug-evaluate.h | 6 +- deps/v8/src/wasm/wasm-debug.cc | 81 +- deps/v8/src/wasm/wasm-debug.h | 4 + deps/v8/src/wasm/wasm-engine.cc | 5 +- deps/v8/src/wasm/wasm-engine.h | 4 +- deps/v8/src/wasm/wasm-external-refs.cc | 60 +- deps/v8/src/wasm/wasm-js.cc | 785 ++++- deps/v8/src/wasm/wasm-js.h | 4 + deps/v8/src/wasm/wasm-module-builder.cc | 2 +- deps/v8/src/wasm/wasm-module-builder.h | 4 +- deps/v8/src/wasm/wasm-module.cc | 11 +- deps/v8/src/wasm/wasm-module.h | 47 +- deps/v8/src/wasm/wasm-objects-inl.h | 25 +- deps/v8/src/wasm/wasm-objects.cc | 73 +- deps/v8/src/wasm/wasm-objects.h | 32 +- deps/v8/src/wasm/wasm-objects.tq | 13 +- deps/v8/src/wasm/wasm-opcodes-inl.h | 49 +- deps/v8/src/wasm/wasm-opcodes.h | 126 +- deps/v8/src/wasm/wasm-result.h | 9 +- deps/v8/src/wasm/wasm-serialization.cc | 14 +- deps/v8/src/wasm/wasm-value.h | 11 + deps/v8/src/zone/zone-containers.h | 4 +- deps/v8/test/BUILD.gn | 1 + deps/v8/test/cctest/BUILD.gn | 5 + deps/v8/test/cctest/assembler-helper-arm.cc | 2 +- deps/v8/test/cctest/cctest-utils.h | 60 + deps/v8/test/cctest/cctest.cc | 2 +- deps/v8/test/cctest/cctest.h | 5 +- deps/v8/test/cctest/cctest.status | 42 +- .../cctest/compiler/code-assembler-tester.h | 20 +- deps/v8/test/cctest/compiler/codegen-tester.h | 2 +- .../test/cctest/compiler/function-tester.cc | 2 +- .../cctest/compiler/test-code-assembler.cc | 21 +- .../cctest/compiler/test-code-generator.cc | 18 +- .../test-js-context-specialization.cc | 14 +- deps/v8/test/cctest/compiler/test-linkage.cc | 13 +- .../cctest/compiler/test-multiple-return.cc | 23 +- .../compiler/test-representation-change.cc | 24 +- .../test-run-bytecode-graph-builder.cc | 6 +- .../test-run-calls-to-external-references.cc | 4 +- .../test/cctest/compiler/test-run-machops.cc | 20 +- .../cctest/compiler/test-run-native-calls.cc | 2 +- .../cctest/compiler/test-run-retpoline.cc | 4 +- .../cctest/compiler/test-run-tail-calls.cc | 4 +- deps/v8/test/cctest/compiler/value-helper.h | 2 + deps/v8/test/cctest/heap/heap-tester.h | 2 +- deps/v8/test/cctest/heap/test-alloc.cc | 7 +- .../cctest/heap/test-array-buffer-tracker.cc | 2 +- deps/v8/test/cctest/heap/test-compaction.cc | 31 + .../cctest/heap/test-concurrent-allocation.cc | 81 +- .../cctest/heap/test-concurrent-marking.cc | 27 +- .../test/cctest/heap/test-embedder-tracing.cc | 118 +- deps/v8/test/cctest/heap/test-heap.cc | 198 +- .../cctest/heap/test-memory-measurement.cc | 59 +- deps/v8/test/cctest/heap/test-spaces.cc | 20 +- deps/v8/test/cctest/heap/test-unmapper.cc | 22 +- .../test/cctest/heap/test-weak-references.cc | 2 +- .../ClassAndSuperClass.golden | 6 +- .../PrivateAccessorAccess.golden | 8 +- .../PrivateMethodAccess.golden | 4 +- .../StaticPrivateMethodAccess.golden | 20 +- .../SuperCallAndSpread.golden | 9 +- .../generate-bytecode-expectations.cc | 4 +- .../cctest/interpreter/interpreter-tester.h | 7 +- .../interpreter/test-bytecode-generator.cc | 4 + .../test-interpreter-intrinsics.cc | 7 - .../test/cctest/libplatform/test-tracing.cc | 14 +- .../v8/test/cctest/test-accessor-assembler.cc | 13 +- deps/v8/test/cctest/test-accessors.cc | 24 + deps/v8/test/cctest/test-api-icu.cc | 2 +- deps/v8/test/cctest/test-api.cc | 710 ++++- deps/v8/test/cctest/test-assembler-arm.cc | 86 +- deps/v8/test/cctest/test-assembler-arm64.cc | 43 +- deps/v8/test/cctest/test-assembler-ia32.cc | 71 +- deps/v8/test/cctest/test-assembler-mips.cc | 166 +- deps/v8/test/cctest/test-assembler-mips64.cc | 186 +- deps/v8/test/cctest/test-assembler-ppc.cc | 24 +- deps/v8/test/cctest/test-assembler-s390.cc | 38 +- deps/v8/test/cctest/test-assembler-x64.cc | 34 +- deps/v8/test/cctest/test-code-layout.cc | 37 +- deps/v8/test/cctest/test-code-pages.cc | 6 +- .../test/cctest/test-code-stub-assembler.cc | 584 ++-- deps/v8/test/cctest/test-compiler.cc | 29 +- .../test-concurrent-descriptor-array.cc | 9 +- .../cctest/test-concurrent-feedback-vector.cc | 268 ++ .../test/cctest/test-concurrent-prototype.cc | 7 +- .../test-concurrent-script-context-table.cc | 18 +- .../test-concurrent-transition-array.cc | 11 +- deps/v8/test/cctest/test-cpu-profiler.cc | 248 +- deps/v8/test/cctest/test-descriptor-array.cc | 26 +- deps/v8/test/cctest/test-disasm-arm.cc | 14 + deps/v8/test/cctest/test-disasm-ia32.cc | 2 +- deps/v8/test/cctest/test-disasm-x64.cc | 18 +- deps/v8/test/cctest/test-factory.cc | 3 +- deps/v8/test/cctest/test-feedback-vector.cc | 4 +- .../test/cctest/test-field-type-tracking.cc | 47 +- deps/v8/test/cctest/test-global-handles.cc | 12 +- deps/v8/test/cctest/test-heap-profiler.cc | 21 +- deps/v8/test/cctest/test-identity-map.cc | 153 +- deps/v8/test/cctest/test-local-handles.cc | 9 +- deps/v8/test/cctest/test-lockers.cc | 4 +- deps/v8/test/cctest/test-log.cc | 9 +- .../test/cctest/test-macro-assembler-arm.cc | 28 +- .../test/cctest/test-macro-assembler-arm64.cc | 37 +- .../test/cctest/test-macro-assembler-mips.cc | 26 +- .../cctest/test-macro-assembler-mips64.cc | 32 +- .../test/cctest/test-macro-assembler-x64.cc | 29 +- deps/v8/test/cctest/test-modules.cc | 133 +- deps/v8/test/cctest/test-object.cc | 90 +- deps/v8/test/cctest/test-orderedhashtable.cc | 495 +++- deps/v8/test/cctest/test-parsing.cc | 558 +++- .../v8/test/cctest/test-persistent-handles.cc | 21 +- deps/v8/test/cctest/test-platform.cc | 35 +- .../v8/test/cctest/test-pointer-auth-arm64.cc | 3 + deps/v8/test/cctest/test-profile-generator.cc | 120 +- deps/v8/test/cctest/test-regexp.cc | 56 +- deps/v8/test/cctest/test-serialize.cc | 103 +- .../test/cctest/test-stack-unwinding-win64.cc | 2 +- deps/v8/test/cctest/test-strings.cc | 8 +- .../test/cctest/test-sync-primitives-arm64.cc | 4 +- .../v8/test/cctest/test-thread-termination.cc | 6 + deps/v8/test/cctest/test-trace-event.cc | 4 +- deps/v8/test/cctest/test-unboxed-doubles.cc | 66 +- .../test/cctest/test-unwinder-code-pages.cc | 251 +- deps/v8/test/cctest/test-verifiers.cc | 187 ++ deps/v8/test/cctest/torque/test-torque.cc | 41 +- deps/v8/test/cctest/wasm/DIR_METADATA | 11 + deps/v8/test/cctest/wasm/OWNERS | 2 - deps/v8/test/cctest/wasm/test-c-wasm-entry.cc | 7 +- deps/v8/test/cctest/wasm/test-gc.cc | 19 + .../cctest/wasm/test-jump-table-assembler.cc | 10 +- deps/v8/test/cctest/wasm/test-run-wasm-64.cc | 16 +- .../test-run-wasm-simd-scalar-lowering.cc | 53 + .../v8/test/cctest/wasm/test-run-wasm-simd.cc | 977 +++++-- .../cctest/wasm/test-run-wasm-wrappers.cc | 184 ++ deps/v8/test/cctest/wasm/test-run-wasm.cc | 23 + .../cctest/wasm/test-streaming-compilation.cc | 165 +- .../cctest/wasm/test-wasm-debug-evaluate.cc | 120 + deps/v8/test/cctest/wasm/test-wasm-metrics.cc | 79 +- deps/v8/test/cctest/wasm/wasm-run-utils.cc | 5 +- deps/v8/test/cctest/wasm/wasm-run-utils.h | 7 +- deps/v8/test/common/flag-utils.h | 38 + deps/v8/test/common/wasm/flag-utils.h | 23 +- deps/v8/test/common/wasm/wasm-interpreter.cc | 616 ++-- deps/v8/test/common/wasm/wasm-interpreter.h | 5 +- deps/v8/test/common/wasm/wasm-macro-gen.h | 6 +- .../v8/test/common/wasm/wasm-module-runner.cc | 8 + .../debug-evaluate-no-side-effect-builtins.js | 2 + deps/v8/test/debugger/test-api.js | 2 +- .../debugging/wasm/gdb-server/DIR_METADATA | 11 + deps/v8/test/debugging/wasm/gdb-server/OWNERS | 2 - deps/v8/test/fuzzer/BUILD.gn | 3 +- deps/v8/test/fuzzer/inspector-fuzzer.cc | 616 ++++ deps/v8/test/fuzzer/inspector/empty | 0 deps/v8/test/fuzzer/inspector/invalid | 1 + deps/v8/test/fuzzer/multi-return.cc | 5 +- deps/v8/test/fuzzer/regexp-builtins.cc | 7 +- deps/v8/test/fuzzer/testcfg.py | 3 +- deps/v8/test/fuzzer/wasm-async.cc | 18 +- deps/v8/test/fuzzer/wasm-compile.cc | 29 +- deps/v8/test/fuzzer/wasm-fuzzer-common.cc | 18 +- deps/v8/test/fuzzer/wasm-fuzzer-common.h | 6 + deps/v8/test/fuzzer/wasm.cc | 11 +- deps/v8/test/fuzzilli/README.md | 9 +- deps/v8/test/fuzzilli/main.cc | 64 +- deps/v8/test/inspector/BUILD.gn | 30 +- deps/v8/test/inspector/DEPS | 8 +- deps/v8/test/inspector/DIR_METADATA | 11 + deps/v8/test/inspector/OWNERS | 2 - .../cpu-profiler/console-profile-wasm.js | 14 +- ...private-methods-static-nested-expected.txt | 2 +- .../class-private-methods-static-nested.js | 2 +- .../class-private-methods-unused-expected.txt | 20 +- .../debugger/class-private-methods-unused.js | 10 +- ... => destroy-in-break-program-expected.txt} | 0 ...program.js => destroy-in-break-program.js} | 0 .../destroy-in-break-program2-expected.txt | 3 + .../debugger/destroy-in-break-program2.js | 49 + .../debugger/pause-on-oom-expected.txt | 1 + .../pause-on-oom-extrawide-expected.txt | 1 + .../debugger/pause-on-oom-wide-expected.txt | 1 + ...int-reset-on-debugger-restart-expected.txt | 2 +- .../debugger/wasm-debug-command-expected.txt | 2 +- .../debugger/wasm-imports-expected.txt | 4 +- .../wasm-remove-breakpoint-expected.txt | 2 +- .../debugger/wasm-scope-info-expected.txt | 278 +- .../wasm-scope-info-liftoff-expected.txt | 79 +- .../debugger/wasm-scope-info-liftoff.js | 1 + .../inspector/debugger/wasm-scope-info.js | 4 + .../wasm-set-breakpoint-liftoff-expected.txt | 58 +- .../wasm-step-after-trap-expected.txt | 4 +- ...p-from-non-breakable-position-expected.txt | 12 + .../wasm-step-from-non-breakable-position.js | 54 + .../wasm-stepping-byte-offsets-expected.txt | 317 -- .../debugger/wasm-stepping-byte-offsets.js | 106 - .../debugger/wasm-stepping-expected.txt | 69 + .../wasm-stepping-in-from-js-expected.txt | 4 +- .../wasm-stepping-liftoff-expected.txt | 69 - .../debugger/wasm-stepping-to-js-expected.txt | 10 +- .../wasm-stepping-with-skiplist-expected.txt | 120 +- ...wasm-stepping-with-source-map-expected.txt | 46 +- ...m-stepping-liftoff.js => wasm-stepping.js} | 0 deps/v8/test/inspector/frontend-channel.h | 79 + deps/v8/test/inspector/inspector-test.cc | 559 +--- deps/v8/test/inspector/inspector.status | 39 +- deps/v8/test/inspector/isolate-data.cc | 104 +- deps/v8/test/inspector/isolate-data.h | 54 +- deps/v8/test/inspector/protocol-test.js | 15 +- .../runtime/add-binding-expected.txt | 107 + deps/v8/test/inspector/runtime/add-binding.js | 68 + .../runtime/custom-preview-expected.txt | 98 +- .../test/inspector/runtime/custom-preview.js | 2 + .../runtime/regression-1140845-expected.txt | 38 + .../inspector/runtime/regression-1140845.js | 36 + deps/v8/test/inspector/task-runner.cc | 32 +- deps/v8/test/inspector/task-runner.h | 33 +- deps/v8/test/inspector/tasks.cc | 53 + deps/v8/test/inspector/tasks.h | 187 ++ deps/v8/test/inspector/utils.cc | 82 + deps/v8/test/inspector/utils.h | 36 + deps/v8/test/inspector/wasm-inspector-test.js | 1 + deps/v8/test/intl/DIR_METADATA | 11 + deps/v8/test/intl/OWNERS | 2 - .../check-minimum-fraction-digits.js | 9 + deps/v8/test/intl/regress-1074578.js | 8 +- deps/v8/test/intl/regress-10960.js | 38 + deps/v8/test/intl/regress-1107661.js | 9 +- deps/v8/test/memory/Memory.json | 4 +- .../fail/dynamic-import-missing-specifier.js | 2 - .../fail/dynamic-import-missing-specifier.out | 2 +- .../fail/modules-duplicate-export5.mjs | 2 - .../fail/modules-duplicate-export5.out | 2 +- .../message/wasm-trace-memory-liftoff.out | 28 +- deps/v8/test/message/wasm-trace-memory.out | 28 +- deps/v8/test/mjsunit/BUILD.gn | 11 +- deps/v8/test/mjsunit/array-concat.js | 26 +- deps/v8/test/mjsunit/code-coverage-block.js | 55 - .../test/mjsunit/compiler/regress-1125145.js | 20 + .../test/mjsunit/compiler/regress-1146652.js | 26 + .../test/mjsunit/compiler/regress-1150649.js | 24 + ...c-map-check-deprecated-maps-polymorphic.js | 2 +- .../test-dynamic-map-check-deprecated-maps.js | 17 +- ...test-dynamic-map-check-deprecated-maps2.js | 44 + .../test-dynamic-map-checks-poly-mono.js | 2 +- .../test-dynamic-map-checks-wrong-handler.js | 2 +- .../test-dynamic-map-checks-wrong-handler1.js | 2 +- .../compiler/test-dynamic-map-checks.js | 2 +- deps/v8/test/mjsunit/es6/object-assign.js | 42 + .../es6/super-ic-opt-dynamic-map-checks.js | 42 + .../mjsunit/es6/super-ic-opt-no-turboprop.js | 51 + deps/v8/test/mjsunit/es6/super-ic-opt.js | 608 ++++ deps/v8/test/mjsunit/es6/super-ic.js | 10 + .../import-from-instantiation-errored.js | 2 +- .../mjsunit/harmony/promise-all-settled.js | 2 +- deps/v8/test/mjsunit/mjsunit.status | 47 +- ...mise-perform-all-settled-resolve-lookup.js | 2 +- .../v8/test/mjsunit/regexp-backtrack-limit.js | 1 + deps/v8/test/mjsunit/regexp-experimental.js | 2 +- .../mjsunit/regexp-fallback-large-default.js | 20 + deps/v8/test/mjsunit/regexp-fallback.js | 37 + deps/v8/test/mjsunit/regexp-linear-flag.js | 35 + deps/v8/test/mjsunit/regexp-no-linear-flag.js | 22 + deps/v8/test/mjsunit/regress-1146106.js | 18 + deps/v8/test/mjsunit/regress/regress-10908.js | 19 + deps/v8/test/mjsunit/regress/regress-10931.js | 14 + .../test/mjsunit/regress/regress-1112155.js | 2 +- .../test/mjsunit/regress/regress-1125871.js | 2 +- .../test/mjsunit/regress/regress-1132111.js | 23 + .../test/mjsunit/regress/regress-1137979.js | 21 + .../test/mjsunit/regress/regress-1138075.js | 27 + .../test/mjsunit/regress/regress-1138611.js | 34 + .../test/mjsunit/regress/regress-1139782.js | 37 + .../test/mjsunit/regress/regress-1141502.js | 21 + .../test/mjsunit/regress/regress-1142158.js | 37 + .../test/mjsunit/regress/regress-1144672.js | 20 + .../test/mjsunit/regress/regress-1161357.js | 15 + .../v8/test/mjsunit/regress/regress-542823.js | 25 +- deps/v8/test/mjsunit/regress/regress-6248.js | 2 +- .../mjsunit/regress/regress-crbug-1038178.js | 6 +- .../mjsunit/regress/regress-crbug-1130213.js | 9 + .../mjsunit/regress/regress-crbug-1137586.js | 16 + .../mjsunit/regress/regress-crbug-1137594.js | 17 + .../mjsunit/regress/regress-crbug-1151890.js | 11 + .../mjsunit/regress/regress-crbug-1171954.js | 19 + .../mjsunit/regress/regress-crbug-696622.js | 8 +- .../mjsunit/regress/wasm/regress-1065599.js | 16 +- .../mjsunit/regress/wasm/regress-11024.js | 22 + .../mjsunit/regress/wasm/regress-1132461.js | 27 + .../mjsunit/regress/wasm/regress-1137582.js | 10 + .../mjsunit/regress/wasm/regress-1146861.js | 56 + .../mjsunit/regress/wasm/regress-1153442.js | 61 + .../mjsunit/regress/wasm/regress-1161654.js | 56 + .../test/mjsunit/regress/wasm/regress-9447.js | 6 +- .../test/mjsunit/runtime-callstats-helpers.js | 21 + deps/v8/test/mjsunit/smi-mul-const.js | 20 +- deps/v8/test/mjsunit/smi-mul.js | 21 +- deps/v8/test/mjsunit/stack-traces.js | 20 - .../mjsunit/stackoverflow-underapplication.js | 54 + deps/v8/test/mjsunit/tools/codemap.mjs | 47 +- deps/v8/test/mjsunit/tools/log_two_byte.js | 3 - deps/v8/test/mjsunit/tools/processor.mjs | 56 + deps/v8/test/mjsunit/tools/timeline.mjs | 24 +- deps/v8/test/mjsunit/wasm/asm-wasm-stack.js | 15 - .../test/mjsunit/wasm/atomics-non-shared.js | 2 +- deps/v8/test/mjsunit/wasm/atomics.js | 17 +- deps/v8/test/mjsunit/wasm/call-ref.js | 62 +- .../mjsunit/wasm/externref-globals-liftoff.js | 2 +- .../v8/test/mjsunit/wasm/externref-liftoff.js | 2 +- deps/v8/test/mjsunit/wasm/generic-wrapper.js | 17 + .../mjsunit/wasm/imported-function-types.js | 44 + .../wasm/indirect-call-non-zero-table.js | 4 +- deps/v8/test/mjsunit/wasm/indirect-calls.js | 10 +- deps/v8/test/mjsunit/wasm/indirect-tables.js | 4 +- .../wasm/many-memories-no-trap-handler.js | 22 + deps/v8/test/mjsunit/wasm/many-memories.js | 24 + deps/v8/test/mjsunit/wasm/return-calls.js | 5 +- .../test/mjsunit/wasm/table-grow-from-wasm.js | 2 +- deps/v8/test/mjsunit/wasm/table-grow.js | 2 +- deps/v8/test/mjsunit/wasm/trap-location.js | 2 +- .../test/mjsunit/wasm/wasm-module-builder.js | 485 ++-- ...efault-currency-maximum-fraction-digits.js | 17 - deps/v8/test/test262/test262.status | 87 +- deps/v8/test/test262/testcfg.py | 2 - deps/v8/test/unittests/BUILD.gn | 12 +- .../v8/test/unittests/api/isolate-unittest.cc | 4 +- .../assembler/turbo-assembler-arm-unittest.cc | 2 +- .../turbo-assembler-arm64-unittest.cc | 2 +- .../unittests/base/functional-unittest.cc | 4 +- .../base/platform/platform-unittest.cc | 9 +- .../codegen/code-stub-assembler-unittest.cc | 5 +- .../compiler-dispatcher-unittest.cc | 20 +- .../optimizing-compile-dispatcher-unittest.cc | 11 +- .../backend/instruction-selector-unittest.cc | 2 +- .../backend/instruction-sequence-unittest.cc | 2 +- .../backend/instruction-sequence-unittest.h | 4 +- .../compiler/bytecode-analysis-unittest.cc | 4 +- .../effect-control-linearizer-unittest.cc | 56 +- .../instruction-selector-ia32-unittest.cc | 50 + deps/v8/test/unittests/compiler/ppc/OWNERS | 1 + .../mid-tier-register-allocator-unittest.cc | 154 + .../compiler/simplified-lowering-unittest.cc | 4 +- .../x64/instruction-selector-x64-unittest.cc | 201 +- .../execution/microtask-queue-unittest.cc | 5 +- .../unittests/heap/base/worklist-unittest.cc | 34 +- .../heap/cppgc/compactor-unittest.cc | 250 ++ .../heap/cppgc/concurrent-marking-unittest.cc | 147 +- .../heap/cppgc/concurrent-sweeper-unittest.cc | 25 +- .../cppgc/cross-thread-persistent-unittest.cc | 101 + .../heap/cppgc/custom-spaces-unittest.cc | 107 +- .../heap/cppgc/ephemeron-pair-unittest.cc | 112 + .../unittests/heap/cppgc/gc-info-unittest.cc | 16 +- .../heap/cppgc/gc-invoker-unittest.cc | 2 +- .../heap/cppgc/heap-object-header-unittest.cc | 16 +- .../unittests/heap/cppgc/heap-unittest.cc | 36 + .../unittests/heap/cppgc/marker-unittest.cc | 22 +- .../heap/cppgc/marking-verifier-unittest.cc | 45 +- .../heap/cppgc/marking-visitor-unittest.cc | 54 +- .../heap/cppgc/name-trait-unittest.cc | 133 + .../heap/cppgc/page-memory-unittest.cc | 11 +- ...ttest.cc => persistent-family-unittest.cc} | 184 +- .../unittests/heap/cppgc/stack-unittest.cc | 3 + .../unittests/heap/cppgc/sweeper-unittest.cc | 5 +- .../unittests/heap/cppgc/test-platform.cc | 123 +- .../test/unittests/heap/cppgc/test-platform.h | 57 +- deps/v8/test/unittests/heap/cppgc/tests.h | 5 +- .../heap/cppgc/weak-container-unittest.cc | 184 ++ .../heap/cppgc/write-barrier-unittest.cc | 10 +- deps/v8/test/unittests/heap/heap-unittest.cc | 9 +- deps/v8/test/unittests/heap/heap-utils.h | 5 +- .../heap/item-parallel-job-unittest.cc | 3 +- .../test/unittests/heap/js-member-unittest.cc | 164 -- .../unittests/heap/local-factory-unittest.cc | 4 +- .../unittests/heap/local-heap-unittest.cc | 10 +- .../test/unittests/heap/safepoint-unittest.cc | 9 +- .../heap/traced-reference-unittest.cc | 204 ++ .../heap/unified-heap-snapshot-unittest.cc | 491 ++++ .../unittests/heap/unified-heap-unittest.cc | 64 +- .../test/unittests/heap/unified-heap-utils.cc | 81 + .../test/unittests/heap/unified-heap-utils.h | 50 + .../test/unittests/heap/unmapper-unittest.cc | 46 +- .../bytecode-array-builder-unittest.cc | 7 +- .../bytecode-array-writer-unittest.cc | 16 +- .../interpreter-assembler-unittest.cc | 2 +- .../interpreter-assembler-unittest.h | 6 +- .../objects/value-serializer-unittest.cc | 27 +- .../unittests/parser/preparser-unittest.cc | 5 +- .../tasks/background-compile-task-unittest.cc | 10 +- deps/v8/test/unittests/test-helpers.h | 4 +- deps/v8/test/unittests/test-utils.cc | 11 +- deps/v8/test/unittests/test-utils.h | 54 +- deps/v8/test/unittests/unittests.status | 3 - deps/v8/test/unittests/wasm/DIR_METADATA | 11 + deps/v8/test/unittests/wasm/OWNERS | 2 - .../test/unittests/wasm/decoder-unittest.cc | 127 +- .../wasm/function-body-decoder-unittest.cc | 230 +- .../unittests/wasm/leb-helper-unittest.cc | 27 +- .../unittests/wasm/module-decoder-unittest.cc | 44 + .../wasm/trap-handler-x64-unittest.cc | 17 +- deps/v8/test/wasm-api-tests/traps.cc | 26 +- deps/v8/test/wasm-api-tests/wasm-api-test.h | 6 + deps/v8/test/wasm-js/tests.tar.gz.sha1 | 2 +- deps/v8/test/wasm-spec-tests/DIR_METADATA | 11 + deps/v8/test/wasm-spec-tests/OWNERS | 2 - .../v8/test/wasm-spec-tests/tests.tar.gz.sha1 | 2 +- .../wasm-spec-tests/wasm-spec-tests.status | 13 +- deps/v8/testing/gtest/BUILD.gn | 18 +- deps/v8/third_party/markupsafe/DIR_METADATA | 3 + deps/v8/third_party/markupsafe/OWNERS | 2 - deps/v8/third_party/zlib/deflate.c | 3 + .../zlib/google/compression_utils.cc | 37 +- .../zlib/google/compression_utils.h | 28 +- .../zlib/google/compression_utils_unittest.cc | 8 +- .../0007-zero-init-deflate-window.patch | 40 + deps/v8/tools/android-sync.sh | 19 +- deps/v8/tools/arguments.mjs | 22 +- .../tools/clusterfuzz/js_fuzzer/DIR_METADATA | 11 + deps/v8/tools/clusterfuzz/js_fuzzer/OWNERS | 2 - deps/v8/tools/codemap.mjs | 433 ++- deps/v8/tools/consarray.mjs | 2 +- deps/v8/tools/csvparser.mjs | 6 +- .../debug_helper/get-object-properties.cc | 7 +- deps/v8/tools/dumpcpp-driver.mjs | 14 +- deps/v8/tools/dumpcpp.mjs | 97 +- deps/v8/tools/gcmole/gcmole-test.cc | 13 + deps/v8/tools/gcmole/gcmole-tools.tar.gz.sha1 | 2 +- deps/v8/tools/gcmole/gcmole.cc | 37 +- deps/v8/tools/gcmole/test-expectations.txt | 5 +- deps/v8/tools/gen-postmortem-metadata.py | 25 +- deps/v8/tools/ic-explorer.html | 389 --- deps/v8/tools/ic-processor-driver.mjs | 74 +- deps/v8/tools/ic-processor.mjs | 197 -- deps/v8/tools/index.html | 17 +- deps/v8/tools/linux-tick-processor | 2 +- deps/v8/tools/logreader.mjs | 34 +- deps/v8/tools/map-processor | 37 - deps/v8/tools/map-processor-driver.mjs | 38 - deps/v8/tools/map-processor.html | 1315 --------- deps/v8/tools/map-processor.mjs | 783 ----- deps/v8/tools/mb/mb_unittest.py | 8 +- deps/v8/tools/parse-processor-driver.mjs | 12 +- deps/v8/tools/parse-processor.mjs | 26 +- deps/v8/tools/profile.mjs | 1434 +++++---- deps/v8/tools/profile_view.mjs | 32 +- deps/v8/tools/sourcemap.mjs | 126 +- deps/v8/tools/splaytree.mjs | 30 +- deps/v8/tools/system-analyzer/app-model.mjs | 128 +- deps/v8/tools/system-analyzer/events.mjs | 33 +- deps/v8/tools/system-analyzer/helper.mjs | 148 +- deps/v8/tools/system-analyzer/ic-model.mjs | 13 +- .../system-analyzer/ic-panel-template.html | 74 +- deps/v8/tools/system-analyzer/ic-panel.mjs | 405 ++- deps/v8/tools/system-analyzer/index.css | 95 +- deps/v8/tools/system-analyzer/index.html | 261 +- deps/v8/tools/system-analyzer/index.mjs | 273 +- .../log-file-reader-template.html | 24 +- .../tools/system-analyzer/log-file-reader.mjs | 138 +- deps/v8/tools/system-analyzer/log/deopt.mjs | 10 + deps/v8/tools/system-analyzer/log/ic.mjs | 19 +- deps/v8/tools/system-analyzer/log/log.mjs | 25 +- deps/v8/tools/system-analyzer/log/map.mjs | 45 +- .../system-analyzer/map-panel-template.html | 1 - deps/v8/tools/system-analyzer/map-panel.mjs | 130 +- .../system-analyzer/map-panel/map-details.mjs | 61 +- .../map-panel/map-transitions-template.html | 2 +- .../map-panel/map-transitions.mjs | 366 ++- deps/v8/tools/system-analyzer/processor.mjs | 185 +- .../source-panel-template.html | 36 +- .../v8/tools/system-analyzer/source-panel.mjs | 300 +- .../system-analyzer/stats-panel-template.html | 47 +- deps/v8/tools/system-analyzer/stats-panel.mjs | 152 +- .../timeline-panel-template.html | 45 - .../tools/system-analyzer/timeline-panel.mjs | 118 +- deps/v8/tools/system-analyzer/timeline.mjs | 106 +- .../timeline/timeline-track-template.html | 90 +- .../timeline/timeline-track.mjs | 904 +++--- deps/v8/tools/testrunner/base_runner.py | 6 - .../v8/tools/testrunner/local/junit_output.py | 49 - deps/v8/tools/testrunner/local/variants.py | 10 +- deps/v8/tools/testrunner/objects/testcase.py | 39 +- deps/v8/tools/testrunner/outproc/base.py | 3 + deps/v8/tools/testrunner/testproc/progress.py | 40 - deps/v8/tools/tickprocessor-driver.mjs | 14 +- deps/v8/tools/tickprocessor.mjs | 225 +- deps/v8/tools/v8_presubmit.py | 63 + deps/v8/tools/v8heapconst.py | 343 +-- deps/v8/tools/whitespace.txt | 5 +- 1623 files changed, 61462 insertions(+), 43678 deletions(-) create mode 100644 deps/v8/DIR_METADATA create mode 100644 deps/v8/include/DIR_METADATA create mode 100644 deps/v8/include/cppgc/cross-thread-persistent.h create mode 100644 deps/v8/include/cppgc/ephemeron-pair.h create mode 100644 deps/v8/include/cppgc/internal/name-trait.h create mode 100644 deps/v8/include/cppgc/name-provider.h create mode 100644 deps/v8/include/v8-unwinder-state.h create mode 100644 deps/v8/src/DIR_METADATA create mode 100644 deps/v8/src/api/DIR_METADATA create mode 100644 deps/v8/src/asmjs/DIR_METADATA create mode 100644 deps/v8/src/ast/DIR_METADATA create mode 100644 deps/v8/src/base/DIR_METADATA create mode 100644 deps/v8/src/base/platform/DIR_METADATA create mode 100644 deps/v8/src/base/platform/wrappers.h create mode 100644 deps/v8/src/base/platform/wrappers_starboard.cc create mode 100644 deps/v8/src/base/platform/wrappers_std.cc create mode 100644 deps/v8/src/base/safe_conversions_arm_impl.h create mode 100644 deps/v8/src/builtins/DIR_METADATA rename deps/v8/src/builtins/{bigint.tq => builtins-bigint.tq} (92%) create mode 100644 deps/v8/src/builtins/ic-dynamic-map-checks.tq create mode 100644 deps/v8/src/builtins/string-trim.tq create mode 100644 deps/v8/src/codegen/DIR_METADATA create mode 100644 deps/v8/src/common/DIR_METADATA create mode 100644 deps/v8/src/compiler-dispatcher/DIR_METADATA create mode 100644 deps/v8/src/compiler/DIR_METADATA create mode 100644 deps/v8/src/compiler/backend/DIR_METADATA create mode 100644 deps/v8/src/date/DIR_METADATA create mode 100644 deps/v8/src/debug/DIR_METADATA create mode 100644 deps/v8/src/debug/wasm/gdb-server/DIR_METADATA create mode 100644 deps/v8/src/deoptimizer/DIR_METADATA create mode 100644 deps/v8/src/diagnostics/arm/unwinder-arm.cc create mode 100644 deps/v8/src/diagnostics/arm64/unwinder-arm64.cc create mode 100644 deps/v8/src/diagnostics/ia32/unwinder-ia32.cc create mode 100644 deps/v8/src/diagnostics/mips/unwinder-mips.cc create mode 100644 deps/v8/src/diagnostics/mips64/unwinder-mips64.cc create mode 100644 deps/v8/src/diagnostics/ppc/unwinder-ppc.cc create mode 100644 deps/v8/src/diagnostics/s390/unwinder-s390.cc create mode 100644 deps/v8/src/diagnostics/unwinder.h create mode 100644 deps/v8/src/diagnostics/x64/unwinder-x64.cc create mode 100644 deps/v8/src/execution/DIR_METADATA create mode 100644 deps/v8/src/execution/external-pointer-table.cc create mode 100644 deps/v8/src/execution/external-pointer-table.h create mode 100644 deps/v8/src/handles/DIR_METADATA create mode 100644 deps/v8/src/heap/DIR_METADATA create mode 100644 deps/v8/src/heap/collection-barrier.cc create mode 100644 deps/v8/src/heap/collection-barrier.h create mode 100644 deps/v8/src/heap/cppgc-js/cpp-snapshot.cc create mode 100644 deps/v8/src/heap/cppgc-js/cpp-snapshot.h create mode 100644 deps/v8/src/heap/cppgc-js/unified-heap-marking-verifier.cc create mode 100644 deps/v8/src/heap/cppgc-js/unified-heap-marking-verifier.h create mode 100644 deps/v8/src/heap/cppgc/compaction-worklists.cc create mode 100644 deps/v8/src/heap/cppgc/compaction-worklists.h create mode 100644 deps/v8/src/heap/cppgc/compactor.cc create mode 100644 deps/v8/src/heap/cppgc/compactor.h create mode 100644 deps/v8/src/heap/cppgc/concurrent-marker.cc create mode 100644 deps/v8/src/heap/cppgc/concurrent-marker.h delete mode 100644 deps/v8/src/heap/cppgc/default-job.h delete mode 100644 deps/v8/src/heap/cppgc/default-platform.cc create mode 100644 deps/v8/src/heap/cppgc/name-trait.cc create mode 100644 deps/v8/src/heap/cppgc/process-heap.h create mode 100644 deps/v8/src/heap/parallel-work-item.h create mode 100644 deps/v8/src/heap/weak-object-worklists.cc create mode 100644 deps/v8/src/heap/weak-object-worklists.h create mode 100644 deps/v8/src/ic/DIR_METADATA create mode 100644 deps/v8/src/init/DIR_METADATA create mode 100644 deps/v8/src/inspector/DIR_METADATA create mode 100644 deps/v8/src/interpreter/DIR_METADATA create mode 100644 deps/v8/src/json/DIR_METADATA create mode 100644 deps/v8/src/libplatform/DIR_METADATA create mode 100644 deps/v8/src/libsampler/DIR_METADATA create mode 100644 deps/v8/src/numbers/DIR_METADATA create mode 100644 deps/v8/src/objects/DIR_METADATA create mode 100644 deps/v8/src/objects/all-objects-inl.h create mode 100644 deps/v8/src/objects/bigint-inl.h create mode 100644 deps/v8/src/objects/bigint.tq delete mode 100644 deps/v8/src/objects/class-definitions-tq-deps-inl.h rename deps/v8/src/objects/{compilation-cache-inl.h => compilation-cache-table-inl.h} (94%) create mode 100644 deps/v8/src/objects/compilation-cache-table.cc rename deps/v8/src/objects/{compilation-cache.h => compilation-cache-table.h} (75%) create mode 100644 deps/v8/src/objects/js-break-iterator.tq create mode 100644 deps/v8/src/objects/js-collator.tq create mode 100644 deps/v8/src/objects/js-collection-iterator-inl.h create mode 100644 deps/v8/src/objects/js-date-time-format.tq create mode 100644 deps/v8/src/objects/js-display-names.tq create mode 100644 deps/v8/src/objects/js-function.tq create mode 100644 deps/v8/src/objects/js-list-format.tq create mode 100644 deps/v8/src/objects/js-locale.tq create mode 100644 deps/v8/src/objects/js-number-format.tq create mode 100644 deps/v8/src/objects/js-plural-rules.tq create mode 100644 deps/v8/src/objects/js-relative-time-format.tq create mode 100644 deps/v8/src/objects/js-segment-iterator.tq create mode 100644 deps/v8/src/objects/js-segmenter.tq create mode 100644 deps/v8/src/objects/js-segments.tq create mode 100644 deps/v8/src/objects/source-text-module-inl.h create mode 100644 deps/v8/src/objects/synthetic-module-inl.h rename deps/v8/src/objects/{template.tq => templates.tq} (97%) create mode 100644 deps/v8/src/objects/torque-defined-classes-inl.h create mode 100644 deps/v8/src/objects/torque-defined-classes.h create mode 100644 deps/v8/src/objects/torque-defined-classes.tq create mode 100644 deps/v8/src/parsing/DIR_METADATA create mode 100644 deps/v8/src/profiler/DIR_METADATA create mode 100644 deps/v8/src/profiler/symbolizer.cc create mode 100644 deps/v8/src/profiler/symbolizer.h create mode 100644 deps/v8/src/regexp/DIR_METADATA create mode 100644 deps/v8/src/roots/DIR_METADATA create mode 100644 deps/v8/src/runtime/DIR_METADATA create mode 100644 deps/v8/src/snapshot/DIR_METADATA delete mode 100644 deps/v8/src/snapshot/deserializer-allocator.cc delete mode 100644 deps/v8/src/snapshot/deserializer-allocator.h delete mode 100644 deps/v8/src/snapshot/serializer-allocator.cc delete mode 100644 deps/v8/src/snapshot/serializer-allocator.h create mode 100644 deps/v8/src/strings/DIR_METADATA create mode 100644 deps/v8/src/torque/cc-generator.cc create mode 100644 deps/v8/src/torque/cc-generator.h create mode 100644 deps/v8/src/torque/runtime-macro-shims.h create mode 100644 deps/v8/src/torque/torque-code-generator.cc create mode 100644 deps/v8/src/torque/torque-code-generator.h create mode 100644 deps/v8/src/tracing/DIR_METADATA create mode 100644 deps/v8/src/trap-handler/DIR_METADATA create mode 100644 deps/v8/src/utils/DIR_METADATA create mode 100644 deps/v8/src/wasm/DIR_METADATA create mode 100644 deps/v8/test/cctest/cctest-utils.h create mode 100644 deps/v8/test/cctest/test-concurrent-feedback-vector.cc create mode 100644 deps/v8/test/cctest/test-verifiers.cc create mode 100644 deps/v8/test/cctest/wasm/DIR_METADATA create mode 100644 deps/v8/test/cctest/wasm/test-run-wasm-wrappers.cc create mode 100644 deps/v8/test/common/flag-utils.h create mode 100644 deps/v8/test/debugging/wasm/gdb-server/DIR_METADATA create mode 100644 deps/v8/test/fuzzer/inspector-fuzzer.cc create mode 100644 deps/v8/test/fuzzer/inspector/empty create mode 100644 deps/v8/test/fuzzer/inspector/invalid create mode 100644 deps/v8/test/inspector/DIR_METADATA rename deps/v8/test/inspector/debugger/{destory-in-break-program-expected.txt => destroy-in-break-program-expected.txt} (100%) rename deps/v8/test/inspector/debugger/{destory-in-break-program.js => destroy-in-break-program.js} (100%) create mode 100644 deps/v8/test/inspector/debugger/destroy-in-break-program2-expected.txt create mode 100644 deps/v8/test/inspector/debugger/destroy-in-break-program2.js create mode 100644 deps/v8/test/inspector/debugger/wasm-step-from-non-breakable-position-expected.txt create mode 100644 deps/v8/test/inspector/debugger/wasm-step-from-non-breakable-position.js delete mode 100644 deps/v8/test/inspector/debugger/wasm-stepping-byte-offsets-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/wasm-stepping-byte-offsets.js create mode 100644 deps/v8/test/inspector/debugger/wasm-stepping-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/wasm-stepping-liftoff-expected.txt rename deps/v8/test/inspector/debugger/{wasm-stepping-liftoff.js => wasm-stepping.js} (100%) create mode 100644 deps/v8/test/inspector/frontend-channel.h create mode 100644 deps/v8/test/inspector/runtime/regression-1140845-expected.txt create mode 100644 deps/v8/test/inspector/runtime/regression-1140845.js create mode 100644 deps/v8/test/inspector/tasks.cc create mode 100644 deps/v8/test/inspector/tasks.h create mode 100644 deps/v8/test/inspector/utils.cc create mode 100644 deps/v8/test/inspector/utils.h create mode 100644 deps/v8/test/intl/DIR_METADATA create mode 100644 deps/v8/test/intl/regress-10960.js create mode 100644 deps/v8/test/mjsunit/compiler/regress-1125145.js create mode 100644 deps/v8/test/mjsunit/compiler/regress-1146652.js create mode 100644 deps/v8/test/mjsunit/compiler/regress-1150649.js create mode 100644 deps/v8/test/mjsunit/compiler/test-dynamic-map-check-deprecated-maps2.js create mode 100644 deps/v8/test/mjsunit/es6/super-ic-opt-dynamic-map-checks.js create mode 100644 deps/v8/test/mjsunit/es6/super-ic-opt-no-turboprop.js create mode 100644 deps/v8/test/mjsunit/es6/super-ic-opt.js create mode 100644 deps/v8/test/mjsunit/regexp-fallback-large-default.js create mode 100644 deps/v8/test/mjsunit/regexp-fallback.js create mode 100644 deps/v8/test/mjsunit/regexp-linear-flag.js create mode 100644 deps/v8/test/mjsunit/regexp-no-linear-flag.js create mode 100644 deps/v8/test/mjsunit/regress-1146106.js create mode 100644 deps/v8/test/mjsunit/regress/regress-10908.js create mode 100644 deps/v8/test/mjsunit/regress/regress-10931.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1132111.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1137979.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1138075.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1138611.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1139782.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1141502.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1142158.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1144672.js create mode 100644 deps/v8/test/mjsunit/regress/regress-1161357.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1130213.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1137586.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1137594.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1151890.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-1171954.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-11024.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-1132461.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-1137582.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-1146861.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-1153442.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-1161654.js create mode 100644 deps/v8/test/mjsunit/runtime-callstats-helpers.js create mode 100644 deps/v8/test/mjsunit/stackoverflow-underapplication.js create mode 100644 deps/v8/test/mjsunit/tools/processor.mjs create mode 100644 deps/v8/test/mjsunit/wasm/imported-function-types.js create mode 100644 deps/v8/test/mjsunit/wasm/many-memories-no-trap-handler.js create mode 100644 deps/v8/test/mjsunit/wasm/many-memories.js delete mode 100644 deps/v8/test/test262/local-tests/test/intl402/NumberFormat/default-currency-maximum-fraction-digits.js create mode 100644 deps/v8/test/unittests/heap/cppgc/compactor-unittest.cc create mode 100644 deps/v8/test/unittests/heap/cppgc/cross-thread-persistent-unittest.cc create mode 100644 deps/v8/test/unittests/heap/cppgc/ephemeron-pair-unittest.cc create mode 100644 deps/v8/test/unittests/heap/cppgc/name-trait-unittest.cc rename deps/v8/test/unittests/heap/cppgc/{persistent-unittest.cc => persistent-family-unittest.cc} (77%) create mode 100644 deps/v8/test/unittests/heap/cppgc/weak-container-unittest.cc delete mode 100644 deps/v8/test/unittests/heap/js-member-unittest.cc create mode 100644 deps/v8/test/unittests/heap/traced-reference-unittest.cc create mode 100644 deps/v8/test/unittests/heap/unified-heap-snapshot-unittest.cc create mode 100644 deps/v8/test/unittests/heap/unified-heap-utils.cc create mode 100644 deps/v8/test/unittests/heap/unified-heap-utils.h create mode 100644 deps/v8/test/unittests/wasm/DIR_METADATA create mode 100644 deps/v8/test/wasm-spec-tests/DIR_METADATA create mode 100644 deps/v8/third_party/markupsafe/DIR_METADATA create mode 100644 deps/v8/third_party/zlib/patches/0007-zero-init-deflate-window.patch create mode 100644 deps/v8/tools/clusterfuzz/js_fuzzer/DIR_METADATA delete mode 100644 deps/v8/tools/ic-explorer.html delete mode 100644 deps/v8/tools/ic-processor.mjs delete mode 100755 deps/v8/tools/map-processor delete mode 100644 deps/v8/tools/map-processor-driver.mjs delete mode 100644 deps/v8/tools/map-processor.html delete mode 100644 deps/v8/tools/map-processor.mjs create mode 100644 deps/v8/tools/system-analyzer/log/deopt.mjs delete mode 100644 deps/v8/tools/testrunner/local/junit_output.py diff --git a/deps/v8/.gitignore b/deps/v8/.gitignore index 6d2cf1077a522a..11c7ae61ddaf53 100644 --- a/deps/v8/.gitignore +++ b/deps/v8/.gitignore @@ -29,6 +29,7 @@ .cproject .gclient_entries .gdb_history +.jslint-cache .landmines .project .pydevproject diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index 36abcfba774a44..72e450430c0bcb 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -72,6 +72,7 @@ Bert Belder Burcu Dogan Caitlin Potter Craig Schlenter +Charles Kerr Chengzhong Wu Choongwoo Han Chris Nardi @@ -117,6 +118,7 @@ Janusz Majnert Jay Freeman James Pike James M Snell +Javad Amiri Jianghua Yang Jiawen Geng Jiaxun Yang @@ -185,6 +187,7 @@ Rob Wu Robert Meijer Robert Mustacchi Robert Nagy +Robert O'Callahan Rong Wang Ross Kirsling Ruben Bridgewater @@ -225,3 +228,4 @@ Zhao Jiazhong Zhongping Wang 柳荣一 Tianping Yang +Takeshi Yoneda diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index 94b598bc9a2882..1dc6c7d5ac51df 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -110,10 +110,10 @@ declare_args() { v8_enable_31bit_smis_on_64bit_arch = false # Disable arguments adaptor frame (sets -dV8_NO_ARGUMENTS_ADAPTOR). - v8_disable_arguments_adaptor = false - - # Reverse JS arguments order in the stack (sets -dV8_REVERSE_JSARGS). - v8_enable_reverse_jsargs = true + 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" # Sets -dOBJECT_PRINT. v8_enable_object_print = "" @@ -130,7 +130,15 @@ declare_args() { # Sets -dV8_TRACE_FEEDBACK_UPDATES. v8_enable_trace_feedback_updates = false - # Sets -dV8_CONCURRENT_MARKING + # Sets -dV8_ATOMIC_OBJECT_FIELD_WRITES and turns all field write operations + # into relaxed atomic operations. + v8_enable_atomic_object_field_writes = "" + + # Sets -dV8_ATOMIC_MARKING_STATE + v8_enable_atomic_marking_state = "" + + # Controls the default values of v8_enable_atomic_object_field_writes and + # v8_enable_concurrent_marking_state. See the default setting code below. v8_enable_concurrent_marking = true # Runs mksnapshot with --turbo-profiling. After building in this @@ -273,6 +281,10 @@ declare_args() { # Experimental feature for collecting per-class zone memory stats. # Requires use_rtti = true v8_enable_precise_zone_stats = false + + # Experimental feature for always keeping prototypes in dict/"slow" mode + # Sets -DV8_DICT_MODE_PROTOTYPES + v8_dict_mode_prototypes = false } # Derived defaults. @@ -317,6 +329,16 @@ if (v8_enable_heap_sandbox == "") { if (v8_enable_single_generation == "") { v8_enable_single_generation = v8_disable_write_barriers } +if (v8_enable_atomic_object_field_writes == "") { + v8_enable_atomic_object_field_writes = v8_enable_concurrent_marking +} +if (v8_enable_atomic_marking_state == "") { + v8_enable_atomic_marking_state = v8_enable_concurrent_marking +} +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.") # Toggle pointer compression for correctness fuzzing when building the # clang_x64_pointer_compression toolchain. We'll correctness-compare the @@ -348,17 +370,9 @@ if (v8_enable_shared_ro_heap && v8_enable_pointer_compression) { assert(!v8_use_multi_snapshots || !v8_control_flow_integrity, "Control-flow integrity does not support multisnapshots") -assert( - !v8_enable_pointer_compression || !v8_enable_shared_ro_heap, - "Pointer compression is not supported with shared read-only heap enabled") - assert(!v8_enable_heap_sandbox || v8_enable_pointer_compression, "V8 Heap Sandbox requires pointer compression") -assert( - !v8_disable_arguments_adaptor || v8_enable_reverse_jsargs, - "Disabling the arguments adaptor frame requires reversing the JS arguments stack") - assert(!v8_enable_unconditional_write_barriers || !v8_disable_write_barriers, "Write barriers can't be both enabled and disabled") @@ -517,9 +531,6 @@ config("v8_header_features") { if (v8_disable_arguments_adaptor) { defines += [ "V8_NO_ARGUMENTS_ADAPTOR" ] } - if (v8_enable_reverse_jsargs) { - defines += [ "V8_REVERSE_JSARGS" ] - } } # Put defines here that are only used in our internal files and NEVER in @@ -614,8 +625,11 @@ config("features") { if (v8_use_external_startup_data) { defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ] } - if (v8_enable_concurrent_marking) { - defines += [ "V8_CONCURRENT_MARKING" ] + if (v8_enable_atomic_object_field_writes) { + defines += [ "V8_ATOMIC_OBJECT_FIELD_WRITES" ] + } + if (v8_enable_atomic_marking_state) { + defines += [ "V8_ATOMIC_MARKING_STATE" ] } if (v8_enable_lazy_source_positions) { defines += [ "V8_ENABLE_LAZY_SOURCE_POSITIONS" ] @@ -656,6 +670,9 @@ config("features") { if (v8_fuzzilli) { defines += [ "V8_FUZZILLI" ] } + if (v8_dict_mode_prototypes) { + defines += [ "V8_DICT_MODE_PROTOTYPES" ] + } } config("toolchain") { @@ -941,6 +958,10 @@ config("toolchain") { # GCC assumes that control can get past an exhaustive switch and then # warns if there's no return there (see https://crbug.com/v8/7658). "-Wno-return-type", + + # Disable gcc warnings for using enum constant in boolean context. + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97266 + "-Wno-int-in-bool-context", ] } @@ -1134,8 +1155,8 @@ torque_files = [ "src/builtins/array.tq", "src/builtins/arraybuffer.tq", "src/builtins/base.tq", - "src/builtins/bigint.tq", "src/builtins/boolean.tq", + "src/builtins/builtins-bigint.tq", "src/builtins/builtins-string.tq", "src/builtins/cast.tq", "src/builtins/collections.tq", @@ -1150,6 +1171,7 @@ torque_files = [ "src/builtins/function.tq", "src/builtins/growable-fixed-array.tq", "src/builtins/ic-callable.tq", + "src/builtins/ic-dynamic-map-checks.tq", "src/builtins/ic.tq", "src/builtins/internal-coverage.tq", "src/builtins/internal.tq", @@ -1200,8 +1222,9 @@ torque_files = [ "src/builtins/string-replaceall.tq", "src/builtins/string-slice.tq", "src/builtins/string-startswith.tq", - "src/builtins/string-substring.tq", "src/builtins/string-substr.tq", + "src/builtins/string-substring.tq", + "src/builtins/string-trim.tq", "src/builtins/symbol.tq", "src/builtins/torque-internal.tq", "src/builtins/typed-array-createtypedarray.tq", @@ -1229,6 +1252,7 @@ torque_files = [ "src/objects/allocation-site.tq", "src/objects/api-callbacks.tq", "src/objects/arguments.tq", + "src/objects/bigint.tq", "src/objects/cell.tq", "src/objects/code.tq", "src/objects/contexts.tq", @@ -1243,11 +1267,11 @@ torque_files = [ "src/objects/free-space.tq", "src/objects/heap-number.tq", "src/objects/heap-object.tq", - "src/objects/intl-objects.tq", "src/objects/js-array-buffer.tq", "src/objects/js-array.tq", "src/objects/js-collection-iterator.tq", "src/objects/js-collection.tq", + "src/objects/js-function.tq", "src/objects/js-generator.tq", "src/objects/js-objects.tq", "src/objects/js-promise.tq", @@ -1278,14 +1302,29 @@ torque_files = [ "src/objects/struct.tq", "src/objects/synthetic-module.tq", "src/objects/template-objects.tq", - "src/objects/template.tq", + "src/objects/templates.tq", + "src/objects/torque-defined-classes.tq", "src/wasm/wasm-objects.tq", "test/torque/test-torque.tq", "third_party/v8/builtins/array-sort.tq", ] -if (!v8_enable_i18n_support) { - torque_files -= [ "src/objects/intl-objects.tq" ] +if (v8_enable_i18n_support) { + torque_files += [ + "src/objects/intl-objects.tq", + "src/objects/js-break-iterator.tq", + "src/objects/js-collator.tq", + "src/objects/js-date-time-format.tq", + "src/objects/js-display-names.tq", + "src/objects/js-list-format.tq", + "src/objects/js-locale.tq", + "src/objects/js-number-format.tq", + "src/objects/js-plural-rules.tq", + "src/objects/js-relative-time-format.tq", + "src/objects/js-segment-iterator.tq", + "src/objects/js-segmenter.tq", + "src/objects/js-segments.tq", + ] } # Template for running torque @@ -1328,19 +1367,15 @@ template("run_torque") { "$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-definitions.cc", - "$target_gen_dir/torque-generated/class-definitions-inl.h", - "$target_gen_dir/torque-generated/class-definitions.h", "$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/instance-types.h", - "$target_gen_dir/torque-generated/internal-class-definitions.h", - "$target_gen_dir/torque-generated/internal-class-definitions-inl.h", - "$target_gen_dir/torque-generated/exported-class-definitions.h", - "$target_gen_dir/torque-generated/exported-class-definitions-inl.h", + "$target_gen_dir/torque-generated/runtime-macros.cc", + "$target_gen_dir/torque-generated/runtime-macros.h", + "$target_gen_dir/torque-generated/class-forward-declarations.h", ] outputs = [] @@ -1351,10 +1386,13 @@ template("run_torque") { } foreach(file, torque_files) { - filetq = string_replace(file, ".tq", "-tq-csa") + filetq = string_replace(file, ".tq", "-tq") outputs += [ - "$destination_folder/$filetq.cc", - "$destination_folder/$filetq.h", + "$target_gen_dir/torque-generated/$filetq-csa.cc", + "$target_gen_dir/torque-generated/$filetq-csa.h", + "$target_gen_dir/torque-generated/$filetq-inl.inc", + "$target_gen_dir/torque-generated/$filetq.cc", + "$target_gen_dir/torque-generated/$filetq.inc", ] } @@ -1430,10 +1468,10 @@ v8_source_set("torque_generated_initializers") { "src/torque/runtime-support.h", ] foreach(file, torque_files) { - filetq = string_replace(file, ".tq", "-tq-csa") + filetq = string_replace(file, ".tq", "-tq") sources += [ - "$target_gen_dir/torque-generated/$filetq.cc", - "$target_gen_dir/torque-generated/$filetq.h", + "$target_gen_dir/torque-generated/$filetq-csa.cc", + "$target_gen_dir/torque-generated/$filetq-csa.h", ] } @@ -1452,12 +1490,21 @@ v8_source_set("torque_generated_definitions") { public_deps = [ ":v8_maybe_icu" ] sources = [ - "$target_gen_dir/torque-generated/class-definitions.cc", + "$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/factory.cc", "$target_gen_dir/torque-generated/objects-printer.cc", + "$target_gen_dir/torque-generated/runtime-macros.cc", ] + foreach(file, torque_files) { + filetq = string_replace(file, ".tq", "-tq") + sources += [ + "$target_gen_dir/torque-generated/$filetq-inl.inc", + "$target_gen_dir/torque-generated/$filetq.cc", + "$target_gen_dir/torque-generated/$filetq.inc", + ] + } configs = [ ":internal_config" ] } @@ -1535,9 +1582,10 @@ template("run_mksnapshot") { args += [ "--turbo-profiling-verbose" ] } if (v8_builtins_profiling_log_file != "") { + sources += [ v8_builtins_profiling_log_file ] args += [ "--turbo-profiling-log-file", - v8_builtins_profiling_log_file, + rebase_path(v8_builtins_profiling_log_file, root_build_dir), ] } @@ -1665,6 +1713,9 @@ action("v8_dump_build_config") { "is_ubsan_vptr=$is_ubsan_vptr", "target_cpu=\"$target_cpu\"", "v8_current_cpu=\"$v8_current_cpu\"", + "v8_enable_atomic_marking_state=$v8_enable_atomic_marking_state", + "v8_enable_atomic_object_field_writes=" + + "$v8_enable_atomic_object_field_writes", "v8_enable_concurrent_marking=$v8_enable_concurrent_marking", "v8_enable_i18n_support=$v8_enable_i18n_support", "v8_enable_verify_predictable=$v8_enable_verify_predictable", @@ -2263,6 +2314,7 @@ v8_source_set("v8_base_without_compiler") { "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", @@ -2469,11 +2521,14 @@ v8_source_set("v8_base_without_compiler") { "src/diagnostics/perf-jit.cc", "src/diagnostics/perf-jit.h", "src/diagnostics/unwinder.cc", + "src/diagnostics/unwinder.h", "src/execution/arguments-inl.h", "src/execution/arguments.cc", "src/execution/arguments.h", "src/execution/execution.cc", "src/execution/execution.h", + "src/execution/external-pointer-table.cc", + "src/execution/external-pointer-table.h", "src/execution/frame-constants.h", "src/execution/frames-inl.h", "src/execution/frames.cc", @@ -2554,6 +2609,8 @@ v8_source_set("v8_base_without_compiler") { "src/heap/code-object-registry.h", "src/heap/code-stats.cc", "src/heap/code-stats.h", + "src/heap/collection-barrier.cc", + "src/heap/collection-barrier.h", "src/heap/combined-heap.cc", "src/heap/combined-heap.h", "src/heap/concurrent-allocator-inl.h", @@ -2563,7 +2620,11 @@ v8_source_set("v8_base_without_compiler") { "src/heap/concurrent-marking.h", "src/heap/cppgc-js/cpp-heap.cc", "src/heap/cppgc-js/cpp-heap.h", + "src/heap/cppgc-js/cpp-snapshot.cc", + "src/heap/cppgc-js/cpp-snapshot.h", "src/heap/cppgc-js/unified-heap-marking-state.h", + "src/heap/cppgc-js/unified-heap-marking-verifier.cc", + "src/heap/cppgc-js/unified-heap-marking-verifier.h", "src/heap/cppgc-js/unified-heap-marking-visitor.cc", "src/heap/cppgc-js/unified-heap-marking-visitor.h", "src/heap/embedder-tracing.cc", @@ -2647,6 +2708,7 @@ v8_source_set("v8_base_without_compiler") { "src/heap/paged-spaces-inl.h", "src/heap/paged-spaces.cc", "src/heap/paged-spaces.h", + "src/heap/parallel-work-item.h", "src/heap/read-only-heap-inl.h", "src/heap/read-only-heap.cc", "src/heap/read-only-heap.h", @@ -2672,6 +2734,8 @@ v8_source_set("v8_base_without_compiler") { "src/heap/stress-scavenge-observer.h", "src/heap/sweeper.cc", "src/heap/sweeper.h", + "src/heap/weak-object-worklists.cc", + "src/heap/weak-object-worklists.h", "src/heap/worklist.h", "src/ic/call-optimization.cc", "src/ic/call-optimization.h", @@ -2785,6 +2849,7 @@ v8_source_set("v8_base_without_compiler") { "src/numbers/math-random.h", "src/numbers/strtod.cc", "src/numbers/strtod.h", + "src/objects/all-objects-inl.h", "src/objects/allocation-site-inl.h", "src/objects/allocation-site-scopes-inl.h", "src/objects/allocation-site-scopes.h", @@ -2795,6 +2860,7 @@ v8_source_set("v8_base_without_compiler") { "src/objects/arguments.h", "src/objects/backing-store.cc", "src/objects/backing-store.h", + "src/objects/bigint-inl.h", "src/objects/bigint.cc", "src/objects/bigint.h", "src/objects/cell-inl.h", @@ -2804,13 +2870,15 @@ v8_source_set("v8_base_without_compiler") { "src/objects/code-kind.h", "src/objects/code.cc", "src/objects/code.h", - "src/objects/compilation-cache-inl.h", - "src/objects/compilation-cache.h", + "src/objects/compilation-cache-table-inl.h", + "src/objects/compilation-cache-table.cc", + "src/objects/compilation-cache-table.h", "src/objects/compressed-slots-inl.h", "src/objects/compressed-slots.h", "src/objects/contexts-inl.h", "src/objects/contexts.cc", "src/objects/contexts.h", + "src/objects/data-handler-inl.h", "src/objects/data-handler.h", "src/objects/debug-objects-inl.h", "src/objects/debug-objects.cc", @@ -2840,8 +2908,12 @@ v8_source_set("v8_base_without_compiler") { "src/objects/field-type.h", "src/objects/fixed-array-inl.h", "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", "src/objects/hash-table-inl.h", "src/objects/hash-table.h", @@ -3009,6 +3081,7 @@ v8_source_set("v8_base_without_compiler") { "src/objects/string.h", "src/objects/struct-inl.h", "src/objects/struct.h", + "src/objects/synthetic-module-inl.h", "src/objects/synthetic-module.cc", "src/objects/synthetic-module.h", "src/objects/tagged-field-inl.h", @@ -3024,6 +3097,8 @@ v8_source_set("v8_base_without_compiler") { "src/objects/template-objects.h", "src/objects/templates-inl.h", "src/objects/templates.h", + "src/objects/torque-defined-classes-inl.h", + "src/objects/torque-defined-classes.h", "src/objects/transitions-inl.h", "src/objects/transitions.cc", "src/objects/transitions.h", @@ -3084,6 +3159,8 @@ v8_source_set("v8_base_without_compiler") { "src/profiler/sampling-heap-profiler.h", "src/profiler/strings-storage.cc", "src/profiler/strings-storage.h", + "src/profiler/symbolizer.cc", + "src/profiler/symbolizer.h", "src/profiler/tick-sample.cc", "src/profiler/tick-sample.h", "src/profiler/tracing-cpu-profiler.cc", @@ -3178,8 +3255,6 @@ v8_source_set("v8_base_without_compiler") { "src/snapshot/context-deserializer.h", "src/snapshot/context-serializer.cc", "src/snapshot/context-serializer.h", - "src/snapshot/deserializer-allocator.cc", - "src/snapshot/deserializer-allocator.h", "src/snapshot/deserializer.cc", "src/snapshot/deserializer.h", "src/snapshot/embedded/embedded-data.cc", @@ -3193,8 +3268,6 @@ v8_source_set("v8_base_without_compiler") { "src/snapshot/references.h", "src/snapshot/roots-serializer.cc", "src/snapshot/roots-serializer.h", - "src/snapshot/serializer-allocator.cc", - "src/snapshot/serializer-allocator.h", "src/snapshot/serializer-deserializer.cc", "src/snapshot/serializer-deserializer.h", "src/snapshot/serializer.cc", @@ -3439,6 +3512,7 @@ v8_source_set("v8_base_without_compiler") { "src/debug/ia32/debug-ia32.cc", "src/deoptimizer/ia32/deoptimizer-ia32.cc", "src/diagnostics/ia32/disasm-ia32.cc", + "src/diagnostics/ia32/unwinder-ia32.cc", "src/execution/ia32/frame-constants-ia32.cc", "src/execution/ia32/frame-constants-ia32.h", "src/regexp/ia32/regexp-macro-assembler-ia32.cc", @@ -3468,6 +3542,7 @@ v8_source_set("v8_base_without_compiler") { "src/deoptimizer/x64/deoptimizer-x64.cc", "src/diagnostics/x64/disasm-x64.cc", "src/diagnostics/x64/eh-frame-x64.cc", + "src/diagnostics/x64/unwinder-x64.cc", "src/execution/x64/frame-constants-x64.cc", "src/execution/x64/frame-constants-x64.h", "src/regexp/x64/regexp-macro-assembler-x64.cc", @@ -3516,6 +3591,7 @@ v8_source_set("v8_base_without_compiler") { "src/deoptimizer/arm/deoptimizer-arm.cc", "src/diagnostics/arm/disasm-arm.cc", "src/diagnostics/arm/eh-frame-arm.cc", + "src/diagnostics/arm/unwinder-arm.cc", "src/execution/arm/frame-constants-arm.cc", "src/execution/arm/frame-constants-arm.h", "src/execution/arm/simulator-arm.cc", @@ -3556,6 +3632,7 @@ v8_source_set("v8_base_without_compiler") { "src/diagnostics/arm64/disasm-arm64.cc", "src/diagnostics/arm64/disasm-arm64.h", "src/diagnostics/arm64/eh-frame-arm64.cc", + "src/diagnostics/arm64/unwinder-arm64.cc", "src/execution/arm64/frame-constants-arm64.cc", "src/execution/arm64/frame-constants-arm64.h", "src/execution/arm64/pointer-auth-arm64.cc", @@ -3594,6 +3671,7 @@ v8_source_set("v8_base_without_compiler") { "src/debug/mips/debug-mips.cc", "src/deoptimizer/mips/deoptimizer-mips.cc", "src/diagnostics/mips/disasm-mips.cc", + "src/diagnostics/mips/unwinder-mips.cc", "src/execution/mips/frame-constants-mips.cc", "src/execution/mips/frame-constants-mips.h", "src/execution/mips/simulator-mips.cc", @@ -3621,6 +3699,7 @@ v8_source_set("v8_base_without_compiler") { "src/debug/mips64/debug-mips64.cc", "src/deoptimizer/mips64/deoptimizer-mips64.cc", "src/diagnostics/mips64/disasm-mips64.cc", + "src/diagnostics/mips64/unwinder-mips64.cc", "src/execution/mips64/frame-constants-mips64.cc", "src/execution/mips64/frame-constants-mips64.h", "src/execution/mips64/simulator-mips64.cc", @@ -3651,6 +3730,7 @@ v8_source_set("v8_base_without_compiler") { "src/deoptimizer/ppc/deoptimizer-ppc.cc", "src/diagnostics/ppc/disasm-ppc.cc", "src/diagnostics/ppc/eh-frame-ppc.cc", + "src/diagnostics/ppc/unwinder-ppc.cc", "src/execution/ppc/frame-constants-ppc.cc", "src/execution/ppc/frame-constants-ppc.h", "src/execution/ppc/simulator-ppc.cc", @@ -3681,6 +3761,7 @@ v8_source_set("v8_base_without_compiler") { "src/deoptimizer/ppc/deoptimizer-ppc.cc", "src/diagnostics/ppc/disasm-ppc.cc", "src/diagnostics/ppc/eh-frame-ppc.cc", + "src/diagnostics/ppc/unwinder-ppc.cc", "src/execution/ppc/frame-constants-ppc.cc", "src/execution/ppc/frame-constants-ppc.h", "src/execution/ppc/simulator-ppc.cc", @@ -3711,6 +3792,7 @@ v8_source_set("v8_base_without_compiler") { "src/deoptimizer/s390/deoptimizer-s390.cc", "src/diagnostics/s390/disasm-s390.cc", "src/diagnostics/s390/eh-frame-s390.cc", + "src/diagnostics/s390/unwinder-s390.cc", "src/execution/s390/frame-constants-s390.cc", "src/execution/s390/frame-constants-s390.h", "src/execution/s390/simulator-s390.cc", @@ -3852,6 +3934,8 @@ v8_source_set("torque_base") { sources = [ "src/torque/ast.h", + "src/torque/cc-generator.cc", + "src/torque/cc-generator.h", "src/torque/cfg.cc", "src/torque/cfg.h", "src/torque/class-debug-reader-generator.cc", @@ -3879,6 +3963,8 @@ v8_source_set("torque_base") { "src/torque/server-data.h", "src/torque/source-positions.cc", "src/torque/source-positions.h", + "src/torque/torque-code-generator.cc", + "src/torque/torque-code-generator.h", "src/torque/torque-compiler.cc", "src/torque/torque-compiler.h", "src/torque/torque-parser.cc", @@ -4020,10 +4106,13 @@ v8_component("v8_libbase") { "src/base/platform/semaphore.h", "src/base/platform/time.cc", "src/base/platform/time.h", + "src/base/platform/wrappers.h", + "src/base/platform/wrappers_std.cc", "src/base/region-allocator.cc", "src/base/region-allocator.h", "src/base/ring-buffer.h", "src/base/safe_conversions.h", + "src/base/safe_conversions_arm_impl.h", "src/base/safe_conversions_impl.h", "src/base/small-vector.h", "src/base/sys-info.cc", @@ -4304,6 +4393,7 @@ v8_source_set("cppgc_base") { "include/cppgc/common.h", "include/cppgc/custom-space.h", "include/cppgc/default-platform.h", + "include/cppgc/ephemeron-pair.h", "include/cppgc/garbage-collected.h", "include/cppgc/heap.h", "include/cppgc/internal/api-constants.h", @@ -4311,6 +4401,7 @@ v8_source_set("cppgc_base") { "include/cppgc/internal/compiler-specific.h", "include/cppgc/internal/finalizer-trait.h", "include/cppgc/internal/gc-info.h", + "include/cppgc/internal/name-trait.h", "include/cppgc/internal/persistent-node.h", "include/cppgc/internal/pointer-policies.h", "include/cppgc/internal/prefinalizer-handler.h", @@ -4319,6 +4410,7 @@ v8_source_set("cppgc_base") { "include/cppgc/liveness-broker.h", "include/cppgc/macros.h", "include/cppgc/member.h", + "include/cppgc/name-provider.h", "include/cppgc/persistent.h", "include/cppgc/platform.h", "include/cppgc/prefinalizer.h", @@ -4328,8 +4420,12 @@ v8_source_set("cppgc_base") { "include/cppgc/visitor.h", "include/v8config.h", "src/heap/cppgc/allocation.cc", - "src/heap/cppgc/default-job.h", - "src/heap/cppgc/default-platform.cc", + "src/heap/cppgc/compaction-worklists.cc", + "src/heap/cppgc/compaction-worklists.h", + "src/heap/cppgc/compactor.cc", + "src/heap/cppgc/compactor.h", + "src/heap/cppgc/concurrent-marker.cc", + "src/heap/cppgc/concurrent-marker.h", "src/heap/cppgc/free-list.cc", "src/heap/cppgc/free-list.h", "src/heap/cppgc/garbage-collector.h", @@ -4366,6 +4462,7 @@ 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/name-trait.cc", "src/heap/cppgc/object-allocator.cc", "src/heap/cppgc/object-allocator.h", "src/heap/cppgc/object-start-bitmap.h", @@ -4377,6 +4474,7 @@ v8_source_set("cppgc_base") { "src/heap/cppgc/prefinalizer-handler.cc", "src/heap/cppgc/prefinalizer-handler.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", @@ -4410,6 +4508,7 @@ v8_source_set("cppgc_base") { public_deps = [ ":v8_cppgc_shared", ":v8_libbase", + ":v8_libplatform", ] } @@ -4711,6 +4810,7 @@ if (is_fuchsia && !build_with_chromium) { group("v8_fuzzers") { testonly = true data_deps = [ + ":v8_simple_inspector_fuzzer", ":v8_simple_json_fuzzer", ":v8_simple_multi_return_fuzzer", ":v8_simple_parser_fuzzer", @@ -5175,6 +5275,23 @@ v8_source_set("wasm_compile_fuzzer") { v8_fuzzer("wasm_compile_fuzzer") { } +v8_source_set("inspector_fuzzer") { + sources = [ "test/fuzzer/inspector-fuzzer.cc" ] + + deps = [ + ":fuzzer_support", + "test/inspector:inspector_test", + ] + + configs = [ + ":external_config", + ":internal_config_base", + ] +} + +v8_fuzzer("inspector_fuzzer") { +} + # Target to build all generated .cc files. group("v8_generated_cc_files") { testonly = true diff --git a/deps/v8/DEPS b/deps/v8/DEPS index 6bddd2cc9f0cab..3e3fed387db216 100644 --- a/deps/v8/DEPS +++ b/deps/v8/DEPS @@ -6,6 +6,9 @@ use_relative_paths = True gclient_gn_args_file = 'build/config/gclient_args.gni' gclient_gn_args = [ + # TODO(https://crbug.com/1137662, https://crbug.com/1080854) + # Remove when migration is complete. + 'checkout_fuchsia_for_arm64_host', 'checkout_google_benchmark', 'mac_xcode_version', ] @@ -26,6 +29,12 @@ vars = { # Wildcards are supported (e.g. "qemu.*"). 'checkout_fuchsia_boot_images': "qemu.x64,qemu.arm64", + # TODO(https://crbug.com/1137662, https://crbug.com/1080854) + # Remove when migration is complete. + # By default, do not check out files required to run fuchsia tests in + # qemu on linux-arm64 machines. + 'checkout_fuchsia_for_arm64_host': False, + 'checkout_instrumented_libraries': False, 'checkout_ittapi': False, # Fetch clang-tidy into the same bin/ directory as our clang binary. @@ -41,10 +50,10 @@ vars = { 'mac_xcode_version': 'default', # GN CIPD package version. - 'gn_version': 'git_revision:e002e68a48d1c82648eadde2f6aafa20d08c36f2', + 'gn_version': 'git_revision:53d92014bf94c3893886470a1c7c1289f8818db0', # luci-go CIPD package version. - 'luci_go': 'git_revision:83c3df996b224edf5061840744395707a0e513e7', + 'luci_go': 'git_revision:1a022d3a4c50be4207ee93451255d71896416596', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_build-tools_version @@ -77,20 +86,20 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_tools-lint_version # and whatever else without interference from each other. - 'android_sdk_cmdline-tools_version': 'ijpIFSitwBfaEdO9VXBGPqDHUVzPimXy_whw3aHTN9oC', + 'android_sdk_cmdline-tools_version': 'V__2Ycej-H2-6AcXX5A3gi7sIk74SuN44PBm2uC_N1sC', } deps = { 'build': - Var('chromium_url') + '/chromium/src/build.git' + '@' + '38a49c12ded01dd8c4628b432cb7eebfb29e77f1', + Var('chromium_url') + '/chromium/src/build.git' + '@' + '2101eff1ac4bfd25f2dfa71ad632a600a38c1ed9', 'third_party/depot_tools': - Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '1099c11d5d12255458303c1ba4e5584cfde90477', + Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '982b2a757087c2519e42b82b93cbfe5adf43cdd5', 'third_party/icu': - Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'aef20f06d47ba76fdf13abcdb033e2a408b5a94d', + Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'c2a4cae149aae7fd30c4cbe3cf1b30df03b386f1', 'third_party/instrumented_libraries': - Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + '3c52ccdd3b9edf8fb7b3bd8ba945cce47d887ea8', + Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + '6ba978ccb754d270b6cd12da58c8269b617e4f6e', 'buildtools': - Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '3ff4f5027b4b81a6c9c36d64d71444f2709a4896', + Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '6302c1175607a436e18947a5abe9df2209e845fc', 'buildtools/clang_format/script': Var('chromium_url') + '/chromium/llvm-project/cfe/tools/clang-format.git' + '@' + '96636aa0e9f047f17447f2d45a094d0b59ed7917', 'buildtools/linux64': { @@ -130,13 +139,13 @@ deps = { 'condition': 'host_os == "win"', }, 'base/trace_event/common': - Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + '23ef5333a357fc7314630ef88b44c3a545881dee', + Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + 'eb94f1c7aa96207f469008f29989a43feb2718f8', 'third_party/android_ndk': { 'url': Var('chromium_url') + '/android_ndk.git' + '@' + '27c0a8d090c666a50e40fceb4ee5b40b1a2d3f87', 'condition': 'checkout_android', }, 'third_party/android_platform': { - 'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + 'fc6c6840eeb254ac4fd199c548c54178ce3545bb', + 'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + 'ef64306e7772dea22df5f98102e6288da3510843', 'condition': 'checkout_android', }, 'third_party/android_sdk/public': { @@ -178,7 +187,7 @@ deps = { 'dep_type': 'cipd', }, 'third_party/catapult': { - 'url': Var('chromium_url') + '/catapult.git' + '@' + '18d69fb4e7b2225974dfc306ca0c11a58fe4e917', + 'url': Var('chromium_url') + '/catapult.git' + '@' + '434681c2378b686117c2b003a58c54d78f22185f', 'condition': 'checkout_android', }, 'third_party/colorama/src': { @@ -186,7 +195,7 @@ deps = { 'condition': 'checkout_android', }, 'third_party/fuchsia-sdk': { - 'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-sdk.git' + '@' + '6a38b0e1f1f4a6255959b259a681e46ee72dee58', + 'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-sdk.git' + '@' + 'f8df9ff79b878d1998970cc04a197061069e48ce', 'condition': 'checkout_fuchsia', }, 'third_party/googletest/src': @@ -198,15 +207,15 @@ deps = { 'third_party/jinja2': Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + 'a82a4944a7f2496639f34a89c9923be5908b80aa', 'third_party/markupsafe': - Var('chromium_url') + '/chromium/src/third_party/markupsafe.git' + '@' + 'f2fb0f21ef1e1d4ffd43be8c63fc3d4928dea7ab', + Var('chromium_url') + '/chromium/src/third_party/markupsafe.git' + '@' + '0944e71f4b2cb9a871bcbe353f95e889b64a611a', 'tools/swarming_client': - Var('chromium_url') + '/infra/luci/client-py.git' + '@' + '44c13d73156581ea09b9389001e58c23a4b8d70a', + Var('chromium_url') + '/infra/luci/client-py.git' + '@' + 'd46ea7635f2911208268170512cb611412488fd8', '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' + '@' + '63976020376c8c2b0ebabf37c364f25288d4b93b', + Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + '0e7319c015fe935594f8bcafaedb0c94f7fec1df', 'test/test262/harness': Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '4555345a943d0c99a9461182705543fb171dda4b', 'third_party/qemu-linux-x64': { @@ -233,7 +242,7 @@ deps = { 'packages': [ { 'package': 'fuchsia/third_party/aemu/linux-amd64', - 'version': 'FfxmX7LQ9OID3pVAmcemr6u9lK3xjXzAXxvqzEcclMwC' + 'version': 'xP4TXh9wWGTG0qr4y6eFcUO_0HOBmt3vorgtVmpwBJsC' }, ], 'condition': 'host_os == "linux" and checkout_fuchsia', @@ -250,7 +259,7 @@ deps = { 'dep_type': 'cipd', }, 'tools/clang': - Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '3017edade60658a699be776d9e282509a902ffe9', + Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'a37c0858a645506c8e9d3bebab1ed5a5b1f9df61', 'tools/luci-go': { 'packages': [ { @@ -280,11 +289,11 @@ deps = { 'dep_type': 'cipd', }, 'third_party/perfetto': - Var('android_url') + '/platform/external/perfetto.git' + '@' + 'ff70e0d273ed10995866c803f23e11250eb3dc52', + Var('android_url') + '/platform/external/perfetto.git' + '@' + '7cdc44f903d3bcfd1d0f67188bfa797a24756868', 'third_party/protobuf': Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + 'b68a347f56137b4b1a746e8c7438495a6ac1bd91', 'third_party/zlib': - Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '4668feaaa47973a6f9d9f9caeb14cd03731854f1', + Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + 'e84c9a3fd75fdc39055b7ae27d6ec508e50bd39e', 'third_party/jsoncpp/source': Var('chromium_url') + '/external/github.com/open-source-parsers/jsoncpp.git'+ '@' + '9059f5cad030ba11d37818847443a53918c327b1', 'third_party/ittapi': { @@ -519,12 +528,21 @@ hooks = [ '-o', 'build/util/LASTCHANGE'], }, { - 'name': 'fuchsia_sdk', + 'name': 'Download Fuchsia SDK', 'pattern': '.', 'condition': 'checkout_fuchsia', 'action': [ 'python', 'build/fuchsia/update_sdk.py', + ], + }, + { + 'name': 'Download Fuchsia system images', + 'pattern': '.', + 'condition': 'checkout_fuchsia', + 'action': [ + 'python', + 'build/fuchsia/update_images.py', '--boot-images={checkout_fuchsia_boot_images}', ], }, diff --git a/deps/v8/DIR_METADATA b/deps/v8/DIR_METADATA new file mode 100644 index 00000000000000..72c04a4d913880 --- /dev/null +++ b/deps/v8/DIR_METADATA @@ -0,0 +1,12 @@ +# Metadata information for this directory. +# +# For more information on DIR_METADATA files, see: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md +# +# For the schema of this file, see Metadata message: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto + +monorail { + component: "Blink>JavaScript" +} +team_email: "v8-dev@googlegroups.com" \ No newline at end of file diff --git a/deps/v8/OWNERS b/deps/v8/OWNERS index e096d3c950fc50..3698d14dd923b9 100644 --- a/deps/v8/OWNERS +++ b/deps/v8/OWNERS @@ -27,6 +27,3 @@ per-file *-mips*=file:MIPS_OWNERS per-file *-mips64*=file:MIPS_OWNERS per-file *-ppc*=file:PPC_OWNERS per-file *-s390*=file:S390_OWNERS - -# TEAM: v8-dev@googlegroups.com -# COMPONENT: Blink>JavaScript diff --git a/deps/v8/PPC_OWNERS b/deps/v8/PPC_OWNERS index 6edd45a6ef2e04..02c2cd757c9cb7 100644 --- a/deps/v8/PPC_OWNERS +++ b/deps/v8/PPC_OWNERS @@ -2,3 +2,4 @@ junyan@redhat.com joransiu@ca.ibm.com midawson@redhat.com mfarazma@redhat.com +vasili.skurydzin@ibm.com diff --git a/deps/v8/PRESUBMIT.py b/deps/v8/PRESUBMIT.py index eba4158d81c20d..113ed2fd61fa69 100644 --- a/deps/v8/PRESUBMIT.py +++ b/deps/v8/PRESUBMIT.py @@ -80,6 +80,7 @@ def _V8PresubmitChecks(input_api, output_api): sys.path.append(input_api.os_path.join( input_api.PresubmitLocalPath(), 'tools')) from v8_presubmit import CppLintProcessor + from v8_presubmit import JSLintProcessor from v8_presubmit import TorqueLintProcessor from v8_presubmit import SourceProcessor from v8_presubmit import StatusFilesProcessor @@ -95,6 +96,11 @@ def FilterTorqueFile(affected_file): affected_file, files_to_check=(r'.+\.tq')) + def FilterJSFile(affected_file): + return input_api.FilterSourceFile( + affected_file, + files_to_check=(r'.+\.m?js')) + results = [] if not CppLintProcessor().RunOnFiles( input_api.AffectedFiles(file_filter=FilterFile, include_deletes=False)): @@ -103,6 +109,10 @@ def FilterTorqueFile(affected_file): input_api.AffectedFiles(file_filter=FilterTorqueFile, include_deletes=False)): results.append(output_api.PresubmitError("Torque format check failed")) + if not JSLintProcessor().RunOnFiles( + input_api.AffectedFiles(file_filter=FilterJSFile, + include_deletes=False)): + results.append(output_api.PresubmitError("JS format check failed")) if not SourceProcessor().RunOnFiles( input_api.AffectedFiles(include_deletes=False)): results.append(output_api.PresubmitError( diff --git a/deps/v8/S390_OWNERS b/deps/v8/S390_OWNERS index 6edd45a6ef2e04..02c2cd757c9cb7 100644 --- a/deps/v8/S390_OWNERS +++ b/deps/v8/S390_OWNERS @@ -2,3 +2,4 @@ junyan@redhat.com joransiu@ca.ibm.com midawson@redhat.com mfarazma@redhat.com +vasili.skurydzin@ibm.com 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 28b7275345c434..120481f30fad6e 100644 --- a/deps/v8/base/trace_event/common/trace_event_common.h +++ b/deps/v8/base/trace_event/common/trace_event_common.h @@ -969,6 +969,7 @@ #define TRACE_TASK_EXECUTION(run_function, task) \ INTERNAL_TRACE_TASK_EXECUTION(run_function, task) +// Special trace event macro to trace log messages. #define TRACE_LOG_MESSAGE(file, message, line) \ INTERNAL_TRACE_LOG_MESSAGE(file, message, line) diff --git a/deps/v8/gni/proto_library.gni b/deps/v8/gni/proto_library.gni index eca3ffb84e55ac..0b72d7b8a4533c 100644 --- a/deps/v8/gni/proto_library.gni +++ b/deps/v8/gni/proto_library.gni @@ -11,8 +11,6 @@ template("proto_library") { assert(defined(invoker.sources)) proto_sources = invoker.sources - set_sources_assignment_filter([]) - if (host_os == "win") { host_executable_suffix = ".exe" } else { @@ -141,6 +139,12 @@ template("proto_library") { ] } + 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 = "" @@ -187,10 +191,7 @@ template("proto_library") { "visibility", ]) - # Exclude the config.descriptor file which is an output for some reason. - set_sources_assignment_filter([ "*.descriptor" ]) sources = get_target_outputs(":$action_name") - set_sources_assignment_filter(sources_assignment_filter) # configs -= [ "//gn/standalone:extra_warnings" ] if (defined(invoker.extra_configs)) { diff --git a/deps/v8/include/DIR_METADATA b/deps/v8/include/DIR_METADATA new file mode 100644 index 00000000000000..a27ea1b53a3f53 --- /dev/null +++ b/deps/v8/include/DIR_METADATA @@ -0,0 +1,11 @@ +# Metadata information for this directory. +# +# For more information on DIR_METADATA files, see: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md +# +# For the schema of this file, see Metadata message: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto + +monorail { + component: "Blink>JavaScript>API" +} \ No newline at end of file diff --git a/deps/v8/include/OWNERS b/deps/v8/include/OWNERS index 9bb043db7c2a3e..19c21fbf52c6e2 100644 --- a/deps/v8/include/OWNERS +++ b/deps/v8/include/OWNERS @@ -21,5 +21,3 @@ per-file js_protocol.pdl=pfeldman@chromium.org per-file v8-version.h=file:../INFRA_OWNERS per-file v8-version.h=hablich@chromium.org per-file v8-version.h=vahl@chromium.org - -# COMPONENT: Blink>JavaScript>API diff --git a/deps/v8/include/cppgc/DEPS b/deps/v8/include/cppgc/DEPS index 04c343de27c329..861d1187ba5501 100644 --- a/deps/v8/include/cppgc/DEPS +++ b/deps/v8/include/cppgc/DEPS @@ -4,4 +4,5 @@ include_rules = [ "+v8-platform.h", "+cppgc", "-src", + "+libplatform/libplatform.h", ] diff --git a/deps/v8/include/cppgc/allocation.h b/deps/v8/include/cppgc/allocation.h index ac5062ad01a55e..556f313a4ac81c 100644 --- a/deps/v8/include/cppgc/allocation.h +++ b/deps/v8/include/cppgc/allocation.h @@ -112,15 +112,24 @@ class MakeGarbageCollectedTraitBase } }; +/** + * struct used specify to MakeGarbageCollected how many bytes should be + * appended to the allocated object. + */ +struct AdditionalBytes { + explicit AdditionalBytes(size_t bytes) : value(bytes) {} + const size_t value; +}; + /** * Default trait class that specifies how to construct an object of type T. * Advanced users may override how an object is constructed using the utilities * that are provided through MakeGarbageCollectedTraitBase. * * Any trait overriding construction must - * - allocate through MakeGarbageCollectedTraitBase::Allocate; + * - allocate through `MakeGarbageCollectedTraitBase::Allocate`; * - mark the object as fully constructed using - * MakeGarbageCollectedTraitBase::MarkObjectAsFullyConstructed; + * `MakeGarbageCollectedTraitBase::MarkObjectAsFullyConstructed`; */ template class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase { @@ -139,6 +148,22 @@ class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase { MakeGarbageCollectedTraitBase::MarkObjectAsFullyConstructed(object); return object; } + + 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)...); + MakeGarbageCollectedTraitBase::MarkObjectAsFullyConstructed(object); + return object; + } }; /** @@ -168,6 +193,25 @@ T* MakeGarbageCollected(AllocationHandle& handle, Args&&... args) { return object; } +/** + * Constructs a managed object of type T where T transitively inherits from + * GarbageCollected. Created objects will have additional bytes appended to + * it. Allocated memory would suffice for `sizeof(T) + additional_bytes`. + * + * \param additional_bytes Denotes how many bytes to append to T. + * \param args List of arguments with which an instance of T will be + * constructed. + * \returns an instance of type T. + */ +template +T* MakeGarbageCollected(AllocationHandle& handle, + AdditionalBytes additional_bytes, Args&&... args) { + T* object = MakeGarbageCollectedTrait::Call(handle, additional_bytes, + std::forward(args)...); + PostConstructionCallbackTrait::Call(object); + return object; +} + } // namespace cppgc #endif // INCLUDE_CPPGC_ALLOCATION_H_ diff --git a/deps/v8/include/cppgc/cross-thread-persistent.h b/deps/v8/include/cppgc/cross-thread-persistent.h new file mode 100644 index 00000000000000..3d49d557c2beb3 --- /dev/null +++ b/deps/v8/include/cppgc/cross-thread-persistent.h @@ -0,0 +1,311 @@ +// 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_CROSS_THREAD_PERSISTENT_H_ +#define INCLUDE_CPPGC_CROSS_THREAD_PERSISTENT_H_ + +#include + +#include "cppgc/internal/persistent-node.h" +#include "cppgc/internal/pointer-policies.h" +#include "cppgc/persistent.h" +#include "cppgc/visitor.h" + +namespace cppgc { + +namespace internal { + +template +class BasicCrossThreadPersistent final : public PersistentBase, + public LocationPolicy, + private WeaknessPolicy, + private CheckingPolicy { + public: + using typename WeaknessPolicy::IsStrongPersistent; + using PointeeType = T; + + ~BasicCrossThreadPersistent() { Clear(); } + + BasicCrossThreadPersistent( // NOLINT + const SourceLocation& loc = SourceLocation::Current()) + : LocationPolicy(loc) {} + + BasicCrossThreadPersistent( // NOLINT + std::nullptr_t, const SourceLocation& loc = SourceLocation::Current()) + : LocationPolicy(loc) {} + + BasicCrossThreadPersistent( // NOLINT + SentinelPointer s, const SourceLocation& loc = SourceLocation::Current()) + : PersistentBase(s), LocationPolicy(loc) {} + + BasicCrossThreadPersistent( // NOLINT + 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); + } + + BasicCrossThreadPersistent( // NOLINT + T& raw, const SourceLocation& loc = SourceLocation::Current()) + : BasicCrossThreadPersistent(&raw, loc) {} + + template ::value>> + BasicCrossThreadPersistent( // NOLINT + internal::BasicMember + member, + const SourceLocation& loc = SourceLocation::Current()) + : BasicCrossThreadPersistent(member.Get(), loc) {} + + BasicCrossThreadPersistent( + const BasicCrossThreadPersistent& other, + const SourceLocation& loc = SourceLocation::Current()) + : BasicCrossThreadPersistent(loc) { + // Invoke operator=. + *this = other; + } + + // Heterogeneous ctor. + template ::value>> + BasicCrossThreadPersistent( // NOLINT + const BasicCrossThreadPersistent& other, + const SourceLocation& loc = SourceLocation::Current()) + : BasicCrossThreadPersistent(loc) { + *this = other; + } + + BasicCrossThreadPersistent( + BasicCrossThreadPersistent&& other, + const SourceLocation& loc = SourceLocation::Current()) noexcept { + // Invoke operator=. + *this = std::move(other); + } + + BasicCrossThreadPersistent& operator=( + const BasicCrossThreadPersistent& other) { + PersistentRegionLock guard; + AssignUnsafe(other.Get()); + return *this; + } + + template ::value>> + BasicCrossThreadPersistent& operator=( + const BasicCrossThreadPersistent& other) { + PersistentRegionLock guard; + AssignUnsafe(other.Get()); + return *this; + } + + BasicCrossThreadPersistent& operator=(BasicCrossThreadPersistent&& other) { + if (this == &other) return *this; + Clear(); + PersistentRegionLock guard; + PersistentBase::operator=(std::move(other)); + LocationPolicy::operator=(std::move(other)); + if (!IsValid(GetValue())) return *this; + GetNode()->UpdateOwner(this); + other.SetValue(nullptr); + other.SetNode(nullptr); + this->CheckPointer(GetValue()); + return *this; + } + + BasicCrossThreadPersistent& operator=(T* other) { + Assign(other); + return *this; + } + + // Assignment from member. + template ::value>> + BasicCrossThreadPersistent& operator=( + internal::BasicMember + member) { + return operator=(member.Get()); + } + + BasicCrossThreadPersistent& operator=(std::nullptr_t) { + Clear(); + return *this; + } + + BasicCrossThreadPersistent& operator=(SentinelPointer s) { + Assign(s); + return *this; + } + + /** + * Returns a pointer to the stored object. + * + * Note: **Not thread-safe.** + * + * \returns a pointer to the stored object. + */ + // CFI cast exemption to allow passing SentinelPointer through T* and support + // 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()); + } + + /** + * Clears the stored object. + */ + void Clear() { Assign(nullptr); } + + /** + * Returns a pointer to the stored object and releases it. + * + * Note: **Not thread-safe.** + * + * \returns a pointer to the stored object. + */ + T* Release() { + T* result = Get(); + Clear(); + return result; + } + + /** + * Conversio to boolean. + * + * Note: **Not thread-safe.** + * + * \returns true if an actual object has been stored and false otherwise. + */ + explicit operator bool() const { return Get(); } + + /** + * Conversion to object of type T. + * + * Note: **Not thread-safe.** + * + * \returns the object. + */ + operator T*() const { return Get(); } // NOLINT + + /** + * Dereferences the stored object. + * + * Note: **Not thread-safe.** + */ + T* operator->() const { return Get(); } + T& operator*() const { return *Get(); } + + private: + static bool IsValid(void* ptr) { return ptr && ptr != kSentinelPointer; } + + static void Trace(Visitor* v, const void* ptr) { + const auto* handle = static_cast(ptr); + v->TraceRoot(*handle, handle->Location()); + } + + void Assign(T* ptr) { + void* old_value = GetValue(); + if (IsValid(old_value)) { + PersistentRegionLock guard; + PersistentRegion& region = this->GetPersistentRegion(old_value); + if (IsValid(ptr) && (®ion == &this->GetPersistentRegion(ptr))) { + SetValue(ptr); + this->CheckPointer(ptr); + return; + } + region.FreeNode(GetNode()); + SetNode(nullptr); + } + SetValue(ptr); + if (!IsValid(ptr)) return; + PersistentRegionLock guard; + SetNode(this->GetPersistentRegion(ptr).AllocateNode(this, &Trace)); + this->CheckPointer(ptr); + } + + void AssignUnsafe(T* ptr) { + void* old_value = GetValue(); + if (IsValid(old_value)) { + PersistentRegion& region = this->GetPersistentRegion(old_value); + if (IsValid(ptr) && (®ion == &this->GetPersistentRegion(ptr))) { + SetValue(ptr); + this->CheckPointer(ptr); + return; + } + region.FreeNode(GetNode()); + SetNode(nullptr); + } + SetValue(ptr); + if (!IsValid(ptr)) return; + SetNode(this->GetPersistentRegion(ptr).AllocateNode(this, &Trace)); + this->CheckPointer(ptr); + } + + void ClearFromGC() const { + if (IsValid(GetValue())) { + WeaknessPolicy::GetPersistentRegion(GetValue()).FreeNode(GetNode()); + PersistentBase::ClearFromGC(); + } + } + + friend class cppgc::Visitor; +}; + +template +struct IsWeak< + BasicCrossThreadPersistent> + : std::true_type {}; + +} // namespace internal + +namespace subtle { + +/** + * **DO NOT USE: Has known caveats, see below.** + * + * CrossThreadPersistent allows retaining objects from threads other than the + * thread the owning heap is operating on. + * + * Known caveats: + * - Does not protect the heap owning an object from terminating. + * - Reaching transitively through the graph is unsupported as objects may be + * moved concurrently on the thread owning the object. + */ +template +using CrossThreadPersistent = internal::BasicCrossThreadPersistent< + T, internal::StrongCrossThreadPersistentPolicy>; + +/** + * **DO NOT USE: Has known caveats, see below.** + * + * CrossThreadPersistent allows weakly retaining objects from threads other than + * the thread the owning heap is operating on. + * + * Known caveats: + * - Does not protect the heap owning an object from terminating. + * - Reaching transitively through the graph is unsupported as objects may be + * moved concurrently on the thread owning the object. + */ +template +using WeakCrossThreadPersistent = internal::BasicCrossThreadPersistent< + T, internal::WeakCrossThreadPersistentPolicy>; + +} // namespace subtle +} // namespace cppgc + +#endif // INCLUDE_CPPGC_CROSS_THREAD_PERSISTENT_H_ diff --git a/deps/v8/include/cppgc/custom-space.h b/deps/v8/include/cppgc/custom-space.h index 2597a5bdef7a41..9a8cd876c3af35 100644 --- a/deps/v8/include/cppgc/custom-space.h +++ b/deps/v8/include/cppgc/custom-space.h @@ -22,11 +22,12 @@ class CustomSpaceBase { public: virtual ~CustomSpaceBase() = default; virtual CustomSpaceIndex GetCustomSpaceIndex() const = 0; + virtual bool IsCompactable() const = 0; }; /** * Base class custom spaces should directly inherit from. The class inheriting - * from CustomSpace must define kSpaceIndex as unique space index. These + * from `CustomSpace` must define `kSpaceIndex` as unique space index. These * indices need for form a sequence starting at 0. * * Example: @@ -47,6 +48,12 @@ class CustomSpace : public CustomSpaceBase { CustomSpaceIndex GetCustomSpaceIndex() const final { return ConcreteCustomSpace::kSpaceIndex; } + bool IsCompactable() const final { + return ConcreteCustomSpace::kSupportsCompaction; + } + + protected: + static constexpr bool kSupportsCompaction = false; }; /** @@ -57,6 +64,28 @@ struct SpaceTrait { using Space = void; }; +namespace internal { + +template +struct IsAllocatedOnCompactableSpaceImpl { + static constexpr bool value = CustomSpace::kSupportsCompaction; +}; + +template <> +struct IsAllocatedOnCompactableSpaceImpl { + // Non-custom spaces are by default not compactable. + static constexpr bool value = false; +}; + +template +struct IsAllocatedOnCompactableSpace { + public: + static constexpr bool value = + IsAllocatedOnCompactableSpaceImpl::Space>::value; +}; + +} // namespace internal + } // namespace cppgc #endif // INCLUDE_CPPGC_CUSTOM_SPACE_H_ diff --git a/deps/v8/include/cppgc/default-platform.h b/deps/v8/include/cppgc/default-platform.h index da8129a81b1480..28990da92e6550 100644 --- a/deps/v8/include/cppgc/default-platform.h +++ b/deps/v8/include/cppgc/default-platform.h @@ -9,74 +9,49 @@ #include #include "cppgc/platform.h" +#include "libplatform/libplatform.h" #include "v8config.h" // NOLINT(build/include_directory) namespace cppgc { -namespace internal { -class DefaultJob; -} // namespace internal - -/** - * Default task runner implementation. Keep posted tasks in a list that can be - * processed by calling RunSingleTask() or RunUntilIdle(). - */ -class V8_EXPORT DefaultTaskRunner final : public cppgc::TaskRunner { - public: - DefaultTaskRunner() = default; - - DefaultTaskRunner(const DefaultTaskRunner&) = delete; - DefaultTaskRunner& operator=(const DefaultTaskRunner&) = delete; - - void PostTask(std::unique_ptr task) override; - void PostDelayedTask(std::unique_ptr task, double) override; - - bool NonNestableTasksEnabled() const final { return false; } - bool NonNestableDelayedTasksEnabled() const final { return false; } - void PostNonNestableTask(std::unique_ptr task) override; - void PostNonNestableDelayedTask(std::unique_ptr task, - double) override; - - void PostIdleTask(std::unique_ptr task) override; - bool IdleTasksEnabled() override { return true; } - - bool RunSingleTask(); - bool RunSingleIdleTask(double duration_in_seconds); - - void RunUntilIdle(); - - private: - std::vector> tasks_; - std::vector> idle_tasks_; -}; - /** - * Default platform implementation that uses std::thread for spawning job tasks. + * Platform provided by cppgc. Uses V8's DefaultPlatform provided by + * libplatform internally. Exception: `GetForegroundTaskRunner()`, see below. */ -class V8_EXPORT DefaultPlatform final : public Platform { +class V8_EXPORT DefaultPlatform : public Platform { public: - DefaultPlatform(); - ~DefaultPlatform() noexcept override; - - cppgc::PageAllocator* GetPageAllocator() final; - - double MonotonicallyIncreasingTime() final; - - std::shared_ptr GetForegroundTaskRunner() final; + using IdleTaskSupport = v8::platform::IdleTaskSupport; + explicit DefaultPlatform( + int thread_pool_size = 0, + IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled) + : v8_platform_(v8::platform::NewDefaultPlatform(thread_pool_size, + idle_task_support)) {} + + cppgc::PageAllocator* GetPageAllocator() override { + return v8_platform_->GetPageAllocator(); + } + + double MonotonicallyIncreasingTime() override { + return v8_platform_->MonotonicallyIncreasingTime(); + } + + std::shared_ptr GetForegroundTaskRunner() override { + // V8's default platform creates a new task runner when passed the + // `v8::Isolate` pointer the first time. For non-default platforms this will + // require getting the appropriate task runner. + return v8_platform_->GetForegroundTaskRunner(kNoIsolate); + } - // DefaultPlatform does not support job priorities. All jobs would be - // assigned the same priority regardless of the cppgc::TaskPriority parameter. std::unique_ptr PostJob( cppgc::TaskPriority priority, - std::unique_ptr job_task) final; + std::unique_ptr job_task) override { + return v8_platform_->PostJob(priority, std::move(job_task)); + } - void WaitAllForegroundTasks(); - void WaitAllBackgroundTasks(); + protected: + static constexpr v8::Isolate* kNoIsolate = nullptr; - private: - std::unique_ptr page_allocator_; - std::shared_ptr foreground_task_runner_; - std::vector> jobs_; + std::unique_ptr v8_platform_; }; } // namespace cppgc diff --git a/deps/v8/include/cppgc/ephemeron-pair.h b/deps/v8/include/cppgc/ephemeron-pair.h new file mode 100644 index 00000000000000..47163d30710b0e --- /dev/null +++ b/deps/v8/include/cppgc/ephemeron-pair.h @@ -0,0 +1,25 @@ +// 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_EPHEMERON_PAIR_H_ +#define INCLUDE_CPPGC_EPHEMERON_PAIR_H_ + +#include "cppgc/member.h" + +namespace cppgc { + +/** + * An ephemeron pair is used to conditionally retain an object. + * The `value` will be kept alive only if the `key` is alive. + */ +template +struct EphemeronPair { + EphemeronPair(K* k, V* v) : key(k), value(v) {} + WeakMember key; + Member value; +}; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_EPHEMERON_PAIR_H_ diff --git a/deps/v8/include/cppgc/garbage-collected.h b/deps/v8/include/cppgc/garbage-collected.h index 3c800ef61b73e5..d28a39074aeec0 100644 --- a/deps/v8/include/cppgc/garbage-collected.h +++ b/deps/v8/include/cppgc/garbage-collected.h @@ -39,8 +39,8 @@ class GarbageCollectedBase { } // namespace internal /** - * Base class for managed objects. Only descendent types of GarbageCollected - * can be constructed using MakeGarbageCollected. Must be inherited from as + * Base class for managed objects. Only descendent types of `GarbageCollected` + * can be constructed using `MakeGarbageCollected()`. Must be inherited from as * left-most base class. * * Types inheriting from GarbageCollected must provide a method of diff --git a/deps/v8/include/cppgc/heap.h b/deps/v8/include/cppgc/heap.h index 029158f4a5884c..04a55598bd853a 100644 --- a/deps/v8/include/cppgc/heap.h +++ b/deps/v8/include/cppgc/heap.h @@ -66,20 +66,20 @@ class V8_EXPORT Heap { /** * Options specifying Heap properties (e.g. custom spaces) when initializing a - * heap through Heap::Create(). + * heap through `Heap::Create()`. */ struct HeapOptions { /** * Creates reasonable defaults for instantiating a Heap. * - * \returns the HeapOptions that can be passed to Heap::Create(). + * \returns the HeapOptions that can be passed to `Heap::Create()`. */ static HeapOptions Default() { return {}; } /** * Custom spaces added to heap are required to have indices forming a - * numbered sequence starting at 0, i.e., their kSpaceIndex must correspond - * to the index they reside in the vector. + * numbered sequence starting at 0, i.e., their `kSpaceIndex` must + * correspond to the index they reside in the vector. */ std::vector> custom_spaces; @@ -89,7 +89,7 @@ class V8_EXPORT Heap { * garbage collections using non-nestable task, which are guaranteed to have * no interesting stack, through the provided Platform. If such tasks are * not supported by the Platform, the embedder must take care of invoking - * the GC through ForceGarbageCollectionSlow(). + * the GC through `ForceGarbageCollectionSlow()`. */ StackSupport stack_support = StackSupport::kSupportsConservativeStackScan; @@ -126,6 +126,10 @@ class V8_EXPORT Heap { const char* source, const char* reason, StackState stack_state = StackState::kMayContainHeapPointers); + /** + * \returns the opaque handle for allocating objects using + * `MakeGarbageCollected()`. + */ AllocationHandle& GetAllocationHandle(); private: diff --git a/deps/v8/include/cppgc/internal/gc-info.h b/deps/v8/include/cppgc/internal/gc-info.h index 3d361e6d71adb6..9c26d6aa5b42bb 100644 --- a/deps/v8/include/cppgc/internal/gc-info.h +++ b/deps/v8/include/cppgc/internal/gc-info.h @@ -8,6 +8,7 @@ #include #include "cppgc/internal/finalizer-trait.h" +#include "cppgc/internal/name-trait.h" #include "cppgc/trace-trait.h" #include "v8config.h" // NOLINT(build/include_directory) @@ -19,7 +20,8 @@ using GCInfoIndex = uint16_t; class V8_EXPORT RegisteredGCInfoIndex final { public: RegisteredGCInfoIndex(FinalizationCallback finalization_callback, - TraceCallback trace_callback, bool has_v_table); + TraceCallback trace_callback, + NameCallback name_callback, bool has_v_table); GCInfoIndex GetIndex() const { return index_; } private: @@ -34,7 +36,7 @@ struct GCInfoTrait { static_assert(sizeof(T), "T must be fully defined"); static const RegisteredGCInfoIndex registered_index( FinalizerTrait::kCallback, TraceTrait::Trace, - std::is_polymorphic::value); + NameTrait::GetName, std::is_polymorphic::value); return registered_index.GetIndex(); } }; diff --git a/deps/v8/include/cppgc/internal/name-trait.h b/deps/v8/include/cppgc/internal/name-trait.h new file mode 100644 index 00000000000000..ae99d41c0d76f9 --- /dev/null +++ b/deps/v8/include/cppgc/internal/name-trait.h @@ -0,0 +1,111 @@ +// 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_NAME_TRAIT_H_ +#define INCLUDE_CPPGC_INTERNAL_NAME_TRAIT_H_ + +#include + +#include "cppgc/name-provider.h" +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { +namespace internal { + +#if CPPGC_SUPPORTS_OBJECT_NAMES && defined(__clang__) +#define CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME 1 + +// Provides constexpr c-string storage for a name of fixed |Size| characters. +// Automatically appends terminating 0 byte. +template +struct NameBuffer { + char name[Size + 1]{}; + + static constexpr NameBuffer FromCString(const char* str) { + NameBuffer result; + for (size_t i = 0; i < Size; ++i) result.name[i] = str[i]; + result.name[Size] = 0; + return result; + } +}; + +template +const char* GetTypename() { + static constexpr char kSelfPrefix[] = + "const char *cppgc::internal::GetTypename() [T ="; + static_assert(__builtin_strncmp(__PRETTY_FUNCTION__, kSelfPrefix, + sizeof(kSelfPrefix) - 1) == 0, + "The prefix must match"); + static constexpr const char* kTypenameStart = + __PRETTY_FUNCTION__ + sizeof(kSelfPrefix); + static constexpr size_t kTypenameSize = + __builtin_strlen(__PRETTY_FUNCTION__) - sizeof(kSelfPrefix) - 1; + // NameBuffer is an indirection that is needed to make sure that only a + // substring of __PRETTY_FUNCTION__ gets materialized in the binary. + static constexpr auto buffer = + NameBuffer::FromCString(kTypenameStart); + return buffer.name; +} + +#else +#define CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME 0 +#endif + +struct HeapObjectName { + const char* value; + bool name_was_hidden; +}; + +class V8_EXPORT NameTraitBase { + protected: + static HeapObjectName GetNameFromTypeSignature(const char*); +}; + +// Trait that specifies how the garbage collector retrieves the name for a +// given object. +template +class NameTrait final : public NameTraitBase { + public: + static HeapObjectName GetName(const void* obj) { + return GetNameFor(static_cast(obj)); + } + + private: + static HeapObjectName GetNameFor(const NameProvider* name_provider) { + return {name_provider->GetName(), false}; + } + + static HeapObjectName GetNameFor(...) { +#if CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME + return {GetTypename(), false}; +#elif CPPGC_SUPPORTS_OBJECT_NAMES + +#if defined(V8_CC_GNU) +#define PRETTY_FUNCTION_VALUE __PRETTY_FUNCTION__ +#elif defined(V8_CC_MSVC) +#define PRETTY_FUNCTION_VALUE __FUNCSIG__ +#else +#define PRETTY_FUNCTION_VALUE nullptr +#endif + + static const HeapObjectName leaky_name = + GetNameFromTypeSignature(PRETTY_FUNCTION_VALUE); + return leaky_name; + +#undef PRETTY_FUNCTION_VALUE + +#else // !CPPGC_SUPPORTS_OBJECT_NAMES + return {NameProvider::kHiddenName, true}; +#endif // !CPPGC_SUPPORTS_OBJECT_NAMES + } +}; + +using NameCallback = HeapObjectName (*)(const void*); + +} // namespace internal +} // namespace cppgc + +#undef CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME + +#endif // INCLUDE_CPPGC_INTERNAL_NAME_TRAIT_H_ diff --git a/deps/v8/include/cppgc/internal/persistent-node.h b/deps/v8/include/cppgc/internal/persistent-node.h index e05efe362131d8..685d8a2d6ad1f4 100644 --- a/deps/v8/include/cppgc/internal/persistent-node.h +++ b/deps/v8/include/cppgc/internal/persistent-node.h @@ -19,7 +19,7 @@ class Visitor; namespace internal { -// PersistentNode represesents a variant of two states: +// PersistentNode represents a variant of two states: // 1) traceable node with a back pointer to the Persistent object; // 2) freelist entry. class PersistentNode final { @@ -109,6 +109,14 @@ class V8_EXPORT PersistentRegion final { PersistentNode* free_list_head_ = nullptr; }; +// CrossThreadPersistent uses PersistentRegion but protects it using this lock +// when needed. +class V8_EXPORT PersistentRegionLock final { + public: + PersistentRegionLock(); + ~PersistentRegionLock(); +}; + } // namespace internal } // namespace cppgc diff --git a/deps/v8/include/cppgc/internal/pointer-policies.h b/deps/v8/include/cppgc/internal/pointer-policies.h index a6cd4e8586d9cf..50c5d5768fcf84 100644 --- a/deps/v8/include/cppgc/internal/pointer-policies.h +++ b/deps/v8/include/cppgc/internal/pointer-policies.h @@ -62,6 +62,7 @@ class KeepLocationPolicy { constexpr const SourceLocation& Location() const { return location_; } protected: + constexpr KeepLocationPolicy() = default; constexpr explicit KeepLocationPolicy(const SourceLocation& location) : location_(location) {} @@ -82,6 +83,7 @@ class IgnoreLocationPolicy { constexpr SourceLocation Location() const { return {}; } protected: + constexpr IgnoreLocationPolicy() = default; constexpr explicit IgnoreLocationPolicy(const SourceLocation&) {} }; @@ -93,17 +95,29 @@ using DefaultLocationPolicy = IgnoreLocationPolicy; struct StrongPersistentPolicy { using IsStrongPersistent = std::true_type; - static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object); }; struct WeakPersistentPolicy { using IsStrongPersistent = std::false_type; + static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object); +}; + +struct StrongCrossThreadPersistentPolicy { + using IsStrongPersistent = std::true_type; + static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object); +}; +struct WeakCrossThreadPersistentPolicy { + using IsStrongPersistent = std::false_type; static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object); }; -// Persistent/Member forward declarations. +// Forward declarations setting up the default policies. +template +class BasicCrossThreadPersistent; template diff --git a/deps/v8/include/cppgc/liveness-broker.h b/deps/v8/include/cppgc/liveness-broker.h index 883be46240ff86..b69a69535b6c8a 100644 --- a/deps/v8/include/cppgc/liveness-broker.h +++ b/deps/v8/include/cppgc/liveness-broker.h @@ -19,7 +19,7 @@ class LivenessBrokerFactory; /** * The broker is passed to weak callbacks to allow (temporarily) querying * the liveness state of an object. References to non-live objects must be - * cleared when IsHeapObjectAlive() returns false. + * cleared when `IsHeapObjectAlive()` returns false. * * \code * class GCedWithCustomWeakCallback final diff --git a/deps/v8/include/cppgc/member.h b/deps/v8/include/cppgc/member.h index 116a2c7e54a2e6..84e81251c25ddf 100644 --- a/deps/v8/include/cppgc/member.h +++ b/deps/v8/include/cppgc/member.h @@ -24,7 +24,7 @@ class MemberBase { MemberBase() = default; explicit MemberBase(void* value) : raw_(value) {} - void* const* GetRawSlot() const { return &raw_; } + void** GetRawSlot() const { return &raw_; } void* GetRaw() const { return raw_; } void SetRaw(void* value) { raw_ = value; } @@ -178,6 +178,10 @@ class BasicMember final : private MemberBase, private CheckingPolicy { return result; } + const T** GetSlotForTesting() const { + return reinterpret_cast(const_cast(GetRawSlot())); + } + private: T* GetRawAtomic() const { return static_cast(MemberBase::GetRawAtomic()); diff --git a/deps/v8/include/cppgc/name-provider.h b/deps/v8/include/cppgc/name-provider.h new file mode 100644 index 00000000000000..8b70b8ea5ee89a --- /dev/null +++ b/deps/v8/include/cppgc/name-provider.h @@ -0,0 +1,65 @@ +// 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_NAME_PROVIDER_H_ +#define INCLUDE_CPPGC_NAME_PROVIDER_H_ + +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { + +/** + * NameProvider allows for providing a human-readable name for garbage-collected + * objects. + * + * There's two cases of names to distinguish: + * a. Explicitly specified names via using NameProvider. Such names are always + * preserved in the system. + * b. Internal names that Oilpan infers from a C++ type on the class hierarchy + * of the object. This is not necessarily the type of the actually + * instantiated object. + * + * Depending on the build configuration, Oilpan may hide names, i.e., represent + * them with kHiddenName, of case b. to avoid exposing internal details. + */ +class V8_EXPORT NameProvider { + public: + /** + * Name that is used when hiding internals. + */ + static constexpr const char kHiddenName[] = "InternalNode"; + + /** + * Name that is used in case compiler support is missing for composing a name + * from C++ types. + */ + static constexpr const char kNoNameDeducible[] = ""; + + /** + * Indicating whether internal names are hidden or not. + * + * @returns true if C++ names should be hidden and represented by kHiddenName. + */ + static constexpr bool HideInternalNames() { +#if CPPGC_SUPPORTS_OBJECT_NAMES + return false; +#else // !CPPGC_SUPPORTS_OBJECT_NAMES + return true; +#endif // !CPPGC_SUPPORTS_OBJECT_NAMES + } + + virtual ~NameProvider() = default; + + /** + * Specifies a name for the garbage-collected object. Such names will never + * be hidden, as they are explicitly specified by the user of this API. + * + * @returns a human readable name for the object. + */ + virtual const char* GetName() const = 0; +}; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_NAME_PROVIDER_H_ diff --git a/deps/v8/include/cppgc/platform.h b/deps/v8/include/cppgc/platform.h index b6c21bdec0f428..fb0b6b208275c9 100644 --- a/deps/v8/include/cppgc/platform.h +++ b/deps/v8/include/cppgc/platform.h @@ -51,22 +51,23 @@ class V8_EXPORT Platform { } /** - * Posts |job_task| to run in parallel. Returns a JobHandle associated with - * the Job, which can be joined or canceled. + * Posts `job_task` to run in parallel. Returns a `JobHandle` associated with + * the `Job`, which can be joined or canceled. * This avoids degenerate cases: - * - Calling CallOnWorkerThread() for each work item, causing significant + * - Calling `CallOnWorkerThread()` for each work item, causing significant * overhead. - * - Fixed number of CallOnWorkerThread() calls that split the work and might - * run for a long time. This is problematic when many components post + * - Fixed number of `CallOnWorkerThread()` calls that split the work and + * might run for a long time. This is problematic when many components post * "num cores" tasks and all expect to use all the cores. In these cases, * the scheduler lacks context to be fair to multiple same-priority requests * and/or ability to request lower priority work to yield when high priority * work comes in. - * A canonical implementation of |job_task| looks like: + * A canonical implementation of `job_task` looks like: + * \code * class MyJobTask : public JobTask { * public: * MyJobTask(...) : worker_queue_(...) {} - * // JobTask: + * // JobTask implementation. * void Run(JobDelegate* delegate) override { * while (!delegate->ShouldYield()) { * // Smallest unit of work. @@ -80,28 +81,33 @@ class V8_EXPORT Platform { * return worker_queue_.GetSize(); // Thread safe. * } * }; + * + * // ... * auto handle = PostJob(TaskPriority::kUserVisible, * std::make_unique(...)); * handle->Join(); + * \endcode * - * PostJob() and methods of the returned JobHandle/JobDelegate, must never be - * called while holding a lock that could be acquired by JobTask::Run or - * JobTask::GetMaxConcurrency -- that could result in a deadlock. This is - * because [1] JobTask::GetMaxConcurrency may be invoked while holding - * internal lock (A), hence JobTask::GetMaxConcurrency can only use a lock (B) - * if that lock is *never* held while calling back into JobHandle from any - * thread (A=>B/B=>A deadlock) and [2] JobTask::Run or - * JobTask::GetMaxConcurrency may be invoked synchronously from JobHandle - * (B=>JobHandle::foo=>B deadlock). + * `PostJob()` and methods of the returned JobHandle/JobDelegate, must never + * be called while holding a lock that could be acquired by `JobTask::Run()` + * or `JobTask::GetMaxConcurrency()` -- that could result in a deadlock. This + * is because (1) `JobTask::GetMaxConcurrency()` may be invoked while holding + * internal lock (A), hence `JobTask::GetMaxConcurrency()` can only use a lock + * (B) if that lock is *never* held while calling back into `JobHandle` from + * any thread (A=>B/B=>A deadlock) and (2) `JobTask::Run()` or + * `JobTask::GetMaxConcurrency()` may be invoked synchronously from + * `JobHandle` (B=>JobHandle::foo=>B deadlock). * - * A sufficient PostJob() implementation that uses the default Job provided in - * libplatform looks like: - * std::unique_ptr PostJob( - * TaskPriority priority, std::unique_ptr job_task) override { - * return std::make_unique( - * std::make_shared( - * this, std::move(job_task), kNumThreads)); + * A sufficient `PostJob()` implementation that uses the default Job provided + * in libplatform looks like: + * \code + * std::unique_ptr PostJob( + * TaskPriority priority, std::unique_ptr job_task) override { + * return std::make_unique( + * std::make_shared( + * this, std::move(job_task), kNumThreads)); * } + * \endcode */ virtual std::unique_ptr PostJob( TaskPriority priority, std::unique_ptr job_task) { diff --git a/deps/v8/include/cppgc/source-location.h b/deps/v8/include/cppgc/source-location.h index 139c9d86c08140..29d69b0a1372e6 100644 --- a/deps/v8/include/cppgc/source-location.h +++ b/deps/v8/include/cppgc/source-location.h @@ -25,7 +25,7 @@ namespace cppgc { /** * Encapsulates source location information. Mimics C++20's - * std::source_location. + * `std::source_location`. */ class V8_EXPORT SourceLocation final { public: diff --git a/deps/v8/include/cppgc/trace-trait.h b/deps/v8/include/cppgc/trace-trait.h index b0a7c7235c1ba2..e33d3ad36b6eb3 100644 --- a/deps/v8/include/cppgc/trace-trait.h +++ b/deps/v8/include/cppgc/trace-trait.h @@ -55,8 +55,6 @@ struct V8_EXPORT TraceTraitFromInnerAddressImpl { static TraceDescriptor GetTraceDescriptor(const void* address); }; -} // namespace internal - /** * Trait specifying how the garbage collector processes an object of type T. * @@ -64,7 +62,7 @@ struct V8_EXPORT TraceTraitFromInnerAddressImpl { * type. */ template -struct TraceTrait { +struct TraceTraitBase { static_assert(internal::IsTraceableV, "T must have a Trace() method"); /** @@ -89,6 +87,11 @@ struct TraceTrait { } }; +} // namespace internal + +template +struct TraceTrait : public internal::TraceTraitBase {}; + namespace internal { template diff --git a/deps/v8/include/cppgc/visitor.h b/deps/v8/include/cppgc/visitor.h index c671c55e058300..01f5f20e520b65 100644 --- a/deps/v8/include/cppgc/visitor.h +++ b/deps/v8/include/cppgc/visitor.h @@ -5,6 +5,8 @@ #ifndef INCLUDE_CPPGC_VISITOR_H_ #define INCLUDE_CPPGC_VISITOR_H_ +#include "cppgc/custom-space.h" +#include "cppgc/ephemeron-pair.h" #include "cppgc/garbage-collected.h" #include "cppgc/internal/logging.h" #include "cppgc/internal/pointer-policies.h" @@ -12,17 +14,20 @@ #include "cppgc/member.h" #include "cppgc/source-location.h" #include "cppgc/trace-trait.h" +#include "cppgc/type-traits.h" namespace cppgc { namespace internal { +template +class BasicCrossThreadPersistent; template class BasicPersistent; class ConservativeTracingVisitor; class VisitorBase; class VisitorFactory; - } // namespace internal using WeakCallback = void (*)(const LivenessBroker&, const void*); @@ -44,7 +49,7 @@ using WeakCallback = void (*)(const LivenessBroker&, const void*); * }; * \endcode */ -class Visitor { +class V8_EXPORT Visitor { public: class Key { private: @@ -78,6 +83,8 @@ class Visitor { static_assert(sizeof(T), "Pointee type must be fully defined."); static_assert(internal::IsGarbageCollectedType::value, "T must be GarbageCollected or GarbageCollectedMixin type"); + static_assert(!internal::IsAllocatedOnCompactableSpace::value, + "Weak references to compactable objects are not allowed"); const T* value = weak_member.GetRawAtomic(); @@ -86,8 +93,7 @@ class Visitor { return; } - // TODO(chromium:1056170): DCHECK (or similar) for deleted values as they - // should come in at a different path. + CPPGC_DCHECK(value != kSentinelPointer); VisitWeak(value, TraceTrait::GetTraceDescriptor(value), &HandleWeak>, &weak_member); } @@ -121,6 +127,74 @@ class Visitor { RegisterWeakCallback(&WeakCallbackMethodDelegate, object); } + /** + * Trace method for EphemeronPair. + * + * \param ephemeron_pair EphemeronPair reference weakly retaining a key object + * and strongly retaining a value object in case the key object is alive. + */ + template + void Trace(const EphemeronPair& ephemeron_pair) { + TraceEphemeron(ephemeron_pair.key, ephemeron_pair.value.GetRawAtomic()); + } + + /** + * Trace method for ephemerons. Used for tracing raw ephemeron in which the + * key and value are kept separately. + * + * \param key WeakMember reference weakly retaining a key object. + * \param value Member reference weakly retaining a value object. + */ + template + void TraceEphemeron(const WeakMember& key, const V* value) { + TraceDescriptor value_desc = TraceTrait::GetTraceDescriptor(value); + VisitEphemeron(key, value_desc); + } + + /** + * Trace method that strongifies a WeakMember. + * + * \param weak_member WeakMember reference retaining an object. + */ + template + void TraceStrongly(const WeakMember& weak_member) { + const T* value = weak_member.GetRawAtomic(); + CPPGC_DCHECK(value != kSentinelPointer); + Trace(value); + } + + /** + * Trace method for weak containers. + * + * \param object reference of the weak container. + * \param callback to be invoked. + * \param data custom data that is passed to the callback. + */ + template + void TraceWeakContainer(const T* object, WeakCallback callback, + const void* data) { + if (!object) return; + VisitWeakContainer(object, TraceTrait::GetTraceDescriptor(object), + TraceTrait::GetWeakTraceDescriptor(object), callback, + data); + } + + /** + * Registers a slot containing a reference to an object allocated on a + * compactable space. Such references maybe be arbitrarily moved by the GC. + * + * \param slot location of reference to object that might be moved by the GC. + */ + template + void RegisterMovableReference(const T** slot) { + static_assert(internal::IsAllocatedOnCompactableSpace::value, + "Only references to objects allocated on compactable spaces " + "should be registered as movable slots."); + static_assert(!internal::IsGarbageCollectedMixinTypeV, + "Mixin types do not support compaction."); + HandleMovableReference(reinterpret_cast(slot)); + } + /** * Registers a weak callback that is invoked during garbage collection. * @@ -129,13 +203,37 @@ class Visitor { */ virtual void RegisterWeakCallback(WeakCallback callback, const void* data) {} + /** + * Defers tracing an object from a concurrent thread to the mutator thread. + * Should be called by Trace methods of types that are not safe to trace + * concurrently. + * + * \param parameter tells the trace callback which object was deferred. + * \param callback to be invoked for tracing on the mutator thread. + * \param deferred_size size of deferred object. + * + * \returns false if the object does not need to be deferred (i.e. currently + * traced on the mutator thread) and true otherwise (i.e. currently traced on + * a concurrent thread). + */ + virtual V8_WARN_UNUSED_RESULT bool DeferTraceToMutatorThreadIfConcurrent( + const void* parameter, TraceCallback callback, size_t deferred_size) { + // By default tracing is not deferred. + return false; + } + protected: virtual void Visit(const void* self, TraceDescriptor) {} virtual void VisitWeak(const void* self, TraceDescriptor, WeakCallback, const void* weak_member) {} - virtual void VisitRoot(const void*, TraceDescriptor) {} + virtual void VisitRoot(const void*, TraceDescriptor, const SourceLocation&) {} virtual void VisitWeakRoot(const void* self, TraceDescriptor, WeakCallback, - const void* weak_root) {} + const void* weak_root, const SourceLocation&) {} + virtual void VisitEphemeron(const void* key, TraceDescriptor value_desc) {} + virtual void VisitWeakContainer(const void* self, TraceDescriptor strong_desc, + TraceDescriptor weak_desc, + WeakCallback callback, const void* data) {} + virtual void HandleMovableReference(const void**) {} private: template @@ -169,7 +267,8 @@ class Visitor { if (!p.Get()) { return; } - VisitRoot(p.Get(), TraceTrait::GetTraceDescriptor(p.Get())); + VisitRoot(p.Get(), TraceTrait::GetTraceDescriptor(p.Get()), + loc); } template < @@ -182,8 +281,10 @@ class Visitor { static_assert(internal::IsGarbageCollectedType::value, "Persistent's pointee type must be GarbageCollected or " "GarbageCollectedMixin"); + static_assert(!internal::IsAllocatedOnCompactableSpace::value, + "Weak references to compactable objects are not allowed"); VisitWeakRoot(p.Get(), TraceTrait::GetTraceDescriptor(p.Get()), - &HandleWeak, &p); + &HandleWeak, &p, loc); } template @@ -198,9 +299,12 @@ class Visitor { } #if V8_ENABLE_CHECKS - V8_EXPORT void CheckObjectNotInConstruction(const void* address); + void CheckObjectNotInConstruction(const void* address); #endif // V8_ENABLE_CHECKS + template + friend class internal::BasicCrossThreadPersistent; template friend class internal::BasicPersistent; diff --git a/deps/v8/include/js_protocol.pdl b/deps/v8/include/js_protocol.pdl index 4c1b567404a479..6971edd5103a72 100644 --- a/deps/v8/include/js_protocol.pdl +++ b/deps/v8/include/js_protocol.pdl @@ -1542,15 +1542,23 @@ domain Runtime # If executionContextId is empty, adds binding with the given name on the # global objects of all inspected contexts, including those created later, # bindings survive reloads. - # If executionContextId is specified, adds binding only on global object of - # given execution context. # Binding function takes exactly one argument, this argument should be string, # in case of any other input, function throws an exception. # Each binding function call produces Runtime.bindingCalled notification. experimental command addBinding parameters string name + # If specified, the binding would only be exposed to the specified + # execution context. If omitted and `executionContextName` is not set, + # the binding is exposed to all execution contexts of the target. + # This parameter is mutually exclusive with `executionContextName`. optional ExecutionContextId executionContextId + # If specified, the binding is exposed to the executionContext with + # matching name, even for contexts created after the binding is added. + # See also `ExecutionContext.name` and `worldName` parameter to + # `Page.addScriptToEvaluateOnNewDocument`. + # This parameter is mutually exclusive with `executionContextId`. + experimental optional string executionContextName # This method does not remove binding function from global object but # unsubscribes current runtime agent from Runtime.bindingCalled notifications. diff --git a/deps/v8/include/v8-cppgc.h b/deps/v8/include/v8-cppgc.h index e202293bcf6061..805eb015e053d3 100644 --- a/deps/v8/include/v8-cppgc.h +++ b/deps/v8/include/v8-cppgc.h @@ -11,203 +11,19 @@ namespace v8 { -class Isolate; -template -class JSMember; - -namespace internal { - -class JSMemberBaseExtractor; - -class V8_EXPORT JSMemberBase { - public: - /** - * Returns true if the reference is empty, i.e., has not been assigned - * object. - */ - bool IsEmpty() const { return val_ == nullptr; } - - /** - * Clears the reference. IsEmpty() will return true after this call. - */ - inline void Reset(); - - private: - static internal::Address* New(v8::Isolate* isolate, - internal::Address* object_slot, - internal::Address** this_slot); - static void Delete(internal::Address* object); - static void Copy(const internal::Address* const* from_slot, - internal::Address** to_slot); - static void Move(internal::Address** from_slot, internal::Address** to_slot); - - JSMemberBase() = default; - - JSMemberBase(v8::Isolate* isolate, internal::Address* object_slot) - : val_(New(isolate, object_slot, &val_)) {} - - inline JSMemberBase& CopyImpl(const JSMemberBase& other); - inline JSMemberBase& MoveImpl(JSMemberBase&& other); - - // val_ points to a GlobalHandles node. - internal::Address* val_ = nullptr; - - template - friend class v8::JSMember; - friend class v8::internal::JSMemberBaseExtractor; -}; - -JSMemberBase& JSMemberBase::CopyImpl(const JSMemberBase& other) { - if (this != &other) { - Reset(); - if (!other.IsEmpty()) { - Copy(&other.val_, &val_); - } - } - return *this; -} - -JSMemberBase& JSMemberBase::MoveImpl(JSMemberBase&& other) { - if (this != &other) { - // No call to Reset() as Move() will conditionally reset itself when needed, - // and otherwise reuse the internal meta data. - Move(&other.val_, &val_); - } - return *this; -} - -void JSMemberBase::Reset() { - if (IsEmpty()) return; - Delete(val_); - val_ = nullptr; -} - -} // namespace internal - -/** - * A traced handle without destructor that clears the handle. The handle may - * only be used in GarbageCollected objects and must be processed in a Trace() - * method. - */ -template -class V8_EXPORT JSMember : public internal::JSMemberBase { - static_assert(std::is_base_of::value, - "JSMember only supports references to v8::Value"); - - public: - JSMember() = default; - - template ::value>> - JSMember(Isolate* isolate, Local that) - : internal::JSMemberBase(isolate, - reinterpret_cast(*that)) {} - - JSMember(const JSMember& other) { CopyImpl(other); } - - template ::value>> - JSMember(const JSMember& other) { // NOLINT - CopyImpl(other); - } - - JSMember(JSMember&& other) { MoveImpl(std::move(other)); } - - template ::value>> - JSMember(JSMember&& other) { // NOLINT - MoveImpl(std::move(other)); - } - - JSMember& operator=(const JSMember& other) { return CopyImpl(other); } - - template ::value>> - JSMember& operator=(const JSMember& other) { - return CopyImpl(other); - } - - JSMember& operator=(JSMember&& other) { return MoveImpl(other); } - - template ::value>> - JSMember& operator=(JSMember&& other) { - return MoveImpl(other); - } - - T* operator->() const { return reinterpret_cast(val_); } - T* operator*() const { return reinterpret_cast(val_); } - - using internal::JSMemberBase::Reset; - - template ::value>> - void Set(v8::Isolate* isolate, Local that) { - Reset(); - val_ = New(isolate, reinterpret_cast(*that), &val_); - } -}; - -template ::value || - std::is_base_of::value>> -inline bool operator==(const JSMember& lhs, const JSMember& rhs) { - v8::internal::Address* a = reinterpret_cast(*lhs); - v8::internal::Address* b = reinterpret_cast(*rhs); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; -} - -template ::value || - std::is_base_of::value>> -inline bool operator!=(const JSMember& lhs, const JSMember& rhs) { - return !(lhs == rhs); -} - -template ::value || - std::is_base_of::value>> -inline bool operator==(const JSMember& lhs, const Local& rhs) { - v8::internal::Address* a = reinterpret_cast(*lhs); - v8::internal::Address* b = reinterpret_cast(*rhs); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; -} - -template ::value || - std::is_base_of::value>> -inline bool operator==(const Local& lhs, const JSMember rhs) { - return rhs == lhs; -} - -template -inline bool operator!=(const JSMember& lhs, const T2& rhs) { - return !(lhs == rhs); -} - -template -inline bool operator!=(const T1& lhs, const JSMember& rhs) { - return !(lhs == rhs); -} - class JSVisitor : public cppgc::Visitor { public: explicit JSVisitor(cppgc::Visitor::Key key) : cppgc::Visitor(key) {} - template - void Trace(const JSMember& ref) { - if (ref.IsEmpty()) return; + void Trace(const TracedReferenceBase& ref) { + if (ref.IsEmptyThreadSafe()) return; Visit(ref); } protected: using cppgc::Visitor::Visit; - virtual void Visit(const internal::JSMemberBase& ref) {} + virtual void Visit(const TracedReferenceBase& ref) {} }; } // namespace v8 @@ -215,8 +31,8 @@ class JSVisitor : public cppgc::Visitor { namespace cppgc { template -struct TraceTrait> { - static void Trace(Visitor* visitor, const v8::JSMember* self) { +struct TraceTrait> { + static void Trace(Visitor* visitor, const v8::TracedReference* self) { static_cast(visitor)->Trace(*self); } }; diff --git a/deps/v8/include/v8-fast-api-calls.h b/deps/v8/include/v8-fast-api-calls.h index 1cac9a6be39eed..2dea8db271ad81 100644 --- a/deps/v8/include/v8-fast-api-calls.h +++ b/deps/v8/include/v8-fast-api-calls.h @@ -18,6 +18,38 @@ * &v8::CFunction::Make(FastMethod)); * \endcode * + * By design, fast calls are limited by the following requirements, which + * the embedder should enforce themselves: + * - they should not allocate on the JS heap; + * - they should not trigger JS execution. + * To enforce them, the embedder could use the existing + * v8::Isolate::DisallowJavascriptExecutionScope and a utility similar to + * Blink's NoAllocationScope: + * https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/platform/heap/thread_state_scopes.h;l=16 + * + * Due to these limitations, it's not directly possible to report errors by + * throwing a JS exception or to otherwise do an allocation. There is an + * alternative way of creating fast calls that supports falling back to the + * slow call and then performing the necessary allocation. When one creates + * the fast method by using CFunction::MakeWithFallbackSupport instead of + * CFunction::Make, the fast callback gets as last parameter an output variable, + * through which it can request falling back to the slow call. So one might + * declare their method like: + * + * \code + * void FastMethodWithFallback(int param, FastApiCallbackOptions& options); + * \endcode + * + * 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. + * * An example for custom embedder type support might employ a way to wrap/ * unwrap various C++ types in JSObject instances, e.g: * @@ -124,13 +156,21 @@ * - uint32_t * - int64_t * - uint64_t + * - float32_t + * - float64_t + * * The 64-bit integer types currently have the IDL (unsigned) long long * semantics: https://heycam.github.io/webidl/#abstract-opdef-converttoint * In the future we'll extend the API to also provide conversions from/to * BigInt to preserve full precision. + * The floating point types currently have the IDL (unrestricted) semantics, + * which is the only one used by WebGL. We plan to add support also for + * restricted floats/doubles, similarly to the BigInt conversion policies. + * We also differ from the specific NaN bit pattern that WebIDL prescribes + * (https://heycam.github.io/webidl/#es-unrestricted-float) in that Blink + * passes NaN values as-is, i.e. doesn't normalize them. + * * To be supported types: - * - float32_t - * - float64_t * - arrays of C types * - arrays of embedder types */ @@ -291,14 +331,14 @@ struct GetCType : public GetCTypePointerImpl {}; template class CFunctionInfoImpl : public CFunctionInfo { public: - static constexpr int kHasErrorArgCount = (RaisesException ? 1 : 0); + static constexpr int kFallbackArgCount = (RaisesException ? 1 : 0); static constexpr int kReceiverCount = 1; CFunctionInfoImpl() : return_info_(internal::GetCType::Get()), - arg_count_(sizeof...(Args) - kHasErrorArgCount), + arg_count_(sizeof...(Args) - kFallbackArgCount), arg_info_{internal::GetCType::Get()...} { - static_assert(sizeof...(Args) >= kHasErrorArgCount + kReceiverCount, - "The receiver or the has_error argument is missing."); + static_assert(sizeof...(Args) >= kFallbackArgCount + 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."); @@ -342,8 +382,8 @@ class V8_EXPORT CFunction { } template - static CFunction MakeWithErrorSupport(F* func) { - return ArgUnwrap::MakeWithErrorSupport(func); + static CFunction MakeWithFallbackSupport(F* func) { + return ArgUnwrap::MakeWithFallbackSupport(func); } template @@ -376,13 +416,17 @@ class V8_EXPORT CFunction { return CFunction(reinterpret_cast(func), GetCFunctionInfo()); } - static CFunction MakeWithErrorSupport(R (*func)(Args...)) { + static CFunction MakeWithFallbackSupport(R (*func)(Args...)) { return CFunction(reinterpret_cast(func), GetCFunctionInfo()); } }; }; +struct FastApiCallbackOptions { + bool fallback; +}; + } // namespace v8 #endif // INCLUDE_V8_FAST_API_CALLS_H_ diff --git a/deps/v8/include/v8-inspector.h b/deps/v8/include/v8-inspector.h index 6573940e2fe3c3..86fcf5187701c1 100644 --- a/deps/v8/include/v8-inspector.h +++ b/deps/v8/include/v8-inspector.h @@ -181,6 +181,10 @@ class V8_EXPORT V8InspectorClient { virtual std::unique_ptr valueSubtype(v8::Local) { return nullptr; } + virtual std::unique_ptr descriptionForValueSubtype( + v8::Local, v8::Local) { + return nullptr; + } virtual bool formatAccessorsAsProperties(v8::Local) { return false; } diff --git a/deps/v8/include/v8-internal.h b/deps/v8/include/v8-internal.h index 0d9cce82b47173..06846d7005550e 100644 --- a/deps/v8/include/v8-internal.h +++ b/deps/v8/include/v8-internal.h @@ -120,6 +120,23 @@ constexpr bool HeapSandboxIsEnabled() { using ExternalPointer_t = Address; +// If the heap sandbox is enabled, these tag values will be XORed with the +// external pointers in the external pointer table to prevent use of pointers of +// the wrong type. +enum ExternalPointerTag : Address { + kExternalPointerNullTag = static_cast
(0ULL), + kArrayBufferBackingStoreTag = static_cast
(1ULL << 48), + kTypedArrayExternalPointerTag = static_cast
(2ULL << 48), + kDataViewDataPointerTag = static_cast
(3ULL << 48), + kExternalStringResourceTag = static_cast
(4ULL << 48), + kExternalStringResourceDataTag = static_cast
(5ULL << 48), + kForeignForeignAddressTag = static_cast
(6ULL << 48), + kNativeContextMicrotaskQueueTag = static_cast
(7ULL << 48), + // TODO(v8:10391, saelo): Currently has to be zero so that raw zero values are + // also nullptr + kEmbedderDataSlotPayloadTag = static_cast
(0ULL << 48), +}; + #ifdef V8_31BIT_SMIS_ON_64BIT_ARCH using PlatformSmiTagging = SmiTagging; #else @@ -140,6 +157,11 @@ V8_INLINE static constexpr internal::Address IntToSmi(int value) { kSmiTag; } +// Converts encoded external pointer to address. +V8_EXPORT Address DecodeExternalPointerImpl(const Isolate* isolate, + ExternalPointer_t pointer, + ExternalPointerTag tag); + // {obj} must be the raw tagged pointer representation of a HeapObject // that's guaranteed to never be in ReadOnlySpace. V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj); @@ -168,6 +190,9 @@ class Internals { static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize; static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize; static const int kEmbedderDataSlotSize = kApiSystemPointerSize; +#ifdef V8_HEAP_SANDBOX + static const int kEmbedderDataSlotRawPayloadOffset = kApiTaggedSize; +#endif static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize; static const int kFullStringRepresentationMask = 0x0f; static const int kStringEncodingMask = 0x8; @@ -187,6 +212,12 @@ class Internals { static const int kIsolateRootsOffset = kIsolateStackGuardOffset + 7 * kApiSystemPointerSize; + static const int kExternalPointerTableBufferOffset = 0; + static const int kExternalPointerTableLengthOffset = + kExternalPointerTableBufferOffset + kApiSystemPointerSize; + static const int kExternalPointerTableCapacityOffset = + kExternalPointerTableLengthOffset + kApiInt32Size; + static const int kUndefinedValueRootIndex = 4; static const int kTheHoleValueRootIndex = 5; static const int kNullValueRootIndex = 6; @@ -352,15 +383,28 @@ class Internals { #endif } + V8_INLINE static Address DecodeExternalPointer( + const Isolate* isolate, ExternalPointer_t encoded_pointer, + ExternalPointerTag tag) { +#ifdef V8_HEAP_SANDBOX + return internal::DecodeExternalPointerImpl(isolate, encoded_pointer, tag); +#else + return encoded_pointer; +#endif + } + V8_INLINE static internal::Address ReadExternalPointerField( - internal::Isolate* isolate, internal::Address heap_object_ptr, - int offset) { - internal::Address value = ReadRawField
(heap_object_ptr, offset); + internal::Isolate* isolate, internal::Address heap_object_ptr, int offset, + ExternalPointerTag tag) { #ifdef V8_HEAP_SANDBOX + internal::ExternalPointer_t encoded_value = + ReadRawField(heap_object_ptr, offset); // We currently have to treat zero as nullptr in embedder slots. - if (value) value = DecodeExternalPointer(isolate, value); + return encoded_value ? DecodeExternalPointer(isolate, encoded_value, tag) + : 0; +#else + return ReadRawField
(heap_object_ptr, offset); #endif - return value; } #ifdef V8_COMPRESS_POINTERS @@ -368,10 +412,6 @@ class Internals { static constexpr size_t kPtrComprHeapReservationSize = size_t{1} << 32; static constexpr size_t kPtrComprIsolateRootAlignment = size_t{1} << 32; - // See v8:10391 for details about V8 heap sandbox. - static constexpr uint32_t kExternalPointerSalt = - 0x7fffffff & ~static_cast(kHeapObjectTagMask); - V8_INLINE static internal::Address GetRootFromOnHeapAddress( internal::Address addr) { return addr & -static_cast(kPtrComprIsolateRootAlignment); @@ -383,14 +423,6 @@ class Internals { return root + static_cast(static_cast(value)); } - V8_INLINE static Address DecodeExternalPointer( - const Isolate* isolate, ExternalPointer_t encoded_pointer) { -#ifndef V8_HEAP_SANDBOX - return encoded_pointer; -#else - return encoded_pointer ^ kExternalPointerSalt; -#endif - } #endif // V8_COMPRESS_POINTERS }; diff --git a/deps/v8/include/v8-metrics.h b/deps/v8/include/v8-metrics.h index 9734ac1b36ab96..69784dcb0fcbf6 100644 --- a/deps/v8/include/v8-metrics.h +++ b/deps/v8/include/v8-metrics.h @@ -10,6 +10,7 @@ namespace v8 { namespace metrics { +// TODO(sartang@microsoft.com): Remove wall_clock_time_in_us. struct WasmModuleDecoded { bool async = false; bool streamed = false; @@ -17,6 +18,7 @@ struct WasmModuleDecoded { size_t module_size_in_bytes = 0; size_t function_count = 0; int64_t wall_clock_time_in_us = -1; + int64_t wall_clock_duration_in_us = -1; }; struct WasmModuleCompiled { @@ -29,6 +31,7 @@ struct WasmModuleCompiled { size_t code_size_in_bytes = 0; size_t liftoff_bailout_count = 0; int64_t wall_clock_time_in_us = -1; + int64_t wall_clock_duration_in_us = -1; }; struct WasmModuleInstantiated { @@ -36,12 +39,14 @@ struct WasmModuleInstantiated { bool success = false; size_t imported_function_count = 0; int64_t wall_clock_time_in_us = -1; + int64_t wall_clock_duration_in_us = -1; }; struct WasmModuleTieredUp { bool lazy = false; size_t code_size_in_bytes = 0; int64_t wall_clock_time_in_us = -1; + int64_t wall_clock_duration_in_us = -1; }; struct WasmModulesPerIsolate { diff --git a/deps/v8/include/v8-platform.h b/deps/v8/include/v8-platform.h index 6669ed9ac7e217..1f1497f6ccd7f2 100644 --- a/deps/v8/include/v8-platform.h +++ b/deps/v8/include/v8-platform.h @@ -216,16 +216,41 @@ class JobHandle { */ virtual void Cancel() = 0; + /* + * Forces all existing workers to yield ASAP but doesn’t wait for them. + * Warning, this is dangerous if the Job's callback is bound to or has access + * to state which may be deleted after this call. + * TODO(etiennep): Cleanup once implemented by all embedders. + */ + virtual void CancelAndDetach() { Cancel(); } + /** - * Returns true if there's no work pending and no worker running. + * Returns true if there's currently no work pending and no worker running. + * TODO(etiennep): Deprecate IsCompleted in favor of IsActive once implemented + * by all embedders. */ virtual bool IsCompleted() = 0; + virtual bool IsActive() { return !IsCompleted(); } /** * Returns true if associated with a Job and other methods may be called. - * Returns false after Join() or Cancel() was called. + * Returns false after Join() or Cancel() was called. This may return true + * even if no workers are running and IsCompleted() returns true + * TODO(etiennep): Deprecate IsRunning in favor of IsValid once implemented by + * all embedders. */ virtual bool IsRunning() = 0; + virtual bool IsValid() { return IsRunning(); } + + /** + * Returns true if job priority can be changed. + */ + virtual bool UpdatePriorityEnabled() const { return false; } + + /** + * Update this Job's priority. + */ + virtual void UpdatePriority(TaskPriority new_priority) {} }; /** diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index 7ec19937343e73..74b6df884d37a9 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -249,6 +249,15 @@ enum CpuProfilingLoggingMode { kEagerLogging, }; +// Enum for returning profiling status. Once StartProfiling is called, +// we want to return to clients whether the profiling was able to start +// correctly, or return a descriptive error. +enum class CpuProfilingStatus { + kStarted, + kAlreadyStarted, + kErrorTooManyProfilers +}; + /** * Optional profiling attributes. */ @@ -337,7 +346,8 @@ class V8_EXPORT CpuProfiler { * profiles may be collected at once. Attempts to start collecting several * profiles with the same title are silently ignored. */ - void StartProfiling(Local title, CpuProfilingOptions options); + CpuProfilingStatus StartProfiling(Local title, + CpuProfilingOptions options); /** * Starts profiling with the same semantics as above, except with expanded @@ -350,7 +360,7 @@ class V8_EXPORT CpuProfiler { * recorded by the profiler. Samples obtained after this limit will be * discarded. */ - void StartProfiling( + CpuProfilingStatus StartProfiling( Local title, CpuProfilingMode mode, bool record_samples = false, unsigned max_samples = CpuProfilingOptions::kNoSampleLimit); /** @@ -358,7 +368,8 @@ class V8_EXPORT CpuProfiler { * kLeafNodeLineNumbers mode, which was the previous default behavior of the * profiler. */ - void StartProfiling(Local title, bool record_samples = false); + CpuProfilingStatus StartProfiling(Local title, + bool record_samples = false); /** * Stops collecting CPU profile with a given title and returns it. @@ -806,6 +817,18 @@ class V8_EXPORT HeapProfiler { v8::EmbedderGraph* graph, void* data); + /** + * Callback function invoked during heap snapshot generation to retrieve + * the detachedness state of an object referenced by a TracedReference. + * + * The callback takes Local as parameter to allow the embedder to + * unpack the TracedReference into a Local and reuse that Local for different + * purposes. + */ + using GetDetachednessCallback = EmbedderGraph::Node::Detachedness (*)( + v8::Isolate* isolate, const v8::Local& v8_value, + uint16_t class_id, void* data); + /** Returns the number of snapshots taken. */ int GetSnapshotCount(); @@ -956,6 +979,8 @@ class V8_EXPORT HeapProfiler { void RemoveBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback, void* data); + void SetGetDetachednessCallback(GetDetachednessCallback callback, void* data); + /** * Default value of persistent handle class ID. Must not be used to * define a class. Can be used to reset a class of a persistent diff --git a/deps/v8/include/v8-unwinder-state.h b/deps/v8/include/v8-unwinder-state.h new file mode 100644 index 00000000000000..ed9988711b4707 --- /dev/null +++ b/deps/v8/include/v8-unwinder-state.h @@ -0,0 +1,30 @@ +// 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_V8_UNWINDER_STATE_H_ +#define INCLUDE_V8_UNWINDER_STATE_H_ + +namespace v8 { + +#ifdef V8_TARGET_ARCH_ARM +struct CalleeSavedRegisters { + void* arm_r4; + void* arm_r5; + void* arm_r6; + void* arm_r7; + void* arm_r8; + void* arm_r9; + void* arm_r10; +}; +#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 +struct CalleeSavedRegisters {}; +#else +#error Target architecture was not detected as supported by v8 +#endif + +} // namespace v8 + +#endif // INCLUDE_V8_UNWINDER _STATE_H_ diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 46810a77ce0da6..8ecd81cb5dad1a 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -9,9 +9,9 @@ // NOTE these macros are used by some of the tool scripts and the build // system so their names cannot be changed without changing the scripts. #define V8_MAJOR_VERSION 8 -#define V8_MINOR_VERSION 7 -#define V8_BUILD_NUMBER 220 -#define V8_PATCH_LEVEL 24 +#define V8_MINOR_VERSION 8 +#define V8_BUILD_NUMBER 278 +#define V8_PATCH_LEVEL 17 // 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 f51fad14d9e479..835178204ad01d 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -83,6 +83,7 @@ class String; class StringObject; class Symbol; class SymbolObject; +class TracedReferenceBase; class PrimitiveArray; class Private; class Uint32; @@ -104,7 +105,7 @@ class TracedGlobal; template class TracedReference; template -class TracedReferenceBase; +class BasicTracedReference; template class PersistentValueMap; template class PersistentValueMapBase; @@ -127,6 +128,7 @@ namespace internal { enum class ArgumentsType; template class Arguments; +class BasicTracedReferenceExtractor; template class CustomArguments; class FunctionCallbackArguments; @@ -301,9 +303,10 @@ class Local { V8_INLINE static Local New(Isolate* isolate, const PersistentBase& that); V8_INLINE static Local New(Isolate* isolate, - const TracedReferenceBase& that); + const BasicTracedReference& that); private: + friend class TracedReferenceBase; friend class Utils; template friend class Eternal; template friend class PersistentBase; @@ -335,7 +338,7 @@ class Local { template friend class TracedGlobal; template - friend class TracedReferenceBase; + friend class BasicTracedReference; template friend class TracedReference; @@ -825,27 +828,11 @@ using UniquePersistent = Global; template struct TracedGlobalTrait {}; -/** - * A traced handle with copy and move semantics. The handle is to be used - * together with |v8::EmbedderHeapTracer| and specifies edges from the embedder - * into V8's heap. - * - * The exact semantics are: - * - Tracing garbage collections use |v8::EmbedderHeapTracer|. - * - Non-tracing garbage collections refer to - * |v8::EmbedderHeapTracer::IsRootForNonTracingGC()| whether the handle should - * be treated as root or not. - * - * Note that the base class cannot be instantiated itself. Choose from - * - TracedGlobal - * - TracedReference - */ -template class TracedReferenceBase { public: /** - * Returns true if this TracedReferenceBase is empty, i.e., has not been - * assigned an object. + * Returns true if the reference is empty, i.e., has not been assigned + * object. */ bool IsEmpty() const { return val_ == nullptr; } @@ -856,36 +843,16 @@ class TracedReferenceBase { V8_INLINE void Reset(); /** - * Construct a Local from this handle. + * Construct a Local from this handle. */ - Local Get(Isolate* isolate) const { return Local::New(isolate, *this); } - - template - V8_INLINE bool operator==(const TracedReferenceBase& that) const { - internal::Address* a = reinterpret_cast(val_); - internal::Address* b = reinterpret_cast(that.val_); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; - } - - template - V8_INLINE bool operator==(const Local& that) const { - internal::Address* a = reinterpret_cast(val_); - internal::Address* b = reinterpret_cast(that.val_); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; - } - - template - V8_INLINE bool operator!=(const TracedReferenceBase& that) const { - return !operator==(that); - } + V8_INLINE v8::Local Get(v8::Isolate* isolate) const; - template - V8_INLINE bool operator!=(const Local& that) const { - return !operator==(that); + /** + * Returns true if this TracedReference is empty, i.e., has not been + * assigned an object. This version of IsEmpty is thread-safe. + */ + bool IsEmptyThreadSafe() const { + return this->GetSlotThreadSafe() == nullptr; } /** @@ -899,41 +866,77 @@ class TracedReferenceBase { */ V8_INLINE uint16_t WrapperClassId() const; - template - V8_INLINE TracedReferenceBase& As() const { - return reinterpret_cast&>( - const_cast&>(*this)); - } - protected: /** - * Update this reference in a thread-safe way + * Update this reference in a thread-safe way. */ - void SetSlotThreadSafe(T* new_val) { - reinterpret_cast*>(&val_)->store(new_val, - std::memory_order_relaxed); + void SetSlotThreadSafe(void* new_val) { + reinterpret_cast*>(&val_)->store( + new_val, std::memory_order_relaxed); } /** * Get this reference in a thread-safe way */ - const T* GetSlotThreadSafe() const { - return reinterpret_cast const*>(&val_)->load( + const void* GetSlotThreadSafe() const { + return reinterpret_cast const*>(&val_)->load( std::memory_order_relaxed); } + // val_ points to a GlobalHandles node. + internal::Address* val_ = nullptr; + + friend class internal::BasicTracedReferenceExtractor; + template + friend class Local; + template + friend bool operator==(const TracedReferenceBase&, const Local&); + friend bool operator==(const TracedReferenceBase&, + const TracedReferenceBase&); +}; + +/** + * A traced handle with copy and move semantics. The handle is to be used + * together with |v8::EmbedderHeapTracer| or as part of GarbageCollected objects + * (see v8-cppgc.h) and specifies edges from C++ objects to JavaScript. + * + * The exact semantics are: + * - Tracing garbage collections use |v8::EmbedderHeapTracer| or cppgc. + * - Non-tracing garbage collections refer to + * |v8::EmbedderHeapTracer::IsRootForNonTracingGC()| whether the handle should + * be treated as root or not. + * + * Note that the base class cannot be instantiated itself. Choose from + * - TracedGlobal + * - TracedReference + */ +template +class BasicTracedReference : public TracedReferenceBase { + public: + /** + * Construct a Local from this handle. + */ + Local Get(Isolate* isolate) const { return Local::New(isolate, *this); } + + template + V8_INLINE BasicTracedReference& As() const { + return reinterpret_cast&>( + const_cast&>(*this)); + } + + T* operator->() const { return reinterpret_cast(val_); } + T* operator*() const { return reinterpret_cast(val_); } + private: enum DestructionMode { kWithDestructor, kWithoutDestructor }; /** - * An empty TracedReferenceBase without storage cell. + * An empty BasicTracedReference without storage cell. */ - TracedReferenceBase() = default; - - V8_INLINE static T* New(Isolate* isolate, T* that, void* slot, - DestructionMode destruction_mode); + BasicTracedReference() = default; - T* val_ = nullptr; + V8_INLINE static internal::Address* New(Isolate* isolate, T* that, void* slot, + DestructionMode destruction_mode); friend class EmbedderHeapTracer; template @@ -944,27 +947,29 @@ class TracedReferenceBase { template friend class TracedReference; template + friend class BasicTracedReference; + template friend class ReturnValue; }; /** * A traced handle with destructor that clears the handle. For more details see - * TracedReferenceBase. + * BasicTracedReference. */ template -class TracedGlobal : public TracedReferenceBase { +class TracedGlobal : public BasicTracedReference { public: - using TracedReferenceBase::Reset; + using BasicTracedReference::Reset; /** - * Destructor resetting the handle. + * Destructor resetting the handle.Is */ ~TracedGlobal() { this->Reset(); } /** * An empty TracedGlobal without storage cell. */ - TracedGlobal() : TracedReferenceBase() {} + TracedGlobal() : BasicTracedReference() {} /** * Construct a TracedGlobal from a Local. @@ -973,9 +978,9 @@ class TracedGlobal : public TracedReferenceBase { * pointing to the same object. */ template - TracedGlobal(Isolate* isolate, Local that) : TracedReferenceBase() { + TracedGlobal(Isolate* isolate, Local that) : BasicTracedReference() { this->val_ = this->New(isolate, that.val_, &this->val_, - TracedReferenceBase::kWithDestructor); + BasicTracedReference::kWithDestructor); static_assert(std::is_base_of::value, "type check"); } @@ -1072,7 +1077,7 @@ class TracedGlobal : public TracedReferenceBase { * A traced handle without destructor that clears the handle. The embedder needs * to ensure that the handle is not accessed once the V8 object has been * reclaimed. This can happen when the handle is not passed through the - * EmbedderHeapTracer. For more details see TracedReferenceBase. + * EmbedderHeapTracer. For more details see BasicTracedReference. * * The reference assumes the embedder has precise knowledge about references at * all times. In case V8 needs to separately handle on-stack references, the @@ -1080,14 +1085,14 @@ class TracedGlobal : public TracedReferenceBase { * |EmbedderHeapTracer::SetStackStart|. */ template -class TracedReference : public TracedReferenceBase { +class TracedReference : public BasicTracedReference { public: - using TracedReferenceBase::Reset; + using BasicTracedReference::Reset; /** * An empty TracedReference without storage cell. */ - TracedReference() : TracedReferenceBase() {} + TracedReference() : BasicTracedReference() {} /** * Construct a TracedReference from a Local. @@ -1096,9 +1101,9 @@ class TracedReference : public TracedReferenceBase { * pointing to the same object. */ template - TracedReference(Isolate* isolate, Local that) : TracedReferenceBase() { + TracedReference(Isolate* isolate, Local that) : BasicTracedReference() { this->val_ = this->New(isolate, that.val_, &this->val_, - TracedReferenceBase::kWithoutDestructor); + BasicTracedReference::kWithoutDestructor); static_assert(std::is_base_of::value, "type check"); } @@ -1174,14 +1179,6 @@ class TracedReference : public TracedReferenceBase { return reinterpret_cast&>( const_cast&>(*this)); } - - /** - * Returns true if this TracedReference is empty, i.e., has not been - * assigned an object. This version of IsEmpty is thread-safe. - */ - bool IsEmptyThreadSafe() const { - return this->GetSlotThreadSafe() == nullptr; - } }; /** @@ -1608,6 +1605,14 @@ class V8_EXPORT Module : public Data { */ int ScriptId(); + /** + * Returns whether this module or any of its requested modules is async, + * i.e. contains top-level await. + * + * The module's status must be at least kInstantiated. + */ + bool IsGraphAsync() const; + /** * Returns whether the module is a SourceTextModule. */ @@ -1834,11 +1839,9 @@ class V8_EXPORT ScriptCompiler { public: enum Encoding { ONE_BYTE, TWO_BYTE, UTF8 }; -#if defined(_MSC_VER) && _MSC_VER >= 1910 /* Disable on VS2015 */ V8_DEPRECATE_SOON( "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); @@ -1856,7 +1859,7 @@ class V8_EXPORT ScriptCompiler { /** * A streaming task which the embedder must run on a background thread to - * stream scripts into V8. Returned by ScriptCompiler::StartStreamingScript. + * stream scripts into V8. Returned by ScriptCompiler::StartStreaming. */ class V8_EXPORT ScriptStreamingTask final { public: @@ -1943,9 +1946,12 @@ class V8_EXPORT ScriptCompiler { * This API allows to start the streaming with as little data as possible, and * the remaining data (for example, the ScriptOrigin) is passed to Compile. */ + V8_DEPRECATE_SOON("Use ScriptCompiler::StartStreamingScript instead.") static ScriptStreamingTask* StartStreamingScript( Isolate* isolate, StreamedSource* source, CompileOptions options = kNoCompileOptions); + static ScriptStreamingTask* StartStreaming(Isolate* isolate, + StreamedSource* source); /** * Compiles a streamed script (bound to current context). @@ -2266,14 +2272,25 @@ enum StateTag { IDLE }; +// Holds the callee saved registers needed for the stack unwinder. It is the +// empty struct if no registers are required. Implemented in +// include/v8-unwinder-state.h. +struct CalleeSavedRegisters; + // A RegisterState represents the current state of registers used // by the sampling profiler API. -struct RegisterState { - RegisterState() : pc(nullptr), sp(nullptr), fp(nullptr), lr(nullptr) {} +struct V8_EXPORT RegisterState { + RegisterState(); + ~RegisterState(); + RegisterState(const RegisterState& other); + RegisterState& operator=(const RegisterState& other); + void* pc; // Instruction pointer. void* sp; // Stack pointer. void* fp; // Frame pointer. void* lr; // Link register (or nullptr on platforms without a link register). + // Callee saved registers (or null if no callee saved registers were stored) + std::unique_ptr callee_saved; }; // The output structure filled up by GetStackSample API function. @@ -3118,7 +3135,7 @@ class V8_EXPORT String : public Name { * Returns true if the string is external two-byte. * */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use String::IsExternalTwoByte() or String::IsExternalOneByte()") bool IsExternal() const; @@ -3975,10 +3992,10 @@ class V8_EXPORT Object : public Value { return object.val_->InternalFieldCount(); } - /** Same as above, but works for TracedReferenceBase. */ + /** Same as above, but works for BasicTracedReference. */ V8_INLINE static int InternalFieldCount( - const TracedReferenceBase& object) { - return object.val_->InternalFieldCount(); + const BasicTracedReference& object) { + return object->InternalFieldCount(); } /** Gets the value from an internal field. */ @@ -4002,8 +4019,8 @@ class V8_EXPORT Object : public Value { /** Same as above, but works for TracedGlobal. */ V8_INLINE static void* GetAlignedPointerFromInternalField( - const TracedReferenceBase& object, int index) { - return object.val_->GetAlignedPointerFromInternalField(index); + const BasicTracedReference& object, int index) { + return object->GetAlignedPointerFromInternalField(index); } /** @@ -4186,6 +4203,16 @@ class V8_EXPORT Object : public Value { V8_INLINE static Object* Cast(Value* obj); + /** + * Support for TC39 "dynamic code brand checks" proposal. + * + * This API allows to query whether an object was constructed from a + * "code like" ObjectTemplate. + * + * See also: v8::ObjectTemplate::SetCodeLike + */ + bool IsCodeLike(Isolate* isolate); + private: Object(); static void CheckCast(Value* obj); @@ -4299,7 +4326,7 @@ class ReturnValue { template V8_INLINE void Set(const Global& handle); template - V8_INLINE void Set(const TracedReferenceBase& handle); + V8_INLINE void Set(const BasicTracedReference& handle); template V8_INLINE void Set(const Local handle); // Fast primitive setters @@ -4594,6 +4621,15 @@ class V8_EXPORT Function : public Object { */ Local GetBoundFunction() const; + /** + * Calls builtin Function.prototype.toString on this function. + * This is different from Value::ToString() that may call a user-defined + * toString() function, and different than Object::ObjectProtoToString() which + * always serializes "[object Function]". + */ + V8_WARN_UNUSED_RESULT MaybeLocal FunctionProtoToString( + Local context); + ScriptOrigin GetScriptOrigin() const; V8_INLINE static Function* Cast(Value* obj); static const int kLineOffsetNotFound; @@ -5966,6 +6002,10 @@ class V8_EXPORT RegExp : public Object { /** * Regular expression flag bits. They can be or'ed to enable a set * of flags. + * The kLinear value ('l') is experimental and can only be used with + * --enable-experimental-regexp-engine. RegExps with kLinear flag are + * guaranteed to be executed in asymptotic linear time wrt. the length of + * the subject string. */ enum Flags { kNone = 0, @@ -5975,9 +6015,10 @@ class V8_EXPORT RegExp : public Object { kSticky = 1 << 3, kUnicode = 1 << 4, kDotAll = 1 << 5, + kLinear = 1 << 6, }; - static constexpr int kFlagCount = 6; + static constexpr int kFlagCount = 7; /** * Creates a regular expression from the given pattern string and @@ -6119,7 +6160,6 @@ class V8_EXPORT Template : public Data { void SetNativeDataProperty( Local name, AccessorGetterCallback getter, AccessorSetterCallback setter = nullptr, - // TODO(dcarney): gcc can't handle Local below Local data = Local(), PropertyAttribute attribute = None, Local signature = Local(), AccessControl settings = DEFAULT, @@ -6128,7 +6168,6 @@ class V8_EXPORT Template : public Data { void SetNativeDataProperty( Local name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter = nullptr, - // TODO(dcarney): gcc can't handle Local below Local data = Local(), PropertyAttribute attribute = None, Local signature = Local(), AccessControl settings = DEFAULT, @@ -6974,6 +7013,18 @@ class V8_EXPORT ObjectTemplate : public Template { */ void SetImmutableProto(); + /** + * Support for TC39 "dynamic code brand checks" proposal. + * + * This API allows to mark (& query) objects as "code like", which causes + * them to be treated like Strings in the context of eval and function + * constructor. + * + * Reference: https://github.com/tc39/proposal-dynamic-code-brand-checks + */ + void SetCodeLike(); + bool IsCodeLike(); + V8_INLINE static ObjectTemplate* Cast(Data* data); private: @@ -7180,25 +7231,25 @@ class V8_EXPORT ResourceConstraints { /** * Deprecated functions. Do not use in new code. */ - V8_DEPRECATE_SOON("Use code_range_size_in_bytes.") + V8_DEPRECATED("Use code_range_size_in_bytes.") size_t code_range_size() const { return code_range_size_ / kMB; } - V8_DEPRECATE_SOON("Use set_code_range_size_in_bytes.") + V8_DEPRECATED("Use set_code_range_size_in_bytes.") void set_code_range_size(size_t limit_in_mb) { code_range_size_ = limit_in_mb * kMB; } - V8_DEPRECATE_SOON("Use max_young_generation_size_in_bytes.") + V8_DEPRECATED("Use max_young_generation_size_in_bytes.") size_t max_semi_space_size_in_kb() const; - V8_DEPRECATE_SOON("Use set_max_young_generation_size_in_bytes.") + V8_DEPRECATED("Use set_max_young_generation_size_in_bytes.") void set_max_semi_space_size_in_kb(size_t limit_in_kb); - V8_DEPRECATE_SOON("Use max_old_generation_size_in_bytes.") + V8_DEPRECATED("Use max_old_generation_size_in_bytes.") size_t max_old_space_size() const { return max_old_generation_size_ / kMB; } - V8_DEPRECATE_SOON("Use set_max_old_generation_size_in_bytes.") + V8_DEPRECATED("Use set_max_old_generation_size_in_bytes.") void set_max_old_space_size(size_t limit_in_mb) { max_old_generation_size_ = limit_in_mb * kMB; } - V8_DEPRECATE_SOON("Zone does not pool memory any more.") + V8_DEPRECATED("Zone does not pool memory any more.") size_t max_zone_pool_size() const { return max_zone_pool_size_; } - V8_DEPRECATE_SOON("Zone does not pool memory any more.") + V8_DEPRECATED("Zone does not pool memory any more.") void set_max_zone_pool_size(size_t bytes) { max_zone_pool_size_ = bytes; } private: @@ -7382,6 +7433,7 @@ class PromiseRejectMessage { typedef void (*PromiseRejectCallback)(PromiseRejectMessage message); // --- Microtasks Callbacks --- +V8_DEPRECATED("Use *WithData version.") typedef void (*MicrotasksCompletedCallback)(Isolate*); typedef void (*MicrotasksCompletedCallbackWithData)(Isolate*, void*); typedef void (*MicrotaskCallback)(void* data); @@ -7547,11 +7599,15 @@ struct ModifyCodeGenerationFromStringsResult { /** * Callback to check if codegen is allowed from a source object, and convert - * the source to string if necessary.See ModifyCodeGenerationFromStrings. + * the source to string if necessary. See: ModifyCodeGenerationFromStrings. */ typedef ModifyCodeGenerationFromStringsResult ( *ModifyCodeGenerationFromStringsCallback)(Local context, Local source); +typedef ModifyCodeGenerationFromStringsResult ( + *ModifyCodeGenerationFromStringsCallback2)(Local context, + Local source, + bool is_code_like); // --- WebAssembly compilation callbacks --- typedef bool (*ExtensionCallback)(const FunctionCallbackInfo&); @@ -7997,7 +8053,7 @@ class V8_EXPORT EmbedderHeapTracer { virtual void RegisterV8References( const std::vector >& embedder_fields) = 0; - void RegisterEmbedderReference(const TracedReferenceBase& ref); + void RegisterEmbedderReference(const BasicTracedReference& ref); /** * Called at the beginning of a GC cycle. @@ -9135,7 +9191,7 @@ class V8_EXPORT Isolate { /** * An alias for PerformMicrotaskCheckpoint. */ - V8_DEPRECATE_SOON("Use PerformMicrotaskCheckpoint.") + V8_DEPRECATED("Use PerformMicrotaskCheckpoint.") void RunMicrotasks() { PerformMicrotaskCheckpoint(); } /** @@ -9179,7 +9235,7 @@ class V8_EXPORT Isolate { * Executing scripts inside the callback will not re-trigger microtasks and * the callback. */ - V8_DEPRECATE_SOON("Use *WithData version.") + V8_DEPRECATED("Use *WithData version.") void AddMicrotasksCompletedCallback(MicrotasksCompletedCallback callback); void AddMicrotasksCompletedCallback( MicrotasksCompletedCallbackWithData callback, void* data = nullptr); @@ -9187,7 +9243,7 @@ class V8_EXPORT Isolate { /** * Removes callback that was installed by AddMicrotasksCompletedCallback. */ - V8_DEPRECATE_SOON("Use *WithData version.") + V8_DEPRECATED("Use *WithData version.") void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallback callback); void RemoveMicrotasksCompletedCallback( MicrotasksCompletedCallbackWithData callback, void* data = nullptr); @@ -9367,6 +9423,12 @@ class V8_EXPORT Isolate { */ void GetCodeRange(void** start, size_t* length_in_bytes); + /** + * As GetCodeRange, but for embedded builtins (these live in a distinct + * memory region from other V8 Code objects). + */ + void GetEmbeddedCodeRange(const void** start, size_t* length_in_bytes); + /** * Returns the JSEntryStubs necessary for use with the Unwinder API. */ @@ -9429,8 +9491,15 @@ class V8_EXPORT Isolate { "See http://crbug.com/v8/10096.") void SetAllowCodeGenerationFromStringsCallback( AllowCodeGenerationFromStringsCallback callback); + V8_DEPRECATE_SOON( + "Use Isolate::SetModifyCodeGenerationFromStringsCallback with " + "ModifyCodeGenerationFromStringsCallback2 instead. See " + "http://crbug.com/1096017 and TC39 Dynamic Code Brand Checks proposal " + "at https://github.com/tc39/proposal-dynamic-code-brand-checks.") void SetModifyCodeGenerationFromStringsCallback( ModifyCodeGenerationFromStringsCallback callback); + void SetModifyCodeGenerationFromStringsCallback( + ModifyCodeGenerationFromStringsCallback2 callback); /** * Set the callback to invoke to check if wasm code generation should @@ -9818,6 +9887,12 @@ class V8_EXPORT V8 { */ static void GetSharedMemoryStatistics(SharedMemoryStatistics* statistics); + /** + * Notifies V8 that the process is cross-origin-isolated, which enables + * defining the SharedArrayBuffer function on the global object of Contexts. + */ + static void SetIsCrossOriginIsolated(); + private: V8(); @@ -9867,6 +9942,8 @@ class V8_EXPORT V8 { static void ToLocalEmpty(); static void InternalFieldOutOfBounds(int index); template + friend class BasicTracedReference; + template friend class Global; template friend class Local; template @@ -9874,9 +9951,8 @@ class V8_EXPORT V8 { template friend class Maybe; template - friend class TracedReferenceBase; - template friend class TracedGlobal; + friend class TracedReferenceBase; template friend class TracedReference; template @@ -10417,12 +10493,9 @@ class V8_EXPORT Context { */ void Exit(); - /** Returns the isolate associated with a current context. */ + /** Returns an isolate associated with a current context. */ Isolate* GetIsolate(); - /** Returns the microtask queue associated with a current context. */ - MicrotaskQueue* GetMicrotaskQueue(); - /** * The field at kDebugIdIndex used to be reserved for the inspector. * It now serves no purpose. @@ -10777,8 +10850,8 @@ Local Local::New(Isolate* isolate, const PersistentBase& that) { } template -Local Local::New(Isolate* isolate, const TracedReferenceBase& that) { - return New(isolate, that.val_); +Local Local::New(Isolate* isolate, const BasicTracedReference& that) { + return New(isolate, *that); } template @@ -10965,23 +11038,69 @@ Global& Global::operator=(Global&& rhs) { } template -T* TracedReferenceBase::New(Isolate* isolate, T* that, void* slot, - DestructionMode destruction_mode) { +internal::Address* BasicTracedReference::New( + Isolate* isolate, T* that, void* slot, DestructionMode destruction_mode) { if (that == nullptr) return nullptr; internal::Address* p = reinterpret_cast(that); - return reinterpret_cast(V8::GlobalizeTracedReference( + return V8::GlobalizeTracedReference( reinterpret_cast(isolate), p, reinterpret_cast(slot), - destruction_mode == kWithDestructor)); + destruction_mode == kWithDestructor); } -template -void TracedReferenceBase::Reset() { +void TracedReferenceBase::Reset() { if (IsEmpty()) return; V8::DisposeTracedGlobal(reinterpret_cast(val_)); SetSlotThreadSafe(nullptr); } +v8::Local TracedReferenceBase::Get(v8::Isolate* isolate) const { + if (IsEmpty()) return Local(); + return Local::New(isolate, reinterpret_cast(val_)); +} + +V8_INLINE bool operator==(const TracedReferenceBase& lhs, + const TracedReferenceBase& rhs) { + v8::internal::Address* a = reinterpret_cast(lhs.val_); + v8::internal::Address* b = reinterpret_cast(rhs.val_); + if (a == nullptr) return b == nullptr; + if (b == nullptr) return false; + return *a == *b; +} + +template +V8_INLINE bool operator==(const TracedReferenceBase& lhs, + const v8::Local& rhs) { + v8::internal::Address* a = reinterpret_cast(lhs.val_); + v8::internal::Address* b = reinterpret_cast(*rhs); + if (a == nullptr) return b == nullptr; + if (b == nullptr) return false; + return *a == *b; +} + +template +V8_INLINE bool operator==(const v8::Local& lhs, + const TracedReferenceBase& rhs) { + return rhs == lhs; +} + +V8_INLINE bool operator!=(const TracedReferenceBase& lhs, + const TracedReferenceBase& rhs) { + return !(lhs == rhs); +} + +template +V8_INLINE bool operator!=(const TracedReferenceBase& lhs, + const v8::Local& rhs) { + return !(lhs == rhs); +} + +template +V8_INLINE bool operator!=(const v8::Local& lhs, + const TracedReferenceBase& rhs) { + return !(rhs == lhs); +} + template template void TracedGlobal::Reset(Isolate* isolate, const Local& other) { @@ -10989,7 +11108,7 @@ void TracedGlobal::Reset(Isolate* isolate, const Local& other) { Reset(); if (other.IsEmpty()) return; this->val_ = this->New(isolate, other.val_, &this->val_, - TracedReferenceBase::kWithDestructor); + BasicTracedReference::kWithDestructor); } template @@ -11039,7 +11158,7 @@ void TracedReference::Reset(Isolate* isolate, const Local& other) { if (other.IsEmpty()) return; this->SetSlotThreadSafe( this->New(isolate, other.val_, &this->val_, - TracedReferenceBase::kWithoutDestructor)); + BasicTracedReference::kWithoutDestructor)); } template @@ -11082,8 +11201,7 @@ TracedReference& TracedReference::operator=(const TracedReference& rhs) { return *this; } -template -void TracedReferenceBase::SetWrapperClassId(uint16_t class_id) { +void TracedReferenceBase::SetWrapperClassId(uint16_t class_id) { typedef internal::Internals I; if (IsEmpty()) return; internal::Address* obj = reinterpret_cast(val_); @@ -11091,8 +11209,7 @@ void TracedReferenceBase::SetWrapperClassId(uint16_t class_id) { *reinterpret_cast(addr) = class_id; } -template -uint16_t TracedReferenceBase::WrapperClassId() const { +uint16_t TracedReferenceBase::WrapperClassId() const { typedef internal::Internals I; if (IsEmpty()) return 0; internal::Address* obj = reinterpret_cast(val_); @@ -11123,7 +11240,7 @@ void ReturnValue::Set(const Global& handle) { template template -void ReturnValue::Set(const TracedReferenceBase& handle) { +void ReturnValue::Set(const BasicTracedReference& handle) { static_assert(std::is_base_of::value, "type check"); if (V8_UNLIKELY(handle.IsEmpty())) { *value_ = GetDefaultValue(); @@ -11243,22 +11360,14 @@ template Local FunctionCallbackInfo::operator[](int i) const { // values_ points to the first argument (not the receiver). if (i < 0 || length_ <= i) return Local(*Undefined(GetIsolate())); -#ifdef V8_REVERSE_JSARGS return Local(reinterpret_cast(values_ + i)); -#else - return Local(reinterpret_cast(values_ - i)); -#endif } template Local FunctionCallbackInfo::This() const { // values_ points to the first argument (not the receiver). -#ifdef V8_REVERSE_JSARGS return Local(reinterpret_cast(values_ - 1)); -#else - return Local(reinterpret_cast(values_ + 1)); -#endif } @@ -11453,8 +11562,12 @@ void* Object::GetAlignedPointerFromInternalField(int index) { instance_type == I::kJSApiObjectType || instance_type == I::kJSSpecialApiObjectType)) { int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index); +#ifdef V8_HEAP_SANDBOX + offset += I::kEmbedderDataSlotRawPayloadOffset; +#endif internal::Isolate* isolate = I::GetIsolateForHeapSandbox(obj); - A value = I::ReadExternalPointerField(isolate, obj, offset); + A value = I::ReadExternalPointerField( + isolate, obj, offset, internal::kEmbedderDataSlotPayloadTag); return reinterpret_cast(value); } #endif @@ -11487,7 +11600,8 @@ String::ExternalStringResource* String::GetExternalStringResource() const { if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) { internal::Isolate* isolate = I::GetIsolateForHeapSandbox(obj); A value = - I::ReadExternalPointerField(isolate, obj, I::kStringResourceOffset); + I::ReadExternalPointerField(isolate, obj, I::kStringResourceOffset, + internal::kExternalStringResourceTag); result = reinterpret_cast(value); } else { result = GetExternalStringResourceSlow(); @@ -11511,7 +11625,8 @@ String::ExternalStringResourceBase* String::GetExternalStringResourceBase( type == I::kExternalTwoByteRepresentationTag) { internal::Isolate* isolate = I::GetIsolateForHeapSandbox(obj); A value = - I::ReadExternalPointerField(isolate, obj, I::kStringResourceOffset); + I::ReadExternalPointerField(isolate, obj, I::kStringResourceOffset, + internal::kExternalStringResourceTag); resource = reinterpret_cast(value); } else { resource = GetExternalStringResourceBaseSlow(encoding_out); @@ -12073,9 +12188,13 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) { I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset); int value_offset = I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index); +#ifdef V8_HEAP_SANDBOX + value_offset += I::kEmbedderDataSlotRawPayloadOffset; +#endif internal::Isolate* isolate = I::GetIsolateForHeapSandbox(ctx); return reinterpret_cast( - I::ReadExternalPointerField(isolate, embedder_data, value_offset)); + I::ReadExternalPointerField(isolate, embedder_data, value_offset, + internal::kEmbedderDataSlotPayloadTag)); #else return SlowGetAlignedPointerFromEmbedderData(index); #endif diff --git a/deps/v8/include/v8config.h b/deps/v8/include/v8config.h index a047874c4064f6..ae89edb2c9b791 100644 --- a/deps/v8/include/v8config.h +++ b/deps/v8/include/v8config.h @@ -482,15 +482,6 @@ V8 shared library set USING_V8_SHARED. #endif // V8_OS_WIN -// Support for floating point parameters in calls to C. -// It's currently enabled only for the platforms listed below. We don't plan -// to add support for IA32, because it has a totally different approach -// (using FP stack). As support is added to more platforms, please make sure -// to list them here in order to enable tests of this functionality. -#if defined(V8_TARGET_ARCH_X64) -#define V8_ENABLE_FP_PARAMS_IN_C_LINKAGE -#endif - // clang-format on #endif // V8CONFIG_H_ diff --git a/deps/v8/infra/mb/mb_config.pyl b/deps/v8/infra/mb/mb_config.pyl index 7d5cc73026c277..aab725feece2fa 100644 --- a/deps/v8/infra/mb/mb_config.pyl +++ b/deps/v8/infra/mb/mb_config.pyl @@ -86,7 +86,6 @@ 'V8 Linux - arm64 - sim - MSAN': 'release_simulate_arm64_msan', # Misc. 'V8 Linux gcc': 'release_x86_gcc', - 'V8 Linux64 gcc - debug': 'debug_x64_gcc', # FYI. 'V8 iOS - sim': 'release_x64_ios_simulator', 'V8 Linux64 - debug - perfetto - builder': 'debug_x64_perfetto', @@ -95,10 +94,10 @@ 'release_x64_pointer_compression_without_dchecks', 'V8 Linux64 - arm64 - sim - pointer compression - builder': 'release_simulate_arm64_pointer_compression', + 'V8 Linux64 gcc - debug': 'debug_x64_gcc', 'V8 Fuchsia - builder': 'release_x64_fuchsia', 'V8 Fuchsia - debug builder': 'debug_x64_fuchsia', 'V8 Linux64 - cfi': 'release_x64_cfi', - 'V8 Linux64 - reverse jsargs': 'debug_x64_reverse_jsargs', 'V8 Linux64 UBSan': 'release_x64_ubsan', 'V8 Linux - vtunejit': 'debug_x86_vtunejit', 'V8 Linux64 - gcov coverage': 'release_x64_gcc_coverage', @@ -232,7 +231,6 @@ 'v8_linux64_perfetto_dbg_ng': 'debug_x64_perfetto', 'v8_linux64_pointer_compression_rel_ng': 'release_x64_pointer_compression', 'v8_linux64_rel_ng': 'release_x64_test_features_trybot', - 'v8_linux64_reverse_jsargs_dbg_ng': 'debug_x64_reverse_jsargs', 'v8_linux64_shared_compile_rel': 'release_x64_shared_verify_heap', 'v8_linux64_verify_csa_rel_ng': 'release_x64_verify_csa', 'v8_linux64_asan_rel_ng': 'release_x64_asan_minimal_symbols', @@ -538,8 +536,6 @@ 'debug_bot', 'x64', 'perfetto'], 'debug_x64_trybot': [ 'debug_trybot', 'x64'], - 'debug_x64_reverse_jsargs': [ - 'debug_bot', 'x64', 'reverse_jsargs'], 'debug_x64_trybot_custom': [ 'debug_trybot', 'x64', 'v8_snapshot_custom'], 'full_debug_x64': [ @@ -661,7 +657,13 @@ }, 'disable_concurrent_marking': { - 'gn_args': 'v8_enable_concurrent_marking=false', + # Disable concurrent marking and atomic object field writes in order to + # increase the TSAN coverage for background tasks. We need to keep the + # atomic marking state enabled because that is needed for the concurrent + # write-barrier used by background compilation. + 'gn_args': 'v8_enable_concurrent_marking=false ' + 'v8_enable_atomic_object_field_writes=false ' + 'v8_enable_atomic_marking_state=true ', }, 'disable_pgo': { @@ -752,10 +754,6 @@ 'mixins': ['release_bot', 'minimal_symbols', 'dcheck_always_on'], }, - 'reverse_jsargs': { - 'gn_args': 'v8_enable_reverse_jsargs=true', - }, - 'official': { 'gn_args': 'is_official_build=true', }, diff --git a/deps/v8/infra/testing/PRESUBMIT.py b/deps/v8/infra/testing/PRESUBMIT.py index 178ba9f707c011..46ae05163d51d1 100644 --- a/deps/v8/infra/testing/PRESUBMIT.py +++ b/deps/v8/infra/testing/PRESUBMIT.py @@ -29,6 +29,7 @@ 'cpu', 'device_os', 'device_type', + 'gpu', 'os', 'pool', ] diff --git a/deps/v8/infra/testing/builders.pyl b/deps/v8/infra/testing/builders.pyl index c5ee5e496f45cd..9414e17377abf2 100644 --- a/deps/v8/infra/testing/builders.pyl +++ b/deps/v8/infra/testing/builders.pyl @@ -81,6 +81,24 @@ {'name': 'test262', 'variant': 'extra', 'shards': 3}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, + # Noavx. + { + 'name': 'mozilla', + 'suffix': 'noavx', + 'test_args': ['--extra-flags', '--noenable-avx'] + }, + { + 'name': 'test262', + 'suffix': 'noavx', + 'variant': 'default', + 'test_args': ['--extra-flags', '--noenable-avx'] + }, + { + 'name': 'v8testing', + 'suffix': 'noavx', + 'test_args': ['--extra-flags', '--noenable-avx'], + 'shards': 2 + }, ], }, 'v8_linux_gc_stress_dbg_ng_triggered': { @@ -202,6 +220,24 @@ 'test_args': ['--extra-flags', '--noenable-sse4-1 --noenable-avx'], 'shards': 3, }, + # Noavx. + { + 'name': 'mozilla', + 'suffix': 'noavx', + 'test_args': ['--extra-flags', '--noenable-avx'] + }, + { + 'name': 'test262', + 'suffix': 'noavx', + 'variant': 'default', + 'test_args': ['--extra-flags', '--noenable-avx'] + }, + { + 'name': 'v8testing', + 'suffix': 'noavx', + 'test_args': ['--extra-flags', '--noenable-avx'], + 'shards': 2 + }, ], }, 'v8_linux_verify_csa_rel_ng_triggered': { @@ -292,6 +328,7 @@ {'name': 'v8testing', 'variant': 'minor_mc'}, {'name': 'v8testing', 'variant': 'no_lfa'}, {'name': 'v8testing', 'variant': 'stress_instruction_scheduling'}, + {'name': 'v8testing', 'variant': 'stress_concurrent_allocation'}, ], }, 'v8_linux64_fuzzilli_ng_triggered': { @@ -301,15 +338,6 @@ # TODO(almuthanna): Add a new test config for the fuzzilli suite. 'tests': [], }, - 'v8_linux64_reverse_jsargs_dbg_ng_triggered': { - 'swarming_dimensions' : { - 'cpu': 'x86-64-avx2', - 'os': 'Ubuntu-16.04', - }, - 'tests': [ - {'name': 'v8testing', 'shards': 3}, - ], - }, 'v8_linux64_gc_stress_custom_snapshot_dbg_ng_triggered': { 'swarming_dimensions' : { 'os': 'Ubuntu-16.04', @@ -423,6 +451,7 @@ {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, {'name': 'v8testing', 'variant': 'no_local_heaps'}, {'name': 'v8testing', 'variant': 'slow_path'}, + {'name': 'v8testing', 'variant': 'stress_concurrent_allocation'}, ], }, 'v8_linux64_tsan_no_cm_rel_ng_triggered': { @@ -610,7 +639,8 @@ 'v8_mac64_asan_rel_ng_triggered': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'tests': [ {'name': 'v8testing', 'shards': 4}, @@ -619,7 +649,8 @@ 'v8_mac64_dbg_ng_triggered': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'tests': [ {'name': 'mozilla'}, @@ -631,7 +662,8 @@ 'v8_mac64_gc_stress_dbg_ng_triggered': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'tests': [ {'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 4}, @@ -640,7 +672,8 @@ 'v8_mac64_rel_ng_triggered': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'tests': [ {'name': 'mozilla'}, @@ -682,7 +715,8 @@ 'v8_mac_arm64_sim_rel_ng_triggered': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'tests': [ {'name': 'v8testing', 'shards': 8}, @@ -691,7 +725,8 @@ 'v8_mac_arm64_sim_dbg_ng_triggered': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'tests': [ {'name': 'v8testing', 'shards': 8}, @@ -700,7 +735,8 @@ 'v8_mac_arm64_sim_nodcheck_rel_ng_triggered': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'tests': [ {'name': 'v8testing', 'shards': 8}, @@ -764,6 +800,24 @@ 'suffix': 'nosse4', 'test_args': ['--extra-flags', '--noenable-sse4-1 --noenable-avx'] }, + # Noavx. + { + 'name': 'mozilla', + 'suffix': 'noavx', + 'test_args': ['--extra-flags', '--noenable-avx'] + }, + { + 'name': 'test262', + 'suffix': 'noavx', + 'variant': 'default', + 'test_args': ['--extra-flags', '--noenable-avx'] + }, + { + 'name': 'v8testing', + 'suffix': 'noavx', + 'test_args': ['--extra-flags', '--noenable-avx'], + 'shards': 2 + }, ], }, 'V8 Linux - arm64 - sim - CFI': { @@ -846,6 +900,24 @@ 'test_args': ['--extra-flags', '--noenable-sse4-1 --noenable-avx'], 'shards': 3 }, + # Noavx. + { + 'name': 'mozilla', + 'suffix': 'noavx', + 'test_args': ['--extra-flags', '--noenable-avx'] + }, + { + 'name': 'test262', + 'suffix': 'noavx', + 'variant': 'default', + 'test_args': ['--extra-flags', '--noenable-avx'] + }, + { + 'name': 'v8testing', + 'suffix': 'noavx', + 'test_args': ['--extra-flags', '--noenable-avx'], + 'shards': 2 + }, ], }, 'V8 Linux - full debug': { @@ -1010,6 +1082,7 @@ {'name': 'v8testing', 'variant': 'no_lfa'}, {'name': 'v8testing', 'variant': 'slow_path'}, {'name': 'v8testing', 'variant': 'stress_instruction_scheduling'}, + {'name': 'v8testing', 'variant': 'stress_concurrent_allocation'}, # Noavx. { 'name': 'mozilla', @@ -1105,15 +1178,6 @@ {'name': 'v8testing', 'shards': 2}, ], }, - 'V8 Linux64 - reverse jsargs': { - 'swarming_dimensions' : { - 'cpu': 'x86-64-avx2', - 'os': 'Ubuntu-16.04', - }, - 'tests': [ - {'name': 'v8testing', 'shards': 3}, - ], - }, 'V8 Linux64 - shared': { 'swarming_dimensions' : { 'os': 'Ubuntu-16.04', @@ -1168,6 +1232,7 @@ {'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}, ], }, 'V8 Linux64 TSAN - stress-incremental-marking': { @@ -1240,7 +1305,8 @@ 'V8 Mac64': { 'swarming_dimensions': { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'tests': [ {'name': 'mozilla'}, @@ -1252,7 +1318,8 @@ 'V8 Mac64 - debug': { 'swarming_dimensions': { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'tests': [ {'name': 'mozilla'}, @@ -1264,7 +1331,8 @@ 'V8 Mac64 ASAN': { 'swarming_dimensions': { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'tests': [ {'name': 'v8testing', 'shards': 5}, @@ -1273,7 +1341,8 @@ 'V8 Mac64 GC Stress': { 'swarming_dimensions': { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'tests': [ {'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 4}, @@ -1298,7 +1367,8 @@ 'V8 Mac - arm64 - sim - debug': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'swarming_task_attrs': { 'expiration': 14400, @@ -1312,7 +1382,8 @@ 'V8 Mac - arm64 - sim - release': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.13', + 'os': 'Mac-10.15', + 'gpu': 'none', }, 'swarming_task_attrs': { 'expiration': 14400, diff --git a/deps/v8/samples/cppgc/cppgc-for-v8-embedders.cc b/deps/v8/samples/cppgc/cppgc-for-v8-embedders.cc index 8aaa9cd39ce654..b4d7ed9e4d72da 100644 --- a/deps/v8/samples/cppgc/cppgc-for-v8-embedders.cc +++ b/deps/v8/samples/cppgc/cppgc-for-v8-embedders.cc @@ -3,12 +3,12 @@ // found in the LICENSE file. #include +#include #include #include #include #include #include -#include #include #include @@ -21,42 +21,6 @@ * platform for cppgc. */ -/** - * Platform used by cppgc. Can just redirect to v8::Platform for most calls. - * Exception: GetForegroundTaskRunner(), see below. - * - * This example uses V8's default platform implementation to drive the cppgc - * platform. - */ -class Platform final : public cppgc::Platform { - public: - Platform() : v8_platform_(v8::platform::NewDefaultPlatform()) {} - - cppgc::PageAllocator* GetPageAllocator() final { - return v8_platform_->GetPageAllocator(); - } - - double MonotonicallyIncreasingTime() final { - return v8_platform_->MonotonicallyIncreasingTime(); - } - - std::shared_ptr GetForegroundTaskRunner() final { - // V8's default platform creates a new task runner when passed the - // v8::Isolate pointer the first time. For non-default platforms this will - // require getting the appropriate task runner. - return v8_platform_->GetForegroundTaskRunner(nullptr); - } - - std::unique_ptr PostJob( - cppgc::TaskPriority priority, - std::unique_ptr job_task) final { - return v8_platform_->PostJob(priority, std::move(job_task)); - } - - private: - std::unique_ptr v8_platform_; -}; - /** * Simple string rope to illustrate allocation and garbage collection below. The * rope keeps the next parts alive via regular managed reference. @@ -86,7 +50,7 @@ std::ostream& operator<<(std::ostream& os, const Rope& rope) { int main(int argc, char* argv[]) { // Create a platform that is used by cppgc::Heap for execution and backend // allocation. - auto cppgc_platform = std::make_shared(); + auto cppgc_platform = std::make_shared(); // Initialize the process. This must happen before any cppgc::Heap::Create() // calls. cppgc::InitializeProcess(cppgc_platform->GetPageAllocator()); diff --git a/deps/v8/src/DIR_METADATA b/deps/v8/src/DIR_METADATA new file mode 100644 index 00000000000000..2f8dbbcf45cdda --- /dev/null +++ b/deps/v8/src/DIR_METADATA @@ -0,0 +1,11 @@ +# Metadata information for this directory. +# +# For more information on DIR_METADATA files, see: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md +# +# For the schema of this file, see Metadata message: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto + +monorail { + component: "Blink>JavaScript" +} \ No newline at end of file diff --git a/deps/v8/src/OWNERS b/deps/v8/src/OWNERS index 3e21b6ea369970..e5e3de50a3eb88 100644 --- a/deps/v8/src/OWNERS +++ b/deps/v8/src/OWNERS @@ -1,5 +1,3 @@ per-file *DEPS=file:../COMMON_OWNERS per-file intl-*=file:../INTL_OWNERS per-file *-intl*=file:../INTL_OWNERS - -# COMPONENT: Blink>JavaScript diff --git a/deps/v8/src/api/DIR_METADATA b/deps/v8/src/api/DIR_METADATA new file mode 100644 index 00000000000000..a27ea1b53a3f53 --- /dev/null +++ b/deps/v8/src/api/DIR_METADATA @@ -0,0 +1,11 @@ +# Metadata information for this directory. +# +# For more information on DIR_METADATA files, see: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md +# +# For the schema of this file, see Metadata message: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto + +monorail { + component: "Blink>JavaScript>API" +} \ No newline at end of file diff --git a/deps/v8/src/api/OWNERS b/deps/v8/src/api/OWNERS index 4e36be20e867ca..519588070b000f 100644 --- a/deps/v8/src/api/OWNERS +++ b/deps/v8/src/api/OWNERS @@ -6,5 +6,3 @@ leszeks@chromium.org mlippautz@chromium.org mslekova@chromium.org verwaest@chromium.org - -# COMPONENT: Blink>JavaScript>API diff --git a/deps/v8/src/api/api-natives.cc b/deps/v8/src/api/api-natives.cc index e21dbd0eeedbb3..f8f660ea15c939 100644 --- a/deps/v8/src/api/api-natives.cc +++ b/deps/v8/src/api/api-natives.cc @@ -361,7 +361,8 @@ bool IsSimpleInstantiation(Isolate* isolate, ObjectTemplateInfo info, if (!new_target.IsJSFunction()) return false; JSFunction fun = JSFunction::cast(new_target); - if (fun.shared().function_data() != info.constructor()) return false; + if (fun.shared().function_data(kAcquireLoad) != info.constructor()) + return false; if (info.immutable_proto()) return false; return fun.context().native_context() == isolate->raw_native_context(); } diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index 11a9dce9f0611e..a29747da62ff4e 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -14,6 +14,7 @@ #include "include/v8-cppgc.h" #include "include/v8-fast-api-calls.h" #include "include/v8-profiler.h" +#include "include/v8-unwinder-state.h" #include "include/v8-util.h" #include "src/api/api-inl.h" #include "src/api/api-natives.h" @@ -86,6 +87,7 @@ #include "src/objects/slots.h" #include "src/objects/smi.h" #include "src/objects/stack-frame-info-inl.h" +#include "src/objects/synthetic-module-inl.h" #include "src/objects/templates.h" #include "src/objects/value-serializer.h" #include "src/parsing/parse-info.h" @@ -100,6 +102,7 @@ #include "src/regexp/regexp-utils.h" #include "src/runtime/runtime.h" #include "src/snapshot/code-serializer.h" +#include "src/snapshot/embedded/embedded-data.h" #include "src/snapshot/snapshot.h" #include "src/snapshot/startup-serializer.h" // For SerializedHandleChecker. #include "src/strings/char-predicates-inl.h" @@ -919,9 +922,9 @@ void ResourceConstraints::ConfigureDefaultsFromHeapSize( i::Heap::GenerationSizesFromHeapSize(maximum_heap_size_in_bytes, &young_generation, &old_generation); set_max_young_generation_size_in_bytes( - i::Max(young_generation, i::Heap::MinYoungGenerationSize())); + std::max(young_generation, i::Heap::MinYoungGenerationSize())); set_max_old_generation_size_in_bytes( - i::Max(old_generation, i::Heap::MinOldGenerationSize())); + std::max(old_generation, i::Heap::MinOldGenerationSize())); if (initial_heap_size_in_bytes > 0) { i::Heap::GenerationSizesFromHeapSize(initial_heap_size_in_bytes, &young_generation, &old_generation); @@ -931,7 +934,7 @@ void ResourceConstraints::ConfigureDefaultsFromHeapSize( } if (i::kPlatformRequiresCodeRange) { set_code_range_size_in_bytes( - i::Min(i::kMaximalCodeRangeSize, maximum_heap_size_in_bytes)); + std::min(i::kMaximalCodeRangeSize, maximum_heap_size_in_bytes)); } } @@ -946,8 +949,8 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory, if (virtual_memory_limit > 0 && i::kPlatformRequiresCodeRange) { set_code_range_size_in_bytes( - i::Min(i::kMaximalCodeRangeSize, - static_cast(virtual_memory_limit / 8))); + std::min(i::kMaximalCodeRangeSize, + static_cast(virtual_memory_limit / 8))); } } @@ -991,42 +994,6 @@ i::Address* V8::GlobalizeTracedReference(i::Isolate* isolate, i::Address* obj, return result.location(); } -// static -i::Address* i::JSMemberBase::New(v8::Isolate* isolate, i::Address* object_slot, - i::Address** this_slot) { - i::Isolate* i_isolate = reinterpret_cast(isolate); - LOG_API(i_isolate, JSMemberBase, New); -#ifdef DEBUG - Utils::ApiCheck((object_slot != nullptr), "i::JSMemberBase::New", - "the object must be not null"); -#endif - i::Handle result = i_isolate->global_handles()->CreateTraced( - *object_slot, reinterpret_cast(this_slot), - false /* no destructor */); -#ifdef VERIFY_HEAP - if (i::FLAG_verify_heap) { - i::Object(*object_slot).ObjectVerify(i_isolate); - } -#endif // VERIFY_HEAP - return result.location(); -} - -// static -void i::JSMemberBase::Delete(i::Address* object) { - i::GlobalHandles::DestroyTraced(object); -} - -// static -void i::JSMemberBase::Copy(const i::Address* const* from_slot, - i::Address** to_slot) { - i::GlobalHandles::CopyTracedGlobal(from_slot, to_slot); -} - -// static -void i::JSMemberBase::Move(i::Address** from_slot, i::Address** to_slot) { - i::GlobalHandles::MoveTracedGlobal(from_slot, to_slot); -} - i::Address* V8::CopyGlobalReference(i::Address* from) { i::Handle result = i::GlobalHandles::CopyGlobal(from); return result.location(); @@ -1560,7 +1527,7 @@ void FunctionTemplate::SetCallHandler(FunctionCallback callback, isolate, info, i::handle(*FromCData(isolate, c_function->GetTypeInfo()), isolate)); } - info->set_call_code(*obj); + info->set_call_code(*obj, kReleaseStore); } namespace { @@ -2038,6 +2005,17 @@ void ObjectTemplate::SetImmutableProto() { self->set_immutable_proto(true); } +bool ObjectTemplate::IsCodeLike() { + return Utils::OpenHandle(this)->code_like(); +} + +void ObjectTemplate::SetCodeLike() { + auto self = Utils::OpenHandle(this); + i::Isolate* isolate = self->GetIsolate(); + ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); + self->set_code_like(true); +} + // --- S c r i p t s --- // Internally, UnboundScript is a SharedFunctionInfo, and Script is a @@ -2271,7 +2249,9 @@ Local Module::GetModuleRequest(int i) const { i::Handle::cast(self)->info().module_requests(), isolate); CHECK_LT(i, module_requests->length()); - return ToApiHandle(i::handle(module_requests->get(i), isolate)); + i::Handle module_request( + i::ModuleRequest::cast(module_requests->get(i)), isolate); + return ToApiHandle(i::handle(module_request->specifier(), isolate)); } Location Module::GetModuleRequestLocation(int i) const { @@ -2329,6 +2309,15 @@ int Module::ScriptId() { return ToApiHandle(sfi)->GetId(); } +bool Module::IsGraphAsync() const { + Utils::ApiCheck( + GetStatus() >= kInstantiated, "v8::Module::IsGraphAsync", + "v8::Module::IsGraphAsync must be used on an instantiated module"); + i::Handle self = Utils::OpenHandle(this); + auto isolate = reinterpret_cast(self->GetIsolate()); + return self->IsGraphAsync(isolate); +} + bool Module::IsSourceTextModule() const { return Utils::OpenHandle(this)->IsSourceTextModule(); } @@ -2646,12 +2635,15 @@ void ScriptCompiler::ScriptStreamingTask::Run() { data_->task->Run(); } ScriptCompiler::ScriptStreamingTask* ScriptCompiler::StartStreamingScript( Isolate* v8_isolate, StreamedSource* source, CompileOptions options) { - if (!i::FLAG_script_streaming) { - return nullptr; - } // We don't support other compile options on streaming background compiles. // TODO(rmcilroy): remove CompileOptions from the API. CHECK(options == ScriptCompiler::kNoCompileOptions); + return StartStreaming(v8_isolate, source); +} + +ScriptCompiler::ScriptStreamingTask* ScriptCompiler::StartStreaming( + Isolate* v8_isolate, StreamedSource* source) { + if (!i::FLAG_script_streaming) return nullptr; i::Isolate* isolate = reinterpret_cast(v8_isolate); i::ScriptStreamingData* data = source->impl(); std::unique_ptr task = @@ -3663,6 +3655,12 @@ MaybeLocal Value::ToUint32(Local context) const { RETURN_ESCAPED(result); } +i::Address i::DecodeExternalPointerImpl(const i::Isolate* isolate, + i::ExternalPointer_t encoded_pointer, + ExternalPointerTag tag) { + return i::DecodeExternalPointer(isolate, encoded_pointer, tag); +} + i::Isolate* i::IsolateFromNeverReadOnlySpaceObject(i::Address obj) { return i::GetIsolateFromWritableObject(i::HeapObject::cast(i::Object(obj))); } @@ -4436,7 +4434,8 @@ MaybeLocal v8::Object::GetPropertyNames( accumulator.GetKeys(static_cast(key_conversion)); DCHECK(self->map().EnumLength() == i::kInvalidEnumCacheSentinel || self->map().EnumLength() == 0 || - self->map().instance_descriptors().enum_cache().keys() != *value); + self->map().instance_descriptors(kRelaxedLoad).enum_cache().keys() != + *value); auto result = isolate->factory()->NewJSArrayWithElements(value); RETURN_ESCAPED(Utils::ToLocal(result)); } @@ -4941,7 +4940,8 @@ MaybeLocal Function::NewInstanceWithSideEffectType( CHECK(self->IsJSFunction() && i::JSFunction::cast(*self).shared().IsApiFunction()); i::Object obj = - i::JSFunction::cast(*self).shared().get_api_func_data().call_code(); + i::JSFunction::cast(*self).shared().get_api_func_data().call_code( + kAcquireLoad); if (obj.IsCallHandlerInfo()) { i::CallHandlerInfo handler_info = i::CallHandlerInfo::cast(obj); if (!handler_info.IsSideEffectFreeCallHandlerInfo()) { @@ -4955,7 +4955,8 @@ MaybeLocal Function::NewInstanceWithSideEffectType( i::Execution::New(isolate, self, self, argc, args), &result); if (should_set_has_no_side_effect) { i::Object obj = - i::JSFunction::cast(*self).shared().get_api_func_data().call_code(); + i::JSFunction::cast(*self).shared().get_api_func_data().call_code( + kAcquireLoad); if (obj.IsCallHandlerInfo()) { i::CallHandlerInfo handler_info = i::CallHandlerInfo::cast(obj); if (has_pending_exception) { @@ -5127,6 +5128,18 @@ Local Function::GetBoundFunction() const { return v8::Undefined(reinterpret_cast(self->GetIsolate())); } +MaybeLocal v8::Function::FunctionProtoToString(Local context) { + PREPARE_FOR_EXECUTION(context, Function, FunctionProtoToString, String); + auto self = Utils::OpenHandle(this); + Local result; + has_pending_exception = !ToLocal( + i::Execution::CallBuiltin(isolate, isolate->function_to_string(), self, 0, + nullptr), + &result); + RETURN_ON_FAILED_EXECUTION(String); + RETURN_ESCAPED(Local::Cast(result)); +} + int Name::GetIdentityHash() { auto self = Utils::OpenHandle(this); return static_cast(self->Hash()); @@ -5532,7 +5545,8 @@ String::ExternalStringResource* String::GetExternalStringResourceSlow() const { if (i::StringShape(str).IsExternalTwoByte()) { internal::Isolate* isolate = I::GetIsolateForHeapSandbox(str.ptr()); internal::Address value = I::ReadExternalPointerField( - isolate, str.ptr(), I::kStringResourceOffset); + isolate, str.ptr(), I::kStringResourceOffset, + internal::kExternalStringResourceTag); return reinterpret_cast(value); } return nullptr; @@ -5556,7 +5570,8 @@ String::ExternalStringResourceBase* String::GetExternalStringResourceBaseSlow( i::StringShape(str).IsExternalTwoByte()) { internal::Isolate* isolate = I::GetIsolateForHeapSandbox(string); internal::Address value = - I::ReadExternalPointerField(isolate, string, I::kStringResourceOffset); + I::ReadExternalPointerField(isolate, string, I::kStringResourceOffset, + internal::kExternalStringResourceTag); resource = reinterpret_cast(value); } return resource; @@ -5876,6 +5891,10 @@ void V8::GetSharedMemoryStatistics(SharedMemoryStatistics* statistics) { i::ReadOnlyHeap::PopulateReadOnlySpaceStatistics(statistics); } +void V8::SetIsCrossOriginIsolated() { + i::FLAG_harmony_sharedarraybuffer = true; +} + template struct InvokeBootstrapper; @@ -6118,12 +6137,6 @@ v8::Isolate* Context::GetIsolate() { return reinterpret_cast(env->GetIsolate()); } -v8::MicrotaskQueue* Context::GetMicrotaskQueue() { - i::Handle env = Utils::OpenHandle(this); - CHECK(env->IsNativeContext()); - return i::Handle::cast(env)->microtask_queue(); -} - v8::Local Context::Global() { i::Handle context = Utils::OpenHandle(this); i::Isolate* isolate = context->GetIsolate(); @@ -6839,6 +6852,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(kLinear); #undef REGEXP_FLAG_ASSERT_EQ v8::RegExp::Flags v8::RegExp::GetFlags() const { @@ -7015,10 +7029,11 @@ i::Handle MapAsArray(i::Isolate* isolate, i::Object table_obj, i::DisallowHeapAllocation no_gc; i::Oddball the_hole = i::ReadOnlyRoots(isolate).the_hole_value(); for (int i = offset; i < capacity; ++i) { - i::Object key = table->KeyAt(i); + i::InternalIndex entry(i); + i::Object key = table->KeyAt(entry); if (key == the_hole) continue; if (collect_keys) result->set(result_index++, key); - if (collect_values) result->set(result_index++, table->ValueAt(i)); + if (collect_values) result->set(result_index++, table->ValueAt(entry)); } } DCHECK_GE(max_length, result_index); @@ -7118,7 +7133,8 @@ i::Handle SetAsArray(i::Isolate* isolate, i::Object table_obj, i::DisallowHeapAllocation no_gc; i::Oddball the_hole = i::ReadOnlyRoots(isolate).the_hole_value(); for (int i = offset; i < capacity; ++i) { - i::Object key = table->KeyAt(i); + i::InternalIndex entry(i); + i::Object key = table->KeyAt(entry); if (key == the_hole) continue; result->set(result_index++, key); if (collect_key_values) result->set(result_index++, key); @@ -7314,6 +7330,7 @@ CompiledWasmModule::CompiledWasmModule( } OwnedBuffer CompiledWasmModule::Serialize() { + TRACE_EVENT0("v8.wasm", "wasm.SerializeModule"); i::wasm::WasmSerializer wasm_serializer(native_module_.get()); size_t buffer_size = wasm_serializer.GetSerializedNativeModuleSize(); std::unique_ptr buffer(new uint8_t[buffer_size]); @@ -7665,7 +7682,7 @@ Local v8::ArrayBufferView::Buffer() { size_t v8::ArrayBufferView::CopyContents(void* dest, size_t byte_length) { i::Handle self = Utils::OpenHandle(this); size_t byte_offset = self->byte_offset(); - size_t bytes_to_copy = i::Min(byte_length, self->byte_length()); + size_t bytes_to_copy = std::min(byte_length, self->byte_length()); if (bytes_to_copy) { i::DisallowHeapAllocation no_gc; i::Isolate* isolate = self->GetIsolate(); @@ -8995,6 +9012,14 @@ void Isolate::GetCodeRange(void** start, size_t* length_in_bytes) { *length_in_bytes = code_range.size(); } +void Isolate::GetEmbeddedCodeRange(const void** start, + size_t* length_in_bytes) { + i::Isolate* isolate = reinterpret_cast(this); + i::EmbeddedData d = i::EmbeddedData::FromBlob(isolate); + *start = reinterpret_cast(d.code()); + *length_in_bytes = d.code_size(); +} + JSEntryStubs Isolate::GetJSEntryStubs() { JSEntryStubs entry_stubs; @@ -9050,6 +9075,9 @@ CALLBACK_SETTER(AllowCodeGenerationFromStringsCallback, CALLBACK_SETTER(ModifyCodeGenerationFromStringsCallback, ModifyCodeGenerationFromStringsCallback, modify_code_gen_callback) +CALLBACK_SETTER(ModifyCodeGenerationFromStringsCallback, + ModifyCodeGenerationFromStringsCallback2, + modify_code_gen_callback2) CALLBACK_SETTER(AllowWasmCodeGenerationCallback, AllowWasmCodeGenerationCallback, allow_wasm_code_gen_callback) @@ -9199,6 +9227,14 @@ void v8::Isolate::LocaleConfigurationChangeNotification() { #endif // V8_INTL_SUPPORT } +bool v8::Object::IsCodeLike(v8::Isolate* isolate) { + i::Isolate* i_isolate = reinterpret_cast(isolate); + LOG_API(i_isolate, Object, IsCodeLike); + ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); + i::HandleScope scope(i_isolate); + return Utils::OpenHandle(this)->IsCodeLike(i_isolate); +} + // static std::unique_ptr MicrotaskQueue::New(Isolate* isolate, MicrotasksPolicy policy) { @@ -9827,7 +9863,7 @@ void debug::ForceGarbageCollection( v8::Isolate* isolate, v8::EmbedderHeapTracer::EmbedderStackState embedder_stack_state) { i::Heap* heap = reinterpret_cast(isolate)->heap(); - heap->SetEmbedderStackStateForNextFinalizaton(embedder_stack_state); + heap->SetEmbedderStackStateForNextFinalization(embedder_stack_state); isolate->LowMemoryNotification(); } @@ -9943,6 +9979,10 @@ int debug::WasmScript::CodeOffset() const { 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(); } @@ -10289,6 +10329,12 @@ debug::PostponeInterruptsScope::PostponeInterruptsScope(v8::Isolate* isolate) debug::PostponeInterruptsScope::~PostponeInterruptsScope() = default; +debug::DisableBreakScope::DisableBreakScope(v8::Isolate* isolate) + : scope_(std::make_unique( + reinterpret_cast(isolate)->debug())) {} + +debug::DisableBreakScope::~DisableBreakScope() = default; + Local CpuProfileNode::GetFunctionName() const { const i::ProfileNode* node = reinterpret_cast(this); i::Isolate* isolate = node->isolate(); @@ -10695,24 +10741,27 @@ void CpuProfiler::SetUsePreciseSampling(bool use_precise_sampling) { use_precise_sampling); } -void CpuProfiler::StartProfiling(Local title, - CpuProfilingOptions options) { - reinterpret_cast(this)->StartProfiling( +CpuProfilingStatus CpuProfiler::StartProfiling(Local title, + CpuProfilingOptions options) { + return reinterpret_cast(this)->StartProfiling( *Utils::OpenHandle(*title), options); } -void CpuProfiler::StartProfiling(Local title, bool record_samples) { +CpuProfilingStatus CpuProfiler::StartProfiling(Local title, + bool record_samples) { CpuProfilingOptions options( kLeafNodeLineNumbers, record_samples ? CpuProfilingOptions::kNoSampleLimit : 0); - reinterpret_cast(this)->StartProfiling( + return reinterpret_cast(this)->StartProfiling( *Utils::OpenHandle(*title), options); } -void CpuProfiler::StartProfiling(Local title, CpuProfilingMode mode, - bool record_samples, unsigned max_samples) { +CpuProfilingStatus CpuProfiler::StartProfiling(Local title, + CpuProfilingMode mode, + bool record_samples, + unsigned max_samples) { CpuProfilingOptions options(mode, record_samples ? max_samples : 0); - reinterpret_cast(this)->StartProfiling( + return reinterpret_cast(this)->StartProfiling( *Utils::OpenHandle(*title), options); } @@ -11004,6 +11053,12 @@ void HeapProfiler::RemoveBuildEmbedderGraphCallback( callback, data); } +void HeapProfiler::SetGetDetachednessCallback(GetDetachednessCallback callback, + void* data) { + reinterpret_cast(this)->SetGetDetachednessCallback(callback, + data); +} + void EmbedderHeapTracer::SetStackStart(void* stack_start) { CHECK(isolate_); reinterpret_cast(isolate_)->global_handles()->SetStackStart( @@ -11032,7 +11087,7 @@ void EmbedderHeapTracer::GarbageCollectionForTesting( CHECK(isolate_); CHECK(i::FLAG_expose_gc); i::Heap* const heap = reinterpret_cast(isolate_)->heap(); - heap->SetEmbedderStackStateForNextFinalizaton(stack_state); + heap->SetEmbedderStackStateForNextFinalization(stack_state); heap->PreciseCollectAllGarbage(i::Heap::kNoGCFlags, i::GarbageCollectionReason::kTesting, kGCCallbackFlagForced); @@ -11061,7 +11116,7 @@ void EmbedderHeapTracer::DecreaseAllocatedSize(size_t bytes) { } void EmbedderHeapTracer::RegisterEmbedderReference( - const TracedReferenceBase& ref) { + const BasicTracedReference& ref) { if (ref.IsEmpty()) return; i::Heap* const heap = reinterpret_cast(isolate_)->heap(); @@ -11119,6 +11174,33 @@ CFunction::CFunction(const void* address, const CFunctionInfo* type_info) } } +RegisterState::RegisterState() + : pc(nullptr), sp(nullptr), fp(nullptr), lr(nullptr) {} +RegisterState::~RegisterState() = default; + +RegisterState::RegisterState(const RegisterState& other) V8_NOEXCEPT { + *this = other; +} + +RegisterState& RegisterState::operator=(const RegisterState& other) + V8_NOEXCEPT { + if (&other != this) { + pc = other.pc; + sp = other.sp; + fp = other.fp; + lr = other.lr; + if (other.callee_saved) { + // Make a deep copy if {other.callee_saved} is non-null. + callee_saved = + std::make_unique(*(other.callee_saved)); + } else { + // Otherwise, set {callee_saved} to null to match {other}. + callee_saved.reset(); + } + } + return *this; +} + namespace internal { const size_t HandleScopeImplementer::kEnteredContextsOffset = diff --git a/deps/v8/src/asmjs/DIR_METADATA b/deps/v8/src/asmjs/DIR_METADATA new file mode 100644 index 00000000000000..3b428d966064f9 --- /dev/null +++ b/deps/v8/src/asmjs/DIR_METADATA @@ -0,0 +1,11 @@ +# Metadata information for this directory. +# +# For more information on DIR_METADATA files, see: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md +# +# For the schema of this file, see Metadata message: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto + +monorail { + component: "Blink>JavaScript>WebAssembly" +} \ No newline at end of file diff --git a/deps/v8/src/asmjs/OWNERS b/deps/v8/src/asmjs/OWNERS index 16b08f3b3b743a..c400f97de0620e 100644 --- a/deps/v8/src/asmjs/OWNERS +++ b/deps/v8/src/asmjs/OWNERS @@ -1,5 +1,3 @@ ahaas@chromium.org clemensb@chromium.org titzer@chromium.org - -# COMPONENT: Blink>JavaScript>WebAssembly diff --git a/deps/v8/src/ast/DIR_METADATA b/deps/v8/src/ast/DIR_METADATA new file mode 100644 index 00000000000000..165380ae4f387a --- /dev/null +++ b/deps/v8/src/ast/DIR_METADATA @@ -0,0 +1,11 @@ +# Metadata information for this directory. +# +# For more information on DIR_METADATA files, see: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md +# +# For the schema of this file, see Metadata message: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto + +monorail { + component: "Blink>JavaScript>Parser" +} \ No newline at end of file diff --git a/deps/v8/src/ast/OWNERS b/deps/v8/src/ast/OWNERS index 089db4c25225d2..1da57bd30d05c2 100644 --- a/deps/v8/src/ast/OWNERS +++ b/deps/v8/src/ast/OWNERS @@ -6,5 +6,3 @@ littledan@chromium.org marja@chromium.org neis@chromium.org verwaest@chromium.org - -# COMPONENT: Blink>JavaScript>Parser diff --git a/deps/v8/src/ast/ast-function-literal-id-reindexer.cc b/deps/v8/src/ast/ast-function-literal-id-reindexer.cc index b583b5e4214ad4..8c9318bfe7475d 100644 --- a/deps/v8/src/ast/ast-function-literal-id-reindexer.cc +++ b/deps/v8/src/ast/ast-function-literal-id-reindexer.cc @@ -54,10 +54,10 @@ void AstFunctionLiteralIdReindexer::VisitClassLiteral(ClassLiteral* expr) { // Private fields have their key and value present in // instance_members_initializer_function, so they will // already have been visited. - if (prop->value()->IsFunctionLiteral()) { - Visit(prop->value()); - } else { + if (prop->kind() == ClassLiteralProperty::Kind::FIELD) { CheckVisited(prop->value()); + } else { + Visit(prop->value()); } } ZonePtrList* props = expr->public_members(); @@ -67,7 +67,8 @@ void AstFunctionLiteralIdReindexer::VisitClassLiteral(ClassLiteral* expr) { // Public fields with computed names have their key // and value present in instance_members_initializer_function, so they will // already have been visited. - if (prop->is_computed_name() && !prop->value()->IsFunctionLiteral()) { + if (prop->is_computed_name() && + prop->kind() == ClassLiteralProperty::Kind::FIELD) { if (!prop->key()->IsLiteral()) { CheckVisited(prop->key()); } diff --git a/deps/v8/src/ast/ast-source-ranges.h b/deps/v8/src/ast/ast-source-ranges.h index 1e96ec4c27c58b..1b42a055dd642d 100644 --- a/deps/v8/src/ast/ast-source-ranges.h +++ b/deps/v8/src/ast/ast-source-ranges.h @@ -47,7 +47,6 @@ struct SourceRange { V(Block) \ V(CaseClause) \ V(Conditional) \ - V(Expression) \ V(FunctionLiteral) \ V(IfStatement) \ V(IterationStatement) \ @@ -282,24 +281,6 @@ class NaryOperationSourceRanges final : public AstNodeSourceRanges { ZoneVector ranges_; }; -class ExpressionSourceRanges final : public AstNodeSourceRanges { - public: - explicit ExpressionSourceRanges(const SourceRange& right_range) - : right_range_(right_range) {} - - SourceRange GetRange(SourceRangeKind kind) override { - DCHECK(HasRange(kind)); - return right_range_; - } - - bool HasRange(SourceRangeKind kind) override { - return kind == SourceRangeKind::kRight; - } - - private: - SourceRange right_range_; -}; - class SuspendSourceRanges final : public ContinuationSourceRanges { public: explicit SuspendSourceRanges(int32_t continuation_position) diff --git a/deps/v8/src/ast/ast-value-factory.cc b/deps/v8/src/ast/ast-value-factory.cc index 598096ba10d269..b5a39b22cf3b9d 100644 --- a/deps/v8/src/ast/ast-value-factory.cc +++ b/deps/v8/src/ast/ast-value-factory.cc @@ -27,12 +27,14 @@ #include "src/ast/ast-value-factory.h" +#include "src/base/hashmap-entry.h" #include "src/base/logging.h" #include "src/common/globals.h" #include "src/heap/factory-inl.h" #include "src/heap/local-factory-inl.h" #include "src/objects/objects-inl.h" #include "src/objects/objects.h" +#include "src/objects/string.h" #include "src/strings/char-predicates-inl.h" #include "src/strings/string-hasher.h" #include "src/utils/utils-inl.h" @@ -113,9 +115,7 @@ uint16_t AstRawString::FirstCharacter() const { return *c; } -bool AstRawString::Compare(void* a, void* b) { - const AstRawString* lhs = static_cast(a); - const AstRawString* rhs = static_cast(b); +bool AstRawString::Compare(const AstRawString* lhs, const AstRawString* rhs) { DCHECK_EQ(lhs->Hash(), rhs->Hash()); if (lhs->length() != rhs->length()) return false; @@ -194,14 +194,17 @@ Handle AstConsString::AllocateFlat(LocalIsolate* isolate) const { ->NewRawOneByteString(result_length, AllocationType::kOld) .ToHandleChecked(); DisallowHeapAllocation no_gc; - uint8_t* dest = result->GetChars(no_gc) + result_length; + uint8_t* dest = + result->GetChars(no_gc, SharedStringAccessGuardIfNeeded::NotNeeded()) + + result_length; for (const AstConsString::Segment* current = &segment_; current != nullptr; current = current->next) { int length = current->string->length(); dest -= length; CopyChars(dest, current->string->raw_data(), length); } - DCHECK_EQ(dest, result->GetChars(no_gc)); + DCHECK_EQ(dest, result->GetChars( + no_gc, SharedStringAccessGuardIfNeeded::NotNeeded())); return result; } @@ -210,7 +213,9 @@ Handle AstConsString::AllocateFlat(LocalIsolate* isolate) const { ->NewRawTwoByteString(result_length, AllocationType::kOld) .ToHandleChecked(); DisallowHeapAllocation no_gc; - uint16_t* dest = result->GetChars(no_gc) + result_length; + uint16_t* dest = + result->GetChars(no_gc, SharedStringAccessGuardIfNeeded::NotNeeded()) + + result_length; for (const AstConsString::Segment* current = &segment_; current != nullptr; current = current->next) { int length = current->string->length(); @@ -223,7 +228,8 @@ Handle AstConsString::AllocateFlat(LocalIsolate* isolate) const { length); } } - DCHECK_EQ(dest, result->GetChars(no_gc)); + DCHECK_EQ(dest, result->GetChars( + no_gc, SharedStringAccessGuardIfNeeded::NotNeeded())); return result; } template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) @@ -248,7 +254,7 @@ std::forward_list AstConsString::ToRawStrings() const { AstStringConstants::AstStringConstants(Isolate* isolate, uint64_t hash_seed) : zone_(isolate->allocator(), ZONE_NAME), - string_table_(AstRawString::Compare), + string_table_(), hash_seed_(hash_seed) { DCHECK_EQ(ThreadId::Current(), isolate->thread_id()); #define F(name, str) \ @@ -262,16 +268,13 @@ AstStringConstants::AstStringConstants(Isolate* isolate, uint64_t hash_seed) /* The Handle returned by the factory is located on the roots */ \ /* array, not on the temporary HandleScope, so this is safe. */ \ name##_string_->set_string(isolate->factory()->name##_string()); \ - base::HashMap::Entry* entry = \ - string_table_.InsertNew(name##_string_, name##_string_->Hash()); \ - DCHECK_NULL(entry->value); \ - entry->value = reinterpret_cast(1); \ + string_table_.InsertNew(name##_string_, name##_string_->Hash()); \ } AST_STRING_CONSTANTS(F) #undef F } -AstRawString* AstValueFactory::GetOneByteStringInternal( +const AstRawString* AstValueFactory::GetOneByteStringInternal( Vector literal) { if (literal.length() == 1 && literal[0] < kMaxOneCharStringValue) { int key = literal[0]; @@ -287,7 +290,7 @@ AstRawString* AstValueFactory::GetOneByteStringInternal( return GetString(hash_field, true, literal); } -AstRawString* AstValueFactory::GetTwoByteStringInternal( +const AstRawString* AstValueFactory::GetTwoByteStringInternal( Vector literal) { uint32_t hash_field = StringHasher::HashSequentialString( literal.begin(), literal.length(), hash_seed_); @@ -295,7 +298,7 @@ AstRawString* AstValueFactory::GetTwoByteStringInternal( } const AstRawString* AstValueFactory::GetString(Handle literal) { - AstRawString* result = nullptr; + const AstRawString* result = nullptr; DisallowHeapAllocation no_gc; String::FlatContent content = literal->GetFlatContent(no_gc); if (content.IsOneByte()) { @@ -348,27 +351,29 @@ template EXPORT_TEMPLATE_DEFINE( template EXPORT_TEMPLATE_DEFINE( V8_EXPORT_PRIVATE) void AstValueFactory::Internalize(LocalIsolate* isolate); -AstRawString* AstValueFactory::GetString(uint32_t hash_field, bool is_one_byte, - Vector literal_bytes) { +const AstRawString* AstValueFactory::GetString( + uint32_t hash_field, bool is_one_byte, Vector literal_bytes) { // literal_bytes here points to whatever the user passed, and this is OK // because we use vector_compare (which checks the contents) to compare // against the AstRawStrings which are in the string_table_. We should not // return this AstRawString. AstRawString key(is_one_byte, literal_bytes, hash_field); - base::HashMap::Entry* entry = string_table_.LookupOrInsert(&key, key.Hash()); - if (entry->value == nullptr) { - // Copy literal contents for later comparison. - int length = literal_bytes.length(); - byte* new_literal_bytes = zone()->NewArray(length); - memcpy(new_literal_bytes, literal_bytes.begin(), length); - AstRawString* new_string = zone()->New( - is_one_byte, Vector(new_literal_bytes, length), hash_field); - CHECK_NOT_NULL(new_string); - AddString(new_string); - entry->key = new_string; - entry->value = reinterpret_cast(1); - } - return reinterpret_cast(entry->key); + AstRawStringMap::Entry* entry = string_table_.LookupOrInsert( + &key, key.Hash(), + [&]() { + // Copy literal contents for later comparison. + int length = literal_bytes.length(); + byte* new_literal_bytes = zone()->NewArray(length); + memcpy(new_literal_bytes, literal_bytes.begin(), length); + AstRawString* new_string = zone()->New( + is_one_byte, Vector(new_literal_bytes, length), + hash_field); + CHECK_NOT_NULL(new_string); + AddString(new_string); + return new_string; + }, + [&]() { return base::NoHashMapValue(); }); + return entry->key; } } // namespace internal diff --git a/deps/v8/src/ast/ast-value-factory.h b/deps/v8/src/ast/ast-value-factory.h index 1752498123507b..776b45a670e051 100644 --- a/deps/v8/src/ast/ast-value-factory.h +++ b/deps/v8/src/ast/ast-value-factory.h @@ -48,6 +48,8 @@ class Isolate; class AstRawString final : public ZoneObject { public: + static bool Compare(const AstRawString* a, const AstRawString* b); + bool IsEmpty() const { return literal_bytes_.length() == 0; } int length() const { return is_one_byte() ? literal_bytes_.length() @@ -85,7 +87,6 @@ class AstRawString final : public ZoneObject { friend Zone; // Members accessed only by the AstValueFactory & related classes: - static bool Compare(void* a, void* b); AstRawString(bool is_one_byte, const Vector& literal_bytes, uint32_t hash_field) : next_(nullptr), @@ -205,12 +206,26 @@ class AstBigInt { const char* bigint_; }; +struct AstRawStringMapMatcher { + bool operator()(uint32_t hash1, uint32_t hash2, + const AstRawString* lookup_key, + const AstRawString* entry_key) const { + return hash1 == hash2 && AstRawString::Compare(lookup_key, entry_key); + } +}; + +using AstRawStringMap = + base::TemplateHashMapImpl; + // For generating constants. #define AST_STRING_CONSTANTS(F) \ F(anonymous, "anonymous") \ F(anonymous_function, "(anonymous function)") \ F(arguments, "arguments") \ F(as, "as") \ + F(assert, "assert") \ F(async, "async") \ F(await, "await") \ F(bigint, "bigint") \ @@ -269,13 +284,11 @@ class AstStringConstants final { #undef F uint64_t hash_seed() const { return hash_seed_; } - const base::CustomMatcherHashMap* string_table() const { - return &string_table_; - } + const AstRawStringMap* string_table() const { return &string_table_; } private: Zone zone_; - base::CustomMatcherHashMap string_table_; + AstRawStringMap string_table_; uint64_t hash_seed_; #define F(name, str) AstRawString* name##_string_; @@ -353,14 +366,14 @@ class AstValueFactory { strings_ = nullptr; strings_end_ = &strings_; } - V8_EXPORT_PRIVATE AstRawString* GetOneByteStringInternal( + V8_EXPORT_PRIVATE const AstRawString* GetOneByteStringInternal( Vector literal); - AstRawString* GetTwoByteStringInternal(Vector literal); - AstRawString* GetString(uint32_t hash, bool is_one_byte, - Vector literal_bytes); + const AstRawString* GetTwoByteStringInternal(Vector literal); + const AstRawString* GetString(uint32_t hash, bool is_one_byte, + Vector literal_bytes); - // All strings are copied here, one after another (no zeroes inbetween). - base::CustomMatcherHashMap string_table_; + // All strings are copied here. + AstRawStringMap string_table_; AstRawString* strings_; AstRawString** strings_end_; @@ -372,7 +385,7 @@ class AstValueFactory { // Caches one character lowercase strings (for minified code). static const int kMaxOneCharStringValue = 128; - AstRawString* one_character_strings_[kMaxOneCharStringValue]; + const AstRawString* one_character_strings_[kMaxOneCharStringValue]; Zone* zone_; diff --git a/deps/v8/src/ast/ast.cc b/deps/v8/src/ast/ast.cc index b40cf83c8209d6..e8c7796abc2b09 100644 --- a/deps/v8/src/ast/ast.cc +++ b/deps/v8/src/ast/ast.cc @@ -223,12 +223,6 @@ bool FunctionLiteral::AllowsLazyCompilation() { return scope()->AllowsLazyCompilation(); } -bool FunctionLiteral::SafeToSkipArgumentsAdaptor() const { - return language_mode() == LanguageMode::kStrict && - scope()->arguments() == nullptr && - scope()->rest_parameter() == nullptr; -} - int FunctionLiteral::start_position() const { return scope()->start_position(); } @@ -438,7 +432,7 @@ int ObjectLiteral::InitDepthAndFlags() { // literal with fast elements will be a waste of space. uint32_t element_index = 0; if (key->AsArrayIndex(&element_index)) { - max_element_index = Max(element_index, max_element_index); + max_element_index = std::max(element_index, max_element_index); elements++; } else { DCHECK(key->IsPropertyName()); diff --git a/deps/v8/src/ast/ast.h b/deps/v8/src/ast/ast.h index 4213c60f246e40..7b70181e6a0721 100644 --- a/deps/v8/src/ast/ast.h +++ b/deps/v8/src/ast/ast.h @@ -2160,18 +2160,6 @@ class FunctionLiteral final : public Expression { return false; } - // We can safely skip the arguments adaptor frame setup even - // in case of arguments mismatches for strict mode functions, - // as long as there's - // - // 1. no use of the arguments object (either explicitly or - // potentially implicitly via a direct eval() call), and - // 2. rest parameters aren't being used in the function. - // - // See http://bit.ly/v8-faster-calls-with-arguments-mismatch - // for the details here (https://crbug.com/v8/8895). - bool SafeToSkipArgumentsAdaptor() const; - // Returns either name or inferred name as a cstring. std::unique_ptr GetDebugName() const; diff --git a/deps/v8/src/ast/modules.cc b/deps/v8/src/ast/modules.cc index 08fbe761020cf5..3c9a5080adfb3b 100644 --- a/deps/v8/src/ast/modules.cc +++ b/deps/v8/src/ast/modules.cc @@ -16,43 +16,78 @@ namespace internal { bool SourceTextModuleDescriptor::AstRawStringComparer::operator()( const AstRawString* lhs, const AstRawString* rhs) const { + return ThreeWayCompare(lhs, rhs) < 0; +} + +int SourceTextModuleDescriptor::AstRawStringComparer::ThreeWayCompare( + const AstRawString* lhs, const AstRawString* rhs) { // Fast path for equal pointers: a pointer is not strictly less than itself. if (lhs == rhs) return false; // Order by contents (ordering by hash is unstable across runs). if (lhs->is_one_byte() != rhs->is_one_byte()) { - return lhs->is_one_byte(); + return lhs->is_one_byte() ? -1 : 1; } if (lhs->byte_length() != rhs->byte_length()) { - return lhs->byte_length() < rhs->byte_length(); + return lhs->byte_length() - rhs->byte_length(); } - return memcmp(lhs->raw_data(), rhs->raw_data(), lhs->byte_length()) < 0; + return memcmp(lhs->raw_data(), rhs->raw_data(), lhs->byte_length()); +} + +bool SourceTextModuleDescriptor::ModuleRequestComparer::operator()( + const AstModuleRequest* lhs, const AstModuleRequest* rhs) const { + if (int specifier_comparison = AstRawStringComparer::ThreeWayCompare( + lhs->specifier(), rhs->specifier())) + return specifier_comparison < 0; + + if (lhs->import_assertions()->size() != rhs->import_assertions()->size()) + return (lhs->import_assertions()->size() < + rhs->import_assertions()->size()); + + auto lhsIt = lhs->import_assertions()->cbegin(); + auto rhsIt = rhs->import_assertions()->cbegin(); + for (; lhsIt != lhs->import_assertions()->cend(); ++lhsIt, ++rhsIt) { + if (int assertion_key_comparison = + AstRawStringComparer::ThreeWayCompare(lhsIt->first, rhsIt->first)) + return assertion_key_comparison < 0; + + if (int assertion_value_comparison = AstRawStringComparer::ThreeWayCompare( + lhsIt->second.first, rhsIt->second.first)) + return assertion_value_comparison < 0; + } + + return false; } void SourceTextModuleDescriptor::AddImport( const AstRawString* import_name, const AstRawString* local_name, - const AstRawString* module_request, const Scanner::Location loc, + const AstRawString* module_request, + const ImportAssertions* import_assertions, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone) { Entry* entry = zone->New(loc); entry->local_name = local_name; entry->import_name = import_name; - entry->module_request = AddModuleRequest(module_request, specifier_loc); + entry->module_request = + AddModuleRequest(module_request, import_assertions, specifier_loc, zone); AddRegularImport(entry); } void SourceTextModuleDescriptor::AddStarImport( const AstRawString* local_name, const AstRawString* module_request, - const Scanner::Location loc, const Scanner::Location specifier_loc, - Zone* zone) { + const ImportAssertions* import_assertions, const Scanner::Location loc, + const Scanner::Location specifier_loc, Zone* zone) { Entry* entry = zone->New(loc); entry->local_name = local_name; - entry->module_request = AddModuleRequest(module_request, specifier_loc); + entry->module_request = + AddModuleRequest(module_request, import_assertions, specifier_loc, zone); AddNamespaceImport(entry, zone); } void SourceTextModuleDescriptor::AddEmptyImport( - const AstRawString* module_request, const Scanner::Location specifier_loc) { - AddModuleRequest(module_request, specifier_loc); + const AstRawString* module_request, + const ImportAssertions* import_assertions, + const Scanner::Location specifier_loc, Zone* zone) { + AddModuleRequest(module_request, import_assertions, specifier_loc, zone); } void SourceTextModuleDescriptor::AddExport(const AstRawString* local_name, @@ -66,22 +101,26 @@ void SourceTextModuleDescriptor::AddExport(const AstRawString* local_name, void SourceTextModuleDescriptor::AddExport( const AstRawString* import_name, const AstRawString* export_name, - const AstRawString* module_request, const Scanner::Location loc, + const AstRawString* module_request, + const ImportAssertions* import_assertions, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone) { DCHECK_NOT_NULL(import_name); DCHECK_NOT_NULL(export_name); Entry* entry = zone->New(loc); entry->export_name = export_name; entry->import_name = import_name; - entry->module_request = AddModuleRequest(module_request, specifier_loc); + entry->module_request = + AddModuleRequest(module_request, import_assertions, specifier_loc, zone); AddSpecialExport(entry, zone); } void SourceTextModuleDescriptor::AddStarExport( - const AstRawString* module_request, const Scanner::Location loc, + const AstRawString* module_request, + const ImportAssertions* import_assertions, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone) { Entry* entry = zone->New(loc); - entry->module_request = AddModuleRequest(module_request, specifier_loc); + entry->module_request = + AddModuleRequest(module_request, import_assertions, specifier_loc, zone); AddSpecialExport(entry, zone); } @@ -94,6 +133,32 @@ Handle ToStringOrUndefined(LocalIsolate* isolate, } } // namespace +template +Handle SourceTextModuleDescriptor::AstModuleRequest::Serialize( + LocalIsolate* isolate) const { + // The import assertions will be stored in this array in the form: + // [key1, value1, location1, key2, value2, location2, ...] + Handle import_assertions_array = + isolate->factory()->NewFixedArray( + static_cast(import_assertions()->size() * 3)); + + int i = 0; + for (auto iter = import_assertions()->cbegin(); + iter != import_assertions()->cend(); ++iter, i += 3) { + import_assertions_array->set(i, *iter->first->string()); + import_assertions_array->set(i + 1, *iter->second.first->string()); + import_assertions_array->set(i + 2, + Smi::FromInt(iter->second.second.beg_pos)); + } + return v8::internal::ModuleRequest::New(isolate, specifier()->string(), + import_assertions_array); +} +template Handle +SourceTextModuleDescriptor::AstModuleRequest::Serialize(Isolate* isolate) const; +template Handle +SourceTextModuleDescriptor::AstModuleRequest::Serialize( + LocalIsolate* isolate) const; + template Handle SourceTextModuleDescriptor::Entry::Serialize( LocalIsolate* isolate) const { diff --git a/deps/v8/src/ast/modules.h b/deps/v8/src/ast/modules.h index b57387b25fa9be..f156d7a411ac79 100644 --- a/deps/v8/src/ast/modules.h +++ b/deps/v8/src/ast/modules.h @@ -13,6 +13,7 @@ namespace internal { class AstRawString; +class ModuleRequest; class SourceTextModuleInfo; class SourceTextModuleInfoEntry; class PendingCompilationErrorHandler; @@ -26,6 +27,10 @@ class SourceTextModuleDescriptor : public ZoneObject { regular_exports_(zone), regular_imports_(zone) {} + using ImportAssertions = + ZoneMap>; + // The following Add* methods are high-level convenience functions for use by // the parser. @@ -35,12 +40,14 @@ class SourceTextModuleDescriptor : public ZoneObject { void AddImport(const AstRawString* import_name, const AstRawString* local_name, const AstRawString* module_request, + const ImportAssertions* import_assertions, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone); // import * as x from "foo.js"; void AddStarImport(const AstRawString* local_name, const AstRawString* module_request, + const ImportAssertions* import_assertions, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone); @@ -48,7 +55,8 @@ class SourceTextModuleDescriptor : public ZoneObject { // import {} from "foo.js"; // export {} from "foo.js"; (sic!) void AddEmptyImport(const AstRawString* module_request, - const Scanner::Location specifier_loc); + const ImportAssertions* import_assertions, + const Scanner::Location specifier_loc, Zone* zone); // export {x}; // export {x as y}; @@ -64,11 +72,13 @@ class SourceTextModuleDescriptor : public ZoneObject { void AddExport(const AstRawString* export_name, const AstRawString* import_name, const AstRawString* module_request, + const ImportAssertions* import_assertions, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone); // export * from "foo.js"; void AddStarExport(const AstRawString* module_request, + const ImportAssertions* import_assertions, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone); @@ -114,20 +124,55 @@ class SourceTextModuleDescriptor : public ZoneObject { enum CellIndexKind { kInvalid, kExport, kImport }; static CellIndexKind GetCellIndexKind(int cell_index); - struct ModuleRequest { + class AstModuleRequest : public ZoneObject { + public: + // TODO(v8:10958): Consider storing module request location here + // instead of using separate ModuleRequestLocation struct. + AstModuleRequest(const AstRawString* specifier, + const ImportAssertions* import_assertions) + : specifier_(specifier), import_assertions_(import_assertions) {} + + template + Handle Serialize(LocalIsolate* isolate) const; + + const AstRawString* specifier() const { return specifier_; } + const ImportAssertions* import_assertions() const { + return import_assertions_; + } + + private: + const AstRawString* specifier_; + const ImportAssertions* import_assertions_; + }; + + struct ModuleRequestLocation { + // The index at which we will place the request in SourceTextModuleInfo's + // module_requests FixedArray. int index; + + // The JS source code position of the request, used for reporting errors. int position; - ModuleRequest(int index, int position) : index(index), position(position) {} + + ModuleRequestLocation(int index, int position) + : index(index), position(position) {} }; // Custom content-based comparer for the below maps, to keep them stable // across parses. struct V8_EXPORT_PRIVATE AstRawStringComparer { bool operator()(const AstRawString* lhs, const AstRawString* rhs) const; + static int ThreeWayCompare(const AstRawString* lhs, + const AstRawString* rhs); + }; + + struct V8_EXPORT_PRIVATE ModuleRequestComparer { + bool operator()(const AstModuleRequest* lhs, + const AstModuleRequest* rhs) const; }; using ModuleRequestMap = - ZoneMap; + ZoneMap; using RegularExportMap = ZoneMultimap; using RegularImportMap = @@ -224,13 +269,15 @@ class SourceTextModuleDescriptor : public ZoneObject { void AssignCellIndices(); int AddModuleRequest(const AstRawString* specifier, - Scanner::Location specifier_loc) { + const ImportAssertions* import_assertions, + Scanner::Location specifier_loc, Zone* zone) { DCHECK_NOT_NULL(specifier); int module_requests_count = static_cast(module_requests_.size()); auto it = module_requests_ - .insert(std::make_pair(specifier, - ModuleRequest(module_requests_count, - specifier_loc.beg_pos))) + .insert(std::make_pair( + zone->New(specifier, import_assertions), + ModuleRequestLocation(module_requests_count, + specifier_loc.beg_pos))) .first; return it->second.index; } diff --git a/deps/v8/src/ast/prettyprinter.cc b/deps/v8/src/ast/prettyprinter.cc index 20dca56cc40526..e53d9c9e6e1b1e 100644 --- a/deps/v8/src/ast/prettyprinter.cc +++ b/deps/v8/src/ast/prettyprinter.cc @@ -258,6 +258,7 @@ void CallPrinter::VisitRegExpLiteral(RegExpLiteral* node) { Print("/"); if (node->flags() & RegExp::kGlobal) Print("g"); if (node->flags() & RegExp::kIgnoreCase) Print("i"); + if (node->flags() & RegExp::kLinear) Print("l"); if (node->flags() & RegExp::kMultiline) Print("m"); if (node->flags() & RegExp::kUnicode) Print("u"); if (node->flags() & RegExp::kSticky) Print("y"); @@ -1163,6 +1164,7 @@ void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) { EmbeddedVector buf; if (node->flags() & RegExp::kGlobal) buf[i++] = 'g'; if (node->flags() & RegExp::kIgnoreCase) buf[i++] = 'i'; + if (node->flags() & RegExp::kLinear) buf[i++] = 'l'; if (node->flags() & RegExp::kMultiline) buf[i++] = 'm'; if (node->flags() & RegExp::kUnicode) buf[i++] = 'u'; if (node->flags() & RegExp::kSticky) buf[i++] = 'y'; diff --git a/deps/v8/src/ast/scopes.h b/deps/v8/src/ast/scopes.h index a5f4523670a170..e731d4c46a08eb 100644 --- a/deps/v8/src/ast/scopes.h +++ b/deps/v8/src/ast/scopes.h @@ -705,8 +705,6 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) { void SetDefaults(); - void set_scope_info(Handle scope_info); - friend class DeclarationScope; friend class ClassScope; friend class ScopeTestHelper; diff --git a/deps/v8/src/base/DIR_METADATA b/deps/v8/src/base/DIR_METADATA new file mode 100644 index 00000000000000..2f8dbbcf45cdda --- /dev/null +++ b/deps/v8/src/base/DIR_METADATA @@ -0,0 +1,11 @@ +# Metadata information for this directory. +# +# For more information on DIR_METADATA files, see: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md +# +# For the schema of this file, see Metadata message: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto + +monorail { + component: "Blink>JavaScript" +} \ No newline at end of file diff --git a/deps/v8/src/base/OWNERS b/deps/v8/src/base/OWNERS index 67dcc1cd98f358..8fcbc9e047aae0 100644 --- a/deps/v8/src/base/OWNERS +++ b/deps/v8/src/base/OWNERS @@ -1,5 +1,3 @@ clemensb@chromium.org ishell@chromium.org mlippautz@chromium.org - -# COMPONENT: Blink>JavaScript diff --git a/deps/v8/src/base/bounded-page-allocator.h b/deps/v8/src/base/bounded-page-allocator.h index d09aecee05c6f0..1c8c84671129d8 100644 --- a/deps/v8/src/base/bounded-page-allocator.h +++ b/deps/v8/src/base/bounded-page-allocator.h @@ -29,6 +29,8 @@ class V8_BASE_EXPORT BoundedPageAllocator : public v8::PageAllocator { BoundedPageAllocator(v8::PageAllocator* page_allocator, Address start, size_t size, size_t allocate_page_size); + BoundedPageAllocator(const BoundedPageAllocator&) = delete; + BoundedPageAllocator& operator=(const BoundedPageAllocator&) = delete; ~BoundedPageAllocator() override = default; // These functions are not inlined to avoid https://crbug.com/v8/8275. @@ -75,8 +77,6 @@ class V8_BASE_EXPORT BoundedPageAllocator : public v8::PageAllocator { const size_t commit_page_size_; v8::PageAllocator* const page_allocator_; v8::base::RegionAllocator region_allocator_; - - DISALLOW_COPY_AND_ASSIGN(BoundedPageAllocator); }; } // namespace base diff --git a/deps/v8/src/base/build_config.h b/deps/v8/src/base/build_config.h index ad287c92906485..2bfbe1ba3279f5 100644 --- a/deps/v8/src/base/build_config.h +++ b/deps/v8/src/base/build_config.h @@ -207,6 +207,10 @@ constexpr int kReturnAddressStackSlotCount = // PPC has large (64KB) physical pages. const int kPageSizeBits = 19; #else +// Arm64 supports up to 64k OS pages on Linux, however 4k pages are more common +// so we keep the V8 page size at 256k. Nonetheless, we need to make sure we +// don't decrease it further in the future due to reserving 3 OS pages for every +// executable V8 page. const int kPageSizeBits = 18; #endif diff --git a/deps/v8/src/base/debug/stack_trace_posix.cc b/deps/v8/src/base/debug/stack_trace_posix.cc index ed602af547d2f9..270f1ca4e02792 100644 --- a/deps/v8/src/base/debug/stack_trace_posix.cc +++ b/deps/v8/src/base/debug/stack_trace_posix.cc @@ -267,27 +267,28 @@ void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) { class PrintBacktraceOutputHandler : public BacktraceOutputHandler { public: PrintBacktraceOutputHandler() = default; + PrintBacktraceOutputHandler(const PrintBacktraceOutputHandler&) = delete; + PrintBacktraceOutputHandler& operator=(const PrintBacktraceOutputHandler&) = + delete; void HandleOutput(const char* output) override { // NOTE: This code MUST be async-signal safe (it's used by in-process // stack dumping signal handler). NO malloc or stdio is allowed here. PrintToStderr(output); } - - private: - DISALLOW_COPY_AND_ASSIGN(PrintBacktraceOutputHandler); }; class StreamBacktraceOutputHandler : public BacktraceOutputHandler { public: explicit StreamBacktraceOutputHandler(std::ostream* os) : os_(os) {} + StreamBacktraceOutputHandler(const StreamBacktraceOutputHandler&) = delete; + StreamBacktraceOutputHandler& operator=(const StreamBacktraceOutputHandler&) = + delete; void HandleOutput(const char* output) override { (*os_) << output; } private: std::ostream* os_; - - DISALLOW_COPY_AND_ASSIGN(StreamBacktraceOutputHandler); }; void WarmUpBacktrace() { diff --git a/deps/v8/src/base/hashmap-entry.h b/deps/v8/src/base/hashmap-entry.h index 629e734088f745..2f984f3c2ae43b 100644 --- a/deps/v8/src/base/hashmap-entry.h +++ b/deps/v8/src/base/hashmap-entry.h @@ -6,15 +6,25 @@ #define V8_BASE_HASHMAP_ENTRY_H_ #include +#include + +#include "src/base/memory.h" namespace v8 { namespace base { +// Marker type for hashmaps without a value (i.e. hashsets). These won't +// allocate space for the value in the entry. +struct NoHashMapValue {}; + // HashMap entries are (key, value, hash) triplets, with a boolean indicating if // they are an empty entry. Some clients may not need to use the value slot -// (e.g. implementers of sets, where the key is the value). +// (e.g. implementers of sets, where the key is the value), in which case they +// should use NoHashMapValue. template struct TemplateHashMapEntry { + STATIC_ASSERT((!std::is_same::value)); + Key key; Value value; uint32_t hash; // The full hash value for key @@ -33,6 +43,8 @@ struct TemplateHashMapEntry { // Specialization for pointer-valued keys template struct TemplateHashMapEntry { + STATIC_ASSERT((!std::is_same::value)); + Key* key; Value value; uint32_t hash; // The full hash value for key @@ -45,8 +57,42 @@ struct TemplateHashMapEntry { void clear() { key = nullptr; } }; -// TODO(leszeks): There could be a specialisation for void values (e.g. for -// sets), which omits the value field +// Specialization for no value. +template +struct TemplateHashMapEntry { + union { + Key key; + NoHashMapValue value; // Value in union with key to not take up space. + }; + uint32_t hash; // The full hash value for key + + TemplateHashMapEntry(Key key, NoHashMapValue value, uint32_t hash) + : key(key), hash(hash), exists_(true) {} + + bool exists() const { return exists_; } + + void clear() { exists_ = false; } + + private: + bool exists_; +}; + +// Specialization for pointer-valued keys and no value. +template +struct TemplateHashMapEntry { + union { + Key* key; + NoHashMapValue value; // Value in union with key to not take up space. + }; + uint32_t hash; // The full hash value for key + + TemplateHashMapEntry(Key* key, NoHashMapValue value, uint32_t hash) + : key(key), hash(hash) {} + + bool exists() const { return key != nullptr; } + + void clear() { key = nullptr; } +}; } // namespace base } // namespace v8 diff --git a/deps/v8/src/base/hashmap.h b/deps/v8/src/base/hashmap.h index 2b40b329b8e819..c0a7f21bf542c0 100644 --- a/deps/v8/src/base/hashmap.h +++ b/deps/v8/src/base/hashmap.h @@ -46,6 +46,9 @@ class TemplateHashMapImpl { MatchFun match = MatchFun(), AllocationPolicy allocator = AllocationPolicy()); + TemplateHashMapImpl(const TemplateHashMapImpl&) = delete; + TemplateHashMapImpl& operator=(const TemplateHashMapImpl&) = delete; + // Clones the given hashmap and creates a copy with the same entries. explicit TemplateHashMapImpl(const TemplateHashMapImpl* original, AllocationPolicy allocator = AllocationPolicy()); @@ -72,6 +75,20 @@ class TemplateHashMapImpl { template Entry* LookupOrInsert(const Key& key, uint32_t hash, const Func& value_func); + // Heterogeneous version of LookupOrInsert, which allows a + // different lookup key type than the hashmap's key type. + // The requirement is that MatchFun has an overload: + // + // operator()(const LookupKey& lookup_key, const Key& entry_key) + // + // If an entry with matching key is found, returns that entry. + // If no matching entry is found, a new entry is inserted with + // a key created by key_func, key hash, and value created by + // value_func. + template + Entry* LookupOrInsert(const LookupKey& lookup_key, uint32_t hash, + const KeyFunc& key_func, const ValueFunc& value_func); + Entry* InsertNew(const Key& key, uint32_t hash); // Removes the entry with matching key. @@ -115,7 +132,8 @@ class TemplateHashMapImpl { private: Entry* map_end() const { return impl_.map_ + impl_.capacity_; } - Entry* Probe(const Key& key, uint32_t hash) const; + template + Entry* Probe(const LookupKey& key, uint32_t hash) const; Entry* FillEmptyEntry(Entry* entry, const Key& key, const Value& value, uint32_t hash); void Resize(); @@ -160,8 +178,6 @@ class TemplateHashMapImpl { uint32_t capacity_ = 0; uint32_t occupancy_ = 0; } impl_; - - DISALLOW_COPY_AND_ASSIGN(TemplateHashMapImpl); }; template @@ -214,13 +230,24 @@ template typename TemplateHashMapImpl::Entry* TemplateHashMapImpl::LookupOrInsert( const Key& key, uint32_t hash, const Func& value_func) { + return LookupOrInsert( + key, hash, [&key]() { return key; }, value_func); +} + +template +template +typename TemplateHashMapImpl::Entry* +TemplateHashMapImpl::LookupOrInsert( + const LookupKey& lookup_key, uint32_t hash, const KeyFunc& key_func, + const ValueFunc& value_func) { // Find a matching entry. - Entry* entry = Probe(key, hash); + Entry* entry = Probe(lookup_key, hash); if (entry->exists()) { return entry; } - return FillEmptyEntry(entry, key, value_func(), hash); + return FillEmptyEntry(entry, key_func(), value_func(), hash); } template ::Next( template +template typename TemplateHashMapImpl::Entry* TemplateHashMapImpl::Probe( - const Key& key, uint32_t hash) const { + const LookupKey& key, uint32_t hash) const { DCHECK(base::bits::IsPowerOfTwo(capacity())); size_t i = hash & (capacity() - 1); DCHECK(i < capacity()); @@ -442,8 +470,10 @@ class CustomMatcherTemplateHashMapImpl AllocationPolicy allocator = AllocationPolicy()) : Base(original, allocator) {} - private: - DISALLOW_COPY_AND_ASSIGN(CustomMatcherTemplateHashMapImpl); + CustomMatcherTemplateHashMapImpl(const CustomMatcherTemplateHashMapImpl&) = + delete; + CustomMatcherTemplateHashMapImpl& operator=( + const CustomMatcherTemplateHashMapImpl&) = delete; }; using CustomMatcherHashMap = diff --git a/deps/v8/src/base/lazy-instance.h b/deps/v8/src/base/lazy-instance.h index 3ea5fc95759dd6..75e5b060062f5c 100644 --- a/deps/v8/src/base/lazy-instance.h +++ b/deps/v8/src/base/lazy-instance.h @@ -235,12 +235,13 @@ class LeakyObject { new (&storage_) T(std::forward(args)...); } + LeakyObject(const LeakyObject&) = delete; + LeakyObject& operator=(const LeakyObject&) = delete; + T* get() { return reinterpret_cast(&storage_); } private: typename std::aligned_storage::type storage_; - - DISALLOW_COPY_AND_ASSIGN(LeakyObject); }; // Define a function which returns a pointer to a lazily initialized and never diff --git a/deps/v8/src/base/macros.h b/deps/v8/src/base/macros.h index 37cab78f08fcbc..8b39da2451f702 100644 --- a/deps/v8/src/base/macros.h +++ b/deps/v8/src/base/macros.h @@ -109,11 +109,15 @@ V8_INLINE Dest bit_cast(Source const& source) { } // Explicitly declare the assignment operator as deleted. +// Note: This macro is deprecated and will be removed soon. Please explicitly +// delete the assignment operator instead. #define DISALLOW_ASSIGN(TypeName) TypeName& operator=(const TypeName&) = delete // Explicitly declare the copy constructor and assignment operator as deleted. // This also deletes the implicit move constructor and implicit move assignment // operator, but still allows to manually define them. +// Note: This macro is deprecated and will be removed soon. Please explicitly +// delete the copy constructor and assignment operator instead. #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&) = delete; \ DISALLOW_ASSIGN(TypeName) diff --git a/deps/v8/src/base/platform/DIR_METADATA b/deps/v8/src/base/platform/DIR_METADATA new file mode 100644 index 00000000000000..2f8dbbcf45cdda --- /dev/null +++ b/deps/v8/src/base/platform/DIR_METADATA @@ -0,0 +1,11 @@ +# Metadata information for this directory. +# +# For more information on DIR_METADATA files, see: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md +# +# For the schema of this file, see Metadata message: +# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto + +monorail { + component: "Blink>JavaScript" +} \ No newline at end of file diff --git a/deps/v8/src/base/platform/OWNERS b/deps/v8/src/base/platform/OWNERS index bf5455c9afaa8a..782eb7c68449ba 100644 --- a/deps/v8/src/base/platform/OWNERS +++ b/deps/v8/src/base/platform/OWNERS @@ -3,5 +3,3 @@ mlippautz@chromium.org ulan@chromium.org per-file platform-fuchsia.cc=wez@chromium.org - -# COMPONENT: Blink>JavaScript diff --git a/deps/v8/src/base/platform/condition-variable.h b/deps/v8/src/base/platform/condition-variable.h index 8b5c7cf56922a4..79e653a32aa1d3 100644 --- a/deps/v8/src/base/platform/condition-variable.h +++ b/deps/v8/src/base/platform/condition-variable.h @@ -36,6 +36,8 @@ class TimeDelta; class V8_BASE_EXPORT ConditionVariable final { public: ConditionVariable(); + ConditionVariable(const ConditionVariable&) = delete; + ConditionVariable& operator=(const ConditionVariable&) = delete; ~ConditionVariable(); // If any threads are waiting on this condition variable, calling @@ -81,8 +83,6 @@ class V8_BASE_EXPORT ConditionVariable final { private: NativeHandle native_handle_; - - DISALLOW_COPY_AND_ASSIGN(ConditionVariable); }; // POD ConditionVariable initialized lazily (i.e. the first time Pointer() is diff --git a/deps/v8/src/base/platform/mutex.h b/deps/v8/src/base/platform/mutex.h index 7a19b2f4aa7225..1b950c61ad7c03 100644 --- a/deps/v8/src/base/platform/mutex.h +++ b/deps/v8/src/base/platform/mutex.h @@ -43,6 +43,8 @@ namespace base { class V8_BASE_EXPORT Mutex final { public: Mutex(); + Mutex(const Mutex&) = delete; + Mutex& operator=(const Mutex&) = delete; ~Mutex(); // Locks the given mutex. If the mutex is currently unlocked, it becomes @@ -99,8 +101,6 @@ class V8_BASE_EXPORT Mutex final { } friend class ConditionVariable; - - DISALLOW_COPY_AND_ASSIGN(Mutex); }; // POD Mutex initialized lazily (i.e. the first time Pointer() is called). @@ -140,6 +140,8 @@ using LazyMutex = LazyStaticInstance, class V8_BASE_EXPORT RecursiveMutex final { public: RecursiveMutex(); + RecursiveMutex(const RecursiveMutex&) = delete; + RecursiveMutex& operator=(const RecursiveMutex&) = delete; ~RecursiveMutex(); // Locks the mutex. If another thread has already locked the mutex, a call to @@ -175,8 +177,6 @@ class V8_BASE_EXPORT RecursiveMutex final { #ifdef DEBUG int level_; #endif - - DISALLOW_COPY_AND_ASSIGN(RecursiveMutex); }; @@ -213,6 +213,8 @@ using LazyRecursiveMutex = class V8_BASE_EXPORT SharedMutex final { public: SharedMutex(); + SharedMutex(const SharedMutex&) = delete; + SharedMutex& operator=(const SharedMutex&) = delete; ~SharedMutex(); // Acquires shared ownership of the {SharedMutex}. If another thread is @@ -262,8 +264,6 @@ class V8_BASE_EXPORT SharedMutex final { #endif NativeHandle native_handle_; - - DISALLOW_COPY_AND_ASSIGN(SharedMutex); }; // ----------------------------------------------------------------------------- @@ -286,6 +286,8 @@ class LockGuard final { explicit LockGuard(Mutex* mutex) : mutex_(mutex) { if (has_mutex()) mutex_->Lock(); } + LockGuard(const LockGuard&) = delete; + LockGuard& operator=(const LockGuard&) = delete; ~LockGuard() { if (has_mutex()) mutex_->Unlock(); } @@ -298,8 +300,6 @@ class LockGuard final { mutex_ != nullptr); return Behavior == NullBehavior::kRequireNotNull || mutex_ != nullptr; } - - DISALLOW_COPY_AND_ASSIGN(LockGuard); }; using MutexGuard = LockGuard; @@ -319,6 +319,8 @@ class SharedMutexGuard final { mutex_->LockExclusive(); } } + SharedMutexGuard(const SharedMutexGuard&) = delete; + SharedMutexGuard& operator=(const SharedMutexGuard&) = delete; ~SharedMutexGuard() { if (!has_mutex()) return; if (kIsShared) { @@ -336,8 +338,6 @@ class SharedMutexGuard final { mutex_ != nullptr); return Behavior == NullBehavior::kRequireNotNull || mutex_ != nullptr; } - - DISALLOW_COPY_AND_ASSIGN(SharedMutexGuard); }; } // namespace base diff --git a/deps/v8/src/base/platform/platform-aix.cc b/deps/v8/src/base/platform/platform-aix.cc index e1ccda2ab05601..6b6a870370b3b6 100644 --- a/deps/v8/src/base/platform/platform-aix.cc +++ b/deps/v8/src/base/platform/platform-aix.cc @@ -130,7 +130,7 @@ void OS::SignalCodeMovingGC() {} void OS::AdjustSchedulingParams() {} // static -void* Stack::GetStackStart() { +Stack::StackSlot Stack::GetStackStart() { // pthread_getthrds_np creates 3 values: // __pi_stackaddr, __pi_stacksize, __pi_stackend diff --git a/deps/v8/src/base/platform/platform-freebsd.cc b/deps/v8/src/base/platform/platform-freebsd.cc index ed16ad096d0e50..edc793c662efc7 100644 --- a/deps/v8/src/base/platform/platform-freebsd.cc +++ b/deps/v8/src/base/platform/platform-freebsd.cc @@ -98,7 +98,7 @@ void OS::SignalCodeMovingGC() {} void OS::AdjustSchedulingParams() {} // static -void* Stack::GetStackStart() { +Stack::StackSlot Stack::GetStackStart() { pthread_attr_t attr; int error; pthread_attr_init(&attr); diff --git a/deps/v8/src/base/platform/platform-fuchsia.cc b/deps/v8/src/base/platform/platform-fuchsia.cc index 35a508a140ebd7..381b59a904b588 100644 --- a/deps/v8/src/base/platform/platform-fuchsia.cc +++ b/deps/v8/src/base/platform/platform-fuchsia.cc @@ -4,6 +4,7 @@ #include #include +#include #include "src/base/macros.h" #include "src/base/platform/platform-posix-time.h" @@ -151,17 +152,18 @@ void OS::SignalCodeMovingGC() { int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { const auto kNanosPerMicrosecond = 1000ULL; const auto kMicrosPerSecond = 1000000ULL; - zx_time_t nanos_since_thread_started; - zx_status_t status = - zx_clock_get(ZX_CLOCK_THREAD, &nanos_since_thread_started); + + zx_info_thread_stats_t info = {}; + zx_status_t status = zx_object_get_info(thrd_get_zx_handle(thrd_current()), + ZX_INFO_THREAD_STATS, &info, + sizeof(info), nullptr, nullptr); if (status != ZX_OK) { return -1; } // First convert to microseconds, rounding up. const uint64_t micros_since_thread_started = - (nanos_since_thread_started + kNanosPerMicrosecond - 1ULL) / - kNanosPerMicrosecond; + (info.total_runtime + kNanosPerMicrosecond - 1ULL) / kNanosPerMicrosecond; *secs = static_cast(micros_since_thread_started / kMicrosPerSecond); *usecs = diff --git a/deps/v8/src/base/platform/platform-macos.cc b/deps/v8/src/base/platform/platform-macos.cc index bee6b30f7cc71c..3f1638ec0d50d6 100644 --- a/deps/v8/src/base/platform/platform-macos.cc +++ b/deps/v8/src/base/platform/platform-macos.cc @@ -94,7 +94,7 @@ void OS::AdjustSchedulingParams() { } // static -void* Stack::GetStackStart() { +Stack::StackSlot Stack::GetStackStart() { return pthread_get_stackaddr_np(pthread_self()); } diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc index d5624cb8ace431..ab0d7839a453d8 100644 --- a/deps/v8/src/base/platform/platform-posix.cc +++ b/deps/v8/src/base/platform/platform-posix.cc @@ -415,16 +415,6 @@ bool OS::SetPermissions(void* address, size_t size, MemoryPermission access) { int prot = GetProtectionFromMemoryPermission(access); int ret = mprotect(address, size, prot); - - // MacOS 11.2 on Apple Silicon refuses to switch permissions from - // rwx to none. Just use madvise instead. -#if defined(V8_OS_MACOSX) - if (ret != 0 && access == OS::MemoryPermission::kNoAccess) { - ret = madvise(address, size, MADV_FREE_REUSABLE); - return ret == 0; - } -#endif - if (ret == 0 && access == OS::MemoryPermission::kNoAccess) { // This is advisory; ignore errors and continue execution. USE(DiscardSystemPages(address, size)); @@ -1013,7 +1003,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* value) { !defined(V8_OS_SOLARIS) // static -void* Stack::GetStackStart() { +Stack::StackSlot Stack::GetStackStart() { pthread_attr_t attr; int error = pthread_getattr_np(pthread_self(), &attr); if (!error) { @@ -1039,7 +1029,9 @@ void* Stack::GetStackStart() { // !defined(_AIX) && !defined(V8_OS_SOLARIS) // static -void* Stack::GetCurrentStackPosition() { return __builtin_frame_address(0); } +Stack::StackSlot Stack::GetCurrentStackPosition() { + return __builtin_frame_address(0); +} #undef LOG_TAG #undef MAP_ANONYMOUS diff --git a/deps/v8/src/base/platform/platform-win32.cc b/deps/v8/src/base/platform/platform-win32.cc index e7b1e519362350..cee24e987674cc 100644 --- a/deps/v8/src/base/platform/platform-win32.cc +++ b/deps/v8/src/base/platform/platform-win32.cc @@ -1395,7 +1395,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* value) { void OS::AdjustSchedulingParams() {} // static -void* Stack::GetStackStart() { +Stack::StackSlot Stack::GetStackStart() { #if defined(V8_TARGET_ARCH_X64) return reinterpret_cast( reinterpret_cast(NtCurrentTeb())->StackBase); @@ -1414,7 +1414,7 @@ void* Stack::GetStackStart() { } // static -void* Stack::GetCurrentStackPosition() { +Stack::StackSlot Stack::GetCurrentStackPosition() { #if V8_CC_MSVC return _AddressOfReturnAddress(); #else diff --git a/deps/v8/src/base/platform/platform.h b/deps/v8/src/base/platform/platform.h index 9c52f218042b74..042e4428cd31cc 100644 --- a/deps/v8/src/base/platform/platform.h +++ b/deps/v8/src/base/platform/platform.h @@ -22,6 +22,7 @@ #define V8_BASE_PLATFORM_PLATFORM_H_ #include +#include #include #include @@ -353,6 +354,8 @@ class V8_BASE_EXPORT Thread { // Create new thread. explicit Thread(const Options& options); + Thread(const Thread&) = delete; + Thread& operator=(const Thread&) = delete; virtual ~Thread(); // Start new thread by calling the Run() method on the new thread. @@ -426,37 +429,48 @@ class V8_BASE_EXPORT Thread { char name_[kMaxThreadNameLength]; int stack_size_; Semaphore* start_semaphore_; - - DISALLOW_COPY_AND_ASSIGN(Thread); }; // TODO(v8:10354): Make use of the stack utilities here in V8. class V8_BASE_EXPORT Stack { public: + // Convenience wrapper to use stack slots as unsigned values or void* + // pointers. + struct StackSlot { + // NOLINTNEXTLINE + StackSlot(void* value) : value(reinterpret_cast(value)) {} + StackSlot(uintptr_t value) : value(value) {} // NOLINT + + // NOLINTNEXTLINE + operator void*() const { return reinterpret_cast(value); } + operator uintptr_t() const { return value; } // NOLINT + + uintptr_t value; + }; + // Gets the start of the stack of the current thread. - static void* GetStackStart(); + static StackSlot GetStackStart(); // Returns the current stack top. Works correctly with ASAN and SafeStack. // GetCurrentStackPosition() should not be inlined, because it works on stack // frames if it were inlined into a function with a huge stack frame it would // return an address significantly above the actual current stack position. - static V8_NOINLINE void* GetCurrentStackPosition(); + static V8_NOINLINE StackSlot GetCurrentStackPosition(); - // Translates an ASAN-based slot to a real stack slot if necessary. - static void* GetStackSlot(void* slot) { + // Returns the real stack frame if slot is part of a fake frame, and slot + // otherwise. + static StackSlot GetRealStackAddressForSlot(StackSlot slot) { #ifdef V8_USE_ADDRESS_SANITIZER - void* fake_stack = __asan_get_current_fake_stack(); - if (fake_stack) { - void* fake_frame_start; - void* real_frame = __asan_addr_is_in_fake_stack( - fake_stack, slot, &fake_frame_start, nullptr); - if (real_frame) { - return reinterpret_cast( - reinterpret_cast(real_frame) + - (reinterpret_cast(slot) - - reinterpret_cast(fake_frame_start))); - } - } + // ASAN fetches the real stack deeper in the __asan_addr_is_in_fake_stack() + // call (precisely, deeper in __asan_stack_malloc_()), which results in a + // real frame that could be outside of stack bounds. Adjust for this + // impreciseness here. + constexpr size_t kAsanRealFrameOffsetBytes = 32; + void* real_frame = __asan_addr_is_in_fake_stack( + __asan_get_current_fake_stack(), slot, nullptr, nullptr); + return real_frame + ? (static_cast(real_frame) + kAsanRealFrameOffsetBytes) + : slot; #endif // V8_USE_ADDRESS_SANITIZER return slot; } diff --git a/deps/v8/src/base/platform/semaphore.h b/deps/v8/src/base/platform/semaphore.h index 0c0b877da29750..83a7a3392f7098 100644 --- a/deps/v8/src/base/platform/semaphore.h +++ b/deps/v8/src/base/platform/semaphore.h @@ -39,6 +39,8 @@ class TimeDelta; class V8_BASE_EXPORT Semaphore final { public: explicit Semaphore(int count); + Semaphore(const Semaphore&) = delete; + Semaphore& operator=(const Semaphore&) = delete; ~Semaphore(); // Increments the semaphore counter. @@ -72,8 +74,6 @@ class V8_BASE_EXPORT Semaphore final { private: NativeHandle native_handle_; - - DISALLOW_COPY_AND_ASSIGN(Semaphore); }; diff --git a/deps/v8/src/base/platform/wrappers.h b/deps/v8/src/base/platform/wrappers.h new file mode 100644 index 00000000000000..521b06ebe12a99 --- /dev/null +++ b/deps/v8/src/base/platform/wrappers.h @@ -0,0 +1,31 @@ +// 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 V8_BASE_PLATFORM_WRAPPERS_H_ +#define V8_BASE_PLATFORM_WRAPPERS_H_ + +#include +#include + +namespace v8 { +namespace base { + +void* Malloc(size_t size); + +void* Realloc(void* memory, size_t size); + +void Free(void* memory); + +void* Calloc(size_t count, size_t size); + +void* Memcpy(void* dest, const void* source, size_t count); + +FILE* Fopen(const char* filename, const char* mode); + +int Fclose(FILE* stream); + +} // namespace base +} // namespace v8 + +#endif // V8_BASE_PLATFORM_WRAPPERS_H_ diff --git a/deps/v8/src/base/platform/wrappers_starboard.cc b/deps/v8/src/base/platform/wrappers_starboard.cc new file mode 100644 index 00000000000000..199e75340909bb --- /dev/null +++ b/deps/v8/src/base/platform/wrappers_starboard.cc @@ -0,0 +1,31 @@ +// 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. + +#include "starboard/memory.h" + +#include "src/base/platform/wrappers.h" + +namespace v8 { +namespace base { + +void* Malloc(size_t size) { return SbMemoryAlloc(size); } + +void* Realloc(void* memory, size_t size) { + return SbMemoryReallocate(memory, size); +} + +void Free(void* memory) { return SbMemoryDeallocate(memory); } + +void* Calloc(size_t count, size_t size) { return SbMemoryCalloc(count, size); } + +void* Memcpy(void* dest, const void* source, size_t count) { + return SbMemoryCopy(dest, source, count); +} + +FILE* Fopen(const char* filename, const char* mode) { return NULL; } + +int Fclose(FILE* stream) { return -1; } + +} // namespace base +} // namespace v8 diff --git a/deps/v8/src/base/platform/wrappers_std.cc b/deps/v8/src/base/platform/wrappers_std.cc new file mode 100644 index 00000000000000..6b38b18e37a85f --- /dev/null +++ b/deps/v8/src/base/platform/wrappers_std.cc @@ -0,0 +1,34 @@ +// 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. + +#include +#include +#include +#include + +#include "src/base/platform/wrappers.h" + +namespace v8 { +namespace base { + +void* Malloc(size_t size) { return malloc(size); } + +void* Realloc(void* memory, size_t size) { return realloc(memory, size); } + +void Free(void* memory) { return free(memory); } + +void* Calloc(size_t count, size_t size) { return calloc(count, size); } + +void* Memcpy(void* dest, const void* source, size_t count) { + return memcpy(dest, source, count); +} + +FILE* Fopen(const char* filename, const char* mode) { + return fopen(filename, mode); +} + +int Fclose(FILE* stream) { return fclose(stream); } + +} // namespace base +} // namespace v8 diff --git a/deps/v8/src/base/region-allocator.h b/deps/v8/src/base/region-allocator.h index 887f123b10c90d..adc4bd10b67ecf 100644 --- a/deps/v8/src/base/region-allocator.h +++ b/deps/v8/src/base/region-allocator.h @@ -39,6 +39,8 @@ class V8_BASE_EXPORT RegionAllocator final { }; RegionAllocator(Address address, size_t size, size_t page_size); + RegionAllocator(const RegionAllocator&) = delete; + RegionAllocator& operator=(const RegionAllocator&) = delete; ~RegionAllocator(); // Allocates region of |size| (must be |page_size|-aligned). Returns @@ -176,8 +178,6 @@ class V8_BASE_EXPORT RegionAllocator final { FRIEND_TEST(RegionAllocatorTest, Contains); FRIEND_TEST(RegionAllocatorTest, FindRegion); FRIEND_TEST(RegionAllocatorTest, Fragmentation); - - DISALLOW_COPY_AND_ASSIGN(RegionAllocator); }; } // namespace base diff --git a/deps/v8/src/base/ring-buffer.h b/deps/v8/src/base/ring-buffer.h index b347977640587e..8357987083d805 100644 --- a/deps/v8/src/base/ring-buffer.h +++ b/deps/v8/src/base/ring-buffer.h @@ -14,7 +14,11 @@ template class RingBuffer { public: RingBuffer() { Reset(); } + RingBuffer(const RingBuffer&) = delete; + RingBuffer& operator=(const RingBuffer&) = delete; + static const int kSize = 10; + void Push(const T& value) { if (count_ == kSize) { elements_[start_++] = value; @@ -45,7 +49,6 @@ class RingBuffer { T elements_[kSize]; int start_; int count_; - DISALLOW_COPY_AND_ASSIGN(RingBuffer); }; } // namespace base diff --git a/deps/v8/src/base/safe_conversions.h b/deps/v8/src/base/safe_conversions.h index f63f1ad99e6c28..38aa7b9aaa7562 100644 --- a/deps/v8/src/base/safe_conversions.h +++ b/deps/v8/src/base/safe_conversions.h @@ -4,59 +4,383 @@ // Slightly adapted for inclusion in V8. // Copyright 2014 the V8 project authors. All rights reserved. +// List of adaptations: +// - include guard names +// - wrap in v8 namespace +// - formatting (git cl format) +// - include paths #ifndef V8_BASE_SAFE_CONVERSIONS_H_ #define V8_BASE_SAFE_CONVERSIONS_H_ +#include + +#include #include +#include #include "src/base/safe_conversions_impl.h" +#if defined(__ARMEL__) && !defined(__native_client__) +#include "src/base/safe_conversions_arm_impl.h" +#define BASE_HAS_OPTIMIZED_SAFE_CONVERSIONS (1) +#else +#define BASE_HAS_OPTIMIZED_SAFE_CONVERSIONS (0) +#endif + +#if !BASE_NUMERICS_DISABLE_OSTREAM_OPERATORS +#include +#endif + namespace v8 { namespace base { +namespace internal { + +#if !BASE_HAS_OPTIMIZED_SAFE_CONVERSIONS +template +struct SaturateFastAsmOp { + static constexpr bool is_supported = false; + static constexpr Dst Do(Src) { + // Force a compile failure if instantiated. + return CheckOnFailure::template HandleFailure(); + } +}; +#endif // BASE_HAS_OPTIMIZED_SAFE_CONVERSIONS +#undef BASE_HAS_OPTIMIZED_SAFE_CONVERSIONS + +// The following special case a few specific integer conversions where we can +// eke out better performance than range checking. +template +struct IsValueInRangeFastOp { + static constexpr bool is_supported = false; + static constexpr bool Do(Src value) { + // Force a compile failure if instantiated. + return CheckOnFailure::template HandleFailure(); + } +}; + +// Signed to signed range comparison. +template +struct IsValueInRangeFastOp< + Dst, Src, + typename std::enable_if< + std::is_integral::value && std::is_integral::value && + std::is_signed::value && std::is_signed::value && + !IsTypeInRangeForNumericType::value>::type> { + static constexpr bool is_supported = true; + + static constexpr bool Do(Src value) { + // Just downcast to the smaller type, sign extend it back to the original + // type, and then see if it matches the original value. + return value == static_cast(value); + } +}; + +// Signed to unsigned range comparison. +template +struct IsValueInRangeFastOp< + Dst, Src, + typename std::enable_if< + std::is_integral::value && std::is_integral::value && + !std::is_signed::value && std::is_signed::value && + !IsTypeInRangeForNumericType::value>::type> { + static constexpr bool is_supported = true; + + static constexpr bool Do(Src value) { + // We cast a signed as unsigned to overflow negative values to the top, + // then compare against whichever maximum is smaller, as our upper bound. + return as_unsigned(value) <= as_unsigned(CommonMax()); + } +}; // Convenience function that returns true if the supplied value is in range // for the destination type. template -inline bool IsValueInRangeForNumericType(Src value) { - return internal::DstRangeRelationToSrcRange(value) == - internal::RANGE_VALID; +constexpr bool IsValueInRangeForNumericType(Src value) { + using SrcType = typename internal::UnderlyingType::type; + return internal::IsValueInRangeFastOp::is_supported + ? internal::IsValueInRangeFastOp::Do( + static_cast(value)) + : internal::DstRangeRelationToSrcRange( + static_cast(value)) + .IsValid(); } // checked_cast<> is analogous to static_cast<> for numeric types, // except that it CHECKs that the specified numeric conversion will not // overflow or underflow. NaN source will always trigger a CHECK. -template -inline Dst checked_cast(Src value) { - CHECK(IsValueInRangeForNumericType(value)); - return static_cast(value); +template +constexpr Dst checked_cast(Src value) { + // This throws a compile-time error on evaluating the constexpr if it can be + // determined at compile-time as failing, otherwise it will CHECK at runtime. + using SrcType = typename internal::UnderlyingType::type; + return BASE_NUMERICS_LIKELY((IsValueInRangeForNumericType(value))) + ? static_cast(static_cast(value)) + : CheckHandler::template HandleFailure(); } +// Default boundaries for integral/float: max/infinity, lowest/-infinity, 0/NaN. +// You may provide your own limits (e.g. to saturated_cast) so long as you +// implement all of the static constexpr member functions in the class below. +template +struct SaturationDefaultLimits : public std::numeric_limits { + static constexpr T NaN() { + return std::numeric_limits::has_quiet_NaN + ? std::numeric_limits::quiet_NaN() + : T(); + } + using std::numeric_limits::max; + static constexpr T Overflow() { + return std::numeric_limits::has_infinity + ? std::numeric_limits::infinity() + : std::numeric_limits::max(); + } + using std::numeric_limits::lowest; + static constexpr T Underflow() { + return std::numeric_limits::has_infinity + ? std::numeric_limits::infinity() * -1 + : std::numeric_limits::lowest(); + } +}; + +template class S, typename Src> +constexpr Dst saturated_cast_impl(Src value, RangeCheck constraint) { + // For some reason clang generates much better code when the branch is + // structured exactly this way, rather than a sequence of checks. + return !constraint.IsOverflowFlagSet() + ? (!constraint.IsUnderflowFlagSet() ? static_cast(value) + : S::Underflow()) + // Skip this check for integral Src, which cannot be NaN. + : (std::is_integral::value || !constraint.IsUnderflowFlagSet() + ? S::Overflow() + : S::NaN()); +} + +// We can reduce the number of conditions and get slightly better performance +// for normal signed and unsigned integer ranges. And in the specific case of +// Arm, we can use the optimized saturation instructions. +template +struct SaturateFastOp { + static constexpr bool is_supported = false; + static constexpr Dst Do(Src value) { + // Force a compile failure if instantiated. + return CheckOnFailure::template HandleFailure(); + } +}; + +template +struct SaturateFastOp< + Dst, Src, + typename std::enable_if::value && + std::is_integral::value && + SaturateFastAsmOp::is_supported>::type> { + static constexpr bool is_supported = true; + static constexpr Dst Do(Src value) { + return SaturateFastAsmOp::Do(value); + } +}; + +template +struct SaturateFastOp< + Dst, Src, + typename std::enable_if::value && + std::is_integral::value && + !SaturateFastAsmOp::is_supported>::type> { + static constexpr bool is_supported = true; + static constexpr Dst Do(Src value) { + // The exact order of the following is structured to hit the correct + // optimization heuristics across compilers. Do not change without + // checking the emitted code. + const Dst saturated = CommonMaxOrMin( + IsMaxInRangeForNumericType() || + (!IsMinInRangeForNumericType() && IsValueNegative(value))); + return BASE_NUMERICS_LIKELY(IsValueInRangeForNumericType(value)) + ? static_cast(value) + : saturated; + } +}; + // saturated_cast<> is analogous to static_cast<> for numeric types, except -// that the specified numeric conversion will saturate rather than overflow or -// underflow. NaN assignment to an integral will trigger a CHECK condition. +// that the specified numeric conversion will saturate by default rather than +// overflow or underflow, and NaN assignment to an integral will return 0. +// All boundary condition behaviors can be overriden with a custom handler. +template class SaturationHandler = SaturationDefaultLimits, + typename Src> +constexpr Dst saturated_cast(Src value) { + using SrcType = typename UnderlyingType::type; + return !IsCompileTimeConstant(value) && + SaturateFastOp::is_supported && + std::is_same, + SaturationDefaultLimits>::value + ? SaturateFastOp::Do(static_cast(value)) + : saturated_cast_impl( + static_cast(value), + DstRangeRelationToSrcRange( + static_cast(value))); +} + +// strict_cast<> is analogous to static_cast<> for numeric types, except that +// it will cause a compile failure if the destination type is not large enough +// to contain any value in the source type. It performs no runtime checking. template -inline Dst saturated_cast(Src value) { - // Optimization for floating point values, which already saturate. - if (std::numeric_limits::is_iec559) - return static_cast(value); +constexpr Dst strict_cast(Src value) { + using SrcType = typename UnderlyingType::type; + static_assert(UnderlyingType::is_numeric, "Argument must be numeric."); + static_assert(std::is_arithmetic::value, "Result must be numeric."); + + // If you got here from a compiler error, it's because you tried to assign + // from a source type to a destination type that has insufficient range. + // The solution may be to change the destination type you're assigning to, + // and use one large enough to represent the source. + // Alternatively, you may be better served with the checked_cast<> or + // saturated_cast<> template functions for your particular use case. + static_assert(StaticDstRangeRelationToSrcRange::value == + NUMERIC_RANGE_CONTAINED, + "The source type is out of range for the destination type. " + "Please see strict_cast<> comments for more information."); + + return static_cast(static_cast(value)); +} + +// Some wrappers to statically check that a type is in range. +template +struct IsNumericRangeContained { + static constexpr bool value = false; +}; + +template +struct IsNumericRangeContained< + Dst, Src, + typename std::enable_if::value && + ArithmeticOrUnderlyingEnum::value>::type> { + static constexpr bool value = + StaticDstRangeRelationToSrcRange::value == + NUMERIC_RANGE_CONTAINED; +}; + +// StrictNumeric implements compile time range checking between numeric types by +// wrapping assignment operations in a strict_cast. This class is intended to be +// used for function arguments and return types, to ensure the destination type +// can always contain the source type. This is essentially the same as enforcing +// -Wconversion in gcc and C4302 warnings on MSVC, but it can be applied +// incrementally at API boundaries, making it easier to convert code so that it +// compiles cleanly with truncation warnings enabled. +// This template should introduce no runtime overhead, but it also provides no +// runtime checking of any of the associated mathematical operations. Use +// CheckedNumeric for runtime range checks of the actual value being assigned. +template +class StrictNumeric { + public: + using type = T; - switch (internal::DstRangeRelationToSrcRange(value)) { - case internal::RANGE_VALID: - return static_cast(value); + constexpr StrictNumeric() : value_(0) {} - case internal::RANGE_UNDERFLOW: - return std::numeric_limits::min(); + // Copy constructor. + template + constexpr StrictNumeric(const StrictNumeric& rhs) + : value_(strict_cast(rhs.value_)) {} - case internal::RANGE_OVERFLOW: - return std::numeric_limits::max(); + // This is not an explicit constructor because we implicitly upgrade regular + // numerics to StrictNumerics to make them easier to use. + template + constexpr StrictNumeric(Src value) // NOLINT(runtime/explicit) + : value_(strict_cast(value)) {} - // Should fail only on attempting to assign NaN to a saturated integer. - case internal::RANGE_INVALID: - UNREACHABLE(); + // If you got here from a compiler error, it's because you tried to assign + // from a source type to a destination type that has insufficient range. + // The solution may be to change the destination type you're assigning to, + // and use one large enough to represent the source. + // If you're assigning from a CheckedNumeric<> class, you may be able to use + // the AssignIfValid() member function, specify a narrower destination type to + // the member value functions (e.g. val.template ValueOrDie()), use one + // of the value helper functions (e.g. ValueOrDieForType(val)). + // If you've encountered an _ambiguous overload_ you can use a static_cast<> + // to explicitly cast the result to the destination type. + // If none of that works, you may be better served with the checked_cast<> or + // saturated_cast<> template functions for your particular use case. + template ::value>::type* = nullptr> + constexpr operator Dst() const { + return static_cast::type>(value_); } - UNREACHABLE(); + private: + const T value_; +}; + +// Convience wrapper returns a StrictNumeric from the provided arithmetic type. +template +constexpr StrictNumeric::type> MakeStrictNum( + const T value) { + return value; +} + +#if !BASE_NUMERICS_DISABLE_OSTREAM_OPERATORS +// Overload the ostream output operator to make logging work nicely. +template +std::ostream& operator<<(std::ostream& os, const StrictNumeric& value) { + os << static_cast(value); + return os; +} +#endif + +#define BASE_NUMERIC_COMPARISON_OPERATORS(CLASS, NAME, OP) \ + template ::value>::type* = nullptr> \ + constexpr bool operator OP(const L lhs, const R rhs) { \ + return SafeCompare::type, \ + typename UnderlyingType::type>(lhs, rhs); \ + } + +BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsLess, <) +BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsLessOrEqual, <=) +BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsGreater, >) +BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsGreaterOrEqual, >=) +BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsEqual, ==) +BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsNotEqual, !=) + +} // namespace internal + +using internal::as_signed; +using internal::as_unsigned; +using internal::checked_cast; +using internal::IsTypeInRangeForNumericType; +using internal::IsValueInRangeForNumericType; +using internal::IsValueNegative; +using internal::MakeStrictNum; +using internal::SafeUnsignedAbs; +using internal::saturated_cast; +using internal::strict_cast; +using internal::StrictNumeric; + +// Explicitly make a shorter size_t alias for convenience. +using SizeT = StrictNumeric; + +// floating -> integral conversions that saturate and thus can actually return +// an integral type. In most cases, these should be preferred over the std:: +// versions. +template ::value && + std::is_floating_point::value>> +Dst ClampFloor(Src value) { + return saturated_cast(std::floor(value)); +} +template ::value && + std::is_floating_point::value>> +Dst ClampCeil(Src value) { + return saturated_cast(std::ceil(value)); +} +template ::value && + std::is_floating_point::value>> +Dst ClampRound(Src value) { + const Src rounded = + (value >= 0.0f) ? std::floor(value + 0.5f) : std::ceil(value - 0.5f); + return saturated_cast(rounded); } } // namespace base diff --git a/deps/v8/src/base/safe_conversions_arm_impl.h b/deps/v8/src/base/safe_conversions_arm_impl.h new file mode 100644 index 00000000000000..0e08a14405a47e --- /dev/null +++ b/deps/v8/src/base/safe_conversions_arm_impl.h @@ -0,0 +1,60 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Slightly adapted for inclusion in V8. +// Copyright 2014 the V8 project authors. All rights reserved. +// List of adaptations: +// - include guard names +// - wrap in v8 namespace +// - include paths + +#ifndef V8_BASE_SAFE_CONVERSIONS_ARM_IMPL_H_ +#define V8_BASE_SAFE_CONVERSIONS_ARM_IMPL_H_ + +#include +#include +#include + +#include "src/base/safe_conversions_impl.h" + +namespace v8 { +namespace base { +namespace internal { + +// Fast saturation to a destination type. +template +struct SaturateFastAsmOp { + static constexpr bool is_supported = + std::is_signed::value && std::is_integral::value && + std::is_integral::value && + IntegerBitsPlusSign::value <= IntegerBitsPlusSign::value && + IntegerBitsPlusSign::value <= IntegerBitsPlusSign::value && + !IsTypeInRangeForNumericType::value; + + __attribute__((always_inline)) static Dst Do(Src value) { + int32_t src = value; + typename std::conditional::value, int32_t, + uint32_t>::type result; + if (std::is_signed::value) { + asm("ssat %[dst], %[shift], %[src]" + : [dst] "=r"(result) + : [src] "r"(src), [shift] "n"(IntegerBitsPlusSign::value <= 32 + ? IntegerBitsPlusSign::value + : 32)); + } else { + asm("usat %[dst], %[shift], %[src]" + : [dst] "=r"(result) + : [src] "r"(src), [shift] "n"(IntegerBitsPlusSign::value < 32 + ? IntegerBitsPlusSign::value + : 31)); + } + return static_cast(result); + } +}; + +} // namespace internal +} // namespace base +} // namespace v8 + +#endif // V8_BASE_SAFE_CONVERSIONS_ARM_IMPL_H_ diff --git a/deps/v8/src/base/safe_conversions_impl.h b/deps/v8/src/base/safe_conversions_impl.h index 90c8e19353d711..5d9277df24972c 100644 --- a/deps/v8/src/base/safe_conversions_impl.h +++ b/deps/v8/src/base/safe_conversions_impl.h @@ -4,28 +4,130 @@ // Slightly adapted for inclusion in V8. // Copyright 2014 the V8 project authors. All rights reserved. +// List of adaptations: +// - include guard names +// - wrap in v8 namespace +// - formatting (git cl format) #ifndef V8_BASE_SAFE_CONVERSIONS_IMPL_H_ #define V8_BASE_SAFE_CONVERSIONS_IMPL_H_ +#include + #include +#include -#include "src/base/logging.h" -#include "src/base/macros.h" +#if defined(__GNUC__) || defined(__clang__) +#define BASE_NUMERICS_LIKELY(x) __builtin_expect(!!(x), 1) +#define BASE_NUMERICS_UNLIKELY(x) __builtin_expect(!!(x), 0) +#else +#define BASE_NUMERICS_LIKELY(x) (x) +#define BASE_NUMERICS_UNLIKELY(x) (x) +#endif namespace v8 { namespace base { namespace internal { // The std library doesn't provide a binary max_exponent for integers, however -// we can compute one by adding one to the number of non-sign bits. This allows -// for accurate range comparisons between floating point and integer types. +// we can compute an analog using std::numeric_limits<>::digits. template struct MaxExponent { - static const int value = std::numeric_limits::is_iec559 + static const int value = std::is_floating_point::value ? std::numeric_limits::max_exponent - : (sizeof(NumericType) * 8 + 1 - - std::numeric_limits::is_signed); + : std::numeric_limits::digits + 1; +}; + +// The number of bits (including the sign) in an integer. Eliminates sizeof +// hacks. +template +struct IntegerBitsPlusSign { + static const int value = std::numeric_limits::digits + + std::is_signed::value; +}; + +// Helper templates for integer manipulations. + +template +struct PositionOfSignBit { + static const size_t value = IntegerBitsPlusSign::value - 1; +}; + +// Determines if a numeric value is negative without throwing compiler +// warnings on: unsigned(value) < 0. +template ::value>::type* = nullptr> +constexpr bool IsValueNegative(T value) { + static_assert(std::is_arithmetic::value, "Argument must be numeric."); + return value < 0; +} + +template ::value>::type* = nullptr> +constexpr bool IsValueNegative(T) { + static_assert(std::is_arithmetic::value, "Argument must be numeric."); + return false; +} + +// This performs a fast negation, returning a signed value. It works on unsigned +// arguments, but probably doesn't do what you want for any unsigned value +// larger than max / 2 + 1 (i.e. signed min cast to unsigned). +template +constexpr typename std::make_signed::type ConditionalNegate( + T x, bool is_negative) { + static_assert(std::is_integral::value, "Type must be integral"); + using SignedT = typename std::make_signed::type; + using UnsignedT = typename std::make_unsigned::type; + return static_cast( + (static_cast(x) ^ -SignedT(is_negative)) + is_negative); +} + +// This performs a safe, absolute value via unsigned overflow. +template +constexpr typename std::make_unsigned::type SafeUnsignedAbs(T value) { + static_assert(std::is_integral::value, "Type must be integral"); + using UnsignedT = typename std::make_unsigned::type; + return IsValueNegative(value) + ? static_cast(0u - static_cast(value)) + : static_cast(value); +} + +// This allows us to switch paths on known compile-time constants. +#if defined(__clang__) || defined(__GNUC__) +constexpr bool CanDetectCompileTimeConstant() { return true; } +template +constexpr bool IsCompileTimeConstant(const T v) { + return __builtin_constant_p(v); +} +#else +constexpr bool CanDetectCompileTimeConstant() { return false; } +template +constexpr bool IsCompileTimeConstant(const T) { + return false; +} +#endif +template +constexpr bool MustTreatAsConstexpr(const T v) { + // Either we can't detect a compile-time constant, and must always use the + // constexpr path, or we know we have a compile-time constant. + return !CanDetectCompileTimeConstant() || IsCompileTimeConstant(v); +} + +// Forces a crash, like a CHECK(false). Used for numeric boundary errors. +// Also used in a constexpr template to trigger a compilation failure on +// an error condition. +struct CheckOnFailure { + template + static T HandleFailure() { +#if defined(_MSC_VER) + __debugbreak(); +#elif defined(__GNUC__) || defined(__clang__) + __builtin_trap(); +#else + ((void)(*(volatile char*)0 = 0)); +#endif + return T(); + } }; enum IntegerRepresentation { @@ -35,7 +137,7 @@ enum IntegerRepresentation { // A range for a given nunmeric Src type is contained for a given numeric Dst // type if both numeric_limits::max() <= numeric_limits::max() and -// numeric_limits::min() >= numeric_limits::min() are true. +// numeric_limits::lowest() >= numeric_limits::lowest() are true. // We implement this as template specializations rather than simple static // comparisons to ensure type correctness in our comparisons. enum NumericRangeRepresentation { @@ -46,16 +148,13 @@ enum NumericRangeRepresentation { // Helper templates to statically determine if our destination type can contain // maximum and minimum values represented by the source type. -template < - typename Dst, - typename Src, - IntegerRepresentation DstSign = std::numeric_limits::is_signed - ? INTEGER_REPRESENTATION_SIGNED - : INTEGER_REPRESENTATION_UNSIGNED, - IntegerRepresentation SrcSign = - std::numeric_limits::is_signed - ? INTEGER_REPRESENTATION_SIGNED - : INTEGER_REPRESENTATION_UNSIGNED > +template ::value + ? INTEGER_REPRESENTATION_SIGNED + : INTEGER_REPRESENTATION_UNSIGNED, + IntegerRepresentation SrcSign = std::is_signed::value + ? INTEGER_REPRESENTATION_SIGNED + : INTEGER_REPRESENTATION_UNSIGNED> struct StaticDstRangeRelationToSrcRange; // Same sign: Dst is guaranteed to contain Src only if its range is equal or @@ -90,127 +189,630 @@ struct StaticDstRangeRelationToSrcRange= RANGE_VALID && - integer_range_constraint <= RANGE_INVALID); - return static_cast(integer_range_constraint); -} +// The following helper template addresses a corner case in range checks for +// conversion from a floating-point type to an integral type of smaller range +// but larger precision (e.g. float -> unsigned). The problem is as follows: +// 1. Integral maximum is always one less than a power of two, so it must be +// truncated to fit the mantissa of the floating point. The direction of +// rounding is implementation defined, but by default it's always IEEE +// floats, which round to nearest and thus result in a value of larger +// magnitude than the integral value. +// Example: float f = UINT_MAX; // f is 4294967296f but UINT_MAX +// // is 4294967295u. +// 2. If the floating point value is equal to the promoted integral maximum +// value, a range check will erroneously pass. +// Example: (4294967296f <= 4294967295u) // This is true due to a precision +// // loss in rounding up to float. +// 3. When the floating point value is then converted to an integral, the +// resulting value is out of range for the target integral type and +// thus is implementation defined. +// Example: unsigned u = (float)INT_MAX; // u will typically overflow to 0. +// To fix this bug we manually truncate the maximum value when the destination +// type is an integral of larger precision than the source floating-point type, +// such that the resulting maximum is represented exactly as a floating point. +template class Bounds> +struct NarrowingRange { + using SrcLimits = std::numeric_limits; + using DstLimits = typename std::numeric_limits; -// This function creates a RangeConstraint from an upper and lower bound -// check by taking advantage of the fact that only NaN can be out of range in -// both directions at once. -inline RangeConstraint GetRangeConstraint(bool is_in_upper_bound, - bool is_in_lower_bound) { - return GetRangeConstraint((is_in_upper_bound ? 0 : RANGE_OVERFLOW) | - (is_in_lower_bound ? 0 : RANGE_UNDERFLOW)); -} + // Computes the mask required to make an accurate comparison between types. + static const int kShift = + (MaxExponent::value > MaxExponent::value && + SrcLimits::digits < DstLimits::digits) + ? (DstLimits::digits - SrcLimits::digits) + : 0; + template ::value>::type* = nullptr> -template < - typename Dst, - typename Src, - IntegerRepresentation DstSign = std::numeric_limits::is_signed - ? INTEGER_REPRESENTATION_SIGNED - : INTEGER_REPRESENTATION_UNSIGNED, - IntegerRepresentation SrcSign = std::numeric_limits::is_signed - ? INTEGER_REPRESENTATION_SIGNED - : INTEGER_REPRESENTATION_UNSIGNED, - NumericRangeRepresentation DstRange = - StaticDstRangeRelationToSrcRange::value > + // Masks out the integer bits that are beyond the precision of the + // intermediate type used for comparison. + static constexpr T Adjust(T value) { + static_assert(std::is_same::value, ""); + static_assert(kShift < DstLimits::digits, ""); + return static_cast( + ConditionalNegate(SafeUnsignedAbs(value) & ~((T(1) << kShift) - T(1)), + IsValueNegative(value))); + } + + template ::value>::type* = nullptr> + static constexpr T Adjust(T value) { + static_assert(std::is_same::value, ""); + static_assert(kShift == 0, ""); + return value; + } + + static constexpr Dst max() { return Adjust(Bounds::max()); } + static constexpr Dst lowest() { return Adjust(Bounds::lowest()); } +}; + +template class Bounds, + IntegerRepresentation DstSign = std::is_signed::value + ? INTEGER_REPRESENTATION_SIGNED + : INTEGER_REPRESENTATION_UNSIGNED, + IntegerRepresentation SrcSign = std::is_signed::value + ? INTEGER_REPRESENTATION_SIGNED + : INTEGER_REPRESENTATION_UNSIGNED, + NumericRangeRepresentation DstRange = + StaticDstRangeRelationToSrcRange::value> struct DstRangeRelationToSrcRangeImpl; // The following templates are for ranges that must be verified at runtime. We // split it into checks based on signedness to avoid confusing casts and // compiler warnings on signed an unsigned comparisons. -// Dst range is statically determined to contain Src: Nothing to check. -template -struct DstRangeRelationToSrcRangeImpl class Bounds, + IntegerRepresentation DstSign, IntegerRepresentation SrcSign> +struct DstRangeRelationToSrcRangeImpl { - static RangeConstraint Check(Src value) { return RANGE_VALID; } + static constexpr RangeCheck Check(Src value) { + using SrcLimits = std::numeric_limits; + using DstLimits = NarrowingRange; + return RangeCheck( + static_cast(SrcLimits::lowest()) >= DstLimits::lowest() || + static_cast(value) >= DstLimits::lowest(), + static_cast(SrcLimits::max()) <= DstLimits::max() || + static_cast(value) <= DstLimits::max()); + } }; // Signed to signed narrowing: Both the upper and lower boundaries may be -// exceeded. -template -struct DstRangeRelationToSrcRangeImpl { - static RangeConstraint Check(Src value) { - return std::numeric_limits::is_iec559 - ? GetRangeConstraint(value <= std::numeric_limits::max(), - value >= -std::numeric_limits::max()) - : GetRangeConstraint(value <= std::numeric_limits::max(), - value >= std::numeric_limits::min()); +// exceeded for standard limits. +template class Bounds> +struct DstRangeRelationToSrcRangeImpl< + Dst, Src, Bounds, INTEGER_REPRESENTATION_SIGNED, + INTEGER_REPRESENTATION_SIGNED, NUMERIC_RANGE_NOT_CONTAINED> { + static constexpr RangeCheck Check(Src value) { + using DstLimits = NarrowingRange; + return RangeCheck(value >= DstLimits::lowest(), value <= DstLimits::max()); } }; -// Unsigned to unsigned narrowing: Only the upper boundary can be exceeded. -template -struct DstRangeRelationToSrcRangeImpl { - static RangeConstraint Check(Src value) { - return GetRangeConstraint(value <= std::numeric_limits::max(), true); +// Unsigned to unsigned narrowing: Only the upper bound can be exceeded for +// standard limits. +template class Bounds> +struct DstRangeRelationToSrcRangeImpl< + Dst, Src, Bounds, INTEGER_REPRESENTATION_UNSIGNED, + INTEGER_REPRESENTATION_UNSIGNED, NUMERIC_RANGE_NOT_CONTAINED> { + static constexpr RangeCheck Check(Src value) { + using DstLimits = NarrowingRange; + return RangeCheck( + DstLimits::lowest() == Dst(0) || value >= DstLimits::lowest(), + value <= DstLimits::max()); } }; -// Unsigned to signed: The upper boundary may be exceeded. -template -struct DstRangeRelationToSrcRangeImpl { - static RangeConstraint Check(Src value) { - return sizeof(Dst) > sizeof(Src) - ? RANGE_VALID - : GetRangeConstraint( - value <= static_cast(std::numeric_limits::max()), - true); +// Unsigned to signed: Only the upper bound can be exceeded for standard limits. +template class Bounds> +struct DstRangeRelationToSrcRangeImpl< + Dst, Src, Bounds, INTEGER_REPRESENTATION_SIGNED, + INTEGER_REPRESENTATION_UNSIGNED, NUMERIC_RANGE_NOT_CONTAINED> { + static constexpr RangeCheck Check(Src value) { + using DstLimits = NarrowingRange; + using Promotion = decltype(Src() + Dst()); + return RangeCheck(DstLimits::lowest() <= Dst(0) || + static_cast(value) >= + static_cast(DstLimits::lowest()), + static_cast(value) <= + static_cast(DstLimits::max())); } }; // Signed to unsigned: The upper boundary may be exceeded for a narrower Dst, -// and any negative value exceeds the lower boundary. +// and any negative value exceeds the lower boundary for standard limits. +template class Bounds> +struct DstRangeRelationToSrcRangeImpl< + Dst, Src, Bounds, INTEGER_REPRESENTATION_UNSIGNED, + INTEGER_REPRESENTATION_SIGNED, NUMERIC_RANGE_NOT_CONTAINED> { + static constexpr RangeCheck Check(Src value) { + using SrcLimits = std::numeric_limits; + using DstLimits = NarrowingRange; + using Promotion = decltype(Src() + Dst()); + bool ge_zero = false; + // Converting floating-point to integer will discard fractional part, so + // values in (-1.0, -0.0) will truncate to 0 and fit in Dst. + if (std::is_floating_point::value) { + ge_zero = value > Src(-1); + } else { + ge_zero = value >= Src(0); + } + return RangeCheck( + ge_zero && (DstLimits::lowest() == 0 || + static_cast(value) >= DstLimits::lowest()), + static_cast(SrcLimits::max()) <= + static_cast(DstLimits::max()) || + static_cast(value) <= + static_cast(DstLimits::max())); + } +}; + +// Simple wrapper for statically checking if a type's range is contained. template -struct DstRangeRelationToSrcRangeImpl { - static RangeConstraint Check(Src value) { - return (MaxExponent::value >= MaxExponent::value) - ? GetRangeConstraint(true, value >= static_cast(0)) - : GetRangeConstraint( - value <= static_cast(std::numeric_limits::max()), - value >= static_cast(0)); +struct IsTypeInRangeForNumericType { + static const bool value = StaticDstRangeRelationToSrcRange::value == + NUMERIC_RANGE_CONTAINED; +}; + +template class Bounds = std::numeric_limits, + typename Src> +constexpr RangeCheck DstRangeRelationToSrcRange(Src value) { + static_assert(std::is_arithmetic::value, "Argument must be numeric."); + static_assert(std::is_arithmetic::value, "Result must be numeric."); + static_assert(Bounds::lowest() < Bounds::max(), ""); + return DstRangeRelationToSrcRangeImpl::Check(value); +} + +// Integer promotion templates used by the portable checked integer arithmetic. +template +struct IntegerForDigitsAndSign; + +#define INTEGER_FOR_DIGITS_AND_SIGN(I) \ + template <> \ + struct IntegerForDigitsAndSign::value, \ + std::is_signed::value> { \ + using type = I; \ + } + +INTEGER_FOR_DIGITS_AND_SIGN(int8_t); +INTEGER_FOR_DIGITS_AND_SIGN(uint8_t); +INTEGER_FOR_DIGITS_AND_SIGN(int16_t); +INTEGER_FOR_DIGITS_AND_SIGN(uint16_t); +INTEGER_FOR_DIGITS_AND_SIGN(int32_t); +INTEGER_FOR_DIGITS_AND_SIGN(uint32_t); +INTEGER_FOR_DIGITS_AND_SIGN(int64_t); +INTEGER_FOR_DIGITS_AND_SIGN(uint64_t); +#undef INTEGER_FOR_DIGITS_AND_SIGN + +// WARNING: We have no IntegerForSizeAndSign<16, *>. If we ever add one to +// support 128-bit math, then the ArithmeticPromotion template below will need +// to be updated (or more likely replaced with a decltype expression). +static_assert(IntegerBitsPlusSign::value == 64, + "Max integer size not supported for this toolchain."); + +template ::value> +struct TwiceWiderInteger { + using type = + typename IntegerForDigitsAndSign::value * 2, + IsSigned>::type; +}; + +enum ArithmeticPromotionCategory { + LEFT_PROMOTION, // Use the type of the left-hand argument. + RIGHT_PROMOTION // Use the type of the right-hand argument. +}; + +// Determines the type that can represent the largest positive value. +template ::value > MaxExponent::value) + ? LEFT_PROMOTION + : RIGHT_PROMOTION> +struct MaxExponentPromotion; + +template +struct MaxExponentPromotion { + using type = Lhs; +}; + +template +struct MaxExponentPromotion { + using type = Rhs; +}; + +// Determines the type that can represent the lowest arithmetic value. +template ::value + ? (std::is_signed::value + ? (MaxExponent::value > MaxExponent::value + ? LEFT_PROMOTION + : RIGHT_PROMOTION) + : LEFT_PROMOTION) + : (std::is_signed::value + ? RIGHT_PROMOTION + : (MaxExponent::value < MaxExponent::value + ? LEFT_PROMOTION + : RIGHT_PROMOTION))> +struct LowestValuePromotion; + +template +struct LowestValuePromotion { + using type = Lhs; +}; + +template +struct LowestValuePromotion { + using type = Rhs; +}; + +// Determines the type that is best able to represent an arithmetic result. +template < + typename Lhs, typename Rhs = Lhs, + bool is_intmax_type = + std::is_integral::type>::value&& + IntegerBitsPlusSign::type>:: + value == IntegerBitsPlusSign::value, + bool is_max_exponent = + StaticDstRangeRelationToSrcRange< + typename MaxExponentPromotion::type, Lhs>::value == + NUMERIC_RANGE_CONTAINED&& StaticDstRangeRelationToSrcRange< + typename MaxExponentPromotion::type, Rhs>::value == + NUMERIC_RANGE_CONTAINED> +struct BigEnoughPromotion; + +// The side with the max exponent is big enough. +template +struct BigEnoughPromotion { + using type = typename MaxExponentPromotion::type; + static const bool is_contained = true; +}; + +// We can use a twice wider type to fit. +template +struct BigEnoughPromotion { + using type = + typename TwiceWiderInteger::type, + std::is_signed::value || + std::is_signed::value>::type; + static const bool is_contained = true; +}; + +// No type is large enough. +template +struct BigEnoughPromotion { + using type = typename MaxExponentPromotion::type; + static const bool is_contained = false; +}; + +// We can statically check if operations on the provided types can wrap, so we +// can skip the checked operations if they're not needed. So, for an integer we +// care if the destination type preserves the sign and is twice the width of +// the source. +template +struct IsIntegerArithmeticSafe { + static const bool value = + !std::is_floating_point::value && + !std::is_floating_point::value && + !std::is_floating_point::value && + std::is_signed::value >= std::is_signed::value && + IntegerBitsPlusSign::value >= (2 * IntegerBitsPlusSign::value) && + std::is_signed::value >= std::is_signed::value && + IntegerBitsPlusSign::value >= (2 * IntegerBitsPlusSign::value); +}; + +// Promotes to a type that can represent any possible result of a binary +// arithmetic operation with the source types. +template ::value || + std::is_signed::value, + intmax_t, uintmax_t>::type, + typename MaxExponentPromotion::type>::value> +struct FastIntegerArithmeticPromotion; + +template +struct FastIntegerArithmeticPromotion { + using type = + typename TwiceWiderInteger::type, + std::is_signed::value || + std::is_signed::value>::type; + static_assert(IsIntegerArithmeticSafe::value, ""); + static const bool is_contained = true; +}; + +template +struct FastIntegerArithmeticPromotion { + using type = typename BigEnoughPromotion::type; + static const bool is_contained = false; +}; + +// Extracts the underlying type from an enum. +template ::value> +struct ArithmeticOrUnderlyingEnum; + +template +struct ArithmeticOrUnderlyingEnum { + using type = typename std::underlying_type::type; + static const bool value = std::is_arithmetic::value; +}; + +template +struct ArithmeticOrUnderlyingEnum { + using type = T; + static const bool value = std::is_arithmetic::value; +}; + +// The following are helper templates used in the CheckedNumeric class. +template +class CheckedNumeric; + +template +class ClampedNumeric; + +template +class StrictNumeric; + +// Used to treat CheckedNumeric and arithmetic underlying types the same. +template +struct UnderlyingType { + using type = typename ArithmeticOrUnderlyingEnum::type; + static const bool is_numeric = std::is_arithmetic::value; + static const bool is_checked = false; + static const bool is_clamped = false; + static const bool is_strict = false; +}; + +template +struct UnderlyingType> { + using type = T; + static const bool is_numeric = true; + static const bool is_checked = true; + static const bool is_clamped = false; + static const bool is_strict = false; +}; + +template +struct UnderlyingType> { + using type = T; + static const bool is_numeric = true; + static const bool is_checked = false; + static const bool is_clamped = true; + static const bool is_strict = false; +}; + +template +struct UnderlyingType> { + using type = T; + static const bool is_numeric = true; + static const bool is_checked = false; + static const bool is_clamped = false; + static const bool is_strict = true; +}; + +template +struct IsCheckedOp { + static const bool value = + UnderlyingType::is_numeric && UnderlyingType::is_numeric && + (UnderlyingType::is_checked || UnderlyingType::is_checked); +}; + +template +struct IsClampedOp { + static const bool value = + UnderlyingType::is_numeric && UnderlyingType::is_numeric && + (UnderlyingType::is_clamped || UnderlyingType::is_clamped) && + !(UnderlyingType::is_checked || UnderlyingType::is_checked); +}; + +template +struct IsStrictOp { + static const bool value = + UnderlyingType::is_numeric && UnderlyingType::is_numeric && + (UnderlyingType::is_strict || UnderlyingType::is_strict) && + !(UnderlyingType::is_checked || UnderlyingType::is_checked) && + !(UnderlyingType::is_clamped || UnderlyingType::is_clamped); +}; + +// as_signed<> returns the supplied integral value (or integral castable +// Numeric template) cast as a signed integral of equivalent precision. +// I.e. it's mostly an alias for: static_cast::type>(t) +template +constexpr typename std::make_signed< + typename base::internal::UnderlyingType::type>::type +as_signed(const Src value) { + static_assert(std::is_integral::value, + "Argument must be a signed or unsigned integer type."); + return static_cast(value); +} + +// as_unsigned<> returns the supplied integral value (or integral castable +// Numeric template) cast as an unsigned integral of equivalent precision. +// I.e. it's mostly an alias for: static_cast::type>(t) +template +constexpr typename std::make_unsigned< + typename base::internal::UnderlyingType::type>::type +as_unsigned(const Src value) { + static_assert(std::is_integral::value, + "Argument must be a signed or unsigned integer type."); + return static_cast(value); +} + +template +constexpr bool IsLessImpl(const L lhs, const R rhs, const RangeCheck l_range, + const RangeCheck r_range) { + return l_range.IsUnderflow() || r_range.IsOverflow() || + (l_range == r_range && static_cast(lhs) < + static_cast(rhs)); +} + +template +struct IsLess { + static_assert(std::is_arithmetic::value && std::is_arithmetic::value, + "Types must be numeric."); + static constexpr bool Test(const L lhs, const R rhs) { + return IsLessImpl(lhs, rhs, DstRangeRelationToSrcRange(lhs), + DstRangeRelationToSrcRange(rhs)); + } +}; + +template +constexpr bool IsLessOrEqualImpl(const L lhs, const R rhs, + const RangeCheck l_range, + const RangeCheck r_range) { + return l_range.IsUnderflow() || r_range.IsOverflow() || + (l_range == r_range && static_cast(lhs) <= + static_cast(rhs)); +} + +template +struct IsLessOrEqual { + static_assert(std::is_arithmetic::value && std::is_arithmetic::value, + "Types must be numeric."); + static constexpr bool Test(const L lhs, const R rhs) { + return IsLessOrEqualImpl(lhs, rhs, DstRangeRelationToSrcRange(lhs), + DstRangeRelationToSrcRange(rhs)); + } +}; + +template +constexpr bool IsGreaterImpl(const L lhs, const R rhs, const RangeCheck l_range, + const RangeCheck r_range) { + return l_range.IsOverflow() || r_range.IsUnderflow() || + (l_range == r_range && static_cast(lhs) > + static_cast(rhs)); +} + +template +struct IsGreater { + static_assert(std::is_arithmetic::value && std::is_arithmetic::value, + "Types must be numeric."); + static constexpr bool Test(const L lhs, const R rhs) { + return IsGreaterImpl(lhs, rhs, DstRangeRelationToSrcRange(lhs), + DstRangeRelationToSrcRange(rhs)); } }; +template +constexpr bool IsGreaterOrEqualImpl(const L lhs, const R rhs, + const RangeCheck l_range, + const RangeCheck r_range) { + return l_range.IsOverflow() || r_range.IsUnderflow() || + (l_range == r_range && static_cast(lhs) >= + static_cast(rhs)); +} + +template +struct IsGreaterOrEqual { + static_assert(std::is_arithmetic::value && std::is_arithmetic::value, + "Types must be numeric."); + static constexpr bool Test(const L lhs, const R rhs) { + return IsGreaterOrEqualImpl(lhs, rhs, DstRangeRelationToSrcRange(lhs), + DstRangeRelationToSrcRange(rhs)); + } +}; + +template +struct IsEqual { + static_assert(std::is_arithmetic::value && std::is_arithmetic::value, + "Types must be numeric."); + static constexpr bool Test(const L lhs, const R rhs) { + return DstRangeRelationToSrcRange(lhs) == + DstRangeRelationToSrcRange(rhs) && + static_cast(lhs) == + static_cast(rhs); + } +}; + +template +struct IsNotEqual { + static_assert(std::is_arithmetic::value && std::is_arithmetic::value, + "Types must be numeric."); + static constexpr bool Test(const L lhs, const R rhs) { + return DstRangeRelationToSrcRange(lhs) != + DstRangeRelationToSrcRange(rhs) || + static_cast(lhs) != + static_cast(rhs); + } +}; + +// These perform the actual math operations on the CheckedNumerics. +// Binary arithmetic operations. +template