From bbf42b1dcbd112ad97b5e18b61a22d6b53cedd58 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Mon, 5 Oct 2026 15:32:30 +0200 Subject: [PATCH 01/23] deps: update V8 to 15.5.35.20 Signed-off-by: Joyee Cheung --- deps/v8/.gitignore | 1 + deps/v8/.gn | 10 +- deps/v8/.vpython3 | 107 - deps/v8/AUTHORS | 11 +- deps/v8/BUILD.bazel | 332 +- deps/v8/BUILD.gn | 316 +- deps/v8/COMMON_OWNERS | 1 + deps/v8/DEPS | 349 +- deps/v8/MODULE.bazel | 3 +- deps/v8/OWNERS | 1 + deps/v8/PRESUBMIT.py | 81 +- deps/v8/agents/.vpython3 | 4 + deps/v8/agents/PRESUBMIT.py | 23 + deps/v8/agents/README.md | 4 + deps/v8/agents/scripts/create_worktree.sh | 10 +- .../agents/scripts/install_for_copilot_cli.py | 362 ++ .../scripts/install_for_copilot_cli_test.py | 651 +++ .../skills/ecmascript-evaluation/SKILL.md | 63 +- deps/v8/bazel/defs.bzl | 293 +- deps/v8/bazel/toolchain/libcxx_repository.bzl | 4 +- deps/v8/docs/runtime/tiering.md | 2 +- deps/v8/docs/security/triaging.md | 10 + deps/v8/gni/v8.gni | 28 +- deps/v8/include/OWNERS | 1 + deps/v8/include/cppgc/explicit-management.h | 7 +- deps/v8/include/js_protocol.pdl | 21 +- deps/v8/include/v8-container.h | 11 +- deps/v8/include/v8-context.h | 81 +- deps/v8/include/v8-cppgc.h | 31 +- deps/v8/include/v8-exception.h | 8 + deps/v8/include/v8-function-callback.h | 7 - deps/v8/include/v8-internal.h | 93 +- deps/v8/include/v8-isolate.h | 23 +- deps/v8/include/v8-microtask-queue.h | 23 +- deps/v8/include/v8-object.h | 74 +- deps/v8/include/v8-sandbox.h | 2 + deps/v8/include/v8-script.h | 24 +- deps/v8/include/v8-template.h | 226 +- deps/v8/include/v8-value-serializer.h | 34 +- deps/v8/include/v8-value.h | 7 + deps/v8/include/v8-version.h | 6 +- deps/v8/include/v8-wasm.h | 38 +- deps/v8/include/v8config.h | 4 - deps/v8/infra/mb/mb_config.pyl | 9 + deps/v8/infra/testing/builders.pyl | 94 +- deps/v8/src/DEPS | 1 + deps/v8/src/api/api-arguments-inl.h | 41 +- deps/v8/src/api/api-inl.h | 9 +- deps/v8/src/api/api-natives.cc | 11 +- deps/v8/src/api/api.cc | 370 +- deps/v8/src/ast/modules.cc | 8 +- deps/v8/src/ast/modules.h | 35 +- deps/v8/src/ast/scopes.cc | 4 +- deps/v8/src/ast/variables.h | 2 + deps/v8/src/base/atomic-utils.h | 11 +- deps/v8/src/base/cpu/cpu-riscv.cc | 6 + deps/v8/src/base/cpu/cpu-x86.cc | 6 + deps/v8/src/base/cpu/cpu.cc | 1 + deps/v8/src/base/cpu/cpu.h | 6 + deps/v8/src/base/debug/stack_trace_win.cc | 6 + deps/v8/src/base/macros.h | 16 +- deps/v8/src/base/memcopy.h | 61 +- deps/v8/src/base/memory.h | 2 - deps/v8/src/base/platform/platform-aix.cc | 17 - deps/v8/src/base/platform/platform-posix.cc | 14 +- deps/v8/src/base/platform/platform-solaris.cc | 18 - .../arm64/baseline-assembler-arm64-inl.h | 34 + deps/v8/src/baseline/baseline-assembler.h | 18 + deps/v8/src/baseline/baseline-compiler.cc | 185 +- deps/v8/src/baseline/baseline-compiler.h | 19 + .../loong64/baseline-assembler-loong64-inl.h | 35 + .../baseline/x64/baseline-assembler-x64-inl.h | 43 +- deps/v8/src/bigint/bigint-inl.h | 53 + deps/v8/src/bigint/bigint-internal.cc | 48 +- deps/v8/src/bigint/bigint.h | 10 + deps/v8/src/builtins/accessors.cc | 10 + deps/v8/src/builtins/arm/builtins-arm.cc | 14 +- deps/v8/src/builtins/arm64/builtins-arm64.cc | 14 +- deps/v8/src/builtins/array-from.tq | 4 +- deps/v8/src/builtins/array-join.tq | 69 +- deps/v8/src/builtins/array-lastindexof.tq | 167 +- deps/v8/src/builtins/base.tq | 14 +- deps/v8/src/builtins/builtins-array.cc | 1 + deps/v8/src/builtins/builtins-arraybuffer.cc | 1 + .../builtins-atomics-synchronization.cc | 1 + deps/v8/src/builtins/builtins-bigint.cc | 1 + deps/v8/src/builtins/builtins-callsite.cc | 102 + deps/v8/src/builtins/builtins-dataview.cc | 1 + deps/v8/src/builtins/builtins-date.cc | 1 + deps/v8/src/builtins/builtins-definitions.h | 55 +- deps/v8/src/builtins/builtins-inl.h | 1 + deps/v8/src/builtins/builtins-intl-gen.cc | 6 + deps/v8/src/builtins/builtins-intl.cc | 6 +- deps/v8/src/builtins/builtins-iterator-inl.h | 1 + deps/v8/src/builtins/builtins-math.cc | 1 + .../builtins/builtins-microtask-queue-gen.cc | 6 - deps/v8/src/builtins/builtins-number-gen.cc | 106 +- deps/v8/src/builtins/builtins-number-tsa.cc | 9 +- deps/v8/src/builtins/builtins-number.cc | 1 + deps/v8/src/builtins/builtins-regexp-gen.cc | 291 +- deps/v8/src/builtins/builtins-regexp-gen.h | 16 + .../builtins/builtins-sharedarraybuffer.cc | 4 +- deps/v8/src/builtins/builtins-string-gen.cc | 22 +- deps/v8/src/builtins/builtins-string.cc | 1 + deps/v8/src/builtins/builtins-struct.cc | 1 + deps/v8/src/builtins/builtins-temporal.cc | 1 + deps/v8/src/builtins/builtins-trace.cc | 1 + deps/v8/src/builtins/builtins.cc | 66 +- deps/v8/src/builtins/builtins.h | 12 + deps/v8/src/builtins/convert.tq | 3 + deps/v8/src/builtins/generator.tq | 3 +- deps/v8/src/builtins/ia32/builtins-ia32.cc | 12 +- deps/v8/src/builtins/iterator-helpers.tq | 16 +- deps/v8/src/builtins/iterator.tq | 4 +- .../src/builtins/js-trampoline-assembler.cc | 10 +- .../src/builtins/loong64/builtins-loong64.cc | 16 +- .../v8/src/builtins/mips64/builtins-mips64.cc | 6 +- deps/v8/src/builtins/ppc/builtins-ppc.cc | 40 +- deps/v8/src/builtins/promise-try.tq | 61 +- deps/v8/src/builtins/regexp-match-all.tq | 56 +- deps/v8/src/builtins/riscv/builtins-riscv.cc | 19 +- deps/v8/src/builtins/s390/builtins-s390.cc | 14 +- deps/v8/src/builtins/typed-array-set.tq | 21 +- deps/v8/src/builtins/wasm-strings.tq | 23 +- deps/v8/src/builtins/wasm.tq | 163 +- deps/v8/src/builtins/x64/builtins-x64.cc | 20 +- .../arm64/interface-descriptors-arm64-inl.h | 8 + .../codegen/arm64/macro-assembler-arm64.cc | 291 +- .../src/codegen/arm64/macro-assembler-arm64.h | 55 +- deps/v8/src/codegen/code-stub-assembler.cc | 223 +- deps/v8/src/codegen/code-stub-assembler.h | 27 +- deps/v8/src/codegen/compiler.cc | 103 +- deps/v8/src/codegen/compiler.h | 5 - deps/v8/src/codegen/cpu-features.h | 2 + deps/v8/src/codegen/external-reference.cc | 6 + deps/v8/src/codegen/external-reference.h | 2 + deps/v8/src/codegen/handler-table.cc | 4 +- .../src/codegen/ia32/macro-assembler-ia32.h | 31 + deps/v8/src/codegen/interface-descriptors.h | 43 +- .../src/codegen/loong64/assembler-loong64.h | 4 + .../interface-descriptors-loong64-inl.h | 28 + .../loong64/macro-assembler-loong64.cc | 256 +- .../codegen/loong64/macro-assembler-loong64.h | 16 +- deps/v8/src/codegen/machine-type.h | 4 + .../codegen/mips64/macro-assembler-mips64.cc | 26 +- .../codegen/mips64/macro-assembler-mips64.h | 17 +- .../v8/src/codegen/ppc/macro-assembler-ppc.cc | 118 +- deps/v8/src/codegen/ppc/macro-assembler-ppc.h | 37 +- deps/v8/src/codegen/reloc-info.h | 3 +- deps/v8/src/codegen/riscv/assembler-riscv.cc | 4 +- .../src/codegen/riscv/base-assembler-riscv.cc | 21 +- .../src/codegen/riscv/base-assembler-riscv.h | 2 + .../src/codegen/riscv/base-constants-riscv.cc | 16 +- deps/v8/src/codegen/riscv/constant-riscv-c.h | 42 + .../v8/src/codegen/riscv/extension-riscv-c.cc | 83 + deps/v8/src/codegen/riscv/extension-riscv-c.h | 17 + .../codegen/riscv/macro-assembler-riscv.cc | 166 +- .../src/codegen/riscv/macro-assembler-riscv.h | 16 +- deps/v8/src/codegen/riscv/register-riscv.h | 5 + deps/v8/src/codegen/riscv/reglist-riscv.h | 8 + .../src/codegen/s390/macro-assembler-s390.cc | 11 +- .../macro-assembler-shared-ia32-x64.cc | 95 +- .../macro-assembler-shared-ia32-x64.h | 30 +- deps/v8/src/codegen/x64/assembler-x64-inl.h | 70 + deps/v8/src/codegen/x64/assembler-x64.cc | 105 +- deps/v8/src/codegen/x64/assembler-x64.h | 288 + .../x64/interface-descriptors-x64-inl.h | 5 + .../v8/src/codegen/x64/macro-assembler-x64.cc | 152 +- deps/v8/src/codegen/x64/macro-assembler-x64.h | 66 +- deps/v8/src/codegen/x64/register-x64.h | 112 +- deps/v8/src/common/assert-scope.h | 2 +- deps/v8/src/common/globals.h | 59 +- deps/v8/src/common/operation.h | 12 + deps/v8/src/common/ptr-compr-inl.h | 2 +- deps/v8/src/common/segmented-table-inl.h | 295 -- deps/v8/src/common/segmented-table.h | 257 - .../optimizing-compile-dispatcher.cc | 27 + .../optimizing-compile-dispatcher.h | 10 +- deps/v8/src/compiler/access-builder.cc | 4 +- .../backend/arm/instruction-selector-arm.cc | 4 + .../backend/arm64/code-generator-arm64.cc | 16 +- .../arm64/instruction-scheduler-arm64.cc | 443 +- .../arm64/instruction-selector-arm64.cc | 524 +- .../v8/src/compiler/backend/bitcast-elider.cc | 19 +- .../backend/ia32/code-generator-ia32.cc | 23 +- .../backend/ia32/instruction-selector-ia32.cc | 8 +- .../backend/instruction-selector-impl.h | 180 + .../compiler/backend/instruction-selector.cc | 522 +- .../compiler/backend/instruction-selector.h | 38 + .../backend/loong64/code-generator-loong64.cc | 336 +- .../loong64/instruction-codes-loong64.h | 3 + .../loong64/instruction-selector-loong64.cc | 313 +- .../backend/mips64/code-generator-mips64.cc | 14 +- .../mips64/instruction-selector-mips64.cc | 11 +- .../v8/src/compiler/backend/move-optimizer.cc | 44 + .../backend/ppc/instruction-selector-ppc.cc | 4 + .../compiler/backend/register-allocation.h | 16 +- .../compiler/backend/register-allocator.cc | 88 +- .../src/compiler/backend/register-allocator.h | 51 +- .../backend/riscv/code-generator-riscv.cc | 157 +- .../riscv/instruction-selector-riscv.h | 17 +- .../riscv/instruction-selector-riscv64.cc | 16 +- .../backend/s390/instruction-selector-s390.cc | 4 + .../backend/x64/code-generator-x64.cc | 254 +- .../backend/x64/instruction-codes-x64.h | 1 + .../backend/x64/instruction-scheduler-x64.cc | 1 + .../backend/x64/instruction-selector-x64.cc | 287 +- .../v8/src/compiler/bytecode-graph-builder.cc | 69 +- deps/v8/src/compiler/code-assembler.cc | 4 + deps/v8/src/compiler/code-assembler.h | 4 + .../src/compiler/compilation-dependencies.cc | 44 +- deps/v8/src/compiler/heap-refs.cc | 11 +- deps/v8/src/compiler/js-call-reducer.cc | 40 + deps/v8/src/compiler/js-generic-lowering.cc | 17 +- deps/v8/src/compiler/js-generic-lowering.h | 4 +- deps/v8/src/compiler/js-heap-broker.cc | 19 +- .../js-native-context-specialization.cc | 25 +- deps/v8/src/compiler/js-operator.cc | 22 +- deps/v8/src/compiler/js-operator.h | 41 +- deps/v8/src/compiler/js-type-hint-lowering.cc | 157 +- deps/v8/src/compiler/js-type-hint-lowering.h | 11 +- deps/v8/src/compiler/js-typed-lowering.cc | 21 +- deps/v8/src/compiler/linear-scheduler.cc | 129 - deps/v8/src/compiler/linear-scheduler.h | 67 - deps/v8/src/compiler/pipeline.cc | 26 +- deps/v8/src/compiler/processed-feedback.h | 9 +- deps/v8/src/compiler/representation-change.cc | 123 +- deps/v8/src/compiler/revectorizer.cc | 1462 ------ deps/v8/src/compiler/revectorizer.h | 211 - deps/v8/src/compiler/simplified-lowering.cc | 4 +- deps/v8/src/compiler/turbofan-types.cc | 3 + deps/v8/src/compiler/turboshaft/assembler.h | 16 +- .../turboshaft/builtin-call-descriptors.h | 36 +- .../src/compiler/turboshaft/graph-builder.cc | 2 + .../turboshaft/int64-lowering-reducer.h | 52 +- .../late-load-elimination-reducer.h | 1 - .../load-store-simplification-reducer.h | 68 +- .../turboshaft/loop-unrolling-reducer.cc | 4 +- .../turboshaft/loop-unrolling-reducer.h | 2 +- .../turboshaft/machine-lowering-reducer-inl.h | 100 +- .../turboshaft/machine-optimization-reducer.h | 91 +- deps/v8/src/compiler/turboshaft/operations.h | 65 +- deps/v8/src/compiler/turboshaft/phase.h | 11 + deps/v8/src/compiler/turboshaft/pipelines.cc | 2 + .../turboshaft/random-rescheduling-phase.cc | 8 +- .../turboshaft/runtime-call-descriptors.h | 7 + .../turboshaft/stack-check-lowering-reducer.h | 4 +- .../turboshaft/turbolev-frontend-pipeline.cc | 32 +- .../turboshaft/turbolev-graph-builder.cc | 492 +- .../wasm-in-js-inlining-reducer-inl.h | 1 + .../turboshaft/wasm-lowering-reducer.h | 169 +- .../compiler/turboshaft/wasm-revec-phase.cc | 1 + .../compiler/turboshaft/wasm-revec-reducer.cc | 148 +- .../compiler/turboshaft/wasm-revec-reducer.h | 191 +- .../turboshaft/wasm-shuffle-reducer.cc | 174 +- .../turboshaft/wasm-shuffle-reducer.h | 117 +- .../compiler/turboshaft/wasm-simd-phase.cc | 1 + .../compiler/turboshaft/wasm-wrappers-inl.h | 29 +- .../src/compiler/turboshaft/wasm-wrappers.h | 519 +- deps/v8/src/compiler/wasm-gc-lowering.cc | 69 +- deps/v8/src/compiler/wasm-inlining-into-js.cc | 49 +- deps/v8/src/d8/OWNERS | 8 +- deps/v8/src/d8/async-hooks-wrapper.cc | 10 +- deps/v8/src/d8/async-hooks-wrapper.h | 4 +- deps/v8/src/d8/d8-console.cc | 32 +- deps/v8/src/d8/d8-posix.cc | 71 +- deps/v8/src/d8/d8-test.cc | 224 + deps/v8/src/d8/d8-windows.cc | 8 +- deps/v8/src/d8/d8.cc | 561 +- deps/v8/src/d8/d8.h | 96 +- deps/v8/src/d8/hardware-watchpoints.cc | 8 +- deps/v8/src/debug/debug-coverage.cc | 2 +- deps/v8/src/debug/debug-evaluate.cc | 46 +- deps/v8/src/debug/debug-evaluate.h | 6 +- deps/v8/src/debug/debug-interface.cc | 50 +- deps/v8/src/debug/debug-interface.h | 30 +- deps/v8/src/debug/debug-property-iterator.cc | 6 + deps/v8/src/debug/debug-scope-info.cc | 783 +++ deps/v8/src/debug/debug-scope-info.h | 140 + deps/v8/src/debug/debug-scope-iterator.cc | 15 +- deps/v8/src/debug/debug-scopes.cc | 51 +- deps/v8/src/debug/debug-scopes.h | 8 + .../src/debug/debug-stack-trace-iterator.cc | 4 +- .../v8/src/debug/debug-stack-trace-iterator.h | 3 +- deps/v8/src/debug/debug-wasm-objects.cc | 14 +- deps/v8/src/debug/debug-wasm-objects.h | 2 + deps/v8/src/debug/debug.cc | 110 +- deps/v8/src/debug/debug.h | 35 +- deps/v8/src/debug/liveedit-diff.cc | 412 -- deps/v8/src/debug/liveedit-diff.h | 44 - deps/v8/src/debug/liveedit.cc | 1155 ---- deps/v8/src/debug/liveedit.h | 72 - .../src/debug/wasm/gdb-server/gdb-server.cc | 1 - .../v8/src/debug/wasm/gdb-server/gdb-server.h | 2 +- .../wasm/gdb-server/wasm-module-debug.cc | 9 +- deps/v8/src/deoptimizer/DEPS | 5 - deps/v8/src/deoptimizer/deoptimizer.cc | 8 +- deps/v8/src/deoptimizer/deoptimizer.h | 2 +- .../deoptimizer/frame-translation-builder.cc | 60 +- .../deoptimizer/frame-translation-builder.h | 32 +- .../deoptimizer/riscv/deoptimizer-riscv.cc | 5 + deps/v8/src/deoptimizer/translated-state.cc | 5 + .../src/diagnostics/basic-block-profiler.cc | 49 +- .../v8/src/diagnostics/basic-block-profiler.h | 10 + deps/v8/src/diagnostics/disassembler.cc | 7 +- deps/v8/src/diagnostics/objects-debug.cc | 79 +- deps/v8/src/diagnostics/objects-printer.cc | 86 +- deps/v8/src/diagnostics/riscv/disasm-riscv.cc | 76 +- deps/v8/src/diagnostics/x64/disasm-x64.cc | 326 +- deps/v8/src/dumpling/object-dumping.cc | 1 + deps/v8/src/execution/arguments-inl.h | 1 + deps/v8/src/execution/execution.cc | 16 +- deps/v8/src/execution/frame-constants.h | 4 + deps/v8/src/execution/frames.cc | 181 +- deps/v8/src/execution/futex-emulation.cc | 33 +- deps/v8/src/execution/futex-emulation.h | 11 +- deps/v8/src/execution/isolate-inl.h | 6 +- deps/v8/src/execution/isolate.cc | 72 +- deps/v8/src/execution/isolate.h | 32 +- deps/v8/src/execution/microtask-queue.cc | 75 +- deps/v8/src/execution/microtask-queue.h | 29 +- .../v8/src/execution/riscv/simulator-riscv.cc | 136 +- deps/v8/src/execution/riscv/simulator-riscv.h | 7 +- deps/v8/src/execution/tiering-manager.cc | 33 +- .../v8/src/extensions/statistics-extension.cc | 6 +- deps/v8/src/flags/feature-flags.h | 232 + deps/v8/src/flags/flag-definitions.h | 471 +- deps/v8/src/flags/flags.cc | 109 +- deps/v8/src/fuzzilli/OWNERS | 3 + deps/v8/src/fuzzilli/cov.cc | 28 +- deps/v8/src/fuzzilli/cov.h | 15 +- deps/v8/src/handles/global-handles.cc | 3 +- deps/v8/src/handles/handles.h | 2 +- deps/v8/src/heap/concurrent-marking.cc | 8 +- .../cppgc-internal/explicit-management.cc | 9 +- .../heap/cppgc-internal/heap-object-header.h | 14 + deps/v8/src/heap/cppgc-internal/heap-page.h | 4 + deps/v8/src/heap/cppgc-internal/heap-space.h | 10 +- .../src/heap/cppgc-internal/marking-state.h | 22 +- deps/v8/src/heap/cppgc-internal/memory.h | 10 +- .../v8/src/heap/cppgc-internal/page-memory.cc | 7 + deps/v8/src/heap/cppgc-js/cpp-heap.cc | 49 +- deps/v8/src/heap/cppgc-js/cpp-heap.h | 22 +- deps/v8/src/heap/factory-base.h | 7 + deps/v8/src/heap/factory.cc | 306 +- deps/v8/src/heap/factory.h | 60 +- deps/v8/src/heap/gc-tracer.cc | 11 + deps/v8/src/heap/gc-tracer.h | 12 + deps/v8/src/heap/heap-controller.cc | 11 +- deps/v8/src/heap/heap-inl.h | 7 + deps/v8/src/heap/heap-verifier.cc | 1 + deps/v8/src/heap/heap-visitor.h | 156 +- deps/v8/src/heap/heap-write-barrier.cc | 2 +- deps/v8/src/heap/heap.cc | 17 +- deps/v8/src/heap/heap.h | 7 +- deps/v8/src/heap/mark-compact.cc | 33 +- deps/v8/src/heap/marking-barrier.cc | 5 +- deps/v8/src/heap/marking-visitor-inl.h | 9 +- deps/v8/src/heap/memory-chunk-inl.h | 4 +- deps/v8/src/heap/minor-mark-sweep.cc | 9 +- deps/v8/src/heap/minor-mark-sweep.h | 2 +- deps/v8/src/heap/mutable-page.cc | 6 +- deps/v8/src/heap/object-stats.cc | 9 +- deps/v8/src/heap/pretenuring-handler-inl.h | 52 +- deps/v8/src/heap/pretenuring-handler.h | 17 +- deps/v8/src/heap/read-only-heap.cc | 18 +- deps/v8/src/heap/read-only-heap.h | 2 +- deps/v8/src/heap/read-only-promotion.cc | 4 +- deps/v8/src/heap/read-only-spaces.cc | 10 + deps/v8/src/heap/scavenger.cc | 27 +- deps/v8/src/heap/setup-heap-internal.cc | 30 +- .../young-generation-marking-visitor-inl.h | 12 +- .../heap/young-generation-marking-visitor.h | 7 +- deps/v8/src/ic/accessor-assembler.cc | 8 + deps/v8/src/ic/handler-configuration.h | 4 + deps/v8/src/ic/ic.cc | 65 +- deps/v8/src/ic/unary-op-assembler.cc | 101 +- deps/v8/src/ic/unary-op-assembler.h | 35 +- deps/v8/src/init/bootstrapper.cc | 403 +- deps/v8/src/init/isolate-group.h | 8 +- deps/v8/src/inspector/custom-preview.cc | 42 +- deps/v8/src/inspector/injected-script.cc | 4 +- deps/v8/src/inspector/injected-script.h | 4 +- deps/v8/src/inspector/inspected-context.cc | 16 +- deps/v8/src/inspector/inspected-context.h | 6 +- deps/v8/src/inspector/v8-console.cc | 49 +- .../src/inspector/v8-debugger-agent-impl.cc | 107 +- .../v8/src/inspector/v8-debugger-agent-impl.h | 1 + deps/v8/src/inspector/v8-debugger-script.cc | 22 +- deps/v8/src/inspector/v8-debugger-script.h | 9 +- deps/v8/src/inspector/v8-debugger.cc | 28 +- deps/v8/src/inspector/v8-debugger.h | 2 +- deps/v8/src/inspector/v8-deep-serializer.cc | 54 +- .../inspector/v8-heap-profiler-agent-impl.cc | 4 +- deps/v8/src/inspector/v8-inspector-impl.cc | 1 + .../inspector/v8-inspector-session-impl.cc | 64 +- .../src/inspector/v8-inspector-session-impl.h | 4 +- deps/v8/src/inspector/v8-regex.cc | 2 + deps/v8/src/inspector/value-mirror.cc | 10 + .../src/interpreter/bytecode-array-builder.cc | 14 +- .../interpreter/bytecode-array-iterator.cc | 9 +- .../src/interpreter/bytecode-array-iterator.h | 3 +- .../src/interpreter/bytecode-array-writer.cc | 12 +- deps/v8/src/interpreter/bytecode-decoder.cc | 19 +- deps/v8/src/interpreter/bytecode-generator.cc | 76 +- deps/v8/src/interpreter/bytecode-generator.h | 1 - deps/v8/src/interpreter/bytecodes.h | 23 +- .../src/interpreter/handler-table-builder.cc | 30 +- .../src/interpreter/handler-table-builder.h | 10 +- .../src/interpreter/interpreter-assembler.cc | 28 + .../interpreter/interpreter-generator-tsa.cc | 8 +- .../src/interpreter/interpreter-generator.cc | 52 +- deps/v8/src/interpreter/interpreter.cc | 17 - deps/v8/src/json/json-parser.cc | 1 + deps/v8/src/json/json-stringifier.cc | 4 +- deps/v8/src/logging/counters-definitions.h | 3 + deps/v8/src/logging/log.cc | 3 + deps/v8/src/logging/runtime-call-stats.h | 1 - .../src/maglev/arm/maglev-assembler-arm-inl.h | 81 +- deps/v8/src/maglev/arm/maglev-ir-arm.cc | 86 +- .../maglev/arm64/maglev-assembler-arm64-inl.h | 115 +- deps/v8/src/maglev/arm64/maglev-ir-arm64.cc | 90 +- .../loong64/maglev-assembler-loong64-inl.h | 97 +- .../src/maglev/loong64/maglev-ir-loong64.cc | 88 +- deps/v8/src/maglev/maglev-assembler.cc | 136 +- deps/v8/src/maglev/maglev-assembler.h | 20 + deps/v8/src/maglev/maglev-basic-block.h | 19 +- deps/v8/src/maglev/maglev-compiler.cc | 2 +- .../maglev/maglev-concurrent-dispatcher.cc | 18 +- deps/v8/src/maglev/maglev-graph-builder.cc | 2580 ++++----- deps/v8/src/maglev/maglev-graph-builder.h | 181 +- deps/v8/src/maglev/maglev-graph-labeller.h | 4 +- deps/v8/src/maglev/maglev-graph-optimizer.cc | 377 +- deps/v8/src/maglev/maglev-graph-optimizer.h | 27 +- deps/v8/src/maglev/maglev-graph-printer.cc | 5 +- deps/v8/src/maglev/maglev-graph-processor.h | 17 + deps/v8/src/maglev/maglev-graph-verifier.h | 17 + deps/v8/src/maglev/maglev-graph.cc | 11 +- deps/v8/src/maglev/maglev-inlining.cc | 17 +- .../maglev/maglev-interpreter-frame-state.cc | 64 +- .../maglev/maglev-interpreter-frame-state.h | 170 +- deps/v8/src/maglev/maglev-ir.cc | 782 +-- deps/v8/src/maglev/maglev-ir.h | 857 ++- deps/v8/src/maglev/maglev-kna-processor.cc | 21 +- deps/v8/src/maglev/maglev-kna-processor.h | 19 +- .../src/maglev/maglev-known-node-aspects.cc | 291 +- .../v8/src/maglev/maglev-known-node-aspects.h | 109 +- deps/v8/src/maglev/maglev-loop-peeler.cc | 52 +- .../maglev-phi-representation-selector.cc | 146 +- ...maglev-post-hoc-optimizations-processors.h | 21 +- deps/v8/src/maglev/maglev-range-analysis.h | 9 +- deps/v8/src/maglev/maglev-range.h | 20 + deps/v8/src/maglev/maglev-reducer-inl.h | 1715 ++++-- deps/v8/src/maglev/maglev-reducer.h | 225 +- deps/v8/src/maglev/maglev-regalloc.cc | 15 +- deps/v8/src/maglev/maglev-truncation.h | 262 +- .../src/maglev/ppc/maglev-assembler-ppc-inl.h | 69 +- deps/v8/src/maglev/ppc/maglev-ir-ppc.cc | 128 +- .../maglev/riscv/maglev-assembler-riscv-inl.h | 165 +- .../maglev/riscv/maglev-assembler-riscv.cc | 1 - deps/v8/src/maglev/riscv/maglev-ir-riscv.cc | 134 +- .../maglev/s390/maglev-assembler-s390-inl.h | 71 +- deps/v8/src/maglev/s390/maglev-ir-s390.cc | 88 +- .../v8/src/maglev/turbolev-escape-analysis.cc | 162 +- deps/v8/src/maglev/turbolev-escape-analysis.h | 26 +- .../src/maglev/x64/maglev-assembler-x64-inl.h | 69 +- .../v8/src/maglev/x64/maglev-assembler-x64.cc | 16 +- deps/v8/src/maglev/x64/maglev-ir-x64.cc | 99 +- deps/v8/src/objects/abstract-code.h | 2 + deps/v8/src/objects/all-objects-inl.h | 9 +- deps/v8/src/objects/all-objects.h | 129 + deps/v8/src/objects/allocation-site-inl.h | 1 + deps/v8/src/objects/allocation-site.h | 5 + deps/v8/src/objects/arguments.h | 4 + deps/v8/src/objects/backing-store.cc | 47 +- deps/v8/src/objects/backing-store.h | 25 +- deps/v8/src/objects/bigint.h | 7 + deps/v8/src/objects/call-site-info.cc | 6 +- deps/v8/src/objects/code.h | 6 + .../src/objects/compilation-cache-table-inl.h | 1 + deps/v8/src/objects/compilation-cache-table.h | 2 + deps/v8/src/objects/contexts-inl.h | 6 - deps/v8/src/objects/contexts.h | 10 +- .../src/objects/cpp-heap-object-wrapper-inl.h | 9 + deps/v8/src/objects/cpp-heap-object-wrapper.h | 6 +- deps/v8/src/objects/data-handler.h | 2 + deps/v8/src/objects/debug-objects-inl.h | 16 + deps/v8/src/objects/debug-objects.h | 26 + deps/v8/src/objects/debug-objects.tq | 15 + deps/v8/src/objects/deoptimization-data.cc | 52 +- deps/v8/src/objects/deoptimization-data.h | 18 +- deps/v8/src/objects/dependent-code.h | 2 + deps/v8/src/objects/descriptor-array.h | 2 + deps/v8/src/objects/dictionary-inl.h | 2 +- deps/v8/src/objects/elements.cc | 63 +- deps/v8/src/objects/embedder-data-array.cc | 26 +- deps/v8/src/objects/embedder-data-array.h | 3 +- deps/v8/src/objects/embedder-data-slot-inl.h | 259 +- deps/v8/src/objects/embedder-data-slot.h | 147 +- deps/v8/src/objects/feedback-vector-inl.h | 23 +- deps/v8/src/objects/feedback-vector.cc | 23 + deps/v8/src/objects/feedback-vector.h | 19 +- deps/v8/src/objects/feedback-vector.tq | 2 +- deps/v8/src/objects/fixed-array-base.h | 6 +- deps/v8/src/objects/fixed-array.h | 21 +- deps/v8/src/objects/fixed-primitive-array.h | 3 + deps/v8/src/objects/foreign.h | 4 + deps/v8/src/objects/free-space.h | 2 + deps/v8/src/objects/hash-seed-wrapper.h | 2 + deps/v8/src/objects/hash-table.h | 14 +- deps/v8/src/objects/heap-object-set-map-inl.h | 3 +- deps/v8/src/objects/heap-object.h | 2 + deps/v8/src/objects/hole.h | 4 + deps/v8/src/objects/instance-type-checker.h | 10 +- deps/v8/src/objects/instance-type-inl.h | 56 +- deps/v8/src/objects/instance-type.h | 18 +- deps/v8/src/objects/instance-types-gen.h | 55 + deps/v8/src/objects/instruction-stream.cc | 6 + deps/v8/src/objects/instruction-stream.h | 2 + deps/v8/src/objects/intl-objects.cc | 18 +- deps/v8/src/objects/intl-objects.h | 30 +- deps/v8/src/objects/js-array-buffer-inl.h | 17 + deps/v8/src/objects/js-array-buffer.cc | 32 +- deps/v8/src/objects/js-array-buffer.h | 19 +- deps/v8/src/objects/js-array.h | 5 + .../src/objects/js-atomics-synchronization.h | 2 + deps/v8/src/objects/js-break-iterator-inl.h | 10 +- deps/v8/src/objects/js-break-iterator.cc | 6 +- deps/v8/src/objects/js-break-iterator.h | 6 +- deps/v8/src/objects/js-break-iterator.tq | 3 +- deps/v8/src/objects/js-collator-inl.h | 6 +- deps/v8/src/objects/js-collator.cc | 7 +- deps/v8/src/objects/js-collator.h | 6 +- deps/v8/src/objects/js-collator.tq | 2 +- deps/v8/src/objects/js-collection-iterator.h | 2 + deps/v8/src/objects/js-collection.h | 8 + .../src/objects/js-data-object-builder-inl.h | 1 + deps/v8/src/objects/js-date-time-format-inl.h | 22 +- deps/v8/src/objects/js-date-time-format.cc | 89 +- deps/v8/src/objects/js-date-time-format.h | 21 +- deps/v8/src/objects/js-date-time-format.tq | 8 +- deps/v8/src/objects/js-display-names-inl.h | 9 +- deps/v8/src/objects/js-display-names.cc | 12 +- deps/v8/src/objects/js-display-names.h | 6 +- deps/v8/src/objects/js-display-names.tq | 2 +- deps/v8/src/objects/js-disposable-stack.h | 2 + deps/v8/src/objects/js-duration-format-inl.h | 14 +- deps/v8/src/objects/js-duration-format.cc | 8 +- deps/v8/src/objects/js-duration-format.h | 13 +- deps/v8/src/objects/js-duration-format.tq | 4 +- deps/v8/src/objects/js-function-inl.h | 2 + deps/v8/src/objects/js-function.cc | 23 +- deps/v8/src/objects/js-function.h | 8 +- deps/v8/src/objects/js-generator.h | 2 + deps/v8/src/objects/js-interceptor-map.h | 2 + deps/v8/src/objects/js-iterator-helpers.h | 6 + deps/v8/src/objects/js-list-format-inl.h | 8 +- deps/v8/src/objects/js-list-format.cc | 8 +- deps/v8/src/objects/js-list-format.h | 6 +- deps/v8/src/objects/js-list-format.tq | 2 +- deps/v8/src/objects/js-locale-inl.h | 6 +- deps/v8/src/objects/js-locale.cc | 232 +- deps/v8/src/objects/js-locale.h | 6 +- deps/v8/src/objects/js-locale.tq | 2 +- deps/v8/src/objects/js-number-format-inl.h | 6 +- deps/v8/src/objects/js-number-format.cc | 13 +- deps/v8/src/objects/js-number-format.h | 7 +- deps/v8/src/objects/js-number-format.tq | 2 +- deps/v8/src/objects/js-objects.cc | 119 +- deps/v8/src/objects/js-objects.h | 36 +- deps/v8/src/objects/js-plural-rules-inl.h | 12 +- deps/v8/src/objects/js-plural-rules.cc | 19 +- deps/v8/src/objects/js-plural-rules.h | 13 +- deps/v8/src/objects/js-plural-rules.tq | 4 +- deps/v8/src/objects/js-proxy.h | 3 +- deps/v8/src/objects/js-regexp-inl.h | 23 + deps/v8/src/objects/js-regexp.cc | 28 +- deps/v8/src/objects/js-regexp.h | 57 + deps/v8/src/objects/js-regexp.tq | 4 + .../src/objects/js-relative-time-format-inl.h | 7 +- .../v8/src/objects/js-relative-time-format.cc | 11 +- deps/v8/src/objects/js-relative-time-format.h | 7 +- .../v8/src/objects/js-relative-time-format.tq | 3 +- deps/v8/src/objects/js-segment-iterator-inl.h | 8 +- deps/v8/src/objects/js-segment-iterator.cc | 7 +- deps/v8/src/objects/js-segment-iterator.h | 12 +- deps/v8/src/objects/js-segment-iterator.tq | 3 +- deps/v8/src/objects/js-segmenter-inl.h | 6 +- deps/v8/src/objects/js-segmenter.cc | 6 +- deps/v8/src/objects/js-segmenter.h | 6 +- deps/v8/src/objects/js-segmenter.tq | 2 +- deps/v8/src/objects/js-segments-inl.h | 10 +- deps/v8/src/objects/js-segments.cc | 7 +- deps/v8/src/objects/js-segments.h | 6 +- deps/v8/src/objects/js-segments.tq | 3 +- deps/v8/src/objects/js-struct.h | 2 + deps/v8/src/objects/js-temporal-helpers.cc | 1 + deps/v8/src/objects/js-temporal-objects-inl.h | 29 +- deps/v8/src/objects/js-temporal-objects.cc | 25 +- deps/v8/src/objects/js-temporal-objects.h | 42 +- deps/v8/src/objects/js-temporal-objects.tq | 17 +- deps/v8/src/objects/js-temporal-zoneinfo64.cc | 48 +- deps/v8/src/objects/keys.cc | 11 +- deps/v8/src/objects/literal-objects.h | 1 - deps/v8/src/objects/lookup-inl.h | 7 +- deps/v8/src/objects/lookup.cc | 15 +- deps/v8/src/objects/lookup.h | 2 + deps/v8/src/objects/managed-inl.h | 77 + deps/v8/src/objects/managed-type-id.h | 79 + deps/v8/src/objects/managed.cc | 15 + deps/v8/src/objects/managed.h | 187 +- deps/v8/src/objects/managed.tq | 8 + deps/v8/src/objects/map.cc | 13 + deps/v8/src/objects/map.h | 55 +- deps/v8/src/objects/microtask.h | 2 + deps/v8/src/objects/module.cc | 40 +- deps/v8/src/objects/module.h | 15 +- deps/v8/src/objects/name.h | 2 + deps/v8/src/objects/number-string-cache.h | 4 + deps/v8/src/objects/object-conversions-inl.h | 89 + deps/v8/src/objects/object-list-macros.h | 10 +- deps/v8/src/objects/object-macros-undef.h | 9 + deps/v8/src/objects/object-macros.h | 70 + .../objects/objects-body-descriptors-inl.h | 77 +- deps/v8/src/objects/objects-definitions.h | 4 +- deps/v8/src/objects/objects-inl.h | 82 +- deps/v8/src/objects/objects.cc | 36 +- deps/v8/src/objects/oddball-predicates-inl.h | 59 + deps/v8/src/objects/oddball.h | 10 + deps/v8/src/objects/option-utils.cc | 1 + deps/v8/src/objects/ordered-hash-table.cc | 1 + deps/v8/src/objects/ordered-hash-table.h | 2 + deps/v8/src/objects/pod-array.h | 4 + deps/v8/src/objects/primitive-heap-object.h | 2 + deps/v8/src/objects/promise.h | 2 + deps/v8/src/objects/property-details.h | 4 +- deps/v8/src/objects/prototype-info-inl.h | 4 +- deps/v8/src/objects/prototype-info.h | 2 + deps/v8/src/objects/regexp-match-info.h | 5 +- deps/v8/src/objects/scope-info-inl.h | 27 +- deps/v8/src/objects/scope-info.cc | 88 +- deps/v8/src/objects/scope-info.h | 28 +- deps/v8/src/objects/scope-info.tq | 9 + deps/v8/src/objects/script-inl.h | 47 +- deps/v8/src/objects/script.cc | 31 +- deps/v8/src/objects/script.h | 49 +- deps/v8/src/objects/script.tq | 8 +- .../v8/src/objects/shared-function-info-inl.h | 9 +- deps/v8/src/objects/shared-function-info.cc | 59 +- deps/v8/src/objects/shared-function-info.h | 13 +- deps/v8/src/objects/shared-function-info.tq | 3 - deps/v8/src/objects/simd.cc | 10 +- deps/v8/src/objects/slots-inl.h | 9 +- deps/v8/src/objects/slots.h | 3 + deps/v8/src/objects/source-text-module.cc | 36 +- deps/v8/src/objects/source-text-module.h | 12 +- deps/v8/src/objects/string-inl.h | 26 +- deps/v8/src/objects/string-set.h | 2 + deps/v8/src/objects/string.cc | 10 +- deps/v8/src/objects/string.h | 44 +- deps/v8/src/objects/struct-inl.h | 7 + deps/v8/src/objects/struct.h | 11 + deps/v8/src/objects/synthetic-module.cc | 35 +- deps/v8/src/objects/synthetic-module.h | 2 +- deps/v8/src/objects/templates.cc | 20 +- deps/v8/src/objects/templates.h | 4 + deps/v8/src/objects/transitions.h | 2 + deps/v8/src/objects/trusted-object.h | 4 + deps/v8/src/objects/turbofan-types.h | 1 + deps/v8/src/objects/turboshaft-types.h | 7 + deps/v8/src/objects/value-serializer.cc | 81 +- deps/v8/src/objects/value-serializer.h | 30 +- deps/v8/src/parsing/parse-info.cc | 18 +- deps/v8/src/parsing/parser-base.h | 64 +- deps/v8/src/parsing/parser.cc | 86 +- deps/v8/src/parsing/token.h | 4 + deps/v8/src/profiler/heap-profiler.cc | 2 + .../src/profiler/heap-snapshot-generator.cc | 159 +- .../v8/src/profiler/heap-snapshot-generator.h | 10 + deps/v8/src/profiler/output-stream-writer.h | 5 +- deps/v8/src/profiler/strings-storage.cc | 6 + deps/v8/src/profiler/strings-storage.h | 2 + .../loong64/regexp-macro-assembler-loong64.cc | 88 +- .../loong64/regexp-macro-assembler-loong64.h | 7 + .../mips64/regexp-macro-assembler-mips64.cc | 88 +- .../mips64/regexp-macro-assembler-mips64.h | 7 + deps/v8/src/regexp/regexp-compiler-tonode.cc | 194 +- deps/v8/src/regexp/regexp-compiler.cc | 990 ++-- deps/v8/src/regexp/regexp-compiler.h | 36 +- deps/v8/src/regexp/regexp-dotprinter.cc | 4 - deps/v8/src/regexp/regexp-macro-assembler.cc | 20 +- deps/v8/src/regexp/regexp-macro-assembler.h | 10 +- deps/v8/src/regexp/regexp-node-printer.cc | 3 - deps/v8/src/regexp/regexp-nodes.h | 165 +- deps/v8/src/regexp/regexp-parser.cc | 76 +- deps/v8/src/regexp/regexp.cc | 129 +- deps/v8/src/regexp/regexp.h | 33 +- .../riscv/regexp-macro-assembler-riscv.cc | 89 +- .../riscv/regexp-macro-assembler-riscv.h | 7 + .../regexp/x64/regexp-macro-assembler-x64.cc | 10 +- deps/v8/src/roots/roots.h | 34 +- deps/v8/src/roots/static-roots-intl-nowasm.h | 20 +- deps/v8/src/roots/static-roots-intl-wasm.h | 22 +- .../v8/src/roots/static-roots-nointl-nowasm.h | 20 +- deps/v8/src/roots/static-roots-nointl-wasm.h | 22 +- deps/v8/src/runtime/runtime-array.cc | 1 + deps/v8/src/runtime/runtime-compiler.cc | 65 +- deps/v8/src/runtime/runtime-debug.cc | 71 +- deps/v8/src/runtime/runtime-internal.cc | 33 +- deps/v8/src/runtime/runtime-literals.cc | 1 + deps/v8/src/runtime/runtime-numbers.cc | 1 + deps/v8/src/runtime/runtime-object.cc | 18 +- deps/v8/src/runtime/runtime-regexp.cc | 110 +- deps/v8/src/runtime/runtime-scopes.cc | 13 +- deps/v8/src/runtime/runtime-test-wasm.cc | 19 +- deps/v8/src/runtime/runtime-test.cc | 56 +- deps/v8/src/runtime/runtime-wasm.cc | 61 +- deps/v8/src/runtime/runtime.h | 20 +- deps/v8/src/sandbox/OWNERS | 1 + deps/v8/src/sandbox/bytecode-verifier.cc | 15 +- .../src/sandbox/cppheap-pointer-table-inl.h | 16 + deps/v8/src/sandbox/cppheap-pointer-table.h | 9 + .../src/sandbox/external-entity-table-inl.h | 85 +- deps/v8/src/sandbox/external-entity-table.h | 25 +- deps/v8/src/sandbox/external-pointer-inl.h | 66 +- .../src/sandbox/external-pointer-table-inl.h | 82 +- deps/v8/src/sandbox/external-pointer-table.h | 17 +- deps/v8/src/sandbox/external-pointer.h | 13 + .../sandbox/generated-code-validator-arm64.cc | 451 +- .../sandbox/generated-code-validator-x64.cc | 291 +- .../src/sandbox/generated-code-validator.cc | 152 +- .../v8/src/sandbox/generated-code-validator.h | 48 +- deps/v8/src/sandbox/isolate.h | 17 + deps/v8/src/sandbox/js-dispatch-table-inl.h | 15 - deps/v8/src/sandbox/js-dispatch-table.h | 15 - deps/v8/src/sandbox/segmented-table-inl.h | 88 + deps/v8/src/sandbox/segmented-table.cc | 169 + deps/v8/src/sandbox/segmented-table.h | 417 ++ deps/v8/src/sandbox/testing.cc | 14 + deps/v8/src/snapshot/code-serializer.cc | 2 +- deps/v8/src/snapshot/context-deserializer.cc | 1 + deps/v8/src/snapshot/deserializer.cc | 25 +- deps/v8/src/snapshot/deserializer.h | 9 + deps/v8/src/snapshot/object-deserializer.cc | 13 +- deps/v8/src/snapshot/object-deserializer.h | 3 + .../v8/src/snapshot/read-only-deserializer.cc | 1 + deps/v8/src/snapshot/read-only-serializer.cc | 24 +- deps/v8/src/snapshot/serializer.cc | 53 +- .../src/snapshot/shared-heap-deserializer.cc | 1 + deps/v8/src/snapshot/startup-deserializer.cc | 1 + deps/v8/src/strings/string-stream.cc | 1 + deps/v8/src/strings/unicode.h | 60 + deps/v8/src/torque/constants.h | 9 +- deps/v8/src/torque/implementation-visitor.cc | 30 +- deps/v8/src/torque/instance-type-generator.cc | 299 +- deps/v8/src/torque/torque-parser.cc | 4 + deps/v8/src/torque/types.h | 3 + deps/v8/src/tracing/code-data-source.cc | 5 +- deps/v8/src/utils/address-map.cc | 4 +- deps/v8/src/utils/boxed-float.h | 9 +- .../arm64/liftoff-assembler-arm64-inl.h | 6 +- .../ia32/liftoff-assembler-ia32-inl.h | 16 +- deps/v8/src/wasm/baseline/liftoff-assembler.h | 22 + deps/v8/src/wasm/baseline/liftoff-compiler.cc | 274 +- .../loong64/liftoff-assembler-loong64-inl.h | 24 +- .../mips64/liftoff-assembler-mips64-inl.h | 4 +- .../baseline/ppc/liftoff-assembler-ppc-inl.h | 2 +- .../riscv/liftoff-assembler-riscv-inl.h | 48 +- .../riscv/liftoff-assembler-riscv64-inl.h | 85 +- .../baseline/x64/liftoff-assembler-x64-inl.h | 75 +- deps/v8/src/wasm/c-api.cc | 42 +- deps/v8/src/wasm/canonical-types.cc | 54 +- deps/v8/src/wasm/canonical-types.h | 12 +- deps/v8/src/wasm/compilation-environment.h | 12 - .../src/wasm/constant-expression-interface.cc | 12 +- deps/v8/src/wasm/effect-handler.h | 6 +- deps/v8/src/wasm/function-body-decoder-impl.h | 30 + .../wasm/fuzzing/random-module-generation.cc | 38 +- .../riscv/interpreter-builtins-riscv.cc | 19 +- .../interpreter/wasm-interpreter-runtime.cc | 77 +- .../wasm/interpreter/wasm-interpreter-simd.cc | 4 +- .../src/wasm/interpreter/wasm-interpreter.cc | 105 +- .../src/wasm/interpreter/wasm-interpreter.h | 53 +- deps/v8/src/wasm/jump-table-assembler.cc | 41 +- deps/v8/src/wasm/jump-table-assembler.h | 4 +- deps/v8/src/wasm/module-compiler.cc | 17 +- deps/v8/src/wasm/module-decoder-impl.h | 6 + deps/v8/src/wasm/module-instantiate.cc | 60 +- deps/v8/src/wasm/stacks.cc | 135 +- deps/v8/src/wasm/stacks.h | 17 +- deps/v8/src/wasm/streaming-decoder.h | 9 + .../v8/src/wasm/turboshaft-graph-interface.cc | 89 +- deps/v8/src/wasm/wasm-builtin-list.h | 1 - deps/v8/src/wasm/wasm-code-manager.cc | 21 +- deps/v8/src/wasm/wasm-code-manager.h | 14 +- .../v8/src/wasm/wasm-code-pointer-table-inl.h | 2 +- deps/v8/src/wasm/wasm-code-pointer-table.cc | 6 +- deps/v8/src/wasm/wasm-code-pointer-table.h | 2 +- deps/v8/src/wasm/wasm-constants.h | 4 + deps/v8/src/wasm/wasm-debug.cc | 11 +- deps/v8/src/wasm/wasm-engine.cc | 19 +- deps/v8/src/wasm/wasm-engine.h | 1 + deps/v8/src/wasm/wasm-external-refs.cc | 1 + deps/v8/src/wasm/wasm-feature-flags.h | 145 - deps/v8/src/wasm/wasm-features.h | 16 +- deps/v8/src/wasm/wasm-js.cc | 101 +- deps/v8/src/wasm/wasm-js.h | 7 +- .../v8/src/wasm/wasm-memory-map-descriptor.cc | 18 +- deps/v8/src/wasm/wasm-module.cc | 6 +- deps/v8/src/wasm/wasm-objects-inl.h | 67 +- deps/v8/src/wasm/wasm-objects.cc | 322 +- deps/v8/src/wasm/wasm-objects.h | 192 +- deps/v8/src/wasm/wasm-objects.tq | 31 +- deps/v8/src/wasm/wasm-opcodes.h | 1 + deps/v8/src/wasm/wasm-subtyping.cc | 8 +- deps/v8/test/BUILD.gn | 1 + deps/v8/test/cctest/BUILD.gn | 2 +- deps/v8/test/cctest/cctest.h | 7 +- deps/v8/test/cctest/cctest.status | 134 +- .../cctest/compiler/test-code-generator.cc | 1 + .../cctest/compiler/test-js-typed-lowering.cc | 1 - .../cctest/compiler/test-multiple-return.cc | 2 +- .../compiler/turboshaft-test-simd-shift.cc | 382 ++ deps/v8/test/cctest/heap/heap-tester.h | 5 - deps/v8/test/cctest/heap/test-heap.cc | 4638 +---------------- deps/v8/test/cctest/test-api-interceptors.cc | 68 +- deps/v8/test/cctest/test-api-stack-traces.cc | 28 - deps/v8/test/cctest/test-api-typed-array.cc | 1 + deps/v8/test/cctest/test-api.cc | 370 +- deps/v8/test/cctest/test-api.h | 6 + .../test/cctest/test-code-stub-assembler.cc | 1 + deps/v8/test/cctest/test-cpu-profiler.cc | 43 + deps/v8/test/cctest/test-debug.cc | 217 +- deps/v8/test/cctest/test-heap-profiler.cc | 94 +- .../cctest/test-inobject-slack-tracking.cc | 1 + deps/v8/test/cctest/test-liveedit.cc | 566 -- deps/v8/test/cctest/test-regexp.cc | 8 +- deps/v8/test/cctest/test-serialize.cc | 92 +- deps/v8/test/cctest/test-usecounters.cc | 104 + .../cctest/wasm/test-compilation-cache.cc | 8 +- deps/v8/test/cctest/wasm/test-fuzzer-steps.cc | 6 +- .../test/cctest/wasm/test-run-wasm-module.cc | 2 +- .../v8/test/cctest/wasm/test-run-wasm-simd.cc | 182 + .../cctest/wasm/test-streaming-compilation.cc | 10 +- .../test/cctest/wasm/test-wasm-breakpoints.cc | 2 +- deps/v8/test/cctest/wasm/test-wasm-metrics.cc | 6 +- .../cctest/wasm/test-wasm-serialization.cc | 18 +- deps/v8/test/common/types-fuzz.h | 1 + deps/v8/test/common/wasm/fuzzer-common.cc | 29 +- deps/v8/test/common/wasm/fuzzer-common.h | 1 - deps/v8/test/common/wasm/wasm-run-utils.cc | 3 +- deps/v8/test/common/wasm/wasm-run-utils.h | 1 + .../debugger/debug/debug-evaluate-closure.js | 2 + .../debugger/debug/debug-evaluate-locals.js | 3 + .../debug/debug-evaluate-nested-let.js | 2 + .../debug-evaluate-shadowed-context-reuse.js | 45 + .../debug/debug-evaluate-shadowed-context.js | 45 + .../test/debugger/debug/debug-liveedit-1.js | 45 - .../test/debugger/debug/debug-liveedit-2.js | 57 - .../test/debugger/debug/debug-liveedit-3.js | 63 - .../test/debugger/debug/debug-liveedit-4.js | 64 - .../debug-liveedit-arrow-function-at-start.js | 13 - .../debug/debug-liveedit-check-stack.js | 142 - .../debug/debug-liveedit-compile-error.js | 50 - .../debugger/debug/debug-liveedit-eval.js | 23 - .../debugger/debug/debug-liveedit-inline.js | 27 - .../debugger/debug/debug-liveedit-literals.js | 88 - .../debug/debug-liveedit-newsource.js | 71 - .../debug-liveedit-patch-positions-replace.js | 76 - .../debug/debug-liveedit-recursion.js | 42 - .../debug/debug-modules-many-variables.mjs | 162 + .../debug/es6/debug-liveedit-new-target-1.js | 87 - .../debug/es6/debug-liveedit-new-target-2.js | 75 - .../debug/es6/debug-liveedit-new-target-3.js | 88 - .../debugger/debug/futex-reentrant-wait.js | 35 + .../regress-debug-scopes-context-blocklist.js | 69 + deps/v8/test/debugger/debugger.status | 8 - deps/v8/test/debugger/test-api.js | 5 +- deps/v8/test/filecheck/filecheck.status | 1 + .../crash/invalid-wasm-code-space-size.js | 6 + .../invalid-wasm-code-space-size-fuzzing.js | 6 + deps/v8/test/fuzzer/wasm/deopt.cc | 1 - deps/v8/test/fuzzer/wasm/init-expr.cc | 3 +- .../wasm/interpreter/interpreter-diff.cc | 1 - .../interpreter/interpreter-fuzzer-common.cc | 52 +- .../wasm/interpreter/interpreter-init-expr.cc | 1 - deps/v8/test/fuzzer/wasm/module.cc | 1 - deps/v8/test/fuzzer/wasm/streaming.cc | 2 +- .../untrusted-session-expected.txt | 3 + .../cpu-profiler/untrusted-session.js | 20 + .../debugger/es6-module-liveedit-expected.txt | 15 - .../inspector/debugger/es6-module-liveedit.js | 52 - ...evaluate-on-call-frame-scopes-expected.txt | 34 + .../debugger/evaluate-on-call-frame-scopes.js | 65 + ...ght-exception-in-module-async-expected.txt | 7 + ...use-on-caught-exception-in-module-async.js | 18 + ...on-caught-exception-in-module-expected.txt | 7 + .../pause-on-caught-exception-in-module.js | 18 + ...-on-exception-in-module-async-expected.txt | 7 + .../pause-on-exception-in-module-async.js | 18 + .../pause-on-exception-in-module-expected.txt | 7 + ...-exception-in-module-imported-expected.txt | 7 + .../pause-on-exception-in-module-imported.js | 19 + .../debugger/pause-on-exception-in-module.js | 18 + .../pause-on-oom-in-eval-expected.txt | 2 + .../debugger/pause-on-oom-in-eval.js | 40 + .../restart-osr-frame-expected.txt | 18 + .../restart-frame/restart-osr-frame.js | 41 + ...set-breakpoint-after-liveedit-expected.txt | 17 - .../debugger/set-breakpoint-after-liveedit.js | 41 - ...script-source-active-function-expected.txt | 16 - .../set-script-source-active-function.js | 45 - ...source-debug-evaluate-closure-expected.txt | 16 - ...et-script-source-debug-evaluate-closure.js | 66 - .../set-script-source-es-module-expected.txt | 9 - .../debugger/set-script-source-es-module.js | 39 - .../set-script-source-exception-expected.txt | 24 - .../debugger/set-script-source-exception.js | 28 - .../debugger/set-script-source-expected.txt | 17 +- .../set-script-source-repl-mode-expected.txt | 2 - .../debugger/set-script-source-repl-mode.js | 36 - .../set-script-source-top-frame-expected.txt | 30 - ...e-with-additional-activations-expected.txt | 21 - ...e-top-frame-with-additional-activations.js | 53 - .../debugger/set-script-source-top-frame.js | 70 - .../set-script-source-unchanged-expected.txt | 1 - .../debugger/set-script-source-unchanged.js | 18 - .../inspector/debugger/set-script-source.js | 30 +- ...ling-heap-profiler-call-stack-expected.txt | 2 + .../sampling-heap-profiler-call-stack.js | 3 + deps/v8/test/inspector/inspector-test.cc | 10 +- deps/v8/test/inspector/inspector.status | 5 +- deps/v8/test/inspector/isolate-data.cc | 33 +- deps/v8/test/inspector/isolate-data.h | 5 +- deps/v8/test/inspector/protocol-test.js | 10 +- .../regress-crbug-1195927-expected.txt | 27 - .../regress/regress-crbug-1195927.js | 56 - .../regress-crbug-1197392-expected.txt | 7 + .../regress/regress-crbug-1197392.js | 4 +- .../regress-crbug-1328453-expected.txt | 7 - .../regress/regress-crbug-1328453.js | 32 - .../runtime/custom-preview-proxy-expected.txt | 91 + .../inspector/runtime/custom-preview-proxy.js | 115 + .../deep-serialization-errors-expected.txt | 106 + .../runtime/deep-serialization-errors.js | 64 + .../error-preview-sideeffects-expected.txt | 12 + .../runtime/error-preview-sideeffects.js | 74 + ...de-effect-free-monitor-events-expected.txt | 6 + ...valuate-side-effect-free-monitor-events.js | 60 + ...import-defer-module-namespace-expected.txt | 361 ++ ...efer-module-namespace-subtype-expected.txt | 28 + .../import-defer-module-namespace-subtype.js | 99 + .../runtime/import-defer-module-namespace.js | 156 + .../runtime/preview-sideeffects-expected.txt | 5 + .../inspector/runtime/preview-sideeffects.js | 25 + .../runtime/regress-520052954-2-expected.txt | 4 + .../inspector/runtime/regress-520052954-2.js | 63 + .../runtime/regress-520052954-3-expected.txt | 4 + .../inspector/runtime/regress-520052954-3.js | 59 + .../runtime/regress-523442920-expected.txt | 2 + .../inspector/runtime/regress-523442920.js | 32 + .../regress-custom-preview-uaf-expected.txt | 1 + .../runtime/regress-custom-preview-uaf.js | 33 + deps/v8/test/inspector/tasks.cc | 2 +- deps/v8/test/inspector/tasks.h | 4 +- .../intl/date-format/temporal-cjk-format.js | 30 + .../test/intl/date-format/year-woy-field.js | 26 + deps/v8/test/intl/intl.status | 5 + .../fail/d8-trace-config-invalid.bad-json | 1 + .../message/fail/d8-trace-config-invalid.js | 7 + .../message/fail/d8-trace-config-invalid.out | 6 + .../message/fail/d8-trace-config-missing.js | 5 + .../message/fail/d8-trace-config-missing.out | 1 + .../fail/modules-import-redeclare4.mjs | 6 + .../fail/modules-import-redeclare4.out | 5 + deps/v8/test/message/message.status | 16 +- deps/v8/test/message/wasm-trace-deopt-32.out | 2 +- deps/v8/test/message/wasm-trace-deopt-64.out | 2 +- .../mjsunit/additive-safe-int-feedback.js | 372 +- .../array-indexof-dictionary-elements.js | 84 + .../v8/test/mjsunit/array-lastindexof-fast.js | 153 + deps/v8/test/mjsunit/array-reduce.js | 2 + .../mjsunit/baseline/test-osr-maglev-tf.js | 2 +- .../test/mjsunit/compiler/dataview-deopt.js | 14 + deps/v8/test/mjsunit/compiler/dataview-get.js | 6 + deps/v8/test/mjsunit/compiler/dataview-set.js | 2 + .../test/mjsunit/compiler/no-stack-checks.js | 54 + .../mjsunit/compiler/regress-542923494.js | 31 + .../compiler/script-context-const-load.js | 26 + .../compiler/script-context-let-load.js | 26 + deps/v8/test/mjsunit/console.js | 24 + ...acking-let-wont-prevent-osr-to-turbofan.js | 3 +- deps/v8/test/mjsunit/cross-realm-callsite.js | 72 + .../test/mjsunit/d8/d8-code-cache-import.js | 7 + .../d8/d8-code-cache-module-after-execute.mjs | 23 + .../d8/d8-code-cache-module-compile-only.mjs | 12 + .../mjsunit/d8/d8-code-cache-module-dep.mjs | 7 + .../d8/d8-code-cache-module-import.mjs | 7 + .../test/mjsunit/d8/d8-code-cache-module.mjs | 19 + .../mjsunit/d8/d8-console-assert-terminate.js | 11 + .../d8-inspector-shutdown-pending-evaluate.js | 16 + .../test/mjsunit/d8/d8-test-access-check.js | 64 + .../v8/test/mjsunit/d8/d8-test-interceptor.js | 42 + .../test/mjsunit/d8/d8-test-special-object.js | 53 + deps/v8/test/mjsunit/d8/d8-tostring-errors.js | 54 + deps/v8/test/mjsunit/debug-osr-debug-break.js | 44 + .../mjsunit/debug-osr-step-in-blackboxed.js | 64 + .../debug-osr-step-on-throw-blackboxed.js | 62 + .../test/mjsunit/debug-osr-step-on-throw.js | 58 + deps/v8/test/mjsunit/debug-osr-step-out.js | 52 + .../v8/test/mjsunit/es6/iterator-prototype.js | 2 +- deps/v8/test/mjsunit/frozen-array-reduce.js | 2 + ...et-current-frame-optimization-status-02.js | 1 + .../async-iterator-prototype-async-dispose.js | 25 + .../harmony/base64-from-hex-long-inputs.js | 2 +- .../base64-from-hex-with-two-byte-strings.js | 2 +- .../base64-from-to-base64-null-option.js | 2 - ...rototype-to-hex-fill-with-maximum-value.js | 2 - .../base64-prototype-to-hex-long-inputs.js | 2 - .../test/mjsunit/harmony/bigint/mod-fold.js | 216 + .../test/mjsunit/harmony/iterator-includes.js | 43 +- .../mjsunit/harmony/iterator-zip-keyed.js | 36 + deps/v8/test/mjsunit/harmony/iterator-zip.js | 35 + .../modules-import-attributes-text.mjs | 3 - ...odules-import-defer-get-private-member.mjs | 23 + ...ort-defer-own-property-keys-no-exports.mjs | 17 + ...ules-import-defer-sync-eval-async-cycle.js | 75 + ...es-import-defer-throws-in-api-callback.mjs | 36 + .../modules-skip-import-defer-no-exports.mjs | 8 + ...les-skip-import-defer-throws-primitive.mjs | 15 + .../harmony/regress/regress-416166113.js | 2 +- .../harmony/regress/regress-416302802.js | 2 - .../harmony/regress/regress-418804470.js | 2 - .../harmony/regress/regress-421227542.js | 2 +- .../harmony/regress/regress-499254994.js | 2 - .../harmony/regress/regress-499254996.mjs | 2 - ...-set-from-base64-on-shared-array-buffer.js | 2 +- ...ray-set-from-hex-on-shared-array-buffer.js | 2 +- ...-array-to-base64-on-shared-array-buffer.js | 2 +- ...nt8-array-to-hex-on-shared-array-buffer.js | 2 +- .../harmony/uint8array-base64-immutable.js | 2 +- deps/v8/test/mjsunit/homomorphic-array-smi.js | 34 +- deps/v8/test/mjsunit/homomorphic-ic.js | 6 +- .../regress/regress-561323344.js | 55 + .../maglev/call-with-spread-jsarray.js | 259 + .../call-with-spread-object-tracking.js | 38 + .../test/mjsunit/maglev/check-int32-is-smi.js | 31 + .../collection-iterator-next-inlined.js | 96 + .../maglev/collection-iterator-next.js | 357 ++ .../constant-typed-array-store-double.js | 21 + .../mjsunit/maglev/float64-conversions.js | 351 ++ .../maglev/generator-next-cross-realm.js | 126 + .../holey-double-store-canonicalization.js | 153 + .../maglev/holey-double-unsilenced-exit.js | 115 + .../v8/test/mjsunit/maglev/int32-mod-range.js | 77 + .../maglev/keyed-access-thin-constant-key.js | 35 + deps/v8/test/mjsunit/maglev/loop-preheader.js | 194 + .../mjsunit/maglev/map-iterator-creation.js | 46 + .../mjsunit/maglev/optimize-large-function.js | 21 + .../maglev/osr-from-ml-to-tf-mode-1.js | 63 + .../test/mjsunit/maglev/osr-from-ml-to-tf.js | 3 +- .../test/mjsunit/maglev/osr-multiple-loops.js | 36 + .../test/mjsunit/maglev/osr-only-interrupt.js | 27 + deps/v8/test/mjsunit/maglev/osr-to-tf.js | 3 +- .../mjsunit/maglev/promise-catch-reduction.js | 162 + .../test/mjsunit/maglev/regress-394119934.js | 35 + .../test/mjsunit/maglev/regress-536945254.js | 1 + .../test/mjsunit/maglev/regress-538562119.js | 64 + .../mjsunit/maglev/regress-538884561-1.js | 30 + .../mjsunit/maglev/regress-538884561-2.js | 33 + .../test/mjsunit/maglev/regress-539121142.js | 43 + .../test/mjsunit/maglev/regress-540467501.js | 20 + .../test/mjsunit/maglev/regress-540905585.js | 24 + .../test/mjsunit/maglev/regress-543919179.js | 22 + .../test/mjsunit/maglev/regress-544053478.js | 24 + .../test/mjsunit/maglev/regress-547330043.js | 53 + .../test/mjsunit/maglev/regress-551265173.js | 29 + .../test/mjsunit/maglev/regress-552832446.js | 24 + .../test/mjsunit/maglev/regress-556962428.js | 25 + .../mjsunit/maglev/regress-int32mod-cse.js | 21 + .../maglev/regress-truncated-int32-product.js | 40 + .../maglev/regress-truncated-region-bound.js | 45 + .../regress-truncated-region-operand.js | 44 + .../maglev/regress-yield-star-lazy-deopt.js | 38 + .../maglev/regress/regress-546472719.js | 23 + .../maglev/regress/regress-546792433.js | 101 + .../maglev/regress/regress-551320574.js | 85 + .../maglev/regress/regress-552783942.js | 98 + .../array-iterator-modification-1.js | 2 +- .../array-iterator-modification-2.js | 2 +- .../v8/test/mjsunit/math-sum-precise/basic.js | 2 +- .../test/mjsunit/math-sum-precise/closing.js | 2 - .../v8/test/mjsunit/math-sum-precise/holey.js | 2 - .../test/mjsunit/math-sum-precise/holey2.js | 2 - .../iterator-clear-on-error.js | 2 - .../math-sum-precise/regress-494013010.js | 2 - .../math-sum-precise/regress-513719178.js | 2 - .../test/mjsunit/math-sum-precise/regress.js | 2 +- .../set-iterator-clear-on-error.js | 2 - .../mjsunit/math-sum-precise/set-regress.js | 2 - .../mjsunit/math-sum-precise/set-regress2.js | 2 - .../typed-array-iterator-modification-1.js | 2 +- .../typed-array-iterator-modification-2.js | 2 +- .../typed-array-iterator-modification-3.js | 2 +- .../typed-array-iterator-modification-4.js | 2 +- deps/v8/test/mjsunit/mjsunit.status | 508 +- .../mjsunit/modules-many-bindings-lazy.mjs | 457 ++ .../mjsunit/modules-skip-many-bindings.mjs | 411 ++ .../mjsunit/non-extensible-array-reduce.js | 2 + .../proto-seq-opt-arrow-function.js | 5 + ...proto-seq-opt-assign-key-multiple-times.js | 5 + .../proto-seq-opt-before-after.js | 5 + .../proto-seq-opt-class-fast-path.js | 5 + .../proto-seq-opt-frozen-objects-strict.js | 5 + .../proto-seq-opt-frozen-objects.js | 5 + .../proto-seq-opt-function-fast-path.js | 5 + ...to-seq-opt-get-own-property-descriptors.js | 5 + .../proto-seq-opt-has-prototype-keys.js | 5 + .../proto-seq-opt-has-setters.js | 5 + .../opt-proto-seq/proto-seq-opt-iife.js | 5 + .../proto-seq-opt-locked-proto-strict.js | 5 + .../proto-seq-opt-locked-proto.js | 5 + ...o-seq-opt-non-extensible-objects-strict.js | 5 + .../proto-seq-opt-non-extensible-objects.js | 5 + .../proto-seq-opt-not-proto-assign-seq.js | 5 + .../proto-seq-opt-object-assign.js | 5 + .../proto-seq-opt-poison-default-proto.js | 5 + .../proto-seq-opt-preserve-descriptor.js | 5 + ...oto-seq-opt-proto-of-prototype-assigned.js | 5 + .../proto-seq-opt-prototype-proto-keys.js | 5 + .../proto-seq-opt-prototype-read-only.js | 5 + .../proto-seq-opt-variable-proxy-eval.js | 7 +- .../proto-seq-opt-variable-proxy.js | 9 +- deps/v8/test/mjsunit/regexp-modifiers.js | 43 + .../mjsunit/regexp-split-cache-disabled.js | 10 + deps/v8/test/mjsunit/regexp-split-cache-gc.js | 21 + deps/v8/test/mjsunit/regexp-split-cache.js | 147 + deps/v8/test/mjsunit/regexp/drain.js | 12 +- .../regexp/first-character-reject-bitset.js | 234 + deps/v8/test/mjsunit/regress-414738826.js | 1 + ...les-import-defer-cross-realm-synthetic.mjs | 2 +- .../test/mjsunit/regress/regress-42204525.js | 26 + .../test/mjsunit/regress/regress-450237486.js | 13 + .../test/mjsunit/regress/regress-476989751.js | 139 + .../test/mjsunit/regress/regress-504697280.js | 8 + .../test/mjsunit/regress/regress-514071819.js | 14 +- .../mjsunit/regress/regress-531513399-1.js | 21 + .../mjsunit/regress/regress-531513399-2.js | 30 + .../mjsunit/regress/regress-531513399-3.js | 26 + .../mjsunit/regress/regress-531513399-4.js | 16 + .../mjsunit/regress/regress-531513399-5.js | 24 + .../test/mjsunit/regress/regress-532595489.js | 4 +- .../test/mjsunit/regress/regress-533049459.js | 12 + .../test/mjsunit/regress/regress-533926191.js | 11 + .../mjsunit/regress/regress-538529872-2.js | 28 + .../test/mjsunit/regress/regress-538529872.js | 58 + .../test/mjsunit/regress/regress-539212794.js | 66 + ...ress-539350801-long-chain-int32-operand.js | 34 + .../regress/regress-539350801-long-chain.js | 31 + .../regress/regress-539350801-nine-terms.js | 39 + .../test/mjsunit/regress/regress-539350801.js | 40 + .../test/mjsunit/regress/regress-540471948.js | 41 + .../test/mjsunit/regress/regress-540482886.js | 58 + .../test/mjsunit/regress/regress-541491578.js | 27 + .../test/mjsunit/regress/regress-542377192.js | 16 + .../test/mjsunit/regress/regress-542636068.js | 56 + .../test/mjsunit/regress/regress-544223867.js | 10 + .../test/mjsunit/regress/regress-545767601.js | 34 + .../test/mjsunit/regress/regress-546308452.js | 31 + .../test/mjsunit/regress/regress-546370262.js | 16 + .../test/mjsunit/regress/regress-546665034.js | 50 + .../test/mjsunit/regress/regress-546815249.js | 85 + .../mjsunit/regress/regress-547027738-wasm.js | 68 + .../test/mjsunit/regress/regress-547027738.js | 45 + .../test/mjsunit/regress/regress-547982135.js | 30 + .../test/mjsunit/regress/regress-549226708.js | 38 + .../test/mjsunit/regress/regress-549231120.js | 54 + .../test/mjsunit/regress/regress-551047528.js | 14 + .../test/mjsunit/regress/regress-551186503.js | 13 + .../test/mjsunit/regress/regress-557062659.js | 9 + .../test/mjsunit/regress/regress-558005441.js | 14 + .../test/mjsunit/regress/regress-558186672.js | 10 + .../test/mjsunit/regress/regress-558280524.js | 55 + .../test/mjsunit/regress/regress-559580852.js | 19 + .../test/mjsunit/regress/regress-559756520.js | 16 + .../test/mjsunit/regress/regress-563235411.js | 50 + .../test/mjsunit/regress/regress-563716534.js | 17 + .../test/mjsunit/regress/regress-567538973.js | 43 + .../mjsunit/regress/regress-crbug-1440685.js | 6 +- .../mjsunit/regress/regress-crbug-1509910.js | 2 - .../regress/regress-crbug-514165662.js | 56 + .../regress/regress-crbug-542403045.js | 3 + .../regress/regress-crbug-552342545.js | 24 + .../regress/regress-crbug-560233248.js | 77 + .../regress-fast-api-uint64-negative.js | 51 + ...regress-fast-path-zero-exclusion-object.js | 30 + .../regress/regress-homomorphic-maglev.js | 61 + .../regress/regress-homomorphic-turbofan.js | 61 + .../regress-homomorphic-unoptimized.js | 47 + .../regress/regress-parse-only-stress-runs.js | 11 + .../mjsunit/regress/regress-rab-proto-oob.js | 37 + .../regress/regress-value-serializer.js | 12 + .../mjsunit/regress/wasm/regress-433984397.js | 18 +- .../mjsunit/regress/wasm/regress-448404198.js | 2 +- .../mjsunit/regress/wasm/regress-502030575.js | 33 +- .../mjsunit/regress/wasm/regress-526163463.js | 39 + .../mjsunit/regress/wasm/regress-535659723.js | 50 + .../mjsunit/regress/wasm/regress-540446645.js | 51 + .../mjsunit/regress/wasm/regress-541316788.js | 37 + .../mjsunit/regress/wasm/regress-543901836.js | 42 + .../mjsunit/regress/wasm/regress-550812031.js | 18 + .../mjsunit/regress/wasm/regress-552026580.js | 33 + .../mjsunit/regress/wasm/regress-554714206.js | 18 + .../mjsunit/regress/wasm/regress-555812363.js | 33 + .../mjsunit/regress/wasm/regress-558539954.js | 183 + .../regress-drumbrake-unreachable-cast.js | 243 + .../regress-interpreter-failed-reentry.js | 87 + .../regress/wasm/regress-simd-526303932.js | 26 + .../regress/wasm/regress-simd-547572465.js | 51 + .../regress/wasm/regress-simd-549328680-2.js | 33 + .../regress/wasm/regress-simd-549328680.js | 33 + .../regress/wasm/regress-simd-555760230.js | 76 + .../regress/wasm/regress-simd-555806042-2.js | 107 + .../regress/wasm/regress-simd-555806042.js | 76 + .../regress/wasm/regress-simd-557106111.js | 103 + .../regress/wasm/regress-simd-557107091.js | 82 + .../regress/wasm/regress-simd-557107349.js | 98 + .../test/mjsunit/sandbox/regress-530292681.js | 61 + .../test/mjsunit/sandbox/regress-535892918.js | 44 + .../test/mjsunit/sandbox/regress-540033151.js | 51 + .../test/mjsunit/sandbox/regress-554034656.js | 39 + .../sandbox/regress/regress-512160117.js | 2 +- .../sandbox/regress/regress-532204454.js | 90 + .../sandbox/regress/regress-546253900.js | 121 + .../regress/regress-561655173-completion.js | 137 + .../sandbox/regress/regress-561655173.js | 33 + deps/v8/test/mjsunit/sealed-array-reduce.js | 2 + .../regress/regress-541880797.js | 10 + .../mjsunit/string-localecompare-inline.js | 37 + .../tools/tickprocessor-test-large.log | 8 +- .../turbolev/array-holey-double-load.js | 11 +- .../mjsunit/turbolev/check-uint32-is-smi.js | 25 + .../mjsunit/turbolev/dataview-deopt-oob.js | 67 + ...scape-analysis-inside-loop-phi-backedge.js | 41 + ...e-analysis-loop-phi-backedge-dependency.js | 35 + .../escape-analysis-nested-loop-revisit.js | 31 + .../escape-analysis-regreee-540324228.js | 25 + .../escape-analysis-regress-538666333.js | 49 + .../escape-analysis-regress-539464276.js | 40 + .../escape-analysis-regress-542377197.js | 17 + .../escape-analysis-regress-543940209.js | 29 + .../escape-analysis-regress-544548648.js | 29 + .../turbolev/holey-double-load-arith.js | 108 + .../turbolev/holey-double-phi-distinguish.js | 44 + .../keyed-access-thin-constant-key.js | 35 + .../turbolev/module-export-loop-peel.js | 40 + .../mjsunit/turbolev/regress-533979617.js | 28 + .../mjsunit/turbolev/regress-538938804.js | 33 + .../mjsunit/turbolev/regress-539006995-1.js | 22 + .../mjsunit/turbolev/regress-539006995-2.js | 22 + .../mjsunit/turbolev/regress-539006995-3.js | 21 + .../mjsunit/turbolev/regress-540482606.js | 24 + .../mjsunit/turbolev/regress-540651858.js | 27 + .../mjsunit/turbolev/regress-540717862.js | 25 + .../mjsunit/turbolev/regress-543836266.js | 18 + .../mjsunit/turbolev/regress-543954265.js | 14 + .../mjsunit/turbolev/regress-544083885.js | 22 + .../mjsunit/turbolev/regress-544150244.js | 20 + .../mjsunit/turbolev/regress-546639196.js | 29 + .../mjsunit/turbolev/regress-546647038.js | 21 + .../mjsunit/turbolev/regress-546842384.js | 30 + .../mjsunit/turbolev/regress-546963430.js | 45 + .../mjsunit/turbolev/regress-546979662.js | 29 + .../mjsunit/turbolev/regress-552783942.js | 98 + .../mjsunit/turbolev/regress-556768919.js | 46 + .../mjsunit/turbolev/regress-567177599.js | 36 + .../turbolev/throw-reference-error-if-hole.js | 28 + deps/v8/test/mjsunit/turbolev/typed-arrays.js | 2 +- ...ss-527385397.js => regress-527385397-1.js} | 9 +- .../mjsunit/turboshaft/regress-527385397-2.js | 88 + .../mjsunit/turboshaft/regress-539984773.js | 54 + .../mjsunit/wasm/acq-rel-rmw-operations.js | 79 +- .../mjsunit/wasm/atomic-wait-multi-memory.js | 5 +- deps/v8/test/mjsunit/wasm/atomics-memory64.js | 10 +- deps/v8/test/mjsunit/wasm/atomics.js | 82 +- .../wasm/compiled-module-serialization.js | 8 +- .../wasm/custom-descriptors-validity.js | 47 +- deps/v8/test/mjsunit/wasm/futex.js | 10 +- deps/v8/test/mjsunit/wasm/gc-js-interop.js | 10 +- deps/v8/test/mjsunit/wasm/import-memory.js | 8 +- .../wasm/import-wrapper-uninhabitable.js | 26 + deps/v8/test/mjsunit/wasm/return-calls.js | 49 + .../ref-cast-in-different-isolate.js | 54 + .../shared-everything/shared-js-roundtrip.js | 108 + .../shared-everything/wrapper-type-checks.js | 47 + deps/v8/test/mjsunit/wasm/simd-dot-i8x16.js | 168 + .../mjsunit/wasm/stack-switching-minor-gc.js | 98 + deps/v8/test/mjsunit/wasm/stringrefs-js.js | 3 + deps/v8/test/mjsunit/wasm/table.js | 23 + .../test/mjsunit/wasm/wasm-gc-js-roundtrip.js | 144 +- deps/v8/test/mjsunit/wasm/wasm-interpreter.js | 266 + .../test/mjsunit/wasm/wasm-module-builder.js | 1 + deps/v8/test/mjsunit/wasm/wide-add.js | 405 ++ .../mjsunit/wasm/wrapper-microbenchmark.js | 218 + deps/v8/test/mkgrokdump/mkgrokdump.cc | 5 +- .../local-tests/test/staging/features.txt | 6 + deps/v8/test/test262/test262.status | 111 +- deps/v8/test/test262/testcfg.py | 10 - deps/v8/test/test262/tools/v8_importer.py | 6 +- deps/v8/test/unittests/BUILD.gn | 20 +- .../test/unittests/api/api-wasm-unittest.cc | 116 +- .../api/dictionary-template-unittest.cc | 39 + .../unittests/api/interceptor-unittest.cc | 100 + .../test/unittests/api/v8-array-unittest.cc | 166 + .../assembler/assembler-arm64-unittest.cc | 210 +- .../assembler/assembler-riscv64-unittest.cc | 115 + .../assembler/assembler-x64-unittest.cc | 183 + .../assembler/disasm-riscv-unittest.cc | 42 + .../assembler/disasm-x64-unittest.cc | 117 +- .../macro-assembler-loong64-unittest.cc | 6 +- .../assembler/macro-assembler-x64-unittest.cc | 393 +- .../unittests/base/atomic-utils-unittest.cc | 69 +- deps/v8/test/unittests/base/cpu-unittest.cc | 1 + ...ft-instruction-scheduler-arm64-unittest.cc | 114 +- ...aft-instruction-selector-arm64-unittest.cc | 361 +- .../unittests/compiler/compiler-unittest.cc | 1 + ...haft-instruction-selector-ia32-unittest.cc | 18 + .../compiler/linear-scheduler-unittest.cc | 177 - ...t-instruction-selector-loong64-unittest.cc | 47 +- ...ft-instruction-selector-mips64-unittest.cc | 18 + .../regalloc/move-optimizer-unittest.cc | 60 + .../regalloc/register-allocator-unittest.cc | 25 + .../test/unittests/compiler/revec-unittest.cc | 697 --- ...t-instruction-selector-riscv64-unittest.cc | 22 + .../compiler/run-jsobjects-unittest.cc | 1 + .../compiler/run-unwinding-info-unittest.cc | 12 +- .../late-load-elimination-reducer-unittest.cc | 37 + .../wasm-shuffle-reducer-unittest.cc | 573 ++ .../compiler/turboshaft/wasm-simd-unittest.cc | 75 + .../test/unittests/compiler/types-unittest.cc | 1 + ...shaft-instruction-selector-x64-unittest.cc | 405 ++ .../debug/debug-scope-info-unittest.cc | 1335 +++++ .../execution/microtask-queue-unittest.cc | 53 - .../flags/flag-definitions-unittest.cc | 58 +- .../heap/cppgc-js/unified-heap-unittest.cc | 29 + .../cppgc/explicit-management-unittest.cc | 8 + .../unittests/heap/direct-handles-unittest.cc | 7 + .../unittests/heap/global-handles-unittest.cc | 39 + deps/v8/test/unittests/heap/heap-unittest.cc | 2966 +++++++++++ deps/v8/test/unittests/heap/heap-utils.cc | 90 +- deps/v8/test/unittests/heap/heap-utils.h | 52 + .../test/unittests/heap/iterators-unittest.cc | 42 + .../unittests/heap/shared-heap-unittest.cc | 105 + .../bytecode-array-builder-unittest.cc | 8 +- .../bytecode-array-iterator-unittest.cc | 1 + ...bytecode-array-random-iterator-unittest.cc | 1 + .../bytecode-array-writer-unittest.cc | 26 +- .../interpreter/bytecode-decoder-unittest.cc | 6 +- .../bytecode-expectations-printer.cc | 4 +- .../ArrayLiterals.golden | 10 +- .../AssignmentsInBinaryExpression.golden | 6 +- .../bytecode_expectations/BasicLoops.golden | 12 +- .../BreakableBlocks.golden | 10 +- .../CallAndSpread.golden | 12 +- .../CompareBoolean.golden | 4 +- .../bytecode_expectations/CompareNil.golden | 4 +- .../CountOperators.golden | 26 +- .../DestructuringAssignment.golden | 38 +- .../GlobalCountOperators.golden | 12 +- .../bytecode_expectations/Modules.golden | 12 +- .../bytecode_expectations/NewAndSpread.golden | 12 +- .../PrivateAccessorAccess.golden | 12 +- .../StandardForLoop.golden | 42 +- .../StaticPrivateMethodAccess.golden | 8 +- .../SuperCallAndSpread.golden | 12 +- .../UnaryOperators.golden | 4 +- .../VariableWithHint.golden | 4 +- .../WideRegisters.golden | 4 +- .../constant-array-builder-unittest.cc | 1 + .../interpreter/interpreter-tester.cc | 6 +- .../interpreter/interpreter-unittest.cc | 68 +- .../maglev/maglev-assembler-unittest.cc | 19 + .../maglev/maglev-graph-processor-unittest.cc | 132 +- .../unittests/maglev/node-type-unittest.cc | 15 +- .../objects/elements-kind-unittest.cc | 43 + .../objects/feedback-vector-unittest.cc | 13 + .../unittests/objects/managed-unittest.cc | 34 +- .../unittests/objects/modules-unittest.cc | 243 +- .../test/unittests/objects/object-unittest.cc | 109 + .../test/unittests/objects/roots-unittest.cc | 5 + .../objects/string-table-unittest.cc | 36 + .../objects/value-serializer-unittest.cc | 141 + .../test/unittests/parser/decls-unittest.cc | 2 - .../profiler/heap-snapshot-unittest.cc | 339 ++ .../unittests/profiler/heap-snapshot-utils.cc | 8 +- .../unittests/profiler/heap-snapshot-utils.h | 4 +- .../profiler/output-stream-writer-unittest.cc | 42 + .../profiler/strings-storage-unittest.cc | 8 + .../test/unittests/regexp/regexp-unittest.cc | 6 +- .../regress/regress-536271629-unittest.cc | 15 + .../regress/regress-536954139-unittest.cc | 31 + deps/v8/test/unittests/run-all-unittests.cc | 9 + .../generated-code-validator-unittest.cc | 247 +- .../sandbox/pointer-table-unittest.cc | 48 +- .../sandbox/segmented-table-unittest.cc | 429 ++ deps/v8/test/unittests/test-utils.h | 10 + deps/v8/test/unittests/unittests.status | 18 +- .../wasm/function-body-decoder-unittest.cc | 143 + ...imd-cross-compiler-determinism-fuzztest.cc | 170 +- .../wasm/wasm-interpreter-thread-unittest.cc | 50 + .../unittests/wasm/wasm-tracing-unittest.cc | 4 +- .../test/unittests/wasm/wasm-usecounters.cc | 38 +- deps/v8/test/wasm-js/tests.tar.gz.sha1 | 2 +- deps/v8/test/wasm-js/wasm-js.status | 5 - deps/v8/test/wasm-spec-tests/testcfg.py | 77 +- .../v8/test/wasm-spec-tests/tests.tar.gz.sha1 | 2 +- .../wasm-spec-tests/wasm-spec-tests.status | 13 + deps/v8/third_party/abseil-cpp/.style.yapf | 2 + deps/v8/third_party/abseil-cpp/BUILD.gn | 94 + .../abseil-cpp/CMake/AbseilDll.cmake | 24 +- deps/v8/third_party/abseil-cpp/MODULE.bazel | 6 +- .../v8/third_party/abseil-cpp/README.chromium | 2 +- .../abseil-cpp/absl/algorithm/BUILD.bazel | 1 - .../abseil-cpp/absl/algorithm/BUILD.gn | 3 +- .../abseil-cpp/absl/algorithm/CMakeLists.txt | 1 - .../abseil-cpp/absl/algorithm/container.h | 2 +- .../absl/algorithm/container_test.cc | 22 +- .../abseil-cpp/absl/base/BUILD.bazel | 5 +- .../third_party/abseil-cpp/absl/base/BUILD.gn | 370 +- .../abseil-cpp/absl/base/CMakeLists.txt | 2 - .../abseil-cpp/absl/base/attributes.h | 74 +- .../abseil-cpp/absl/base/bit_cast_test.cc | 22 +- .../abseil-cpp/absl/base/call_once.h | 4 +- .../third_party/abseil-cpp/absl/base/casts.h | 11 +- .../third_party/abseil-cpp/absl/base/config.h | 51 - .../abseil-cpp/absl/base/const_init.h | 4 +- .../abseil-cpp/absl/base/fast_type_id_test.cc | 5 +- .../absl/base/internal/cpu_detect.cc | 45 +- .../absl/base/internal/cycleclock.cc | 1 + .../absl/base/internal/cycleclock.h | 1 + .../absl/base/internal/direct_mmap.h | 2 + .../absl/base/internal/endian_test.cc | 3 + .../absl/base/internal/errno_saver_test.cc | 1 + .../base/internal/exception_safety_testing.h | 3 +- .../absl/base/internal/hardening.cc | 34 - .../abseil-cpp/absl/base/internal/hardening.h | 16 - .../absl/base/internal/hardening_test.cc | 53 +- .../base/internal/low_level_alloc_test.cc | 5 +- .../absl/base/internal/low_level_scheduling.h | 1 + .../absl/base/internal/raw_logging.cc | 8 +- .../absl/base/internal/raw_logging.h | 1 + .../absl/base/internal/scoped_set_env.cc | 8 +- .../absl/base/internal/scoped_set_env_test.cc | 10 +- .../abseil-cpp/absl/base/internal/strerror.cc | 2 +- .../abseil-cpp/absl/base/internal/sysinfo.cc | 39 +- .../abseil-cpp/absl/base/internal/sysinfo.h | 8 +- .../absl/base/internal/sysinfo_test.cc | 10 +- .../absl/base/internal/thread_identity.cc | 18 +- .../absl/base/internal/thread_identity.h | 16 +- .../base/internal/thread_identity_test.cc | 2 + .../absl/base/internal/tsan_mutex_interface.h | 7 +- .../absl/base/internal/unscaledcycleclock.cc | 2 + .../absl/base/internal/unscaledcycleclock.h | 6 +- .../abseil-cpp/absl/base/log_severity_test.cc | 1 + .../third_party/abseil-cpp/absl/base/macros.h | 24 +- .../abseil-cpp/absl/base/options.h | 4 +- .../abseil-cpp/absl/base/policy_checks.h | 2 +- .../third_party/abseil-cpp/absl/base/port.h | 2 + .../abseil-cpp/absl/base/prefetch_test.cc | 1 + .../abseil-cpp/absl/base/raw_logging_test.cc | 1 + .../absl/base/spinlock_test_common.cc | 3 +- .../abseil-cpp/absl/base/throw_delegate.cc | 1 + .../absl/base/throw_delegate_test.cc | 1 + .../abseil-cpp/absl/cleanup/BUILD.gn | 2 + .../abseil-cpp/absl/cleanup/cleanup_test.cc | 28 +- .../abseil-cpp/absl/container/BUILD.bazel | 37 +- .../abseil-cpp/absl/container/BUILD.gn | 193 +- .../abseil-cpp/absl/container/CMakeLists.txt | 3 - .../abseil-cpp/absl/container/btree_map.h | 12 +- .../abseil-cpp/absl/container/btree_set.h | 2 +- .../abseil-cpp/absl/container/btree_test.cc | 19 +- .../abseil-cpp/absl/container/chunked_queue.h | 6 - .../absl/container/chunked_queue_test.cc | 2 - .../abseil-cpp/absl/container/fixed_array.h | 4 +- .../absl/container/fixed_array_test.cc | 32 +- .../abseil-cpp/absl/container/flat_hash_map.h | 9 +- .../absl/container/flat_hash_map_test.cc | 4 +- .../abseil-cpp/absl/container/flat_hash_set.h | 4 +- .../absl/container/inlined_vector.h | 4 +- .../absl/container/inlined_vector_test.cc | 16 +- .../absl/container/internal/btree.h | 5 +- .../absl/container/internal/common.h | 2 - .../container/internal/compressed_tuple.h | 10 +- .../container/internal/container_memory.h | 35 +- .../internal/container_memory_test.cc | 33 +- .../container/internal/hash_policy_traits.h | 15 +- .../internal/hash_policy_traits_test.cc | 23 +- .../internal/hashtable_control_bytes.h | 13 +- .../absl/container/internal/inlined_vector.h | 2 +- .../absl/container/internal/layout.h | 16 +- .../absl/container/internal/layout_test.cc | 97 +- .../container/internal/node_slot_policy.h | 2 +- .../absl/container/internal/raw_hash_map.h | 4 +- .../absl/container/internal/raw_hash_set.cc | 11 +- .../absl/container/internal/raw_hash_set.h | 214 +- .../internal/raw_hash_set_allocator_test.cc | 8 +- .../internal/raw_hash_set_benchmark.cc | 4 +- .../internal/raw_hash_set_probe_benchmark.cc | 2 +- .../container/internal/raw_hash_set_test.cc | 165 +- .../absl/container/internal/tracked.h | 6 +- .../internal/unordered_set_lookup_test.h | 6 +- .../absl/container/linked_hash_map.h | 1 + .../absl/container/linked_hash_map_test.cc | 2 +- .../absl/container/linked_hash_set.h | 1 + .../abseil-cpp/absl/container/node_hash_map.h | 8 +- .../absl/container/node_hash_map_test.cc | 2 +- .../abseil-cpp/absl/container/node_hash_set.h | 4 +- .../third_party/abseil-cpp/absl/crc/BUILD.gn | 37 +- .../third_party/abseil-cpp/absl/crc/crc32c.cc | 1 + .../third_party/abseil-cpp/absl/crc/crc32c.h | 1 + .../abseil-cpp/absl/crc/crc32c_benchmark.cc | 2 + .../abseil-cpp/absl/crc/internal/crc.cc | 7 +- .../abseil-cpp/absl/crc/internal/crc.h | 1 + .../internal/crc32_x86_arm_combined_simd.h | 37 + .../abseil-cpp/absl/crc/internal/crc32c.h | 2 + .../absl/crc/internal/crc32c_inline.h | 1 + .../absl/crc/internal/crc_cord_state.cc | 4 + .../absl/crc/internal/crc_cord_state.h | 2 + .../absl/crc/internal/crc_internal.h | 2 + .../internal/crc_memcpy_x86_arm_combined.cc | 8 - .../absl/crc/internal/crc_x86_arm_combined.cc | 277 +- .../absl/crc/internal/non_temporal_memcpy.h | 18 +- .../crc/internal/non_temporal_memcpy_test.cc | 1 + .../abseil-cpp/absl/debugging/BUILD.bazel | 1 + .../abseil-cpp/absl/debugging/BUILD.gn | 49 +- .../absl/debugging/failure_signal_handler.cc | 29 +- .../debugging/failure_signal_handler_test.cc | 2 + .../debugging/internal/address_is_readable.cc | 2 + .../absl/debugging/internal/demangle.cc | 8 +- .../absl/debugging/internal/demangle.h | 2 + .../absl/debugging/internal/demangle_rust.cc | 32 +- .../debugging/internal/demangle_rust_test.cc | 14 + .../absl/debugging/internal/demangle_test.cc | 37 + .../absl/debugging/internal/elf_mem_image.h | 1 + .../absl/debugging/internal/examine_stack.cc | 27 +- .../internal/stacktrace_aarch64-inl.inc | 14 +- .../debugging/internal/stacktrace_config.h | 9 +- .../internal/stacktrace_powerpc-inl.inc | 15 +- .../internal/stacktrace_riscv-inl.inc | 16 +- .../debugging/internal/stacktrace_x86-inl.inc | 17 +- .../absl/debugging/internal/symbolize.h | 2 +- .../absl/debugging/internal/vdso_support.cc | 8 +- .../absl/debugging/stacktrace_test.cc | 10 +- .../absl/debugging/symbolize_elf.inc | 9 +- .../absl/debugging/symbolize_test.cc | 32 +- .../abseil-cpp/absl/flags/BUILD.gn | 111 +- .../abseil-cpp/absl/flags/config_test.cc | 3 +- .../abseil-cpp/absl/flags/flag_test.cc | 5 +- .../abseil-cpp/absl/flags/internal/flag.h | 11 +- .../abseil-cpp/absl/flags/internal/parse.h | 6 + .../absl/flags/internal/sequence_lock_test.cc | 6 +- .../abseil-cpp/absl/flags/parse.cc | 32 +- .../third_party/abseil-cpp/absl/flags/parse.h | 15 + .../abseil-cpp/absl/flags/parse_test.cc | 61 + .../abseil-cpp/absl/flags/reflection.cc | 4 +- .../abseil-cpp/absl/functional/BUILD.gn | 10 + .../absl/functional/any_invocable_test.h | 30 +- .../abseil-cpp/absl/functional/bind_back.h | 2 - .../abseil-cpp/absl/functional/bind_front.h | 2 - .../absl/functional/internal/any_invocable.h | 10 +- .../absl/functional/internal/function_ref.h | 10 +- .../abseil-cpp/absl/hash/BUILD.bazel | 1 + .../third_party/abseil-cpp/absl/hash/BUILD.gn | 24 +- .../abseil-cpp/absl/hash/hash_benchmark.cc | 10 +- .../abseil-cpp/absl/hash/hash_test.cc | 32 +- .../abseil-cpp/absl/hash/internal/city.cc | 3 + .../absl/hash/internal/city_test.cc | 3 + .../abseil-cpp/absl/hash/internal/hash.h | 32 +- .../abseil-cpp/absl/hash/internal/hash_test.h | 1 + .../absl/hash/internal/print_hash_of.cc | 3 + .../absl/hash/internal/spy_hash_state.h | 3 +- .../abseil-cpp/absl/log/BUILD.bazel | 13 +- .../third_party/abseil-cpp/absl/log/BUILD.gn | 58 +- .../abseil-cpp/absl/log/internal/BUILD.gn | 115 +- .../abseil-cpp/absl/log/internal/conditions.h | 11 +- .../abseil-cpp/absl/log/internal/globals.cc | 8 +- .../absl/log/internal/log_format.cc | 52 +- .../absl/log/internal/log_message.cc | 8 +- .../absl/log/internal/log_sink_set.cc | 24 +- .../abseil-cpp/absl/log/internal/nullstream.h | 11 +- .../absl/log/internal/test_helpers.cc | 14 +- .../log/internal/vlog_config_benchmark.cc | 2 +- .../abseil-cpp/absl/log/log_format_test.cc | 10 +- .../absl/log/log_modifier_methods_test.cc | 2 + .../abseil-cpp/absl/log/log_sink_test.cc | 2 + .../absl/log/scoped_mock_log_test.cc | 1 + .../abseil-cpp/absl/log/stripping_test.cc | 17 +- .../abseil-cpp/absl/memory/BUILD.gn | 2 + .../abseil-cpp/absl/memory/memory.h | 1 + .../abseil-cpp/absl/memory/memory_test.cc | 1 + .../third_party/abseil-cpp/absl/meta/BUILD.gn | 6 +- .../absl/meta/internal/constexpr_testing.h | 3 +- .../abseil-cpp/absl/meta/type_traits.h | 181 +- .../abseil-cpp/absl/meta/type_traits_test.cc | 137 +- .../abseil-cpp/absl/numeric/BUILD.gn | 11 + .../abseil-cpp/absl/numeric/bits.h | 1 + .../abseil-cpp/absl/numeric/bits_benchmark.cc | 2 + .../abseil-cpp/absl/numeric/bits_test.cc | 236 +- .../abseil-cpp/absl/numeric/int128.cc | 10 +- .../abseil-cpp/absl/numeric/int128.h | 1 + .../absl/numeric/int128_stream_test.cc | 8 +- .../abseil-cpp/absl/numeric/int128_test.cc | 30 +- .../abseil-cpp/absl/numeric/internal/bits.h | 6 +- .../abseil-cpp/absl/profiling/BUILD.bazel | 3 + .../abseil-cpp/absl/profiling/BUILD.gn | 29 +- .../abseil-cpp/absl/profiling/hashtable.cc | 1 + .../internal/exponential_biased_test.cc | 47 + .../profiling/internal/periodic_sampler.cc | 2 + .../internal/periodic_sampler_benchmark.cc | 1 + .../internal/periodic_sampler_test.cc | 1 + .../profiling/internal/profile_builder.cc | 11 +- .../absl/profiling/internal/profile_builder.h | 3 + .../absl/profiling/internal/sample_recorder.h | 8 +- .../internal/sample_recorder_test.cc | 1 + .../abseil-cpp/absl/random/BUILD.bazel | 2 + .../abseil-cpp/absl/random/BUILD.gn | 202 +- .../abseil-cpp/absl/random/benchmarks.cc | 4 +- .../random/bernoulli_distribution_test.cc | 2 + .../absl/random/beta_distribution.h | 2 - .../absl/random/beta_distribution_test.cc | 4 + .../absl/random/discrete_distribution_test.cc | 1 + .../absl/random/distributions_test.cc | 12 +- .../abseil-cpp/absl/random/examples_test.cc | 5 + .../absl/random/exponential_distribution.h | 2 + .../absl/random/gaussian_distribution_test.cc | 3 + .../abseil-cpp/absl/random/generators_test.cc | 1 + .../absl/random/internal/BUILD.bazel | 28 +- .../abseil-cpp/absl/random/internal/BUILD.gn | 316 +- .../absl/random/internal/chi_square.cc | 1 + .../absl/random/internal/chi_square_test.cc | 13 +- .../random/internal/distribution_test_util.cc | 7 +- .../internal/distribution_test_util_test.cc | 3 + .../absl/random/internal/entropy_pool.cc | 7 +- .../random/internal/explicit_seed_seq_test.cc | 16 +- .../random/internal/fast_uniform_bits_test.cc | 4 + .../absl/random/internal/fastmath_test.cc | 3 + .../gaussian_distribution_gentables.cc | 7 +- .../absl/random/internal/generate_real.h | 3 +- .../random/internal/iostream_state_saver.h | 12 +- .../internal/iostream_state_saver_test.cc | 6 +- .../absl/random/internal/nanobenchmark.cc | 15 +- .../absl/random/internal/nanobenchmark.h | 7 +- .../random/internal/nanobenchmark_test.cc | 4 + .../random/internal/nonsecure_base_test.cc | 4 +- .../absl/random/internal/pcg_engine.h | 22 +- .../absl/random/internal/pcg_engine_test.cc | 5 +- .../abseil-cpp/absl/random/internal/randen.cc | 5 +- .../abseil-cpp/absl/random/internal/randen.h | 4 +- .../absl/random/internal/randen_benchmarks.cc | 1 - .../absl/random/internal/randen_detect.cc | 15 +- .../absl/random/internal/randen_engine.h | 2 + .../random/internal/randen_engine_test.cc | 5 +- .../absl/random/internal/randen_hwaes.cc | 9 +- .../absl/random/internal/randen_hwaes_test.cc | 5 +- .../absl/random/internal/randen_round_keys.cc | 3 + .../absl/random/internal/randen_slow.cc | 3 +- .../absl/random/internal/randen_slow_test.cc | 2 +- .../absl/random/internal/randen_test.cc | 2 +- .../random/internal/salted_seed_seq_test.cc | 8 +- .../absl/random/internal/seed_material.cc | 14 +- .../absl/random/internal/sequence_urbg.h | 1 + .../abseil-cpp/absl/random/internal/traits.h | 1 + .../random/internal/uniform_helper_test.cc | 5 +- .../absl/random/internal/wide_multiply.h | 11 +- .../random/internal/wide_multiply_test.cc | 1 + .../log_uniform_int_distribution_test.cc | 4 + .../absl/random/poisson_distribution_test.cc | 2 + .../absl/random/seed_gen_exception.cc | 2 + .../abseil-cpp/absl/random/seed_sequences.h | 1 + .../absl/random/seed_sequences_test.cc | 4 + .../random/uniform_int_distribution_test.cc | 2 + .../random/uniform_real_distribution_test.cc | 2 + .../absl/random/zipf_distribution_test.cc | 4 + .../abseil-cpp/absl/status/BUILD.bazel | 2 +- .../abseil-cpp/absl/status/BUILD.gn | 30 +- .../absl/status/internal/status_internal.cc | 3 +- .../absl/status/internal/status_internal.h | 11 +- .../absl/status/internal/status_matchers.cc | 2 +- .../absl/status/internal/status_matchers.h | 2 +- .../absl/status/internal/statusor_internal.h | 5 +- .../abseil-cpp/absl/status/status.cc | 89 +- .../abseil-cpp/absl/status/status.h | 513 +- .../absl/status/status_benchmark.cc | 10 + .../abseil-cpp/absl/status/status_builder.cc | 4 +- .../abseil-cpp/absl/status/status_builder.h | 4 +- .../absl/status/status_macros_test.cc | 2 - .../abseil-cpp/absl/status/status_test.cc | 210 +- .../abseil-cpp/absl/status/statusor.h | 34 +- .../absl/status/statusor_benchmark.cc | 3 + .../abseil-cpp/absl/status/statusor_test.cc | 25 +- .../abseil-cpp/absl/strings/BUILD.bazel | 35 +- .../abseil-cpp/absl/strings/BUILD.gn | 270 +- .../abseil-cpp/absl/strings/CMakeLists.txt | 1 - .../abseil-cpp/absl/strings/ascii_test.cc | 3 +- .../abseil-cpp/absl/strings/cord.h | 9 +- .../abseil-cpp/absl/strings/cord_buffer.h | 3 +- .../absl/strings/cord_buffer_test.cc | 1 - .../abseil-cpp/absl/strings/cord_test.cc | 131 +- .../absl/strings/cord_test_helpers.h | 3 + .../absl/strings/cordz_test_helpers.h | 3 + .../abseil-cpp/absl/strings/escaping.cc | 68 +- .../abseil-cpp/absl/strings/escaping.h | 1 + .../abseil-cpp/absl/strings/escaping_test.cc | 1 + .../absl/strings/has_absl_stringify.h | 1 + .../absl/strings/internal/charconv_bigint.cc | 4 + .../strings/internal/charconv_bigint_test.cc | 2 + .../strings/internal/charconv_parse_test.cc | 3 + .../strings/internal/cord_data_edge_test.cc | 1 + .../absl/strings/internal/cord_internal.cc | 1 + .../absl/strings/internal/cord_internal.h | 181 +- .../absl/strings/internal/cord_rep_btree.cc | 6 +- .../absl/strings/internal/cord_rep_btree.h | 15 +- .../internal/cord_rep_btree_navigator.cc | 2 + .../internal/cord_rep_btree_navigator.h | 3 + .../internal/cord_rep_btree_navigator_test.cc | 1 + .../strings/internal/cord_rep_btree_reader.cc | 2 + .../strings/internal/cord_rep_btree_reader.h | 3 + .../internal/cord_rep_btree_reader_test.cc | 2 + .../strings/internal/cord_rep_btree_test.cc | 7 + .../absl/strings/internal/cord_rep_consume.cc | 1 + .../absl/strings/internal/cord_rep_consume.h | 1 + .../absl/strings/internal/cord_rep_crc.cc | 1 + .../strings/internal/cord_rep_crc_test.cc | 3 + .../absl/strings/internal/cord_rep_flat.h | 7 +- .../strings/internal/cord_rep_test_util.h | 3 + .../absl/strings/internal/cordz_functions.cc | 1 + .../strings/internal/cordz_functions_test.cc | 1 + .../absl/strings/internal/cordz_handle.cc | 4 + .../strings/internal/cordz_handle_test.cc | 2 + .../absl/strings/internal/cordz_info.cc | 7 + .../absl/strings/internal/cordz_info.h | 4 + .../internal/cordz_info_statistics_test.cc | 6 + .../absl/strings/internal/cordz_info_test.cc | 4 + .../strings/internal/cordz_sample_token.h | 3 + .../internal/cordz_sample_token_test.cc | 33 +- .../absl/strings/internal/cordz_statistics.h | 1 + .../internal/cordz_update_tracker_test.cc | 1 + .../damerau_levenshtein_distance_benchmark.cc | 1 + .../damerau_levenshtein_distance_test.cc | 1 + .../absl/strings/internal/escaping.cc | 1 + .../absl/strings/internal/generic_printer.cc | 2 + .../strings/internal/generic_printer_test.cc | 4 + .../strings/internal/memutil_benchmark.cc | 1 + .../strings/internal/ostringstream_test.cc | 7 +- .../strings/internal/pow10_helper_test.cc | 1 + .../strings/internal/resize_uninitialized.h | 1 + .../internal/resize_uninitialized_test.cc | 1 + .../absl/strings/internal/str_format/arg.cc | 8 +- .../absl/strings/internal/str_format/arg.h | 8 +- .../absl/strings/internal/str_format/bind.cc | 6 +- .../absl/strings/internal/str_format/bind.h | 1 + .../strings/internal/str_format/bind_test.cc | 5 + .../strings/internal/str_format/checker.h | 3 + .../internal/str_format/checker_test.cc | 1 + .../internal/str_format/convert_test.cc | 113 +- .../strings/internal/str_format/extension.cc | 4 + .../strings/internal/str_format/extension.h | 2 +- .../internal/str_format/float_conversion.cc | 9 +- .../strings/internal/str_format/output.cc | 5 + .../internal/str_format/output_test.cc | 1 + .../strings/internal/str_format/parser.cc | 9 +- .../internal/str_format/parser_test.cc | 7 +- .../strings/internal/str_split_internal.h | 14 +- .../strings/internal/string_constant_test.cc | 1 + .../absl/strings/internal/stringify_sink.cc | 4 + .../absl/strings/internal/stringify_sink.h | 1 + .../abseil-cpp/absl/strings/match.cc | 109 +- .../absl/strings/match_benchmark.cc | 97 + .../abseil-cpp/absl/strings/match_test.cc | 257 + .../abseil-cpp/absl/strings/numbers.cc | 6 +- .../abseil-cpp/absl/strings/numbers.h | 16 +- .../abseil-cpp/absl/strings/str_cat.h | 1 + .../abseil-cpp/absl/strings/str_format.h | 10 +- .../absl/strings/str_format_test.cc | 17 +- .../abseil-cpp/absl/strings/str_join_test.cc | 2 +- .../abseil-cpp/absl/strings/str_replace.h | 4 +- .../absl/strings/str_replace_test.cc | 18 + .../abseil-cpp/absl/strings/str_split.h | 2 + .../abseil-cpp/absl/strings/str_split_test.cc | 31 +- .../abseil-cpp/absl/strings/strip_test.cc | 2 + .../abseil-cpp/absl/strings/substitute.h | 22 +- .../absl/synchronization/BUILD.bazel | 15 +- .../abseil-cpp/absl/synchronization/BUILD.gn | 72 +- .../absl/synchronization/CMakeLists.txt | 1 + .../absl/synchronization/barrier.cc | 1 + .../absl/synchronization/barrier_test.cc | 2 +- .../absl/synchronization/blocking_counter.cc | 2 + .../absl/synchronization/blocking_counter.h | 2 +- .../internal/create_thread_identity.cc | 12 +- .../internal/create_thread_identity.h | 1 + .../absl/synchronization/internal/futex.h | 21 +- .../synchronization/internal/futex_waiter.cc | 5 +- .../synchronization/internal/graphcycles.cc | 15 +- .../synchronization/internal/graphcycles.h | 12 +- .../internal/graphcycles_test.cc | 31 +- .../internal/kernel_timeout.cc | 14 +- .../synchronization/internal/kernel_timeout.h | 8 +- .../internal/kernel_timeout_test.cc | 79 +- .../internal/per_thread_sem.cc | 9 +- .../synchronization/internal/per_thread_sem.h | 9 + .../internal/per_thread_sem_test.cc | 14 +- .../internal/pthread_waiter.cc | 5 +- .../synchronization/internal/sem_waiter.cc | 3 - .../synchronization/internal/stdcpp_waiter.cc | 4 - .../synchronization/internal/waiter_base.cc | 3 + .../synchronization/internal/waiter_test.cc | 4 +- .../absl/synchronization/lifetime_test.cc | 1 - .../abseil-cpp/absl/synchronization/mutex.cc | 51 +- .../abseil-cpp/absl/synchronization/mutex.h | 6 +- .../absl/synchronization/mutex_benchmark.cc | 11 +- .../mutex_method_pointer_test.cc | 8 +- .../absl/synchronization/mutex_test.cc | 13 +- .../absl/synchronization/notification.cc | 2 + .../absl/synchronization/notification.h | 5 +- .../absl/synchronization/notification_test.cc | 1 + .../abseil-cpp/absl/time/BUILD.bazel | 1 + .../third_party/abseil-cpp/absl/time/BUILD.gn | 14 +- .../abseil-cpp/absl/time/civil_time.h | 52 +- .../abseil-cpp/absl/time/civil_time_test.cc | 64 +- .../third_party/abseil-cpp/absl/time/clock.cc | 13 +- .../abseil-cpp/absl/time/clock_benchmark.cc | 9 +- .../abseil-cpp/absl/time/clock_test.cc | 6 +- .../abseil-cpp/absl/time/duration.cc | 10 +- .../absl/time/duration_benchmark.cc | 3 +- .../abseil-cpp/absl/time/duration_test.cc | 46 +- .../abseil-cpp/absl/time/format_benchmark.cc | 3 +- .../absl/time/internal/cctz/BUILD.bazel | 23 +- .../absl/time/internal/cctz/BUILD.gn | 81 +- .../time/internal/cctz/src/cctz_benchmark.cc | 1 + .../time/internal/cctz/src/time_zone_fixed.cc | 17 +- .../internal/cctz/src/time_zone_format.cc | 30 +- .../cctz/src/time_zone_format_test.cc | 21 + .../time/internal/cctz/src/time_zone_impl.cc | 11 +- .../time/internal/cctz/src/time_zone_info.cc | 147 +- .../cctz/src/time_zone_lookup_test.cc | 234 + .../time/internal/cctz/src/time_zone_posix.cc | 24 +- .../time/internal/cctz/src/time_zone_posix.h | 2 +- .../internal/cctz/src/time_zone_posix_test.cc | 198 + .../absl/time/internal/cctz/testdata/version | 2 +- .../cctz/testdata/zoneinfo/Africa/Casablanca | Bin 1919 -> 793 bytes .../cctz/testdata/zoneinfo/Africa/El_Aaiun | Bin 1830 -> 704 bytes .../cctz/testdata/zoneinfo/America/Edmonton | Bin 970 -> 1313 bytes .../testdata/zoneinfo/America/Yellowknife | Bin 970 -> 1313 bytes .../cctz/testdata/zoneinfo/Canada/Mountain | Bin 970 -> 1313 bytes .../cctz/testdata/zoneinfo/zone1970.tab | 2 +- .../cctz/testdata/zoneinfo/zonenow.tab | 9 +- .../third_party/abseil-cpp/absl/time/time.cc | 8 +- .../third_party/abseil-cpp/absl/time/time.h | 26 +- .../abseil-cpp/absl/time/time_benchmark.cc | 10 +- .../abseil-cpp/absl/time/time_test.cc | 109 +- .../abseil-cpp/absl/types/BUILD.bazel | 2 - .../abseil-cpp/absl/types/BUILD.gn | 25 +- .../abseil-cpp/absl/types/CMakeLists.txt | 2 - .../abseil-cpp/absl/types/any_span.h | 5 +- .../abseil-cpp/absl/types/any_span_test.cc | 3 - .../abseil-cpp/absl/types/compare.h | 143 +- .../abseil-cpp/absl/types/compare_test.cc | 24 +- .../abseil-cpp/absl/types/internal/any_span.h | 5 +- .../abseil-cpp/absl/types/internal/span.h | 10 +- .../absl/types/optional_ref_test.cc | 2 +- .../third_party/abseil-cpp/absl/types/span.h | 11 +- .../abseil-cpp/absl/types/span_test.cc | 3 - .../abseil-cpp/absl/utility/BUILD.gn | 3 +- .../abseil-cpp/convert_bazel_to_gn.py | 525 ++ .../abseil-cpp/generate_def_files.py | 219 +- deps/v8/third_party/abseil-cpp/roll_abseil.py | 249 +- .../abseil-cpp/symbols_arm64_dbg.def | 806 +-- .../abseil-cpp/symbols_arm64_dbg_cxx23.def | 806 +-- .../abseil-cpp/symbols_arm64_rel.def | 67 +- .../abseil-cpp/symbols_arm64_rel_cxx23.def | 67 +- .../abseil-cpp/symbols_x64_dbg.def | 806 +-- .../abseil-cpp/symbols_x64_dbg_cxx23.def | 806 +-- .../abseil-cpp/symbols_x64_rel.def | 70 +- .../abseil-cpp/symbols_x64_rel_asan.def | 92 +- .../abseil-cpp/symbols_x64_rel_asan_cxx23.def | 92 +- .../abseil-cpp/symbols_x64_rel_cxx23.def | 70 +- .../abseil-cpp/symbols_x86_dbg.def | 806 +-- .../abseil-cpp/symbols_x86_dbg_cxx23.def | 806 +-- .../abseil-cpp/symbols_x86_rel.def | 68 +- .../abseil-cpp/symbols_x86_rel_cxx23.def | 68 +- .../highway/src/hwy/contrib/sort/BUILD | 310 ++ .../llvm-libc/src/hdr/CMakeLists.txt | 82 +- .../third_party/llvm-libc/src/hdr/elf_proxy.h | 27 + .../llvm-libc/src/hdr/fnmatch_macros.h | 27 + .../llvm-libc/src/hdr/netdb_macros.h | 27 + .../llvm-libc/src/hdr/semaphore_macros.h | 27 + .../llvm-libc/src/hdr/types/CMakeLists.txt | 115 +- .../llvm-libc/src/hdr/types/dev_t.h | 27 + .../llvm-libc/src/hdr/types/sem_t.h | 27 + .../llvm-libc/src/hdr/types/struct_addrinfo.h | 27 + .../src/hdr/types/struct_if_nameindex.h | 26 + .../src/hdr/types/struct_itimerspec.h | 27 + .../llvm-libc/src/hdr/types/struct_link_map.h | 27 + .../llvm-libc/src/hdr/types/struct_passwd.h | 26 + .../llvm-libc/src/hdr/types/struct_r_debug.h | 27 + .../llvm-libc/src/hdr/types/struct_sigevent.h | 27 + .../llvm-libc/src/hdr/types/struct_statfs.h | 27 + .../llvm-libc/src/hdr/types/struct_sysinfo.h | 27 + .../llvm-libc/src/hdr/types/timer_t.h | 27 + .../llvm-libc/src/hdr/types/useconds_t.h | 27 + .../llvm-libc/src/include/CMakeLists.txt | 288 +- .../llvm-libc/src/include/dirent.yaml | 21 + .../llvm-libc/src/include/elf.yaml | 666 +-- .../llvm-libc/src/include/errno.yaml | 6 +- .../llvm-libc/src/include/fcntl.yaml | 6 +- .../llvm-libc/src/include/fnmatch.yaml | 28 + .../llvm-libc/src/include/grp.yaml | 10 + .../llvm-libc/src/include/limits.yaml | 2 + .../llvm-libc/src/include/link.yaml | 11 + .../include/llvm-libc-macros/CMakeLists.txt | 59 +- .../include/llvm-libc-macros/dirent-macros.h | 21 + .../include/llvm-libc-macros/float16-macros.h | 6 +- .../include/llvm-libc-macros/fnmatch-macros.h | 25 + .../include/llvm-libc-macros/limits-macros.h | 5 + .../llvm-libc-macros/linux/CMakeLists.txt | 30 + .../llvm-libc-macros/linux/dirent-macros.h | 26 + .../llvm-libc-macros/linux/fcntl-macros.h | 46 +- .../llvm-libc-macros/linux/netdb-macros.h | 28 + .../llvm-libc-macros/linux/sched-macros.h | 28 + .../llvm-libc-macros/linux/signal-macros.h | 29 +- .../llvm-libc-macros/linux/sys-mount-macros.h | 40 + .../linux/sys-resource-macros.h | 4 + .../linux/sys-socket-macros.h | 12 +- .../linux/sys-statfs-macros.h | 21 + .../linux/sys-sysmacros-macros.h | 21 + .../llvm-libc-macros/linux/time-macros.h | 3 + .../llvm-libc-macros/linux/unistd-macros.h | 5 +- .../llvm-libc-macros/math-function-macros.h | 24 + .../include/llvm-libc-macros/netdb-macros.h | 21 + .../include/llvm-libc-macros/pthread-macros.h | 3 + .../llvm-libc-macros/semaphore-macros.h | 20 + .../llvm-libc-macros/sys-mount-macros.h | 21 + .../llvm-libc-macros/sys-statfs-macros.h | 21 + .../llvm-libc-macros/sys-sysmacros-macros.h | 21 + .../include/llvm-libc-macros/syslog-macros.h | 53 + .../llvm-libc-macros/windows/CMakeLists.txt | 1 - .../include/llvm-libc-proxy/CMakeLists.txt | 58 + .../include/llvm-libc-proxy/elf_proxy.yaml | 673 +++ .../include/llvm-libc-types/CMakeLists.txt | 82 +- .../src/include/llvm-libc-types/float128.h | 6 +- .../src/include/llvm-libc-types/fsid_t.h | 21 + .../llvm-libc-types/linux/CMakeLists.txt | 6 + .../llvm-libc-types/linux/struct_sysinfo.h | 19 + .../src/include/llvm-libc-types/reclen_t.h | 19 + .../src/include/llvm-libc-types/sem_t.h | 29 + .../src/include/llvm-libc-types/sig_t.h | 20 + .../src/include/llvm-libc-types/siginfo_t.h | 2 +- .../include/llvm-libc-types/struct_addrinfo.h | 31 + .../include/llvm-libc-types/struct_dirent.h | 3 +- .../include/llvm-libc-types/struct_group.h | 27 + .../llvm-libc-types/struct_if_nameindex.h | 23 + .../llvm-libc-types/struct_itimerspec.h | 24 + .../include/llvm-libc-types/struct_link_map.h | 29 + .../include/llvm-libc-types/struct_passwd.h | 31 + .../llvm-libc-types/struct_posix_dent.h | 35 + .../include/llvm-libc-types/struct_r_debug.h | 33 + .../include/llvm-libc-types/struct_sigevent.h | 36 + .../include/llvm-libc-types/struct_statfs.h | 39 + .../include/llvm-libc-types/struct_sysinfo.h | 21 + .../include/llvm-libc-types/struct_ucred.h | 28 + .../src/include/llvm-libc-types/timer_t.h | 19 + .../llvm-libc/src/include/math.yaml | 128 +- .../llvm-libc/src/include/memory.yaml | 5 + .../llvm-libc/src/include/net/if.yaml | 12 + .../llvm-libc/src/include/netdb.yaml | 44 + .../llvm-libc/src/include/pthread.yaml | 12 + .../llvm-libc/src/include/pwd.yaml | 26 + .../llvm-libc/src/include/semaphore.yaml | 86 + .../llvm-libc/src/include/signal.yaml | 14 + .../llvm-libc/src/include/stdio.yaml | 14 + .../llvm-libc/src/include/stdlib.yaml | 6 + .../llvm-libc/src/include/sys/fcntl.yaml | 5 + .../llvm-libc/src/include/sys/mount.yaml | 15 + .../llvm-libc/src/include/sys/poll.yaml | 5 + .../llvm-libc/src/include/sys/resource.yaml | 16 + .../llvm-libc/src/include/sys/signal.yaml | 5 + .../llvm-libc/src/include/sys/socket.yaml | 3 + .../llvm-libc/src/include/sys/statfs.yaml | 19 + .../llvm-libc/src/include/sys/syscall.h.def | 16 + .../llvm-libc/src/include/sys/sysinfo.yaml | 10 + .../llvm-libc/src/include/sys/syslog.yaml | 5 + .../llvm-libc/src/include/sys/sysmacros.yaml | 26 + .../llvm-libc/src/include/sys/types.yaml | 1 + .../llvm-libc/src/include/sys/unistd.yaml | 5 + .../llvm-libc/src/include/sys/vfs.yaml | 5 + .../llvm-libc/src/include/syslog.yaml | 68 + .../llvm-libc/src/include/time.yaml | 64 +- .../llvm-libc/src/include/unistd.yaml | 35 +- .../llvm-libc/src/shared/CMakeLists.txt | 14 +- .../llvm-libc/src/shared/builtins.h | 34 + .../llvm-libc/src/shared/builtins/addtf3.h | 4 +- .../llvm-libc/src/shared/builtins/divtf3.h | 4 +- .../src/shared/builtins/extenddftf2.h | 35 + .../src/shared/builtins/extendsfdf2.h | 29 + .../src/shared/builtins/extendsftf2.h | 35 + .../src/shared/builtins/extendxftf2.h | 38 + .../llvm-libc/src/shared/builtins/fixdfdi.h | 29 + .../llvm-libc/src/shared/builtins/fixdfsi.h | 29 + .../llvm-libc/src/shared/builtins/fixdfti.h | 35 + .../llvm-libc/src/shared/builtins/fixsfdi.h | 29 + .../llvm-libc/src/shared/builtins/fixsfsi.h | 29 + .../llvm-libc/src/shared/builtins/fixsfti.h | 35 + .../src/shared/builtins/fixunsdfdi.h | 29 + .../src/shared/builtins/fixunsdfsi.h | 29 + .../src/shared/builtins/fixunsdfti.h | 35 + .../src/shared/builtins/fixunssfdi.h | 29 + .../src/shared/builtins/fixunssfsi.h | 29 + .../src/shared/builtins/fixunssfti.h | 35 + .../llvm-libc/src/shared/builtins/floatdidf.h | 29 + .../llvm-libc/src/shared/builtins/floatdisf.h | 29 + .../llvm-libc/src/shared/builtins/floatsidf.h | 29 + .../llvm-libc/src/shared/builtins/floatsisf.h | 29 + .../llvm-libc/src/shared/builtins/floattidf.h | 35 + .../llvm-libc/src/shared/builtins/floattisf.h | 35 + .../src/shared/builtins/floatundidf.h | 29 + .../src/shared/builtins/floatundisf.h | 29 + .../src/shared/builtins/floatunsidf.h | 29 + .../src/shared/builtins/floatunsisf.h | 29 + .../src/shared/builtins/floatuntidf.h | 35 + .../src/shared/builtins/floatuntisf.h | 35 + .../llvm-libc/src/shared/builtins/multf3.h | 4 +- .../llvm-libc/src/shared/builtins/negdf2.h | 29 + .../llvm-libc/src/shared/builtins/negsf2.h | 29 + .../llvm-libc/src/shared/builtins/subtf3.h | 4 +- .../src/shared/builtins/truncdfsf2.h | 29 + .../src/shared/builtins/trunctfdf2.h | 35 + .../src/shared/builtins/trunctfsf2.h | 35 + .../src/shared/builtins/trunctfxf2.h | 38 + .../third_party/llvm-libc/src/shared/math.h | 1 + .../llvm-libc/src/shared/math/atan2f128.h | 6 - .../llvm-libc/src/shared/math/bf16addf128.h | 4 +- .../llvm-libc/src/shared/math/bf16divf128.h | 4 +- .../llvm-libc/src/shared/math/bf16fmaf128.h | 4 +- .../llvm-libc/src/shared/math/bf16mulf128.h | 4 +- .../llvm-libc/src/shared/math/bf16subf128.h | 4 +- .../src/shared/math/canonicalizef128.h | 4 +- .../llvm-libc/src/shared/math/ceilf128.h | 6 - .../llvm-libc/src/shared/math/copysignf128.h | 4 +- .../llvm-libc/src/shared/math/daddf128.h | 4 +- .../llvm-libc/src/shared/math/ddivf128.h | 4 +- .../llvm-libc/src/shared/math/dfmaf128.h | 4 +- .../llvm-libc/src/shared/math/dmulf128.h | 4 +- .../llvm-libc/src/shared/math/dsqrtf128.h | 4 +- .../llvm-libc/src/shared/math/dsubf128.h | 4 +- .../llvm-libc/src/shared/math/f16addf128.h | 4 +- .../llvm-libc/src/shared/math/f16divf128.h | 4 +- .../llvm-libc/src/shared/math/f16fmaf128.h | 4 +- .../llvm-libc/src/shared/math/f16mulf128.h | 4 +- .../llvm-libc/src/shared/math/f16sqrtf128.h | 4 +- .../llvm-libc/src/shared/math/f16subf128.h | 4 +- .../llvm-libc/src/shared/math/fabsf128.h | 4 +- .../llvm-libc/src/shared/math/faddf128.h | 4 +- .../llvm-libc/src/shared/math/fdimf128.h | 4 +- .../llvm-libc/src/shared/math/fdivf128.h | 4 +- .../llvm-libc/src/shared/math/ffmaf128.h | 4 +- .../llvm-libc/src/shared/math/floorf128.h | 6 - .../llvm-libc/src/shared/math/fmaxf128.h | 6 - .../src/shared/math/fmaximum_mag_numf128.h | 4 +- .../src/shared/math/fmaximum_magf128.h | 4 +- .../src/shared/math/fmaximum_numf128.h | 4 +- .../llvm-libc/src/shared/math/fmaximumf128.h | 4 +- .../llvm-libc/src/shared/math/fminf128.h | 6 - .../src/shared/math/fminimum_mag_numf128.h | 4 +- .../src/shared/math/fminimum_magf128.h | 4 +- .../src/shared/math/fminimum_numf128.h | 4 +- .../llvm-libc/src/shared/math/fminimumf128.h | 4 +- .../llvm-libc/src/shared/math/fmodf128.h | 4 +- .../llvm-libc/src/shared/math/fmulf128.h | 4 +- .../llvm-libc/src/shared/math/frexpf128.h | 4 +- .../llvm-libc/src/shared/math/fromfpf128.h | 4 +- .../llvm-libc/src/shared/math/fromfpxf128.h | 4 +- .../llvm-libc/src/shared/math/fsqrtf128.h | 4 +- .../llvm-libc/src/shared/math/fsubf128.h | 4 +- .../src/shared/math/getpayloadf128.h | 4 +- .../llvm-libc/src/shared/math/ilogbf128.h | 4 +- .../src/shared/math/iscanonicalf128.h | 6 - .../llvm-libc/src/shared/math/isnanf128.h | 6 - .../src/shared/math/issignalingf128.h | 6 - .../llvm-libc/src/shared/math/ldexpf128.h | 4 +- .../llvm-libc/src/shared/math/lgammaf.h | 23 + .../llvm-libc/src/shared/math/llogbf128.h | 4 +- .../llvm-libc/src/shared/math/llrintf128.h | 6 - .../llvm-libc/src/shared/math/llroundf128.h | 6 - .../llvm-libc/src/shared/math/logbf128.h | 4 +- .../llvm-libc/src/shared/math/lrintf128.h | 6 - .../llvm-libc/src/shared/math/lroundf128.h | 6 - .../llvm-libc/src/shared/math/modff128.h | 4 +- .../llvm-libc/src/shared/math/nanf128.h | 4 +- .../llvm-libc/src/shared/math/nearbyintf128.h | 6 - .../llvm-libc/src/shared/math/nextafterf128.h | 4 +- .../llvm-libc/src/shared/math/nextdownf128.h | 4 +- .../llvm-libc/src/shared/math/nextupf128.h | 4 +- .../llvm-libc/src/shared/math/remainderf128.h | 4 +- .../llvm-libc/src/shared/math/remquof128.h | 4 +- .../llvm-libc/src/shared/math/rintf128.h | 6 - .../llvm-libc/src/shared/math/roundevenf128.h | 6 - .../llvm-libc/src/shared/math/roundf128.h | 6 - .../llvm-libc/src/shared/math/scalblnf128.h | 4 +- .../llvm-libc/src/shared/math/scalbnf128.h | 4 +- .../src/shared/math/setpayloadf128.h | 4 +- .../src/shared/math/setpayloadsigf128.h | 4 +- .../llvm-libc/src/shared/math/sqrtf128.h | 6 - .../src/shared/math/static_rounding/expf.h | 28 + .../src/shared/math/totalorderf128.h | 4 +- .../src/shared/math/totalordermagf128.h | 4 +- .../llvm-libc/src/shared/math/truncf128.h | 6 - .../llvm-libc/src/shared/math/ufromfpf128.h | 4 +- .../llvm-libc/src/shared/math/ufromfpxf128.h | 4 +- .../v8/third_party/llvm-libc/src/shared/rpc.h | 88 +- .../llvm-libc/src/shared/rpc_util.h | 18 +- .../src/shared/static_rounding_math.h | 20 + .../src/src/__support/CMakeLists.txt | 38 +- .../src/src/__support/CPP/CMakeLists.txt | 8 + .../src/src/__support/CPP/expected.h | 24 + .../src/src/__support/CPP/optional.h | 11 + .../llvm-libc/src/src/__support/CPP/simd.h | 20 +- .../llvm-libc/src/src/__support/CPP/string.h | 170 +- .../CPP/type_traits/is_floating_point.h | 9 +- .../src/src/__support/FPUtil/CMakeLists.txt | 20 + .../src/src/__support/FPUtil/FPBits.h | 21 +- .../llvm-libc/src/src/__support/FPUtil/cast.h | 4 +- .../src/src/__support/FPUtil/dyadic_float.h | 21 +- .../src/src/__support/FPUtil/float128.h | 19 +- .../src/src/__support/FPUtil/float80.h | 156 + .../src/__support/FPUtil/generic/add_sub.h | 5 +- .../llvm-libc/src/src/__support/FPUtil/sqrt.h | 2 +- .../src/src/__support/File/CMakeLists.txt | 2 +- .../llvm-libc/src/src/__support/File/file.h | 21 + .../src/src/__support/File/linux/file.cpp | 177 +- .../src/src/__support/File/linux/file.h | 3 + .../llvm-libc/src/src/__support/GPU/utils.h | 2 +- .../src/__support/HashTable/CMakeLists.txt | 2 +- .../__support/OSUtil/darwin/CMakeLists.txt | 2 +- .../src/__support/OSUtil/linux/CMakeLists.txt | 16 + .../OSUtil/linux/network_syscall_policy.h | 58 + .../OSUtil/linux/stat/stat_via_statx.h | 10 +- .../linux/syscall_wrappers/CMakeLists.txt | 195 +- .../linux/syscall_wrappers/clock_getres.h | 49 + .../OSUtil/linux/syscall_wrappers/clone3.h | 36 + .../OSUtil/linux/syscall_wrappers/execle.h | 49 + .../OSUtil/linux/syscall_wrappers/execve.h | 44 + .../OSUtil/linux/syscall_wrappers/fstatfs.h | 43 + .../OSUtil/linux/syscall_wrappers/getrusage.h | 37 + .../OSUtil/linux/syscall_wrappers/nanosleep.h | 51 + .../linux/syscall_wrappers/rt_sigaction.h | 36 + .../OSUtil/linux/syscall_wrappers/statfs.h | 43 + .../OSUtil/linux/syscall_wrappers/sysinfo.h | 6 +- .../linux/syscall_wrappers/timer_create.h | 91 + .../linux/syscall_wrappers/timer_delete.h | 38 + .../linux/syscall_wrappers/timer_gettime.h | 49 + .../linux/syscall_wrappers/timer_settime.h | 50 + .../OSUtil/linux/syscall_wrappers/wait4.h | 99 + .../llvm-libc/src/src/__support/big_int.h | 12 +- .../src/src/__support/builtins/CMakeLists.txt | 390 +- .../src/src/__support/builtins/addtf3.h | 4 +- .../src/src/__support/builtins/cmp_helper.h | 63 + .../src/src/__support/builtins/divtf3.h | 4 +- .../src/src/__support/builtins/extenddftf2.h | 36 + .../src/src/__support/builtins/extendsfdf2.h | 30 + .../src/src/__support/builtins/extendsftf2.h | 36 + .../src/src/__support/builtins/extendxftf2.h | 41 + .../src/src/__support/builtins/fixdfdi.h | 32 + .../src/src/__support/builtins/fixdfsi.h | 32 + .../src/src/__support/builtins/fixdfti.h | 39 + .../src/__support/builtins/fixint_helper.h | 84 + .../src/src/__support/builtins/fixsfdi.h | 32 + .../src/src/__support/builtins/fixsfsi.h | 32 + .../src/src/__support/builtins/fixsfti.h | 39 + .../src/src/__support/builtins/fixunsdfdi.h | 32 + .../src/src/__support/builtins/fixunsdfsi.h | 32 + .../src/src/__support/builtins/fixunsdfti.h | 39 + .../src/src/__support/builtins/fixunssfdi.h | 32 + .../src/src/__support/builtins/fixunssfsi.h | 32 + .../src/src/__support/builtins/fixunssfti.h | 39 + .../src/src/__support/builtins/floatdidf.h | 32 + .../src/src/__support/builtins/floatdisf.h | 32 + .../src/__support/builtins/floatint_helper.h | 59 + .../src/src/__support/builtins/floatsidf.h | 32 + .../src/src/__support/builtins/floatsisf.h | 32 + .../src/src/__support/builtins/floattidf.h | 38 + .../src/src/__support/builtins/floattisf.h | 38 + .../src/src/__support/builtins/floatundidf.h | 32 + .../src/src/__support/builtins/floatundisf.h | 32 + .../src/src/__support/builtins/floatunsidf.h | 32 + .../src/src/__support/builtins/floatunsisf.h | 32 + .../src/src/__support/builtins/floatuntidf.h | 38 + .../src/src/__support/builtins/floatuntisf.h | 38 + .../src/__support/builtins/fpconvert_helper.h | 83 + .../src/src/__support/builtins/multf3.h | 4 +- .../src/src/__support/builtins/negdf2.h | 37 + .../src/src/__support/builtins/negsf2.h | 37 + .../src/src/__support/builtins/subtf3.h | 4 +- .../src/src/__support/builtins/truncdfsf2.h | 30 + .../src/src/__support/builtins/trunctfdf2.h | 36 + .../src/src/__support/builtins/trunctfsf2.h | 36 + .../src/src/__support/builtins/trunctfxf2.h | 41 + .../llvm-libc/src/src/__support/common.h | 48 +- .../llvm-libc/src/src/__support/fixedvector.h | 40 +- .../src/src/__support/float_to_string.h | 7 +- .../llvm-libc/src/src/__support/frac64.h | 58 + .../llvm-libc/src/src/__support/freelist.cpp | 33 +- .../llvm-libc/src/src/__support/freelist.h | 19 +- .../src/src/__support/freelist_heap.h | 1 + .../llvm-libc/src/src/__support/freestore.h | 290 +- .../llvm-libc/src/src/__support/freetrie.cpp | 24 +- .../llvm-libc/src/src/__support/freetrie.h | 36 +- .../src/__support/high_precision_decimal.h | 3 +- .../llvm-libc/src/src/__support/libc_assert.h | 99 +- .../src/src/__support/macros/CMakeLists.txt | 7 + .../src/src/__support/macros/config.h | 4 + .../src/src/__support/macros/hardening.h | 36 + .../src/__support/macros/properties/types.h | 44 +- .../src/src/__support/math/CMakeLists.txt | 95 +- .../src/src/__support/math/atan2f128.h | 25 +- .../src/src/__support/math/bf16addf128.h | 4 +- .../src/src/__support/math/bf16divf128.h | 4 +- .../src/src/__support/math/bf16fmaf128.h | 4 +- .../src/src/__support/math/bf16mulf128.h | 4 +- .../src/src/__support/math/bf16subf128.h | 4 +- .../src/src/__support/math/canonicalizef128.h | 4 +- .../src/src/__support/math/ceilf128.h | 11 +- .../src/src/__support/math/copysignf128.h | 4 +- .../src/src/__support/math/daddf128.h | 4 +- .../src/src/__support/math/ddivf128.h | 4 +- .../src/src/__support/math/dfmaf128.h | 4 +- .../src/src/__support/math/dmulf128.h | 4 +- .../src/src/__support/math/dsqrtf128.h | 4 +- .../src/src/__support/math/dsubf128.h | 4 +- .../src/src/__support/math/erfcf16.h | 4 +- .../llvm-libc/src/src/__support/math/erff16.h | 7 +- .../src/__support/math/expf_integer_eval.h | 284 + .../llvm-libc/src/src/__support/math/expm1.h | 4 +- .../src/src/__support/math/f16addf128.h | 4 +- .../src/src/__support/math/f16divf128.h | 4 +- .../src/src/__support/math/f16fmaf128.h | 4 +- .../src/src/__support/math/f16mulf128.h | 4 +- .../src/src/__support/math/f16sqrtf128.h | 4 +- .../src/src/__support/math/f16subf128.h | 4 +- .../src/src/__support/math/fabsf128.h | 4 +- .../src/src/__support/math/faddf128.h | 4 +- .../src/src/__support/math/fdimf128.h | 4 +- .../src/src/__support/math/fdivf128.h | 4 +- .../src/src/__support/math/ffmaf128.h | 4 +- .../src/src/__support/math/floorf128.h | 11 +- .../src/src/__support/math/fmaxf128.h | 11 +- .../src/__support/math/fmaximum_mag_numf128.h | 4 +- .../src/src/__support/math/fmaximum_magf128.h | 4 +- .../src/src/__support/math/fmaximum_numf128.h | 4 +- .../src/src/__support/math/fmaximumf128.h | 4 +- .../src/src/__support/math/fminf128.h | 11 +- .../src/__support/math/fminimum_mag_numf128.h | 4 +- .../src/src/__support/math/fminimum_magf128.h | 4 +- .../src/src/__support/math/fminimum_numf128.h | 4 +- .../src/src/__support/math/fminimumf128.h | 4 +- .../src/src/__support/math/fmodf128.h | 4 +- .../src/src/__support/math/fmulf128.h | 4 +- .../src/src/__support/math/frexpf128.h | 4 +- .../src/src/__support/math/fromfpf128.h | 4 +- .../src/src/__support/math/fromfpxf128.h | 4 +- .../src/src/__support/math/fsqrtf128.h | 4 +- .../src/src/__support/math/fsubf128.h | 4 +- .../src/src/__support/math/gamma_util.h | 116 + .../src/src/__support/math/getpayloadf128.h | 4 +- .../src/src/__support/math/ilogbf128.h | 4 +- .../src/src/__support/math/iscanonicalf128.h | 13 +- .../src/src/__support/math/isnanf128.h | 13 +- .../src/src/__support/math/issignalingf128.h | 11 +- .../src/src/__support/math/ldexpf128.h | 4 +- .../src/src/__support/math/lgammaf.h | 505 ++ .../src/src/__support/math/lgammaf16.h | 92 +- .../src/src/__support/math/llogbf128.h | 4 +- .../src/src/__support/math/llrintf128.h | 13 +- .../src/src/__support/math/llroundf128.h | 13 +- .../src/src/__support/math/logbf128.h | 4 +- .../src/src/__support/math/lrintf128.h | 13 +- .../src/src/__support/math/lroundf128.h | 13 +- .../src/src/__support/math/modff128.h | 4 +- .../src/src/__support/math/nanf128.h | 4 +- .../src/src/__support/math/nearbyintf128.h | 11 +- .../src/src/__support/math/nextafterf128.h | 4 +- .../src/src/__support/math/nextdownf128.h | 4 +- .../src/src/__support/math/nextupf128.h | 4 +- .../src/src/__support/math/remainderf128.h | 4 +- .../src/src/__support/math/remquof128.h | 4 +- .../src/src/__support/math/rintf128.h | 11 +- .../llvm-libc/src/src/__support/math/round.h | 29 +- .../src/src/__support/math/roundevenf128.h | 11 +- .../llvm-libc/src/src/__support/math/roundf.h | 29 +- .../src/src/__support/math/roundf128.h | 11 +- .../src/src/__support/math/scalblnf128.h | 4 +- .../src/src/__support/math/scalbnf128.h | 4 +- .../src/src/__support/math/setpayloadf128.h | 4 +- .../src/__support/math/setpayloadsigf128.h | 4 +- .../src/src/__support/math/sqrtf128.h | 15 +- .../llvm-libc/src/src/__support/math/tan.h | 5 +- .../src/src/__support/math/totalorderf128.h | 4 +- .../src/__support/math/totalordermagf128.h | 4 +- .../src/src/__support/math/truncf128.h | 11 +- .../src/src/__support/math/ufromfpf128.h | 4 +- .../src/src/__support/math/ufromfpxf128.h | 4 +- .../src/src/__support/mathvec/CMakeLists.txt | 10 +- .../src/src/__support/mathvec/exp10f.h | 46 +- .../src/src/__support/mathvec/exp2f.h | 42 +- .../src/src/__support/mathvec/expf.h | 36 +- .../src/src/__support/mathvec/expf_utils.h | 35 +- .../src/__support/printf_core/CMakeLists.txt | 7 +- .../src/src/__support/printf_core/parser.h | 4 +- .../src/__support/printf_core/printf_config.h | 2 +- .../printf_core/write_int_converter.h | 4 +- .../src/src/__support/str_to_float.h | 12 +- .../src/src/__support/threads/CMakeLists.txt | 16 +- .../src/src/__support/threads/identifier.h | 2 +- .../__support/threads/linux/CMakeLists.txt | 7 +- .../src/__support/threads/linux/thread.cpp | 23 +- .../src/src/__support/threads/thread.cpp | 3 +- .../src/src/__support/threads/thread.h | 102 +- .../src/__support/threads/thread_attributes.h | 121 + .../src/src/__support/time/CMakeLists.txt | 4 +- .../llvm-libc/src/src/__support/tlsf_table.h | 219 + .../src/src/__support/wchar/CMakeLists.txt | 3 +- .../src/__support/wchar/character_converter.h | 30 + .../src/src/__support/wctype/CMakeLists.txt | 1 - deps/v8/third_party/zlib/BUILD.gn | 22 +- deps/v8/third_party/zlib/CMakeLists.txt | 5 +- deps/v8/third_party/zlib/adler32_simd.c | 2 +- deps/v8/third_party/zlib/chromeconf.h | 3 - deps/v8/third_party/zlib/compare256.h | 56 + deps/v8/third_party/zlib/cpu_features.c | 5 + deps/v8/third_party/zlib/crc32_simd.c | 6 + deps/v8/third_party/zlib/crc_folding.c | 14 + deps/v8/third_party/zlib/deflate.c | 22 +- deps/v8/third_party/zlib/google/OWNERS | 2 +- .../zlib/google/zip_reader_unittest.cc | 13 +- deps/v8/tools/.vpython3 | 143 - deps/v8/tools/BUILD.gn | 3 +- deps/v8/tools/bash-completion.sh | 9 +- deps/v8/tools/bigsleep/create_snapshot.py | 35 +- deps/v8/tools/builtins-pgo/profile_only.py | 12 + deps/v8/tools/cfi/ignores.txt | 4 + .../clusterfuzz/foozzie/v8_fuzz_flags.json | 4 +- .../trials/clusterfuzz_trials_config.json | 4 +- deps/v8/tools/debug_helper/BUILD.gn | 6 +- .../debug_helper/get-object-properties.cc | 11 +- deps/v8/tools/debug_helper/plugins/README.md | 33 + .../tools/debug_helper/plugins/gdb_plugin.py | 72 +- .../tools/debug_helper/plugins/lldb_plugin.py | 28 + .../plugins/test/helpers/source.py | 121 + .../plugins/test/test_gdb_core.py | 17 + .../plugins/test/test_gdb_live.py | 20 + .../plugins/test/test_lldb_core.py | 17 + .../plugins/test/test_lldb_live.py | 20 + .../debug_helper/plugins/v8dbg/commands.py | 73 +- .../debug_helper/plugins/v8dbg/format.py | 75 + .../plugins/v8dbg/shared_bridge.py | 76 +- deps/v8/tools/dev/gm.py | 1 + deps/v8/tools/dev/setup_worktree_build.py | 6 + deps/v8/tools/dev/update-compile-commands.py | 17 +- deps/v8/tools/gcmole/gcmole-tools.tar.gz.sha1 | 2 +- deps/v8/tools/gen-postmortem-metadata.py | 2 +- deps/v8/tools/lldb_commands.py | 4 +- deps/v8/tools/locs.py | 2 +- deps/v8/tools/mb/mb_test.py | 2 +- deps/v8/tools/metagen/.gitignore | 2 + deps/v8/tools/metagen/__init__.py | 3 + deps/v8/tools/metagen/clang_bootstrap.py | 217 + deps/v8/tools/metagen/compile_flags.py | 263 + deps/v8/tools/metagen/compile_flags_test.py | 90 + deps/v8/tools/metagen/cpp_hier.py | 513 ++ deps/v8/tools/metagen/extract.py | 208 + deps/v8/tools/metagen/harvest-driver.cc | 14 + deps/v8/tools/metagen/instance_types.py | 536 ++ deps/v8/tools/metagen/metagen.py | 510 ++ deps/v8/tools/package-lock.json | 40 +- .../tools/regexp/correctness_fuzzer/README.md | 86 +- .../correctness_fuzzer/correctness_fuzzer.py | 416 +- .../correctness_fuzzer/grammar/__init__.py | 60 + .../correctness_fuzzer/grammar/cases.py | 72 + .../correctness_fuzzer/grammar/menus.py | 82 + .../correctness_fuzzer/grammar/profiles.py | 80 + .../correctness_fuzzer/grammar/registry.py | 182 + .../correctness_fuzzer/grammar/rules.py | 616 +++ .../regexp/correctness_fuzzer/grammar_test.py | 436 ++ .../regexp/correctness_fuzzer/harness.js | 55 +- deps/v8/tools/release/common_includes.py | 10 +- deps/v8/tools/release/create_release.py | 2 +- deps/v8/tools/release/mergeinfo.py | 2 +- deps/v8/tools/run-clang-tidy.py | 2 +- deps/v8/tools/run_perf.py | 2 +- deps/v8/tools/sanitizers/sancov_formatter.py | 6 +- deps/v8/tools/testrunner/base_runner.py | 64 +- deps/v8/tools/testrunner/local/variants.py | 50 +- deps/v8/tools/testrunner/objects/testcase.py | 12 +- deps/v8/tools/testrunner/outproc/test262.py | 2 +- deps/v8/tools/testrunner/standard_runner.py | 3 +- .../tools/testrunner/standard_runner_test.py | 57 + deps/v8/tools/testrunner/testproc/fuzzer.py | 4 +- deps/v8/tools/testrunner/testproc/progress.py | 23 +- deps/v8/tools/testrunner/utils/test_utils.py | 30 +- deps/v8/tools/turbolizer/package-lock.json | 24 +- .../tools/turbolizer/src/turbo-visualizer.ts | 2 +- deps/v8/tools/update-object-macros-undef.py | 2 +- deps/v8/tools/v8_presubmit.py | 16 +- deps/v8/tools/vpython.toml | 37 + deps/v8/tools/vpython.toml.uv.lock | 202 + deps/v8/tools/wasm/update-wasm-spec-tests.sh | 2 +- deps/v8/vpython.toml | 30 + deps/v8/vpython.toml.uv.lock | 126 + 2417 files changed, 85938 insertions(+), 35601 deletions(-) delete mode 100644 deps/v8/.vpython3 create mode 100644 deps/v8/agents/PRESUBMIT.py create mode 100644 deps/v8/agents/scripts/install_for_copilot_cli.py create mode 100644 deps/v8/agents/scripts/install_for_copilot_cli_test.py delete mode 100644 deps/v8/src/common/segmented-table-inl.h delete mode 100644 deps/v8/src/common/segmented-table.h delete mode 100644 deps/v8/src/compiler/linear-scheduler.cc delete mode 100644 deps/v8/src/compiler/linear-scheduler.h delete mode 100644 deps/v8/src/compiler/revectorizer.cc delete mode 100644 deps/v8/src/compiler/revectorizer.h create mode 100644 deps/v8/src/debug/debug-scope-info.cc create mode 100644 deps/v8/src/debug/debug-scope-info.h delete mode 100644 deps/v8/src/debug/liveedit-diff.cc delete mode 100644 deps/v8/src/debug/liveedit-diff.h delete mode 100644 deps/v8/src/debug/liveedit.cc delete mode 100644 deps/v8/src/debug/liveedit.h delete mode 100644 deps/v8/src/deoptimizer/DEPS create mode 100644 deps/v8/src/flags/feature-flags.h create mode 100644 deps/v8/src/objects/all-objects.h create mode 100644 deps/v8/src/objects/instance-types-gen.h create mode 100644 deps/v8/src/objects/managed-type-id.h create mode 100644 deps/v8/src/objects/managed.tq create mode 100644 deps/v8/src/objects/object-conversions-inl.h create mode 100644 deps/v8/src/sandbox/segmented-table-inl.h create mode 100644 deps/v8/src/sandbox/segmented-table.cc create mode 100644 deps/v8/src/sandbox/segmented-table.h delete mode 100644 deps/v8/src/wasm/wasm-feature-flags.h create mode 100644 deps/v8/test/cctest/compiler/turboshaft-test-simd-shift.cc delete mode 100644 deps/v8/test/cctest/test-liveedit.cc delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-1.js delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-2.js delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-3.js delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-4.js delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-arrow-function-at-start.js delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-check-stack.js delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-compile-error.js delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-eval.js delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-inline.js delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-literals.js delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-newsource.js delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-patch-positions-replace.js delete mode 100644 deps/v8/test/debugger/debug/debug-liveedit-recursion.js create mode 100644 deps/v8/test/debugger/debug/debug-modules-many-variables.mjs delete mode 100644 deps/v8/test/debugger/debug/es6/debug-liveedit-new-target-1.js delete mode 100644 deps/v8/test/debugger/debug/es6/debug-liveedit-new-target-2.js delete mode 100644 deps/v8/test/debugger/debug/es6/debug-liveedit-new-target-3.js create mode 100644 deps/v8/test/debugger/debug/futex-reentrant-wait.js create mode 100644 deps/v8/test/debugger/debug/regress-debug-scopes-context-blocklist.js create mode 100644 deps/v8/test/filecheck/wasm/crash/invalid-wasm-code-space-size.js create mode 100644 deps/v8/test/filecheck/wasm/invalid-wasm-code-space-size-fuzzing.js create mode 100644 deps/v8/test/inspector/cpu-profiler/untrusted-session-expected.txt create mode 100644 deps/v8/test/inspector/cpu-profiler/untrusted-session.js delete mode 100644 deps/v8/test/inspector/debugger/es6-module-liveedit-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/es6-module-liveedit.js create mode 100644 deps/v8/test/inspector/debugger/evaluate-on-call-frame-scopes-expected.txt create mode 100644 deps/v8/test/inspector/debugger/evaluate-on-call-frame-scopes.js create mode 100644 deps/v8/test/inspector/debugger/pause-on-caught-exception-in-module-async-expected.txt create mode 100644 deps/v8/test/inspector/debugger/pause-on-caught-exception-in-module-async.js create mode 100644 deps/v8/test/inspector/debugger/pause-on-caught-exception-in-module-expected.txt create mode 100644 deps/v8/test/inspector/debugger/pause-on-caught-exception-in-module.js create mode 100644 deps/v8/test/inspector/debugger/pause-on-exception-in-module-async-expected.txt create mode 100644 deps/v8/test/inspector/debugger/pause-on-exception-in-module-async.js create mode 100644 deps/v8/test/inspector/debugger/pause-on-exception-in-module-expected.txt create mode 100644 deps/v8/test/inspector/debugger/pause-on-exception-in-module-imported-expected.txt create mode 100644 deps/v8/test/inspector/debugger/pause-on-exception-in-module-imported.js create mode 100644 deps/v8/test/inspector/debugger/pause-on-exception-in-module.js create mode 100644 deps/v8/test/inspector/debugger/pause-on-oom-in-eval-expected.txt create mode 100644 deps/v8/test/inspector/debugger/pause-on-oom-in-eval.js create mode 100644 deps/v8/test/inspector/debugger/restart-frame/restart-osr-frame-expected.txt create mode 100644 deps/v8/test/inspector/debugger/restart-frame/restart-osr-frame.js delete mode 100644 deps/v8/test/inspector/debugger/set-breakpoint-after-liveedit-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/set-breakpoint-after-liveedit.js delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-active-function-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-active-function.js delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-debug-evaluate-closure-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-debug-evaluate-closure.js delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-es-module-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-es-module.js delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-exception-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-exception.js delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-repl-mode-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-repl-mode.js delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-top-frame-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-top-frame-with-additional-activations-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-top-frame-with-additional-activations.js delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-top-frame.js delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-unchanged-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/set-script-source-unchanged.js delete mode 100644 deps/v8/test/inspector/regress/regress-crbug-1195927-expected.txt delete mode 100644 deps/v8/test/inspector/regress/regress-crbug-1195927.js delete mode 100644 deps/v8/test/inspector/regress/regress-crbug-1328453-expected.txt delete mode 100644 deps/v8/test/inspector/regress/regress-crbug-1328453.js create mode 100644 deps/v8/test/inspector/runtime/custom-preview-proxy-expected.txt create mode 100644 deps/v8/test/inspector/runtime/custom-preview-proxy.js create mode 100644 deps/v8/test/inspector/runtime/deep-serialization-errors-expected.txt create mode 100644 deps/v8/test/inspector/runtime/deep-serialization-errors.js create mode 100644 deps/v8/test/inspector/runtime/evaluate-side-effect-free-monitor-events-expected.txt create mode 100644 deps/v8/test/inspector/runtime/evaluate-side-effect-free-monitor-events.js create mode 100644 deps/v8/test/inspector/runtime/import-defer-module-namespace-expected.txt create mode 100644 deps/v8/test/inspector/runtime/import-defer-module-namespace-subtype-expected.txt create mode 100644 deps/v8/test/inspector/runtime/import-defer-module-namespace-subtype.js create mode 100644 deps/v8/test/inspector/runtime/import-defer-module-namespace.js create mode 100644 deps/v8/test/inspector/runtime/regress-520052954-2-expected.txt create mode 100644 deps/v8/test/inspector/runtime/regress-520052954-2.js create mode 100644 deps/v8/test/inspector/runtime/regress-520052954-3-expected.txt create mode 100644 deps/v8/test/inspector/runtime/regress-520052954-3.js create mode 100644 deps/v8/test/inspector/runtime/regress-523442920-expected.txt create mode 100644 deps/v8/test/inspector/runtime/regress-523442920.js create mode 100644 deps/v8/test/inspector/runtime/regress-custom-preview-uaf-expected.txt create mode 100644 deps/v8/test/inspector/runtime/regress-custom-preview-uaf.js create mode 100644 deps/v8/test/intl/date-format/temporal-cjk-format.js create mode 100644 deps/v8/test/intl/date-format/year-woy-field.js create mode 100644 deps/v8/test/message/fail/d8-trace-config-invalid.bad-json create mode 100644 deps/v8/test/message/fail/d8-trace-config-invalid.js create mode 100644 deps/v8/test/message/fail/d8-trace-config-invalid.out create mode 100644 deps/v8/test/message/fail/d8-trace-config-missing.js create mode 100644 deps/v8/test/message/fail/d8-trace-config-missing.out create mode 100644 deps/v8/test/message/fail/modules-import-redeclare4.mjs create mode 100644 deps/v8/test/message/fail/modules-import-redeclare4.out create mode 100644 deps/v8/test/mjsunit/array-indexof-dictionary-elements.js create mode 100644 deps/v8/test/mjsunit/array-lastindexof-fast.js create mode 100644 deps/v8/test/mjsunit/compiler/no-stack-checks.js create mode 100644 deps/v8/test/mjsunit/compiler/regress-542923494.js create mode 100644 deps/v8/test/mjsunit/compiler/script-context-const-load.js create mode 100644 deps/v8/test/mjsunit/compiler/script-context-let-load.js create mode 100644 deps/v8/test/mjsunit/cross-realm-callsite.js create mode 100644 deps/v8/test/mjsunit/d8/d8-code-cache-import.js create mode 100644 deps/v8/test/mjsunit/d8/d8-code-cache-module-after-execute.mjs create mode 100644 deps/v8/test/mjsunit/d8/d8-code-cache-module-compile-only.mjs create mode 100644 deps/v8/test/mjsunit/d8/d8-code-cache-module-dep.mjs create mode 100644 deps/v8/test/mjsunit/d8/d8-code-cache-module-import.mjs create mode 100644 deps/v8/test/mjsunit/d8/d8-code-cache-module.mjs create mode 100644 deps/v8/test/mjsunit/d8/d8-console-assert-terminate.js create mode 100644 deps/v8/test/mjsunit/d8/d8-inspector-shutdown-pending-evaluate.js create mode 100644 deps/v8/test/mjsunit/d8/d8-test-access-check.js create mode 100644 deps/v8/test/mjsunit/d8/d8-test-interceptor.js create mode 100644 deps/v8/test/mjsunit/d8/d8-test-special-object.js create mode 100644 deps/v8/test/mjsunit/d8/d8-tostring-errors.js create mode 100644 deps/v8/test/mjsunit/debug-osr-debug-break.js create mode 100644 deps/v8/test/mjsunit/debug-osr-step-in-blackboxed.js create mode 100644 deps/v8/test/mjsunit/debug-osr-step-on-throw-blackboxed.js create mode 100644 deps/v8/test/mjsunit/debug-osr-step-on-throw.js create mode 100644 deps/v8/test/mjsunit/debug-osr-step-out.js create mode 100644 deps/v8/test/mjsunit/harmony/async-iterator-prototype-async-dispose.js create mode 100644 deps/v8/test/mjsunit/harmony/bigint/mod-fold.js create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-defer-get-private-member.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-defer-own-property-keys-no-exports.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-defer-sync-eval-async-cycle.js create mode 100644 deps/v8/test/mjsunit/harmony/modules-import-defer-throws-in-api-callback.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-skip-import-defer-no-exports.mjs create mode 100644 deps/v8/test/mjsunit/harmony/modules-skip-import-defer-throws-primitive.mjs create mode 100644 deps/v8/test/mjsunit/lower_limits_mode/regress/regress-561323344.js create mode 100644 deps/v8/test/mjsunit/maglev/call-with-spread-jsarray.js create mode 100644 deps/v8/test/mjsunit/maglev/call-with-spread-object-tracking.js create mode 100644 deps/v8/test/mjsunit/maglev/check-int32-is-smi.js create mode 100644 deps/v8/test/mjsunit/maglev/collection-iterator-next-inlined.js create mode 100644 deps/v8/test/mjsunit/maglev/collection-iterator-next.js create mode 100644 deps/v8/test/mjsunit/maglev/float64-conversions.js create mode 100644 deps/v8/test/mjsunit/maglev/generator-next-cross-realm.js create mode 100644 deps/v8/test/mjsunit/maglev/holey-double-store-canonicalization.js create mode 100644 deps/v8/test/mjsunit/maglev/holey-double-unsilenced-exit.js create mode 100644 deps/v8/test/mjsunit/maglev/int32-mod-range.js create mode 100644 deps/v8/test/mjsunit/maglev/keyed-access-thin-constant-key.js create mode 100644 deps/v8/test/mjsunit/maglev/loop-preheader.js create mode 100644 deps/v8/test/mjsunit/maglev/map-iterator-creation.js create mode 100644 deps/v8/test/mjsunit/maglev/optimize-large-function.js create mode 100644 deps/v8/test/mjsunit/maglev/osr-from-ml-to-tf-mode-1.js create mode 100644 deps/v8/test/mjsunit/maglev/osr-multiple-loops.js create mode 100644 deps/v8/test/mjsunit/maglev/osr-only-interrupt.js create mode 100644 deps/v8/test/mjsunit/maglev/promise-catch-reduction.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-394119934.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-538562119.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-538884561-1.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-538884561-2.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-539121142.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-540467501.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-540905585.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-543919179.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-544053478.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-547330043.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-551265173.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-552832446.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-556962428.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-int32mod-cse.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-truncated-int32-product.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-truncated-region-bound.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-truncated-region-operand.js create mode 100644 deps/v8/test/mjsunit/maglev/regress-yield-star-lazy-deopt.js create mode 100644 deps/v8/test/mjsunit/maglev/regress/regress-546472719.js create mode 100644 deps/v8/test/mjsunit/maglev/regress/regress-546792433.js create mode 100644 deps/v8/test/mjsunit/maglev/regress/regress-551320574.js create mode 100644 deps/v8/test/mjsunit/maglev/regress/regress-552783942.js create mode 100644 deps/v8/test/mjsunit/modules-many-bindings-lazy.mjs create mode 100644 deps/v8/test/mjsunit/modules-skip-many-bindings.mjs create mode 100644 deps/v8/test/mjsunit/regexp-split-cache-disabled.js create mode 100644 deps/v8/test/mjsunit/regexp-split-cache-gc.js create mode 100644 deps/v8/test/mjsunit/regexp-split-cache.js create mode 100644 deps/v8/test/mjsunit/regexp/first-character-reject-bitset.js create mode 100644 deps/v8/test/mjsunit/regress/regress-42204525.js create mode 100644 deps/v8/test/mjsunit/regress/regress-450237486.js create mode 100644 deps/v8/test/mjsunit/regress/regress-476989751.js create mode 100644 deps/v8/test/mjsunit/regress/regress-504697280.js create mode 100644 deps/v8/test/mjsunit/regress/regress-531513399-1.js create mode 100644 deps/v8/test/mjsunit/regress/regress-531513399-2.js create mode 100644 deps/v8/test/mjsunit/regress/regress-531513399-3.js create mode 100644 deps/v8/test/mjsunit/regress/regress-531513399-4.js create mode 100644 deps/v8/test/mjsunit/regress/regress-531513399-5.js create mode 100644 deps/v8/test/mjsunit/regress/regress-533049459.js create mode 100644 deps/v8/test/mjsunit/regress/regress-533926191.js create mode 100644 deps/v8/test/mjsunit/regress/regress-538529872-2.js create mode 100644 deps/v8/test/mjsunit/regress/regress-538529872.js create mode 100644 deps/v8/test/mjsunit/regress/regress-539212794.js create mode 100644 deps/v8/test/mjsunit/regress/regress-539350801-long-chain-int32-operand.js create mode 100644 deps/v8/test/mjsunit/regress/regress-539350801-long-chain.js create mode 100644 deps/v8/test/mjsunit/regress/regress-539350801-nine-terms.js create mode 100644 deps/v8/test/mjsunit/regress/regress-539350801.js create mode 100644 deps/v8/test/mjsunit/regress/regress-540471948.js create mode 100644 deps/v8/test/mjsunit/regress/regress-540482886.js create mode 100644 deps/v8/test/mjsunit/regress/regress-541491578.js create mode 100644 deps/v8/test/mjsunit/regress/regress-542377192.js create mode 100644 deps/v8/test/mjsunit/regress/regress-542636068.js create mode 100644 deps/v8/test/mjsunit/regress/regress-544223867.js create mode 100644 deps/v8/test/mjsunit/regress/regress-545767601.js create mode 100644 deps/v8/test/mjsunit/regress/regress-546308452.js create mode 100644 deps/v8/test/mjsunit/regress/regress-546370262.js create mode 100644 deps/v8/test/mjsunit/regress/regress-546665034.js create mode 100644 deps/v8/test/mjsunit/regress/regress-546815249.js create mode 100644 deps/v8/test/mjsunit/regress/regress-547027738-wasm.js create mode 100644 deps/v8/test/mjsunit/regress/regress-547027738.js create mode 100644 deps/v8/test/mjsunit/regress/regress-547982135.js create mode 100644 deps/v8/test/mjsunit/regress/regress-549226708.js create mode 100644 deps/v8/test/mjsunit/regress/regress-549231120.js create mode 100644 deps/v8/test/mjsunit/regress/regress-551047528.js create mode 100644 deps/v8/test/mjsunit/regress/regress-551186503.js create mode 100644 deps/v8/test/mjsunit/regress/regress-557062659.js create mode 100644 deps/v8/test/mjsunit/regress/regress-558005441.js create mode 100644 deps/v8/test/mjsunit/regress/regress-558186672.js create mode 100644 deps/v8/test/mjsunit/regress/regress-558280524.js create mode 100644 deps/v8/test/mjsunit/regress/regress-559580852.js create mode 100644 deps/v8/test/mjsunit/regress/regress-559756520.js create mode 100644 deps/v8/test/mjsunit/regress/regress-563235411.js create mode 100644 deps/v8/test/mjsunit/regress/regress-563716534.js create mode 100644 deps/v8/test/mjsunit/regress/regress-567538973.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-514165662.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-552342545.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-560233248.js create mode 100644 deps/v8/test/mjsunit/regress/regress-fast-api-uint64-negative.js create mode 100644 deps/v8/test/mjsunit/regress/regress-fast-path-zero-exclusion-object.js create mode 100644 deps/v8/test/mjsunit/regress/regress-homomorphic-maglev.js create mode 100644 deps/v8/test/mjsunit/regress/regress-homomorphic-turbofan.js create mode 100644 deps/v8/test/mjsunit/regress/regress-homomorphic-unoptimized.js create mode 100644 deps/v8/test/mjsunit/regress/regress-parse-only-stress-runs.js create mode 100644 deps/v8/test/mjsunit/regress/regress-rab-proto-oob.js create mode 100644 deps/v8/test/mjsunit/regress/regress-value-serializer.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-526163463.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-535659723.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-540446645.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-541316788.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-543901836.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-550812031.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-552026580.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-554714206.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-555812363.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-558539954.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-drumbrake-unreachable-cast.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-interpreter-failed-reentry.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-simd-526303932.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-simd-547572465.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-simd-549328680-2.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-simd-549328680.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-simd-555760230.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-simd-555806042-2.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-simd-555806042.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-simd-557106111.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-simd-557107091.js create mode 100644 deps/v8/test/mjsunit/regress/wasm/regress-simd-557107349.js create mode 100644 deps/v8/test/mjsunit/sandbox/regress-530292681.js create mode 100644 deps/v8/test/mjsunit/sandbox/regress-535892918.js create mode 100644 deps/v8/test/mjsunit/sandbox/regress-540033151.js create mode 100644 deps/v8/test/mjsunit/sandbox/regress-554034656.js create mode 100644 deps/v8/test/mjsunit/sandbox/regress/regress-532204454.js create mode 100644 deps/v8/test/mjsunit/sandbox/regress/regress-546253900.js create mode 100644 deps/v8/test/mjsunit/sandbox/regress/regress-561655173-completion.js create mode 100644 deps/v8/test/mjsunit/sandbox/regress/regress-561655173.js create mode 100644 deps/v8/test/mjsunit/shared-memory/regress/regress-541880797.js create mode 100644 deps/v8/test/mjsunit/turbolev/check-uint32-is-smi.js create mode 100644 deps/v8/test/mjsunit/turbolev/dataview-deopt-oob.js create mode 100644 deps/v8/test/mjsunit/turbolev/escape-analysis-inside-loop-phi-backedge.js create mode 100644 deps/v8/test/mjsunit/turbolev/escape-analysis-loop-phi-backedge-dependency.js create mode 100644 deps/v8/test/mjsunit/turbolev/escape-analysis-nested-loop-revisit.js create mode 100644 deps/v8/test/mjsunit/turbolev/escape-analysis-regreee-540324228.js create mode 100644 deps/v8/test/mjsunit/turbolev/escape-analysis-regress-538666333.js create mode 100644 deps/v8/test/mjsunit/turbolev/escape-analysis-regress-539464276.js create mode 100644 deps/v8/test/mjsunit/turbolev/escape-analysis-regress-542377197.js create mode 100644 deps/v8/test/mjsunit/turbolev/escape-analysis-regress-543940209.js create mode 100644 deps/v8/test/mjsunit/turbolev/escape-analysis-regress-544548648.js create mode 100644 deps/v8/test/mjsunit/turbolev/holey-double-load-arith.js create mode 100644 deps/v8/test/mjsunit/turbolev/holey-double-phi-distinguish.js create mode 100644 deps/v8/test/mjsunit/turbolev/keyed-access-thin-constant-key.js create mode 100644 deps/v8/test/mjsunit/turbolev/module-export-loop-peel.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-533979617.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-538938804.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-539006995-1.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-539006995-2.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-539006995-3.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-540482606.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-540651858.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-540717862.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-543836266.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-543954265.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-544083885.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-544150244.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-546639196.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-546647038.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-546842384.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-546963430.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-546979662.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-552783942.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-556768919.js create mode 100644 deps/v8/test/mjsunit/turbolev/regress-567177599.js create mode 100644 deps/v8/test/mjsunit/turbolev/throw-reference-error-if-hole.js rename deps/v8/test/mjsunit/turboshaft/{regress-527385397.js => regress-527385397-1.js} (87%) create mode 100644 deps/v8/test/mjsunit/turboshaft/regress-527385397-2.js create mode 100644 deps/v8/test/mjsunit/turboshaft/regress-539984773.js create mode 100644 deps/v8/test/mjsunit/wasm/import-wrapper-uninhabitable.js create mode 100644 deps/v8/test/mjsunit/wasm/shared-everything/ref-cast-in-different-isolate.js create mode 100644 deps/v8/test/mjsunit/wasm/shared-everything/shared-js-roundtrip.js create mode 100644 deps/v8/test/mjsunit/wasm/stack-switching-minor-gc.js create mode 100644 deps/v8/test/mjsunit/wasm/wide-add.js create mode 100644 deps/v8/test/mjsunit/wasm/wrapper-microbenchmark.js delete mode 100644 deps/v8/test/unittests/compiler/linear-scheduler-unittest.cc delete mode 100644 deps/v8/test/unittests/compiler/revec-unittest.cc create mode 100644 deps/v8/test/unittests/debug/debug-scope-info-unittest.cc create mode 100644 deps/v8/test/unittests/profiler/output-stream-writer-unittest.cc create mode 100644 deps/v8/test/unittests/regress/regress-536954139-unittest.cc create mode 100644 deps/v8/test/unittests/sandbox/segmented-table-unittest.cc create mode 100644 deps/v8/test/unittests/wasm/wasm-interpreter-thread-unittest.cc create mode 100644 deps/v8/third_party/abseil-cpp/.style.yapf delete mode 100644 deps/v8/third_party/abseil-cpp/absl/base/internal/hardening.cc create mode 100644 deps/v8/third_party/abseil-cpp/absl/strings/match_benchmark.cc create mode 100644 deps/v8/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix_test.cc create mode 100755 deps/v8/third_party/abseil-cpp/convert_bazel_to_gn.py create mode 100644 deps/v8/third_party/highway/src/hwy/contrib/sort/BUILD create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/elf_proxy.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/fnmatch_macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/netdb_macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/semaphore_macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/dev_t.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/sem_t.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/struct_addrinfo.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/struct_if_nameindex.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/struct_itimerspec.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/struct_link_map.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/struct_passwd.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/struct_r_debug.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/struct_sigevent.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/struct_statfs.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/struct_sysinfo.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/timer_t.h create mode 100644 deps/v8/third_party/llvm-libc/src/hdr/types/useconds_t.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/fnmatch.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/grp.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/dirent-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/fnmatch-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/linux/dirent-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/linux/netdb-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/linux/sys-mount-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/linux/sys-statfs-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/linux/sys-sysmacros-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/netdb-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/semaphore-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/sys-mount-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/sys-statfs-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/sys-sysmacros-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-macros/syslog-macros.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-proxy/CMakeLists.txt create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-proxy/elf_proxy.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/fsid_t.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/linux/struct_sysinfo.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/reclen_t.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/sem_t.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/sig_t.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/struct_addrinfo.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/struct_group.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/struct_if_nameindex.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/struct_itimerspec.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/struct_link_map.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/struct_passwd.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/struct_posix_dent.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/struct_r_debug.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/struct_sigevent.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/struct_statfs.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/struct_sysinfo.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/struct_ucred.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/llvm-libc-types/timer_t.h create mode 100644 deps/v8/third_party/llvm-libc/src/include/memory.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/netdb.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/pwd.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/semaphore.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/sys/fcntl.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/sys/mount.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/sys/poll.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/sys/signal.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/sys/statfs.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/sys/sysinfo.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/sys/syslog.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/sys/sysmacros.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/sys/unistd.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/sys/vfs.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/include/syslog.yaml create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/extenddftf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/extendsfdf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/extendsftf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/extendxftf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/fixdfdi.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/fixdfsi.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/fixdfti.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/fixsfdi.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/fixsfsi.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/fixsfti.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/fixunsdfdi.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/fixunsdfsi.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/fixunsdfti.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/fixunssfdi.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/fixunssfsi.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/fixunssfti.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/floatdidf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/floatdisf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/floatsidf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/floatsisf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/floattidf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/floattisf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/floatundidf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/floatundisf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/floatunsidf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/floatunsisf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/floatuntidf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/floatuntisf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/negdf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/negsf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/truncdfsf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/trunctfdf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/trunctfsf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/builtins/trunctfxf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/math/lgammaf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/math/static_rounding/expf.h create mode 100644 deps/v8/third_party/llvm-libc/src/shared/static_rounding_math.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/FPUtil/float80.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/network_syscall_policy.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/clock_getres.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/clone3.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/execle.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/execve.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/fstatfs.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/getrusage.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/nanosleep.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/rt_sigaction.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/statfs.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/timer_create.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/timer_delete.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/timer_gettime.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/timer_settime.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/OSUtil/linux/syscall_wrappers/wait4.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/cmp_helper.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/extenddftf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/extendsfdf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/extendsftf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/extendxftf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixdfdi.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixdfsi.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixdfti.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixint_helper.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixsfdi.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixsfsi.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixsfti.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixunsdfdi.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixunsdfsi.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixunsdfti.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixunssfdi.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixunssfsi.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fixunssfti.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floatdidf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floatdisf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floatint_helper.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floatsidf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floatsisf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floattidf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floattisf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floatundidf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floatundisf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floatunsidf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floatunsisf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floatuntidf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/floatuntisf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/fpconvert_helper.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/negdf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/negsf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/truncdfsf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/trunctfdf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/trunctfsf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/builtins/trunctfxf2.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/frac64.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/macros/hardening.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/math/expf_integer_eval.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/math/gamma_util.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/math/lgammaf.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/threads/thread_attributes.h create mode 100644 deps/v8/third_party/llvm-libc/src/src/__support/tlsf_table.h create mode 100644 deps/v8/third_party/zlib/compare256.h delete mode 100644 deps/v8/tools/.vpython3 create mode 100644 deps/v8/tools/debug_helper/plugins/test/helpers/source.py create mode 100644 deps/v8/tools/debug_helper/plugins/v8dbg/format.py create mode 100644 deps/v8/tools/metagen/.gitignore create mode 100644 deps/v8/tools/metagen/__init__.py create mode 100644 deps/v8/tools/metagen/clang_bootstrap.py create mode 100644 deps/v8/tools/metagen/compile_flags.py create mode 100644 deps/v8/tools/metagen/compile_flags_test.py create mode 100644 deps/v8/tools/metagen/cpp_hier.py create mode 100644 deps/v8/tools/metagen/extract.py create mode 100644 deps/v8/tools/metagen/harvest-driver.cc create mode 100644 deps/v8/tools/metagen/instance_types.py create mode 100644 deps/v8/tools/metagen/metagen.py create mode 100644 deps/v8/tools/regexp/correctness_fuzzer/grammar/__init__.py create mode 100644 deps/v8/tools/regexp/correctness_fuzzer/grammar/cases.py create mode 100644 deps/v8/tools/regexp/correctness_fuzzer/grammar/menus.py create mode 100644 deps/v8/tools/regexp/correctness_fuzzer/grammar/profiles.py create mode 100644 deps/v8/tools/regexp/correctness_fuzzer/grammar/registry.py create mode 100644 deps/v8/tools/regexp/correctness_fuzzer/grammar/rules.py create mode 100755 deps/v8/tools/regexp/correctness_fuzzer/grammar_test.py create mode 100644 deps/v8/tools/vpython.toml create mode 100644 deps/v8/tools/vpython.toml.uv.lock create mode 100644 deps/v8/vpython.toml create mode 100644 deps/v8/vpython.toml.uv.lock diff --git a/deps/v8/.gitignore b/deps/v8/.gitignore index d7f3cb65e118..c9cbb930c22c 100644 --- a/deps/v8/.gitignore +++ b/deps/v8/.gitignore @@ -35,6 +35,7 @@ .gclient_entries .gdb_history .gemini +.github .idea .jetskicli .jslint-cache diff --git a/deps/v8/.gn b/deps/v8/.gn index 8b788bd17722..fcc0c855322e 100644 --- a/deps/v8/.gn +++ b/deps/v8/.gn @@ -7,9 +7,13 @@ import("//build/dotfile_settings.gni") # The location of the build configuration file. buildconfig = "//build/config/BUILDCONFIG.gn" -# The python interpreter to use by default. On Windows, this will look -# for python3.exe and python3.bat. -script_executable = "python3" +# The hermetic Python interpreter to use by default. Platforms without a +# hermetic CPython CIPD package fallback to the system python3 on $PATH. +if (host_cpu == "s390x" || host_cpu == "ppc64" || host_os == "zos") { + script_executable = "python3" +} else { + script_executable = "//third_party/cpython3/host/bin/python3" +} # These are the targets to check headers for by default. The files in targets # matching these patterns (see "gn help label_pattern" for format) will have diff --git a/deps/v8/.vpython3 b/deps/v8/.vpython3 deleted file mode 100644 index 8551fa2f7a11..000000000000 --- a/deps/v8/.vpython3 +++ /dev/null @@ -1,107 +0,0 @@ -# This is a vpython "spec" file. -# -# It describes patterns for python wheel dependencies of the python scripts in -# the chromium repo, particularly for dependencies that have compiled components -# (since pure-python dependencies can be easily vendored into third_party). -# -# When vpython is invoked, it finds this file and builds a python VirtualEnv, -# containing all of the dependencies described in this file, fetching them from -# CIPD (the "Chrome Infrastructure Package Deployer" service). Unlike `pip`, -# this never requires the end-user machine to have a working python extension -# compilation environment. All of these packages are built using: -# https://chromium.googlesource.com/infra/infra/+/main/infra/tools/dockerbuild/ -# -# All python scripts in the repo share this same spec, to avoid dependency -# fragmentation. -# -# If you have depot_tools installed in your $PATH, you can invoke python scripts -# in this repo by running them as you normally would run them, except -# substituting `vpython` instead of `python` on the command line, e.g.: -# vpython path/to/script.py some --arguments -# -# Read more about `vpython` and how to modify this file here: -# https://chromium.googlesource.com/infra/infra/+/main/doc/users/vpython.md - -python_version: "3.11" - -# The default set of platforms vpython checks does not yet include mac-arm64. -# Setting `verify_pep425_tag` to the list of platforms we explicitly must support -# allows us to ensure that vpython specs stay mac-arm64-friendly -verify_pep425_tag: [ - {python: "cp311", abi: "cp311", platform: "manylinux1_x86_64"}, - {python: "cp311", abi: "cp311", platform: "linux_arm64"}, - - {python: "cp311", abi: "cp311", platform: "macosx_10_10_intel"}, - {python: "cp311", abi: "cp311", platform: "macosx_11_0_arm64"}, - - {python: "cp311", abi: "cp311", platform: "win32"}, - {python: "cp311", abi: "cp311", platform: "win_amd64"} -] - -# TODO(https://crbug.com/898348): Add in necessary wheels as Python3 versions -# become available. -wheel: < - name: "infra/python/wheels/six-py2_py3" - version: "version:1.15.0" -> - -wheel: < - name: "infra/python/wheels/coverage/${vpython_platform}" - version: "version:7.3.1" -> - -wheel: < - name: "infra/python/wheels/pbr-py2_py3" - version: "version:3.0.0" -> - -wheel: < - name: "infra/python/wheels/filecheck-py2_py3" - version: "version:1.0.1" -> - -wheel: < - name: "infra/python/wheels/funcsigs-py2_py3" - version: "version:1.0.2" -> - -wheel: < - name: "infra/python/wheels/mock-py2_py3" - version: "version:2.0.0" -> - -wheel: < - name: "infra/python/wheels/numpy/${vpython_platform}" - version: "version:1.23.5.chromium.4" -> - -wheel: < - name: "infra/python/wheels/protobuf-py3" - version: "version:3.19.3" -> - -# requests and its dependencies. -wheel: < - name: "infra/python/wheels/requests-py3" - version: "version:2.31.0" -> -wheel: < - name: "infra/python/wheels/urllib3-py2_py3" - version: "version:1.26.6" -> -wheel: < - name: "infra/python/wheels/idna-py2_py3" - version: "version:2.8" -> -wheel: < - name: "infra/python/wheels/certifi-py2_py3" - version: "version:2020.11.8" -> -wheel: < - name: "infra/python/wheels/charset_normalizer-py3" - version: "version:2.0.4" -> -wheel: < - name: "infra/python/wheels/pyfakefs-py3" - version: "version:5.7.3" -> diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index e3c97a9fdf35..39f1bbd70a13 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -67,6 +67,7 @@ Amos Lim Andreas Anyuru Andrei Kashcha Andreu Botella +Andrew Gaul Andrew Paprocki Anna Henningsen Antoine du Hamel @@ -106,10 +107,12 @@ Christopher Nady Colin Ihrig Cong Zuo Craig Schlenter +Cristiano Moraes Daniel Andersson Daniel Bevenius Daniel Dromboski Daniel James +Daniel Kocielinski Daniel Shelton Daniil Bakin Danylo Boiko @@ -129,7 +132,6 @@ Douglas Crosher Dusan Milosavljevic Eden Wang Edoardo Marangoni -Eliau Elkouby Elisha Hollander Eric Rannaud Erich Ocean @@ -181,6 +183,7 @@ Jay Freeman Jeroen Bobbeldijk Jérôme Vouillon Jesper van den Ende +Jesse Wright Ji Qiu Jiawen Geng Jiaxun Yang @@ -207,6 +210,7 @@ Keyhan Vakil Kris Selden Krishna Ravishankar Kyounga Ra +Leo Camus Levi Zim LN Liberda Loo Rong Jie @@ -287,10 +291,12 @@ Ruben Bridgewater Ryan Dahl Sahil Shaikh Sakthipriyan Vairamani (thefourtheye) +Samuel Attard Sander Mathijs van Veen Sandro Santilli Sanjoy Das Sam James +Samuel Attard Sébastien Doeraene Seo Sanghyeon Sergey Markelov @@ -303,13 +309,13 @@ Stefan Penner Stefan Stojanovic Stephan Hartmann Stephen Belanger -Steven R. Loomis Sylvestre Ledru Takeshi Yoneda Taketoshi Aono Tao Liqiang Tao Wang Teddy Katz +Temiloluwa Yusuf Thomas Young Tiancheng "Timothy" Gu Tianping Yang @@ -359,6 +365,7 @@ Zhaojun Meng Zheng Liu Zhongqi Wang Zhongping Wang +Zuyao Chen 柳荣一 Yang Xiang Kotaro Ohsugi diff --git a/deps/v8/BUILD.bazel b/deps/v8/BUILD.bazel index 49a7613604d4..2350f14126e5 100644 --- a/deps/v8/BUILD.bazel +++ b/deps/v8/BUILD.bazel @@ -9,6 +9,7 @@ load("@rules_python//python:defs.bzl", "py_binary", "py_test") load("@v8_python_deps//:requirements.bzl", "requirement") load( "@v8//:bazel/defs.bzl", + "metagen_instance_types", "v8_binary", "v8_build_config", "v8_config", @@ -47,7 +48,6 @@ load(":bazel/v8-non-pointer-compression.bzl", "v8_binary_non_pointer_compression # v8_enable_local_off_stack_check # v8_enable_ignition_dispatch_counting # v8_enable_builtins_optimization -# v8_enable_builtins_profiling # v8_enable_builtins_profiling_verbose # v8_builtins_profiling_log_file # v8_enable_builtins_reordering @@ -94,11 +94,6 @@ v8_flag(name = "v8_annotate_torque_ir") v8_flag(name = "v8_code_comments") -v8_flag( - name = "v8_cppgc_microtask_queue", - default = False, -) - v8_flag( name = "v8_deprecation_warnings", default = True, @@ -111,6 +106,8 @@ v8_flag( v8_flag(name = "v8_enable_backtrace") +v8_flag(name = "v8_enable_builtins_profiling") + v8_flag(name = "v8_enable_debug_code") v8_flag(name = "v8_enable_disassembler") @@ -146,14 +143,19 @@ v8_flag(name = "v8_enable_snapshot_code_comments") v8_flag(name = "v8_enable_snapshot_native_code_counters") v8_flag( - name = "v8_enable_static_roots", - default = True, + name = "v8_enable_static_roots", + default = True, ) v8_flag(name = "v8_enable_trace_maps") v8_flag(name = "v8_enable_v8_checks") +v8_flag( + name = "v8_disallow_js_in_api_interrupts_is_checked", + default = True, +) + v8_flag(name = "v8_enable_verify_csa") v8_flag(name = "v8_enable_verify_heap") @@ -176,6 +178,14 @@ v8_flag( v8_flag(name = "v8_enable_experimental_tq_to_tsa") +# Mirrors the GN arg of the same name: selects which instance-type +# generator's output V8 compiles in, metagen or Torque's emission. When +# off, the metagen action is not part of the build graph. +v8_flag( + name = "v8_use_metagen_instance_types", + default = False, +) + v8_flag( name = "v8_use_host_cpu_arm_features", default = True, @@ -506,10 +516,11 @@ v8_config( conditional_defines = { "v8_android_log_stdout": "V8_ANDROID_LOG_STDOUT", "v8_code_comments": "V8_CODE_COMMENTS", - "v8_cppgc_microtask_queue": "V8_CPPGC_MICROTASK_QUEUE", "v8_deprecation_warnings": "V8_DEPRECATION_WARNINGS", + "v8_disallow_js_in_api_interrupts_is_checked": "V8_DISALLOW_JS_IN_API_INTERRUPTS_IS_CHECKED", "v8_imminent_deprecation_warnings": "V8_IMMINENT_DEPRECATION_WARNINGS", "v8_enable_debug_code": "V8_ENABLE_DEBUG_CODE", + "v8_enable_builtins_profiling": "V8_ENABLE_BUILTINS_PROFILING", "v8_enable_disassembler": "ENABLE_DISASSEMBLER", "v8_enable_global_handle_zapping": "ENABLE_GLOBAL_HANDLE_ZAPPING", "v8_enable_local_handle_zapping": "ENABLE_LOCAL_HANDLE_ZAPPING", @@ -544,22 +555,27 @@ v8_config( "V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA", "V8_TLS_USED_IN_LIBRARY", ] + select({ + ":is_not_v8_use_metagen_instance_types": [ + "V8_USE_METAGEN_INSTANCE_TYPES=0", + ], + "//conditions:default": [], + }) + select({ "@v8//bazel/config:is_debug": [ "DEBUG", "V8_ENABLE_CHECKS", ], "//conditions:default": [], }) + select({ - "@v8//bazel/config:asan_enabled" : [ "V8_USE_ADDRESS_SANITIZER" ], + "@v8//bazel/config:asan_enabled": ["V8_USE_ADDRESS_SANITIZER"], "//conditions:default": [], }) + select({ - "@v8//bazel/config:hwasan_enabled" : [ "V8_USE_HWADDRESS_SANITIZER" ], + "@v8//bazel/config:hwasan_enabled": ["V8_USE_HWADDRESS_SANITIZER"], "//conditions:default": [], }) + select({ - "@v8//bazel/config:msan_enabled" : [ "V8_USE_MEMORY_SANITIZER" ], + "@v8//bazel/config:msan_enabled": ["V8_USE_MEMORY_SANITIZER"], "//conditions:default": [], }) + select({ - "@v8//bazel/config:ubsan_enabled" : [ "V8_USE_UNDEFINED_BEHAVIOR_SANITIZER" ], + "@v8//bazel/config:ubsan_enabled": ["V8_USE_UNDEFINED_BEHAVIOR_SANITIZER"], "//conditions:default": [], }) + select( { @@ -578,7 +594,7 @@ v8_config( "V8_ENABLE_SPARKPLUG_PLUS", ], "@v8//bazel/config:v8_target_s390x": [ - "V8_TARGET_ARCH_S390X" + "V8_TARGET_ARCH_S390X", ], "@v8//bazel/config:v8_target_riscv64": [ # NOTE: Bazel rules for riscv64 weren't tested on a real system. @@ -587,7 +603,7 @@ v8_config( ], "@v8//bazel/config:v8_target_ppc64le": [ # NOTE: Bazel rules for ppc64le weren't tested on a real system. - "V8_TARGET_ARCH_PPC64" + "V8_TARGET_ARCH_PPC64", ], }, no_match_error = "Please specify a target cpu supported by v8", @@ -657,11 +673,10 @@ v8_config( "//conditions:default": [], }) + select({ "v8_drumbrake_bounds_checks": [ - "V8_DRUMBRAKE_BOUNDS_CHECKS" + "V8_DRUMBRAKE_BOUNDS_CHECKS", ], "//conditions:default": [], }), - deps = [":default"], ) @@ -813,13 +828,11 @@ filegroup( filegroup( name = "v8_flags", srcs = [ + "src/flags/feature-flags.h", "src/flags/flag-definitions.h", "src/flags/flags-impl.h", "src/flags/flags.h", - ] + select({ - "is_v8_enable_webassembly": ["src/wasm/wasm-feature-flags.h"], - "//conditions:default": [], - }), + ], ) filegroup( @@ -1284,6 +1297,7 @@ filegroup( # "src/objects/js-temporal-objects.tq", "src/objects/js-weak-refs.tq", "src/objects/literal-objects.tq", + "src/objects/managed.tq", "src/objects/map.tq", "src/objects/megadom-handler.tq", "src/objects/microtask.tq", @@ -1326,7 +1340,7 @@ filegroup( "src/wasm/wasm-objects.tq", ], ":is_v8_enable_drumbrake": [ - "src/wasm/wasm-interpreter-objects.tq" + "src/wasm/wasm-interpreter-objects.tq", ], "//conditions:default": [], }), @@ -1623,8 +1637,6 @@ filegroup( "src/common/ptr-compr-inl.h", "src/common/thread-local-storage.h", "src/common/scoped-modification.h", - "src/common/segmented-table.h", - "src/common/segmented-table-inl.h", "src/common/simd128.h", "src/common/synchronization-point-support.cc", "src/common/synchronization-point-support.h", @@ -1650,6 +1662,8 @@ filegroup( "src/debug/debug-interface.h", "src/debug/debug-property-iterator.cc", "src/debug/debug-property-iterator.h", + "src/debug/debug-scope-info.cc", + "src/debug/debug-scope-info.h", "src/debug/debug-scope-iterator.cc", "src/debug/debug-scope-iterator.h", "src/debug/debug-scopes.cc", @@ -1657,10 +1671,6 @@ filegroup( "src/debug/debug-stack-trace-iterator.cc", "src/debug/debug-stack-trace-iterator.h", "src/debug/interface-types.h", - "src/debug/liveedit.cc", - "src/debug/liveedit.h", - "src/debug/liveedit-diff.cc", - "src/debug/liveedit-diff.h", "src/deoptimizer/deoptimize-reason.cc", "src/deoptimizer/deoptimize-reason.h", "src/deoptimizer/deoptimized-frame-info.cc", @@ -2097,6 +2107,7 @@ filegroup( "src/objects/abstract-code.h", "src/objects/abstract-code-inl.h", "src/objects/all-objects-inl.h", + "src/objects/all-objects.h", "src/objects/allocation-site.h", "src/objects/allocation-site-inl.h", "src/objects/allocation-site-scopes.h", @@ -2196,6 +2207,7 @@ filegroup( "src/objects/instance-type.h", "src/objects/instance-type-checker.h", "src/objects/instance-type-inl.h", + "src/objects/instance-types-gen.h", "src/objects/internal-index.h", "src/objects/instruction-stream.cc", "src/objects/instruction-stream.h", @@ -2270,6 +2282,7 @@ filegroup( "src/objects/managed.cc", "src/objects/managed.h", "src/objects/managed-inl.h", + "src/objects/managed-type-id.h", "src/objects/map.cc", "src/objects/map.h", "src/objects/map-inl.h", @@ -2296,6 +2309,7 @@ filegroup( "src/objects/object-macros-undef.h", "src/objects/object-type.cc", "src/objects/object-type.h", + "src/objects/object-conversions-inl.h", "src/objects/object-predicates.h", "src/objects/object-predicates-inl.h", "src/objects/oddball-predicates.h", @@ -2627,6 +2641,9 @@ filegroup( "src/sandbox/sandbox-malloc.h", "src/sandbox/sandboxed-pointer.h", "src/sandbox/sandboxed-pointer-inl.h", + "src/sandbox/segmented-table.cc", + "src/sandbox/segmented-table.h", + "src/sandbox/segmented-table-inl.h", "src/sandbox/tagged-payload.h", "src/sandbox/testing.cc", "src/sandbox/testing.h", @@ -3269,7 +3286,6 @@ filegroup( "src/wasm/wasm-value.h", "src/wasm/well-known-imports.cc", "src/wasm/well-known-imports.h", - "src/wasm/wasm-wrapper-cache-inl.h", "third_party/utf8-decoder/generalized-utf8-decoder.h", ], @@ -4021,10 +4037,10 @@ filegroup( "//conditions:default": [], }) + select({ ":enable_drumbrake_x64": [ - "src/wasm/interpreter/x64/interpreter-builtins-x64.cc" + "src/wasm/interpreter/x64/interpreter-builtins-x64.cc", ], ":enable_drumbrake_arm64": [ - "src/wasm/interpreter/arm64/interpreter-builtins-arm64.cc" + "src/wasm/interpreter/arm64/interpreter-builtins-arm64.cc", ], "//conditions:default": [], }), @@ -4171,27 +4187,27 @@ filegroup( ) v8_library( - name = "lib_dragonbox", - srcs = ["third_party/dragonbox/src/include/dragonbox/dragonbox.h"], - hdrs = [ - "third_party/dragonbox/src/include/dragonbox/dragonbox.h", - ], - includes = [ - "third_party/dragonbox/src/include", - ], + name = "lib_dragonbox", + srcs = ["third_party/dragonbox/src/include/dragonbox/dragonbox.h"], + hdrs = [ + "third_party/dragonbox/src/include/dragonbox/dragonbox.h", + ], + includes = [ + "third_party/dragonbox/src/include", + ], ) v8_library( - name = "lib_fp16", - srcs = ["third_party/fp16/src/include/fp16.h"], - hdrs = [ - "third_party/fp16/src/include/fp16/fp16.h", - "third_party/fp16/src/include/fp16/bitcasts.h", - "third_party/fp16/src/include/fp16/macros.h", - ], - includes = [ - "third_party/fp16/src/include", - ], + name = "lib_fp16", + srcs = ["third_party/fp16/src/include/fp16.h"], + hdrs = [ + "third_party/fp16/src/include/fp16/fp16.h", + "third_party/fp16/src/include/fp16/bitcasts.h", + "third_party/fp16/src/include/fp16/macros.h", + ], + includes = [ + "third_party/fp16/src/include", + ], ) filegroup( @@ -4448,6 +4464,8 @@ v8_torque_files( "class-forward-declarations.h", # "debug-macros.cc", # "debug-macros.h", + "debug-reader-classes-list.h", + "instance-type-checker-lists.h", "instance-types.h", "interface-descriptors.inc", ], @@ -4455,6 +4473,185 @@ v8_torque_files( noicu_srcs = [":noicu/torque_files"], ) +# Metagen: libclang-driven IT generator. Produces gen/metagen/instance-types.h +# which `src/objects/instance-types-gen.h` includes when +# V8_USE_METAGEN_INSTANCE_TYPES is on. :v8_libshared reaches the targets +# below only under that flag. +filegroup( + name = "metagen_python_sources", + srcs = [ + "tools/metagen/__init__.py", + "tools/metagen/clang_bootstrap.py", + "tools/metagen/compile_flags.py", + "tools/metagen/cpp_hier.py", + "tools/metagen/extract.py", + "tools/metagen/instance_types.py", + "tools/metagen/metagen.py", + ], +) + +# V8 headers staged into the metagen action's sandbox so libclang can +# resolve transitive #includes. Globbed wide on purpose: cheaper than +# enumerating the transitive set, and the extra files only cost sandbox +# materialization. +filegroup( + name = "metagen_sandbox_headers", + srcs = glob([ + "include/**/*.h", + "src/**/*.h", + "src/**/*.inc", + # Vendored third_party headers reached from V8's own (e.g. + # src/strings/unicode.h -> utf8-decoder.h). Enumerated rather + # than a blanket third_party/**, which would also stage the + # large gclient trees. + "third_party/utf8-decoder/**/*.h", + "third_party/simdutf/**/*.h", + "third_party/rapidhash-v8/**/*.h", + "third_party/fp16/**/*.h", + "third_party/wasm-api/**/*.h", + "third_party/siphash/**/*.h", + "third_party/vtune/**/*.h", + ]), +) + +# Libclang runtime files: the Python bindings + host native library, both +# from the llvm-libclang package (version-locked together). This filegroup +# is consumed in the exec configuration, so the select follows the host +# that runs metagen rather than the V8 target platform. +filegroup( + name = "metagen_libclang_files", + srcs = [ + "third_party/llvm-libclang/bindings/python/clang/__init__.py", + "third_party/llvm-libclang/bindings/python/clang/cindex.py", + ] + select({ + "@v8//bazel/config:is_macos": [ + "third_party/llvm-libclang/lib/libclang.dylib", + ], + "@v8//bazel/config:is_windows": [ + "third_party/llvm-libclang/bin/libclang.dll", + ], + "//conditions:default": [ + "third_party/llvm-libclang/lib/libclang.so", + ], + }), +) + +# Clang's builtin headers (stddef.h, stdarg.h, the arch intrinsics). +# Kept separate from the libclang files above because they are a +# different input to the rule: metagen takes their directory explicitly +# and passes it as -isystem. The llvm-libclang package ships the library +# and the C API headers but no builtin headers, so these come from the +# clang toolchain, which rolls from the same LLVM revision and therefore +# matches the parsing library. +filegroup( + name = "metagen_clang_builtin_headers", + srcs = glob([ + "third_party/llvm-build/Release+Asserts/lib/clang/*/include/**", + ]), +) + +# The harvest's checked-in C++ driver, shared with GN and metagen.py. It +# includes src/objects/all-objects.h, whose feature-conditional groups +# are selected by the normal V8 feature defines. Bazel always defines +# V8_ENABLE_WEBASSEMBLY via :define_flags; V8_INTL_SUPPORT is added only by +# the icu-prefixed action. Temporal is disabled because temporal_rs is not a +# Bazel dependency. +# +# The headers themselves reach the action through the +# `metagen_sandbox_headers` glob below, which already covers src/**. +filegroup( + name = "metagen_driver", + srcs = ["tools/metagen/harvest-driver.cc"], +) + +py_binary( + name = "metagen_tool", + srcs = [ + "tools/metagen/__init__.py", + "tools/metagen/clang_bootstrap.py", + "tools/metagen/compile_flags.py", + "tools/metagen/cpp_hier.py", + "tools/metagen/extract.py", + "tools/metagen/instance_types.py", + "tools/metagen/metagen.py", + ], + # tools/metagen/ is a Python package, so the scripts import each + # other as `from metagen import ...`, which needs the package's + # parent -- tools/ -- on sys.path rather than the package dir + # itself. metagen.py arranges that itself when run as a script, + # rather than through the `imports` attribute, which not every + # py_binary rule this file is built with supports. + main = "tools/metagen/metagen.py", +) + +metagen_instance_types( + name = "metagen_instance_types_h", + driver = ":metagen_driver", + clang_builtin_headers = [":metagen_clang_builtin_headers"], + libclang_files = [":metagen_libclang_files"], + python_srcs = [":metagen_python_sources"], + # V8 source-tree headers transitively #include'd from the input + # headers. The cc_compilation_context_from CcInfo only covers + # :v8_libbase and :define_flags, which doesn't reach src/objects, + # src/handles, src/wasm, etc. The natural target that would + # (:v8_libshared) depends on this rule's output, so we ship the + # headers as raw files in the action sandbox instead. + extra_sandbox_files = [":metagen_sandbox_headers"], + tool = ":metagen_tool", + # Source of the cflags fed to libclang: `:define_flags` carries V8's + # arch/feature defines, `:v8_libbase` the source-root / include/ / + # libc++ context, the cc toolchain the rest. + # + # The third_party libs need CcInfo rather than the sandbox glob + # because their includes resolve through the lib's own -I, which a + # glob cannot supply: abseil is included as absl/..., and fp16.h + # does #include "fp16/bitcasts.h". The rest are included by full + # path, resolve via -I., and the glob suffices. + cc_compilation_context_from = [ + ":define_flags", + ":v8_libbase", + ":lib_fp16", + ":simdutf", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/container:node_hash_set", + "@abseil-cpp//absl/functional:function_ref", + "@abseil-cpp//absl/functional:overload", + "@abseil-cpp//absl/numeric:int128", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/synchronization", + ], + # The icu variant of v8_library compiles with V8_INTL_SUPPORT (via + # ENABLE_I18N_SUPPORT_DEFINES copts, invisible to CcInfo) and the + # intl object sources, so its IT enum must include the intl types: + # the icu-prefixed harvest additionally parses the intl headers, + # with the same defines and with ICU's headers + include paths. + icu_cc_compilation_context_from = ["//external:icu"], + icu_extra_defines = [ + "V8_INTL_SUPPORT", + "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC", + "UNISTR_FROM_CHAR_EXPLICIT=", + ], +) + +# Header-only library wrapping the metagen output. strip_include_prefix +# rewrites the include path so `#include "metagen/instance-types.h"` +# resolves against the gen dir. +cc_library( + name = "icu/metagen_instance_types_headers", + hdrs = [":icu/metagen_instance_types_h"], + copts = ["-Wno-implicit-fallthrough"], + strip_include_prefix = "icu", +) + +cc_library( + name = "noicu/metagen_instance_types_headers", + hdrs = [":noicu/metagen_instance_types_h"], + copts = ["-Wno-implicit-fallthrough"], + strip_include_prefix = "noicu", +) + py_binary( name = "code_generator", srcs = [ @@ -4571,6 +4768,9 @@ genrule( v8_mksnapshot( name = "generated_snapshot_files", args = select({ + ":is_v8_enable_builtins_profiling": ["--turbo-profiling"], + "//conditions:default": [], + }) + select({ ":is_v8_enable_verify_heap": ["--verify-heap"], "//conditions:default": [], }) + select({ @@ -4661,11 +4861,11 @@ cc_library( ) cc_library( - name = "simdutf", - srcs = ["third_party/simdutf/simdutf.cpp"], - hdrs = ["third_party/simdutf/simdutf.h"], - strip_include_prefix = "third_party/simdutf", - copts = select({ + name = "simdutf", + srcs = ["third_party/simdutf/simdutf.cpp"], + hdrs = ["third_party/simdutf/simdutf.h"], + strip_include_prefix = "third_party/simdutf", + copts = select({ "@v8//bazel/config:is_clang": ["-std=c++20"], "@v8//bazel/config:is_gcc": ["-std=gnu++2a"], "@v8//bazel/config:is_windows": ["/std:c++20"], @@ -4688,18 +4888,34 @@ v8_library( icu_deps = [ ":icu/generated_torque_definitions_headers", "//external:icu", - ], + ] + select({ + ":is_v8_use_metagen_instance_types": [ + ":icu/metagen_instance_types_headers", + ], + "//conditions:default": [], + }), icu_srcs = [ ":generated_regexp_special_case", ":icu/generated_torque_definitions", ":icu/v8_base_without_compiler_files", - ], + ] + select({ + ":is_v8_use_metagen_instance_types": [":icu/metagen_instance_types_h"], + "//conditions:default": [], + }), noicu_deps = [ ":noicu/generated_torque_definitions_headers", - ], + ] + select({ + ":is_v8_use_metagen_instance_types": [ + ":noicu/metagen_instance_types_headers", + ], + "//conditions:default": [], + }), noicu_srcs = [ ":noicu/generated_torque_definitions", - ], + ] + select({ + ":is_v8_use_metagen_instance_types": [":noicu/metagen_instance_types_h"], + "//conditions:default": [], + }), deps = [ ":lib_dragonbox", "//third_party/fast_float/src:fast_float", diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index 721634899569..c6132807ff6c 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -7,6 +7,7 @@ import("//build/config/android/config.gni") import("//build/config/arm.gni") import("//build/config/c++/c++.gni") +import("//build/config/clang/clang.gni") import("//build/config/coverage/coverage.gni") import("//build/config/dcheck_always_on.gni") import("//build/config/host_byteorder.gni") @@ -24,6 +25,11 @@ if (is_clang) { import("//build/config/clang/clang.gni") } +if (is_win && v8_use_metagen_instance_types) { + # For the SDK include flags, see `metagen_instance_types_h`. + import("//build/toolchain/win/win_toolchain_data.gni") +} + if (v8_enable_temporal_support) { import("//build/config/rust.gni") } @@ -43,6 +49,16 @@ declare_args() { # Print to stdout on Android. v8_android_log_stdout = false + # Native libclang for the metagen instance-type harvest, for platforms + # that have no prebuilt llvm-libclang package (currently ppc64 and s390x). + # Both are absolute paths, and both must be set or both left empty. + # v8_metagen_libclang_so: the native libclang shared library. + # v8_metagen_libclang_bindings_dir: the directory holding the matching + # clang/cindex.py bindings (i.e. the + # dir that contains the clang/ package). + v8_metagen_libclang_so = "" + v8_metagen_libclang_bindings_dir = "" + # Dynamically set an additional dependency from v8/custom_deps. v8_custom_deps = "" @@ -71,6 +87,13 @@ declare_args() { # Enable compiler warnings when using V8_DEPRECATED apis. v8_deprecation_warnings = true + # Check that executing JavaScript inside API interrupt callbacks is + # disallowed. + # TODO(40067940): Ensure this does not break DevTools. + # TODO(node): Upstream issue https://github.com/nodejs/node/pull/65028 + v8_disallow_js_in_api_interrupts_is_checked = + !(defined(build_with_node) && build_with_node) + # Enable compiler warnings when using V8_DEPRECATE_SOON apis. v8_imminent_deprecation_warnings = true @@ -104,6 +127,9 @@ declare_args() { # Sets -DV8_ENABLE_APX_F. v8_enable_apx_f = false + # Sets -DV8_ENABLE_AVX10_1. + v8_enable_avx10_1 = false + # Sets -DENABLE_HUGEPAGE v8_enable_hugepage = false @@ -135,7 +161,9 @@ declare_args() { v8_enable_slow_dchecks = false # Enable fast mksnapshot runs. - v8_enable_fast_mksnapshot = false + v8_enable_fast_mksnapshot = + build_with_chromium && (is_debug || dcheck_always_on) && + !is_official_build # Enable using multiple threads to build builtins in mksnapshot. v8_enable_concurrent_mksnapshot = true @@ -531,6 +559,13 @@ declare_args() { v8_logging_level = "" } +# The native-libclang args are a matched pair: a .so with no bindings (or +# vice versa) is always a misconfiguration, so fail early rather than at the +# metagen action. Both being empty is the normal, bundled-package case. +assert(v8_metagen_libclang_so == "" == (v8_metagen_libclang_bindings_dir == ""), + "v8_metagen_libclang_so and v8_metagen_libclang_bindings_dir must be " + + "set together or left empty together.") + # Derived defaults. if (v8_logging_level == "") { if (v8_enable_verification_features || v8_dcheck_always_on) { @@ -656,7 +691,8 @@ if (v8_enable_sparkplug == "") { v8_enable_sparkplug = !v8_jitless } v8_enable_sparkplug_plus = v8_enable_sparkplug && (v8_current_cpu == "x64" || - v8_current_cpu == "arm64") + v8_current_cpu == "arm64" || + v8_current_cpu == "loong64") if (v8_enable_maglev == "") { v8_enable_maglev = v8_enable_turbofan && @@ -1059,11 +1095,11 @@ external_v8_defines = [ "V8_COMPRESS_ZONES", "V8_ENABLE_SANDBOX", "V8_DEPRECATION_WARNINGS", + "V8_DISALLOW_JS_IN_API_INTERRUPTS_IS_CHECKED", "V8_IMMINENT_DEPRECATION_WARNINGS", "V8_USE_PERFETTO", "V8_USE_PERFETTO_JSON_EXPORT", "V8_USE_PERFETTO_SDK", - "V8_CPPGC_MICROTASK_QUEUE", "V8_MAP_PACKING", "V8_IS_TSAN", "V8_ENABLE_DIRECT_HANDLE", @@ -1110,6 +1146,10 @@ if (v8_enable_sandbox) { if (v8_deprecation_warnings) { enabled_external_v8_defines += [ "V8_DEPRECATION_WARNINGS" ] } +if (v8_disallow_js_in_api_interrupts_is_checked) { + enabled_external_v8_defines += + [ "V8_DISALLOW_JS_IN_API_INTERRUPTS_IS_CHECKED" ] +} if (v8_imminent_deprecation_warnings) { enabled_external_v8_defines += [ "V8_IMMINENT_DEPRECATION_WARNINGS" ] } @@ -1122,9 +1162,7 @@ if (v8_use_perfetto_json_export) { if (v8_use_perfetto_sdk) { enabled_external_v8_defines += [ "V8_USE_PERFETTO_SDK" ] } -if (v8_cppgc_microtask_queue) { - enabled_external_v8_defines += [ "V8_CPPGC_MICROTASK_QUEUE" ] -} + if (v8_enable_map_packing) { enabled_external_v8_defines += [ "V8_MAP_PACKING" ] } @@ -1277,6 +1315,13 @@ config("features") { "V8_LOGGING_LEVEL=${v8_logging_level}", ] + # Selects metagen vs Torque instance-type output (see + # src/objects/instance-types-gen.h). The header defaults to metagen + # when this is undefined, so only the off case needs a define. + if (!v8_use_metagen_instance_types) { + defines += [ "V8_USE_METAGEN_INSTANCE_TYPES=0" ] + } + configs = [ ":v8_header_features", ":cppgc_header_features", @@ -1340,6 +1385,9 @@ config("features") { if (v8_enable_apx_f) { defines += [ "V8_ENABLE_APX_F" ] } + if (v8_enable_avx10_1) { + defines += [ "V8_ENABLE_AVX10_1" ] + } if (v8_enable_hugepage) { defines += [ "ENABLE_HUGEPAGE" ] } @@ -1391,9 +1439,6 @@ config("features") { if (v8_enable_temporal_support) { defines += [ "V8_TEMPORAL_SUPPORT" ] } - if (v8_enable_temporal_systemicu) { - defines += [ "V8_ENABLE_TEMPORAL_SYSTEMICU" ] - } if (v8_enable_local_handle_zapping) { defines += [ "ENABLE_LOCAL_HANDLE_ZAPPING" ] } @@ -1463,6 +1508,9 @@ config("features") { if (v8_fuzzilli) { defines += [ "V8_FUZZILLI" ] } + if (v8_enable_builtins_profiling) { + defines += [ "V8_ENABLE_BUILTINS_PROFILING" ] + } if (use_chromium_fuzzilli) { defines += [ "USE_CHROMIUM_FUZZILLI" ] } @@ -1484,6 +1532,9 @@ config("features") { v8_current_cpu == "x64") { defines += [ "V8_BUILTINS_GEARBOX" ] } + if (v8_enable_builtins_optimization) { + defines += [ "V8_ENABLE_BUILTINS_OPTIMIZATION" ] + } if (v8_enable_short_builtin_calls) { defines += [ "V8_SHORT_BUILTIN_CALLS" ] } @@ -1724,16 +1775,7 @@ config("toolchain") { if (v8_current_cpu == "ppc64") { defines += [ "V8_TARGET_ARCH_PPC64" ] cflags += [ "-ffp-contract=off" ] - if (current_os == "aix" && !is_clang) { - cflags += [ - # Work around AIX ceil, trunc and round oddities. - "-mcpu=power5+", - "-mfprnd", - - # Work around AIX assembler popcntb bug. - "-mno-popcntb", - ] - } else if (!v8_target_is_simulator) { + if (!v8_target_is_simulator) { cflags += [ "-mcpu=pwr9" ] } } @@ -1957,10 +1999,10 @@ config("strict_warnings") { v8_current_cpu == "mips64el" || v8_current_cpu == "riscv64") { cflags += [ "-Wshorten-64-to-32" ] } - cflags += [ "-Wmissing-field-initializers" ] - if (v8_current_cpu != "ppc64" && v8_current_cpu != "s390x") { - cflags += [ "-Wunnecessary-virtual-specifier" ] - } + cflags += [ + "-Wmissing-field-initializers", + "-Wunnecessary-virtual-specifier", + ] } } @@ -2016,9 +2058,17 @@ if (v8_postmortem_support) { script = "tools/gen-postmortem-metadata.py" + if (v8_use_metagen_instance_types) { + _instance_types_header = "$target_gen_dir/metagen/instance-types.h" + } else { + _instance_types_header = + "$target_gen_dir/torque-generated/instance-types.h" + } + # NOSORT inputs = [ - "$target_gen_dir/torque-generated/instance-types.h", + _instance_types_header, + "$target_gen_dir/torque-generated/debug-reader-classes-list.h", "src/objects/allocation-site.h", "src/objects/allocation-site-inl.h", "src/objects/cell.h", @@ -2124,6 +2174,9 @@ if (v8_postmortem_support) { rebase_path(inputs, root_build_dir) deps = [ ":run_torque" ] + if (v8_use_metagen_instance_types) { + deps += [ ":metagen_instance_types_h" ] + } } } @@ -2324,6 +2377,7 @@ torque_files = [ "src/objects/js-struct.tq", "src/objects/js-weak-refs.tq", "src/objects/literal-objects.tq", + "src/objects/managed.tq", "src/objects/map.tq", "src/objects/megadom-handler.tq", "src/objects/microtask.tq", @@ -2395,6 +2449,178 @@ if (v8_enable_webassembly) { } } +if (v8_use_metagen_instance_types) { + # The checked-in translation unit metagen parses. It includes + # src/objects/all-objects.h, whose feature-specific groups use the same + # defines as their V8 sources. + _metagen_driver_file = "tools/metagen/harvest-driver.cc" + _metagen_out_dir = "$target_gen_dir/metagen" + + # metagen's libclang Python bindings and native library, declared as + # inputs so a package roll re-runs the harvest. + # + # The `//` prefix is load-bearing: llvm-libclang lives in the checkout + # root's third_party in both layouts (v8/ standalone, src/ under + # Chromium), whereas a relative path would anchor at //v8/ in Chromium. + if (v8_metagen_libclang_so != "") { + # System libclang + separately-staged bindings: the bundled package files + # do not exist on this platform, so declare none of them as inputs. + _metagen_libclang_files = [] + } else { + _metagen_libclang_files = [ + "//third_party/llvm-libclang/bindings/python/clang/cindex.py", + "//third_party/llvm-libclang/bindings/python/clang/__init__.py", + ] + if (host_os == "mac") { + _metagen_libclang_files += + [ "//third_party/llvm-libclang/lib/libclang.dylib" ] + } else if (host_os == "win") { + _metagen_libclang_files += + [ "//third_party/llvm-libclang/bin/libclang.dll" ] + } else { + _metagen_libclang_files += + [ "//third_party/llvm-libclang/lib/libclang.so" ] + } + } + + # The clang toolchain's resource dir contains builting headers + # include/{stddef.h,stdarg.h,...}. + _metagen_clang_resource_dir = "$clang_base_path/lib/clang/$clang_version" + _metagen_flags_target = ":v8_base_without_compiler" + _metagen_flags_target_ninja = + get_label_info(_metagen_flags_target, "target_out_dir") + + "/v8_base_without_compiler.ninja" + + action("metagen_instance_types_h") { + visibility = [ + ":*", + "tools/debug_helper/:*", + ] + + script = "tools/metagen/metagen.py" + + # The script obtains the parse flags through `gn desc`, so make the build + # configuration an explicit input. In particular, changing a feature define + # must re-run the driver even though the action command is unchanged. + deps = [ ":v8_dump_build_config" ] + + if (v8_generate_external_defines_header) { + # v8config.h includes the generated v8-gn.h in this configuration. + deps += [ ":gen_v8_gn" ] + } + + # No deps on V8's own generators: every generated header the harvested set + # reaches short-circuits to empty under V8_METAGEN_GENERATION_PASS + # (see builtins-definitions.h and factory-base.h), so the harvest runs + # independently of Torque and the bytecode-builtins-list generator. + # Perfetto's generated headers are kept out of the parse the same way, by + # undefining V8_USE_PERFETTO for it (see metagen.py). + + # `inputs`, not `sources`: these headers belong to the V8 targets that + # compile them; this action only reads them. + inputs = [ + "tools/metagen/clang_bootstrap.py", + "tools/metagen/compile_flags.py", + "tools/metagen/cpp_hier.py", + "tools/metagen/extract.py", + "tools/metagen/instance_types.py", + "tools/metagen/metagen.py", + _metagen_driver_file, + "$root_out_dir/v8_build_config.json", + + # Proxy for the whole builtin-header directory, which has no + # GN glob: a toolchain roll rewrites stddef.h along with the + # rest, and the harvest cannot parse without it. + "$_metagen_clang_resource_dir/include/stddef.h", + ] + _metagen_libclang_files + + outputs = [ "$_metagen_out_dir/instance-types.h" ] + + # The files the harvest read a fact out of, reported by the script. + # `inputs` above declares only the driver, so this is what re-runs the + # harvest when a class declaration or a marker changes. + # + # Binds to the first output, so output order matters if one is added. + depfile = "$_metagen_out_dir/instance-types.h.d" + + args = [ + "--depfile", + rebase_path(depfile, root_build_dir), + "--driver", + rebase_path(_metagen_driver_file, root_build_dir), + "--v8-root", + rebase_path(".", root_build_dir), + "--build-dir", + ".", # The action runs with cwd=root_build_dir. + + # metagen cannot find this by walking up from the build dir: on + # ChromeOS the build dir sits outside the checkout entirely. + "--source-root", + rebase_path("//", root_build_dir), + "--out", + rebase_path(_metagen_out_dir, root_build_dir), + + # Representative compiled target whose flags metagen harvests via + # `gn desc`: its TUs include the headers metagen parses, so its + # config is the right one. Passed as a string, not a dep, to avoid a + # cycle with the targets that consume instance-types.h. + # Pass the current_toolchain so cross-compiles are handled correctly. + # It travels in its own argument because GN would not quote the + # parentheses of a qualified label on a Windows command line. + "--flags-from-target", + get_label_info(_metagen_flags_target, "label_no_toolchain"), + "--flags-toolchain", + current_toolchain, + + # GN does not allow its generated ninja files as explicit action inputs. + # Have metagen add the file containing the queried flags to its depfile. + "--flags-dependency", + rebase_path(_metagen_flags_target_ninja, root_build_dir), + + # We pass a resource dir, not an include dir, so the driver decides where + # the builtin headers sit: behind libc++, ahead of the Windows SDK's + # copies of stddef.h and the intrinsics. See tools/metagen/metagen.py. + "--clang-resource-dir", + rebase_path(_metagen_clang_resource_dir, root_build_dir), + ] + + if (v8_metagen_libclang_so != "") { + # No prebuilt llvm-libclang for this platform: point metagen at the + # system libclang and the separately-staged cindex bindings. The two + # args are validated as a pair at the top of this file. + args += [ + "--libclang-so", + v8_metagen_libclang_so, + "--libclang-bindings-dir", + v8_metagen_libclang_bindings_dir, + + # The toolchain major, so metagen can warn if the loaded libclang is + # out of step with the clang whose builtin headers it parses against. + "--expect-libclang-major", + clang_version, + ] + } else { + # Package root, so metagen need not guess the checkout layout. + args += [ + "--libclang-dir", + rebase_path("//third_party/llvm-libclang", root_build_dir), + ] + } + + if (is_win) { + # The SDK/UCRT include dirs never show up in `gn desc`: the toolchain + # interpolates them into its tool command template instead of into + # cflags. Pass the build's own resolved flags, the way + # build/modules/BUILD.gn does, so an SDK roll reruns the harvest. + # `--extra-flag=` attaches the value because the flags start with a + # dash (-imsvc) and argparse would take them for options. + foreach(flag, current_win_toolchain_data.include_flags_imsvc_list) { + args += [ "--extra-flag=$flag" ] + } + } + } +} + if (v8_enable_experimental_tq_to_tsa) { template("run_torque_to_tsa") { if (target_name == "") { @@ -2508,9 +2734,11 @@ template("run_torque") { "$destination_folder/csa-types.h", "$destination_folder/debug-macros.cc", "$destination_folder/debug-macros.h", + "$destination_folder/debug-reader-classes-list.h", "$destination_folder/enum-verifiers.cc", "$destination_folder/exported-macros-assembler.cc", "$destination_folder/exported-macros-assembler.h", + "$destination_folder/instance-type-checker-lists.h", "$destination_folder/instance-types.h", "$destination_folder/interface-descriptors.inc", ] @@ -2606,6 +2834,7 @@ group("v8_simdutf") { visibility = [ "./*" ] } + config("simdutf_include_config") { include_dirs = [ "//third_party/simdutf" ] } @@ -2767,6 +2996,7 @@ template("run_mksnapshot") { } else { suffix = "_$name" } + action("run_mksnapshot_" + name) { deps = [ ":mksnapshot($v8_snapshot_toolchain)" ] if (v8_verify_deterministic_mksnapshot) { @@ -3051,6 +3281,7 @@ if (v8_verify_builtins_compatibility) { # This specifies a separate mksnapshot target for each of: # x86, x64, arm, arm64. hashes = "builtins_hashes_$v8_current_cpu" + run_mksnapshot("dump_$v8_current_cpu") { args = [ "--dump-builtins-hashes-to-file", @@ -3071,6 +3302,7 @@ if (v8_verify_builtins_compatibility) { profile_toolchain = "//build/toolchain/linux:clang_${profile_arch}" target_toolchain = "//build/toolchain/linux:clang_${profile_arch}_v8_${target_arch}" + action("compare_builtins_$target_name") { deps = [ ":run_mksnapshot_dump_${profile_arch}($profile_toolchain)", @@ -3207,7 +3439,6 @@ action("v8_dump_build_config") { "wasm_random_fuzzers=$v8_wasm_random_fuzzers", "memory_corruption_api=$v8_enable_memory_corruption_api", "lower_limits_mode=$v8_lower_limits_mode", - "cppgc_microtask_queue=$v8_cppgc_microtask_queue", "test_only_sync_points=$v8_enable_test_only_sync_points", # Please add new switches also in `build_config_content` in `bazel/defs.bzl` @@ -3229,6 +3460,8 @@ generated_file("v8_generate_features_json") { output_conversion = "json" contents = { v8_deprecation_warnings = v8_deprecation_warnings + v8_disallow_js_in_api_interrupts_is_checked = + v8_disallow_js_in_api_interrupts_is_checked v8_enable_31bit_smis_on_64bit_arch = v8_enable_31bit_smis_on_64bit_arch v8_enable_direct_handle = v8_enable_direct_handle v8_enable_extensible_ro_snapshot = v8_enable_extensible_ro_snapshot @@ -3236,7 +3469,6 @@ generated_file("v8_generate_features_json") { v8_enable_hugepage = v8_enable_hugepage v8_enable_i18n_support = v8_enable_i18n_support v8_enable_temporal_support = v8_enable_temporal_support - v8_enable_temporal_systemicu = v8_enable_temporal_systemicu v8_enable_javascript_promise_hooks = v8_enable_javascript_promise_hooks v8_enable_lite_mode = v8_enable_lite_mode v8_enable_map_packing = v8_enable_map_packing @@ -3253,7 +3485,6 @@ generated_file("v8_generate_features_json") { v8_optimized_debug = v8_optimized_debug v8_random_seed = v8_random_seed v8_use_perfetto = v8_use_perfetto - v8_cppgc_microtask_queue = v8_cppgc_microtask_queue v8_use_siphash = v8_use_siphash v8_use_default_hasher_secret = v8_use_default_hasher_secret } @@ -3691,6 +3922,7 @@ v8_header_set("v8_flags") { configs = [ ":internal_config" ] sources = [ + "src/flags/feature-flags.h", "src/flags/flag-definitions.h", "src/flags/flags-impl.h", "src/flags/flags.h", @@ -3829,8 +4061,6 @@ v8_header_set("v8_internal_headers") { "src/common/ptr-compr-inl.h", "src/common/ptr-compr.h", "src/common/scoped-modification.h", - "src/common/segmented-table-inl.h", - "src/common/segmented-table.h", "src/common/simd128.h", "src/common/synchronization-point-support.h", "src/common/thread-local-storage.h", @@ -4077,13 +4307,12 @@ v8_header_set("v8_internal_headers") { "src/debug/debug-frames.h", "src/debug/debug-interface.h", "src/debug/debug-property-iterator.h", + "src/debug/debug-scope-info.h", "src/debug/debug-scope-iterator.h", "src/debug/debug-scopes.h", "src/debug/debug-stack-trace-iterator.h", "src/debug/debug.h", "src/debug/interface-types.h", - "src/debug/liveedit-diff.h", - "src/debug/liveedit.h", "src/deoptimizer/deoptimize-reason.h", "src/deoptimizer/deoptimized-frame-info.h", "src/deoptimizer/deoptimizer.h", @@ -4346,6 +4575,7 @@ v8_header_set("v8_internal_headers") { "src/numbers/ieee754.h", "src/numbers/math-random.h", "src/objects/all-objects-inl.h", + "src/objects/all-objects.h", "src/objects/allocation-site-inl.h", "src/objects/allocation-site-scopes-inl.h", "src/objects/allocation-site-scopes.h", @@ -4473,6 +4703,7 @@ v8_header_set("v8_internal_headers") { "src/objects/lookup-inl.h", "src/objects/lookup.h", "src/objects/managed-inl.h", + "src/objects/managed-type-id.h", "src/objects/managed.h", "src/objects/map-inl.h", "src/objects/map-updater.h", @@ -4489,6 +4720,7 @@ v8_header_set("v8_internal_headers") { "src/objects/module.h", "src/objects/name-inl.h", "src/objects/name.h", + "src/objects/object-conversions-inl.h", "src/objects/object-list-macros.h", "src/objects/object-macros-undef.h", "src/objects/object-macros.h", @@ -4693,6 +4925,8 @@ v8_header_set("v8_internal_headers") { "src/sandbox/sandboxable-thread.h", "src/sandbox/sandboxed-pointer-inl.h", "src/sandbox/sandboxed-pointer.h", + "src/sandbox/segmented-table-inl.h", + "src/sandbox/segmented-table.h", "src/sandbox/tagged-payload.h", "src/sandbox/testing.h", "src/sandbox/trusted-pointer-scope.h", @@ -4987,7 +5221,6 @@ v8_header_set("v8_internal_headers") { "src/wasm/wasm-engine.h", "src/wasm/wasm-export-wrapper-cache.h", "src/wasm/wasm-external-refs.h", - "src/wasm/wasm-feature-flags.h", "src/wasm/wasm-features.h", "src/wasm/wasm-import-wrapper-cache.h", "src/wasm/wasm-init-expr.h", @@ -5028,8 +5261,6 @@ v8_header_set("v8_internal_headers") { if (v8_enable_wasm_simd256_revec) { sources += [ - "src/compiler/linear-scheduler.h", - "src/compiler/revectorizer.h", "src/compiler/turboshaft/wasm-revec-phase.h", "src/compiler/turboshaft/wasm-revec-reducer.h", ] @@ -5485,6 +5716,9 @@ v8_header_set("v8_internal_headers") { if (v8_enable_experimental_tq_to_tsa) { deps += [ ":run_torque_to_tsa" ] } + if (v8_use_metagen_instance_types) { + deps += [ ":metagen_instance_types_h" ] + } } v8_compiler_sources = [ @@ -5783,8 +6017,6 @@ if (v8_enable_webassembly) { if (v8_enable_wasm_simd256_revec) { v8_compiler_sources += [ - "src/compiler/linear-scheduler.cc", - "src/compiler/revectorizer.cc", "src/compiler/turboshaft/wasm-revec-phase.cc", "src/compiler/turboshaft/wasm-revec-reducer.cc", ] @@ -6032,12 +6264,11 @@ v8_cluster_source_set("v8_base_without_compiler") { "src/debug/debug-frames.cc", "src/debug/debug-interface.cc", "src/debug/debug-property-iterator.cc", + "src/debug/debug-scope-info.cc", "src/debug/debug-scope-iterator.cc", "src/debug/debug-scopes.cc", "src/debug/debug-stack-trace-iterator.cc", "src/debug/debug.cc", - "src/debug/liveedit-diff.cc", - "src/debug/liveedit.cc", "src/deoptimizer/deoptimize-reason.cc", "src/deoptimizer/deoptimized-frame-info.cc", "src/deoptimizer/deoptimizer.cc", @@ -6370,6 +6601,7 @@ v8_cluster_source_set("v8_base_without_compiler") { "src/sandbox/js-dispatch-table.cc", "src/sandbox/sandbox.cc", "src/sandbox/sandboxable-thread.cc", + "src/sandbox/segmented-table.cc", "src/sandbox/testing.cc", "src/sandbox/trap-fuzzer.cc", "src/sandbox/trusted-pointer-scope.cc", @@ -7926,6 +8158,7 @@ if (v8_check_header_includes) { # This file will be generated by tools/generate-header-include-checks.py # if the "check_v8_header_includes" gclient variable is set. import("check-header-includes/sources.gni") + v8_source_set("check_headers") { configs = [ ":internal_config" ] sources = check_header_includes_sources @@ -7965,6 +8198,7 @@ if (v8_monolithic) { # Using external startup data would produce separate files. assert(!v8_use_external_startup_data, "Set `v8_use_external_startup_data = false` for v8_monolithic.") + v8_static_library("v8_monolith") { deps = [ ":v8", @@ -8229,7 +8463,10 @@ group("gn_all") { } group("v8_python_base") { - data = [ ".vpython3" ] + data = [ + "vpython.toml", + "vpython.toml.uv.lock", + ] } # Enable fallbacks for files that might be hard to access on Clusterfuzz. @@ -8872,6 +9109,7 @@ if (v8_enable_webassembly) { template("v8_wasm_fuzzer") { forward_variables_from(invoker, "*") + v8_fuzzer(target_name) { deps = [ ":wasm_test_common" ] } diff --git a/deps/v8/COMMON_OWNERS b/deps/v8/COMMON_OWNERS index d789357ca67a..998869969e65 100644 --- a/deps/v8/COMMON_OWNERS +++ b/deps/v8/COMMON_OWNERS @@ -1,5 +1,6 @@ ahaas@chromium.org alexschulze@chromium.org +arashk@chromium.org bikineev@chromium.org bmeurer@chromium.org cbruni@chromium.org diff --git a/deps/v8/DEPS b/deps/v8/DEPS index 30d59efdb80c..67ee185a5afd 100644 --- a/deps/v8/DEPS +++ b/deps/v8/DEPS @@ -76,6 +76,9 @@ vars = { # Fetch the internal agents repository. 'checkout_agents_internal': False, + # CPython 3 CIPD package version for Siso hermetic toolchain. + 'cpython3_version': 'version:3@3.11.9.chromium.38', + # reclient CIPD package version 'reclient_version': 're_client_version:0.185.0.db415f21-gomaip', @@ -96,24 +99,24 @@ vars = { 'chromium_jetstream_git': 'https://chromium.googlesource.com/external/github.com/WebKit/JetStream.git', # GN CIPD package version. - 'gn_version': 'git_revision:641ace93dd9560e75e7add0d08f77b446fbb3b78', + 'gn_version': 'git_revision:a99d46a9d04c770d6bb87387058e1d7b151758ce', # ninja CIPD package version # https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja 'ninja_version': 'version:3@1.12.1.chromium.4', # siso CIPD package version - 'siso_version': 'git_revision:78c72819a5567e09f4b3083b04c6b15d11bb345b', + 'siso_version': 'git_revision:efbbe7f1892211b5e9512576843a3c247b6a6d7c', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Fuchsia sdk # and whatever else without interference from each other. - 'fuchsia_version': 'version:32.20260723.5.1', + 'fuchsia_version': 'version:33.20260824.1.1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling partition_alloc_version # and whatever else without interference from each other. - 'partition_alloc_version': '66df8ef636795eff70efc52a47d8f62612800054', + 'partition_alloc_version': 'c029851c21b7e1154fa3964e08c97710adc92cc7', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_build-tools_version @@ -138,15 +141,15 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling jetstream_3.0-custom_revision # and whatever else without interference from each other. - 'jetstream_3.0-custom_revision': '91552391bf2f429a2b7102c5c02d6f2cb82b4bcf', + 'jetstream_3.0-custom_revision': 'ffde597c189c9c781986a6247a5844b1c04e4a8a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling agents-internal # and whatever else without interference from each other. - 'agents_internal_revision': '21c25488408500557636122892d27dda39a0f922', + 'agents_internal_revision': 'd2d5adf5a243d90aba25902a46fc32e7a4f5ab99', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling agents-public # and whatever else without interference from each other. - 'agents_public_revision': '559f135fc214d637f85174c6be7010804e31f1e5', + 'agents_public_revision': '4e0a8bacdfcc6b6303540aa466b05a508f349486', } deps = { @@ -158,9 +161,9 @@ deps = { 'condition': 'checkout_agents_internal', }, 'build': - Var('chromium_url') + '/chromium/src/build.git' + '@' + 'fab0ea1e4e8033be4088e2478d58cfac471b76ca', + Var('chromium_url') + '/chromium/src/build.git' + '@' + '8ca8a372cab9ff143072204053d30fbc2c17bd7a', 'buildtools': - Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '0d8a204ff274ee12fa9ace5e3ffd8e5fbcb54926', + Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '6f6a5dbf04b734214f3b1f386567d101ec9d607e', 'buildtools/linux64': { 'packages': [ { @@ -215,7 +218,7 @@ deps = { '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' + '@' + '9e61c12835c5e4a3bdba93850427e6742c4f64c4', + Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + '72faf8ec1445c55149615e8b35187830783aba1a', 'third_party/android_platform': { 'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + 'e3919359f2387399042d31401817db4a02d756ec', 'condition': 'checkout_android', @@ -257,11 +260,11 @@ deps = { 'dep_type': 'cipd', }, 'third_party/catapult': { - 'url': Var('chromium_url') + '/catapult.git' + '@' + '74513188f5cd39f9edb16236ea3a49ed5b3cb3c6', + 'url': Var('chromium_url') + '/catapult.git' + '@' + '50c971fc0958d8c1fb0adcc97f41b90042fa7c87', 'condition': 'checkout_android', }, 'third_party/clang-format/script': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/clang/tools/clang-format.git' + '@' + '6eddfb5ec5f92127a531eda66c568d3a11e7ec11', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/clang/tools/clang-format.git' + '@' + '70510081984cfcdb14a15b3e08dfe9776dc7ed37', 'third_party/colorama/src': { 'url': Var('chromium_url') + '/external/colorama.git' + '@' + '3de9f013df4b470069d03d250224062e8cf15c49', 'condition': 'checkout_android', @@ -275,7 +278,7 @@ deps = { 'condition': 'checkout_android', }, 'third_party/depot_tools': - Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + 'f394ab2c993283e94680ca13db98b99927868e98', + Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + 'cb70c994a656601dc6a0d423f49ff57503bd70bc', 'third_party/dragonbox/src': Var('chromium_url') + '/external/github.com/jk-jeon/dragonbox.git' + '@' + 'beeeef91cf6fef89a4d4ba5e95d47ca64ccb3a44', 'third_party/fp16/src': @@ -283,7 +286,7 @@ deps = { 'third_party/fast_float/src': Var('chromium_url') + '/external/github.com/fastfloat/fast_float.git' + '@' + '34164f547b7df3f5d794ff67e9f885c36819ebfc', 'third_party/fuchsia-gn-sdk': { - 'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-gn-sdk.git' + '@' + '4f34a41435a29fbf91cb3c6e0bcaffff6598c190', + 'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-gn-sdk.git' + '@' + '740d23bfe5b137c2c387a4b421f120f6126845de', 'condition': 'checkout_fuchsia', }, 'third_party/simdutf': @@ -307,17 +310,17 @@ deps = { 'url': Var('chromium_url') + '/external/github.com/google/benchmark.git' + '@' + '8abf1e701fbd88c8170f48fe0558247e2e5f8e7d', }, 'third_party/fuzztest': - Var('chromium_url') + '/chromium/src/third_party/fuzztest.git' + '@' + 'cc30588369ddfd00e2098229ea8050a8ebe1cf58', + Var('chromium_url') + '/chromium/src/third_party/fuzztest.git' + '@' + 'f0f143db954fb311d4e7ba39972d2dab9ba47e2a', 'third_party/fuzztest/src': - Var('chromium_url') + '/external/github.com/google/fuzztest.git' + '@' + '073bf2392bf11e22d456036a8f7d286bc9a6d346', + Var('chromium_url') + '/external/github.com/google/fuzztest.git' + '@' + '846bda6f291e26b7f8fb33c8de23796129bffd12', 'third_party/googletest/src': Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '4fe3307fb2d9f86d19777c7eb0e4809e9694dde7', 'third_party/highway/src': Var('chromium_url') + '/external/github.com/google/highway.git' + '@' + '2607d3b5b0113992fe84d3848859eae13b3b52c1', 'third_party/icu': - Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'd578f2e8b7bd5938e21cfb6bf15c079e0aa5b738', + Var('chromium_url') + '/chromium/deps/icu.git' + '@' + '6ebb40c594776cc2c21ea14df85a2a89a328b364', 'third_party/instrumented_libs': { - 'url': Var('chromium_url') + '/chromium/third_party/instrumented_libraries.git' + '@' + 'e8cb570a9a2ee9128e2214c73417ad2a3c47780b', + 'url': Var('chromium_url') + '/chromium/third_party/instrumented_libraries.git' + '@' + 'd15c278eed5d38d9acf2d8054cf37baba93cef8e', 'condition': 'checkout_instrumented_libraries', }, 'third_party/ittapi': { @@ -329,175 +332,182 @@ deps = { 'third_party/jinja2': Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + 'c3027d884967773057bf74b957e3fea87e5df4d7', 'third_party/jsoncpp/source': - Var('chromium_url') + '/external/github.com/open-source-parsers/jsoncpp.git'+ '@' + 'edc01ab10f52135ec80e3589b6b4e0a9c65b27fd', + Var('chromium_url') + '/external/github.com/open-source-parsers/jsoncpp.git'+ '@' + '3347a4b86bb914cb565f0cbda19c06e109513300', 'third_party/libc++/src': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + 'b16984ce99c702355a5b2b4c52574e82cec41fb9', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + '97b436da4c33663581d394f4ee0a5977fc38c2f4', 'third_party/libc++abi/src': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + '8f11bb1d4438d0239d0dfc1bd9456a9f31629dda', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + 'fc1897a2c12aa27e703c3ed48b62eba8abf4ce19', 'third_party/libpfm4': Var('chromium_url') + '/chromium/src/third_party/libpfm4.git' + '@' + '4a112befd93f8d90a9b6894b2ec4d320310e1178', 'third_party/libpfm4/src': Var('chromium_url') + '/external/git.code.sf.net/p/perfmon2/libpfm4.git' + '@' + '6870a9f00412830ceaa7e4384bb92ee323e2a28f', 'third_party/libunwind/src': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + '1fd455816c724182cf8736811182bf0c37b03035', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + '45120ee2331193c3650acc9c427ed267fab31d62', 'third_party/llvm-libc/src': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libc.git' + '@' + '75ae50cd48c8a9d70f552ccff040029968778da9', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libc.git' + '@' + '43a9a99ce4b5a04954090f8a0e74bf2786f59379', 'third_party/llvm-build/Release+Asserts': { 'dep_type': 'gcs', 'bucket': 'chromium-browser-clang', 'objects': [ { - 'object_name': 'Linux_x64/clang-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': 'e22e06c05fe1657f48f988b15804b8226e691addb00abba5b984a5c99ac98c42', - 'size_bytes': 59093892, - 'generation': 1781627382446731, + 'object_name': 'Linux_x64/clang-android-runtime-library-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '780597375163e78615a307a73ec66346b54c58ea3164aa6fbedf24eae85382fc', + 'size_bytes': 6210856, + 'generation': 1787607008868327, + 'condition': 'checkout_android', + }, + { + 'object_name': 'Linux_x64/clang-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '565f7d980b31411e76d9478731cf3f0ac907a46f274d289ea7f03d9137354053', + 'size_bytes': 56894668, + 'generation': 1787607001504676, 'condition': 'host_os == "linux"', }, { - 'object_name': 'Linux_x64/clang-tidy-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '96da04c2fff4e580ac81b840405edfa292108d0b593927a10750c0a1d8599c0a', - 'size_bytes': 14808648, - 'generation': 1781627382496605, + 'object_name': 'Linux_x64/clang-tidy-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '4290664a4fa8aa11fd1e6b2d3ff4965d26b41cca1a4950f9835ff19115c2384f', + 'size_bytes': 14877500, + 'generation': 1787607001575317, 'condition': 'host_os == "linux" and checkout_clang_tidy', }, { - 'object_name': 'Linux_x64/clangd-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '1e6b6918bb270659ef517a3e8f80af8f371bc79a9d942241978db8faea22f152', - 'size_bytes': 15001372, - 'generation': 1781627382490030, + 'object_name': 'Linux_x64/clangd-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '9db50937915608c466da28ba4166cfa69a5f6bcad346233e47807f532cc3075b', + 'size_bytes': 15049952, + 'generation': 1787607001603946, 'condition': 'host_os == "linux" and checkout_clangd', }, { - 'object_name': 'Linux_x64/llvm-code-coverage-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': 'bb63e33c20329c344a9dfa958f3742b316c0b9dd602647190fb0037d8d53a7e6', - 'size_bytes': 2332356, - 'generation': 1781627382888550, + 'object_name': 'Linux_x64/llvm-code-coverage-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '34747a8e113c399daa36f75a5a0a4c0963871ceafbce7c49a3b5133f81a63bae', + 'size_bytes': 2352288, + 'generation': 1787607001865886, 'condition': 'host_os == "linux" and checkout_clang_coverage_tools', }, { - 'object_name': 'Linux_x64/llvmobjdump-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': 'e43b98bce71d58bbe1b456f7b62997c4d017cf8362a0367592428ac5a7512f41', - 'size_bytes': 5875704, - 'generation': 1781627382574869, + 'object_name': 'Linux_x64/llvmobjdump-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': 'cc8a621ec8cc3c48471c90cf4ed88dcc56bfb403824eda10f8b55796abaec280', + 'size_bytes': 5912568, + 'generation': 1787607001713199, 'condition': '(checkout_linux or checkout_mac or checkout_android) and host_os == "linux"', }, { - 'object_name': 'Mac/clang-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '84b3934db2fb3c2e657d4a783a83ca6d2facaf598991490ae8ab712fcb03224b', - 'size_bytes': 56083264, - 'generation': 1781627385112611, + 'object_name': 'Mac/clang-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': 'ba2b707d83f7a19d81b9403b4ebe8e999d41ae35fead00a142f02b67e197fe2f', + 'size_bytes': 56420628, + 'generation': 1787607010939621, 'condition': 'host_os == "mac" and host_cpu == "x64"', }, { - 'object_name': 'Mac/clang-mac-runtime-library-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '5079e2ac3f0fa76e8b0218bf99a65a5439e8dcf6a750f886a355a66df34c69c1', - 'size_bytes': 1010816, - 'generation': 1781627394919334, + 'object_name': 'Mac/clang-mac-runtime-library-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': 'da06337f54ba4b36c79e0d379557832bf82b9c7e85fe8ef78a5b953567d98de1', + 'size_bytes': 1012348, + 'generation': 1787607018227451, 'condition': 'checkout_mac and not host_os == "mac"', }, { - 'object_name': 'Mac/clang-tidy-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '1ca3dc160992d8c27765adaffcc8115aed34cdf7645a5354820e8c8b16b75dcd', - 'size_bytes': 14790996, - 'generation': 1781627384977799, + 'object_name': 'Mac/clang-tidy-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': 'ae5cbec1362517b6928162fddb9b160bd1c75e8fd90789718393e1cadf1342ae', + 'size_bytes': 14882308, + 'generation': 1787607010909866, 'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clang_tidy', }, { - 'object_name': 'Mac/clangd-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '4920275e6050dffbb81ba0210a627a61a20faa896aa50f5ecc2d765522790526', - 'size_bytes': 16720488, - 'generation': 1781627385229783, + 'object_name': 'Mac/clangd-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '73f5de0f007f8c588593d824147963ec770b66d487a707d1c377a06e34952d89', + 'size_bytes': 16779464, + 'generation': 1787607010899287, 'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clangd', }, { - 'object_name': 'Mac/llvm-code-coverage-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '07e8bf3354e0c086e420ab8f1f376e48c8b6207788cf30b56d1b0ad1fd4b0f12', - 'size_bytes': 2372720, - 'generation': 1781627385661382, + 'object_name': 'Mac/llvm-code-coverage-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': 'c47eb37873d3290cc95ba5f9027337895eeeaa199c3f70e63c5d09b710faf250', + 'size_bytes': 2411184, + 'generation': 1787607011184644, 'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clang_coverage_tools', }, { - 'object_name': 'Mac/llvmobjdump-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '9b286eecf04996dfa82cd1434bceb19612fa0754e4390649ba8dcd846dca9c1e', - 'size_bytes': 5797028, - 'generation': 1781627385345493, + 'object_name': 'Mac/llvmobjdump-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '4ddefa96f6aaa04ac502610fc736528f65dc3e1b997fc4a5380081937f6ffb1a', + 'size_bytes': 5874672, + 'generation': 1787607011035157, 'condition': 'host_os == "mac" and host_cpu == "x64"', }, { - 'object_name': 'Mac_arm64/clang-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': 'e96c5e31ddc2a6e841bcb0f7278ae82b3a581799904276e6f7673213c9748c27', - 'size_bytes': 47058068, - 'generation': 1781627397208650, + 'object_name': 'Mac_arm64/clang-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '264d803970f9b58ddbdc90464ad82e54cef642c58ec371ba5356dfa7342ece4d', + 'size_bytes': 47226204, + 'generation': 1787607020088085, 'condition': 'host_os == "mac" and host_cpu == "arm64"', }, { - 'object_name': 'Mac_arm64/clang-tidy-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '27eff49b49d393c903246d5e17ba620f62f493a8a39cb6dbdd2e3f5f06c592a2', - 'size_bytes': 12835944, - 'generation': 1781627397575694, + 'object_name': 'Mac_arm64/clang-tidy-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '3e02eae391e05018fb4e95d3c90b270688a5e3d5f5b31df6c59512e602478f36', + 'size_bytes': 12960456, + 'generation': 1787607020070956, 'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clang_tidy', }, { - 'object_name': 'Mac_arm64/clangd-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '9519e51006f45a797a351b616d92bff319793ab976eeb59df60901d6181f3c18', - 'size_bytes': 13205948, - 'generation': 1781627397237653, + 'object_name': 'Mac_arm64/clangd-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': 'a56514d09cfcb216efa297e5fecd51a2e248faf7db6edd2d444cfe78e0e219d3', + 'size_bytes': 13320572, + 'generation': 1787607020209265, 'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clangd', }, { - 'object_name': 'Mac_arm64/llvm-code-coverage-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '62084a5523a1c3b140166c2ed5a21bc110ceb65503f2759272a9f1feb00b503e', - 'size_bytes': 2000216, - 'generation': 1781627397451117, + 'object_name': 'Mac_arm64/llvm-code-coverage-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': 'b593c509e8f4269cf4a16272f6eddcea0f9dd47f6f3fe39b9813041d0f96d4e3', + 'size_bytes': 2031112, + 'generation': 1787607020489366, 'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clang_coverage_tools', }, { - 'object_name': 'Mac_arm64/llvmobjdump-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': 'b6c6c0b1b4147ba4d51603713d3ed21f88ee2f506ff07fb432b3444f1d323295', - 'size_bytes': 5548680, - 'generation': 1781627397409118, + 'object_name': 'Mac_arm64/llvmobjdump-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': 'c67f5dba316d6367be8c153ede456fdbef0dfffad4da10aaf597ff967c07378c', + 'size_bytes': 5610096, + 'generation': 1787607020228775, 'condition': 'host_os == "mac" and host_cpu == "arm64"', }, { - 'object_name': 'Win/clang-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '9e3894b94d0d5e3d5904a559f590f12bd53aa5d1d9b6a902de2acb957825de46', - 'size_bytes': 51306328, - 'generation': 1781627409675428, + 'object_name': 'Win/clang-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '166437ede456b3d7cf0d9317287511e47714f91da547dbde02992261aeef7174', + 'size_bytes': 51467544, + 'generation': 1787607030157700, 'condition': 'host_os == "win"', }, { - 'object_name': 'Win/clang-tidy-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '8fa52c3d1707e73d0689aaa3c8d3789f13e85526bef029d942baf44ed980b442', - 'size_bytes': 14867152, - 'generation': 1781627409620988, + 'object_name': 'Win/clang-tidy-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '13cae70dfa207c9ec27e294f38b732b5c820ef637f48d24cc8b97f5f3a96e220', + 'size_bytes': 15134360, + 'generation': 1787607030186388, 'condition': 'host_os == "win" and checkout_clang_tidy', }, { - 'object_name': 'Win/clang-win-runtime-library-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': 'f925c30e1f63291662b2ad91103592208ecc4354f669c98a07e35360d2561a13', - 'size_bytes': 2623388, - 'generation': 1781627419134531, + 'object_name': 'Win/clang-win-runtime-library-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '4ff9a06f5fc4a711103cd890e724ae4448d67873de438542f3ac6772e68d3c63', + 'size_bytes': 2638196, + 'generation': 1787607037249082, 'condition': 'checkout_win and not host_os == "win"', }, { - 'object_name': 'Win/clangd-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '54042464918d992a19efed3a5f2a170e6fc2e4551884b4870650e3a3a6a03b41', - 'size_bytes': 15262064, - 'generation': 1781627409708803, + 'object_name': 'Win/clangd-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '17f1d575127724051099a778d77e609f650702248cf4e7ff3ec33b377053edd9', + 'size_bytes': 15444040, + 'generation': 1787607030301504, 'condition': 'host_os == "win" and checkout_clangd', }, { - 'object_name': 'Win/llvm-code-coverage-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '7c4fbafcf2741a036d1f4058fc31b52cb5b0951e617561fc3d51b7fbe0a3044b', - 'size_bytes': 2496336, - 'generation': 1781627409916932, + 'object_name': 'Win/llvm-code-coverage-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '78aa6b2b9cf057077be6705b76e43ffed83e46e17ee86da1ab699340129b1aca', + 'size_bytes': 2512968, + 'generation': 1787607030493491, 'condition': 'host_os == "win" and checkout_clang_coverage_tools', }, { - 'object_name': 'Win/llvmobjdump-llvmorg-23-init-19482-g53d18800-1.tar.xz', - 'sha256sum': '7ea19d03f21ef59d2e511af8d9cccff20ea72deb54923557173bb46a64244fa7', - 'size_bytes': 5934284, - 'generation': 1781627409787893, + 'object_name': 'Win/llvmobjdump-llvmorg-24-init-3796-g20e97c4b-4.tar.xz', + 'sha256sum': '4b899193da883a447c75f057e3a94f5e7ab93e5df5724ad94cbd6bf82ea792b4', + 'size_bytes': 5994644, + 'generation': 1787607030276791, 'condition': '(checkout_linux or checkout_mac or checkout_android) and host_os == "win"', }, ], @@ -521,9 +531,9 @@ deps = { 'condition': 'not build_with_chromium', }, 'third_party/perfetto': - Var('chromium_url') + '/external/github.com/google/perfetto.git' + '@' + 'bd153cb9c843f35cce632e2f21b8cd04b551576e', + Var('chromium_url') + '/external/github.com/google/perfetto.git' + '@' + '5dbeaad4ceb91470a835426b52e0cb43a3e5ef10', 'third_party/protobuf': - Var('chromium_url') + '/chromium/src/third_party/protobuf.git' + '@' + 'f4b110307a4845dfe04c4fc5458d514eb8fc7d66', + Var('chromium_url') + '/chromium/src/third_party/protobuf.git' + '@' + '5f8c379d1fc89fe8eee16ae560dd5e514a4608da', 'third_party/re2/src': Var('chromium_url') + '/external/github.com/google/re2.git' + '@' + '972a15cedd008d846f1a39b2e88ce48d7f166cbd', 'third_party/requests': { @@ -531,41 +541,84 @@ deps = { 'condition': 'checkout_android', }, 'tools/rust': - Var('chromium_url') + '/chromium/src/tools/rust' + '@' + '9c007b63f883469648cd95ca8bbd88dd8f35a1b4', + Var('chromium_url') + '/chromium/src/tools/rust' + '@' + '54d1148695dbbbfc3e00dfd05aff502acaa602e3', 'tools/win': - Var('chromium_url') + '/chromium/src/tools/win' + '@' + '45843c2c1e993427751e2a07f904db069dc26ad6', + Var('chromium_url') + '/chromium/src/tools/win' + '@' + '13cb6e5d223dc49eadd082d3aef4c2a5b0e4c0a0', 'third_party/rust': - Var('chromium_url') + '/chromium/src/third_party/rust' + '@' + 'afbc96607d0e659715d803cc099607dd1737fc41', + Var('chromium_url') + '/chromium/src/third_party/rust' + '@' + '4dec6f65bcb34c4c289736b0e6fd571b35c6c665', 'third_party/rust-toolchain': { 'dep_type': 'gcs', 'bucket': 'chromium-browser-clang', 'objects': [ { - 'object_name': 'Linux_x64/rust-toolchain-b998449636a48e2c4a362809085b600a0174e1f2-5-llvmorg-23-init-19482-g53d18800.tar.xz', - 'sha256sum': '1753392d6fe791a5ce743bfc70f45e151ee27bcccede516fb221b023f2c06a05', - 'size_bytes': 274786408, - 'generation': 1783367871911099, + 'object_name': 'Linux_x64/rust-toolchain-0913b18e489ac1011b580e31fa5559654be12bfc-2-llvmorg-24-init-3796-g20e97c4b.tar.xz', + 'sha256sum': '4b131e81d157a97bcf454ad0fbb71bc2063b2a3708c858410c04201ef06134e5', + 'size_bytes': 276314860, + 'generation': 1786821088882867, 'condition': 'host_os == "linux"', }, { - 'object_name': 'Mac/rust-toolchain-b998449636a48e2c4a362809085b600a0174e1f2-5-llvmorg-23-init-19482-g53d18800.tar.xz', - 'sha256sum': '6925151e70efd917156f3d50925c5bd416b9adf4ff42ca4bf73b4a6610d785d2', - 'size_bytes': 262413648, - 'generation': 1783367875702343, + 'object_name': 'Mac/rust-toolchain-0913b18e489ac1011b580e31fa5559654be12bfc-2-llvmorg-24-init-3796-g20e97c4b.tar.xz', + 'sha256sum': '12ca849195c27495073ba52ae7126d8a4a9a5807cd7a0dc6ba6b6fa612302a6d', + 'size_bytes': 264031896, + 'generation': 1786821092536805, 'condition': 'host_os == "mac" and host_cpu == "x64"', }, { - 'object_name': 'Mac_arm64/rust-toolchain-b998449636a48e2c4a362809085b600a0174e1f2-5-llvmorg-23-init-19482-g53d18800.tar.xz', - 'sha256sum': '1765d9be3b30726f5f5ad60d8bc50ee66501220bc942019782cf423de3f7114e', - 'size_bytes': 246837492, - 'generation': 1783367879712419, + 'object_name': 'Mac_arm64/rust-toolchain-0913b18e489ac1011b580e31fa5559654be12bfc-2-llvmorg-24-init-3796-g20e97c4b.tar.xz', + 'sha256sum': 'fe128475561d7a51c797d1cb3ccea6f94fd770b167c8e0cc33bf75e7c25d8225', + 'size_bytes': 248465344, + 'generation': 1786821096222521, 'condition': 'host_os == "mac" and host_cpu == "arm64"', }, { - 'object_name': 'Win/rust-toolchain-b998449636a48e2c4a362809085b600a0174e1f2-5-llvmorg-23-init-19482-g53d18800.tar.xz', - 'sha256sum': 'dfa5db1cef7e75fd4d3ea5827f0c5eff3543d55d9d9982f806154e8d6b05950a', - 'size_bytes': 415992772, - 'generation': 1783367883448269, + 'object_name': 'Win/rust-toolchain-0913b18e489ac1011b580e31fa5559654be12bfc-2-llvmorg-24-init-3796-g20e97c4b.tar.xz', + 'sha256sum': '14bc9cea5e00cb191f58204ef44d68a6794f856a76f885c50298a12d052035bc', + 'size_bytes': 414479372, + 'generation': 1786821099612317, + 'condition': 'host_os == "win"', + }, + ], + }, + # libclang + Python bindings, for the tools/metagen harvest. Built from + # the same LLVM revision as the clang and rust packages, so it stays in + # step with the toolchain metagen borrows its resource-dir from; bump + # this pin along with the clang/rust roll. + # + # The GCS object is named rust-libclang-*, but the entry uses the name + # Chromium gives it (src/third_party/llvm-libclang, maintained there by + # tools/clang/scripts/sync_deps.py) so //third_party/llvm-libclang + # resolves in both trees. + 'third_party/llvm-libclang': { + 'dep_type': 'gcs', + 'bucket': 'chromium-browser-clang', + 'objects': [ + { + 'object_name': 'Linux_x64/rust-libclang-0913b18e489ac1011b580e31fa5559654be12bfc-2-llvmorg-24-init-3796-g20e97c4b.tar.xz', + 'sha256sum': 'a36afcfb09b2b096cd7d17b6008beb1993c3962d780a7ccc0aa4c5f544447429', + 'size_bytes': 22734560, + 'generation': 1786821090667672, + 'condition': 'host_os == "linux"', + }, + { + 'object_name': 'Mac/rust-libclang-0913b18e489ac1011b580e31fa5559654be12bfc-2-llvmorg-24-init-3796-g20e97c4b.tar.xz', + 'sha256sum': '0ff3d2a46a0ed3851311cce6aa60f70f3d3e88e4177c2b10806c990a72461f67', + 'size_bytes': 23130796, + 'generation': 1786821094366500, + 'condition': 'host_os == "mac" and host_cpu == "x64"', + }, + { + 'object_name': 'Mac_arm64/rust-libclang-0913b18e489ac1011b580e31fa5559654be12bfc-2-llvmorg-24-init-3796-g20e97c4b.tar.xz', + 'sha256sum': '0a95d15ec7e992b60f47b9cf98f951b32f718488aa5d15d1c8cbae81f1db6b39', + 'size_bytes': 20545284, + 'generation': 1786821097847085, + 'condition': 'host_os == "mac" and host_cpu == "arm64"', + }, + { + 'object_name': 'Win/rust-libclang-0913b18e489ac1011b580e31fa5559654be12bfc-2-llvmorg-24-init-3796-g20e97c4b.tar.xz', + 'sha256sum': '75033b0243acf7c25227f6015c60797724b98d1de5514e9e1a374735ef76aa4e', + 'size_bytes': 21534908, + 'generation': 1786821101319840, 'condition': 'host_os == "win"', }, ], @@ -580,14 +633,36 @@ deps = { 'dep_type': 'cipd', 'condition': 'not build_with_chromium and host_cpu != "s390x" and host_os != "zos" and host_cpu != "ppc64"', }, + # Always download Linux x64 package regardless of host OS for RBE workers. + 'third_party/cpython3/linux-amd64': { + 'packages': [ + { + 'package': 'infra/3pp/tools/cpython3/linux-amd64', + 'version': Var('cpython3_version'), + } + ], + 'condition': 'not build_with_chromium and host_cpu != "s390x" and host_os != "zos" and host_cpu != "ppc64"', + 'dep_type': 'cipd', + }, + # Host platform package. + 'third_party/cpython3/host': { + 'packages': [ + { + 'package': 'infra/3pp/tools/cpython3/${{platform}}', + 'version': Var('cpython3_version'), + } + ], + 'condition': 'not build_with_chromium and host_cpu != "s390x" and host_os != "zos" and host_cpu != "ppc64"', + 'dep_type': 'cipd', + }, 'third_party/zlib': - Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '42c2f19a14d33b4ed327ab898fe7b652013aa740', + Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '285e94b8fa95ad3b7d16b80798ec8dce6febb8c8', 'tools/clang': - Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '56a7ab321b6840e949e3acf5f4528dadc6cb05bc', + Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '450d823868eaee61e2b2cb986e19aec287f16d58', 'tools/protoc_wrapper': - Var('chromium_url') + '/chromium/src/tools/protoc_wrapper.git' + '@' + '418c65786fdf6fc5f10cb008c252c2b12c4713a6', + Var('chromium_url') + '/chromium/src/tools/protoc_wrapper.git' + '@' + 'e9dbe1bf6a2a5d2d4973725874259eed587cf18d', 'third_party/abseil-cpp': { - 'url': Var('chromium_url') + '/chromium/src/third_party/abseil-cpp.git' + '@' + 'ff6e8ce3e932c16cebd1611c8fc42c45080a0e55', + 'url': Var('chromium_url') + '/chromium/src/third_party/abseil-cpp.git' + '@' + '435e7d977fb36fb47854a4c552c0706dad0bd7cf', 'condition': 'not build_with_chromium', }, 'third_party/fadec/src': { @@ -828,7 +903,7 @@ hooks = [ 'name': 'vpython3_common', 'pattern': '.', 'action': [ 'vpython3', - '-vpython-spec', '.vpython3', + '-vpython-spec', 'vpython.toml', '-vpython-tool', 'install', ], }, diff --git a/deps/v8/MODULE.bazel b/deps/v8/MODULE.bazel index 00ad66496a5e..9f3b298b0b1b 100644 --- a/deps/v8/MODULE.bazel +++ b/deps/v8/MODULE.bazel @@ -118,8 +118,7 @@ def _impl(ctx): "{WORKSPACE_ROOT}/third_party/libc++abi/src/include", "{WORKSPACE_ROOT}/third_party/libc++/src/src", "{WORKSPACE_ROOT}/third_party/llvm-libc/src", - "{WORKSPACE_ROOT}/third_party/llvm-build/Release+Asserts/lib/clang/22/include", - "{WORKSPACE_ROOT}/third_party/llvm-build/Release+Asserts/lib/clang/23/include", + "{WORKSPACE_ROOT}/third_party/llvm-build/Release+Asserts/lib/clang/24/include", "{WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot/usr/include", "{WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot/usr/local/include", ], diff --git a/deps/v8/OWNERS b/deps/v8/OWNERS index 265bcceab8d4..3bf23b9f9fb1 100644 --- a/deps/v8/OWNERS +++ b/deps/v8/OWNERS @@ -2,6 +2,7 @@ # Disagreement among owners should be escalated to eng reviewers. file:ENG_REVIEW_OWNERS +per-file vpython.toml*=file:INFRA_OWNERS per-file .*=file:INFRA_OWNERS per-file .bazelrc=file:COMMON_OWNERS per-file .mailmap=file:COMMON_OWNERS diff --git a/deps/v8/PRESUBMIT.py b/deps/v8/PRESUBMIT.py index 3e25c400395a..335f2333e0b9 100644 --- a/deps/v8/PRESUBMIT.py +++ b/deps/v8/PRESUBMIT.py @@ -436,7 +436,7 @@ def _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api): r'//.*({})'.format(base_function_pattern)) exclusion_pattern = input_api.re.compile( r'::[A-Za-z0-9_]+({})|({})[^;]+'.format(base_function_pattern, - base_function_pattern) + '\{') + base_function_pattern) + r'\{') def FilterFile(affected_file): files_to_skip = (_EXCLUDED_PATHS + @@ -679,6 +679,7 @@ def _CommonChecks(input_api, output_api): _CheckNoInlineHeaderIncludesInNormalHeaders, _CheckInlineHeadersIncludeNonInlineHeadersFirst, _CheckJSONFiles, + _CheckMetagenHeaders, _CheckNoexceptAnnotations, _CheckBannedCpp, _RunTestsWithVPythonSpec, @@ -747,6 +748,8 @@ def _CheckLandOnChromiumBranch(input_api, output_api): target_branch = 'refs/heads/%s' % target_branch if not target_branch.startswith('refs/heads/chromium/'): return [] + if '_' in target_branch: # Allow merges to mini branches. + return [] description = input_api.change.FullDescriptionText() if input_api.re.search(r'^LAND_ON_CHROMIUM_BRANCH=.+', description, @@ -844,6 +847,82 @@ def FilterFile(affected_file): return [] +def _CheckMetagenHeaders(input_api, output_api): + """Check that tools/metagen's driver still reaches every heap object. + + tools/metagen/metagen.py harvests the InstanceType enum from the class + declarations its driver's include closure reaches. A header that grows a + V8_OBJECT / V8_IT_ class but that nothing in the closure includes is + silently skipped -- the class simply gets no instance type -- so catch the + drift at upload time. + + Reachability is resolved textually rather than by preprocessing, and + conditional includes are followed regardless of their guard: a header + reachable only under V8_INTL_SUPPORT still counts as reached, because the + harvest runs per build configuration and sees it in the configs that + enable it. + """ + import subprocess + v8_root = input_api.PresubmitLocalPath() + join = input_api.os_path.join + + # A header takes part in the harvest if it declares a V8_OBJECT / + # V8_ABSTRACT_OBJECT class or carries a `V8_IT_` marker, which is + # a member of the class body. Leading whitespace is allowed for both; + # requiring the marker at the start of its line is what keeps a + # comment that mentions a marker out. object-macros.h matches + # structurally because it defines the markers themselves; exclude it. + marker_regex = ( + r"^[[:space:]]*V8_(ABSTRACT_)?OBJECT|^[[:space:]]*V8_IT_[A-Z_]+") + try: + res = subprocess.run([ + "git", "grep", "-lE", marker_regex, "--", "src/**/*.h", + ":!src/objects/object-macros.h" + ], + cwd=v8_root, + capture_output=True, + text=True, + check=True) + except (subprocess.CalledProcessError, FileNotFoundError) as e: + return [ + output_api.PresubmitNotifyResult( + f"_CheckMetagenHeaders: skipping (git grep failed: {e})") + ] + live = set(res.stdout.split()) + + include_re = re.compile(r'^\s*#\s*include\s+"([^"]+)"', re.MULTILINE) + driver = join("tools", "metagen", "harvest-driver.cc") + reached = set() + queue = [driver] + while queue: + rel = queue.pop() + if rel in reached: + continue + reached.add(rel) + try: + with open(join(v8_root, rel)) as f: + body = f.read() + except OSError: + # Not a V8 file (a system or third_party header); its includes + # cannot reach a V8_OBJECT declaration we care about. + continue + queue.extend(include_re.findall(body)) + + missing = sorted(live - reached) + if not missing: + return [] + return [ + output_api.PresubmitError("\n".join([ + f"{driver} no longer reaches every heap object.", + "These headers carry a V8_OBJECT/V8_IT_ marker but nothing in the " + "driver's include closure includes them, so metagen assigns their " + "classes no instance type:", + ] + [f" {h}" for h in missing] + [ + "Add them to src/objects/all-objects.h.", + ])) + ] + + def _CheckBannedCpp(input_api, output_api): # We only check for a single pattern right now; feel free to add more, but # potentially change the logic for files_to_skip then (and skip individual diff --git a/deps/v8/agents/.vpython3 b/deps/v8/agents/.vpython3 index c9d6c30b5533..9a55b6ba5af3 100644 --- a/deps/v8/agents/.vpython3 +++ b/deps/v8/agents/.vpython3 @@ -99,6 +99,10 @@ wheel: < name: "infra/python/wheels/click-py3" version: "version:8.0.3" > +wheel: < + name: "infra/python/wheels/colorama-py2_py3" + version: "version:0.4.1" +> wheel: < name: "infra/python/wheels/perfetto-py3" version: "version:0.16.0" diff --git a/deps/v8/agents/PRESUBMIT.py b/deps/v8/agents/PRESUBMIT.py new file mode 100644 index 000000000000..7cf5428231c9 --- /dev/null +++ b/deps/v8/agents/PRESUBMIT.py @@ -0,0 +1,23 @@ +# Copyright 2026 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. + +USE_PYTHON3 = True + + +def _CommonChecks(input_api, output_api): + return input_api.RunTests( + input_api.canned_checks.GetUnitTestsInDirectory( + input_api, + output_api, + 'scripts', + files_to_check=[r'.+_test\.py$'], + run_on_python2=False)) + + +def CheckChangeOnCommit(input_api, output_api): + return _CommonChecks(input_api, output_api) + + +def CheckChangeOnUpload(input_api, output_api): + return _CommonChecks(input_api, output_api) diff --git a/deps/v8/agents/README.md b/deps/v8/agents/README.md index 762a42e13bdf..2d4e4f31732b 100644 --- a/deps/v8/agents/README.md +++ b/deps/v8/agents/README.md @@ -26,6 +26,10 @@ To use them, you need to run the appropriate installation script from the generate the subagent files in `.gemini/agents/`. - **For Jetski**: Run `vpython3 scripts/install_for_jetski.py` to create symlinks in `.agents/agents/`. +- **For GitHub Copilot CLI**: Run `vpython3 scripts/install_for_copilot_cli.py` + to generate repository instructions in `.github/copilot-instructions.md`, + install compatible V8 rules as instruction files in `.github/instructions/`, + and expose compatible V8 skills in `.github/skills/`. ## Contributing diff --git a/deps/v8/agents/scripts/create_worktree.sh b/deps/v8/agents/scripts/create_worktree.sh index 506446e3c597..81ee1049c500 100755 --- a/deps/v8/agents/scripts/create_worktree.sh +++ b/deps/v8/agents/scripts/create_worktree.sh @@ -51,8 +51,14 @@ WORKTREE_PATH="$V8_ROOT/worktrees/$BRANCH_NAME" mkdir -p "$V8_ROOT/worktrees" -git worktree add -b "$BRANCH_NAME" "$WORKTREE_PATH" origin/main > /dev/null 2>&1 +if ! git worktree add -b "$BRANCH_NAME" "$WORKTREE_PATH" origin/main; then + echo "Error: Failed to create git worktree at $WORKTREE_PATH" >&2 + exit 1 +fi -python3 "$V8_ROOT/tools/dev/setup_worktree_build.py" "$V8_ROOT" "$WORKTREE_PATH" > /dev/null 2>&1 +if ! python3 "$V8_ROOT/tools/dev/setup_worktree_build.py" "$V8_ROOT" "$WORKTREE_PATH"; then + echo "Error: Failed to set up dependencies for $WORKTREE_PATH" >&2 + exit 1 +fi echo "$WORKTREE_PATH" diff --git a/deps/v8/agents/scripts/install_for_copilot_cli.py b/deps/v8/agents/scripts/install_for_copilot_cli.py new file mode 100644 index 000000000000..63d2182d27d2 --- /dev/null +++ b/deps/v8/agents/scripts/install_for_copilot_cli.py @@ -0,0 +1,362 @@ +#!/usr/bin/env vpython3 +# Copyright 2026 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. +"""Install local GitHub Copilot CLI adapters for V8 agent files. + +Generated files are ignored by Git. Pass --force to refresh files created by a +previous run without replacing user-managed files. +""" + +from __future__ import annotations + +import argparse +import os +from pathlib import Path +import re +import stat +import sys +import yaml + +FILE_PATH = Path(__file__).resolve() +GENERATED_MARKER = ( + "") +# Copilot only reads instruction files that carry this suffix. +RULE_ADAPTER_SUFFIX = ".instructions.md" +FRONTMATTER_PATTERN = re.compile( + r"\A(?P---[ \t]*\r?\n(?P.*?)\r?\n---[ \t]*)" + r"(?:\r?\n|\Z)", re.DOTALL) +COPILOT_INCOMPATIBLE_RULES = { + # Mandates orchestration-only operation through subagent and `gdb-mcp` + # APIs not mapped by this adapter. + "debugging.md", + # Hard-codes Jetski/Gemini CLI behavior and adapter paths. + "framework.md", + # Mandates `TAG=agy` and a conversation ID that this adapter cannot + # supply, which would land in uploaded CL descriptions. + "git-commit.md", +} +COPILOT_INCOMPATIBLE_SKILLS = { + # Requires client-specific approval suppression and agent lifecycle controls + # not mapped by this adapter. + "agent-evaluation-framework", + # Mandates a subagent API and model tier not mapped by this adapter. + "doc-invalidation-checker", + # Maps only Jetski and Gemini CLI tools. + "env-abstraction", + # Mandates scheduling and delegation APIs not mapped by this adapter. + "orchestrator", + # Mandates internal Buganizer, session-context, and delegation APIs not + # provisioned or mapped by this adapter. + "v8-security-triaging", + # Mixes client-neutral tool setup with Jetski-specific .agents, MCP, and + # settings guidance; exclude it until split or adapted. + "v8-setup", +} + + +def _path_entry_exists(path: Path) -> bool: + try: + path.lstat() + except FileNotFoundError: + return False + return True + + +def _path_entry_is_reparse_point(path: Path) -> bool: + path_stat = path.lstat() + if stat.S_ISLNK(path_stat.st_mode): + return True + file_attributes = getattr(path_stat, "st_file_attributes", 0) + reparse_attribute = getattr(stat, "FILE_ATTRIBUTE_REPARSE_POINT", 0) + return bool(file_attributes & reparse_attribute) + + +class CopilotInstaller: + """Installs Copilot CLI adapters for one V8 checkout.""" + + def __init__(self, repo_root: Path): + self.repo_root = repo_root + self.agents_dir = repo_root / "agents" + self.skills_dir = self.agents_dir / "skills" + self.rules_dir = self.agents_dir / "rules" + self.github_dir = repo_root / ".github" + self.copilot_instructions = self.github_dir / "copilot-instructions.md" + self.github_skills_dir = self.github_dir / "skills" + self.github_instructions_dir = self.github_dir / "instructions" + + def _repo_path(self, path: Path) -> str: + return path.relative_to(self.repo_root).as_posix() + + def _frontmatter(self, markdown_file: Path) -> tuple[dict[str, str], str]: + """Return parsed YAML frontmatter and its original Markdown block.""" + match = FRONTMATTER_PATTERN.match(markdown_file.read_text(encoding="utf-8")) + if not match: + return {}, "" + metadata = yaml.safe_load(match.group("yaml")) or {} + if not isinstance(metadata, dict): + metadata = {} + return metadata, match.group("block") + + def _write_generated_file(self, path: Path, content: str) -> bool: + if path.is_symlink(): + print(f"Skipping {path}: existing path is a symlink") + return False + if _path_entry_exists(path): + try: + existing = path.read_text(encoding="utf-8") + except UnicodeDecodeError: + # Destinations under .github/ are user territory, so skip undecodable + # files instead of aborting the install part-way through. + print(f"Skipping {path}: existing file is not UTF-8 text") + return False + if GENERATED_MARKER not in existing: + print(f"Skipping {path}: existing file is not generated") + return False + + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(content, encoding="utf-8", newline="\n") + print(f"Wrote {path}") + return True + + def _rule_apply_to(self, metadata: dict[str, str]) -> str | None: + """Return the Copilot `applyTo` glob for a rule. + + `None` means Copilot has no equivalent trigger and the rule is only + advertised in the instructions. + """ + trigger = str(metadata.get("trigger", "")) + if trigger == "always_on": + # Copilot has no always-on trigger, but `**` matches every file. + return "**" + if trigger == "glob": + return str(metadata.get("globs", "")) or None + # Some rules carry the glob in the trigger field instead of `globs`. + if "*" in trigger: + return trigger + return None + + def _compatible_rules(self): + """Yield `(rule_file, metadata, apply_to)` for each compatible rule.""" + if not self.rules_dir.is_dir(): + return + for rule_file in sorted(self.rules_dir.glob("*.md")): + if rule_file.name in COPILOT_INCOMPATIBLE_RULES: + continue + metadata, _ = self._frontmatter(rule_file) + yield rule_file, metadata, self._rule_apply_to(metadata) + + def _rule_source_for(self, adapter_name: str) -> Path: + stem = adapter_name + if stem.endswith(RULE_ADAPTER_SUFFIX): + stem = stem[:-len(RULE_ADAPTER_SUFFIX)] + return self.rules_dir / f"{stem}.md" + + def _enumerate_rules(self) -> str: + """List rules that Copilot cannot trigger on its own.""" + entries = [] + for rule_file, metadata, apply_to in self._compatible_rules(): + if apply_to is not None: + continue + entry = f"- `{self._repo_path(rule_file)}`" + description = metadata.get("description", "") + if description: + entry += f": {description}" + entries.append(entry) + + if not entries: + return "" + return ("\n## Optional rules\n\n" + "Copilot cannot trigger these rules automatically. Read one when " + "its description matches the current task:\n\n" + + "\n".join(entries) + "\n") + + def _instructions(self) -> str: + return f"""{GENERATED_MARKER} +# V8 GitHub Copilot Instructions + +The canonical V8 agent knowledge lives under `agents/`. Update those checked-in +files rather than this generated adapter. + +## Canonical context + +Rules install as Copilot instruction files under `.github/instructions/`, which +Copilot applies on its own. Load compatible V8 skills on demand through +`.github/skills/`; their canonical content and supporting resources remain in +`agents/skills/`. When a rule or skill names another agent's tool, use the +Copilot CLI equivalent. +{self._enumerate_rules()}""" + + def _generated_markdown(self, path: Path) -> bool: + if not path.is_file(): + return False + try: + return GENERATED_MARKER in path.read_text(encoding="utf-8") + except UnicodeDecodeError: + # A file this script cannot decode is not one it generated. + return False + + def _generated_link(self, path: Path, source: Path) -> bool: + if not path.is_symlink(): + return False + try: + return os.readlink(path) == os.path.relpath(source, start=path.parent) + except OSError: + return False + + def _remove_generated_adapter(self, path: Path, source: Path) -> bool: + """Remove an adapter this script generated, keeping user files intact.""" + if self._generated_link(path, source): + path.unlink() + return True + if path.is_symlink() or _path_entry_is_reparse_point(path): + return False + if path.is_file(): + if not self._generated_markdown(path): + return False + path.unlink() + return True + if path.is_dir() and self._generated_markdown(path / "SKILL.md"): + (path / "SKILL.md").unlink() + if not any(path.iterdir()): + path.rmdir() + return True + return False + + def _skill_wrapper(self, skill_dir: Path) -> str: + skill_file = skill_dir / "SKILL.md" + metadata, frontmatter = self._frontmatter(skill_file) + name = metadata.get("name", skill_dir.name) + if not frontmatter: + frontmatter = ( + "---\n" + f"name: {skill_dir.name}\n" + f"description: Adapter for the canonical V8 {skill_dir.name} skill.\n" + "---") + canonical_path = self._repo_path(skill_file) + base_path = self._repo_path(skill_dir) + return f"""{frontmatter} +{GENERATED_MARKER} + +# {name} + +Read and follow the canonical skill at `{canonical_path}`. +Treat `{base_path}/` as the skill's base directory when resolving relative +paths and supporting resources. +""" + + def _write_skill_wrapper(self, skill_dir: Path, dest: Path) -> None: + self._write_generated_file(dest / "SKILL.md", + self._skill_wrapper(skill_dir)) + + def _rule_wrapper(self, rule_file: Path, apply_to: str) -> str: + """Render a rule as an instruction file Copilot can act on. + + The canonical frontmatter is dropped rather than passed through, because + its `trigger` vocabulary means nothing to Copilot. + """ + _, frontmatter = self._frontmatter(rule_file) + body = rule_file.read_text(encoding="utf-8")[len(frontmatter):] + return (f"---\napplyTo: \"{apply_to}\"\n---\n" + f"{GENERATED_MARKER}\n\n{body.lstrip()}") + + def _remove_stale_adapters(self, adapters_dir: Path, current: set[str], + source_for) -> None: + if not adapters_dir.is_dir(): + return + for dest in adapters_dir.iterdir(): + if dest.name in current: + continue + if self._remove_generated_adapter(dest, source_for(dest.name)): + print(f"Removed stale adapter {dest}") + + def _install_skill(self, skill_dir: Path, force: bool) -> None: + """Link the skill into `.github/`, falling back to a generated wrapper.""" + dest = self.github_skills_dir / skill_dir.name + if _path_entry_exists(dest): + if not force: + print(f"Skipping {dest}: already exists") + return + if not self._remove_generated_adapter(dest, skill_dir): + print(f"Skipping {dest}: existing path is not generated") + return + if _path_entry_exists(dest): + self._write_skill_wrapper(skill_dir, dest) + return + + dest.parent.mkdir(parents=True, exist_ok=True) + target = Path(os.path.relpath(skill_dir, start=dest.parent)) + try: + dest.symlink_to(target, target_is_directory=True) + print(f"Symlinked {dest} -> {target}") + except OSError as exc: + if _path_entry_exists(dest): + print(f"Skipping {dest}: failed to create a clean adapter: {exc}") + return + print(f"Could not symlink {dest}: {exc}; writing a wrapper instead") + self._write_skill_wrapper(skill_dir, dest) + + def _install_rule(self, rule_file: Path, apply_to: str) -> None: + # A rule cannot be linked the way a skill is, because Copilot needs an + # `applyTo` header that the canonical file does not carry. + dest = self.github_instructions_dir / (rule_file.stem + RULE_ADAPTER_SUFFIX) + self._write_generated_file(dest, self._rule_wrapper(rule_file, apply_to)) + + def install(self, force: bool) -> int: + if not self.skills_dir.is_dir(): + print(f"Missing skills directory: {self.skills_dir}", file=sys.stderr) + return 1 + + for destination in (self.github_dir, self.github_skills_dir, + self.github_instructions_dir): + if (_path_entry_exists(destination) and + _path_entry_is_reparse_point(destination)): + print( + f"Unsafe adapter destination: {destination} is a symlink or " + "reparse point", + file=sys.stderr) + return 1 + + self._write_generated_file(self.copilot_instructions, self._instructions()) + + self.github_skills_dir.mkdir(parents=True, exist_ok=True) + + current_skills = sorted( + path for path in self.skills_dir.iterdir() + if (path.is_dir() and (path / "SKILL.md").is_file() and + path.name not in COPILOT_INCOMPATIBLE_SKILLS)) + current_rules = [(rule_file, apply_to) + for rule_file, _, apply_to in self._compatible_rules() + if apply_to is not None] + # Stale adapters are dropped even without `--force`: reclaiming a path + # this script generated is not the same as overwriting a user's file, and + # leaving one behind keeps a rule active after it stops being compatible. + self._remove_stale_adapters(self.github_skills_dir, + {path.name for path in current_skills}, + lambda name: self.skills_dir / name) + self._remove_stale_adapters( + self.github_instructions_dir, + {path.stem + RULE_ADAPTER_SUFFIX for path, _ in current_rules}, + self._rule_source_for) + for skill_dir in current_skills: + self._install_skill(skill_dir, force) + for rule_file, apply_to in current_rules: + self._install_rule(rule_file, apply_to) + + print("GitHub Copilot CLI adapter installation complete.") + print("Restart or resume your Copilot CLI session to pick up the changes.") + return 0 + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--force", + action="store_true", + help="replace adapters generated by a previous run") + args = parser.parse_args(argv) + return CopilotInstaller(FILE_PATH.parents[2]).install(args.force) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/deps/v8/agents/scripts/install_for_copilot_cli_test.py b/deps/v8/agents/scripts/install_for_copilot_cli_test.py new file mode 100644 index 000000000000..bdb3198cfc0d --- /dev/null +++ b/deps/v8/agents/scripts/install_for_copilot_cli_test.py @@ -0,0 +1,651 @@ +#!/usr/bin/env python3 +# Copyright 2026 the V8 project authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import io +import os +from pathlib import Path +import shutil +import stat +import subprocess +import tempfile +import unittest +from unittest import mock + +from install_for_copilot_cli import CopilotInstaller +from install_for_copilot_cli import COPILOT_INCOMPATIBLE_RULES +from install_for_copilot_cli import COPILOT_INCOMPATIBLE_SKILLS +from install_for_copilot_cli import GENERATED_MARKER + +REPO_ROOT = Path(__file__).resolve().parents[2] + + +class CopilotInstallerTest(unittest.TestCase): + + def setUp(self): + self.temp_dir = tempfile.TemporaryDirectory() + self.repo_root = Path(self.temp_dir.name) + self.skills_dir = self.repo_root / "agents" / "skills" + self.rules_dir = self.repo_root / "agents" / "rules" + self.skills_dir.mkdir(parents=True) + self.rules_dir.mkdir() + self.installer = CopilotInstaller(self.repo_root) + + def tearDown(self): + self.temp_dir.cleanup() + + def _write(self, path: Path, content: str) -> None: + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(content, encoding="utf-8") + + def _add_skill(self, name: str, body: str = "Original instructions.\n"): + skill_dir = self.skills_dir / name + self._write(skill_dir / "SKILL.md", + f"---\nname: {name}\ndescription: Test skill.\n---\n\n{body}") + self._write(skill_dir / "scripts" / "helper.py", "print('helper')\n") + return skill_dir + + def _add_rule(self, + name: str, + trigger: str = "", + globs: str = "", + description: str = "", + body: str = "Rule body.\n") -> Path: + frontmatter = [f"name: {name}"] + if trigger: + frontmatter.append(f"trigger: {trigger}") + if globs: + frontmatter.append(f"globs: {globs}") + if description: + frontmatter.append(f"description: {description}") + rule_file = self.rules_dir / f"{name}.md" + self._write(rule_file, "---\n{}\n---\n\n{}".format("\n".join(frontmatter), + body)) + return rule_file + + def _rule_adapter(self, name: str) -> Path: + return self.installer.github_instructions_dir / f"{name}.instructions.md" + + # Junctions need neither elevation nor developer mode, so failures are real. + def _create_junction(self, junction: Path, target: Path) -> None: + subprocess.run( + ["cmd.exe", "/d", "/c", "mklink", "/J", + str(junction), + str(target)], + check=True, + capture_output=True, + text=True) + + def _is_junction(self, junction: Path) -> bool: + return bool(junction.lstat().st_file_attributes + & stat.FILE_ATTRIBUTE_REPARSE_POINT) + + def _remove_junction(self, junction: Path) -> None: + # Tolerate a missing junction so cleanup cannot mask an assertion failure. + try: + is_junction = self._is_junction(junction) + except FileNotFoundError: + return + if is_junction: + os.rmdir(junction) + + def _symlink_or_skip(self, + link: Path, + target: Path, + is_directory: bool = True) -> None: + try: + link.symlink_to(target, target_is_directory=is_directory) + except OSError as exc: + self.skipTest(f"Symlinks are unavailable: {exc}") + + def _require_symlinks(self) -> None: + probe = self.repo_root / "symlink-probe" + self._symlink_or_skip(probe, self.repo_root) + probe.unlink() + + def _without_symlink_support(self): + return mock.patch.object( + Path, "symlink_to", side_effect=OSError("unsupported")) + + def _file_snapshot(self, root: Path) -> dict[Path, bytes]: + return { + path.relative_to(root): path.read_bytes() + for path in root.rglob("*") + if path.is_file() + } + + def test_wrapper_fallback_points_to_canonical_skill(self): + self._add_skill("test-skill", + "Run [the helper](../../scripts/create_worktree.sh).\n") + self._add_rule("always", trigger="always_on") + for rule_name in COPILOT_INCOMPATIBLE_RULES: + self._add_rule(Path(rule_name).stem, trigger="always_on") + + with self._without_symlink_support(): + self.assertEqual(0, self.installer.install(force=False)) + + instructions = self.installer.copilot_instructions.read_text( + encoding="utf-8") + self.assertIn(GENERATED_MARKER, instructions) + self.assertIn(".github/instructions/", instructions) + self.assertIn("Load compatible V8 skills on demand", instructions) + # The generated file points at canonical knowledge instead of restating + # it, and does not rely on `@` imports being expanded, so neither an + # import line nor duplicated build guidance may appear here. + self.assertNotIn("@agents/rules/", instructions) + self.assertNotIn("tools/dev/gm.py", instructions) + for rule_name in COPILOT_INCOMPATIBLE_RULES: + self.assertNotIn(f"agents/rules/{rule_name}", instructions) + self.assertFalse(self._rule_adapter(Path(rule_name).stem).exists()) + + installed = self.installer.github_skills_dir / "test-skill" + wrapper = (installed / "SKILL.md").read_text(encoding="utf-8") + self.assertIn(GENERATED_MARKER, wrapper) + self.assertIn("agents/skills/test-skill/SKILL.md", wrapper) + self.assertIn( + "Treat `agents/skills/test-skill/` as the skill's base directory", + wrapper) + self.assertFalse((installed / "scripts" / "helper.py").exists()) + + def test_symlinked_skill_resolves_to_canonical_resources(self): + self._require_symlinks() + self._add_skill("test-skill") + + self.assertEqual(0, self.installer.install(force=False)) + + installed = self.installer.github_skills_dir / "test-skill" + self.assertTrue(installed.is_symlink()) + self.assertEqual( + os.path.join("..", "..", "agents", "skills", "test-skill"), + os.readlink(installed)) + self.assertIn("Original instructions.", + (installed / "SKILL.md").read_text(encoding="utf-8")) + self.assertTrue((installed / "scripts" / "helper.py").is_file()) + + def test_stale_symlinked_adapter_is_removed(self): + self._require_symlinks() + stale_skill = self._add_skill("stale-skill") + self.assertEqual(0, self.installer.install(force=False)) + installed = self.installer.github_skills_dir / "stale-skill" + self.assertTrue(installed.is_symlink()) + + shutil.rmtree(stale_skill) + self.assertEqual(0, self.installer.install(force=False)) + + self.assertFalse(installed.is_symlink()) + self.assertFalse(installed.exists()) + + def test_force_upgrades_wrapper_to_symlink(self): + self._require_symlinks() + self._add_skill("test-skill") + with self._without_symlink_support(): + self.assertEqual(0, self.installer.install(force=False)) + installed = self.installer.github_skills_dir / "test-skill" + self.assertFalse(installed.is_symlink()) + + self.assertEqual(0, self.installer.install(force=True)) + + self.assertTrue(installed.is_symlink()) + + def test_always_on_rule_applies_to_every_file(self): + self._add_rule("always", trigger="always_on", body="Always body.\n") + + self.assertEqual(0, self.installer.install(force=False)) + + adapter = self._rule_adapter("always") + self.assertFalse(adapter.is_symlink()) + wrapper = adapter.read_text(encoding="utf-8") + self.assertTrue(wrapper.startswith('---\napplyTo: "**"\n---\n')) + self.assertIn(GENERATED_MARKER, wrapper) + self.assertIn("Always body.", wrapper) + + def test_rule_adapters_drop_the_canonical_frontmatter(self): + self._add_rule("always", trigger="always_on") + self._add_rule("conditional", trigger="glob", globs="src/**/*.tq") + + self.assertEqual(0, self.installer.install(force=False)) + + for name in ("always", "conditional"): + with self.subTest(rule=name): + wrapper = self._rule_adapter(name).read_text(encoding="utf-8") + # Scope reaches Copilot through the generated `applyTo` header, so + # V8's own frontmatter is dropped rather than passed through. + self.assertNotIn("trigger:", wrapper) + self.assertNotIn("always_on", wrapper) + self.assertNotIn("globs:", wrapper) + self.assertNotIn(f"name: {name}", wrapper) + + def test_glob_rule_wrapper_carries_apply_to(self): + self._add_rule( + "conditional", + trigger="glob", + globs="src/**/*.tq", + body="Torque body.\n") + + self.assertEqual(0, self.installer.install(force=False)) + + adapter = self._rule_adapter("conditional") + self.assertFalse(adapter.is_symlink()) + wrapper = adapter.read_text(encoding="utf-8") + self.assertTrue(wrapper.startswith('---\napplyTo: "src/**/*.tq"\n---\n')) + self.assertIn(GENERATED_MARKER, wrapper) + self.assertIn("Torque body.", wrapper) + + def test_glob_rule_wrapper_refreshes_without_force(self): + rule_file = self._add_rule( + "conditional", trigger="glob", globs="src/**/*.tq", body="First.\n") + self.assertEqual(0, self.installer.install(force=False)) + self._write( + rule_file, "---\nname: conditional\ntrigger: glob\n" + "globs: src/**/*.tq\n---\n\nSecond.\n") + + self.assertEqual(0, self.installer.install(force=False)) + + wrapper = self._rule_adapter("conditional").read_text(encoding="utf-8") + self.assertIn("Second.", wrapper) + self.assertNotIn("First.", wrapper) + + def test_glob_written_in_the_trigger_field_is_used_as_apply_to(self): + self._add_rule("writing-skills", trigger="agents/**/*") + + self.assertEqual(0, self.installer.install(force=False)) + + self.assertIn( + 'applyTo: "agents/**/*"', + self._rule_adapter("writing-skills").read_text(encoding="utf-8")) + + def test_rules_without_a_copilot_trigger_are_listed_only(self): + self._add_rule( + "chooseable", trigger="model_decision", description="Use for CLs.") + self._add_rule("missing-trigger") + self._add_rule("unknown-trigger", trigger="unsupported") + self._add_rule("empty-glob", trigger="glob") + for rule_name in COPILOT_INCOMPATIBLE_RULES: + self._add_rule(Path(rule_name).stem, trigger="always_on") + + self.assertEqual(0, self.installer.install(force=False)) + + instructions = self.installer.copilot_instructions.read_text( + encoding="utf-8") + self.assertIn("## Optional rules", instructions) + self.assertIn("- `agents/rules/chooseable.md`: Use for CLs.", instructions) + for name in ("missing-trigger", "unknown-trigger", "empty-glob"): + self.assertIn(f"- `agents/rules/{name}.md`", instructions) + for name in ("chooseable", "missing-trigger", "unknown-trigger", + "empty-glob"): + self.assertFalse(self._rule_adapter(name).exists()) + for rule_name in COPILOT_INCOMPATIBLE_RULES: + self.assertNotIn(f"agents/rules/{rule_name}", instructions) + + def test_stale_rule_adapters_are_removed(self): + always = self._add_rule("stale-always", trigger="always_on") + conditional = self._add_rule( + "stale-glob", trigger="glob", globs="src/**/*.tq") + self.assertEqual(0, self.installer.install(force=False)) + for name in ("stale-always", "stale-glob"): + self.assertTrue(self._rule_adapter(name).is_file()) + + always.unlink() + conditional.unlink() + self.assertEqual(0, self.installer.install(force=False)) + + for name in ("stale-always", "stale-glob"): + self.assertFalse(self._rule_adapter(name).exists()) + + def test_force_preserves_user_managed_rule_adapters(self): + self._add_rule("always", trigger="always_on") + self._add_rule("conditional", trigger="glob", globs="src/**/*.tq") + for name in ("always", "conditional"): + self._write(self._rule_adapter(name), "User rule.\n") + + self.assertEqual(0, self.installer.install(force=True)) + + for name in ("always", "conditional"): + self.assertEqual("User rule.\n", + self._rule_adapter(name).read_text(encoding="utf-8")) + + def test_rejects_instructions_symlink_before_mutating_anything(self): + self._add_rule("always", trigger="always_on") + with tempfile.TemporaryDirectory() as external_temp_dir: + external = Path(external_temp_dir) / "external-instructions" + self._write(external / "keep.txt", "External tree sentinel.\n") + self.installer.github_dir.mkdir(parents=True) + self._symlink_or_skip(self.installer.github_instructions_dir, external) + try: + with mock.patch("sys.stderr", new_callable=io.StringIO) as stderr: + self.assertEqual(1, self.installer.install(force=True)) + + self.assertIn("is a symlink or reparse point", stderr.getvalue()) + self.assertFalse(self.installer.copilot_instructions.exists()) + self.assertEqual(["keep.txt"], [p.name for p in external.iterdir()]) + finally: + if self.installer.github_instructions_dir.is_symlink(): + self.installer.github_instructions_dir.unlink() + + def test_frontmatter_uses_yaml_and_preserves_original_block(self): + markdown_file = self.repo_root / "frontmatter.md" + frontmatter = ("---\n" + 'name: "name: with colon"\n' + "description: >-\n" + " Folded description.\n" + "---") + self._write(markdown_file, f"{frontmatter}\n\nBody.\n") + + metadata, block = self.installer._frontmatter(markdown_file) + + self.assertEqual("name: with colon", metadata["name"]) + self.assertEqual("Folded description.", metadata["description"]) + self.assertEqual(frontmatter, block) + + def test_force_refreshes_generated_wrapper(self): + skill_dir = self._add_skill("test-skill") + with self._without_symlink_support(): + self.assertEqual(0, self.installer.install(force=False)) + self._write( + skill_dir / "SKILL.md", + "---\nname: test-skill\ndescription: Updated description.\n---\n") + self.assertEqual(0, self.installer.install(force=True)) + + installed = self.installer.github_skills_dir / "test-skill" / "SKILL.md" + self.assertIn("description: Updated description.", + installed.read_text(encoding="utf-8")) + + def test_stale_generated_wrapper_is_removed(self): + stale_skill = self._add_skill("stale-skill") + with self._without_symlink_support(): + self.assertEqual(0, self.installer.install(force=False)) + installed = self.installer.github_skills_dir / "stale-skill" + self._write(installed / "user-notes.md", "Keep me.\n") + shutil.rmtree(stale_skill) + self.assertEqual(0, self.installer.install(force=False)) + + self.assertTrue(installed.is_dir()) + self.assertFalse((installed / "SKILL.md").exists()) + self.assertEqual("Keep me.\n", + (installed / "user-notes.md").read_text(encoding="utf-8")) + + def test_force_preserves_user_files_beside_generated_wrapper(self): + self._add_skill("test-skill") + with self._without_symlink_support(): + self.assertEqual(0, self.installer.install(force=False)) + installed = self.installer.github_skills_dir / "test-skill" + self._write(installed / "user-notes.md", "Keep me.\n") + self.assertEqual(0, self.installer.install(force=True)) + + self.assertTrue((installed / "SKILL.md").is_file()) + self.assertEqual("Keep me.\n", + (installed / "user-notes.md").read_text(encoding="utf-8")) + + def test_incompatible_skills_are_not_installed(self): + for skill_name in COPILOT_INCOMPATIBLE_SKILLS: + self._add_skill(skill_name) + + self.assertEqual(0, self.installer.install(force=False)) + + for skill_name in COPILOT_INCOMPATIBLE_SKILLS: + self.assertFalse((self.installer.github_skills_dir / skill_name).exists()) + + def test_incompatible_adapter_sources_exist_in_checkout(self): + for rule_name in COPILOT_INCOMPATIBLE_RULES: + with self.subTest(rule=rule_name): + self.assertTrue((REPO_ROOT / "agents" / "rules" / rule_name).is_file()) + for skill_name in COPILOT_INCOMPATIBLE_SKILLS: + with self.subTest(skill=skill_name): + self.assertTrue((REPO_ROOT / "agents" / "skills" / skill_name / + "SKILL.md").is_file()) + + def test_file_system_errors_propagate(self): + generated_file = self.installer.copilot_instructions + self._write(generated_file, GENERATED_MARKER) + with mock.patch.object( + Path, "read_text", side_effect=OSError("unreadable")): + with self.assertRaisesRegex(OSError, "unreadable"): + self.installer._write_generated_file(generated_file, "new contents") + + def test_force_preserves_user_managed_files(self): + self._add_skill("test-skill") + self._write(self.installer.copilot_instructions, "User instructions.\n") + installed = self.installer.github_skills_dir / "test-skill" + self._write(installed / "SKILL.md", "User skill.\n") + + self.assertEqual(0, self.installer.install(force=True)) + + self.assertEqual( + "User instructions.\n", + self.installer.copilot_instructions.read_text(encoding="utf-8")) + self.assertEqual("User skill.\n", + (installed / "SKILL.md").read_text(encoding="utf-8")) + + @unittest.skipUnless(os.name == "nt", "Directory junctions require Windows") + def test_rejects_github_junction_before_mutation(self): + self._add_skill("test-skill") + with tempfile.TemporaryDirectory() as external_temp_dir: + external_github = Path(external_temp_dir) / "external-github" + self._write(external_github / "copilot-instructions.md", + f"{GENERATED_MARKER}\n\nExternal instructions sentinel.\n") + self._write(external_github / "skills" / "stale-skill" / "SKILL.md", + f"{GENERATED_MARKER}\n\nExternal skill sentinel.\n") + self._write(external_github / "keep.txt", "External tree sentinel.\n") + original_files = self._file_snapshot(external_github) + + self._create_junction(self.installer.github_dir, external_github) + original_target = os.readlink(self.installer.github_dir) + try: + with mock.patch("sys.stderr", new_callable=io.StringIO) as stderr: + self.assertEqual(1, self.installer.install(force=True)) + + self.assertIn( + f"Unsafe adapter destination: {self.installer.github_dir}", + stderr.getvalue()) + self.assertEqual(original_target, + os.readlink(self.installer.github_dir)) + self.assertEqual(original_files, self._file_snapshot(external_github)) + self.assertFalse((external_github / "skills" / "test-skill").exists()) + finally: + self._remove_junction(self.installer.github_dir) + + @unittest.skipUnless(os.name == "nt", "Directory junctions require Windows") + def test_rejects_skills_junction_before_mutation(self): + self._add_skill("test-skill") + self._write(self.installer.copilot_instructions, + "User instructions sentinel.\n") + original_instructions = self.installer.copilot_instructions.read_bytes() + with tempfile.TemporaryDirectory() as external_temp_dir: + external_skills = Path(external_temp_dir) / "external-skills" + self._write(external_skills / "test-skill" / "SKILL.md", + f"{GENERATED_MARKER}\n\nExternal skill sentinel.\n") + self._write(external_skills / "keep.txt", "External tree sentinel.\n") + original_files = self._file_snapshot(external_skills) + + self._create_junction(self.installer.github_skills_dir, external_skills) + original_target = os.readlink(self.installer.github_skills_dir) + try: + with mock.patch("sys.stderr", new_callable=io.StringIO) as stderr: + self.assertEqual(1, self.installer.install(force=True)) + + self.assertIn( + f"Unsafe adapter destination: {self.installer.github_skills_dir}", + stderr.getvalue()) + self.assertEqual(original_instructions, + self.installer.copilot_instructions.read_bytes()) + self.assertEqual(original_target, + os.readlink(self.installer.github_skills_dir)) + self.assertEqual(original_files, self._file_snapshot(external_skills)) + finally: + self._remove_junction(self.installer.github_skills_dir) + + def test_rejects_github_symlink_before_mutation(self): + self._add_skill("test-skill") + with tempfile.TemporaryDirectory() as external_temp_dir: + external_github = Path(external_temp_dir) / "external-github" + self._write(external_github / "keep.txt", "External tree sentinel.\n") + self._symlink_or_skip(self.installer.github_dir, external_github) + try: + with mock.patch("sys.stderr", new_callable=io.StringIO) as stderr: + self.assertEqual(1, self.installer.install(force=True)) + + self.assertIn("is a symlink or reparse point", stderr.getvalue()) + self.assertTrue(self.installer.github_dir.is_symlink()) + self.assertEqual("External tree sentinel.\n", + (external_github / + "keep.txt").read_text(encoding="utf-8")) + self.assertFalse((external_github / "copilot-instructions.md").exists()) + self.assertFalse((external_github / "skills").exists()) + finally: + if self.installer.github_dir.is_symlink(): + self.installer.github_dir.unlink() + + def test_rejects_skills_symlink_before_mutation(self): + self._add_skill("test-skill") + self._write(self.installer.copilot_instructions, + "User instructions sentinel.\n") + original_instructions = self.installer.copilot_instructions.read_bytes() + with tempfile.TemporaryDirectory() as external_temp_dir: + external_skills = Path(external_temp_dir) / "external-skills" + self._write(external_skills / "keep.txt", "External tree sentinel.\n") + self._symlink_or_skip(self.installer.github_skills_dir, external_skills) + try: + with mock.patch("sys.stderr", new_callable=io.StringIO) as stderr: + self.assertEqual(1, self.installer.install(force=True)) + + self.assertIn("is a symlink or reparse point", stderr.getvalue()) + self.assertEqual(original_instructions, + self.installer.copilot_instructions.read_bytes()) + self.assertTrue(self.installer.github_skills_dir.is_symlink()) + self.assertEqual("External tree sentinel.\n", + (external_skills / + "keep.txt").read_text(encoding="utf-8")) + self.assertFalse((external_skills / "test-skill").exists()) + finally: + if self.installer.github_skills_dir.is_symlink(): + self.installer.github_skills_dir.unlink() + + def test_force_does_not_follow_user_managed_symlink(self): + skill_dir = self._add_skill("test-skill") + external_skill = self.repo_root / "external-skill" + self._write(external_skill / "SKILL.md", + f"{GENERATED_MARKER}\n\nUser-managed target.\n") + installed = self.installer.github_skills_dir / "test-skill" + installed.parent.mkdir(parents=True) + self._symlink_or_skip(installed, external_skill) + + self.assertEqual(0, self.installer.install(force=True)) + + self.assertTrue(installed.is_symlink()) + self.assertEqual(f"{GENERATED_MARKER}\n\nUser-managed target.\n", + (external_skill / "SKILL.md").read_text(encoding="utf-8")) + self.assertNotEqual( + installed.resolve(strict=False), skill_dir.resolve(strict=False)) + + @unittest.skipUnless(os.name == "nt", "Directory junctions require Windows") + def test_force_does_not_follow_user_managed_junction(self): + self._add_skill("test-skill") + external_skill = self.repo_root / "junction-target" + target_contents = ( + f"{GENERATED_MARKER}\r\n\r\nUser-managed junction target.\r\n") + self._write(external_skill / "SKILL.md", target_contents) + installed = self.installer.github_skills_dir / "test-skill" + installed.parent.mkdir(parents=True) + self._create_junction(installed, external_skill) + + original_contents = (external_skill / "SKILL.md").read_bytes() + try: + self.assertEqual(0, self.installer.install(force=True)) + + self.assertEqual(original_contents, + (external_skill / "SKILL.md").read_bytes()) + self.assertTrue(self._is_junction(installed)) + finally: + self._remove_junction(installed) + + @unittest.skipUnless(os.name == "nt", "Directory junctions require Windows") + def test_force_preserves_dangling_user_managed_junction(self): + self._add_skill("test-skill") + installed = self.installer.github_skills_dir / "test-skill" + installed.parent.mkdir(parents=True) + + with tempfile.TemporaryDirectory() as external_temp_dir: + external_skill = Path(external_temp_dir) / "junction-target" + moved_skill = Path(external_temp_dir) / "moved-target" + target_contents = ( + f"{GENERATED_MARKER}\r\n\r\nUser-managed junction target.\r\n") + self._write(external_skill / "SKILL.md", target_contents) + self._create_junction(installed, external_skill) + + original_target = os.readlink(installed) + original_contents = (external_skill / "SKILL.md").read_bytes() + try: + external_skill.rename(moved_skill) + self.assertFalse(external_skill.exists()) + self.assertFalse(installed.exists()) + + self.assertEqual(0, self.installer.install(force=True)) + + self.assertEqual(original_target, os.readlink(installed)) + self.assertEqual(original_contents, + (moved_skill / "SKILL.md").read_bytes()) + self.assertTrue(self._is_junction(installed)) + finally: + self._remove_junction(installed) + + def test_non_utf8_user_files_are_skipped(self): + self._add_skill("test-skill") + installed = self.installer.github_skills_dir / "test-skill" + installed.mkdir(parents=True) + self.installer.copilot_instructions.write_bytes(b"\xe9 user notes\n") + (installed / "SKILL.md").write_bytes(b"\xe9 user skill\n") + + with self._without_symlink_support(): + self.assertEqual(0, self.installer.install(force=True)) + + self.assertEqual(b"\xe9 user notes\n", + self.installer.copilot_instructions.read_bytes()) + self.assertEqual(b"\xe9 user skill\n", + (installed / "SKILL.md").read_bytes()) + + def test_generated_file_symlink_is_not_followed(self): + external = self.repo_root / "shared-instructions.md" + self._write(external, f"{GENERATED_MARKER}\n\nShared checkout content.\n") + self.installer.github_dir.mkdir(parents=True) + self._symlink_or_skip( + self.installer.copilot_instructions, external, is_directory=False) + original = external.read_bytes() + + self.assertEqual(0, self.installer.install(force=True)) + + self.assertEqual(original, external.read_bytes()) + self.assertTrue(self.installer.copilot_instructions.is_symlink()) + + def test_without_force_existing_adapters_are_left_alone(self): + skill_dir = self._add_skill("test-skill") + with self._without_symlink_support(): + self.assertEqual(0, self.installer.install(force=False)) + installed = self.installer.github_skills_dir / "test-skill" / "SKILL.md" + original = installed.read_bytes() + + self._write(skill_dir / "SKILL.md", + "---\nname: test-skill\ndescription: Updated.\n---\n") + self.assertEqual(0, self.installer.install(force=False)) + + self.assertEqual(original, installed.read_bytes()) + + def test_stale_removal_preserves_user_managed_adapters(self): + self._add_skill("test-skill") + user_rule = self.installer.github_instructions_dir / "mine.instructions.md" + user_skill = self.installer.github_skills_dir / "mine" / "SKILL.md" + self._write(user_rule, "User rule.\n") + self._write(user_skill, "User skill.\n") + + self.assertEqual(0, self.installer.install(force=False)) + + self.assertEqual("User rule.\n", user_rule.read_text(encoding="utf-8")) + self.assertEqual("User skill.\n", user_skill.read_text(encoding="utf-8")) + + def test_missing_skills_directory_fails(self): + missing_root = self.repo_root / "missing" + self.assertEqual(1, CopilotInstaller(missing_root).install(force=False)) + + +if __name__ == "__main__": + unittest.main() diff --git a/deps/v8/agents/skills/ecmascript-evaluation/SKILL.md b/deps/v8/agents/skills/ecmascript-evaluation/SKILL.md index 1845f2da7382..020e5c210627 100644 --- a/deps/v8/agents/skills/ecmascript-evaluation/SKILL.md +++ b/deps/v8/agents/skills/ecmascript-evaluation/SKILL.md @@ -88,30 +88,45 @@ your answers: ### I. Navigation & Grammar Extraction -- `ecma262_get_operation(name)`: **[RECOMMENDED]** Use this to directly fetch - the algorithm for an abstract operation by name (e.g., `ToObject`, `GetValue`, - `CreateMutableBinding`). **Try this FIRST** whenever you know the name of the - operation you need, as it bypasses search-then-fetch and saves steps. -- `ecma262_get_evaluation(production_name)`: **[RECOMMENDED]** Use this to - directly fetch the evaluation rules for a specific grammar production (e.g., - `VariableStatement`). This saves steps and is much faster than searching. -- `ecma262_search(query)`: Use this to locate the exact section ID for a syntax - node (e.g., `VariableStatement`) or when you don't know the exact name of the - operation. -- `ecma262_signature(name)` / `ecma262_dependencies(id)`: Use these to map out - the call graph before writing out an evaluation. This ensures you know which - operations you will need to invoke. -- `ecma262_section(id)`: Fetch the actual algorithm steps. Treat these steps as - law. -- `ecma262_lookup(id)`: Resolves the ancestry (parent chain) of a given section - ID, helping to understand its context in the specification hierarchy. -- `ecma262_sections(ids)`: Fetch full HTML content for multiple section IDs at - once to reduce tool calls. -- `ecma262_production(symbol)`: Use this to fetch Syntactic or Lexical grammar - rules (e.g., `StringNumericLiteral` or `AssignmentExpression`) to explain - parsing edge cases. - -### II. State Alteration (JSON Scratchpad) +- `ecma262_get_operation(name, proposal=None)`: **[RECOMMENDED]** Use this to + directly fetch the algorithm for an abstract operation by name (e.g., + `ToObject`, `GetValue`, `CreateMutableBinding`, `PrivateFieldAdd`). Steps that + can invoke JavaScript user code (getters, setters, Proxy traps, + `Symbol.toPrimitive`, etc.) are annotated with `⚡`. +- `ecma262_get_evaluation(production_name, proposal=None)`: **[RECOMMENDED]** + Use this to directly fetch the evaluation rules for a specific grammar + production (e.g., `VariableStatement`). This saves steps and is much faster + than searching. +- `ecma262_callers(name, proposal=None)`: Find all algorithm steps across the + specification (or active TC39 proposal) that call or reference a given + operation (e.g., `IsExtensible`, `HostEnsureCanAddPrivateElement`). +- `ecma262_search(query, proposal=None)`: Use this to locate the exact section + ID for a syntax node (e.g., `VariableStatement`) or when you don't know the + exact name of the operation. +- `ecma262_signature(name, proposal=None)`: Fetch the formal type signature of + an abstract operation. +- `ecma262_section(id, proposal=None)`: Fetch the rendered Markdown content of a + specific section ID. +- `ecma262_sections(ids, proposal=None)`: Fetch content for multiple section IDs + at once. +- `ecma262_lookup(id, proposal=None)`: Resolves the ancestry (parent chain) of a + given section ID, helping to understand its context in the specification + hierarchy. + +### II. TC39 Proposal Research & Diffing + +- `ecma262_load_proposal(name)`: Fetch and index an official TC39 proposal + (e.g., `defer-import-eval`, `explicit-resource-management`, `temporal`, + `decorators`, `shadowrealm`) and set it as the active context. +- `ecma262_list_proposals()`: List all loaded proposals and see which + specification context is currently active. +- `ecma262_use_proposal(name)`: Switch the active specification context between + Base ECMA-262 (`"base"`) and any loaded proposal. +- `ecma262_diff(name, proposal=None)`: Compare an abstract operation or clause + between Base ECMA-262 and a TC39 proposal, displaying `` additions and + `` deletions side-by-side. + +### III. State Alteration (JSON Scratchpad) You **MUST** use the following tools to maintain the abstract machine state. Call `init()` at the start of evaluation. The tool will automatically generate a diff --git a/deps/v8/bazel/defs.bzl b/deps/v8/bazel/defs.bzl index 1b1234b02db1..68f283bcfc3c 100644 --- a/deps/v8/bazel/defs.bzl +++ b/deps/v8/bazel/defs.bzl @@ -8,6 +8,7 @@ This module contains helper functions to compile V8. load("@rules_cc//cc:cc_library.bzl", "cc_library") load("@rules_cc//cc:cc_binary.bzl", "cc_binary") +load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain", "use_cc_toolchain") load("@rules_cc//cc/common:cc_common.bzl", "cc_common") load("@rules_cc//cc/common:cc_info.bzl", "CcInfo") @@ -140,6 +141,7 @@ def _default_args(): "-Wno-invalid-offsetof", "-Wno-deprecated-this-capture", "-Wno-deprecated-declarations", + "-Wno-deprecated-attributes", "-std=c++20", ], "@v8//bazel/config:is_gcc": [ @@ -590,7 +592,6 @@ def build_config_content(cpu, icu): ("local_off_stack_check", "false"), ("lower_limits_mode", "false"), ("memory_corruption_api", "false"), - ("cppgc_microtask_queue", "false"), ("mips_arch_variant", '""'), ("mips_use_msa", "false"), ("msan", "false"), @@ -621,6 +622,296 @@ def build_config_content(cpu, icu): ("write_barriers", "false"), ]) +# ============================================================================= +# Metagen: libclang-driven instance-type generator. +# +# Produces gen/metagen/instance-types.h, the file `src/objects/instance-types- +# gen.h` includes when V8_USE_METAGEN_INSTANCE_TYPES=1, i.e. under +# --//:v8_use_metagen_instance_types. +# +# The generator runs tools/metagen/metagen.py, which uses libclang to parse +# V8_OBJECT-annotated C++ headers and emits the IT enum macros. We feed it +# a compile_commands.json synthesized from cc_common: the defines / includes +# come from the cc_libraries passed via `cc_compilation_context_from`, the +# toolchain bits (libc++ -isystem, sysroot, target triple, ...) come from +# the active cc toolchain, and metagen-specific cflags (-std=c++20, +# -fno-rtti, -fno-exceptions, -fsyntax-only) come from a small list below. +# ============================================================================= + +# Metagen-specific cflags that don't propagate via CcInfo (they're copts on +# v8_library, not on the `:define_flags` we depend on). Kept tiny on +# purpose -- everything else comes from the toolchain or CcInfo. +_METAGEN_USER_COPTS = [ + "-std=c++20", + "-fno-rtti", + "-fno-exceptions", +] + +def _metagen_instance_types_impl(ctx): + v8root = ctx.label.workspace_root + if v8root == "": + v8root = "." + + out_h = ctx.actions.declare_file( + ctx.attr.prefix + "/metagen/instance-types.h", + ) + out_dir = out_h.dirname + + # Merge CcInfo from all cc_compilation_context_from targets -- this is + # where V8's defines (`:define_flags`), the libc++ system include path + # (`@libcxx//:libc++`), and the V8 source-root include come from. + cc_infos = [d[CcInfo] for d in ctx.attr.cc_compilation_context_from] + merged_cc_info = cc_common.merge_cc_infos(cc_infos = cc_infos) + cc_context = merged_cc_info.compilation_context + + cc_toolchain = find_cc_toolchain(ctx) + feature_configuration = cc_common.configure_features( + ctx = ctx, + cc_toolchain = cc_toolchain, + requested_features = ctx.features, + unsupported_features = ctx.disabled_features + ["module_maps"], + ) + + # -I dirs for the generated headers (torque, bytecode_builtins). + # None of these live in a cc_library CcInfo so they're added directly. + extra_quote_includes = [ + ctx.bin_dir.path + "/" + v8root, + ctx.bin_dir.path + "/" + v8root + "/" + ctx.attr.prefix, + # V8 source root: needed because `is_posix` copts include + # `-isystem .` and that's a copt, not propagated via CcInfo. + ".", + ] + + compile_variables = cc_common.create_compile_variables( + feature_configuration = feature_configuration, + cc_toolchain = cc_toolchain, + source_file = "tools/metagen/probe.cc", + user_compile_flags = _METAGEN_USER_COPTS, + include_directories = cc_context.includes, + quote_include_directories = depset( + extra_quote_includes, + transitive = [cc_context.quote_includes], + ), + system_include_directories = cc_context.system_includes, + framework_include_directories = cc_context.framework_includes, + preprocessor_defines = depset( + ctx.attr.extra_defines, + transitive = [ + cc_context.defines, + cc_context.local_defines, + ], + ), + ) + + cc_cmd_line = cc_common.get_memory_inefficient_command_line( + feature_configuration = feature_configuration, + action_name = "c++-compile", + variables = compile_variables, + ) + cc_binary = cc_common.get_tool_for_action( + feature_configuration = feature_configuration, + action_name = "c++-compile", + ) + + # Synthesize a one-entry compile_commands.json for metagen. (The GN + # side instead harvests flags via `gn desc`; this is the Bazel path.) + # The `directory` is the action's cwd (execroot); the bogus + # `probe.cc` file + `-c`/`-o` args are filtered out by metagen. + compile_db = ctx.actions.declare_file( + ctx.attr.prefix + "/metagen-compile-commands.json", + ) + ctx.actions.write( + output = compile_db, + content = json.encode([{ + "directory": ".", + "file": "tools/metagen/probe.cc", + "arguments": [cc_binary] + cc_cmd_line, + }]), + ) + + args = ctx.actions.args() + args.add("--v8-root", v8root) + args.add("--compile-commands", compile_db.path) + args.add("--driver", ctx.file.driver.path) + args.add("--out", out_dir) + + # Where libclang comes from. Both modes are explicit, so a mismatch + # is an analysis-time error rather than a harvest that quietly parses + # with the wrong library. + if ctx.attr.libclang_from_python_env: + if ctx.files.libclang_files: + fail("libclang_from_python_env = True, but libclang_files is " + + "non-empty. In this mode the bindings come from the tool's " + + "Python deps; drop libclang_files or unset the flag.") + args.add("--libclang-from-python-env") + else: + if not ctx.files.libclang_files: + fail("libclang_files is empty. Pass the llvm-libclang package " + + "files, or set libclang_from_python_env = True to take the " + + "bindings from the tool's Python deps instead.") + + # The llvm-libclang package root, as an execroot-relative path: + # metagen resolves it against the action's cwd. The files get + # there as action inputs (:metagen_libclang_files below), which + # is why the tool needs no runfiles copy of them. This mirrors + # what the GN action passes for //third_party/llvm-libclang. + args.add("--libclang-dir", v8root + "/third_party/llvm-libclang") + + # Clang's builtin headers. Find the directory via stddef.h rather + # than files[0].dirname: the staged set contains subdirectories + # (sanitizer/, cuda_wrappers/, ...), so element 0 sits at the include + # root only by luck of ordering, and a dir one level too deep fails + # as a wall of parse errors rather than a build error. + builtin_headers_dir = None + for f in ctx.files.clang_builtin_headers: + if f.basename == "stddef.h": + builtin_headers_dir = f.dirname + break + if builtin_headers_dir == None: + fail("clang_builtin_headers contains no stddef.h, so the clang " + + "builtin-header directory cannot be located. Pass the target " + + "that stages clang's builtin headers (lib/Headers).") + args.add("--clang-builtin-headers-dir", builtin_headers_dir) + + all_inputs = depset( + direct = [compile_db, ctx.file.driver], + transitive = [ + depset(ctx.files.libclang_files), + depset(ctx.files.clang_builtin_headers), + depset(ctx.files.python_srcs), + depset(ctx.files.extra_sandbox_files), + cc_context.headers, + cc_toolchain.all_files, + ], + ) + + ctx.actions.run( + outputs = [out_h], + inputs = all_inputs, + executable = ctx.executable.tool, + arguments = [args], + mnemonic = "MetagenInstanceTypes", + progress_message = "Generating metagen/instance-types.h", + ) + + return [DefaultInfo(files = depset([out_h]))] + +# The harvest is a host tool that must reason about the target build, so +# this rule's inputs fall into two groups -- the same split GN gets from +# v8_generator_toolchain (see gni/snapshot_toolchain.gni), where the +# generator is a host binary compiled with the target's V8 configuration: +# +# exec-configured the parsing machinery: the tool, libclang, and +# clang's builtin headers. These are host-only +# artifacts; a build that constrains targets by +# platform will reject them for a non-host target +# unless they are exec-configured. +# +# target-configured what we parse and how: `headers`, +# `cc_compilation_context_from`, `extra_defines`, and +# `extra_sandbox_files` (V8's own source headers). +# These must reflect the TARGET build -- exec- +# configuring them would harvest the host's defines, +# which today changes nothing but would silently emit +# host object layout once metagen generates layout. +_metagen_instance_types = rule( + implementation = _metagen_instance_types_impl, + attrs = { + "prefix": attr.string(mandatory = True), + # The checked-in C++ driver, passed straight through as --driver. Its + # direct includes are staged by extra_sandbox_files, not by this attr. + "driver": attr.label(allow_single_file = True, mandatory = True), + "libclang_files": attr.label_list(allow_files = True, cfg = "exec"), + # Clang's builtin headers (stddef.h etc.), staged into the action + # sandbox and passed to metagen as -isystem. Separate from + # extra_sandbox_files because this is host toolchain material: + # it needs cfg = "exec", whereas V8's own headers must not have it. + "clang_builtin_headers": attr.label_list( + allow_files = True, + cfg = "exec", + mandatory = True, + ), + # Selects where libclang comes from; see the impl. Explicit rather + # than inferred from libclang_files being empty, so no call site + # can end up in environment mode by forgetting an argument. + "libclang_from_python_env": attr.bool(default = False), + "python_srcs": attr.label_list(allow_files = True, cfg = "exec"), + # Additional files that need to live in the action sandbox so + # libclang's transitive #include resolution succeeds, but that + # should NOT be directly included by the driver. + # Bazel hermetic sandboxing makes this necessary: header files + # only reach the sandbox via declared inputs, and the CcInfo of + # :v8_libbase / :define_flags doesn't reach into src/objects, + # src/handles, src/wasm etc. v8_libshared (which would) depends + # on this rule's output, so a CcInfo-based propagation cycles. + # V8's own headers, so target-configured; host-toolchain material + # goes in clang_builtin_headers instead. + "extra_sandbox_files": attr.label_list(allow_files = True), + # cc_library / v8_library / v8_config labels whose CcInfo merged + # compilation_context supplies the defines, includes, and libc++ + # paths that V8 normally compiles with. + "cc_compilation_context_from": attr.label_list( + providers = [CcInfo], + mandatory = True, + ), + # Additional -D defines for the harvest that do not propagate + # via CcInfo (v8_library applies them as per-variant copts, + # e.g. V8_INTL_SUPPORT on the icu prefix). + "extra_defines": attr.string_list(), + "tool": attr.label( + executable = True, + cfg = "exec", + mandatory = True, + ), + }, + fragments = ["cpp"], + # use_cc_toolchain() rather than a literal @bazel_tools label: the + # helper resolves to whichever cc toolchain type the surrounding + # build defines, and find_cc_toolchain() reads it back out of + # ctx.toolchains. Spelling the label directly makes the rule + # unusable in builds that do not have a @bazel_tools repository. + toolchains = use_cc_toolchain(), +) + +def metagen_instance_types(name, driver, + python_srcs, tool, + cc_compilation_context_from, + clang_builtin_headers, + libclang_files = [], + libclang_from_python_env = False, + extra_sandbox_files = [], + icu_extra_defines = [], + icu_cc_compilation_context_from = []): + """Emit gen/metagen/instance-types.h for both icu/ and noicu/ prefixes. + + Mirrors the v8_torque_files double-emission pattern so each consumer + library can include the correctly-prefixed copy. The two harvests + differ: v8_library compiles the icu variant with V8_INTL_SUPPORT + (via copts, invisible to CcInfo) and the intl object sources, so + the icu emission additionally enables the driver's i18n includes with the + intl defines and ICU's compilation context. + + Pass either `libclang_files` (the bundled llvm-libclang package) or + `libclang_from_python_env = True` (bindings supplied through `tool`'s + Python deps) -- exactly one, enforced by the rule. + """ + for prefix in ("noicu", "icu"): + is_icu = prefix == "icu" + _metagen_instance_types( + name = prefix + "/" + name, + prefix = prefix, + driver = driver, + libclang_files = libclang_files, + libclang_from_python_env = libclang_from_python_env, + clang_builtin_headers = clang_builtin_headers, + python_srcs = python_srcs, + tool = tool, + cc_compilation_context_from = cc_compilation_context_from + + (icu_cc_compilation_context_from if is_icu else []), + extra_defines = icu_extra_defines if is_icu else [], + extra_sandbox_files = extra_sandbox_files, + ) + # TODO(victorgomes): Create a rule (instead of a macro), that can # dynamically populate the build config. def v8_build_config(name, arch): diff --git a/deps/v8/bazel/toolchain/libcxx_repository.bzl b/deps/v8/bazel/toolchain/libcxx_repository.bzl index 60aca4bf91d1..b60ea9be6151 100644 --- a/deps/v8/bazel/toolchain/libcxx_repository.bzl +++ b/deps/v8/bazel/toolchain/libcxx_repository.bzl @@ -28,11 +28,13 @@ load("@rules_cc//cc:defs.bzl", "cc_library") package(default_visibility = ["//visibility:public"]) LIBCXX_COPTS = [ - "-std=c++23", + "-std=c++26", "-fPIC", "-fstrict-aliasing", "-fexceptions", "-frtti", + "-Wno-pragma-clang-attribute", + "-Wno-ignored-attributes", "-D_LIBCPP_BUILDING_LIBRARY", "-D_LIBCPP_HARDENING_MODE_DEFAULT=_LIBCPP_HARDENING_MODE_NONE", "-DLIBC_NAMESPACE=__llvm_libc_cr", diff --git a/deps/v8/docs/runtime/tiering.md b/deps/v8/docs/runtime/tiering.md index 98fcb9af9ae4..21e1c8a34307 100644 --- a/deps/v8/docs/runtime/tiering.md +++ b/deps/v8/docs/runtime/tiering.md @@ -62,7 +62,7 @@ When the budget is exceeded, V8 calls into the C++ runtime. Each tier has its ow * **Ignition**: `Runtime::kBytecodeBudgetInterruptWithStackCheck_Ignition` and `Runtime::kBytecodeBudgetInterrupt_Ignition`. * **Sparkplug**: `Runtime::kBytecodeBudgetInterruptWithStackCheck_Sparkplug` and `Runtime::kBytecodeBudgetInterrupt_Sparkplug`. -* **Maglev**: `Runtime::kBytecodeBudgetInterruptWithStackCheck_Maglev` and `Runtime::kBytecodeBudgetInterrupt_Maglev`. +* **Maglev**: `Runtime::kBytecodeBudgetLoopInterrupt_Maglev` and `Runtime::kBytecodeBudgetInterrupt_Maglev`. The "WithStackCheck" variants are typically used at loop back-edges to handle both interrupts (e.g., GC requests, debugging pauses) and stack limit checks simultaneously. diff --git a/deps/v8/docs/security/triaging.md b/deps/v8/docs/security/triaging.md index 3a293aecae2b..86ead358de95 100644 --- a/deps/v8/docs/security/triaging.md +++ b/deps/v8/docs/security/triaging.md @@ -22,6 +22,8 @@ It is okay to just set to the current stable or extended stable milestone if unk - **Introduced In**: Should point to the milestone this was introduced. It is okay to be conservative if unknown, e.g., to assume that the bug was present when a feature was launched. +Triage is based on available information; initial classifications (such as type, severity, impact) may be revised as expert analysis or new evidence emerges. + ### Sandbox bypasses V8 Sandbox bypasses are included in Chrome’s VRP. @@ -117,6 +119,14 @@ Invalid ("bogus") `DCHECK`s should still be fixed or removed. Note: `CHECK`s must not be behind special builds or phases, such as `--verify-*`. +### Leaking _Hole_ values into JavaScript + +Fields: **Type=Bug**, **[Security_Impact-None][hl-impact-none]** + +Rationale: V8 uses internal sentinel _Hole_ values. +While leaking them historically enabled type confusion, _Hole_ sentinels are now immutable in read-only space, segregated by type (preventing cross-subsystem confusion), and have unmapped payloads (since M146) that deterministically crash on access. +Leaks are therefore triaged as functional bugs unless exploitability is demonstrated. + ### Breakage through directly invoking internal runtime functions with `%`-syntax Runtime functions like `%IterableForEach()` are directly visible to JavaScript programs via `--allow-natives-syntax`. diff --git a/deps/v8/gni/v8.gni b/deps/v8/gni/v8.gni index b54c2d74057c..aee7c82b4864 100644 --- a/deps/v8/gni/v8.gni +++ b/deps/v8/gni/v8.gni @@ -34,6 +34,12 @@ declare_args() { # Turns on compiler optimizations in V8 in Debug build. v8_optimized_debug = true + # Selects which instance-type generator's output V8 compiles in: + # metagen (tools/metagen/) or Torque's emission. When off, the metagen + # action is out of the build graph entirely, so nothing depends on the + # llvm-libclang package. Sets -DV8_USE_METAGEN_INSTANCE_TYPES=0 when off. + v8_use_metagen_instance_types = true + # Support for backtrace_symbols on linux. v8_enable_backtrace = "" @@ -42,6 +48,7 @@ declare_args() { v8_use_external_startup_data = "" # Includes profiles to optimize builtins. + # Sets -DV8_ENABLE_BUILTINS_OPTIMIZATION. v8_enable_builtins_optimization = "" # Turns on all V8 debug features. Enables running V8 in a pseudo debug mode @@ -62,10 +69,6 @@ declare_args() { # Furthermore, some architectures don't have Rust toolchains in Chromium v8_enable_temporal_support = !(defined(build_with_node) && build_with_node) - # by default, don't enable compiling Temporal with a system ICU4C - # (assume private headers are available) - v8_enable_temporal_systemicu = false - # Use static libraries instead of source_sets. v8_static_library = false @@ -87,7 +90,9 @@ declare_args() { v8_expose_symbols = false # Implement tracing using Perfetto (https://perfetto.dev). - v8_use_perfetto = false + # Chromium is configured to use the perfetto client library, v8 should also + # use perfetto for tracing. + v8_use_perfetto = build_with_chromium && !use_fuzzing_engine # Use Perfetto JSON Export. v8_use_perfetto_json_export = "" @@ -95,12 +100,6 @@ declare_args() { # Use Perfetto SDK headers. v8_use_perfetto_sdk = false - # Enable definition of v8::MicrotaskQueue as a cppgc object. - # TODO(https://crbug.com/515252150): remove this flag once the old - # v8::MicrotaskQueue::New() returning std::unique_ptr<> gets through - # the V8 API deprecation process. - v8_cppgc_microtask_queue = true - # Override global symbol level setting for v8. v8_symbol_level = symbol_level @@ -314,12 +313,6 @@ if (v8_use_perfetto_sdk) { v8_use_perfetto = true } -# Chromium is configured to use the perfetto client library, v8 should also -# use perfetto for tracing. -if (build_with_chromium && !use_fuzzing_engine) { - v8_use_perfetto = true -} - # Enable JSON export by default when using perfetto but not the SDK. if (v8_use_perfetto_json_export == "") { v8_use_perfetto_json_export = v8_use_perfetto && !v8_use_perfetto_sdk @@ -463,6 +456,7 @@ template("v8_source_set") { } else { link_target_type = "source_set" } + target(link_target_type, target_name) { forward_variables_from(invoker, "*", diff --git a/deps/v8/include/OWNERS b/deps/v8/include/OWNERS index c0e3a1f767be..c0b23e355e59 100644 --- a/deps/v8/include/OWNERS +++ b/deps/v8/include/OWNERS @@ -1,6 +1,7 @@ cbruni@chromium.org leszeks@chromium.org mlippautz@chromium.org +olivf@chromium.org verwaest@chromium.org yangguo@chromium.org diff --git a/deps/v8/include/cppgc/explicit-management.h b/deps/v8/include/cppgc/explicit-management.h index 0290328dccba..d7f1dcde6563 100644 --- a/deps/v8/include/cppgc/explicit-management.h +++ b/deps/v8/include/cppgc/explicit-management.h @@ -90,8 +90,11 @@ template bool Resize(T& object, AdditionalBytes additional_bytes) { static_assert(IsGarbageCollectedTypeV, "Object must be of type GarbageCollected."); - return internal::ExplicitManagementImpl::Resize( - &object, sizeof(T) + additional_bytes.value); + const size_t new_object_size = sizeof(T) + additional_bytes.value; + if (new_object_size < sizeof(T)) { + return false; + } + return internal::ExplicitManagementImpl::Resize(&object, new_object_size); } } // namespace subtle diff --git a/deps/v8/include/js_protocol.pdl b/deps/v8/include/js_protocol.pdl index bc86332d869b..99905a48ca7b 100644 --- a/deps/v8/include/js_protocol.pdl +++ b/deps/v8/include/js_protocol.pdl @@ -143,6 +143,12 @@ domain Debugger optional Location startLocation # Location in the source code where scope ends optional Location endLocation + # True if the scope does not declare any variables or have a runtime context. + # Only present if true. + # Empty scopes are retained in the scope chain because + # they can be targeted via `evaluateOnCallFrame` (using `scopeNumber`) or + # matched against scopes in source maps. + experimental optional boolean empty # Search match for resource. type SearchMatch extends object @@ -212,6 +218,8 @@ domain Debugger optional boolean throwOnSideEffect # Terminate execution after timing out (number of milliseconds). experimental optional Runtime.TimeDelta timeout + # Specifies the scope number to evaluate the expression in (default: 0, innermost scope). + experimental optional integer scopeNumber returns # Object wrapper for the evaluation result. Runtime.RemoteObject result @@ -485,14 +493,8 @@ domain Debugger # New return value. Runtime.CallArgument newValue - # Edits JavaScript source live. - # - # In general, functions that are currently on the stack can not be edited with - # a single exception: If the edited function is the top-most stack frame and - # that is the only activation of that function on the stack. In this case - # the live edit will be successful and a `Debugger.restartFrame` for the - # top-most function is automatically triggered. - command setScriptSource + # Live edit is no longer supported and this command always fails with a "no longer available" error. + deprecated command setScriptSource parameters # Id of the script to edit. Runtime.ScriptId scriptId @@ -1142,6 +1144,7 @@ domain Runtime dataview webassemblymemory wasmvalue + deferredmodule # blink's subtypes. trustedtype # Object class (constructor) name. Specified for `object` type values only. @@ -1205,6 +1208,7 @@ domain Runtime dataview webassemblymemory wasmvalue + deferredmodule # blink's subtypes. trustedtype # String representation of the object. @@ -1256,6 +1260,7 @@ domain Runtime dataview webassemblymemory wasmvalue + deferredmodule # blink's subtypes. trustedtype diff --git a/deps/v8/include/v8-container.h b/deps/v8/include/v8-container.h index 380999e5ee45..213e38d6204b 100644 --- a/deps/v8/include/v8-container.h +++ b/deps/v8/include/v8-container.h @@ -76,17 +76,8 @@ class V8_EXPORT Array : public Object { * This function will typically be faster than calling {Get()} repeatedly. * As a consequence of being optimized for low overhead, the provided * callback must adhere to the following restrictions: - * - It must not allocate any V8 objects and continue iterating; it may - * allocate (e.g. an error message/object) and then immediately terminate - * the iteration. * - It must not modify the array being iterated. - * - It must not call back into V8 (unless it can guarantee that such a - * call does not violate the above restrictions, which is difficult). - * - The {Local element} must not "escape", i.e. must not be assigned - * to any other {Local}. Creating a {Global} from it, or updating a - * v8::TypecheckWitness with it, is safe. - * These restrictions may be lifted in the future if use cases arise that - * justify a slower but more robust implementation. + * - It must not call back into V8 to execute JavaScript. * * Returns {Nothing} on exception; use a {TryCatch} to catch and handle this * exception. diff --git a/deps/v8/include/v8-context.h b/deps/v8/include/v8-context.h index a91bae448a03..02b6f5c855d3 100644 --- a/deps/v8/include/v8-context.h +++ b/deps/v8/include/v8-context.h @@ -9,6 +9,7 @@ #include +#include "cppgc/type-traits.h" // NOLINT(build/include_directory) #include "v8-data.h" // NOLINT(build/include_directory) #include "v8-local-handle.h" // NOLINT(build/include_directory) #include "v8-maybe.h" // NOLINT(build/include_directory) @@ -316,39 +317,22 @@ class V8_EXPORT Context : public Data { */ V8_INLINE void* GetAlignedPointerFromEmbedderData(Isolate* isolate, int index, EmbedderDataTypeTag tag); - V8_INLINE void* GetAlignedPointerFromEmbedderData(int index, - EmbedderDataTypeTag tag); - - V8_DEPRECATED( - "Use GetAlignedPointerFromEmbedderData with EmbedderDataTypeTag " - "parameter instead.") - V8_INLINE void* GetAlignedPointerFromEmbedderData(Isolate* isolate, - int index) { - return GetAlignedPointerFromEmbedderData(isolate, index, - kEmbedderDataTypeTagDefault); - } - - V8_DEPRECATED( - "Use GetAlignedPointerFromEmbedderData with EmbedderDataTypeTag " - "parameter instead.") - V8_INLINE void* GetAlignedPointerFromEmbedderData(int index) { - return GetAlignedPointerFromEmbedderData(index, - kEmbedderDataTypeTagDefault); - } + void* GetAlignedPointerFromEmbedderData(int index, + EmbedderDataTypeTag tag); + template + requires cppgc::IsGarbageCollectedTypeV + V8_INLINE T* GetAlignedPointerFromEmbedderData(Isolate* isolate, int index, + CppHeapPointerTag tag); void SetAlignedPointerInEmbedderData(int index, void* value, EmbedderDataTypeTag tag); - /** - * Sets a 2-byte-aligned native pointer in the embedder data with the given - * index, growing the data as needed. Note that index 0 currently has a - * special meaning for Chrome's debugger. - */ - V8_DEPRECATED( - "Use SetAlignedPointerInEmbedderData with EmbedderDataTypeTag parameter " - "instead.") - void SetAlignedPointerInEmbedderData(int index, void* value) { - SetAlignedPointerInEmbedderData(index, value, kEmbedderDataTypeTagDefault); + template + requires cppgc::IsGarbageCollectedTypeV + void SetAlignedPointerInEmbedderData(int index, T* value, + CppHeapPointerTag tag) { + SetAlignedPointerInEmbedderDataInternal(index, static_cast(value), + tag); } /** @@ -477,8 +461,9 @@ class V8_EXPORT Context : public Data { size_t index); Local SlowGetEmbedderData(int index); Local SlowGetEmbedderDataV2(int index); - void* SlowGetAlignedPointerFromEmbedderData(int index, - EmbedderDataTypeTag tag); + void* SlowGetAlignedPointerFromEmbedderData(int index, CppHeapPointerTag tag); + void SetAlignedPointerInEmbedderDataInternal(int index, void* value, + CppHeapPointerTag tag); }; // --- Implementation --- @@ -529,26 +514,15 @@ V8_INLINE Local Context::GetEmbedderDataV2(int index) { #endif } -void* Context::GetAlignedPointerFromEmbedderData(Isolate* isolate, int index, - EmbedderDataTypeTag tag) { -#if !defined(V8_ENABLE_CHECKS) - using A = internal::Address; - using I = internal::Internals; - A ctx = internal::ValueHelper::ValueAsAddress(this); - A embedder_data = - I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset); - int value_offset = I::kEmbedderDataArrayHeaderSize + - (I::kEmbedderDataSlotSize * index) + - I::kEmbedderDataSlotExternalPointerOffset; - return reinterpret_cast(I::ReadExternalPointerField( - isolate, embedder_data, value_offset, ToExternalPointerTag(tag))); -#else - return SlowGetAlignedPointerFromEmbedderData(index, tag); -#endif +V8_INLINE void* Context::GetAlignedPointerFromEmbedderData( + Isolate* isolate, int index, EmbedderDataTypeTag tag) { + return GetAlignedPointerFromEmbedderData(index, tag); } -void* Context::GetAlignedPointerFromEmbedderData(int index, - EmbedderDataTypeTag tag) { +template + requires cppgc::IsGarbageCollectedTypeV +T* Context::GetAlignedPointerFromEmbedderData(Isolate* isolate, int index, + CppHeapPointerTag tag) { #if !defined(V8_ENABLE_CHECKS) using A = internal::Address; using I = internal::Internals; @@ -557,12 +531,11 @@ void* Context::GetAlignedPointerFromEmbedderData(int index, I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset); int value_offset = I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index) + - I::kEmbedderDataSlotExternalPointerOffset; - Isolate* isolate = I::GetCurrentIsolateForSandbox(); - return reinterpret_cast(I::ReadExternalPointerField( - isolate, embedder_data, value_offset, ToExternalPointerTag(tag))); + I::kEmbedderDataSlotCppHeapPointerOffset; + return internal::ReadCppHeapPointerField( + isolate, embedder_data, value_offset, CppHeapPointerTagRange(tag, tag)); #else - return SlowGetAlignedPointerFromEmbedderData(index, tag); + return static_cast(SlowGetAlignedPointerFromEmbedderData(index, tag)); #endif } diff --git a/deps/v8/include/v8-cppgc.h b/deps/v8/include/v8-cppgc.h index 9dc6ee5e617f..2bb82aa6f2cd 100644 --- a/deps/v8/include/v8-cppgc.h +++ b/deps/v8/include/v8-cppgc.h @@ -86,15 +86,6 @@ class V8_EXPORT CppHeap { */ cppgc::HeapHandle& GetHeapHandle(); - /** - * Terminate clears all roots and performs multiple garbage collections to - * reclaim potentially newly created objects in destructors. - * - * After this call, object allocation is prohibited. - */ - V8_DEPRECATED("Terminate gets automatically called in the CppHeap destructor") - void Terminate(); - /** * \param detail_level specifies whether should return detailed * statistics or only brief summary statistics. @@ -136,6 +127,28 @@ class V8_EXPORT CppHeap { void CollectGarbageInYoungGenerationForTesting( cppgc::EmbedderStackState stack_state); + /** + * Controls whether forced garbage collections sweep atomically. + * + * A forced garbage collection (including + * `Isolate::RequestGarbageCollectionForTesting()`) normally sweeps + * atomically, so finalizers have already run by the time the collection + * returns. When this is enabled, forced collections instead sweep according + * to the heap's sweeping support, leaving finalization deferred as it would + * be in a natural garbage collection. This lets a test observe an object in + * the window between being discovered unreachable and being finalized. + * + * Note that sweeping may then be concurrent; pass `--single-threaded-gc` for + * sweeping that only makes progress on the main thread, and use + * `FinishSweepingForTesting()` to close the window deterministically. + */ + void SetForceIncrementalSweepingForTesting(bool value); + + /** + * Finishes any in-progress sweeping, running the finalizers it discovers. + */ + void FinishSweepingForTesting(); + private: CppHeap() = default; diff --git a/deps/v8/include/v8-exception.h b/deps/v8/include/v8-exception.h index f240d9a609e9..74f57311a525 100644 --- a/deps/v8/include/v8-exception.h +++ b/deps/v8/include/v8-exception.h @@ -276,6 +276,14 @@ class V8_EXPORT TryCatch { void ResetInternal(); + /** + * Set whether or not this TryCatch is internal. + * Internal TryCatch blocks are not treated as external handlers for the + * purposes of the debugger. + */ + void SetIsInternal(bool value); + bool IsInternal() const; + // Helper methods for internal::Isolate. bool capture_message() const; void set_can_continue(bool value); diff --git a/deps/v8/include/v8-function-callback.h b/deps/v8/include/v8-function-callback.h index aeac5e557bd7..e0708430f615 100644 --- a/deps/v8/include/v8-function-callback.h +++ b/deps/v8/include/v8-function-callback.h @@ -243,9 +243,6 @@ class PropertyCallbackInfo { * would return the global proxy. */ V8_INLINE Local Holder() const; - // TODO(http://crbug.com/333672197): deprecate and remove. - V8_DEPRECATED("Use Holder().") - V8_INLINE Local HolderV2() const; /** * \return The return value of the callback. @@ -688,10 +685,6 @@ template Local PropertyCallbackInfo::Holder() const { return Local::FromSlot(&args_[kHolderIndex]); } -template -Local PropertyCallbackInfo::HolderV2() const { - return Holder(); -} template ReturnValue PropertyCallbackInfo::GetReturnValue() const { diff --git a/deps/v8/include/v8-internal.h b/deps/v8/include/v8-internal.h index 4ce3e6e30555..43b598c4a0c2 100644 --- a/deps/v8/include/v8-internal.h +++ b/deps/v8/include/v8-internal.h @@ -467,14 +467,11 @@ constexpr size_t kMaxCppHeapPointers = 0; // // As an example, consider the following type hierarchy: // -// A -// +-- B -// | +-- C -// | +-- D -//. | -// +-- E -// -// F +// A F +// / \ +// B E +// / \ +// C D // // A potential type id assignment for range-based type checks is // {A: 0, B: 1, C: 2, D: 3, E: 4, F: 5}. With that, the type check for type A @@ -526,11 +523,7 @@ struct TagRange { constexpr TagRange(Tag first, Tag last) : first(first), last(last) { #ifdef V8_ENABLE_CHECKS // This would typically be a DCHECK, but that's not available here. -#if V8_HAS_BUILTIN_UNREACHABLE if (first > last) __builtin_unreachable(); // Invalid tag range. -#elif defined(_MSC_VER) - if (first > last) __assume(0); // Invalid tag range. -#endif #endif } @@ -582,37 +575,42 @@ struct TagRange { Tag last; }; +enum class ManagedTypeId : uint32_t { + kBackingStore, + kTestDeleteCounter, + kTestDeleteNative, + kWasmStreaming, + kWasmFuncData, + kWasmManagedData, + kWasmNativeModule, + kIcuBreakIterator, + kIcuBreakIteratorWithText, + kIcuLocale, + kIcuSimpleDateFormat, + kIcuDateIntervalFormat, + kIcuRelativeDateTimeFormatter, + kIcuListFormatter, + kIcuCollator, + kIcuPluralRules, + kIcuLocalizedNumberFormatter, + kTemporalDuration, + kTemporalInstant, + kTemporalPlainDate, + kTemporalPlainTime, + kTemporalPlainDateTime, + kTemporalPlainYearMonth, + kTemporalPlainMonthDay, + kTemporalZonedDateTime, + kDisplayNamesInternal, + kD8Worker, + kD8ModuleEmbedderData, + kD8AsyncHooksWrap, +}; + #define SHARED_MANAGED_TAG_LIST(V) V(WasmFutexManagedObjectWaitListTag) -#define MANAGED_TAG_LIST(V) \ - SHARED_MANAGED_TAG_LIST(V) \ - V(GenericManagedTag) \ - V(WasmWasmStreamingTag) \ - V(WasmFuncDataTag) \ - V(WasmManagedDataTag) \ - V(WasmNativeModuleTag) \ - V(BackingStoreTag) \ - V(IcuBreakIteratorTag) \ - V(IcuListFormatterTag) \ - V(IcuLocaleTag) \ - V(IcuSimpleDateFormatTag) \ - V(IcuDateIntervalFormatTag) \ - V(IcuRelativeDateTimeFormatterTag) \ - V(IcuLocalizedNumberFormatterTag) \ - V(IcuPluralRulesTag) \ - V(IcuCollatorTag) \ - V(IcuBreakIteratorWithTextTag) \ - V(TemporalDurationTag) \ - V(TemporalInstantTag) \ - V(TemporalPlainDateTag) \ - V(TemporalPlainTimeTag) \ - V(TemporalPlainDateTimeTag) \ - V(TemporalPlainYearMonthTag) \ - V(TemporalPlainMonthDayTag) \ - V(TemporalZonedDateTimeTag) \ - V(DisplayNamesInternalTag) \ - V(D8WorkerTag) \ - V(D8ModuleEmbedderDataTag) +#define MANAGED_TAG_LIST(V) \ + SHARED_MANAGED_TAG_LIST(V) #define FOREIGN_TAG_LIST(V) \ V(GenericForeignTag) \ @@ -1005,12 +1003,8 @@ class Internals { #endif // !V8_COMPRESS_POINTERS static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize; static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize; - static const int kEmbedderDataSlotSize = kApiSystemPointerSize; -#ifdef V8_ENABLE_SANDBOX - static const int kEmbedderDataSlotExternalPointerOffset = kApiTaggedSize; -#else - static const int kEmbedderDataSlotExternalPointerOffset = 0; -#endif + static const int kEmbedderDataSlotSize = 2 * kApiTaggedSize; + static const int kEmbedderDataSlotCppHeapPointerOffset = kApiTaggedSize; static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize; static const int kStringRepresentationAndEncodingMask = 0x0f; static const int kStringEncodingMask = 0x8; @@ -1038,10 +1032,7 @@ class Internals { // ExternalPointerTable, CppHeapPointerTable and TrustedPointerTable layout // guarantees. static const int kExternalEntityTableBasePointerOffset = 0; - static const int kSegmentedTableSegmentPoolSize = 4; - static const int kExternalEntityTableSize = - 4 * kApiSystemPointerSize + - kSegmentedTableSegmentPoolSize * sizeof(uint32_t); + static const int kExternalEntityTableSize = 4 * kApiSystemPointerSize; // IsolateData layout guarantees. static const int kIsolateCageBaseOffset = 0; diff --git a/deps/v8/include/v8-isolate.h b/deps/v8/include/v8-isolate.h index f8395c96f14b..50c87b78de5e 100644 --- a/deps/v8/include/v8-isolate.h +++ b/deps/v8/include/v8-isolate.h @@ -665,6 +665,10 @@ class V8_EXPORT Isolate { kOBSOLETE_WasmResizableBuffers = 183, kInvalidatedArrayBufferMutableProtector = 184, kHoleyArrayReadthrough = 185, + kWasmGCAllocation = 186, + kModuleNamespaceMissingDefaultWithStarExport = 187, + kRegExpMatcherFlagsMismatch = 188, + kRegExpCustomSpecies = 189, // If you add new values here, you'll also need to update Chromium's: // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to @@ -971,18 +975,19 @@ class V8_EXPORT Isolate { V8_INLINE MaybeLocal GetDataFromSnapshotOnce(size_t index); /** - * Returns the value that was set or restored by - * SetContinuationPreservedEmbedderData(), if any. + * Returns the value set by `SetContinuationPreservedEmbedderData()` or + * restored during microtask execution for the currently running continuation, + * if any. Returns undefiend if no continuation preserved embedder data was + * set. */ - V8_DEPRECATED("Use GetContinuationPreservedEmbedderDataV2 instead") - Local GetContinuationPreservedEmbedderData(); + Local GetContinuationPreservedEmbedderData(); /** - * Sets a value that will be stored on continuations and reset while the - * continuation runs. + * Sets a value that will be stored on continuations and restored while the + * continuation runs. If `data` is empty, the continuation preserved embedder + * data is set to undefined. */ - V8_DEPRECATED("Use SetContinuationPreservedEmbedderDataV2 instead") - void SetContinuationPreservedEmbedderData(Local data); + void SetContinuationPreservedEmbedderData(Local data); /** * Returns the value set by `SetContinuationPreservedEmbedderDataV2()` or @@ -1509,7 +1514,7 @@ class V8_EXPORT Isolate { * The optional parameter |dependant_context| specifies whether the disposed * context was depending on state from other contexts or not. */ - V8_DEPRECATE_SOON("Use version that passes ContextDependants.") + V8_DEPRECATED("Use version that passes ContextDependants.") int ContextDisposedNotification(bool dependant_context = true); /** diff --git a/deps/v8/include/v8-microtask-queue.h b/deps/v8/include/v8-microtask-queue.h index b99a734aa6f6..de58638c85d6 100644 --- a/deps/v8/include/v8-microtask-queue.h +++ b/deps/v8/include/v8-microtask-queue.h @@ -9,16 +9,13 @@ #include +#include "cppgc/garbage-collected.h" #include "cppgc/macros.h" +#include "cppgc/name-provider.h" #include "v8-local-handle.h" // NOLINT(build/include_directory) #include "v8-microtask.h" // NOLINT(build/include_directory) #include "v8config.h" // NOLINT(build/include_directory) -#ifdef V8_CPPGC_MICROTASK_QUEUE -#include "cppgc/garbage-collected.h" -#include "cppgc/name-provider.h" -#endif // V8_CPPGC_MICROTASK_QUEUE - namespace v8 { class Function; @@ -43,27 +40,15 @@ class MicrotaskQueue; * other synchronously. E.g. for Web embedding, use the same instance for all * origins that share the same URL scheme and eTLD+1. */ -class V8_EXPORT MicrotaskQueue -#ifdef V8_CPPGC_MICROTASK_QUEUE - : public cppgc::GarbageCollected, - public cppgc::NameProvider -#endif // V8_CPPGC_MICROTASK_QUEUE -{ +class V8_EXPORT MicrotaskQueue : public cppgc::GarbageCollected, + public cppgc::NameProvider { public: /** * Creates an empty MicrotaskQueue instance. */ -#ifdef V8_CPPGC_MICROTASK_QUEUE static MicrotaskQueue* New(Isolate* isolate, MicrotasksPolicy policy = MicrotasksPolicy::kAuto); virtual void Trace(cppgc::Visitor* visitor) const {} -#else - V8_DEPRECATE_SOON( - "Use MicrotaskQueue allocated in cppgc, " - "see gn flag: v8_cppgc_microtask_queue.") - static std::unique_ptr New( - Isolate* isolate, MicrotasksPolicy policy = MicrotasksPolicy::kAuto); -#endif // V8_CPPGC_MICROTASK_QUEUE virtual ~MicrotaskQueue() = default; diff --git a/deps/v8/include/v8-object.h b/deps/v8/include/v8-object.h index f66c5a97f5c0..1dd2eb91124d 100644 --- a/deps/v8/include/v8-object.h +++ b/deps/v8/include/v8-object.h @@ -202,9 +202,10 @@ using AccessorNameSetterCallbackV2 = void (*)(Local property, Local value, const PropertyCallbackInfo& info); // TODO(https://crbug.com/348660658): deprecate and remove. -using AccessorNameSetterCallback = - void (*)(Local property, Local value, - const PropertyCallbackInfo& info); +using AccessorNameSetterCallback // + V8_DEPRECATE_SOON("Use AccessorNameSetterCallbackV2 instead.") = + void (*)(Local property, Local value, + const PropertyCallbackInfo& info); /** * Property filter bits. They can be or'ed to build a composite filter. @@ -406,30 +407,11 @@ class V8_EXPORT Object : public Value { */ V8_WARN_UNUSED_RESULT Maybe SetNativeDataProperty( Local context, Local name, - AccessorNameGetterCallback getter, AccessorNameSetterCallbackV2 setter, - Local data = Local(), PropertyAttribute attributes = None, - SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect, - SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect); - V8_DEPRECATED("Use AccessorNameSetterCallbackV2 setter instead") - V8_WARN_UNUSED_RESULT Maybe SetNativeDataProperty( - Local context, Local name, - AccessorNameGetterCallback getter, AccessorNameSetterCallback setter, + AccessorNameGetterCallback getter, + AccessorNameSetterCallbackV2 setter = nullptr, Local data = Local(), PropertyAttribute attributes = None, SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect); - // TODO(https://crbug.com/348660658): remove once AccessorNameSetterCallback - // is removed. - V8_WARN_UNUSED_RESULT Maybe SetNativeDataProperty( - Local context, Local name, - AccessorNameGetterCallback getter, std::nullptr_t setter = nullptr, - Local data = Local(), PropertyAttribute attributes = None, - SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect, - SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect) { - return SetNativeDataProperty( - context, name, getter, - static_cast(setter), data, attributes, - getter_side_effect_type, setter_side_effect_type); - } /** * Attempts to create a property with the given name which behaves like a data @@ -494,9 +476,6 @@ class V8_EXPORT Object : public Value { * This does not consult the security handler. */ Local GetPrototype(); - // TODO(http://crbug.com/333672197): deprecate and remove. - V8_DEPRECATED("Use GetPrototype().") - inline Local GetPrototypeV2() { return GetPrototype(); } /** * Set the prototype object (same as calling Object.setPrototypeOf(..)). @@ -504,12 +483,6 @@ class V8_EXPORT Object : public Value { */ V8_WARN_UNUSED_RESULT Maybe SetPrototype(Local context, Local prototype); - // TODO(http://crbug.com/333672197): deprecate and remove. - V8_DEPRECATED("Use SetPrototype().") - V8_WARN_UNUSED_RESULT Maybe SetPrototypeV2(Local context, - Local prototype) { - return SetPrototype(context, prototype); - } /** * Finds an instance of the given function template in the prototype @@ -837,6 +810,8 @@ class V8_EXPORT Object : public Value { void* GetAlignedPointerFromEmbedderDataInCreationContext( int index, EmbedderDataTypeTag tag); + void* GetAlignedPointerFromEmbedderDataInCreationContext( + v8::Isolate* isolate, int index, CppHeapPointerTag tag); /** * Checks whether a callback is set by the * ObjectTemplate::SetCallAsFunctionHandler method. @@ -968,44 +943,11 @@ Local Object::GetInternalField(int index) { void* Object::GetAlignedPointerFromInternalField(v8::Isolate* isolate, int index, EmbedderDataTypeTag tag) { -#if !defined(V8_ENABLE_CHECKS) - using A = internal::Address; - using I = internal::Internals; - A obj = internal::ValueHelper::ValueAsAddress(this); - // Fast path: If the object is a plain JSObject, which is the common case, we - // know where to find the internal fields and can return the value directly. - auto instance_type = I::GetInstanceType(obj); - if (V8_LIKELY(I::CanHaveInternalField(instance_type))) { - int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize + - (I::kEmbedderDataSlotSize * index) + - I::kEmbedderDataSlotExternalPointerOffset; - A value = I::ReadExternalPointerField(isolate, obj, offset, - ToExternalPointerTag(tag)); - return reinterpret_cast(value); - } -#endif return SlowGetAlignedPointerFromInternalField(isolate, index, tag); } void* Object::GetAlignedPointerFromInternalField(int index, EmbedderDataTypeTag tag) { -#if !defined(V8_ENABLE_CHECKS) - using A = internal::Address; - using I = internal::Internals; - A obj = internal::ValueHelper::ValueAsAddress(this); - // Fast path: If the object is a plain JSObject, which is the common case, we - // know where to find the internal fields and can return the value directly. - auto instance_type = I::GetInstanceType(obj); - if (V8_LIKELY(I::CanHaveInternalField(instance_type))) { - int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize + - (I::kEmbedderDataSlotSize * index) + - I::kEmbedderDataSlotExternalPointerOffset; - Isolate* isolate = I::GetCurrentIsolateForSandbox(); - A value = I::ReadExternalPointerField(isolate, obj, offset, - ToExternalPointerTag(tag)); - return reinterpret_cast(value); - } -#endif return SlowGetAlignedPointerFromInternalField(index, tag); } diff --git a/deps/v8/include/v8-sandbox.h b/deps/v8/include/v8-sandbox.h index be31584ac3ec..2cda25eb958e 100644 --- a/deps/v8/include/v8-sandbox.h +++ b/deps/v8/include/v8-sandbox.h @@ -62,6 +62,8 @@ enum class CppHeapPointerTag : uint16_t { kInspectorTaskInfoTag, kMicrotaskQueueTag, kWasmMemoryMapDescriptorTag, + kCppGCManagedTag, + kEmbedderDataSlotTag, kLastV8InternalTag, #if !V8_ENABLE_SANDBOX diff --git a/deps/v8/include/v8-script.h b/deps/v8/include/v8-script.h index 456831b0b2bb..c6b0585cb119 100644 --- a/deps/v8/include/v8-script.h +++ b/deps/v8/include/v8-script.h @@ -280,7 +280,7 @@ class V8_EXPORT Module : public Data { * * If IsGraphAsync() is false, the returned Promise is settled. */ - V8_WARN_UNUSED_RESULT MaybeLocal Evaluate(Local context); + V8_WARN_UNUSED_RESULT MaybeLocal Evaluate(Local context); /** * Evaluates async dependencies of a module and defer its evaluation @@ -292,7 +292,7 @@ class V8_EXPORT Module : public Data { * modules that are going to be evaluated. This module and its sync * dependencies are not going to be evaluated. */ - V8_WARN_UNUSED_RESULT MaybeLocal EvaluateForImportDefer( + V8_WARN_UNUSED_RESULT MaybeLocal EvaluateForImportDefer( Local context); /** @@ -351,6 +351,15 @@ class V8_EXPORT Module : public Data { * (where an exception was thrown). */ using SyntheticModuleEvaluationSteps = + MaybeLocal (*)(Local context, Local module); + + /* + * Deprecated version of SyntheticModuleEvaluationSteps: the returned value is + * still required to be a Promise, but that is only enforced at runtime. + */ + // TODO(https://crbug.com/545375591): Remove once all embedders return a + // MaybeLocal. + using LegacySyntheticModuleEvaluationSteps = MaybeLocal (*)(Local context, Local module); /** @@ -366,6 +375,17 @@ class V8_EXPORT Module : public Data { SyntheticModuleEvaluationSteps evaluation_steps, Local host_defined_options = Local()); + // TODO(https://crbug.com/545375591): Advance to V8_DEPRECATED and then remove + // this overload once all embedders have been migrated to the one above. + V8_DEPRECATE_SOON( + "Use the CreateSyntheticModule overload whose evaluation_steps return a " + "MaybeLocal") + static Local CreateSyntheticModule( + Isolate* isolate, Local module_name, + const std::span>& export_names, + LegacySyntheticModuleEvaluationSteps evaluation_steps, + Local host_defined_options = Local()); + /** * Returns the host defined options set during CreateSyntheticModule(). * Must only be called on SyntheticModules. diff --git a/deps/v8/include/v8-template.h b/deps/v8/include/v8-template.h index 8c51703b8f37..182293f05bd8 100644 --- a/deps/v8/include/v8-template.h +++ b/deps/v8/include/v8-template.h @@ -103,29 +103,10 @@ class V8_EXPORT Template : public Data { */ void SetNativeDataProperty( Local name, AccessorNameGetterCallback getter, - AccessorNameSetterCallbackV2 setter, Local data = Local(), - PropertyAttribute attribute = None, - SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect, - SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect); - V8_DEPRECATED("Use AccessorNameSetterCallbackV2 setter instead") - void SetNativeDataProperty( - Local name, AccessorNameGetterCallback getter, - AccessorNameSetterCallback setter, Local data = Local(), - PropertyAttribute attribute = None, + AccessorNameSetterCallbackV2 setter = nullptr, + Local data = Local(), PropertyAttribute attribute = None, SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect); - // TODO(https://crbug.com/348660658): remove once AccessorNameSetterCallback - // is removed. - void SetNativeDataProperty( - Local name, AccessorNameGetterCallback getter, - std::nullptr_t setter = nullptr, Local data = Local(), - PropertyAttribute attribute = None, - SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect, - SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect) { - SetNativeDataProperty( - name, getter, static_cast(setter), data, - attribute, getter_side_effect_type, setter_side_effect_type); - } /** * Like SetNativeDataProperty, but V8 will replace the native data property @@ -236,9 +217,10 @@ using NamedPropertySetterCallbackV2 = Intercepted (*)(Local property, Local value, const PropertyCallbackInfo& info); // TODO(https://crbug.com/348660658): deprecate and remove. -using NamedPropertySetterCallback = - Intercepted (*)(Local property, Local value, - const PropertyCallbackInfo& info); +using NamedPropertySetterCallback // + V8_DEPRECATE_SOON("Use NamedPropertySetterCallbackV2 instead.") = + Intercepted (*)(Local property, Local value, + const PropertyCallbackInfo& info); /** * Intercepts all requests that query the attributes of the property, @@ -335,9 +317,10 @@ using NamedPropertyDefinerCallbackV2 = Intercepted (*)(Local property, const PropertyDescriptor& desc, const PropertyCallbackInfo& info); // TODO(https://crbug.com/348660658): deprecate and remove. -using NamedPropertyDefinerCallback = - Intercepted (*)(Local property, const PropertyDescriptor& desc, - const PropertyCallbackInfo& info); +using NamedPropertyDefinerCallback // + V8_DEPRECATE_SOON("Use NamedPropertyDefinerCallbackV2 instead.") = + Intercepted (*)(Local property, const PropertyDescriptor& desc, + const PropertyCallbackInfo& info); /** * Interceptor for [[GetOwnProperty]] requests on an object. @@ -369,7 +352,9 @@ using NamedPropertyDescriptorCallback = Intercepted (*)( using IndexedPropertyGetterCallback = Intercepted (*)(uint32_t index, const PropertyCallbackInfo& info); // TODO(https://crbug.com/348660658): deprecate and remove. -using IndexedPropertyGetterCallbackV2 = IndexedPropertyGetterCallback; +using IndexedPropertyGetterCallbackV2 // + V8_DEPRECATE_SOON("Use IndexedPropertyGetterCallback instead.") = + IndexedPropertyGetterCallback; /** * See `v8::NamedPropertySetterCallback`. @@ -378,8 +363,10 @@ using IndexedPropertySetterCallback = Intercepted (*)(uint32_t index, Local value, const PropertyCallbackInfo& info); // TODO(https://crbug.com/348660658): deprecate and remove. -using IndexedPropertySetterCallbackV2 = Intercepted (*)( - uint32_t index, Local value, const PropertyCallbackInfo& info); +using IndexedPropertySetterCallbackV2 // + V8_DEPRECATE_SOON("Use IndexedPropertySetterCallback instead.") = + Intercepted (*)(uint32_t index, Local value, + const PropertyCallbackInfo& info); /** * See `v8::NamedPropertyQueryCallback`. @@ -387,7 +374,9 @@ using IndexedPropertySetterCallbackV2 = Intercepted (*)( using IndexedPropertyQueryCallback = Intercepted (*)(uint32_t index, const PropertyCallbackInfo& info); // TODO(https://crbug.com/348660658): deprecate and remove. -using IndexedPropertyQueryCallbackV2 = IndexedPropertyQueryCallback; +using IndexedPropertyQueryCallbackV2 // + V8_DEPRECATE_SOON("Use IndexedPropertyQueryCallback instead.") = + IndexedPropertyQueryCallback; /** * See `v8::NamedPropertyDeleterCallback`. @@ -395,7 +384,9 @@ using IndexedPropertyQueryCallbackV2 = IndexedPropertyQueryCallback; using IndexedPropertyDeleterCallback = Intercepted (*)(uint32_t index, const PropertyCallbackInfo& info); // TODO(https://crbug.com/348660658): deprecate and remove. -using IndexedPropertyDeleterCallbackV2 = IndexedPropertyDeleterCallback; +using IndexedPropertyDeleterCallbackV2 // + V8_DEPRECATE_SOON("Use IndexedPropertyDeleterCallback instead.") = + IndexedPropertyDeleterCallback; /** * Returns an array containing the indices of the properties the indexed @@ -413,9 +404,10 @@ using IndexedPropertyDefinerCallback = Intercepted (*)(uint32_t index, const PropertyDescriptor& desc, const PropertyCallbackInfo& info); // TODO(https://crbug.com/348660658): deprecate and remove. -using IndexedPropertyDefinerCallbackV2 = - Intercepted (*)(uint32_t index, const PropertyDescriptor& desc, - const PropertyCallbackInfo& info); +using IndexedPropertyDefinerCallbackV2 // + V8_DEPRECATE_SOON("Use IndexedPropertyDefinerCallback instead.") = + Intercepted (*)(uint32_t index, const PropertyDescriptor& desc, + const PropertyCallbackInfo& info); /** * See `v8::NamedPropertyDescriptorCallback`. @@ -423,7 +415,9 @@ using IndexedPropertyDefinerCallbackV2 = using IndexedPropertyDescriptorCallback = Intercepted (*)(uint32_t index, const PropertyCallbackInfo& info); // TODO(https://crbug.com/348660658): deprecate and remove. -using IndexedPropertyDescriptorCallbackV2 = IndexedPropertyDescriptorCallback; +using IndexedPropertyDescriptorCallbackV2 // + V8_DEPRECATE_SOON("Use IndexedPropertyDescriptorCallback instead.") = + IndexedPropertyDescriptorCallback; /** * Experimental API, do not use! @@ -762,69 +756,37 @@ struct NamedPropertyHandlerConfiguration { PropertyHandlerFlags::kInternalNewCallbacksSignatures)); } - static NamedPropertySetterCallbackV2 ConvertSetter(std::nullptr_t) { - return nullptr; - } - static NamedPropertySetterCallbackV2 ConvertSetter( - NamedPropertySetterCallbackV2 value) { - return value; - } - - static NamedPropertyDefinerCallbackV2 ConvertDefiner(std::nullptr_t) { - return nullptr; - } - static NamedPropertyDefinerCallbackV2 ConvertDefiner( - NamedPropertyDefinerCallbackV2 value) { - return value; - } - public: - // TODO(https://crbug.com/348660658): cleanup once migration to - // NamedPropertySetterCallbackV2/NamedPropertyDefinerCallbackV2 is done. - template - requires((std::is_same_v || - std::is_same_v || - std::is_same_v) && - (std::is_same_v || - std::is_same_v || - std::is_same_v)) NamedPropertyHandlerConfiguration( NamedPropertyGetterCallback getter, // - TSetter setter, // + NamedPropertySetterCallbackV2 setter, // NamedPropertyQueryCallback query, // NamedPropertyDeleterCallback deleter, // NamedPropertyEnumeratorCallback enumerator, // - TDefiner definer, // + NamedPropertyDefinerCallbackV2 definer, // NamedPropertyDescriptorCallback descriptor, // Local data = Local(), PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) : getter(getter), - setter(ConvertSetter(setter)), + setter(setter), query(query), deleter(deleter), enumerator(enumerator), - definer(ConvertDefiner(definer)), + definer(definer), descriptor(descriptor), data(data), flags(flags) {} - // TODO(https://crbug.com/348660658): cleanup once migration to - // NamedPropertySetterCallbackV2/NamedPropertyDefinerCallbackV2 is done. - template - requires(std::is_same_v || - std::is_same_v || - std::is_same_v) explicit NamedPropertyHandlerConfiguration( NamedPropertyGetterCallback getter, // - TSetter setter = nullptr, // + NamedPropertySetterCallbackV2 setter = nullptr, // NamedPropertyQueryCallback query = nullptr, // NamedPropertyDeleterCallback deleter = nullptr, // NamedPropertyEnumeratorCallback enumerator = nullptr, // Local data = Local(), PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) : getter(getter), - setter(ConvertSetter(setter)), + setter(setter), query(query), deleter(deleter), enumerator(enumerator), @@ -833,31 +795,21 @@ struct NamedPropertyHandlerConfiguration { data(data), flags(flags) {} - // TODO(https://crbug.com/348660658): cleanup once migration to - // NamedPropertySetterCallbackV2/NamedPropertyDefinerCallbackV2 is done. - template - requires((std::is_same_v || - std::is_same_v || - std::is_same_v) && - (std::is_same_v || - std::is_same_v || - std::is_same_v)) NamedPropertyHandlerConfiguration( NamedPropertyGetterCallback getter, // - TSetter setter, // + NamedPropertySetterCallbackV2 setter, // NamedPropertyDescriptorCallback descriptor, // NamedPropertyDeleterCallback deleter, // NamedPropertyEnumeratorCallback enumerator, // - TDefiner definer, // + NamedPropertyDefinerCallbackV2 definer, // Local data = Local(), PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) : getter(getter), - setter(ConvertSetter(setter)), + setter(setter), query(nullptr), deleter(deleter), enumerator(enumerator), - definer(ConvertDefiner(definer)), + definer(definer), descriptor(descriptor), data(data), flags(flags) {} @@ -883,69 +835,37 @@ struct IndexedPropertyHandlerConfiguration { PropertyHandlerFlags::kInternalNewCallbacksSignatures)); } - static IndexedPropertySetterCallback ConvertSetter(std::nullptr_t) { - return nullptr; - } - static IndexedPropertySetterCallback ConvertSetter( - IndexedPropertySetterCallback value) { - return value; - } - - static IndexedPropertyDefinerCallback ConvertDefiner(std::nullptr_t) { - return nullptr; - } - static IndexedPropertyDefinerCallback ConvertDefiner( - IndexedPropertyDefinerCallback value) { - return value; - } - public: - // TODO(https://crbug.com/348660658): cleanup once migration to - // IndexedPropertySetterCallback/IndexedPropertyDefinerCallback is done. - template - requires((std::is_same_v || - std::is_same_v || - std::is_same_v) && - (std::is_same_v || - std::is_same_v || - std::is_same_v)) IndexedPropertyHandlerConfiguration( IndexedPropertyGetterCallback getter, // - TSetter setter, // + IndexedPropertySetterCallback setter, // IndexedPropertyQueryCallback query, // IndexedPropertyDeleterCallback deleter, // IndexedPropertyEnumeratorCallback enumerator, // - TDefiner definer, // + IndexedPropertyDefinerCallback definer, // IndexedPropertyDescriptorCallback descriptor, // Local data = Local(), PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) : getter(getter), - setter(ConvertSetter(setter)), + setter(setter), query(query), deleter(deleter), enumerator(enumerator), - definer(ConvertDefiner(definer)), + definer(definer), descriptor(descriptor), data(data), flags(flags) {} - // TODO(https://crbug.com/348660658): cleanup once migration to - // IndexedPropertySetterCallback/IndexedPropertyDefinerCallback is done. - template - requires(std::is_same_v || - std::is_same_v || - std::is_same_v) explicit IndexedPropertyHandlerConfiguration( IndexedPropertyGetterCallback getter = nullptr, // - TSetter setter = nullptr, // + IndexedPropertySetterCallback setter = nullptr, // IndexedPropertyQueryCallback query = nullptr, // IndexedPropertyDeleterCallback deleter = nullptr, // IndexedPropertyEnumeratorCallback enumerator = nullptr, // Local data = Local(), // PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) : getter(getter), - setter(ConvertSetter(setter)), + setter(setter), query(query), deleter(deleter), enumerator(enumerator), @@ -954,98 +874,68 @@ struct IndexedPropertyHandlerConfiguration { data(data), flags(flags) {} - // TODO(https://crbug.com/348660658): cleanup once migration to - // IndexedPropertySetterCallback/IndexedPropertyDefinerCallback is done. - template - requires((std::is_same_v || - std::is_same_v || - std::is_same_v) && - (std::is_same_v || - std::is_same_v || - std::is_same_v)) IndexedPropertyHandlerConfiguration( IndexedPropertyGetterCallback getter, // - TSetter setter, // + IndexedPropertySetterCallback setter, // IndexedPropertyDescriptorCallback descriptor, // IndexedPropertyDeleterCallback deleter, // IndexedPropertyEnumeratorCallback enumerator, // - TDefiner definer, // + IndexedPropertyDefinerCallback definer, // Local data = Local(), PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) : getter(getter), - setter(ConvertSetter(setter)), + setter(setter), query(nullptr), deleter(deleter), enumerator(enumerator), - definer(ConvertDefiner(definer)), + definer(definer), descriptor(descriptor), data(data), flags(flags) {} - // TODO(https://crbug.com/348660658): cleanup once migration to - // IndexedPropertySetterCallback/IndexedPropertyDefinerCallback is done. - template - requires((std::is_same_v || - std::is_same_v || - std::is_same_v) && - (std::is_same_v || - std::is_same_v || - std::is_same_v)) V8_DEPRECATE_SOON( "Use IndexedPropertyHandlerConfiguration with iterable_to_list") IndexedPropertyHandlerConfiguration( IndexedPropertyGetterCallback getter, // - TSetter setter, // + IndexedPropertySetterCallback setter, // IndexedPropertyQueryCallback query, // IndexedPropertyDeleterCallback deleter, // IndexedPropertyEnumeratorCallback enumerator, // - TDefiner definer, // + IndexedPropertyDefinerCallback definer, // IndexedPropertyDescriptorCallback descriptor, // IndexedPropertyIndexOfCallback index_of, // Local data = Local(), PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) : getter(getter), - setter(ConvertSetter(setter)), + setter(setter), query(query), deleter(deleter), enumerator(enumerator), - definer(ConvertDefiner(definer)), + definer(definer), descriptor(descriptor), index_of(index_of), iterable_to_list(nullptr), data(data), flags(flags) {} - // TODO(https://crbug.com/348660658): cleanup once migration to - // IndexedPropertySetterCallback/IndexedPropertyDefinerCallback is done. - template - requires((std::is_same_v || - std::is_same_v || - std::is_same_v) && - (std::is_same_v || - std::is_same_v || - std::is_same_v)) IndexedPropertyHandlerConfiguration( IndexedPropertyGetterCallback getter, // - TSetter setter, // + IndexedPropertySetterCallback setter, // IndexedPropertyQueryCallback query, // IndexedPropertyDeleterCallback deleter, // IndexedPropertyEnumeratorCallback enumerator, // - TDefiner definer, // + IndexedPropertyDefinerCallback definer, // IndexedPropertyDescriptorCallback descriptor, // IndexedPropertyIndexOfCallback index_of, // IndexedPropertyIterableToListCallback iterable_to_list, Local data = Local(), PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) : getter(getter), - setter(ConvertSetter(setter)), + setter(setter), query(query), deleter(deleter), enumerator(enumerator), - definer(ConvertDefiner(definer)), + definer(definer), descriptor(descriptor), index_of(index_of), iterable_to_list(iterable_to_list), diff --git a/deps/v8/include/v8-value-serializer.h b/deps/v8/include/v8-value-serializer.h index 0cb3e045bc46..731965722fb3 100644 --- a/deps/v8/include/v8-value-serializer.h +++ b/deps/v8/include/v8-value-serializer.h @@ -10,6 +10,7 @@ #include #include +#include #include "v8-local-handle.h" // NOLINT(build/include_directory) #include "v8-maybe.h" // NOLINT(build/include_directory) @@ -18,6 +19,7 @@ namespace v8 { class ArrayBuffer; +class BackingStore; class Isolate; class Object; class SharedArrayBuffer; @@ -150,8 +152,18 @@ class V8_EXPORT ValueSerializer { virtual void FreeBufferMemory(void* buffer); }; - explicit ValueSerializer(Isolate* isolate); - ValueSerializer(Isolate* isolate, Delegate* delegate); + enum class SharedImmutableArrayBufferMode { + kDisabled, + kEnabled, + }; + + explicit ValueSerializer( + Isolate* isolate, + SharedImmutableArrayBufferMode share_immutable_array_buffer = + SharedImmutableArrayBufferMode::kDisabled); + ValueSerializer(Isolate* isolate, Delegate* delegate, + SharedImmutableArrayBufferMode share_immutable_array_buffer = + SharedImmutableArrayBufferMode::kDisabled); ~ValueSerializer(); /** @@ -190,6 +202,18 @@ class V8_EXPORT ValueSerializer { */ void SetTreatArrayBufferViewsAsHostObjects(bool mode); + /** + * Returns the backing stores of all immutable JSArrayBuffers that were + * serialized without copying. + * + * When SharedImmutableArrayBufferMode::kEnabled is passed to the constructor, + * the embedder MUST call this method after serialization and transmit these + * backing stores to the receiver, where they must be passed to + * ValueDeserializer::SetSharedImmutableBackingStores. + */ + std::vector> + ReleaseSharedImmutableBackingStores(); + /** * Write raw data in various common formats to the buffer. * Note that integer types are written in base-128 varint format, not with a @@ -277,6 +301,12 @@ class V8_EXPORT ValueDeserializer { void TransferSharedArrayBuffer(uint32_t id, Local shared_array_buffer); + /** + * Accepts shared immutable backing stores from ValueSerializer. + */ + void SetSharedImmutableBackingStores( + std::vector> backing_stores); + /** * Must be called before ReadHeader to enable support for reading the legacy * wire format (i.e., which predates this being shipped). diff --git a/deps/v8/include/v8-value.h b/deps/v8/include/v8-value.h index c2fd021ed23f..4757dcc41856 100644 --- a/deps/v8/include/v8-value.h +++ b/deps/v8/include/v8-value.h @@ -366,6 +366,13 @@ class V8_EXPORT Value : public Data { */ bool IsModuleNamespaceObject() const; + /** + * Returns true if the value is a Deferred Module Namespace Object, i.e. the + * namespace object created by `import defer * as ns from ...`. Note that + * IsModuleNamespaceObject() is also true for such values. + */ + bool IsDeferredModuleNamespaceObject() const; + /** * Returns true if the value is a primitive. */ diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 3862105d3f15..d3a60cfe29e1 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 15 -#define V8_MINOR_VERSION 2 -#define V8_BUILD_NUMBER 124 -#define V8_PATCH_LEVEL 38 +#define V8_MINOR_VERSION 5 +#define V8_BUILD_NUMBER 35 +#define V8_PATCH_LEVEL 20 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/include/v8-wasm.h b/deps/v8/include/v8-wasm.h index b78624ec00a7..4d0158bd29d1 100644 --- a/deps/v8/include/v8-wasm.h +++ b/deps/v8/include/v8-wasm.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "v8-internal.h" // NOLINT(build/include_directory) @@ -108,11 +109,11 @@ class V8_EXPORT WasmModuleObject : public Object { CompiledWasmModule GetCompiledModule(); /** - * Compile-time imports that influence how a Wasm module is compiled. These - * mirror the options accepted by the JS `WebAssembly.Module` constructor - * (`{ builtins, importedStringConstants }`). + * Options that influence how a Wasm module is compiled. The compile-time + * import options mirror those accepted by the JS `WebAssembly.Module` + * constructor (`{ builtins, importedStringConstants }`). */ - struct CompileTimeImports { + struct CompileOptions { // Builtin compile-time imports, mirroring the strings accepted in the // `builtins` array of the JS `WebAssembly.Module` constructor options. // Combine values with bitwise-or to enable multiple builtins. @@ -126,8 +127,13 @@ class V8_EXPORT WasmModuleObject : public Object { int builtins = Builtins::kNone; // If non-null, enable imported string constants from the named module // (e.g. "wasm:js/string-constants"). The string must be null-terminated and - // remain valid for the duration of this call. + // remain valid for the duration of the compile call. const char* imported_string_constants_module = nullptr; + // If non-empty, associated with the module's script as its source URL, for + // use in stack traces and developer tooling. If a script already exists in + // the isolate for the same module, its existing URL is retained. The + // string must remain valid for the duration of the compile call. + std::string_view source_url = {}; }; /** @@ -138,11 +144,11 @@ class V8_EXPORT WasmModuleObject : public Object { /** * Compile a Wasm module from the provided uncompiled bytes, applying the - * given compile-time imports. + * given compile options. */ static MaybeLocal Compile( Isolate* isolate, std::span wire_bytes, - const CompileTimeImports& compile_imports); + const CompileOptions& options); V8_INLINE static WasmModuleObject* Cast(Value* value) { #ifdef V8_ENABLE_CHECKS @@ -163,8 +169,8 @@ class V8_EXPORT WasmModuleObject : public Object { */ class V8_EXPORT WasmStreaming final { public: - static constexpr internal::ExternalPointerTag kManagedTag = - internal::kWasmWasmStreamingTag; + static constexpr internal::ManagedTypeId kTypeID = + internal::ManagedTypeId::kWasmStreaming; class WasmStreamingImpl; class ModuleCachingInterface { @@ -236,9 +242,9 @@ class V8_EXPORT WasmStreaming final { void SetUrl(const char* url, size_t length); /** - * Unpacks a {WasmStreaming} object wrapped in a {Managed} for the embedder. - * Since the embedder is on the other side of the API, it cannot unpack the - * {Managed} itself. + * Unpacks a {WasmStreaming} object wrapped in a {CppGCManaged} for the + * embedder. Since the embedder is on the other side of the API, it cannot + * unpack the {CppGCManaged} itself. */ static std::shared_ptr Unpack(Isolate* isolate, Local value); @@ -256,13 +262,15 @@ class V8_EXPORT WasmStreaming final { class V8_EXPORT WasmModuleCompilation final { public: using ModuleCachingCallback = WasmStreaming::ModuleCachingCallback; + using CompileOptions = WasmModuleObject::CompileOptions; /** - * Start an asynchronous module compilation. This can be called on any thread. + * Start an asynchronous module compilation, applying the given compile + * options. This can be called on any thread. Providing + * {CompileOptions::source_url} is equivalent to calling {SetUrl}. * TODO(clemensb): Add some way to pass enabled features. - * TODO(clemensb): Add some way to pass compile time imports. */ - WasmModuleCompilation(); + explicit WasmModuleCompilation(const CompileOptions& options = {}); ~WasmModuleCompilation(); diff --git a/deps/v8/include/v8config.h b/deps/v8/include/v8config.h index 7a60288c673a..b36169f1f77d 100644 --- a/deps/v8/include/v8config.h +++ b/deps/v8/include/v8config.h @@ -602,15 +602,11 @@ path. Add it with -I to the command line // functions. // Use like: // V8_NOINLINE V8_PRESERVE_MOST void UnlikelyMethod(); -#if V8_OS_WIN -# define V8_PRESERVE_MOST -#else #if V8_HAS_ATTRIBUTE_PRESERVE_MOST # define V8_PRESERVE_MOST __attribute__((preserve_most)) #else # define V8_PRESERVE_MOST /* NOT SUPPORTED */ #endif -#endif // A macro (V8_DEPRECATED) to mark classes or functions as deprecated. diff --git a/deps/v8/infra/mb/mb_config.pyl b/deps/v8/infra/mb/mb_config.pyl index da5db1f882a8..0efde3556e70 100644 --- a/deps/v8/infra/mb/mb_config.pyl +++ b/deps/v8/infra/mb/mb_config.pyl @@ -120,6 +120,8 @@ 'V8 Linux64 - runtime call stats - builder': 'release_x64_runtime_call_stats', 'V8 Linux64 - debug - single generation - builder': 'debug_x64_single_generation', 'V8 Linux64 - dumpling - builder': 'release_x64_dumpling', + 'V8 Linux64 - no metagen - debug builder': + 'debug_x64_no_metagen', 'V8 Linux64 - no pointer compression - builder': 'release_x64_no_pointer_compression', 'V8 Linux64 - sticky mark bits - debug builder': 'debug_x64_sticky_mark_bits', 'V8 Linux64 - undefined double - debug builder': 'debug_x64_undefined_double', @@ -305,6 +307,8 @@ 'v8_linux64_fyi_compile_rel': 'release_x64_test_features_trybot', 'v8_linux64_nodcheck_compile_rel': 'release_x64', 'v8_linux64_perfetto_compile_dbg': 'debug_x64_perfetto', + 'v8_linux64_no_metagen_compile_dbg': + 'debug_x64_no_metagen', 'v8_linux64_no_pointer_compression_compile_rel': 'release_x64_no_pointer_compression', 'v8_linux64_compile_rel': 'release_x64_test_features_gcmole_trybot', 'v8_linux64_no_sandbox_compile_rel': 'release_x64_no_sandbox', @@ -753,6 +757,8 @@ 'debug_bot', 'x64', 'non_default_cppgc'], 'debug_x64_perfetto': [ 'debug_bot', 'x64', 'perfetto'], + 'debug_x64_no_metagen': [ + 'debug_bot', 'x64', 'v8_disable_metagen_instance_types'], 'debug_x64_no_sandbox': [ 'debug_bot', 'x64', 'no_sandbox'], 'debug_x64_sandbox_hardware_support': [ @@ -1178,6 +1184,9 @@ 'gn_args': 'v8_dict_property_const_tracking=true', }, + 'v8_disable_metagen_instance_types': { + 'gn_args': 'v8_use_metagen_instance_types=false', + }, 'v8_disable_pointer_compression': { 'gn_args': 'v8_enable_pointer_compression=false', }, diff --git a/deps/v8/infra/testing/builders.pyl b/deps/v8/infra/testing/builders.pyl index 127ce4abf06d..c7ea3073b91a 100644 --- a/deps/v8/infra/testing/builders.pyl +++ b/deps/v8/infra/testing/builders.pyl @@ -321,7 +321,7 @@ 'os': 'Ubuntu-22.04', }, 'tests': [ - {'name': 'v8testing', 'shards': 5}, + {'name': 'v8testing', 'shards': 7}, ], }, 'v8_linux64_css_dbg': { @@ -329,7 +329,7 @@ 'os': 'Ubuntu-22.04', }, 'tests': [ - {'name': 'v8testing', 'shards': 5}, + {'name': 'v8testing', 'shards': 7}, {'name': 'benchmarks', 'shards': 5}, {'name': 'mozilla', 'shards': 5}, {'name': 'test262', 'shards': 12}, @@ -347,16 +347,16 @@ {'name': 'mozilla', 'variant': 'extra'}, {'name': 'test262', 'variant': 'default', 'shards': 4}, {'name': 'test262', 'variant': 'future', 'shards': 4}, - {'name': 'v8testing', 'shards': 8}, + {'name': 'v8testing', 'shards': 9}, {'name': 'v8testing', 'variant': 'extra', 'shards': 6}, {'name': 'v8testing', 'variant': 'minor_ms', 'shards': 2}, - {'name': 'v8testing', 'variant': 'conservative_stack_scanning', 'shards': 2}, + {'name': 'v8testing', 'variant': 'conservative_stack_scanning', 'shards': 3}, {'name': 'v8testing', 'variant': 'no_lfa', 'shards': 2}, {'name': 'v8testing', 'variant': 'stress_instruction_scheduling', 'shards': 2}, {'name': 'v8testing', 'variant': 'stress_concurrent_allocation', 'shards': 2}, {'name': 'v8testing', 'variant': 'stress_concurrent_inlining','shards': 2}, {'name': 'v8testing', 'variant': 'turbofan_random_rescheduling', 'shards': 2}, - {'name': 'v8testing', 'variant': 'scavenger_chaos_mode', 'shards': 2}, + {'name': 'v8testing', 'variant': 'scavenger_chaos_mode', 'shards': 3}, {'name': 'mjsunit', 'variant': 'stress_maglev_tests_with_turbofan', 'shards': 2}, # Maglev -- move to extra once more architectures are supported. {'name': 'v8testing', 'variant': 'maglev', 'shards': 2}, @@ -371,13 +371,13 @@ {'name': 'benchmarks', 'variant': 'code_serializer', 'shards': 1}, {'name': 'd8testing', 'variant': 'code_serializer', 'shards': 2}, {'name': 'mozilla', 'variant': 'code_serializer', 'shards': 1}, - {'name': 'test262', 'variant': 'code_serializer', 'shards': 6}, + {'name': 'test262', 'variant': 'code_serializer', 'shards': 8}, # GC stress { 'name': 'd8testing', 'suffix': 'gc-stress', 'test_args': ['--gc-stress'], - 'shards': 9, + 'shards': 10, }, # Jit fuzzing. {'name': 'mjsunit', 'variant': 'jit_fuzzing'}, @@ -610,6 +610,15 @@ {'name': 'v8testing', 'shards': 8}, ], }, + 'v8_linux64_no_metagen_dbg': { + 'swarming_dimensions' : { + 'os': 'Ubuntu-22.04', + 'cpu': 'x86-64', + }, + 'tests': [ + {'name': 'v8testing', 'shards': 7}, + ], + }, 'v8_linux64_no_pointer_compression_rel': { 'swarming_dimensions' : { 'os': 'Ubuntu-22.04', @@ -1284,7 +1293,7 @@ { 'name': 'd8testing', 'test_args': ['--gc-stress'], - 'shards': 5, + 'shards': 8, }, { 'name': 'mjsunit', @@ -1442,7 +1451,7 @@ 'os': 'Ubuntu-22.04', }, 'tests': [ - {'name': 'mjsunit', 'test_args': ['--no-harness'], 'shards': 2}, + {'name': 'mjsunit', 'test_args': ['--no-harness'], 'shards': 4}, ], }, 'V8 Linux64 - debug': { @@ -1457,28 +1466,28 @@ {'name': 'mozilla', 'variant': 'extra'}, {'name': 'optimize_for_size'}, {'name': 'test262', 'shards': 16}, - {'name': 'test262', 'variant': 'extra', 'shards': 10}, - {'name': 'v8testing', 'shards': 5}, + {'name': 'test262', 'variant': 'extra', 'shards': 12}, + {'name': 'v8testing', 'shards': 7}, {'name': 'v8testing', 'variant': 'extra', 'shards': 4}, - {'name': 'v8testing', 'variant': 'minor_ms'}, - {'name': 'v8testing', 'variant': 'conservative_stack_scanning'}, - {'name': 'v8testing', 'variant': 'no_lfa'}, - {'name': 'v8testing', 'variant': 'slow_path'}, - {'name': 'v8testing', 'variant': 'stress_instruction_scheduling'}, - {'name': 'v8testing', 'variant': 'stress_concurrent_allocation'}, + {'name': 'v8testing', 'variant': 'minor_ms', 'shards': 2}, + {'name': 'v8testing', 'variant': 'conservative_stack_scanning', 'shards': 2}, + {'name': 'v8testing', 'variant': 'no_lfa', 'shards': 2}, + {'name': 'v8testing', 'variant': 'slow_path', 'shards': 2}, + {'name': 'v8testing', 'variant': 'stress_instruction_scheduling', 'shards': 2}, + {'name': 'v8testing', 'variant': 'stress_concurrent_allocation', 'shards': 2}, {'name': 'v8testing', 'variant': 'stress_concurrent_inlining', 'shards': 2}, - {'name': 'v8testing', 'variant': 'turbofan_random_rescheduling'}, - {'name': 'v8testing', 'variant': 'scavenger_chaos_mode'}, - {'name': 'mjsunit', 'variant': 'stress_maglev_tests_with_turbofan'}, + {'name': 'v8testing', 'variant': 'turbofan_random_rescheduling', 'shards': 2}, + {'name': 'v8testing', 'variant': 'scavenger_chaos_mode', 'shards': 2}, + {'name': 'mjsunit', 'variant': 'stress_maglev_tests_with_turbofan', 'shards': 2}, # Maglev -- move to extra once more architectures are supported. - {'name': 'v8testing', 'variant': 'maglev'}, - {'name': 'v8testing', 'variant': 'maglev_future'}, - {'name': 'v8testing', 'variant': 'stress_maglev'}, - {'name': 'v8testing', 'variant': 'stress_maglev_non_eager_inlining'}, - {'name': 'v8testing', 'variant': 'stress_maglev_future'}, - {'name': 'v8testing', 'variant': 'turbolev'}, - {'name': 'v8testing', 'variant': 'stress_turbolev_future'}, - {'name': 'v8testing', 'variant': 'verify_turboshaft'}, + {'name': 'v8testing', 'variant': 'maglev', 'shards': 2}, + {'name': 'v8testing', 'variant': 'maglev_future', 'shards': 2}, + {'name': 'v8testing', 'variant': 'stress_maglev', 'shards': 2}, + {'name': 'v8testing', 'variant': 'stress_maglev_non_eager_inlining', 'shards': 2}, + {'name': 'v8testing', 'variant': 'stress_maglev_future', 'shards': 2}, + {'name': 'v8testing', 'variant': 'turbolev', 'shards': 2}, + {'name': 'v8testing', 'variant': 'stress_turbolev_future', 'shards': 2}, + {'name': 'v8testing', 'variant': 'verify_turboshaft', 'shards': 2}, # Noavx. { 'name': 'v8testing', @@ -1490,7 +1499,7 @@ {'name': 'benchmarks', 'variant': 'code_serializer', 'shards': 1}, {'name': 'd8testing', 'variant': 'code_serializer', 'shards': 1}, {'name': 'mozilla', 'variant': 'code_serializer', 'shards': 1}, - {'name': 'test262', 'variant': 'code_serializer', 'shards': 4}, + {'name': 'test262', 'variant': 'code_serializer', 'shards': 6}, # Jit fuzzing. {'name': 'mjsunit', 'variant': 'jit_fuzzing'}, {'name': 'mjsunit', 'variant': 'jit_fuzzing_maglev'}, @@ -1549,7 +1558,7 @@ 'os': 'Ubuntu-22.04', }, 'tests': [ - {'name': 'v8testing', 'shards': 5}, + {'name': 'v8testing', 'shards': 7}, ], }, 'V8 Linux64 - debug - perfetto': { @@ -1645,7 +1654,7 @@ { 'name': 'd8testing', 'test_args': ['--gc-stress'], - 'shards': 7, + 'shards': 8, }, { 'name': 'mjsunit', @@ -1708,6 +1717,15 @@ {'name': 'v8testing', 'shards': 6}, ], }, + 'V8 Linux64 - no metagen - debug': { + 'swarming_dimensions' : { + 'os': 'Ubuntu-22.04', + 'cpu': 'x86-64', + }, + 'tests': [ + {'name': 'v8testing', 'shards': 7}, + ], + }, 'V8 Linux64 - no pointer compression': { 'swarming_dimensions' : { 'os': 'Ubuntu-22.04', @@ -1791,7 +1809,7 @@ 'os': 'Ubuntu-22.04', }, 'tests': [ - {'name': 'v8testing', 'shards': 2}, + {'name': 'v8testing', 'shards': 3}, ], }, 'V8 Linux64 ASAN': { @@ -1810,10 +1828,10 @@ 'os': 'Ubuntu-22.04', }, 'tests': [ - {'name': 'v8testing', 'shards': 5}, + {'name': 'v8testing', 'shards': 7}, {'name': 'benchmarks', 'shards': 5}, {'name': 'mozilla', 'shards': 5}, - {'name': 'test262', 'shards': 12}, + {'name': 'test262', 'shards': 16}, ], }, 'V8 Linux64 GC Stress - custom snapshot': { @@ -1824,7 +1842,7 @@ { 'name': 'mjsunit', 'test_args': ['--gc-stress', '--no-harness'], - 'shards': 5, + 'shards': 8, }, ], }, @@ -2117,9 +2135,9 @@ {'name': 'test262', 'variant': 'default', 'shards': 4}, {'name': 'v8testing', 'shards': 4}, {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, - {'name': 'v8testing', 'variant': 'minor_ms'}, - {'name': 'v8testing', 'variant': 'conservative_stack_scanning'}, - {'name': 'v8testing', 'variant': 'scavenger_chaos_mode'}, + {'name': 'v8testing', 'variant': 'minor_ms', 'shards': 2}, + {'name': 'v8testing', 'variant': 'conservative_stack_scanning', 'shards': 2}, + {'name': 'v8testing', 'variant': 'scavenger_chaos_mode', 'shards': 2}, {'name': 'benchmarks', 'variant': 'validate_generated_code', 'shards': 2}, {'name': 'd8testing', 'variant': 'validate_generated_code', 'shards': 2}, ], diff --git a/deps/v8/src/DEPS b/deps/v8/src/DEPS index af82a07ba9d2..54108a8f1afa 100644 --- a/deps/v8/src/DEPS +++ b/deps/v8/src/DEPS @@ -88,6 +88,7 @@ include_rules = [ "-src/libplatform", "-include/libplatform", "+builtins-generated", + "+metagen", "+torque-generated", "+starboard", ] diff --git a/deps/v8/src/api/api-arguments-inl.h b/deps/v8/src/api/api-arguments-inl.h index 8cbda85dc65c..dbfae8ec545a 100644 --- a/deps/v8/src/api/api-arguments-inl.h +++ b/deps/v8/src/api/api-arguments-inl.h @@ -354,10 +354,11 @@ v8::Intercepted PropertyCallbackArguments::CallNamedSetter( set_property_key(*name); slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value()); - NamedPropertySetterCallback f = reinterpret_cast( - interceptor->named_setter(isolate)); + NamedPropertySetterCallbackV2 f = + reinterpret_cast( + interceptor->named_setter(isolate)); DirectHandle has_side_effects; - PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, void, has_side_effects, + PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Boolean, has_side_effects, ExceptionContext::kNamedSetter); v8::Intercepted intercepted = f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), callback_info); @@ -373,11 +374,11 @@ v8::Intercepted PropertyCallbackArguments::CallNamedDefiner( set_property_key(*name); slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value()); - NamedPropertyDefinerCallback f = - reinterpret_cast( + NamedPropertyDefinerCallbackV2 f = + reinterpret_cast( interceptor->named_definer(isolate)); DirectHandle has_side_effects; - PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, void, has_side_effects, + PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Boolean, has_side_effects, ExceptionContext::kNamedDefiner); v8::Intercepted intercepted = f(v8::Utils::ToLocal(name), desc, callback_info); @@ -425,8 +426,8 @@ DirectHandle PropertyCallbackArguments::CallIndexedQuery( set_property_key(index); slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kReturnValueIndex).store(Smi::FromInt(v8::None)); - IndexedPropertyQueryCallbackV2 f = - reinterpret_cast( + IndexedPropertyQueryCallback f = + reinterpret_cast( interceptor->indexed_query(isolate)); PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Integer, interceptor, ExceptionContext::kIndexedQuery); @@ -444,8 +445,8 @@ DirectHandle PropertyCallbackArguments::CallIndexedGetter( set_property_key(index); slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).undefined_value()); - IndexedPropertyGetterCallbackV2 f = - reinterpret_cast( + IndexedPropertyGetterCallback f = + reinterpret_cast( interceptor->indexed_getter(isolate)); PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Value, interceptor, ExceptionContext::kIndexedGetter); @@ -463,8 +464,8 @@ Handle PropertyCallbackArguments::CallIndexedDescriptor( set_property_key(index); slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).undefined_value()); - IndexedPropertyDescriptorCallbackV2 f = - reinterpret_cast( + IndexedPropertyDescriptorCallback f = + reinterpret_cast( interceptor->indexed_descriptor(isolate)); PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Value, interceptor, ExceptionContext::kIndexedDescriptor); @@ -482,11 +483,11 @@ v8::Intercepted PropertyCallbackArguments::CallIndexedSetter( set_property_key(index); slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value()); - IndexedPropertySetterCallbackV2 f = - reinterpret_cast( + IndexedPropertySetterCallback f = + reinterpret_cast( interceptor->indexed_setter(isolate)); DirectHandle has_side_effects; - PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, void, has_side_effects, + PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Boolean, has_side_effects, ExceptionContext::kIndexedSetter); v8::Intercepted intercepted = f(index, v8::Utils::ToLocal(value), callback_info); @@ -502,11 +503,11 @@ v8::Intercepted PropertyCallbackArguments::CallIndexedDefiner( set_property_key(index); slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value()); - IndexedPropertyDefinerCallbackV2 f = - reinterpret_cast( + IndexedPropertyDefinerCallback f = + reinterpret_cast( interceptor->indexed_definer(isolate)); DirectHandle has_side_effects; - PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, void, has_side_effects, + PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Boolean, has_side_effects, ExceptionContext::kIndexedDefiner); v8::Intercepted intercepted = f(index, desc, callback_info); return intercepted; @@ -521,8 +522,8 @@ v8::Intercepted PropertyCallbackArguments::CallIndexedDeleter( set_property_key(index); slot_at(kCallbackInfoIndex).store(*interceptor); slot_at(kReturnValueIndex).store(ReadOnlyRoots(isolate).true_value()); - IndexedPropertyDeleterCallbackV2 f = - reinterpret_cast( + IndexedPropertyDeleterCallback f = + reinterpret_cast( interceptor->indexed_deleter(isolate)); PREPARE_CALLBACK_INFO_INTERCEPTOR(isolate, f, v8::Boolean, interceptor, ExceptionContext::kIndexedDeleter); diff --git a/deps/v8/src/api/api-inl.h b/deps/v8/src/api/api-inl.h index a85ad8c47981..b5be783c2314 100644 --- a/deps/v8/src/api/api-inl.h +++ b/deps/v8/src/api/api-inl.h @@ -17,7 +17,7 @@ #include "src/heap/heap-inl.h" #include "src/logging/runtime-call-stats.h" #include "src/objects/foreign-inl.h" -#include "src/objects/objects-inl.h" +#include "src/objects/object-conversions-inl.h" namespace v8 { @@ -203,10 +203,13 @@ class V8_NODISCARD CallDepthScope { bool CheckKeptObjectsClearedAfterMicrotaskCheckpoint( i::MicrotaskQueue* microtask_queue) { bool did_perform_microtask_checkpoint = - isolate_->thread_local_top()->CallDepthIsZero() && do_callback && + do_callback && isolate_->thread_local_top()->CallDepthIsZero() && microtask_queue && microtask_queue->microtasks_policy() == MicrotasksPolicy::kAuto && - !isolate_->is_execution_terminating(); + !isolate_->is_execution_terminating() && + microtask_queue->ShouldPerformCheckpoint( + reinterpret_cast(isolate_)); + return !did_perform_microtask_checkpoint || IsUndefined(isolate_->heap()->weak_refs_keep_during_job()); } diff --git a/deps/v8/src/api/api-natives.cc b/deps/v8/src/api/api-natives.cc index 36bcf476d566..68ba61b7cbc2 100644 --- a/deps/v8/src/api/api-natives.cc +++ b/deps/v8/src/api/api-natives.cc @@ -443,9 +443,7 @@ MaybeHandle InstantiateFunction( if (!info->needs_access_check() && IsUndefined(info->GetNamedPropertyHandler()) && IsUndefined(info->GetIndexedPropertyHandler())) { - function_type = v8_flags.experimental_embedder_instance_types - ? info->GetInstanceType() - : JS_API_OBJECT_TYPE; + function_type = JS_API_OBJECT_TYPE; DCHECK(InstanceTypeChecker::IsJSApiObject(function_type)); } @@ -735,6 +733,13 @@ Handle ApiNatives::CreateApiFunction( if (immutable_proto) map->set_is_immutable_proto(true); JSFunction::SetInitialMap(isolate, result, map, Cast(prototype)); + if (map->supports_fast_iterable_to_list()) { + // %CheckFastIterableToListPrototype() relies on the constness tracking + // which requires the prototype to be in fast mode. + DirectHandle proto_map(Cast(prototype)->map(), isolate); + Map::SetShouldBeFastPrototypeMap(proto_map, true, isolate); + } + return result; } diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index f498fee34316..adee19691fcf 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -112,6 +112,7 @@ #include "src/objects/js-weak-refs-inl.h" #include "src/objects/managed-inl.h" #include "src/objects/module-inl.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" #include "src/objects/oddball.h" #include "src/objects/ordered-hash-table-inl.h" @@ -155,7 +156,6 @@ #include "src/utils/version.h" #if V8_ENABLE_WEBASSEMBLY -#include "src/base/fpu.h" #include "src/debug/debug-wasm-objects.h" #include "src/trap-handler/trap-handler.h" #include "src/wasm/streaming-decoder.h" @@ -955,8 +955,8 @@ Context::BackupIncumbentScope::~BackupIncumbentScope() { } static_assert(i::Internals::kEmbedderDataSlotSize == i::kEmbedderDataSlotSize); -static_assert(i::Internals::kEmbedderDataSlotExternalPointerOffset == - i::EmbedderDataSlot::kExternalPointerOffset); +static_assert(i::Internals::kEmbedderDataSlotCppHeapPointerOffset == + i::EmbedderDataSlot::kCppHeapPointerOffset); static i::DirectHandle EmbedderDataFor( Context* context, int index, bool can_grow, const char* location) { @@ -1035,8 +1035,8 @@ void Context::SetEmbedderDataV2(int index, v8::Local value) { *Utils::OpenDirectHandle(*GetEmbedderDataV2(index))); } -void* Context::SlowGetAlignedPointerFromEmbedderData(int index, - EmbedderDataTypeTag tag) { +void* Context::GetAlignedPointerFromEmbedderData(int index, + EmbedderDataTypeTag tag) { const char* location = "v8::Context::GetAlignedPointerFromEmbedderData()"; i::Isolate* i_isolate = i::Isolate::Current(); i::HandleScope handle_scope(i_isolate); @@ -1051,19 +1051,44 @@ void* Context::SlowGetAlignedPointerFromEmbedderData(int index, return result; } +void* Context::SlowGetAlignedPointerFromEmbedderData(int index, + CppHeapPointerTag tag) { + const char* location = "v8::Context::GetAlignedPointerFromEmbedderData()"; + i::Isolate* i_isolate = i::Isolate::Current(); + i::HandleScope handle_scope(i_isolate); + i::DirectHandle data = + EmbedderDataFor(this, index, false, location); + if (data.is_null()) return nullptr; + void* result; + Utils::ApiCheck(i::EmbedderDataSlot(*data, index) + .ToAlignedPointer(i_isolate, &result, tag), + location, "Pointer is not aligned"); + return result; +} + void Context::SetAlignedPointerInEmbedderData(int index, void* value, EmbedderDataTypeTag tag) { const char* location = "v8::Context::SetAlignedPointerInEmbedderData()"; i::Isolate* i_isolate = i::Isolate::Current(); i::DirectHandle data = EmbedderDataFor(this, index, true, location); - bool ok = i::EmbedderDataSlot(*data, index) - .store_aligned_pointer(i_isolate, *data, value, - ToExternalPointerTag(tag)); + bool ok = i::EmbedderDataSlot::store_aligned_pointer( + i_isolate, data, index, value, ToExternalPointerTag(tag)); Utils::ApiCheck(ok, location, "Pointer is not aligned"); DCHECK_EQ(value, GetAlignedPointerFromEmbedderData(index, tag)); } +void Context::SetAlignedPointerInEmbedderDataInternal(int index, void* value, + CppHeapPointerTag tag) { + const char* location = "v8::Context::SetAlignedPointerInEmbedderData()"; + i::Isolate* i_isolate = i::Isolate::Current(); + i::DirectHandle data = + EmbedderDataFor(this, index, true, location); + bool ok = i::EmbedderDataSlot(*data, index) + .store_aligned_pointer(i_isolate, *data, value, tag); + Utils::ApiCheck(ok, location, "Pointer is not aligned"); +} + // --- T e m p l a t e --- void Template::Set(v8::Local name, v8::Local value, @@ -1563,17 +1588,6 @@ void Template::SetNativeDataProperty(v8::Local name, getter_side_effect_type, setter_side_effect_type); } -void Template::SetNativeDataProperty(v8::Local name, - AccessorNameGetterCallback getter, - AccessorNameSetterCallback setter, - v8::Local data, - PropertyAttribute attribute, - SideEffectType getter_side_effect_type, - SideEffectType setter_side_effect_type) { - TemplateSetAccessor(this, name, getter, setter, data, attribute, false, - getter_side_effect_type, setter_side_effect_type); -} - void Template::SetLazyDataProperty(v8::Local name, AccessorNameGetterCallback getter, v8::Local data, @@ -1581,7 +1595,7 @@ void Template::SetLazyDataProperty(v8::Local name, SideEffectType getter_side_effect_type, SideEffectType setter_side_effect_type) { TemplateSetAccessor( - this, name, getter, static_cast(nullptr), + this, name, getter, static_cast(nullptr), data, attribute, true, getter_side_effect_type, setter_side_effect_type); } @@ -2438,7 +2452,7 @@ Maybe Module::InstantiateModule(Local context, return Just(true); } -MaybeLocal Module::Evaluate(Local context) { +MaybeLocal Module::Evaluate(Local context) { auto i_isolate = i::Isolate::Current(); TRACE_EVENT_CALL_STATS_SCOPED(i_isolate, "v8", "V8.Execute"); EnterV8Scope api_scope{i_isolate, context, @@ -2456,7 +2470,7 @@ MaybeLocal Module::Evaluate(Local context) { return api_scope.EscapeMaybe(i::Module::Evaluate(i_isolate, self)); } -MaybeLocal Module::EvaluateForImportDefer(Local context) { +MaybeLocal Module::EvaluateForImportDefer(Local context) { auto i_isolate = i::Isolate::Current(); TRACE_EVENT_CALL_STATS_SCOPED(i_isolate, "v8", "V8.Execute"); EnterV8Scope api_scope{i_isolate, context, @@ -2486,7 +2500,7 @@ MaybeLocal Module::EvaluateForImportDefer(Local context) { Local v8_dep_module = Utils::ToLocal(dep_module); MaybeLocal maybe_eval_result = v8_dep_module->Evaluate(context); if (maybe_eval_result.IsEmpty()) { - return api_scope.EscapeMaybe(MaybeLocal()); + return api_scope.EscapeMaybe(MaybeLocal()); } Local eval_result = maybe_eval_result.ToLocalChecked(); CHECK(eval_result->IsPromise()); @@ -2501,7 +2515,7 @@ MaybeLocal Module::EvaluateForImportDefer(Local context) { i::MaybeHandle maybe_promise_all_result = i::JSPromise::PerformPromiseAll(i_isolate, promises); if (maybe_promise_all_result.is_null()) { - return api_scope.EscapeMaybe(MaybeLocal()); + return api_scope.EscapeMaybe(MaybeLocal()); } return api_scope.Escape( Utils::ToLocal(maybe_promise_all_result.ToHandleChecked())); @@ -2537,6 +2551,34 @@ Local Module::CreateSyntheticModule( i_host_defined_options))); } +START_ALLOW_USE_DEPRECATED() +Local Module::CreateSyntheticModule( + Isolate* v8_isolate, Local module_name, + const std::span>& export_names, + v8::Module::LegacySyntheticModuleEvaluationSteps evaluation_steps, + Local host_defined_options) { + // TODO(https://crbug.com/545375591): Remove once + // LegacySyntheticModuleEvaluationSteps is gone. +#if (__GNUC__ >= 8) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-function-type" +#endif + // Cast from 'v8::MaybeLocal (*)(v8::Local, + // v8::Local)' to 'v8::MaybeLocal + // (*)(v8::Local, v8::Local)'. Both return types are + // pointer-sized, trivially copyable handle wrappers, so they share the same + // representation. SyntheticModule::Evaluate() checks at runtime that the + // returned value really is a Promise. + auto promise_returning_steps = + reinterpret_cast(evaluation_steps); +#if (__GNUC__ >= 8) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + return CreateSyntheticModule(v8_isolate, module_name, export_names, + promise_returning_steps, host_defined_options); +} +END_ALLOW_USE_DEPRECATED() + Local Module::GetSyntheticModuleHostDefinedOptions() const { auto self = Utils::OpenDirectHandle(this); i::Isolate* i_isolate = i::Isolate::Current(); @@ -3006,6 +3048,7 @@ using TryCatchIsVerboseField = v8::base::BitField; using TryCatchCanContinueField = TryCatchIsVerboseField::Next; using TryCatchCaptureMessageField = TryCatchCanContinueField::Next; using TryCatchRethrowField = TryCatchCaptureMessageField::Next; +using TryCatchIsInternalField = TryCatchRethrowField::Next; } // namespace v8::TryCatch::TryCatch(v8::Isolate* v8_isolate) @@ -3014,7 +3057,8 @@ v8::TryCatch::TryCatch(v8::Isolate* v8_isolate) flags_(TryCatchIsVerboseField::encode(false) | TryCatchCanContinueField::encode(true) | TryCatchCaptureMessageField::encode(true) | - TryCatchRethrowField::encode(false)) { + TryCatchRethrowField::encode(false) | + TryCatchIsInternalField::encode(false)) { ResetInternal(); // Special handling for simulators which have a separate JS stack. js_stack_comparable_address_ = static_cast( @@ -3160,6 +3204,14 @@ void v8::TryCatch::set_rethrow(bool value) { flags_ = TryCatchRethrowField::update(flags_, value); } +bool v8::TryCatch::IsInternal() const { + return TryCatchIsInternalField::decode(flags_); +} + +void v8::TryCatch::SetIsInternal(bool value) { + flags_ = TryCatchIsInternalField::update(flags_, value); +} + // --- M e s s a g e --- Local Message::Get() const { @@ -3477,8 +3529,7 @@ Local StackFrame::GetFunctionName() const { bool StackFrame::IsEval() const { auto self = Utils::OpenDirectHandle(this); - return self->script()->compilation_type() == - i::Script::CompilationType::kEval; + return self->script()->has_eval_origin(); } bool StackFrame::IsConstructor() const { @@ -3610,18 +3661,24 @@ void ValueSerializer::Delegate::FreeBufferMemory(void* buffer) { } struct ValueSerializer::PrivateData { - explicit PrivateData(i::Isolate* i, ValueSerializer::Delegate* delegate) - : isolate(i), serializer(i, delegate) {} + explicit PrivateData( + i::Isolate* i, ValueSerializer::Delegate* delegate, + SharedImmutableArrayBufferMode share_immutable_array_buffer) + : isolate(i), serializer(i, delegate, share_immutable_array_buffer) {} i::Isolate* isolate; i::ValueSerializer serializer; }; -ValueSerializer::ValueSerializer(Isolate* v8_isolate) - : ValueSerializer(v8_isolate, nullptr) {} +ValueSerializer::ValueSerializer( + Isolate* v8_isolate, + SharedImmutableArrayBufferMode share_immutable_array_buffer) + : ValueSerializer(v8_isolate, nullptr, share_immutable_array_buffer) {} -ValueSerializer::ValueSerializer(Isolate* v8_isolate, Delegate* delegate) +ValueSerializer::ValueSerializer( + Isolate* v8_isolate, Delegate* delegate, + SharedImmutableArrayBufferMode share_immutable_array_buffer) : private_(new PrivateData(reinterpret_cast(v8_isolate), - delegate)) {} + delegate, share_immutable_array_buffer)) {} ValueSerializer::~ValueSerializer() { delete private_; } @@ -3631,6 +3688,18 @@ void ValueSerializer::SetTreatArrayBufferViewsAsHostObjects(bool mode) { private_->serializer.SetTreatArrayBufferViewsAsHostObjects(mode); } +std::vector> +ValueSerializer::ReleaseSharedImmutableBackingStores() { + auto i_stores = private_->serializer.ReleaseSharedImmutableBackingStores(); + std::vector> result; + result.reserve(i_stores.size()); + for (auto& bs : i_stores) { + std::shared_ptr bs_base = bs; + result.push_back(std::static_pointer_cast(bs_base)); + } + return result; +} + Maybe ValueSerializer::WriteValue(Local context, Local value) { auto i_isolate = i::Isolate::Current(); @@ -3775,6 +3844,17 @@ void ValueDeserializer::TransferSharedArrayBuffer( transfer_id, Utils::OpenDirectHandle(*shared_array_buffer)); } +void ValueDeserializer::SetSharedImmutableBackingStores( + std::vector> backing_stores) { + std::vector> i_stores; + i_stores.reserve(backing_stores.size()); + for (auto& bs : backing_stores) { + std::shared_ptr bs_base = bs; + i_stores.push_back(std::static_pointer_cast(bs_base)); + } + private_->deserializer.SetSharedImmutableBackingStores(std::move(i_stores)); +} + bool ValueDeserializer::ReadUint32(uint32_t* value) { return private_->deserializer.ReadUint32(value); } @@ -3995,6 +4075,10 @@ bool Value::IsModuleNamespaceObject() const { return IsJSModuleNamespace(*Utils::OpenDirectHandle(this)); } +bool Value::IsDeferredModuleNamespaceObject() const { + return IsJSDeferredModuleNamespace(*Utils::OpenDirectHandle(this)); +} + MaybeLocal Value::ToString(Local context) const { auto obj = Utils::OpenDirectHandle(this); if (i::IsString(*obj)) return ToApiHandle(obj); @@ -5234,24 +5318,13 @@ Maybe Object::SetNativeDataProperty( setter_side_effect_type); } -Maybe Object::SetNativeDataProperty( - v8::Local context, v8::Local name, - AccessorNameGetterCallback getter, AccessorNameSetterCallback setter, - v8::Local data, PropertyAttribute attributes, - SideEffectType getter_side_effect_type, - SideEffectType setter_side_effect_type) { - return ObjectSetAccessor(context, this, name, getter, setter, data, - attributes, false, getter_side_effect_type, - setter_side_effect_type); -} - Maybe Object::SetLazyDataProperty( v8::Local context, v8::Local name, AccessorNameGetterCallback getter, v8::Local data, PropertyAttribute attributes, SideEffectType getter_side_effect_type, SideEffectType setter_side_effect_type) { return ObjectSetAccessor(context, this, name, getter, - static_cast(nullptr), + static_cast(nullptr), data, attributes, true, getter_side_effect_type, setter_side_effect_type); } @@ -5465,10 +5538,10 @@ Local v8::Object::GetCreationContextChecked() { } namespace { +template V8_INLINE void* GetAlignedPointerFromEmbedderDataInCreationContextImpl( - i::DirectHandle object, - i::IsolateForSandbox i_isolate_for_sandbox, int index, - EmbedderDataTypeTag tag) { + i::DirectHandle object, i::Isolate* i_isolate, int index, + TagType tag) { const char* location = "v8::Object::GetAlignedPointerFromEmbedderDataInCreationContext()"; auto maybe_context = object->GetCreationContext(); @@ -5482,8 +5555,7 @@ V8_INLINE void* GetAlignedPointerFromEmbedderDataInCreationContextImpl( // cleared on Detach to avoid leaks). Since we're doing a global proxy // access though, the Isolate's current native context must be the native // context we care about. - i::Isolate* isolate = i::Isolate::Current(); - i::Tagged context = isolate->context(); + i::Tagged context = i_isolate->context(); CHECK_EQ(context->global_proxy(), *object); native_context = context->native_context(); } @@ -5504,8 +5576,7 @@ V8_INLINE void* GetAlignedPointerFromEmbedderDataInCreationContextImpl( static_cast(data->length()))) { void* result; Utils::ApiCheck(i::EmbedderDataSlot(data, index) - .ToAlignedPointer(i_isolate_for_sandbox, &result, - ToExternalPointerTag(tag)), + .ToAlignedPointer(i_isolate, &result, tag), location, "Pointer is not aligned"); return result; } @@ -5521,15 +5592,22 @@ void* v8::Object::GetAlignedPointerFromEmbedderDataInCreationContext( v8::Isolate* isolate, int index, EmbedderDataTypeTag tag) { auto self = Utils::OpenDirectHandle(this); auto i_isolate = reinterpret_cast(isolate); - return GetAlignedPointerFromEmbedderDataInCreationContextImpl(self, i_isolate, - index, tag); + return GetAlignedPointerFromEmbedderDataInCreationContextImpl( + self, i_isolate, index, ToExternalPointerTag(tag)); } void* v8::Object::GetAlignedPointerFromEmbedderDataInCreationContext( int index, EmbedderDataTypeTag tag) { auto self = Utils::OpenDirectHandle(this); - i::IsolateForSandbox isolate = i::GetCurrentIsolateForSandbox(); - return GetAlignedPointerFromEmbedderDataInCreationContextImpl(self, isolate, + return GetAlignedPointerFromEmbedderDataInCreationContextImpl( + self, i::Isolate::Current(), index, ToExternalPointerTag(tag)); +} + +void* v8::Object::GetAlignedPointerFromEmbedderDataInCreationContext( + v8::Isolate* isolate, int index, CppHeapPointerTag tag) { + auto self = Utils::OpenDirectHandle(this); + auto i_isolate = reinterpret_cast(isolate); + return GetAlignedPointerFromEmbedderDataInCreationContextImpl(self, i_isolate, index, tag); } @@ -6281,10 +6359,9 @@ void v8::Object::SetAlignedPointerInInternalField(int index, void* value, const char* location = "v8::Object::SetAlignedPointerInInternalField()"; if (!InternalFieldOK(obj, index, location)) return; - i::DisallowGarbageCollection no_gc; - Utils::ApiCheck(i::EmbedderDataSlot(i::Cast(*obj), index) - .store_aligned_pointer(i::Isolate::Current(), *obj, value, - ToExternalPointerTag(tag)), + Utils::ApiCheck(i::EmbedderDataSlot::store_aligned_pointer( + i::Isolate::Current(), i::Cast(obj), index, + value, ToExternalPointerTag(tag)), location, "Unaligned pointer"); DCHECK_EQ(value, GetAlignedPointerFromInternalField(index, tag)); } @@ -6950,6 +7027,7 @@ bool IsJSReceiverSafeToFreeze(i::InstanceType obj_type) { return true; #if V8_ENABLE_WEBASSEMBLY case i::WASM_ARRAY_TYPE: + case i::WASM_CUSTOM_MAP_TYPE: case i::WASM_STRUCT_TYPE: case i::WASM_TAG_OBJECT_TYPE: #endif // V8_ENABLE_WEBASSEMBLY @@ -8273,11 +8351,6 @@ FastIterateResult FastIterateArray(DirectHandle array, void* callback_data) { // Instead of relying on callers to check condition, this function returns // {kSlowPath} for situations it can't handle. - // Most code paths below don't allocate, and rely on {callback} not allocating - // either, but this isn't enforced with {DisallowHeapAllocation} to allow - // embedders to allocate error objects before terminating the iteration. - // Since {callback} must not allocate anyway, we can get away with fake - // handles, reducing per-element overhead. if (!CanUseFastIteration(isolate, array)) return FastIterateResult::kSlowPath; using Result = v8::Array::CallbackResult; DisallowJavascriptExecution no_js(isolate); @@ -8289,14 +8362,12 @@ FastIterateResult FastIterateArray(DirectHandle array, case PACKED_FROZEN_ELEMENTS: case PACKED_SEALED_ELEMENTS: case PACKED_NONEXTENSIBLE_ELEMENTS: { - Tagged elements = Cast(array->elements()); - for (uint32_t i = 0; i < length; i++) { - Tagged element = elements->get(static_cast(i)); - // TODO(13270): When we switch to CSS, we can pass {element} to - // the callback directly, without {fake_handle}. - IndirectHandle fake_handle( - reinterpret_cast(&element)); - Result result = callback(i, Utils::ToLocal(fake_handle), callback_data); + DirectHandle elements(Cast(array->elements()), + isolate); + FOR_WITH_HANDLE_SCOPE(isolate, uint32_t i = 0, i, i < length, i++) { + DirectHandle element(elements->get(static_cast(i)), + isolate); + Result result = callback(i, Utils::ToLocal(element), callback_data); if (result != Result::kContinue) { return static_cast(result); } @@ -8309,16 +8380,16 @@ FastIterateResult FastIterateArray(DirectHandle array, case HOLEY_SEALED_ELEMENTS: case HOLEY_NONEXTENSIBLE_ELEMENTS: case HOLEY_ELEMENTS: { - Tagged elements = Cast(array->elements()); - for (uint32_t i = 0; i < length; i++) { - Tagged element = elements->get(static_cast(i)); - // TODO(13270): When we switch to CSS, we can pass {element} to - // the callback directly, without {fake_handle}. - auto fake_handle = - IsTheHole(element) - ? isolate->factory()->undefined_value() - : IndirectHandle(reinterpret_cast(&element)); - Result result = callback(i, Utils::ToLocal(fake_handle), callback_data); + DirectHandle elements(Cast(array->elements()), + isolate); + FOR_WITH_HANDLE_SCOPE(isolate, uint32_t i = 0, i, i < length, i++) { + DirectHandle element(elements->get(static_cast(i)), + isolate); + DirectHandle value = + IsTheHole(*element) + ? DirectHandle(isolate->factory()->undefined_value()) + : element; + Result result = callback(i, Utils::ToLocal(value), callback_data); if (result != Result::kContinue) { return static_cast(result); } @@ -8334,10 +8405,10 @@ FastIterateResult FastIterateArray(DirectHandle array, FOR_WITH_HANDLE_SCOPE(isolate, uint32_t i = 0, i, i < length, i++) { DirectHandle value; if (elements->is_the_hole(i)) { - value = Handle(isolate->factory()->undefined_value()); + value = isolate->factory()->undefined_value(); #ifdef V8_ENABLE_UNDEFINED_DOUBLE } else if (elements->is_undefined(i)) { - value = Handle(isolate->factory()->undefined_value()); + value = isolate->factory()->undefined_value(); #endif // V8_ENABLE_UNDEFINED_DOUBLE } else { value = isolate->factory()->NewNumber(elements->get_scalar(i)); @@ -8351,32 +8422,32 @@ FastIterateResult FastIterateArray(DirectHandle array, return FastIterateResult::kFinished; } case DICTIONARY_ELEMENTS: { - DisallowGarbageCollection no_gc; - Tagged dict = array->element_dictionary(); struct Entry { uint32_t index; InternalIndex entry; }; std::vector sorted; - sorted.reserve(dict->NumberOfElements()); - ReadOnlyRoots roots(isolate); - for (InternalIndex i : dict->IterateEntries()) { - Tagged key = dict->KeyAt(i); - if (!dict->IsKey(roots, key)) continue; - uint32_t index = - static_cast(Object::NumberValue(Cast(key))); - sorted.push_back({index, i}); + DirectHandle dict(array->element_dictionary(), isolate); + { + DisallowGarbageCollection no_gc; + ReadOnlyRoots roots(isolate); + sorted.reserve(dict->NumberOfElements()); + for (InternalIndex i : dict->IterateEntries()) { + Tagged key = dict->KeyAt(i); + if (!dict->IsKey(roots, key)) continue; + uint32_t index = + static_cast(Object::NumberValue(Cast(key))); + sorted.push_back({index, i}); + } + std::sort( + sorted.begin(), sorted.end(), + [](const Entry& a, const Entry& b) { return a.index < b.index; }); } - std::sort( - sorted.begin(), sorted.end(), - [](const Entry& a, const Entry& b) { return a.index < b.index; }); - for (const Entry& entry : sorted) { - Tagged value = dict->ValueAt(entry.entry); - // TODO(13270): When we switch to CSS, we can pass {element} to - // the callback directly, without {fake_handle}. - IndirectHandle fake_handle(reinterpret_cast(&value)); + FOR_WITH_HANDLE_SCOPE(isolate, size_t i = 0, i, i < sorted.size(), i++) { + const Entry& entry = sorted[i]; + DirectHandle value(dict->ValueAt(entry.entry), isolate); Result result = - callback(entry.index, Utils::ToLocal(fake_handle), callback_data); + callback(entry.index, Utils::ToLocal(value), callback_data); if (result != Result::kContinue) { return static_cast(result); } @@ -8986,16 +9057,17 @@ MaybeLocal WasmModuleObject::FromCompiledModule( #endif // V8_ENABLE_WEBASSEMBLY } -#if V8_ENABLE_WEBASSEMBLY -namespace { -MaybeLocal CompileWasmModuleImpl( +MaybeLocal WasmModuleObject::Compile( + Isolate* v8_isolate, std::span wire_bytes) { + return Compile(v8_isolate, wire_bytes, CompileOptions{}); +} + +MaybeLocal WasmModuleObject::Compile( Isolate* v8_isolate, std::span wire_bytes, - i::wasm::CompileTimeImports compile_imports) { - // Mirror the JS `WebAssembly.Module` constructor, which disables denormal - // floats at compile time when the host FPU flushes them. - if (base::FPU::GetFlushDenormals()) { - compile_imports.Add(i::wasm::CompileTimeImport::kDisableDenormalFloats); - } + const CompileOptions& options) { +#if V8_ENABLE_WEBASSEMBLY + i::wasm::CompileTimeImports compile_imports = + i::wasm::CompileTimeImportsFromOptions(options); base::OwnedVector bytes = base::OwnedCopyOf(wire_bytes); i::Isolate* i_isolate = reinterpret_cast(v8_isolate); // We don't check for `IsWasmCodegenAllowed` here, because this function is @@ -9008,42 +9080,13 @@ MaybeLocal CompileWasmModuleImpl( i::wasm::WasmEnabledFeatures::FromIsolate(i_isolate); maybe_compiled = i::wasm::GetWasmEngine()->SyncCompile( i_isolate, enabled_features, std::move(compile_imports), &thrower, - std::move(bytes)); + std::move(bytes), + base::Vector(options.source_url.data(), + options.source_url.size())); } CHECK_EQ(maybe_compiled.is_null(), i_isolate->has_exception()); if (maybe_compiled.is_null()) return {}; return Utils::ToLocal(maybe_compiled.ToHandleChecked()); -} -} // namespace -#endif // V8_ENABLE_WEBASSEMBLY - -MaybeLocal WasmModuleObject::Compile( - Isolate* v8_isolate, std::span wire_bytes) { -#if V8_ENABLE_WEBASSEMBLY - return CompileWasmModuleImpl(v8_isolate, wire_bytes, - i::wasm::CompileTimeImports{}); -#else - Utils::ApiCheck(false, "WasmModuleObject::Compile", - "WebAssembly support is not enabled"); - UNREACHABLE(); -#endif // V8_ENABLE_WEBASSEMBLY -} - -MaybeLocal WasmModuleObject::Compile( - Isolate* v8_isolate, std::span wire_bytes, - const CompileTimeImports& compile_imports) { -#if V8_ENABLE_WEBASSEMBLY - i::wasm::CompileTimeImports imports; - using Builtins = CompileTimeImports::Builtins; - if (compile_imports.builtins & Builtins::kJsString) { - imports.Add(i::wasm::CompileTimeImport::kJsString); - } - if (compile_imports.imported_string_constants_module != nullptr) { - imports.constants_module() = - compile_imports.imported_string_constants_module; - imports.Add(i::wasm::CompileTimeImport::kStringConstants); - } - return CompileWasmModuleImpl(v8_isolate, wire_bytes, std::move(imports)); #else Utils::ApiCheck(false, "WasmModuleObject::Compile", "WebAssembly support is not enabled"); @@ -10454,26 +10497,12 @@ i::ValueHelper::InternalRepresentationType Isolate::GetDataFromSnapshotOnce( return GetSerializedDataFromFixedArray(i_isolate, list, index); } -Local Isolate::GetContinuationPreservedEmbedderData() { - i::Isolate* i_isolate = reinterpret_cast(this); -#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA - return ToApiHandle(i::direct_handle( - i_isolate->isolate_data()->continuation_preserved_embedder_data(), - i_isolate)); -#else // V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA - return v8::Undefined(reinterpret_cast(i_isolate)); -#endif // V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA +Local Isolate::GetContinuationPreservedEmbedderData() { + return GetContinuationPreservedEmbedderDataV2(); } -void Isolate::SetContinuationPreservedEmbedderData(Local data) { -#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA - i::Isolate* i_isolate = reinterpret_cast(this); - if (data.IsEmpty()) { - data = v8::Undefined(reinterpret_cast(this)); - } - i_isolate->isolate_data()->set_continuation_preserved_embedder_data( - *Utils::OpenDirectHandle(*data)); -#endif // V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA +void Isolate::SetContinuationPreservedEmbedderData(Local data) { + SetContinuationPreservedEmbedderDataV2(data); } Local Isolate::GetContinuationPreservedEmbedderDataV2() { @@ -10856,8 +10885,8 @@ int Isolate::ContextDisposedNotification(bool dependant_context) { } void Isolate::ContextDisposedNotification(ContextDependants dependants) { - // TODO(mlippautz): Replace implementation with the old version of - // ContextDisposedNotification() that still has a return parameter. + // TODO(mlippautz): Move implementation here once the deprecated version of + // ContextDisposedNotification() with the return parameter is removed. START_ALLOW_USE_DEPRECATED() ContextDisposedNotification(dependants == ContextDependants::kSomeDependants); END_ALLOW_USE_DEPRECATED() @@ -11249,7 +11278,6 @@ bool v8::Object::IsCodeLike(v8::Isolate* v8_isolate) const { } // static -#ifdef V8_CPPGC_MICROTASK_QUEUE MicrotaskQueue* MicrotaskQueue::New(Isolate* v8_isolate, MicrotasksPolicy policy) { auto* microtask_queue = @@ -11257,16 +11285,6 @@ MicrotaskQueue* MicrotaskQueue::New(Isolate* v8_isolate, microtask_queue->set_microtasks_policy(policy); return microtask_queue; } -#else -std::unique_ptr MicrotaskQueue::New(Isolate* v8_isolate, - MicrotasksPolicy policy) { - auto microtask_queue = - i::MicrotaskQueue::New(reinterpret_cast(v8_isolate)); - microtask_queue->set_microtasks_policy(policy); - std::unique_ptr ret(std::move(microtask_queue)); - return ret; -} -#endif // V8_CPPGC_MICROTASK_QUEUE MicrotasksScope::MicrotasksScope(Local v8_context, MicrotasksScope::Type type) diff --git a/deps/v8/src/ast/modules.cc b/deps/v8/src/ast/modules.cc index ec77ed50c058..067f460c7085 100644 --- a/deps/v8/src/ast/modules.cc +++ b/deps/v8/src/ast/modules.cc @@ -55,7 +55,7 @@ bool SourceTextModuleDescriptor::ModuleRequestComparer::operator()( return false; } -void SourceTextModuleDescriptor::AddImport( +bool SourceTextModuleDescriptor::AddImport( const AstRawString* import_name, const AstRawString* local_name, const AstRawString* specifier, const ModuleImportPhase import_phase, const ImportAttributes* import_attributes, const Scanner::Location loc, @@ -65,10 +65,10 @@ void SourceTextModuleDescriptor::AddImport( entry->import_name = import_name; entry->module_request = AddModuleRequest( specifier, import_phase, import_attributes, specifier_loc, zone); - AddRegularImport(entry); + return AddRegularImport(entry); } -void SourceTextModuleDescriptor::AddStarImport( +bool SourceTextModuleDescriptor::AddStarImport( const AstRawString* local_name, const AstRawString* specifier, const ModuleImportPhase import_phase, const ImportAttributes* import_attributes, const Scanner::Location loc, @@ -77,7 +77,7 @@ void SourceTextModuleDescriptor::AddStarImport( entry->local_name = local_name; entry->module_request = AddModuleRequest( specifier, import_phase, import_attributes, specifier_loc, zone); - AddNamespaceImport(entry, zone); + return AddNamespaceImport(entry, zone); } void SourceTextModuleDescriptor::AddEmptyImport( diff --git a/deps/v8/src/ast/modules.h b/deps/v8/src/ast/modules.h index 6f2e56ceea31..8adecf4c5f87 100644 --- a/deps/v8/src/ast/modules.h +++ b/deps/v8/src/ast/modules.h @@ -35,20 +35,20 @@ class SourceTextModuleDescriptor : public ZoneObject { // import x from "foo.js"; // import {x} from "foo.js"; // import {x as y} from "foo.js"; - void AddImport(const AstRawString* import_name, - const AstRawString* local_name, const AstRawString* specifier, - const ModuleImportPhase import_phase, - const ImportAttributes* import_attributes, - const Scanner::Location loc, - const Scanner::Location specifier_loc, Zone* zone); + V8_NODISCARD bool AddImport( + const AstRawString* import_name, const AstRawString* local_name, + const AstRawString* specifier, const ModuleImportPhase import_phase, + const ImportAttributes* import_attributes, 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* specifier, - const ModuleImportPhase import_phase, - const ImportAttributes* import_attributes, - const Scanner::Location loc, - const Scanner::Location specifier_loc, Zone* zone); + V8_NODISCARD bool AddStarImport(const AstRawString* local_name, + const AstRawString* specifier, + const ModuleImportPhase import_phase, + const ImportAttributes* import_attributes, + const Scanner::Location loc, + const Scanner::Location specifier_loc, + Zone* zone); // import "foo.js"; // import {} from "foo.js"; @@ -214,23 +214,20 @@ class SourceTextModuleDescriptor : public ZoneObject { special_exports_.push_back(entry); } - void AddRegularImport(Entry* entry) { + V8_NODISCARD bool AddRegularImport(Entry* entry) { DCHECK_NOT_NULL(entry->import_name); DCHECK_NOT_NULL(entry->local_name); DCHECK_NULL(entry->export_name); DCHECK_LE(0, entry->module_request); - regular_imports_.emplace(entry->local_name, entry); - // We don't care if there's already an entry for this local name, as in that - // case we will report an error when declaring the variable. + return regular_imports_.emplace(entry->local_name, entry).second; } - void AddNamespaceImport(const Entry* entry, Zone* zone) { + V8_NODISCARD bool AddNamespaceImport(const Entry* entry, Zone* zone) { DCHECK_NULL(entry->import_name); DCHECK_NULL(entry->export_name); DCHECK_NOT_NULL(entry->local_name); DCHECK_LE(0, entry->module_request); - DCHECK_EQ(0, namespace_imports_.count(entry->local_name)); - namespace_imports_.emplace(entry->local_name, entry); + return namespace_imports_.emplace(entry->local_name, entry).second; } template diff --git a/deps/v8/src/ast/scopes.cc b/deps/v8/src/ast/scopes.cc index 61b61e5c470e..59d8ca6bbbf4 100644 --- a/deps/v8/src/ast/scopes.cc +++ b/deps/v8/src/ast/scopes.cc @@ -3063,6 +3063,7 @@ void DeclarationScope::AllocateScopeInfos(ParseInfo* parse_info, } } else { scope_info = Cast(info); + if (scope_info->IsEmpty()) continue; } while (true) { if (scope_info == outer) break; @@ -3074,8 +3075,7 @@ void DeclarationScope::AllocateScopeInfos(ParseInfo* parse_info, // TODO(crbug.com/401059828): remove once crashes are gone. int last_checked_field_index = 0; bool equal_scopes = - it->second->Equals(scope_info, parse_info_sfi->live_edited(), - &last_checked_field_index); + it->second->Equals(scope_info, &last_checked_field_index); std::unique_ptr script_name_or_url; size_t script_name_or_url_length = 0; diff --git a/deps/v8/src/ast/variables.h b/deps/v8/src/ast/variables.h index b0bb07054510..7c83c3357184 100644 --- a/deps/v8/src/ast/variables.h +++ b/deps/v8/src/ast/variables.h @@ -296,11 +296,13 @@ class Variable final : public ZoneObject { int index() const { return index_; } + // LINT.IfChange(VariableIsReceiver) bool IsReceiver() const { DCHECK(IsParameter()); return index_ == -1; } + // LINT.ThenChange(/src/debug/debug-scope-info.cc:VariableIsReceiver) bool IsExport() const { DCHECK_EQ(location(), VariableLocation::MODULE); diff --git a/deps/v8/src/base/atomic-utils.h b/deps/v8/src/base/atomic-utils.h index 36052304c469..4959538d1e8b 100644 --- a/deps/v8/src/base/atomic-utils.h +++ b/deps/v8/src/base/atomic-utils.h @@ -112,8 +112,15 @@ class AsAtomicImpl { template static T SeqCst_Swap(T* addr, std::remove_reference_t new_value) { static_assert(sizeof(T) <= sizeof(AtomicStorageType)); - return base::SeqCst_AtomicExchange( - to_storage_addr(addr), cast_helper::to_storage_type(new_value)); + return cast_helper::to_return_type(base::SeqCst_AtomicExchange( + to_storage_addr(addr), cast_helper::to_storage_type(new_value))); + } + + template + static T Relaxed_Swap(T* addr, std::remove_reference_t new_value) { + static_assert(sizeof(T) <= sizeof(AtomicStorageType)); + return cast_helper::to_return_type(base::Relaxed_AtomicExchange( + to_storage_addr(addr), cast_helper::to_storage_type(new_value))); } template diff --git a/deps/v8/src/base/cpu/cpu-riscv.cc b/deps/v8/src/base/cpu/cpu-riscv.cc index c78292eed1e4..91fe06b3564c 100644 --- a/deps/v8/src/base/cpu/cpu-riscv.cc +++ b/deps/v8/src/base/cpu/cpu-riscv.cc @@ -63,6 +63,12 @@ void CPU::DetectFeatures() { if (pairs[0].value & RISCV_HWPROBE_EXT_ZFA) { has_zfa_ = true; } + if (pairs[0].value & RISCV_HWPROBE_EXT_ZFH) { + has_zfh_ = true; + } + if (pairs[0].value & RISCV_HWPROBE_EXT_ZVFH) { + has_zvfh_ = true; + } if (pairs[0].value & RISCV_HWPROBE_IMA_C) { has_rvc_ = true; } diff --git a/deps/v8/src/base/cpu/cpu-x86.cc b/deps/v8/src/base/cpu/cpu-x86.cc index 74256e4b8dcc..96ba25d15b2f 100644 --- a/deps/v8/src/base/cpu/cpu-x86.cc +++ b/deps/v8/src/base/cpu/cpu-x86.cc @@ -137,6 +137,12 @@ void CPU::DetectFeatures() { has_fma3_ = (cpu_info[2] & 0x00001000) != 0; has_f16c_ = (cpu_info[2] & 0x20000000) != 0; has_apx_f_ = (cpu_info71[3] & 0x00200000) != 0; + if ((cpu_info71[3] & 0x00080000) != 0 && num_ids >= 0x24) { + int cpu_info24[4] = {0}; + __cpuid(cpu_info24, 0x24); + has_avx10_1_ = (cpu_info24[1] & 0xff) >= 1; + DCHECK_IMPLIES(has_avx10_1_, (cpu_info24[1] & 0x70000) == 0x70000); + } // CET shadow stack feature flag. See // https://en.wikipedia.org/wiki/CPUID#EAX=7,_ECX=0:_Extended_Features has_cetss_ = (cpu_info70[2] & 0x00000080) != 0; diff --git a/deps/v8/src/base/cpu/cpu.cc b/deps/v8/src/base/cpu/cpu.cc index f5e72eeedc94..2a4551e4400f 100644 --- a/deps/v8/src/base/cpu/cpu.cc +++ b/deps/v8/src/base/cpu/cpu.cc @@ -201,6 +201,7 @@ bool CPU::StarboardDetectCPU() { has_popcnt_ = features.x86.has_popcnt; has_f16c_ = features.x86.has_f16c; // TODO(jiepan): Support APX_F on STARBOARD + // TODO(fanchen): Support AVX10.1 on STARBOARD break; default: return false; diff --git a/deps/v8/src/base/cpu/cpu.h b/deps/v8/src/base/cpu/cpu.h index 1d434bf9ffe1..363cc715748a 100644 --- a/deps/v8/src/base/cpu/cpu.h +++ b/deps/v8/src/base/cpu/cpu.h @@ -97,6 +97,7 @@ class V8_BASE_EXPORT CPU final { bool has_lzcnt() const { return has_lzcnt_; } bool has_popcnt() const { return has_popcnt_; } bool has_apx_f() const { return has_apx_f_; } + bool has_avx10_1() const { return has_avx10_1_; } bool is_atom() const { return is_atom_; } bool has_intel_jcc_erratum() const { return has_intel_jcc_erratum_; } bool has_cetss() const { return has_cetss_; } @@ -145,6 +146,8 @@ class V8_BASE_EXPORT CPU final { bool has_zbs() const { return has_zbs_; } bool has_zfa() const { return has_zfa_; } bool has_rvc() const { return has_rvc_; } + bool has_zfh() const { return has_zfh_; } + bool has_zvfh() const { return has_zvfh_; } enum class RV_MMU_MODE { kRiscvSV39, kRiscvSV48, @@ -202,6 +205,7 @@ class V8_BASE_EXPORT CPU final { bool has_lzcnt_ = false; bool has_popcnt_ = false; bool has_apx_f_ = false; + bool has_avx10_1_ = false; bool has_idiva_ = false; bool has_neon_ = false; bool has_thumb2_ = false; @@ -231,6 +235,8 @@ class V8_BASE_EXPORT CPU final { bool has_zbb_ = false; bool has_zbs_ = false; bool has_zfa_ = false; + bool has_zfh_ = false; + bool has_zvfh_ = false; bool has_rvc_ = false; bool has_lsx_ = false; bool has_lasx_ = false; diff --git a/deps/v8/src/base/debug/stack_trace_win.cc b/deps/v8/src/base/debug/stack_trace_win.cc index f981bec61019..7b3b430668b9 100644 --- a/deps/v8/src/base/debug/stack_trace_win.cc +++ b/deps/v8/src/base/debug/stack_trace_win.cc @@ -52,6 +52,12 @@ long WINAPI StackDumpExceptionFilter(EXCEPTION_POINTERS* info) { // NOLINT bool InitializeSymbols() { if (g_initialized_symbols) return g_init_error == ERROR_SUCCESS; g_initialized_symbols = true; + + // Starting in SDK 10.0.28000, dbghelp loads msdia140.dll dynamically at + // runtime, so preload it before initializing DbgHelp. + if (!::GetModuleHandle(L"msdia140.dll")) { + ::LoadLibrary(L"msdia140.dll"); + } // Defer symbol load until they're needed, use undecorated names, and get line // numbers. SymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES); diff --git a/deps/v8/src/base/macros.h b/deps/v8/src/base/macros.h index c123f8476261..c2c24e8229a1 100644 --- a/deps/v8/src/base/macros.h +++ b/deps/v8/src/base/macros.h @@ -668,8 +668,8 @@ static_assert(V8_ENABLE_SIMD128); #endif // defined(__clang__) // Disable/enable -Wlifetime-safety warnings in code. -#if defined(__clang__) -#if defined(__has_warning) && __has_warning("-Wlifetime-safety") +#if defined(__clang__) && defined(__has_warning) && \ + __has_warning("-Wlifetime-safety") #define START_IGNORE_LIFETIME_SAFETY_WARNINGS() \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wlifetime-safety\"") @@ -677,15 +677,11 @@ static_assert(V8_ENABLE_SIMD128); #else #define START_IGNORE_LIFETIME_SAFETY_WARNINGS() #define END_IGNORE_LIFETIME_SAFETY_WARNINGS() -#endif // __has_warning("-Wlifetime-safety") -#else -#define START_IGNORE_LIFETIME_SAFETY_WARNINGS() -#define END_IGNORE_LIFETIME_SAFETY_WARNINGS() #endif // defined(__clang__) // Disable/enable -Wreturn-stack-address warnings in code. -#if defined(__clang__) -#if defined(__has_warning) && __has_warning("-Wreturn-stack-address") +#if defined(__clang__) && defined(__has_warning) && \ + __has_warning("-Wreturn-stack-address") #define START_IGNORE_RETURN_STACK_ADDRESS_WARNINGS() \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wreturn-stack-address\"") @@ -694,10 +690,6 @@ static_assert(V8_ENABLE_SIMD128); #else #define START_IGNORE_RETURN_STACK_ADDRESS_WARNINGS() #define END_IGNORE_RETURN_STACK_ADDRESS_WARNINGS() -#endif // __has_warning("-Wreturn-stack-address") -#else -#define START_IGNORE_RETURN_STACK_ADDRESS_WARNINGS() -#define END_IGNORE_RETURN_STACK_ADDRESS_WARNINGS() #endif // defined(__clang__) #endif // V8_BASE_MACROS_H_ diff --git a/deps/v8/src/base/memcopy.h b/deps/v8/src/base/memcopy.h index cb24d63a48fa..4c2bea25979a 100644 --- a/deps/v8/src/base/memcopy.h +++ b/deps/v8/src/base/memcopy.h @@ -9,6 +9,8 @@ #include #include +#include +#include #include "include/v8config.h" #include "src/base/base-export.h" @@ -208,6 +210,15 @@ inline void MemCopyAndSwitchEndianness(void* dst, const void* src, COPY_LOOP(uint32_t, bits::ByteReverse32); case 8: COPY_LOOP(uint64_t, bits::ByteReverse64); + case 16: + for (uint32_t i = 0; i < num_elements; i++) { + const uint8_t* s = reinterpret_cast(src) + i * 16; + uint8_t* d = reinterpret_cast(dst) + i * 16; + for (size_t j = 0; j < 16; j++) { + d[j] = s[15 - j]; + } + } + return; default: UNREACHABLE(); } @@ -215,11 +226,59 @@ inline void MemCopyAndSwitchEndianness(void* dst, const void* src, } #endif +// Helper to replicate an integral `value` across all bytes of a uintptr_t word. +template + requires std::is_integral_v +constexpr uintptr_t ReplicateValueWord(T value) { + if constexpr (sizeof(T) >= sizeof(uintptr_t)) { + return static_cast(value); + } else { + using UnsignedT = std::conditional_t< + sizeof(T) == 1, uint8_t, + std::conditional_t< + sizeof(T) == 2, uint16_t, + std::conditional_t>>; + constexpr uintptr_t kMultiplier = + static_cast(-1) / std::numeric_limits::max(); + return static_cast(static_cast(value)) * kMultiplier; + } +} + // Fills `destination` with `count` `value`s. template -inline void Relaxed_Memset(T* destination, T value, size_t count) +V8_INLINE void Relaxed_Memset(T* destination, T value, size_t count) requires std::is_integral_v { +#if defined(__ATOMIC_RELAXED) && (defined(__GNUC__) || defined(__clang__)) + if constexpr (sizeof(T) < sizeof(uintptr_t)) { + constexpr size_t kElementsPerWord = sizeof(uintptr_t) / sizeof(T); + // Prologue: store elements until `destination` is word-aligned. + while (reinterpret_cast(destination) % sizeof(uintptr_t) != 0 && + count > 0) { + std::atomic_ref(*destination).store(value, std::memory_order_relaxed); + destination++; + count--; + } + // Main loop: store word-sized chunks using may_alias attribute and + // __atomic_store_n. + using AliasedWord = uintptr_t __attribute__((may_alias)); + const uintptr_t word_val = ReplicateValueWord(value); + AliasedWord* word_dest = reinterpret_cast(destination); + size_t words = count / kElementsPerWord; + for (size_t w = 0; w < words; w++) { + __atomic_store_n(word_dest + w, word_val, __ATOMIC_RELAXED); + } + destination += words * kElementsPerWord; + count -= words * kElementsPerWord; + // Epilogue: store remaining trailing elements. + while (count > 0) { + std::atomic_ref(*destination).store(value, std::memory_order_relaxed); + destination++; + count--; + } + return; + } +#endif for (size_t i = 0; i < count; i++) { std::atomic_ref(destination[i]).store(value, std::memory_order_relaxed); } diff --git a/deps/v8/src/base/memory.h b/deps/v8/src/base/memory.h index 642d945bf12e..de1c1b3c3f7d 100644 --- a/deps/v8/src/base/memory.h +++ b/deps/v8/src/base/memory.h @@ -37,12 +37,10 @@ static inline V ReadUnalignedValue(const char p[sizeof(V)]) { return ReadUnalignedValue(reinterpret_cast
(p)); } -#if !defined(V8_OS_SOLARIS) template static inline V ReadUnalignedValue(const int8_t p[sizeof(V)]) { return ReadUnalignedValue(reinterpret_cast
(p)); } -#endif template static inline V ReadUnalignedValue(const uint8_t p[sizeof(V)]) { diff --git a/deps/v8/src/base/platform/platform-aix.cc b/deps/v8/src/base/platform/platform-aix.cc index 3593f36239a9..c718cbf9b5b4 100644 --- a/deps/v8/src/base/platform/platform-aix.cc +++ b/deps/v8/src/base/platform/platform-aix.cc @@ -191,26 +191,9 @@ bool OS::DecommitPages(void* address, size_t size) { // with MAP_FIXED will fail and return -1 unless the application has requested // SPEC1170 compliant behaviour: // https://www.ibm.com/docs/en/aix/7.3?topic=m-mmap-mmap64-subroutine - // As a workaround we use `mprotect` to make the page inaccessible and - // `madvise` to hint the OS to release the memory. - // - // NOTE: On AIX, madvise() is a no-op and does not release physical - // memory. The pages remain protected but the physical memory may only be - // reclaimed by the OS under memory pressure. This trade-off is acceptable - // because: - // 1. It fixes critical race conditions (Refs: - // https://github.com/nodejs/node/issues/62647) - // 2. AIX's disclaim64() requires writable pages, incompatible with PROT_NONE - // protection - // 3. The alternative munmap/mmap approach causes "Check failed: ptr == - // address" errors - // 4. Pages are inaccessible, preventing memory corruption - DCHECK_EQ(0, reinterpret_cast(address) % CommitPageSize()); DCHECK_EQ(0, size % CommitPageSize()); if (mprotect(address, size, PROT_NONE) != 0) return false; - if (madvise(static_cast(address), size, MADV_DONTNEED) != 0) - return false; return true; } diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc index df122799fdca..7add12aa4798 100644 --- a/deps/v8/src/base/platform/platform-posix.cc +++ b/deps/v8/src/base/platform/platform-posix.cc @@ -82,19 +82,7 @@ #define MAP_ANONYMOUS MAP_ANON #endif -/* - * NOTE: illumos starting with illumos#14418 (pushed April 20th, 2022) - * prototypes madvise(3C) properly with a `void *` first argument. - * The only way to detect this outside of configure-time checking is to - * check for the existence of MEMCNTL_SHARED, which gets defined for the first - * time in illumos#14418 under the same circumstances save _STRICT_POSIX, which - * thankfully neither Solaris nor illumos builds of Node or V8 do. - * - * If some future illumos push changes the MEMCNTL_SHARED assumptions made - * above, the illumos check below will have to be revisited. This check - * will work on both pre-and-post illumos#14418 illumos environments. - */ -#if defined(V8_OS_SOLARIS) && !(defined(__illumos__) && defined(MEMCNTL_SHARED)) +#if defined(V8_OS_SOLARIS) #if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__) extern "C" int madvise(caddr_t, size_t, int); #else diff --git a/deps/v8/src/base/platform/platform-solaris.cc b/deps/v8/src/base/platform/platform-solaris.cc index 374728a2eaa2..c991d2edac54 100644 --- a/deps/v8/src/base/platform/platform-solaris.cc +++ b/deps/v8/src/base/platform/platform-solaris.cc @@ -89,23 +89,5 @@ Stack::StackSlot Stack::ObtainCurrentThreadStackStart() { return nullptr; } -// static -Stack::StackSlot Stack::ObtainCurrentThreadStackReservedLimit() { - pthread_attr_t attr; - int error; - pthread_attr_init(&attr); - error = pthread_attr_get_np(pthread_self(), &attr); - if (!error) { - void* base; - size_t size; - error = pthread_attr_getstack(&attr, &base, &size); - CHECK(!error); - pthread_attr_destroy(&attr); - return base; - } - pthread_attr_destroy(&attr); - return nullptr; -} - } // namespace base } // namespace v8 diff --git a/deps/v8/src/baseline/arm64/baseline-assembler-arm64-inl.h b/deps/v8/src/baseline/arm64/baseline-assembler-arm64-inl.h index b3ed4cfd284c..27399c6235f6 100644 --- a/deps/v8/src/baseline/arm64/baseline-assembler-arm64-inl.h +++ b/deps/v8/src/baseline/arm64/baseline-assembler-arm64-inl.h @@ -181,6 +181,40 @@ void BaselineAssembler::JumpIfSmi(Condition cc, Register lhs, Register rhs, __ AssertSmi(rhs); __ CompareTaggedAndBranch(lhs, rhs, cc, target); } + +#ifdef V8_ENABLE_SPARKPLUG_PLUS +void BaselineAssembler::JumpIfNotBothSmi(Register lhs, Register rhs, + Label* target, Label::Distance) { + ScratchRegisterScope scope(this); + Register tmp = scope.AcquireScratch(); + __ Orr(tmp, lhs, rhs); + __ JumpIfNotSmi(tmp, target); +} + +void BaselineAssembler::JumpIfTagged(Condition cc, Register lhs, Register rhs, + Label* target, Label::Distance) { + __ CompareTaggedAndBranch(lhs, rhs, cc, target); +} + +void BaselineAssembler::SmiAddConstantAndJumpIfOverflow(Register value, + int constant, + Label* overflow, + Label::Distance) { + DCHECK(Smi::IsValid(constant)); + ScratchRegisterScope scope(this); + Register tmp = scope.AcquireScratch(); + if (SmiValuesAre31Bits()) { + __ Adds(tmp.W(), value.W(), Operand(Smi::FromInt(constant))); + __ B(overflow, vs); + __ Sxtw(value, tmp.W()); + } else { + __ Adds(tmp, value, Operand(Smi::FromInt(constant))); + __ B(overflow, vs); + __ Mov(value, tmp); + } +} +#endif // V8_ENABLE_SPARKPLUG_PLUS + void BaselineAssembler::JumpIfTagged(Condition cc, Register value, MemOperand operand, Label* target, Label::Distance) { diff --git a/deps/v8/src/baseline/baseline-assembler.h b/deps/v8/src/baseline/baseline-assembler.h index 406da59cb5ce..d5aebea695f4 100644 --- a/deps/v8/src/baseline/baseline-assembler.h +++ b/deps/v8/src/baseline/baseline-assembler.h @@ -236,6 +236,24 @@ class BaselineAssembler { inline void Word32And(Register output, Register lhs, int rhs); +#ifdef V8_ENABLE_SPARKPLUG_PLUS + // Jumps to |target| unless both |lhs| and |rhs| are Smis, using a single + // merged tag test. + inline void JumpIfNotBothSmi(Register lhs, Register rhs, Label* target, + Label::Distance distance = Label::kFar); + + // Compares two tagged values without asserting that they are Smis. + inline void JumpIfTagged(Condition cc, Register lhs, Register rhs, + Label* target, + Label::Distance distance = Label::kFar); + + // value := value + Smi(constant). Jumps to |overflow| when the result is not + // a valid Smi. + inline void SmiAddConstantAndJumpIfOverflow( + Register value, int constant, Label* overflow, + Label::Distance distance = Label::kFar); +#endif // V8_ENABLE_SPARKPLUG_PLUS + inline void Switch(Register reg, int case_value_base, Label** labels, int num_labels); diff --git a/deps/v8/src/baseline/baseline-compiler.cc b/deps/v8/src/baseline/baseline-compiler.cc index 7f2475c08355..304dc849ac9c 100644 --- a/deps/v8/src/baseline/baseline-compiler.cc +++ b/deps/v8/src/baseline/baseline-compiler.cc @@ -1471,26 +1471,108 @@ void BaselineCompiler::VisitShiftRightLogicalSmi() { #endif // V8_ENABLE_SPARKPLUG_PLUS #undef VISIT_TYPED_BINARY_OPERATION +#ifdef V8_ENABLE_SPARKPLUG_PLUS +template +bool BaselineCompiler::TryEmitInlineSmiUnary( + BinaryOperationFeedback::Type feedback_type, int feedback_index_offset) { + static_assert(kOperation == Operation::kIncrement || + kOperation == Operation::kDecrement); + if (!v8_flags.sparkplug_inline_smi) { + return false; + } + if (feedback_type != BinaryOperationFeedback::Type::kSignedSmall) { + return false; + } + + ASM_CODE_COMMENT_STRING(&masm_, "inlined Smi unary fast path"); + constexpr int kDelta = kOperation == Operation::kIncrement ? 1 : -1; + Label slow, done; + __ JumpIfNotSmi(kInterpreterAccumulatorRegister, &slow, Label::kNear); + // Smi overflow bails out so that the stub records kNumber for the patcher. + __ SmiAddConstantAndJumpIfOverflow(kInterpreterAccumulatorRegister, kDelta, + &slow, Label::kNear); + __ Jump(&done); + + __ Bind(&slow); + if (allow_sparkplug_plus_) { + CallBuiltin(kInterpreterAccumulatorRegister, + feedback_index_offset); + } else { + CallBuiltin(kInterpreterAccumulatorRegister, + feedback_index_offset); + } + __ Bind(&done); + + return true; +} +#endif // V8_ENABLE_SPARKPLUG_PLUS + +// Inc/Dec/Negate/BitwiseNot are single-operand bytecodes; the embedded +// feedback lives at kUnaryEmbeddedFeedbackOperandIndex (unlike binop/compare +// bytecodes, which use kEmbeddedFeedbackOperandIndex). +#ifdef V8_ENABLE_SPARKPLUG_PLUS +#define TYPED_UNOP_CASE(type, name) \ + case BinaryOperationFeedback::Type::k##type: \ + CallBuiltin( \ + kInterpreterAccumulatorRegister, feedback_index_offset); \ + break; + +#define VISIT_TYPED_UNARY_OPERATION(TypedStubList, Name) \ + using Feedback = BinaryOperationFeedback; \ + auto feedback_index_offset = iterator().GetEmbeddedFeedbackOffset( \ + kUnaryEmbeddedFeedbackOperandIndex); \ + auto feedback_type = \ + Feedback::DecodeTypeIndex(static_cast( \ + EmbeddedFeedback(kUnaryEmbeddedFeedbackOperandIndex))); \ + if constexpr (Operation::k##Name == Operation::kIncrement || \ + Operation::k##Name == Operation::kDecrement) { \ + if (TryEmitInlineSmiUnary( \ + feedback_type, feedback_index_offset)) { \ + return; \ + } \ + } \ + if (allow_sparkplug_plus_) { \ + switch (feedback_type) { \ + TypedStubList(TYPED_UNOP_CASE, Name) default \ + : CallBuiltin( \ + kInterpreterAccumulatorRegister, feedback_index_offset); \ + break; \ + } \ + } else { \ + CallBuiltin( \ + kInterpreterAccumulatorRegister, feedback_index_offset); \ + } +#else +#define VISIT_TYPED_UNARY_OPERATION(TypedStubList, Name) \ + auto feedback_index_offset = iterator().GetEmbeddedFeedbackOffset( \ + kUnaryEmbeddedFeedbackOperandIndex); \ + CallBuiltin( \ + kInterpreterAccumulatorRegister, feedback_index_offset); +#endif // V8_ENABLE_SPARKPLUG_PLUS + void BaselineCompiler::VisitInc() { - CallBuiltin(kInterpreterAccumulatorRegister, - FeedbackSlot(0)); + VISIT_TYPED_UNARY_OPERATION(TYPED_UNARY_STUB_LIST, Increment); } void BaselineCompiler::VisitDec() { - CallBuiltin(kInterpreterAccumulatorRegister, - FeedbackSlot(0)); + VISIT_TYPED_UNARY_OPERATION(TYPED_UNARY_STUB_LIST, Decrement); } void BaselineCompiler::VisitNegate() { - CallBuiltin(kInterpreterAccumulatorRegister, - FeedbackSlot(0)); + VISIT_TYPED_UNARY_OPERATION(TYPED_NEGATE_STUB_LIST, Negate); } void BaselineCompiler::VisitBitwiseNot() { - CallBuiltin(kInterpreterAccumulatorRegister, - FeedbackSlot(0)); + VISIT_TYPED_UNARY_OPERATION(TYPED_UNARY_STUB_LIST, BitwiseNot); } +#ifdef V8_ENABLE_SPARKPLUG_PLUS +#undef TYPED_UNOP_CASE +#endif // V8_ENABLE_SPARKPLUG_PLUS +#undef VISIT_TYPED_UNARY_OPERATION + void BaselineCompiler::VisitToBooleanLogicalNot() { SelectBooleanConstant(kInterpreterAccumulatorRegister, [&](Label* if_true, Label::Distance distance) { @@ -1892,6 +1974,81 @@ void BaselineCompiler::VisitConstructForwardAllArgs() { FeedbackSlotAsTagged(1)); // kSlot } +#ifdef V8_ENABLE_SPARKPLUG_PLUS +template +bool BaselineCompiler::TryEmitInlineSmiCompare( + CompareOperationFeedback::Type feedback_type, int feedback_index_offset) { + static_assert(IsComparisonOperation(kOperation)); + if (!v8_flags.sparkplug_inline_smi) { + return false; + } + if (feedback_type != CompareOperationFeedback::Type::kSignedSmall) { + return false; + } + + ASM_CODE_COMMENT_STRING(&masm_, "inlined Smi compare fast path"); + Label slow, done; + { + BaselineAssembler::ScratchRegisterScope scratch_scope(&basm_); + Register lhs = scratch_scope.AcquireScratch(); + __ Move(lhs, RegisterOperand(0)); + if constexpr (kOperation == Operation::kEqual || + kOperation == Operation::kStrictEqual) { + // Equal Smis have identical tagged values, so check lhs first and let a + // tagged-equal hit return true without checking rhs. Only the not-equal + // edge needs to verify rhs before returning false. + __ JumpIfNotSmi(lhs, &slow, Label::kNear); + } else { + __ JumpIfNotBothSmi(lhs, kInterpreterAccumulatorRegister, &slow, + Label::kNear); + } + + SelectBooleanConstant( + kInterpreterAccumulatorRegister, + [&](Label* if_true, Label::Distance distance) { + if constexpr (kOperation == Operation::kEqual || + kOperation == Operation::kStrictEqual) { + __ JumpIfTagged(kEqual, lhs, kInterpreterAccumulatorRegister, + if_true, distance); + // SelectBooleanConstant evaluates the condition before writing its + // output register, so the accumulator still holds the rhs on the + // path to `slow`. + __ JumpIfNotSmi(kInterpreterAccumulatorRegister, &slow, + Label::kNear); + } else if constexpr (kOperation == Operation::kLessThan) { + __ JumpIfTagged(kLessThan, lhs, kInterpreterAccumulatorRegister, + if_true, distance); + } else if constexpr (kOperation == Operation::kLessThanOrEqual) { + __ JumpIfTagged(kLessThanEqual, lhs, + kInterpreterAccumulatorRegister, if_true, distance); + } else if constexpr (kOperation == Operation::kGreaterThan) { + __ JumpIfTagged(kLessThan, kInterpreterAccumulatorRegister, lhs, + if_true, distance); + } else { + static_assert(kOperation == Operation::kGreaterThanOrEqual); + __ JumpIfTagged(kLessThanEqual, kInterpreterAccumulatorRegister, + lhs, if_true, distance); + } + }); + } + __ Jump(&done); + + __ Bind(&slow); + if (allow_sparkplug_plus_) { + CallBuiltin(RegisterOperand(0), + kInterpreterAccumulatorRegister, + feedback_index_offset); + } else { + CallBuiltin(RegisterOperand(0), + kInterpreterAccumulatorRegister, + feedback_index_offset); + } + __ Bind(&done); + + return true; +} +#endif // V8_ENABLE_SPARKPLUG_PLUS + #ifdef V8_ENABLE_SPARKPLUG_PLUS #define TYPED_COMPARE_CASE(type, name) \ case CompareOperationFeedback::Type::k##type: \ @@ -1904,9 +2061,17 @@ void BaselineCompiler::VisitConstructForwardAllArgs() { using Feedback = CompareOperationFeedback; \ auto feedback_index_offset = \ iterator().GetEmbeddedFeedbackOffset(kEmbeddedFeedbackOperandIndex); \ + auto feedback_type = \ + Feedback::DecodeTypeIndex(static_cast( \ + EmbeddedFeedback(kEmbeddedFeedbackOperandIndex))); \ + if (TryEmitInlineSmiCompare( \ + feedback_type, feedback_index_offset)) { \ + return; \ + } \ if (allow_sparkplug_plus_) { \ - switch (Feedback::DecodeTypeIndex(static_cast( \ - EmbeddedFeedback(kEmbeddedFeedbackOperandIndex)))) { \ + switch (feedback_type) { \ TypedStubList(TYPED_COMPARE_CASE, Name) default \ : CallBuiltin( \ RegisterOperand(0), kInterpreterAccumulatorRegister, \ diff --git a/deps/v8/src/baseline/baseline-compiler.h b/deps/v8/src/baseline/baseline-compiler.h index 60b862f63dc5..724996805a55 100644 --- a/deps/v8/src/baseline/baseline-compiler.h +++ b/deps/v8/src/baseline/baseline-compiler.h @@ -11,6 +11,7 @@ #include "src/base/threaded-list.h" #include "src/base/vlq.h" #include "src/baseline/baseline-assembler.h" +#include "src/common/operation.h" #include "src/execution/local-isolate.h" #include "src/handles/handles.h" #include "src/interpreter/bytecode-array-iterator.h" @@ -138,6 +139,24 @@ class BaselineCompiler { void SelectBooleanConstant( Register output, std::function jump_func); +#ifdef V8_ENABLE_SPARKPLUG_PLUS + // Emits an inlined Smi compare for |kOperation|, followed by a slow-path + // call to |kSmiStub|. Returns false without emitting anything when inlining + // is disabled or when the compile-time embedded feedback hint is not exactly + // kSignedSmall. + template + bool TryEmitInlineSmiCompare(CompareOperationFeedback::Type feedback_type, + int feedback_index_offset); + + // Emits an inlined Smi Inc/Dec for |kOperation|, followed by a slow-path + // call to |kSmiStub|. Returns false without emitting anything when inlining + // is disabled or when the compile-time embedded feedback hint is not exactly + // kSignedSmall. + template + bool TryEmitInlineSmiUnary(BinaryOperationFeedback::Type feedback_type, + int feedback_index_offset); +#endif // V8_ENABLE_SPARKPLUG_PLUS + // Jumps based on calling ToBoolean on kInterpreterAccumulatorRegister. void JumpIfToBoolean(bool do_jump_if_true, Label* label, Label::Distance distance = Label::kFar); diff --git a/deps/v8/src/baseline/loong64/baseline-assembler-loong64-inl.h b/deps/v8/src/baseline/loong64/baseline-assembler-loong64-inl.h index f2260abc26d6..3398e47e6b4d 100644 --- a/deps/v8/src/baseline/loong64/baseline-assembler-loong64-inl.h +++ b/deps/v8/src/baseline/loong64/baseline-assembler-loong64-inl.h @@ -179,6 +179,41 @@ void BaselineAssembler::JumpIfTagged(Condition cc, MemOperand operand, __ CompareTaggedAndBranch(target, cc, scratch, Operand(value)); } +#ifdef V8_ENABLE_SPARKPLUG_PLUS +void BaselineAssembler::JumpIfNotBothSmi(Register lhs, Register rhs, + Label* target, Label::Distance) { + ScratchRegisterScope temps(this); + Register scratch = temps.AcquireScratch(); + __ Or(scratch, lhs, rhs); + __ JumpIfNotSmi(scratch, target); +} + +void BaselineAssembler::JumpIfTagged(Condition cc, Register lhs, Register rhs, + Label* target, Label::Distance) { + __ CompareTaggedAndBranch(target, cc, lhs, Operand(rhs)); +} + +void BaselineAssembler::SmiAddConstantAndJumpIfOverflow(Register value, + int constant, + Label* overflow, + Label::Distance) { + DCHECK(Smi::IsValid(constant)); + ScratchRegisterScope temps(this); + Register scratch1 = temps.AcquireScratch(); + Register scratch2 = temps.AcquireScratch(); + if (SmiValuesAre31Bits()) { + __ slli_w(scratch1, value, 0); + __ Add_w(scratch2, scratch1, Operand(Smi::FromInt(constant))); + __ Branch(overflow, constant > 0 ? lt : gt, scratch2, Operand(scratch1)); + __ Move(value, scratch2); + } else { + __ Add_d(scratch1, value, Operand(Smi::FromInt(constant))); + __ Branch(overflow, constant > 0 ? lt : gt, scratch1, Operand(value)); + __ Move(value, scratch1); + } +} +#endif // V8_ENABLE_SPARKPLUG_PLUS + #ifdef V8_STATIC_ROOTS void BaselineAssembler::JumpIfStaticRootToBoolean( Register value, Label* true_target, Label::Distance true_distance, diff --git a/deps/v8/src/baseline/x64/baseline-assembler-x64-inl.h b/deps/v8/src/baseline/x64/baseline-assembler-x64-inl.h index 7e0deb1d3fc7..ac3f109e7f2a 100644 --- a/deps/v8/src/baseline/x64/baseline-assembler-x64-inl.h +++ b/deps/v8/src/baseline/x64/baseline-assembler-x64-inl.h @@ -180,6 +180,43 @@ void BaselineAssembler::JumpIfSmi(Condition cc, Register lhs, Register rhs, __ j(cc, target, distance); } +#ifdef V8_ENABLE_SPARKPLUG_PLUS +void BaselineAssembler::JumpIfNotBothSmi(Register lhs, Register rhs, + Label* target, + Label::Distance distance) { + ScratchRegisterScope temps(this); + Register tmp = temps.AcquireScratch(); + __ movq(tmp, lhs); + __ orq(tmp, rhs); + __ JumpIfNotSmi(tmp, target, distance); +} + +void BaselineAssembler::JumpIfTagged(Condition cc, Register lhs, Register rhs, + Label* target, Label::Distance distance) { + __ cmp_tagged(lhs, rhs); + __ j(cc, target, distance); +} + +void BaselineAssembler::SmiAddConstantAndJumpIfOverflow( + Register value, int constant, Label* overflow, Label::Distance distance) { + DCHECK(Smi::IsValid(constant)); + ScratchRegisterScope scope(this); + Register tmp = scope.AcquireScratch(); + if (SmiValuesAre31Bits()) { + __ movl(tmp, value); + __ addl(tmp, Immediate(Smi::FromInt(constant))); + __ j(kOverflow, overflow, distance); + __ movsxlq(value, tmp); + } else { + DCHECK(SmiValuesAre32Bits()); + __ Move(tmp, Smi::FromInt(constant)); + __ addq(tmp, value); + __ j(kOverflow, overflow, distance); + __ movq(value, tmp); + } +} +#endif // V8_ENABLE_SPARKPLUG_PLUS + void BaselineAssembler::JumpIfImmediate(Condition cc, Register left, int right, Label* target, Label::Distance distance) { @@ -234,7 +271,7 @@ void BaselineAssembler::JumpIfStaticRootToBoolean( void BaselineAssembler::JumpIfByte(Condition cc, Register value, int32_t byte, Label* target, Label::Distance distance) { - __ cmpb(value, Immediate(byte)); + __ Cmpb(value, byte); __ j(cc, target, distance); } @@ -479,7 +516,7 @@ void BaselineAssembler::LdaContextSlotNoCell(Register context, uint32_t index, if (COMPRESS_POINTERS_BOOL && compression_mode == CompressionMode::kForceDecompression) { - __ addq(tagged.reg(), kPtrComprCageBaseRegister); + __ orq(tagged.reg(), kPtrComprCageBaseRegister); } } } @@ -499,7 +536,7 @@ void BaselineAssembler::StaContextSlotNoCell(Register context, Register value, } if (COMPRESS_POINTERS_BOOL) { // Decompress tagged pointer. - __ addq(tagged.reg(), kPtrComprCageBaseRegister); + __ orq(tagged.reg(), kPtrComprCageBaseRegister); } } StoreTaggedFieldWithWriteBarrier(context, Context::OffsetOfElementAt(index), diff --git a/deps/v8/src/bigint/bigint-inl.h b/deps/v8/src/bigint/bigint-inl.h index ccc66a14a664..9cf5721a5fd0 100644 --- a/deps/v8/src/bigint/bigint-inl.h +++ b/deps/v8/src/bigint/bigint-inl.h @@ -1023,7 +1023,60 @@ inline std::pair ModuloSmall(RWDigits& R, Digits& A, Digits& B) { return {false, 0}; } +ALWAYS_INLINE digit_t Processor::CachedModFold(RWDigits& R, Digits& A, + digit_t c) { + Digits& B = GetCachedDivisor(); + uint32_t n = B.len(); + DCHECK(n >= 2); + DCHECK(n <= A.len() && A.len() <= 2 * n); + DCHECK(R.len() == n); + + // Each column sums A[i] + A[n+i]*c + carry, which for digit base D is at + // most (D-1) + (D-1)^2 + (D-1) == D^2 - 1. It therefore fits in two digits + // and {carry} stays single-digit for any {c}, including ~digit_t{0}. + digit_t carry = 0; + for (uint32_t i = 0; i < n; ++i) { + digit_t high = 0; + // A is always at least n digits: the only caller is {BigIntModulusImpl}, + // which returns early when |x| < |y|. + digit_t low = A[i]; + if (n + i < A.len()) { + digit_t product_low = digit_mul(A[n + i], c, &high); + digit_t add_carry; + low = digit_add2(low, product_low, &add_carry); + high += add_carry; + } + digit_t sum_carry; + R[i] = digit_add2(low, carry, &sum_carry); + DCHECK(high <= ~digit_t{0} - sum_carry); + carry = high + sum_carry; + } + + if (carry) { + digit_t product_high; + digit_t product_low = digit_mul(carry, c, &product_high); + R[0] = digit_add2(R[0], product_low, &carry); + carry += product_high; + for (uint32_t i = 1; i < n && carry; ++i) { + R[i] = digit_add2(R[i], carry, &carry); + } + } + + while (carry || GreaterThanOrEqual(R, B)) { + carry -= InplaceSubAndReturnBorrow(R, B); + } + + return R[n - 1]; +} + ALWAYS_INLINE digit_t Processor::CachedMod(RWDigits& R, Digits& A) { + digit_t c = GetCachedModFoldFactor(); + if (c != 0) { + // A fold-armed divisor leaves {cached_inverse_} allocated but stale; this + // path never reads it. + return CachedModFold(R, A, c); + } + Digits& B = GetCachedDivisor(); Digits& inv = GetCachedInverse(); uint32_t n = B.len(); diff --git a/deps/v8/src/bigint/bigint-internal.cc b/deps/v8/src/bigint/bigint-internal.cc index 5ad6b0686a42..601d49579d04 100644 --- a/deps/v8/src/bigint/bigint-internal.cc +++ b/deps/v8/src/bigint/bigint-internal.cc @@ -135,10 +135,45 @@ void ProcessorImpl::CachedMod_MakeInverse(Digits& B) { // from concurrent mutation. Digits& cached_B = GetCachedDivisor(); CHECK(cached_B.msd() != 0); // {B} must have been canonicalized. - // We can't use {GetSmallScratch()} here, because {DivideSchoolbook} already - // does that (usually). It's fine because we don't expect to call this - // function very often. - ScratchDigits A(n * 2, platform()); + + set_cached_mod_fold_factor(0); + + // {CachedMod} relies on the "small scratch" having been allocated, so make + // sure that has happened regardless of {DivideSchoolbook}'s internal + // decisions, and of which of the two paths below we take. + GetSmallScratch(); + + // We can't use {GetSmallScratch()} for the working space below, because + // {DivideSchoolbook} already does that (usually). It's fine because we don't + // expect to call this function very often. One allocation serves both the + // fold check below and the inverse computation afterwards, which needs + // {n * 2} digits. + ScratchDigits scratch(n + 1 + 2 + n, platform()); + + { + // T := 1 << (n * kDigitBits), i.e. the smallest power of the digit base + // above the divisor. If T == q * B + C has a small q and a single-digit C, + // then C is the factor {CachedModFold} folds the dividend's high half by. + RWDigits T(scratch, 0, n + 1); + T.Clear(); + T[n] = 1; + + RWDigits Q(scratch, n + 1, 2); + RWDigits R(scratch, n + 3, n); + DivideSchoolbook(Q, R, T, cached_B); + + Q.Normalize(); + R.Normalize(); + // Cap the quotient so the corrective while loop in {CachedModFold} doesn't + // have to subtract the divisor too many times. + constexpr digit_t kMaxFoldQuotient = 4; + if (Q.len() == 1 && Q[0] <= kMaxFoldQuotient && R.len() == 1) { + set_cached_mod_fold_factor(R[0]); + return; + } + } + + RWDigits A(scratch, 0, n * 2); // The idea is to set A = 1 << 2*n, and then compute Inv = A / B. However, // having that lone "1" bit in A's top digit is inefficient and far-reaching: // it requires us to make Inv bigger too. So we use a trick: first we @@ -159,11 +194,6 @@ void ProcessorImpl::CachedMod_MakeInverse(Digits& B) { // corrective loop in {CachedDiv}. But don't do it when there's a risk // of overflowing {inv}. if (Inv[0] != ~digit_t{0} || Inv.msd() != ~digit_t{0}) Add(Inv, 1); - - // {CachedMod} relies on the "small scratch" having been allocated, so - // make sure that has happened regardless of {DivideSchoolbook}'s internal - // decisions. - GetSmallScratch(); } void Processor::CachedMod_MakeInverse(Digits& B) { diff --git a/deps/v8/src/bigint/bigint.h b/deps/v8/src/bigint/bigint.h index 87e8c5a1a3db..80d6a5cfec1c 100644 --- a/deps/v8/src/bigint/bigint.h +++ b/deps/v8/src/bigint/bigint.h @@ -403,6 +403,15 @@ class Processor { RWDigits& AllocateCachedInverseFor(Digits& divisor); + // Crandall reduction, used by {CachedMod} when the cached divisor is close + // enough to a power of the digit base for {c} to be armed. + digit_t CachedModFold(RWDigits& R, Digits& A, digit_t c); + + digit_t GetCachedModFoldFactor() { return cached_mod_fold_factor_; } + void set_cached_mod_fold_factor(digit_t factor) { + cached_mod_fold_factor_ = factor; + } + // TODO(jkummerow): Consider merging ProcessorImpl and Processor. std::unique_ptr platform_; Status status_{Status::kOk}; @@ -415,6 +424,7 @@ class Processor { RWDigits cached_inverse_{nullptr, 0}; uint32_t cached_inverse_allocated_length_{0}; int divisor_count_{0}; + digit_t cached_mod_fold_factor_{0}; }; inline uint32_t AddResultLength(uint32_t x_length, uint32_t y_length) { diff --git a/deps/v8/src/builtins/accessors.cc b/deps/v8/src/builtins/accessors.cc index ec95489e5a25..313ac22137cd 100644 --- a/deps/v8/src/builtins/accessors.cc +++ b/deps/v8/src/builtins/accessors.cc @@ -22,6 +22,7 @@ #include "src/objects/js-function.h" #include "src/objects/literal-objects-inl.h" #include "src/objects/module-inl.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/property-details.h" #include "src/objects/prototype.h" @@ -635,6 +636,15 @@ class FrameFunctionIterator { if (frame_iterator_.done()) return; JavaScriptFrame* frame = frame_iterator_.frame(); summaries_ = frame->Summarize(); +#if V8_ENABLE_WEBASSEMBLY + if (summaries_.size() == 0) { + // We skip method wrappers from summaries and stack traces, because + // they are not interesting. + DCHECK_EQ(frame->function()->shared()->builtin_id(), + Builtin::kWasmMethodWrapper); + return; + } +#endif // V8_ENABLE_WEBASSEMBLY inlined_frame_index_ = static_cast(summaries_.size()); DCHECK_LT(0, inlined_frame_index_); } diff --git a/deps/v8/src/builtins/arm/builtins-arm.cc b/deps/v8/src/builtins/arm/builtins-arm.cc index 93648514cbd4..7fdedb6e0048 100644 --- a/deps/v8/src/builtins/arm/builtins-arm.cc +++ b/deps/v8/src/builtins/arm/builtins-arm.cc @@ -3025,6 +3025,7 @@ void SwitchStacks(MacroAssembler* masm, ExternalReference fn, void ReloadParentStack(MacroAssembler* masm, Register return_reg, Register return_value, Register context, Register tmp1, Register tmp2, Register tmp3) { + DCHECK(!AreAliased(tmp1, tmp2, tmp3)); Register active_stack = tmp1; __ LoadRootRelative(active_stack, IsolateData::active_stack_offset()); @@ -3037,7 +3038,10 @@ void ReloadParentStack(MacroAssembler* masm, Register return_reg, // Switch stack! SwitchStacks(masm, ExternalReference::wasm_return_jspi_stack(), parent, nullptr, no_reg, {return_reg, return_value, context, parent}); + __ ldr(tmp1, MemOperand(parent, wasm::kStackPcOffset)); LoadJumpBuffer(masm, parent, false, tmp3); + __ str(tmp1, + MemOperand(fp, WasmJspiFrameConstants::kParentReturnAddressOffset)); } void RestoreParentSuspender(MacroAssembler* masm, Register tmp1) { @@ -3280,6 +3284,9 @@ namespace { // forwards the value, the onRejected variant throws the value. void Generate_WasmResumeHelper(MacroAssembler* masm, wasm::OnResume on_resume) { + __ cmp(kJavaScriptCallArgCountRegister, Operand(JSParameterCount(1))); + __ Check(eq, AbortReason::kJSSignatureMismatch); + auto regs = RegisterAllocator::WithAllocatableGeneralRegisters(); __ EnterFrame(StackFrame::WASM_JSPI); @@ -3739,6 +3746,10 @@ void SwitchBackAndReturnPromise(MacroAssembler* masm, RegisterAllocator& regs, FREE_REG(promise); FREE_REG(return_value); __ bind(return_promise); + // The initial wrapper and a resume callback have different argument cleanup. + __ ldr(tmp, + MemOperand(fp, WasmJspiFrameConstants::kParentReturnAddressOffset)); + __ bx(tmp); } void GenerateExceptionHandlingLandingPad(MacroAssembler* masm, @@ -3962,6 +3973,7 @@ void JSToWasmWrapperHelper(MacroAssembler* masm, wasm::Promise mode) { Label return_promise; if (stack_switch) { SwitchBackAndReturnPromise(masm, regs, mode, &return_promise); + __ Trap(); // Unreachable. } __ bind(&suspend); @@ -5076,7 +5088,7 @@ void Builtins::Generate_RestartFrameTrampoline(MacroAssembler* masm) { __ LeaveFrame(StackFrame::INTERNAL); // The arguments are already in the stack, but we might need to adapt them - // if the function signature changed (e.g. via LiveEdit). + // if the function signature changed. __ ldr(r2, FieldMemOperand(r1, offsetof(JSFunction, shared_function_info_))); __ ldrh(r2, FieldMemOperand( r2, offsetof(SharedFunctionInfo, formal_parameter_count_))); diff --git a/deps/v8/src/builtins/arm64/builtins-arm64.cc b/deps/v8/src/builtins/arm64/builtins-arm64.cc index 26f396576fd9..083e3f09db8b 100644 --- a/deps/v8/src/builtins/arm64/builtins-arm64.cc +++ b/deps/v8/src/builtins/arm64/builtins-arm64.cc @@ -3607,6 +3607,7 @@ void SwitchStacks(MacroAssembler* masm, ExternalReference fn, void ReloadParentStack(MacroAssembler* masm, Register return_reg, Register return_value, Register context, Register tmp1, Register tmp2, Register tmp3) { + DCHECK(!AreAliased(tmp1, tmp2, tmp3)); Register active_stack = tmp1; __ LoadRootRelative(active_stack, IsolateData::active_stack_offset()); @@ -3619,7 +3620,10 @@ void ReloadParentStack(MacroAssembler* masm, Register return_reg, // Switch stack! SwitchStacks(masm, ExternalReference::wasm_return_jspi_stack(), parent, nullptr, no_reg, {return_reg, return_value, context, parent}); + __ Ldr(tmp1, MemOperand(parent, wasm::kStackPcOffset)); LoadJumpBuffer(masm, parent, false, tmp3); + __ Str(tmp1, + MemOperand(fp, WasmJspiFrameConstants::kParentReturnAddressOffset)); } void RestoreParentSuspender(MacroAssembler* masm, Register tmp1) { @@ -3858,6 +3862,9 @@ namespace { // forwards the value, the onRejected variant throws the value. void Generate_WasmResumeHelper(MacroAssembler* masm, wasm::OnResume on_resume) { + __ Cmp(kJavaScriptCallArgCountRegister, JSParameterCount(1)); + __ Check(eq, AbortReason::kJSSignatureMismatch); + auto regs = RegisterAllocator::WithAllocatableGeneralRegisters(); __ EnterFrame(StackFrame::WASM_JSPI); @@ -4301,6 +4308,10 @@ void SwitchBackAndReturnPromise(MacroAssembler* masm, RegisterAllocator& regs, FREE_REG(promise); FREE_REG(return_value); __ bind(return_promise); + // The initial wrapper and a resume callback have different argument cleanup. + __ Ldr(tmp, + MemOperand(fp, WasmJspiFrameConstants::kParentReturnAddressOffset)); + __ Br(tmp); } void GenerateExceptionHandlingLandingPad(MacroAssembler* masm, @@ -4548,6 +4559,7 @@ void JSToWasmWrapperHelper(MacroAssembler* masm, wasm::Promise mode) { Label return_promise; if (stack_switch) { SwitchBackAndReturnPromise(masm, regs, mode, &return_promise); + __ Trap(); // Unreachable. } __ Bind(&suspend, BranchTargetIdentifier::kBtiJump); @@ -5768,7 +5780,7 @@ void Builtins::Generate_RestartFrameTrampoline(MacroAssembler* masm) { __ LeaveFrame(StackFrame::INTERPRETED); // The arguments are already in the stack, but we might need to adapt them - // if the function signature changed (e.g. via LiveEdit). + // if the function signature changed. __ InvokeFunction(x1, x0, InvokeType::kJump, ArgumentAdaptionMode::kAdapt); } diff --git a/deps/v8/src/builtins/array-from.tq b/deps/v8/src/builtins/array-from.tq index 9e1cbe9229b2..b8ceeaf41a78 100644 --- a/deps/v8/src/builtins/array-from.tq +++ b/deps/v8/src/builtins/array-from.tq @@ -66,7 +66,7 @@ transitioning javascript builtin ArrayFrom( const fastIteratorResultMap = GetIteratorResultMap(); // d. Let k be 0. - let k: Smi = 0; + let k: Number = 0; // e. Repeat, while (true) { // i. If k ≥ 2^53-1, then @@ -164,7 +164,7 @@ transitioning javascript builtin ArrayFrom( } // 11. Let k be 0. - let k: Smi = 0; + let k: Number = 0; // 12. Repeat, while k < len while (k < len) { // a. Let Pk be ! ToString(k). diff --git a/deps/v8/src/builtins/array-join.tq b/deps/v8/src/builtins/array-join.tq index c9ec15e06ea2..324013960e34 100644 --- a/deps/v8/src/builtins/array-join.tq +++ b/deps/v8/src/builtins/array-join.tq @@ -351,19 +351,20 @@ macro BufferJoin(implicit context: Context)(buffer: Buffer, sep: String): transitioning macro FastArrayJoin( implicit context: Context)(kind: constexpr ElementsKind, - array: FastJSArrayForRead, sep: String, lengthNumber: Number): String { + array: FastJSArrayForRead, sep: String, lengthNumber: Number): String + labels Bailout { // Check early if the separators might overflow. let len: uintptr = Convert(lengthNumber); // Fast array length is guaranteed to fit in Smi. - dcheck(len <= Convert(kMaxFastArrayLength)); - static_assert(Convert(kMaxFastArrayLength) < kSmiMaxValue); + dcheck(len <= Convert(kFixedArrayMaxLength)); + static_assert(Convert(kFixedArrayMaxLength) < kSmiMaxValue); // If separatorLength <= 1, fast arrays cannot overflow the separator counter // or exceed kStringMaxLength from separators alone, because their maximum // length is bounded by kMaxFastArrayLength (32MB) which is much smaller // than kStringMaxLength (268MB/536MB). Thus we only need to perform checks // if separatorLength > 1. static_assert( - (Convert(kMaxFastArrayLength) - 1) <= + (Convert(kFixedArrayMaxLength) - 1) <= Convert(kStringMaxLength)); const separatorLength: intptr = sep.length_intptr; @@ -428,7 +429,6 @@ transitioning macro FastArrayJoin( } } else { - dcheck(IsSmiElementsKind(kind)); const fixedArray: FixedArray = UnsafeCast(elements); const element: Object = fixedArray.objects[k++]; if constexpr (IsHoleyElementsKind(kind)) { @@ -436,8 +436,37 @@ transitioning macro FastArrayJoin( continue; } } - const smiValue = UnsafeCast(element); - next = SmiToString(smiValue); + if constexpr (IsSmiElementsKind(kind)) { + const smiValue = UnsafeCast(element); + next = SmiToString(smiValue); + } else { + typeswitch (element) { + case (str: String): { + if (str == kEmptyString) { + continue; + } + next = str; + } + case (smi: Smi): { + next = SmiToString(smi); + } + case (heapNum: HeapNumber): { + next = NumberToString(heapNum); + } + case (Undefined): { + continue; + } + case (Null): { + continue; + } + case (b: Boolean): { + next = b.to_string; + } + case (Object): { + goto Bailout; + } + } + } } // d. Set R to the string-concatenation of R and next. @@ -852,30 +881,44 @@ transitioning builtin ArrayPrototypeJoinImpl( dcheck(len <= kMaxArrayLength); try { - const castResult = CastFastJSArrayForRead(o) otherwise NotFastJSArray; + const castResult = CastFastJSArrayForRead(o) otherwise Fallback; const fastO = castResult.object; const elementsKind = castResult.elementsKind; if (IsFastSmiElementsKind(elementsKind)) { if (IsHoleyFastElementsKind(elementsKind)) { return FastArrayJoin( - ElementsKind::HOLEY_SMI_ELEMENTS, fastO, separator, len); + ElementsKind::HOLEY_SMI_ELEMENTS, fastO, separator, len) + otherwise Fallback; } else { return FastArrayJoin( - ElementsKind::PACKED_SMI_ELEMENTS, fastO, separator, len); + ElementsKind::PACKED_SMI_ELEMENTS, fastO, separator, len) + otherwise Fallback; } } else if (IsDoubleElementsKind(elementsKind)) { if (IsHoleyFastElementsKind(elementsKind)) { return FastArrayJoin( - ElementsKind::HOLEY_DOUBLE_ELEMENTS, fastO, separator, len); + ElementsKind::HOLEY_DOUBLE_ELEMENTS, fastO, separator, len) + otherwise Fallback; + } else { + return FastArrayJoin( + ElementsKind::PACKED_DOUBLE_ELEMENTS, fastO, separator, len) + otherwise Fallback; + } + } else if (IsFastElementsKind(elementsKind)) { + if (IsHoleyFastElementsKind(elementsKind)) { + return FastArrayJoin( + ElementsKind::HOLEY_ELEMENTS, fastO, separator, len) + otherwise Fallback; } else { return FastArrayJoin( - ElementsKind::PACKED_DOUBLE_ELEMENTS, fastO, separator, len); + ElementsKind::PACKED_ELEMENTS, fastO, separator, len) + otherwise Fallback; } } // Fall through. - } label NotFastJSArray { + } label Fallback { // Fall through. } diff --git a/deps/v8/src/builtins/array-lastindexof.tq b/deps/v8/src/builtins/array-lastindexof.tq index bd7180394237..ac8bd9e83740 100644 --- a/deps/v8/src/builtins/array-lastindexof.tq +++ b/deps/v8/src/builtins/array-lastindexof.tq @@ -3,66 +3,133 @@ // found in the LICENSE file. namespace array { -macro LoadWithHoleCheck( - elements: FixedArrayBase, index: Smi): JSAny - labels IfHole; - -LoadWithHoleCheck( - implicit context: Context)(elements: FixedArrayBase, index: Smi): JSAny - labels IfHole { - const elements: FixedArray = UnsafeCast(elements); - const element: Object = elements.objects[index]; - if (element == TheHole) goto IfHole; - return UnsafeCast(element); +macro ClampLastIndexOfFrom(from: Smi, elementsLen: Smi): Smi { + // Bug(898785): Due to side-effects in the evaluation of `fromIndex` + // the {from} can be out-of-bounds here, so we need to clamp {k} to + // the {elements} length. We might be reading holes / hole NaNs still + // due to that, but those will be ignored below. + if (from >= elementsLen) { + return elementsLen - 1; + } + return from; } -LoadWithHoleCheck( - implicit context: Context)(elements: FixedArrayBase, index: Smi): JSAny - labels IfHole { - const elements: FixedDoubleArray = UnsafeCast(elements); - try { - const element: float64 = - elements.values[index].Value() otherwise IfUndefined, - IfHole; - return AllocateHeapNumberWithValue(element); - } label IfUndefined { - return Undefined; +macro LastIndexOfNumberInFixedArray( + elements: FixedArray, from: Smi, search: Number): Smi { + const searchNum: float64 = Convert(search); + if (Float64IsNaN(searchNum)) return -1; + + let k: Smi = from; + while (k >= 0) { + const element = UnsafeCast<(JSAny | TheHole)>(elements.objects[k]); + if (TaggedEqual(element, search)) return k; + typeswitch (element) { + case (n: Number): { + if (searchNum == Convert(n)) return k; + } + case (JSAny | TheHole): { + // Fallthrough. + } + } + --k; } + return -1; } -macro FastArrayLastIndexOf( - context: Context, array: JSArray, from: Smi, searchElement: JSAny): Smi { - const elements: FixedArrayBase = array.elements; - const elementsLen: Smi = Convert(elements.length_intptr); +macro LastIndexOfAnyInFixedArray( + implicit context: Context)(elements: FixedArray, from: Smi, + searchElement: JSAny): Smi { let k: Smi = from; + while (k >= 0) { + const element = UnsafeCast<(JSAny | TheHole)>(elements.objects[k]); + if (TaggedEqual(searchElement, element)) return k; + typeswitch (element) { + case (e: JSAny): { + if (StrictEqual(searchElement, e) == True) return k; + } + case (TheHole): { + // Fallthrough. + } + } + --k; + } + return -1; +} - // Bug(898785): Due to side-effects in the evaluation of `fromIndex` - // the {from} can be out-of-bounds here, so we need to clamp {k} to - // the {elements} length. We might be reading holes / hole NaNs still - // due to that, but those will be ignored below. - if (k >= elementsLen) { - k = elementsLen - 1; +macro FastArrayLastIndexOfFixedArray( + context: Context, array: FastJSArrayForRead, from: Smi, + searchElement: JSAny): Smi { + const elements: FixedArray = UnsafeCast(array.elements); + const elementsLen: Smi = Convert(elements.length_intptr); + const k: Smi = ClampLastIndexOfFrom(from, elementsLen); + + typeswitch (searchElement) { + case (search: Number): { + return LastIndexOfNumberInFixedArray(elements, k, search); + } + case (JSAny): { + return LastIndexOfAnyInFixedArray(elements, k, searchElement); + } } +} +macro LastIndexOfDoubleValue( + elements: FixedDoubleArray, from: Smi, searchNum: float64): Smi { + let k: Smi = from; while (k >= 0) { try { - const element: JSAny = LoadWithHoleCheck(elements, k) - otherwise Hole; - - const same: Boolean = StrictEqual(searchElement, element); - if (same == True) { - dcheck(Is(array)); - return k; - } - } label Hole {} // Do nothing for holes. - + const element: float64 = elements.values[k].Value() otherwise IfUndefined, + IfHole; + if (element == searchNum) return k; + } label IfUndefined { + // Fallthrough. + } label IfHole { + // Fallthrough. + } --k; } + return -1; +} - dcheck(Is(array)); +macro LastIndexOfUndefinedInDoubles(elements: FixedDoubleArray, from: Smi): + Smi { + let k: Smi = from; + while (k >= 0) { + try { + elements.values[k].Value() otherwise IfUndefined, IfHole; + } label IfUndefined { + return k; + } label IfHole { + // Fallthrough. + } + --k; + } return -1; } +macro FastArrayLastIndexOfDoubles( + context: Context, array: FastJSArrayForRead, from: Smi, + searchElement: JSAny): Smi { + const elements: FixedDoubleArray = + UnsafeCast(array.elements); + const elementsLen: Smi = Convert(elements.length_intptr); + const k: Smi = ClampLastIndexOfFrom(from, elementsLen); + + typeswitch (searchElement) { + case (search: Number): { + const searchNum: float64 = Convert(search); + if (Float64IsNaN(searchNum)) return -1; + return LastIndexOfDoubleValue(elements, k, searchNum); + } + case (Undefined): { + return LastIndexOfUndefinedInDoubles(elements, k); + } + case (JSAny): { + return -1; + } + } +} + transitioning macro GetFromIndex( context: Context, length: Number, arguments: Arguments): Number { // 4. If fromIndex is present, let n be ? ToInteger(fromIndex); @@ -87,19 +154,19 @@ macro TryFastArrayLastIndexOf( context: Context, receiver: JSReceiver, searchElement: JSAny, from: Number): JSAny labels Slow { - const array: FastJSArray = Cast(receiver) otherwise Slow; + const array: FastJSArrayForRead = Cast(receiver) + otherwise Slow; const length: Smi = array.length; if (length == 0) return SmiConstant(-1); const fromSmi: Smi = Cast(from) otherwise Slow; const kind: ElementsKind = array.map.elements_kind; - if (IsFastSmiOrTaggedElementsKind(kind)) { - return FastArrayLastIndexOf( - context, array, fromSmi, searchElement); + if (IsDoubleElementsKind(kind)) { + return FastArrayLastIndexOfDoubles(context, array, fromSmi, searchElement); } - dcheck(IsDoubleElementsKind(kind)); - return FastArrayLastIndexOf( - context, array, fromSmi, searchElement); + dcheck(IsElementsKindLessThanOrEqual( + kind, ElementsKind::LAST_ANY_NONEXTENSIBLE_ELEMENTS_KIND)); + return FastArrayLastIndexOfFixedArray(context, array, fromSmi, searchElement); } transitioning macro GenericArrayLastIndexOf( diff --git a/deps/v8/src/builtins/base.tq b/deps/v8/src/builtins/base.tq index bdcd122eff7c..e3a860d00229 100644 --- a/deps/v8/src/builtins/base.tq +++ b/deps/v8/src/builtins/base.tq @@ -263,14 +263,20 @@ extern class JSSetIteratorPrototype extends JSInternalPrototypeBase extern class JSStringIteratorPrototype extends JSInternalPrototypeBase generates 'JSObject'; +// OrderedHashMap/Set and OrderedNameDictionary are OrderedHashTable +// instances. OrderedHashTable extends FixedArray directly (a separate +// family from HashTable, with a different layout) and is a class template +// with no instance type of its own, so FixedArray is their nearest +// instance-typed base. +extern class OrderedHashMap extends FixedArray; +extern class OrderedHashSet extends FixedArray; +extern class OrderedNameDictionary extends FixedArray; + // The HashTable inheritance hierarchy doesn't actually look like this in C++ // because it uses some class templates that we can't yet (and may never) // express in Torque, but this is the expected organization of instance types. @doNotGenerateCast extern class HashTable extends FixedArray generates 'FixedArray'; -extern class OrderedHashMap extends HashTable; -extern class OrderedHashSet extends HashTable; -extern class OrderedNameDictionary extends HashTable; extern class NameToIndexHashTable extends HashTable; extern class RegisteredSymbolTable extends HashTable; extern class NameDictionary extends HashTable; @@ -1506,6 +1512,7 @@ extern macro IsTypedArraySpeciesProtectorCellInvalid(): bool; extern macro IsPromiseSpeciesProtectorCellInvalid(): bool; extern macro IsMockArrayBufferAllocatorFlag(): bool; extern macro HasBuiltinSubclassingFlag(): bool; +extern macro HasJsPr3883Flag(): bool; extern macro IsPrototypeTypedArrayPrototype( implicit context: Context)(Map): bool; extern macro IsSetIteratorProtectorCellInvalid(): bool; @@ -1519,6 +1526,7 @@ extern operator '.elements_kind' macro LoadElementsKind(JSTypedArray): ElementsKind; extern operator '.length' macro LoadFastJSArrayLength(FastJSArray): Smi; +extern operator '.length' macro LoadFastJSArrayLength(FastJSArrayForRead): Smi; operator '.length=' macro StoreFastJSArrayLength( array: FastJSArray, length: Smi): void { const array: JSArray = array; diff --git a/deps/v8/src/builtins/builtins-array.cc b/deps/v8/src/builtins/builtins-array.cc index dc11d10c1c37..ac39dac4cf47 100644 --- a/deps/v8/src/builtins/builtins-array.cc +++ b/deps/v8/src/builtins/builtins-array.cc @@ -26,6 +26,7 @@ #include "src/objects/js-collection-inl.h" #include "src/objects/js-shared-array.h" #include "src/objects/lookup.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" #include "src/objects/prototype.h" #include "src/objects/smi.h" diff --git a/deps/v8/src/builtins/builtins-arraybuffer.cc b/deps/v8/src/builtins/builtins-arraybuffer.cc index 9aefc23b1c3c..f3a6e701fa15 100644 --- a/deps/v8/src/builtins/builtins-arraybuffer.cc +++ b/deps/v8/src/builtins/builtins-arraybuffer.cc @@ -10,6 +10,7 @@ #include "src/logging/counters.h" #include "src/numbers/conversions.h" #include "src/objects/js-array-buffer-inl.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" namespace v8 { diff --git a/deps/v8/src/builtins/builtins-atomics-synchronization.cc b/deps/v8/src/builtins/builtins-atomics-synchronization.cc index 2056c5f22b87..d60667d9507a 100644 --- a/deps/v8/src/builtins/builtins-atomics-synchronization.cc +++ b/deps/v8/src/builtins/builtins-atomics-synchronization.cc @@ -4,6 +4,7 @@ #include "src/builtins/builtins-utils-inl.h" #include "src/objects/js-atomics-synchronization-inl.h" +#include "src/objects/object-conversions-inl.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/builtins/builtins-bigint.cc b/deps/v8/src/builtins/builtins-bigint.cc index 36cc472d3575..8a8c037fe096 100644 --- a/deps/v8/src/builtins/builtins-bigint.cc +++ b/deps/v8/src/builtins/builtins-bigint.cc @@ -6,6 +6,7 @@ #include "src/builtins/builtins.h" #include "src/logging/counters.h" #include "src/numbers/conversions.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" #ifdef V8_INTL_SUPPORT #include "src/objects/intl-objects.h" diff --git a/deps/v8/src/builtins/builtins-callsite.cc b/deps/v8/src/builtins/builtins-callsite.cc index 9ee452a00b1d..dfb280ca0b56 100644 --- a/deps/v8/src/builtins/builtins-callsite.cc +++ b/deps/v8/src/builtins/builtins-callsite.cc @@ -4,6 +4,7 @@ #include "src/builtins/builtins-utils-inl.h" #include "src/builtins/builtins.h" +#include "src/execution/isolate-inl.h" #include "src/logging/counters.h" #include "src/objects/call-site-info-inl.h" #include "src/objects/contexts-inl.h" @@ -44,6 +45,29 @@ namespace internal { namespace { +bool IsSecurityTokenCompatible(Isolate* isolate, + DirectHandle frame) { + Tagged current_native_context = isolate->raw_native_context(); + + auto is_compatible = [&](Tagged obj) { + if (!IsJSReceiver(obj)) return true; + std::optional> maybe_creation_context = + Cast(obj)->GetCreationContext(); + if (maybe_creation_context.has_value()) { + Tagged cc = maybe_creation_context.value(); + if (!cc->HasSameSecurityTokenAs(current_native_context)) { + return false; + } + } else { + return false; + } + return true; + }; + + return is_compatible(frame->function()) && + is_compatible(frame->receiver_or_instance()); +} + Tagged PositiveNumberOrNull(int value, Isolate* isolate) { if (value > 0) return *isolate->factory()->NewNumberFromInt(value); return ReadOnlyRoots(isolate).null_value(); @@ -54,12 +78,18 @@ Tagged PositiveNumberOrNull(int value, Isolate* isolate) { BUILTIN(CallSitePrototypeGetColumnNumber) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getColumnNumber"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return PositiveNumberOrNull(CallSiteInfo::GetColumnNumber(frame), isolate); } BUILTIN(CallSitePrototypeGetEnclosingColumnNumber) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getEnclosingColumnNumber"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return PositiveNumberOrNull(CallSiteInfo::GetEnclosingColumnNumber(frame), isolate); } @@ -67,6 +97,9 @@ BUILTIN(CallSitePrototypeGetEnclosingColumnNumber) { BUILTIN(CallSitePrototypeGetEnclosingLineNumber) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getEnclosingLineNumber"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return PositiveNumberOrNull(CallSiteInfo::GetEnclosingLineNumber(frame), isolate); } @@ -74,12 +107,18 @@ BUILTIN(CallSitePrototypeGetEnclosingLineNumber) { BUILTIN(CallSitePrototypeGetEvalOrigin) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getEvalOrigin"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return *CallSiteInfo::GetEvalOrigin(frame); } BUILTIN(CallSitePrototypeGetFileName) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getFileName"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return frame->GetScriptName(); } @@ -87,6 +126,9 @@ BUILTIN(CallSitePrototypeGetFunction) { static const char method_name[] = "getFunction"; HandleScope scope(isolate); CHECK_CALLSITE(frame, method_name); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).undefined_value(); + } Tagged func_obj = frame->function(); if (frame->IsStrict() || @@ -121,30 +163,57 @@ BUILTIN(CallSitePrototypeGetFunction) { BUILTIN(CallSitePrototypeGetFunctionName) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getFunctionName"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } + + Tagged func_obj = frame->function(); + if (IsJSReceiver(func_obj)) { + // Get function's creation context. Return null if not available. + Tagged function_obj = Cast(func_obj); + std::optional> maybe_creation_context = + function_obj->GetCreationContext(); + if (!maybe_creation_context.has_value()) { + return ReadOnlyRoots(isolate).null_value(); + } + } + return *CallSiteInfo::GetFunctionName(frame); } BUILTIN(CallSitePrototypeGetLineNumber) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getLineNumber"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return PositiveNumberOrNull(CallSiteInfo::GetLineNumber(frame), isolate); } BUILTIN(CallSitePrototypeGetMethodName) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getMethodName"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return *CallSiteInfo::GetMethodName(frame); } BUILTIN(CallSitePrototypeGetPosition) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getPosition"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return Smi::FromInt(CallSiteInfo::GetSourcePosition(frame)); } BUILTIN(CallSitePrototypeGetPromiseIndex) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getPromiseIndex"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } if (!frame->IsPromiseAll() && !frame->IsPromiseAny() && !frame->IsPromiseAllSettled()) { return ReadOnlyRoots(isolate).null_value(); @@ -155,12 +224,18 @@ BUILTIN(CallSitePrototypeGetPromiseIndex) { BUILTIN(CallSitePrototypeGetScriptHash) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getScriptHash"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return *CallSiteInfo::GetScriptHash(frame); } BUILTIN(CallSitePrototypeGetScriptNameOrSourceURL) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getScriptNameOrSourceUrl"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return frame->GetScriptNameOrSourceURL(); } @@ -168,6 +243,9 @@ BUILTIN(CallSitePrototypeGetThis) { static const char method_name[] = "getThis"; HandleScope scope(isolate); CHECK_CALLSITE(frame, method_name); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).undefined_value(); + } if (frame->IsStrict()) return ReadOnlyRoots(isolate).undefined_value(); isolate->CountUsage(v8::Isolate::kCallSiteAPIGetThisSloppyCall); @@ -197,48 +275,72 @@ BUILTIN(CallSitePrototypeGetThis) { BUILTIN(CallSitePrototypeGetTypeName) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "getTypeName"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return *CallSiteInfo::GetTypeName(frame); } BUILTIN(CallSitePrototypeIsAsync) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "isAsync"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return ReadOnlyRoots(isolate).boolean_value(frame->IsAsync()); } BUILTIN(CallSitePrototypeIsConstructor) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "isConstructor"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return ReadOnlyRoots(isolate).boolean_value(frame->IsConstructor()); } BUILTIN(CallSitePrototypeIsEval) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "isEval"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return ReadOnlyRoots(isolate).boolean_value(frame->IsEval()); } BUILTIN(CallSitePrototypeIsNative) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "isNative"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return ReadOnlyRoots(isolate).boolean_value(frame->IsNative()); } BUILTIN(CallSitePrototypeIsPromiseAll) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "isPromiseAll"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return ReadOnlyRoots(isolate).boolean_value(frame->IsPromiseAll()); } BUILTIN(CallSitePrototypeIsToplevel) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "isToplevel"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return ReadOnlyRoots(isolate).null_value(); + } return ReadOnlyRoots(isolate).boolean_value(frame->IsToplevel()); } BUILTIN(CallSitePrototypeToString) { HandleScope scope(isolate); CHECK_CALLSITE(frame, "toString"); + if (!IsSecurityTokenCompatible(isolate, frame)) { + return *isolate->factory()->empty_string(); + } RETURN_RESULT_OR_FAILURE(isolate, SerializeCallSiteInfo(isolate, frame)); } diff --git a/deps/v8/src/builtins/builtins-dataview.cc b/deps/v8/src/builtins/builtins-dataview.cc index 0eea7f3d78c3..e7781790d10c 100644 --- a/deps/v8/src/builtins/builtins-dataview.cc +++ b/deps/v8/src/builtins/builtins-dataview.cc @@ -9,6 +9,7 @@ #include "src/logging/counters.h" #include "src/numbers/conversions.h" #include "src/objects/js-array-buffer-inl.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" namespace v8 { diff --git a/deps/v8/src/builtins/builtins-date.cc b/deps/v8/src/builtins/builtins-date.cc index 191d34a9265f..ad5c62f6383c 100644 --- a/deps/v8/src/builtins/builtins-date.cc +++ b/deps/v8/src/builtins/builtins-date.cc @@ -17,6 +17,7 @@ #ifdef V8_TEMPORAL_SUPPORT #include "src/objects/js-temporal-objects-inl.h" #endif // V8_TEMPORAL_SUPPORT +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" #include "src/strings/string-stream.h" diff --git a/deps/v8/src/builtins/builtins-definitions.h b/deps/v8/src/builtins/builtins-definitions.h index 4918024d3111..cdf103579956 100644 --- a/deps/v8/src/builtins/builtins-definitions.h +++ b/deps/v8/src/builtins/builtins-definitions.h @@ -5,13 +5,23 @@ #ifndef V8_BUILTINS_BUILTINS_DEFINITIONS_H_ #define V8_BUILTINS_BUILTINS_DEFINITIONS_H_ +#ifdef V8_METAGEN_GENERATION_PASS +// During the metagen libclang harvest the generated headers may not +// exist yet: the harvest runs before (and independently of) the +// generators, so it must parse without them. Both lists only feed +// BUILTIN_LIST's expansion downstream; defining them to empty keeps +// the Builtin enum well-formed, minus entries the harvest never +// references by name. +#define BUILTIN_LIST_BYTECODE_HANDLERS(V_TSA, V) +#define BUILTIN_LIST_FROM_TORQUE(CPP, TFJ_TSA, TFJ, TFC_TSA, TFC, TFS, TFH, ASM) +#define TORQUE_FUNCTION_POINTER_TYPE_TO_BUILTIN_MAP(V) +#else #include "builtins-generated/bytecodes-builtins-list.h" +#include "torque-generated/builtin-definitions.h" +#endif #include "src/base/strong-alias.h" #include "src/common/globals.h" -// include generated header -#include "torque-generated/builtin-definitions.h" - namespace v8 { namespace internal { @@ -169,6 +179,18 @@ constexpr int kGearboxGenericBuiltinIdOffset = -2; #define GENERATE_BUILTIN_TYPED_BITWISE_HANDLER(V, OP) \ TYPED_BINOP_HANDLER_HELPER(V, OP, None) \ TYPED_BINOP_HANDLER_HELPER(V, OP, SignedSmall) + +#define TYPED_UNOP_HANDLER_HELPER(V, OPERATION, TYPE) \ + V(OPERATION##_##TYPE##_Baseline, UnaryOp_WithEmbeddedFeedbackOffset) + +#define GENERATE_BUILTIN_TYPED_UNOP_HANDLER(V, OP) \ + TYPED_UNOP_HANDLER_HELPER(V, OP, None) \ + TYPED_UNOP_HANDLER_HELPER(V, OP, SignedSmall) + +#define GENERATE_BUILTIN_TYPED_NEGATE_HANDLER(V) \ + TYPED_UNOP_HANDLER_HELPER(V, Negate, None) \ + TYPED_UNOP_HANDLER_HELPER(V, Negate, SignedSmall) \ + TYPED_UNOP_HANDLER_HELPER(V, Negate, Number) #endif /* Tiering related builtins @@ -199,7 +221,8 @@ constexpr int kGearboxGenericBuiltinIdOffset = -2; BUILTIN_LIST_BASE_TIERING_TURBOFAN(TFC) \ TFC(FunctionLogNextExecution, JSTrampoline) \ TFC(MarkReoptimizeLazyDeoptimized, JSTrampoline) \ - TFC(MarkLazyDeoptimized, JSTrampoline) + TFC(MarkLazyDeoptimized, JSTrampoline) \ + TFC(MarkFlushed, JSTrampoline) #define BUILTIN_LIST_BASE_TIER1(CPP, TFJ_TSA, TFJ, TFC_TSA, TFC, TFS, TFH, \ ASM) \ @@ -1058,14 +1081,22 @@ constexpr int kGearboxGenericBuiltinIdOffset = -2; TFC(GreaterThanOrEqual_WithEmbeddedFeedback, Compare_WithEmbeddedFeedback) \ \ /* Unary ops with feedback collection */ \ - TFC(BitwiseNot_Baseline, UnaryOp_Baseline) \ - TFC(Decrement_Baseline, UnaryOp_Baseline) \ - TFC(Increment_Baseline, UnaryOp_Baseline) \ - TFC(Negate_Baseline, UnaryOp_Baseline) \ - IF_TSA(TFC_TSA, TFC, BitwiseNot_WithFeedback, UnaryOp_WithFeedback) \ - TFC(Decrement_WithFeedback, UnaryOp_WithFeedback) \ - TFC(Increment_WithFeedback, UnaryOp_WithFeedback) \ - TFC(Negate_WithFeedback, UnaryOp_WithFeedback) \ + TFC(BitwiseNot_Generic_Baseline, UnaryOp_WithEmbeddedFeedbackOffset) \ + IF_SPARKPLUG_PLUS(GENERATE_BUILTIN_TYPED_UNOP_HANDLER, TFC, BitwiseNot) \ + IF_SPARKPLUG_PLUS(TFC, BitwiseNotAndTryPatchCode, UnaryOpAndTryPatchCode) \ + TFC(Decrement_Generic_Baseline, UnaryOp_WithEmbeddedFeedbackOffset) \ + IF_SPARKPLUG_PLUS(GENERATE_BUILTIN_TYPED_UNOP_HANDLER, TFC, Decrement) \ + IF_SPARKPLUG_PLUS(TFC, DecrementAndTryPatchCode, UnaryOpAndTryPatchCode) \ + TFC(Increment_Generic_Baseline, UnaryOp_WithEmbeddedFeedbackOffset) \ + IF_SPARKPLUG_PLUS(GENERATE_BUILTIN_TYPED_UNOP_HANDLER, TFC, Increment) \ + IF_SPARKPLUG_PLUS(TFC, IncrementAndTryPatchCode, UnaryOpAndTryPatchCode) \ + TFC(Negate_Generic_Baseline, UnaryOp_WithEmbeddedFeedbackOffset) \ + IF_SPARKPLUG_PLUS(GENERATE_BUILTIN_TYPED_NEGATE_HANDLER, TFC) \ + IF_SPARKPLUG_PLUS(TFC, NegateAndTryPatchCode, UnaryOpAndTryPatchCode) \ + IF_TSA(TFC_TSA, TFC, BitwiseNot_WithFeedback, UnaryOp_WithEmbeddedFeedback) \ + TFC(Decrement_WithFeedback, UnaryOp_WithEmbeddedFeedback) \ + TFC(Increment_WithFeedback, UnaryOp_WithEmbeddedFeedback) \ + TFC(Negate_WithFeedback, UnaryOp_WithEmbeddedFeedback) \ \ /* Object */ \ TFJ(ObjectAssign, kDontAdaptArgumentsSentinel) \ diff --git a/deps/v8/src/builtins/builtins-inl.h b/deps/v8/src/builtins/builtins-inl.h index a2fcf92c60f3..220ec111dd21 100644 --- a/deps/v8/src/builtins/builtins-inl.h +++ b/deps/v8/src/builtins/builtins-inl.h @@ -323,6 +323,7 @@ bool Builtins::IsJSTrampoline(Builtin builtin) { switch (builtin) { case Builtin::kIllegal: case Builtin::kCompileLazy: + case Builtin::kMarkFlushed: case Builtin::kInterpreterEntryTrampoline: case Builtin::kDebugBreakTrampoline: #ifdef V8_ENABLE_WEBASSEMBLY diff --git a/deps/v8/src/builtins/builtins-intl-gen.cc b/deps/v8/src/builtins/builtins-intl-gen.cc index 24acfd55921a..e095a5528af3 100644 --- a/deps/v8/src/builtins/builtins-intl-gen.cc +++ b/deps/v8/src/builtins/builtins-intl-gen.cc @@ -184,6 +184,12 @@ void IntlBuiltinsAssembler::ToLowerCaseImpl( &call_c); { + // The allocation above may have internalized a shared source, forwarding + // it to a ThinString or freeing an external resource. The loop below would + // read that through a stale raw pointer, so bail out instead. {call_c} + // re-resolves the source and needs no such check. + to_direct.BailIfTransitioned(&runtime); + const TNode dst_ptr = PointerToSeqStringData(dst); TVARIABLE(IntPtrT, var_cursor, IntPtrConstant(0)); diff --git a/deps/v8/src/builtins/builtins-intl.cc b/deps/v8/src/builtins/builtins-intl.cc index bbfdb2c5505a..4b97358d910b 100644 --- a/deps/v8/src/builtins/builtins-intl.cc +++ b/deps/v8/src/builtins/builtins-intl.cc @@ -30,6 +30,7 @@ #include "src/objects/js-segment-iterator-inl.h" #include "src/objects/js-segmenter-inl.h" #include "src/objects/js-segments-inl.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" #include "src/objects/option-utils.h" #include "src/objects/property-descriptor.h" @@ -1240,7 +1241,8 @@ BUILTIN(CollatorInternalCompare) { Object::ToString(isolate, y)); // 7. Return CompareStrings(collator, X, Y). - Managed::Ptr icu_collator = collator->icu_collator()->ptr(); + CppGCManaged::Ptr icu_collator = + collator->icu_collator()->ptr(); CHECK_NOT_NULL(icu_collator); int result = Intl::CompareStrings(isolate, *icu_collator, string_x, string_y); // See StringPrototypeLocaleCompareIntl: the inline fast path relies on @@ -1325,7 +1327,7 @@ BUILTIN(SegmentsPrototypeIterator) { HandleScope scope(isolate); CHECK_RECEIVER(JSSegments, segments, method_name); - Managed::Ptr iterator_with_text = + CppGCManaged::Ptr iterator_with_text = segments->icu_iterator_with_text()->ptr(); RETURN_RESULT_OR_FAILURE( diff --git a/deps/v8/src/builtins/builtins-iterator-inl.h b/deps/v8/src/builtins/builtins-iterator-inl.h index 45858a78f63c..ca0897c0855d 100644 --- a/deps/v8/src/builtins/builtins-iterator-inl.h +++ b/deps/v8/src/builtins/builtins-iterator-inl.h @@ -17,6 +17,7 @@ #include "src/objects/js-collection-inl.h" #include "src/objects/js-objects-inl.h" #include "src/objects/js-regexp-string-iterator-inl.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" #include "src/objects/ordered-hash-table-inl.h" diff --git a/deps/v8/src/builtins/builtins-math.cc b/deps/v8/src/builtins/builtins-math.cc index 18b9477684ab..a9370f7b14ac 100644 --- a/deps/v8/src/builtins/builtins-math.cc +++ b/deps/v8/src/builtins/builtins-math.cc @@ -10,6 +10,7 @@ #include "src/execution/execution.h" #include "src/execution/protectors-inl.h" #include "src/numbers/conversions.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" namespace v8 { diff --git a/deps/v8/src/builtins/builtins-microtask-queue-gen.cc b/deps/v8/src/builtins/builtins-microtask-queue-gen.cc index 36f37918529a..0193b0bd0cd7 100644 --- a/deps/v8/src/builtins/builtins-microtask-queue-gen.cc +++ b/deps/v8/src/builtins/builtins-microtask-queue-gen.cc @@ -69,15 +69,9 @@ class MicrotaskQueueBuiltinsAssembler : public CodeStubAssembler { TNode MicrotaskQueueBuiltinsAssembler::GetMicrotaskQueue( TNode native_context) { CSA_DCHECK(this, IsNativeContext(native_context)); -#ifdef V8_CPPGC_MICROTASK_QUEUE return LoadCppHeapPointerFromObject(native_context, NativeContext::kMicrotaskQueueOffset, CppHeapPointerTag::kMicrotaskQueueTag); -#else - return LoadExternalPointerFromObject(native_context, - NativeContext::kMicrotaskQueueOffset, - kNativeContextMicrotaskQueueTag); -#endif } TNode MicrotaskQueueBuiltinsAssembler::GetMicrotaskRingBuffer( diff --git a/deps/v8/src/builtins/builtins-number-gen.cc b/deps/v8/src/builtins/builtins-number-gen.cc index a96f788d0ec8..8613da3f613b 100644 --- a/deps/v8/src/builtins/builtins-number-gen.cc +++ b/deps/v8/src/builtins/builtins-number-gen.cc @@ -137,20 +137,21 @@ DEF_BINOP(ShiftRightSmi, ShiftRight, true) DEF_BINOP(ShiftRightLogicalSmi, ShiftRightLogical, true) #undef DEF_BINOP -#define DEF_UNOP(Name, Generator) \ - TF_BUILTIN(Name, CodeStubAssembler) { \ - auto value = Parameter(Descriptor::kValue); \ - auto context = Parameter(Descriptor::kContext); \ - auto feedback_vector = \ - Parameter(Descriptor::kFeedbackVector); \ - auto slot = UncheckedParameter(Descriptor::kSlot); \ - \ - UnaryOpAssembler a(state()); \ - TNode result = \ - a.Generator(context, value, slot, feedback_vector, \ - UpdateFeedbackMode::kGuaranteedFeedback); \ - \ - Return(result); \ +#define DEF_UNOP(Name, Generator) \ + TF_BUILTIN(Name, CodeStubAssembler) { \ + auto value = Parameter(Descriptor::kValue); \ + auto context = Parameter(Descriptor::kContext); \ + auto bytecode_array = \ + Parameter(Descriptor::kBytecodeArray); \ + auto feedback_offset = \ + UncheckedParameter(Descriptor::kFeedbackOffset); \ + \ + UnaryOpAssembler a(state()); \ + TNode result = a.Generator( \ + context, value, \ + a.MakeEmbeddedFeedbackUpdater(bytecode_array, feedback_offset)); \ + \ + Return(result); \ } #ifndef V8_ENABLE_EXPERIMENTAL_TSA_BUILTINS DEF_UNOP(BitwiseNot_WithFeedback, Generate_BitwiseNotWithFeedback) @@ -160,25 +161,23 @@ DEF_UNOP(Increment_WithFeedback, Generate_IncrementWithFeedback) DEF_UNOP(Negate_WithFeedback, Generate_NegateWithFeedback) #undef DEF_UNOP -#define DEF_UNOP(Name, Generator) \ - TF_BUILTIN(Name, CodeStubAssembler) { \ - auto value = Parameter(Descriptor::kValue); \ - auto context = LoadContextFromBaseline(); \ - auto feedback_vector = LoadFeedbackVectorFromBaseline(); \ - auto slot = UncheckedParameter(Descriptor::kSlot); \ - \ - UnaryOpAssembler a(state()); \ - TNode result = \ - a.Generator(context, value, slot, feedback_vector, \ - UpdateFeedbackMode::kGuaranteedFeedback); \ - \ - Return(result); \ +#define DEF_UNOP_GENERIC(Name, Generator) \ + TF_BUILTIN(Name##_Generic_Baseline, CodeStubAssembler) { \ + auto value = Parameter(Descriptor::kValue); \ + auto feedback_offset = \ + UncheckedParameter(Descriptor::kFeedbackOffset); \ + UnaryOpAssembler a(state()); \ + TNode result = \ + a.Generator(LoadContextFromBaseline(), value, \ + a.MakeEmbeddedFeedbackUpdater( \ + LoadBytecodeArrayFromBaseline(), feedback_offset)); \ + Return(result); \ } -DEF_UNOP(BitwiseNot_Baseline, Generate_BitwiseNotWithFeedback) -DEF_UNOP(Decrement_Baseline, Generate_DecrementWithFeedback) -DEF_UNOP(Increment_Baseline, Generate_IncrementWithFeedback) -DEF_UNOP(Negate_Baseline, Generate_NegateWithFeedback) -#undef DEF_UNOP +DEF_UNOP_GENERIC(BitwiseNot, Generate_BitwiseNotWithFeedback) +DEF_UNOP_GENERIC(Decrement, Generate_DecrementWithFeedback) +DEF_UNOP_GENERIC(Increment, Generate_IncrementWithFeedback) +DEF_UNOP_GENERIC(Negate, Generate_NegateWithFeedback) +#undef DEF_UNOP_GENERIC #define DEF_RELATIONAL_COMPARE(Name) \ TF_BUILTIN(Name##_WithEmbeddedFeedback, CodeStubAssembler) { \ @@ -404,6 +403,47 @@ TF_BUILTIN(StrictEqual_Generic_Baseline, CodeStubAssembler) { } #ifdef V8_ENABLE_SPARKPLUG_PLUS +#define DEF_TYPED_UNOP_COMMON(OpName) \ + TF_BUILTIN(OpName##AndTryPatchCode, CodeStubAssembler) { \ + auto value = Parameter(Descriptor::kValue); \ + auto current_feedback = \ + UncheckedParameter(Descriptor::kCurrentFeedback); \ + auto feedback_offset = \ + UncheckedParameter(Descriptor::kFeedbackOffset); \ + GenerateUnaryOpAndTryPatchCode(Operation::k##OpName, value, \ + current_feedback, feedback_offset); \ + } \ + TF_BUILTIN(OpName##_None_Baseline, CodeStubAssembler) { \ + auto value = Parameter(Descriptor::kValue); \ + auto feedback_offset = \ + UncheckedParameter(Descriptor::kFeedbackOffset); \ + TailCallBuiltin( \ + Builtin::k##OpName##AndTryPatchCode, LoadContextFromBaseline(), value, \ + Int32Constant( \ + static_cast(BinaryOperationFeedback::TypeIndex::kNone)), \ + feedback_offset); \ + } \ + TF_BUILTIN(OpName##_SignedSmall_Baseline, CodeStubAssembler) { \ + auto value = Parameter(Descriptor::kValue); \ + auto feedback_offset = \ + UncheckedParameter(Descriptor::kFeedbackOffset); \ + GenerateSmiUnaryOp(Operation::k##OpName, value, feedback_offset, \ + Builtin::k##OpName##AndTryPatchCode); \ + } +DEF_TYPED_UNOP_COMMON(Increment) +DEF_TYPED_UNOP_COMMON(Decrement) +DEF_TYPED_UNOP_COMMON(Negate) +DEF_TYPED_UNOP_COMMON(BitwiseNot) +#undef DEF_TYPED_UNOP_COMMON + +// Negate-only Number stub. +TF_BUILTIN(Negate_Number_Baseline, CodeStubAssembler) { + auto value = Parameter(Descriptor::kValue); + auto feedback_offset = + UncheckedParameter(Descriptor::kFeedbackOffset); + GenerateNumberNegate(value, feedback_offset); +} + #define DEFINE_TYPED_EQUALITY_COMMON(Name) \ TF_BUILTIN(Name##_None_Baseline, CodeStubAssembler) { \ auto lhs = Parameter(Descriptor::kLeft); \ @@ -626,7 +666,7 @@ TF_BUILTIN(Add_String_Baseline, CodeStubAssembler) { auto rhs = Parameter(Descriptor::kRight); auto feedback_offset = UncheckedParameter(Descriptor::kFeedbackOffset); - GenerateStringAdd(lhs, rhs, feedback_offset, Builtin::kAddAndTryPatchCode); + GenerateStringAdd(lhs, rhs, feedback_offset); } TF_BUILTIN(ExponentiateAndTryPatchCode, CodeStubAssembler) { diff --git a/deps/v8/src/builtins/builtins-number-tsa.cc b/deps/v8/src/builtins/builtins-number-tsa.cc index 746e19bff7cd..85ddfe02dedc 100644 --- a/deps/v8/src/builtins/builtins-number-tsa.cc +++ b/deps/v8/src/builtins/builtins-number-tsa.cc @@ -418,12 +418,11 @@ TS_BUILTIN(BitwiseNot_WithFeedback, NumberBuiltinsAssemblerTS) { // Descriptor directly. V value = Parameter(Descriptor::kValue); V context = Parameter(Descriptor::kContext); - V feedback_vector = - Parameter(Descriptor::kFeedbackVector); - V slot = Parameter(Descriptor::kSlot); + V bytecode_array = + Parameter(Descriptor::kBytecodeArray); + V feedback_offset = Parameter(Descriptor::kFeedbackOffset); - SetFeedbackSlot(slot); - SetFeedbackVector(feedback_vector); + SetEmbeddedFeedback(bytecode_array, feedback_offset); V result = BitwiseNot(context, value); Return(result); diff --git a/deps/v8/src/builtins/builtins-number.cc b/deps/v8/src/builtins/builtins-number.cc index e25af221b61c..e031dcfa83da 100644 --- a/deps/v8/src/builtins/builtins-number.cc +++ b/deps/v8/src/builtins/builtins-number.cc @@ -7,6 +7,7 @@ #include "src/codegen/code-factory.h" #include "src/logging/counters.h" #include "src/numbers/conversions.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" #ifdef V8_INTL_SUPPORT #include "src/objects/intl-objects.h" diff --git a/deps/v8/src/builtins/builtins-regexp-gen.cc b/deps/v8/src/builtins/builtins-regexp-gen.cc index be445c39534d..951b56c662f0 100644 --- a/deps/v8/src/builtins/builtins-regexp-gen.cc +++ b/deps/v8/src/builtins/builtins-regexp-gen.cc @@ -181,6 +181,128 @@ TNode RegExpBuiltinsAssembler::LoadRegExpDataFromObject( offset); } +// On a hit, sets {var_result} to a fresh array over the cached parts and jumps +// to {if_found}. On a miss, falls through. Mirrors ResultsCache::Lookup. +void RegExpBuiltinsAssembler::TryRegExpSplitCacheLookup( + TNode context, TNode regexp, TNode data, + TNode string, TVariable* var_result, Label* if_found) { + Label miss(this); + + TNode cache = + CAST(CodeAssembler::LoadRoot(RootIndex::kRegExpSplitCache)); + // The cache is allocated on the first Enter; until then there is nothing to + // probe. + GotoIf(TaggedEqual(cache, EmptyFixedArrayConstant()), &miss); + + TNode key_pattern = + LoadObjectField(data, offsetof(RegExpData, wrapper_)); + + CSA_DCHECK(this, IsInternalizedString(string)); + TNode hash = + Signed(ChangeUint32ToWord(LoadNameHashAssumeComputed(string))); + constexpr int kSizeMask = + regexp::ResultsCache::kRegExpSplitResultsCacheSize - 1; + constexpr int kSlotsPerEntry = + regexp::ResultsCache::kArrayEntriesPerCacheEntry; + TNode first_index = WordAnd(WordAnd(hash, IntPtrConstant(kSizeMask)), + IntPtrConstant(~(kSlotsPerEntry - 1))); + + // Read as part of the probe, so a later eviction cannot be observed. + TVARIABLE(FixedArray, var_elements); + TVARIABLE(FixedArray, var_last_match_cache); + + Label found(this, {&var_elements, &var_last_match_cache}); + auto probe = [&](TNode index, Label* if_no_match) { + TNode key_string = UnsafeLoadFixedArrayElement( + cache, index, regexp::ResultsCache::kStringOffset * kTaggedSize); + GotoIfNot(TaggedEqual(key_string, string), if_no_match); + TNode pattern = UnsafeLoadFixedArrayElement( + cache, index, regexp::ResultsCache::kPatternOffset * kTaggedSize); + GotoIfNot(TaggedEqual(pattern, key_pattern), if_no_match); + var_elements = CAST(UnsafeLoadFixedArrayElement( + cache, index, regexp::ResultsCache::kArrayOffset * kTaggedSize)); + var_last_match_cache = CAST(UnsafeLoadFixedArrayElement( + cache, index, regexp::ResultsCache::kLastMatchOffset * kTaggedSize)); + Goto(&found); + }; + + Label try_second(this); + probe(first_index, &try_second); + + BIND(&try_second); + probe(WordAnd(IntPtrAdd(first_index, IntPtrConstant(kSlotsPerEntry)), + IntPtrConstant(kSizeMask)), + &miss); + + BIND(&found); + { + ReplayLastMatchInfo(context, string, var_last_match_cache.value()); + + // Enter made the elements copy-on-write, so the result can share them: a + // write copies the backing store instead of clobbering the entry. + TNode elements = var_elements.value(); + CSA_DCHECK(this, IsFixedCOWArrayMap(LoadMap(elements))); + TNode array_map = + LoadJSArrayElementsMap(PACKED_ELEMENTS, LoadNativeContext(context)); + *var_result = AllocateJSArray(array_map, elements, + SmiTag(LoadFixedArrayBaseLength(elements))); + Goto(if_found); + } + + BIND(&miss); +} + +// Restores LastMatchInfo from a SnapshotLastMatchInfo result. An empty +// snapshot means the split loop never matched, so LastMatchInfo is left alone. +void RegExpBuiltinsAssembler::ReplayLastMatchInfo( + TNode context, TNode subject, + TNode last_match_cache) { + Label done(this); + TNode register_count = LoadFixedArrayBaseLength(last_match_cache); + GotoIf(IntPtrEqual(register_count, IntPtrConstant(0)), &done); + + CSA_DCHECK(this, TaggedEqual(context, LoadNativeContext(context))); + TNode match_info = CAST( + LoadContextElementNoCell(context, Context::REGEXP_LAST_MATCH_INFO_INDEX)); + match_info = + PrepareMatchInfo(context, match_info, SmiTag(register_count), subject); + + // Both sides hold the capture offsets as Smis, so no write barrier is needed. + CopyRange(match_info, RegExpMatchInfo::OffsetOfElementAt(0), last_match_cache, + FixedArray::OffsetOfElementAt(0), register_count, + UNSAFE_SKIP_WRITE_BARRIER); + Goto(&done); + + BIND(&done); +} + +// Records the match LastMatchInfo currently holds, for a later hit to replay. +// Returns the empty array if the split loop never matched. +TNode RegExpBuiltinsAssembler::SnapshotLastMatchInfo( + TNode context, TNode did_match) { + TVARIABLE(FixedArray, var_result, EmptyFixedArrayConstant()); + Label done(this, &var_result); + GotoIfNot(did_match, &done); + + CSA_DCHECK(this, TaggedEqual(context, LoadNativeContext(context))); + TNode match_info = CAST( + LoadContextElementNoCell(context, Context::REGEXP_LAST_MATCH_INFO_INDEX)); + TNode register_count = PositiveSmiUntag(LoadObjectField( + match_info, offsetof(RegExpMatchInfo, number_of_capture_registers_))); + + TNode snapshot = + CAST(AllocateFixedArray(PACKED_ELEMENTS, register_count)); + // Both sides hold the capture offsets as Smis, so no write barrier is needed. + CopyRange(snapshot, FixedArray::OffsetOfElementAt(0), match_info, + RegExpMatchInfo::OffsetOfElementAt(0), register_count, + UNSAFE_SKIP_WRITE_BARRIER); + var_result = snapshot; + Goto(&done); + + BIND(&done); + return var_result.value(); +} + TNode RegExpBuiltinsAssembler::LoadCaptureCount(TNode data) { return Select( SmiEqual(LoadObjectField(data, offsetof(RegExpData, type_tag_)), @@ -497,11 +619,9 @@ static_assert(kInt32Size == 1 << kInt32SizeLog2); } // namespace -TNode -RegExpBuiltinsAssembler::InitializeMatchInfoFromRegisters( +TNode RegExpBuiltinsAssembler::PrepareMatchInfo( TNode context, TNode match_info, - TNode register_count, TNode subject, - TNode result_offsets_vector) { + TNode register_count, TNode subject) { TVARIABLE(RegExpMatchInfo, var_match_info, match_info); // Check that the last match info has space for the capture registers. @@ -521,7 +641,6 @@ RegExpBuiltinsAssembler::InitializeMatchInfoFromRegisters( BIND(&next); } - // Fill match_info. StoreObjectField(var_match_info.value(), offsetof(RegExpMatchInfo, number_of_capture_registers_), register_count); @@ -529,6 +648,16 @@ RegExpBuiltinsAssembler::InitializeMatchInfoFromRegisters( offsetof(RegExpMatchInfo, last_subject_), subject); StoreObjectField(var_match_info.value(), offsetof(RegExpMatchInfo, last_input_), subject); + return var_match_info.value(); +} + +TNode +RegExpBuiltinsAssembler::InitializeMatchInfoFromRegisters( + TNode context, TNode match_info, + TNode register_count, TNode subject, + TNode result_offsets_vector) { + TNode prepared_match_info = + PrepareMatchInfo(context, match_info, register_count, subject); // Fill match and capture offsets in match_info. They are located in the // region: @@ -554,14 +683,14 @@ RegExpBuiltinsAssembler::InitializeMatchInfoFromRegisters( Load(MachineType::Int32(), current_register_address)); TNode smi_value = SmiFromInt32(value); StoreNoWriteBarrier(MachineRepresentation::kTagged, - var_match_info.value(), var_to_offset.value(), + prepared_match_info, var_to_offset.value(), smi_value); Increment(&var_to_offset, kTaggedSize); }, kInt32Size, kLoopUnrolling, IndexAdvanceMode::kPost); } - return var_match_info.value(); + return prepared_match_info; } TNode RegExpBuiltinsAssembler::RegExpExecInternal_Single( @@ -705,31 +834,83 @@ TNode RegExpBuiltinsAssembler::RegExpExecInternal( BIND(&next); } - // Fast-reject via (chars & mask) == value, using up to a 4-character - // mask precomputed during RegExp compilation. + // Throw out attempts that cannot match without entering the engine, using + // two filters built during compilation: (chars & mask) == value over the + // next four characters, and a bitset of what a match can start with. A + // regexp may have either, both, or neither, and running both rejects more + // than either does alone. This is RegExpData::QuickCheckRejects in CSA. { - Label proceed(this); + Label try_bitset(this), proceed(this); + + // Most regexps have neither filter; see RegExpData::kHasQuickCheck. + TNode internal_flags = + LoadObjectField(data, offsetof(RegExpData, internal_flags_)); + GotoIf(Word32Equal(Word32And(internal_flags, + Uint32Constant(RegExpData::kHasQuickCheck)), + Int32Constant(0)), + &proceed); GotoIfNot(to_direct.IsOneByte(), &proceed); - TNode mask = - LoadObjectField(data, offsetof(RegExpData, quick_check_mask_)); - GotoIf(Word32Equal(mask, Int32Constant(0)), &proceed); - + TNode actual_index = IntPtrAdd(int_last_index, to_direct.offset()); TNode remaining = IntPtrSub(int_string_length, int_last_index); - GotoIf(IntPtrLessThan(remaining, IntPtrConstant(kUInt32Size / kCharSize)), - &proceed); + TNode string_data = to_direct.PointerToData(&proceed); - TNode expected = LoadObjectField( - data, offsetof(RegExpData, quick_check_value_)); + // Mask first. + { + TNode mask = LoadObjectField( + data, offsetof(RegExpData, quick_check_mask_)); + GotoIf(Word32Equal(mask, Int32Constant(0)), &try_bitset); - TNode actual_index = IntPtrAdd(int_last_index, to_direct.offset()); - TNode string_data = to_direct.PointerToData(&proceed); + // Four characters have to be left to read four. The bitset reads only + // one, so a shorter tail skips ahead to it rather than giving up. + GotoIf(IntPtrLessThan(remaining, IntPtrConstant(kUInt32Size / kCharSize)), + &try_bitset); + + TNode expected = LoadObjectField( + data, offsetof(RegExpData, quick_check_value_)); - TNode loaded_word = Load(string_data, actual_index); + TNode loaded_word = Load(string_data, actual_index); + + TNode masked_chars = Word32And(loaded_word, mask); + Branch(Word32Equal(masked_chars, expected), &try_bitset, &out); + } - TNode masked_chars = Word32And(loaded_word, mask); - Branch(Word32Equal(masked_chars, expected), &proceed, &out); + // A set bit means "no match can start with this character", so a regexp + // without a bitset has all zeroes and falls through on its own. Reads a + // single character, so unlike the mask it works on a short tail too. + BIND(&try_bitset); + { + GotoIf(IntPtrEqual(remaining, IntPtrConstant(0)), &proceed); + + TNode c = Load(string_data, actual_index); + + // RegExpData::QuickCheckBitsetBit open-coded, since CSA cannot call it: + // 'a' (97) is word 3, bit 1, so load at byte offset 12 and test 1 << 1. + // This offset is computed rather than constant, and |data| is a trusted + // object, so the bitset has to cover every value the load above can + // produce. It does: |c| is a byte, and the bitset has a bit per byte. + static_assert(RegExpData::kQuickCheckBitsetChars == + 1 << (kUInt8Size * kBitsPerByte)); + static_assert(RegExpData::kQuickCheckBitsetBitsPerWord == + kInt32Size * kBitsPerByte); + constexpr int kBitsPerWordLog2 = kInt32SizeLog2 + kBitsPerByteLog2; + TNode word_index = Signed( + WordShr(ChangeUint32ToWord(c), IntPtrConstant(kBitsPerWordLog2))); + TNode word_offset = + WordShl(word_index, IntPtrConstant(kInt32SizeLog2)); + TNode word = LoadObjectField( + data, IntPtrAdd(IntPtrConstant( + offsetof(RegExpData, quick_check_reject_bitset_)), + word_offset)); + + TNode bit = Word32Shl( + Uint32Constant(1), + Word32And( + c, Uint32Constant(RegExpData::kQuickCheckBitsetBitsPerWord - 1))); + Branch(Word32Equal(Word32And(word, bit), Int32Constant(0)), &proceed, + &out); + } BIND(&proceed); } @@ -1603,7 +1784,7 @@ TNode RegExpBuiltinsAssembler::AdvanceStringIndex( // Must be in Smi range on the fast path. We control the value of {index} // on all call-sites and can never exceed the length of the string. static_assert(String::kMaxLength + 2 < Smi::kMaxValue); - // TODO(532595489): Hard CHECK for now as a quick fix. + // CSA_CHECK kept as defense-in-depth against unexpected fast-path overflow. CSA_CHECK(this, TaggedIsPositiveSmi(index_plus_one)); } @@ -1701,9 +1882,11 @@ TNode RegExpBuiltinsAssembler::RegExpPrototypeSplitBody( const ElementsKind elements_kind = PACKED_ELEMENTS; + TVARIABLE(JSArray, var_result); + Label done(this); + Label done_no_result_vector(this, &var_result); Label return_empty_array(this, Label::kDeferred); - TVARIABLE(JSArray, var_result); // Exception handling is necessary to free any allocated memory. TVARIABLE(Object, var_exception); @@ -1714,6 +1897,23 @@ TNode RegExpBuiltinsAssembler::RegExpPrototypeSplitBody( // the specialized AdvanceStringIndex logic below. TNode data = LoadRegExpDataFromObject(regexp, offsetof(JSRegExp, data_)); + + // Only an unlimited split is cacheable, since the cached array holds every + // part. v8_flags.regexp_results_cache is a mksnapshot-time constant here, so + // it is checked in ResultsCache::{Lookup,Enter} instead. + TNode is_cacheable = + Word32And(SmiEqual(limit, SmiConstant(Smi::kMaxValue)), + IsInternalizedString(string)); + { + Label next(this); + GotoIfNot(is_cacheable, &next); + TryRegExpSplitCacheLookup(context, regexp, data, string, &var_result, + &done_no_result_vector); + Goto(&next); + + BIND(&next); + } + TNode capture_count = LoadCaptureCount(data); TNode register_count_per_match = RegistersForCaptureCount(capture_count); TNode result_offsets_vector; @@ -1791,11 +1991,13 @@ TNode RegExpBuiltinsAssembler::RegExpPrototypeSplitBody( TVARIABLE(Smi, var_last_matched_until, SmiZero()); TVARIABLE(Smi, var_next_search_from, SmiZero()); + // Whether the loop wrote LastMatchInfo. Only then may a hit replay it. + TVARIABLE(BoolT, var_did_match, Int32FalseConstant()); - Label loop(this, - {array.var_array(), array.var_length(), array.var_capacity(), - &var_last_matched_until, &var_next_search_from}), - push_suffix_and_out(this), out(this); + Label loop( + this, {array.var_array(), array.var_length(), array.var_capacity(), + &var_last_matched_until, &var_next_search_from, &var_did_match}), + push_suffix_and_out(this), out(this), out_cacheable(this); Goto(&loop); BIND(&loop); @@ -1833,6 +2035,7 @@ TNode RegExpBuiltinsAssembler::RegExpPrototypeSplitBody( match_info = InitializeMatchInfoFromRegisters( context, match_info, register_count_per_match, string, result_offsets_vector); + var_did_match = Int32TrueConstant(); TNode match_to = LoadArrayElement(match_info, IntPtrConstant(1)); @@ -1925,7 +2128,32 @@ TNode RegExpBuiltinsAssembler::RegExpPrototypeSplitBody( TNode from = var_last_matched_until.value(); TNode to = string_length; array.Push(CallBuiltin(Builtin::kSubString, context, string, from, to)); - Goto(&out); + Branch(is_cacheable, &out_cacheable, &out); + } + + // Only reached when the split ran to the end of the subject. A split cut + // short by {limit} exits through {out} and must not be cached. + BIND(&out_cacheable); + { + var_result = array.ToJSArray(context); + + // Snapshot rather than reconstruct which match was the last one: the + // final match may contribute no element, e.g. one at the end of the + // subject. + TNode last_match_cache = + SnapshotLastMatchInfo(context, var_did_match.value()); + TNode function = + ExternalConstant(ExternalReference::re_split_cache_enter()); + TNode isolate_ptr = + ExternalConstant(ExternalReference::isolate_address()); + CallCFunction( + function, MachineType::AnyTagged(), + std::make_pair(MachineType::Pointer(), isolate_ptr), + std::make_pair(MachineType::AnyTagged(), string), + std::make_pair(MachineType::AnyTagged(), regexp), + std::make_pair(MachineType::AnyTagged(), var_result.value()), + std::make_pair(MachineType::AnyTagged(), last_match_cache)); + Goto(&done); } BIND(&out); @@ -1957,6 +2185,9 @@ TNode RegExpBuiltinsAssembler::RegExpPrototypeSplitBody( BIND(&done); FreeRegExpResultVector(result_offsets_vector, result_offsets_vector_is_dynamic); + Goto(&done_no_result_vector); + + BIND(&done_no_result_vector); return var_result.value(); } diff --git a/deps/v8/src/builtins/builtins-regexp-gen.h b/deps/v8/src/builtins/builtins-regexp-gen.h index 480150132b6e..2470de6e572a 100644 --- a/deps/v8/src/builtins/builtins-regexp-gen.h +++ b/deps/v8/src/builtins/builtins-regexp-gen.h @@ -65,11 +65,27 @@ class RegExpBuiltinsAssembler : public CodeStubAssembler { void FreeRegExpResultVector(TNode result_vector, TNode is_dynamic); + // Grows {match_info} if it cannot hold {register_count} registers and + // initializes its header. The caller fills in the capture offsets. + TNode PrepareMatchInfo(TNode context, + TNode match_info, + TNode register_count, + TNode subject); + TNode InitializeMatchInfoFromRegisters( TNode context, TNode match_info, TNode register_count, TNode subject, TNode result_offsets_vector); + void TryRegExpSplitCacheLookup(TNode context, TNode regexp, + TNode data, TNode string, + TVariable* var_result, + Label* if_found); + TNode SnapshotLastMatchInfo(TNode context, + TNode did_match); + void ReplayLastMatchInfo(TNode context, TNode subject, + TNode last_match_cache); + // Low level logic around the actual call into pattern matching code. // // TODO(jgruber): Callers that either 1. don't need the RegExpMatchInfo, or diff --git a/deps/v8/src/builtins/builtins-sharedarraybuffer.cc b/deps/v8/src/builtins/builtins-sharedarraybuffer.cc index 2c34fefd8e88..430a251b77b1 100644 --- a/deps/v8/src/builtins/builtins-sharedarraybuffer.cc +++ b/deps/v8/src/builtins/builtins-sharedarraybuffer.cc @@ -11,6 +11,7 @@ #include "src/logging/counters.h" #include "src/numbers/conversions-inl.h" #include "src/objects/js-array-buffer-inl.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" namespace v8 { @@ -87,6 +88,8 @@ V8_WARN_UNUSED_RESULT MaybeDirectHandle ValidateIntegerTypedArray( V8_WARN_UNUSED_RESULT Maybe ValidateAtomicAccess( Isolate* isolate, DirectHandle typed_array, Handle request_index) { + size_t typed_array_length = typed_array->GetLength(); + DirectHandle access_index_obj; ASSIGN_RETURN_ON_EXCEPTION( isolate, access_index_obj, @@ -94,7 +97,6 @@ V8_WARN_UNUSED_RESULT Maybe ValidateAtomicAccess( MessageTemplate::kInvalidAtomicAccessIndex)); size_t access_index; - size_t typed_array_length = typed_array->GetLength(); if (!TryNumberToSize(*access_index_obj, &access_index) || access_index >= typed_array_length) { isolate->Throw(*isolate->factory()->NewRangeError( diff --git a/deps/v8/src/builtins/builtins-string-gen.cc b/deps/v8/src/builtins/builtins-string-gen.cc index cefce65959ec..06c2de1f2a76 100644 --- a/deps/v8/src/builtins/builtins-string-gen.cc +++ b/deps/v8/src/builtins/builtins-string-gen.cc @@ -1575,6 +1575,11 @@ TNode StringBuiltinsAssembler::StringToArray( TNode elements = CAST(AllocateFixedArray(PACKED_ELEMENTS, length)); + // The allocation above may have internalized a shared subject, forwarding + // it to a ThinString or freeing an external resource, which would leave + // the pointer below pointing at unrelated heap data. + to_direct.BailIfTransitioned(&fill_thehole_and_call_runtime); + // Don't allocate anything while {string_data} is live! TNode string_data = to_direct.PointerToData(&fill_thehole_and_call_runtime); @@ -1854,13 +1859,16 @@ void StringBuiltinsAssembler::ReplaceUnpairedSurrogates(TNode source, if_indirect); TNode source_data = DirectStringData(source, source_instance_type); - // The destination string is a freshly allocated SeqString, and so is always - // direct. - TNode dest_instance_type = LoadInstanceType(dest); - CSA_DCHECK(this, Word32Equal(Word32And(dest_instance_type, - Int32Constant(kStringEncodingMask)), - Int32Constant(kTwoByteStringTag))); - TNode dest_data = DirectStringData(dest, dest_instance_type); + // The destination string is a freshly allocated TwoByteSeqString, and so is + // always direct. + CSA_DCHECK(this, + Word32Equal( + Word32And(LoadInstanceType(dest), + Int32Constant(kIsNotStringMask | + kStringRepresentationAndEncodingMask)), + Int32Constant(kSeqTwoByteStringTag))); + TNode dest_data = + DirectStringData(dest, Int32Constant(SEQ_TWO_BYTE_STRING_TYPE)); TNode length = LoadStringLengthAsWord(source); CSA_DCHECK(this, IntPtrEqual(length, LoadStringLengthAsWord(dest))); diff --git a/deps/v8/src/builtins/builtins-string.cc b/deps/v8/src/builtins/builtins-string.cc index ccb5ca655608..235d2f09c1e2 100644 --- a/deps/v8/src/builtins/builtins-string.cc +++ b/deps/v8/src/builtins/builtins-string.cc @@ -8,6 +8,7 @@ #include "src/builtins/builtins.h" #include "src/logging/counters.h" #include "src/numbers/conversions.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" #ifdef V8_INTL_SUPPORT #include "src/objects/intl-objects.h" diff --git a/deps/v8/src/builtins/builtins-struct.cc b/deps/v8/src/builtins/builtins-struct.cc index e3288f160613..0ab121a50120 100644 --- a/deps/v8/src/builtins/builtins-struct.cc +++ b/deps/v8/src/builtins/builtins-struct.cc @@ -6,6 +6,7 @@ #include "src/builtins/builtins-utils-inl.h" #include "src/objects/js-struct.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/property-details.h" namespace v8 { diff --git a/deps/v8/src/builtins/builtins-temporal.cc b/deps/v8/src/builtins/builtins-temporal.cc index 17e209bb0f81..b323771263b6 100644 --- a/deps/v8/src/builtins/builtins-temporal.cc +++ b/deps/v8/src/builtins/builtins-temporal.cc @@ -6,6 +6,7 @@ #include "src/builtins/builtins.h" #include "src/objects/bigint.h" #include "src/objects/js-temporal-objects-inl.h" +#include "src/objects/object-conversions-inl.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/builtins/builtins-trace.cc b/deps/v8/src/builtins/builtins-trace.cc index 6b209893add6..5acfb72e4468 100644 --- a/deps/v8/src/builtins/builtins-trace.cc +++ b/deps/v8/src/builtins/builtins-trace.cc @@ -7,6 +7,7 @@ #include "src/builtins/builtins.h" #include "src/json/json-stringifier.h" #include "src/logging/counters.h" +#include "src/objects/object-conversions-inl.h" #include "src/objects/objects-inl.h" #include "src/roots/roots-inl.h" #include "src/tracing/perfetto-sdk.h" diff --git a/deps/v8/src/builtins/builtins.cc b/deps/v8/src/builtins/builtins.cc index cae92c151a1f..31474ac5f24f 100644 --- a/deps/v8/src/builtins/builtins.cc +++ b/deps/v8/src/builtins/builtins.cc @@ -654,6 +654,7 @@ Builtins::JSBuiltinStateFlags Builtins::GetJSBuiltinState(Builtin builtin) { case Builtin::kFunctionLogNextExecution: case Builtin::kMarkReoptimizeLazyDeoptimized: case Builtin::kMarkLazyDeoptimized: + case Builtin::kMarkFlushed: // All *DeoptContinuation builtins. case Builtin::kArrayEveryLoopEagerDeoptContinuation: case Builtin::kArrayEveryLoopLazyDeoptContinuation: @@ -842,52 +843,6 @@ Builtins::JSBuiltinStateFlags Builtins::GetJSBuiltinState(Builtin builtin) { case Builtin::kSharedStructConstructor: RETURN_FLAG_DEPENDENT_LAZY_BUILTIN_STATE(v8_flags.harmony_struct); - // --js-promise-try - case Builtin::kPromiseTry: - RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_promise_try); - - // --js-atomics-pause - case Builtin::kAtomicsPause: - RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_atomics_pause); - - // --js-error-iserror - case Builtin::kErrorIsError: - RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_error_iserror); - - // --js-regexp-escape - case Builtin::kRegExpEscape: - RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_regexp_escape); - - // --js-explicit-resource-management - case Builtin::kSuppressedErrorConstructor: - case Builtin::kDisposableStackConstructor: - case Builtin::kDisposableStackPrototypeUse: - case Builtin::kDisposableStackPrototypeDispose: - case Builtin::kDisposableStackPrototypeAdopt: - case Builtin::kDisposableStackPrototypeDefer: - case Builtin::kDisposableStackPrototypeMove: - case Builtin::kDisposableStackPrototypeGetDisposed: - case Builtin::kAsyncDisposableStackConstructor: - case Builtin::kAsyncDisposableStackPrototypeUse: - case Builtin::kAsyncDisposableStackPrototypeDisposeAsync: - case Builtin::kAsyncDisposableStackPrototypeAdopt: - case Builtin::kAsyncDisposableStackPrototypeDefer: - case Builtin::kAsyncDisposableStackPrototypeMove: - case Builtin::kAsyncDisposableStackPrototypeGetDisposed: - case Builtin::kIteratorPrototypeDispose: - case Builtin::kAsyncIteratorPrototypeAsyncDispose: - RETURN_FLAG_DEPENDENT_BUILTIN_STATE( - v8_flags.js_explicit_resource_management); - - // --js-base-64 - case Builtin::kUint8ArrayFromBase64: - case Builtin::kUint8ArrayFromHex: - case Builtin::kUint8ArrayPrototypeToBase64: - case Builtin::kUint8ArrayPrototypeSetFromBase64: - case Builtin::kUint8ArrayPrototypeToHex: - case Builtin::kUint8ArrayPrototypeSetFromHex: - RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_base_64); - // --js-iterator-sequencing: case Builtin::kIteratorConcat: RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_iterator_sequencing); @@ -897,23 +852,12 @@ Builtins::JSBuiltinStateFlags Builtins::GetJSBuiltinState(Builtin builtin) { case Builtin::kIteratorZipKeyed: RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_joint_iteration); - // --js-upsert - case Builtin::kMapPrototypeGetOrInsert: - case Builtin::kMapPrototypeGetOrInsertComputed: - case Builtin::kWeakMapPrototypeGetOrInsert: - case Builtin::kWeakMapPrototypeGetOrInsertComputed: - RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_upsert); - // --js-immutable-arraybuffer case Builtin::kArrayBufferPrototypeGetImmutable: case Builtin::kArrayBufferPrototypeTransferToImmutable: case Builtin::kArrayBufferPrototypeSliceToImmutable: RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_immutable_arraybuffer); - // --js-sum-precise - case Builtin::kMathSumPrecise: - RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_sum_precise); - // --enable-queue-microtask case Builtin::kGlobalQueueMicrotask: RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.enable_queue_microtask); @@ -926,12 +870,6 @@ Builtins::JSBuiltinStateFlags Builtins::GetJSBuiltinState(Builtin builtin) { case Builtin::kIteratorPrototypeIncludes: RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_iterator_includes); -#ifdef V8_INTL_SUPPORT - // --js-intl-locale-variants - case Builtin::kLocalePrototypeVariants: - RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_intl_locale_variants); -#endif // V8_INTL_SUPPORT - default: { // Treat all other JS builtins as mandatory core JS language builtins. // This will allow us to detect optional builtins (because mandatory JS @@ -962,7 +900,7 @@ void Builtins::VerifyGetJSBuiltinState(bool allow_non_initial_state) { // JSFunctions. for (Tagged obj = iterator.Next(); !obj.is_null(); obj = iterator.Next()) { - if (IsAnyHole(obj)) continue; + if (IsInaccessible(obj)) continue; Tagged func; if (!TryCast(obj, &func)) continue; diff --git a/deps/v8/src/builtins/builtins.h b/deps/v8/src/builtins/builtins.h index e318f9d1de62..938885ffdf74 100644 --- a/deps/v8/src/builtins/builtins.h +++ b/deps/v8/src/builtins/builtins.h @@ -156,6 +156,12 @@ class Builtins { static constexpr Builtin kLastTier0 = static_cast(kBuiltinTier0Count - 1); +#ifdef V8_METAGEN_GENERATION_PASS + static constexpr int kFirstWideBytecodeHandler = 0; + static constexpr int kFirstExtraWideBytecodeHandler = 0; + static constexpr int kLastBytecodeHandlerPlusOne = 0; + static constexpr bool kBytecodeHandlersAreSortedLast = true; +#else static constexpr int kFirstWideBytecodeHandler = static_cast(Builtin::kFirstBytecodeHandler) + kNumberOfBytecodeHandlers; @@ -165,6 +171,7 @@ class Builtins { kFirstExtraWideBytecodeHandler + kNumberOfWideBytecodeHandlers; static constexpr bool kBytecodeHandlersAreSortedLast = kLastBytecodeHandlerPlusOne == kBuiltinCount; +#endif // V8_METAGEN_GENERATION_PASS static_assert(kBytecodeHandlersAreSortedLast); #if V8_ENABLE_GEARBOX @@ -728,6 +735,11 @@ DEFINE_TYPED_OP_CHECKER(BitwiseAnd, None, SignedSmall) DEFINE_TYPED_OP_CHECKER(ShiftLeft, None, SignedSmall) DEFINE_TYPED_OP_CHECKER(ShiftRight, None, SignedSmall) DEFINE_TYPED_OP_CHECKER(ShiftRightLogical, None, SignedSmall) +// Unary op typed-stub families. +DEFINE_TYPED_OP_CHECKER(Increment, None, SignedSmall) +DEFINE_TYPED_OP_CHECKER(Decrement, None, SignedSmall) +DEFINE_TYPED_OP_CHECKER(Negate, None, Number) +DEFINE_TYPED_OP_CHECKER(BitwiseNot, None, SignedSmall) #undef DEFINE_TYPED_OP_CHECKER #endif // V8_ENABLE_SPARKPLUG_PLUS diff --git a/deps/v8/src/builtins/convert.tq b/deps/v8/src/builtins/convert.tq index cb2043c65a31..ce4823056cba 100644 --- a/deps/v8/src/builtins/convert.tq +++ b/deps/v8/src/builtins/convert.tq @@ -298,6 +298,9 @@ Convert(ui: uintptr): uint32 { Convert(s: Smi): intptr { return SmiUntag(s); } +Convert(s: Smi): uintptr { + return Unsigned(SmiUntag(s)); +} Convert(ps: PositiveSmi): uintptr { return Unsigned(SmiUntag(ps)); } diff --git a/deps/v8/src/builtins/generator.tq b/deps/v8/src/builtins/generator.tq index d6f2b748e07d..8f8fd2d5c97f 100644 --- a/deps/v8/src/builtins/generator.tq +++ b/deps/v8/src/builtins/generator.tq @@ -43,7 +43,8 @@ transitioning javascript builtin GeneratorPrototypeNextLazyDeoptContinuation( // Allocating the iterator result object was skipped; allocate it here. if (result == TheHole) { - return AllocateJSIteratorResult(yieldedValue, False); + const val = (yieldedValue == TheHole) ? Undefined : yieldedValue; + return AllocateJSIteratorResult(val, False); } return result; diff --git a/deps/v8/src/builtins/ia32/builtins-ia32.cc b/deps/v8/src/builtins/ia32/builtins-ia32.cc index 603ea966edb3..4af3c368c7c6 100644 --- a/deps/v8/src/builtins/ia32/builtins-ia32.cc +++ b/deps/v8/src/builtins/ia32/builtins-ia32.cc @@ -3373,6 +3373,7 @@ void SwitchStacks(MacroAssembler* masm, ExternalReference fn, void ReloadParentStack(MacroAssembler* masm, Register promise, Register return_value, Register context, Register tmp, Register tmp2) { + DCHECK_NE(tmp, tmp2); Register active_stack = tmp; __ LoadRootRelative(active_stack, IsolateData::active_stack_offset()); @@ -3384,7 +3385,10 @@ void ReloadParentStack(MacroAssembler* masm, Register promise, // Switch stack! SwitchStacks(masm, ExternalReference::wasm_return_jspi_stack(), parent, nullptr, no_reg, {promise, return_value, context, parent}); + __ mov(tmp, Operand(parent, wasm::kStackPcOffset)); LoadJumpBuffer(masm, parent, false); + __ mov(MemOperand(ebp, WasmJspiFrameConstants::kParentReturnAddressOffset), + tmp); } // Loads the context field of the WasmTrustedInstanceData or WasmImportData @@ -3524,6 +3528,8 @@ void SwitchBackAndReturnPromise(MacroAssembler* masm, Register tmp, } __ bind(return_promise); + // The initial wrapper and a resume callback have different argument cleanup. + __ jmp(MemOperand(ebp, WasmJspiFrameConstants::kParentReturnAddressOffset)); } void GenerateExceptionHandlingLandingPad(MacroAssembler* masm, @@ -3746,6 +3752,7 @@ void JSToWasmWrapperHelper(MacroAssembler* masm, wasm::Promise mode) { if (stack_switch) { SwitchBackAndReturnPromise(masm, edx, edi, mode, &return_promise); + __ Trap(); // Unreachable. } __ bind(&suspend); @@ -3852,6 +3859,9 @@ namespace { // forwards the value, the onRejected variant throws the value. void Generate_WasmResumeHelper(MacroAssembler* masm, wasm::OnResume on_resume) { + __ cmp(kJavaScriptCallArgCountRegister, Immediate(JSParameterCount(1))); + __ Check(equal, AbortReason::kJSSignatureMismatch); + __ EnterFrame(StackFrame::WASM_JSPI); Register closure = kJSFunctionRegister; // edi @@ -5287,7 +5297,7 @@ void Builtins::Generate_RestartFrameTrampoline(MacroAssembler* masm) { __ LeaveFrame(StackFrame::INTERPRETED); // The arguments are already in the stack, but we might need to adapt them - // if the function signature changed (e.g. via LiveEdit). + // if the function signature changed. __ mov(ecx, FieldOperand(edi, offsetof(JSFunction, shared_function_info_))); __ movzx_w(ecx, FieldOperand(ecx, offsetof(SharedFunctionInfo, formal_parameter_count_))); diff --git a/deps/v8/src/builtins/iterator-helpers.tq b/deps/v8/src/builtins/iterator-helpers.tq index 38ec255f000c..50bf3b492b5a 100644 --- a/deps/v8/src/builtins/iterator-helpers.tq +++ b/deps/v8/src/builtins/iterator-helpers.tq @@ -1750,6 +1750,7 @@ transitioning macro IteratorZipHelperNextCommon( // ii. Return ? IteratorCloseAll(openIters, result). iterators.objects[kIteratorRecordFieldCount * i] = TheHole; IteratorZipCloseAll(iterators, false); + MarkIteratorHelperAsExhausted(helper); goto DoneWithException(exception, message); } label IterDone { // d. If result is done, then @@ -1809,6 +1810,7 @@ transitioning macro IteratorZipHelperNextCommon( // ii. Return ? IteratorCloseAll(openIters, open). iterators.objects[kIteratorRecordFieldCount * k] = TheHole; IteratorZipCloseAll(iterators, false); + MarkIteratorHelperAsExhausted(helper); goto DoneWithException(e, message); } label InnerDone { // v. If open is done, then @@ -2119,17 +2121,21 @@ transitioning javascript builtin IteratorPrototypeIncludes( } // 6. If toSkip < -0𝔽, then - if (toSkip < 0) { - // a. Let error be ThrowCompletion(a newly created RangeError object). - // b. Return ? IteratorClose(iterated, error). + // a. Let error be ThrowCompletion(a newly created RangeError object). + // b. Return ? IteratorClose(iterated, error). + // 7. If toSkip is finite and toSkip > 𝔽(2^53 - 1), then + // a. Let error be ThrowCompletion(a newly created RangeError object). + // b. Return ? IteratorClose(iterated, error). + if (toSkip < 0 || + (!NumberIsSomeInfinity(toSkip) && toSkip > kMaxSafeInteger)) { IteratorCloseOnException(o); ThrowRangeError(MessageTemplate::kMustBePositive, skippedElements); } - // 7. Let skipped be +0𝔽. + // 8. Let skipped be +0𝔽. let skipped: Number = 0; - // 8. Set iterated to ? GetIteratorDirect(O). + // 9. Set iterated to ? GetIteratorDirect(O). const iterated = GetIteratorDirect(o); const fastIteratorResultMap = GetIteratorResultMap(); diff --git a/deps/v8/src/builtins/iterator.tq b/deps/v8/src/builtins/iterator.tq index a3880479e066..3dc42371b1ca 100644 --- a/deps/v8/src/builtins/iterator.tq +++ b/deps/v8/src/builtins/iterator.tq @@ -385,9 +385,9 @@ transitioning javascript builtin AsyncIteratorPrototypeAsyncDispose( const returnMethod = GetMethod(receiver, kReturnString) otherwise IfUndefined; // 6. Else, - // a. Let result be Call(return, O, « undefined »). + // a. Let result be Call(return, O, « »). // b. IfAbruptRejectPromise(result, promiseCapability). - const result = Call(context, returnMethod, receiver, Undefined); + const result = Call(context, returnMethod, receiver); // c. Let resultWrapper be Completion(PromiseResolve(%Promise%, result)). // d. IfAbruptRejectPromise(resultWrapper, promiseCapability). diff --git a/deps/v8/src/builtins/js-trampoline-assembler.cc b/deps/v8/src/builtins/js-trampoline-assembler.cc index 0eec800258c4..1f5c17a22c53 100644 --- a/deps/v8/src/builtins/js-trampoline-assembler.cc +++ b/deps/v8/src/builtins/js-trampoline-assembler.cc @@ -158,18 +158,24 @@ TF_BUILTIN(OptimizeTurbofanEager, JSTrampolineAssembler) { TF_BUILTIN(MarkLazyDeoptimized, JSTrampolineAssembler) { TieringBuiltinImpl([&](TNode context, TNode function) { - CallRuntime(Runtime::kMarkLazyDeoptimized, context, function, + CallRuntime(Runtime::kMarkLazyDeoptimizedOrFlushed, context, function, /* reoptimize */ SmiConstant(false)); }); } TF_BUILTIN(MarkReoptimizeLazyDeoptimized, JSTrampolineAssembler) { TieringBuiltinImpl([&](TNode context, TNode function) { - CallRuntime(Runtime::kMarkLazyDeoptimized, context, function, + CallRuntime(Runtime::kMarkLazyDeoptimizedOrFlushed, context, function, /* reoptimize */ SmiConstant(true)); }); } +TF_BUILTIN(MarkFlushed, JSTrampolineAssembler) { + TieringBuiltinImpl([&](TNode context, TNode function) { + CallRuntime(Runtime::kMarkLazyDeoptimizedOrFlushed, context, function, + /* reoptimize */ SmiConstant(false)); + }); +} #include "src/codegen/undef-code-stub-assembler-macros.inc" diff --git a/deps/v8/src/builtins/loong64/builtins-loong64.cc b/deps/v8/src/builtins/loong64/builtins-loong64.cc index 042043bef99c..1257a6ee3b0f 100644 --- a/deps/v8/src/builtins/loong64/builtins-loong64.cc +++ b/deps/v8/src/builtins/loong64/builtins-loong64.cc @@ -391,7 +391,7 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { Register dispatch_handle = kJavaScriptCallDispatchHandleRegister; Register code = kJavaScriptCallCodeStartRegister; Register scratch = t5; - __ Ld_w(dispatch_handle, + __ Ld_wu(dispatch_handle, FieldMemOperand(a5, offsetof(JSFunction, dispatch_handle_))); __ LoadEntrypointAndParameterCountFromJSDispatchTable( code, argc, dispatch_handle, scratch); @@ -3237,6 +3237,7 @@ void SwitchStacks(MacroAssembler* masm, ExternalReference fn, void ReloadParentStack(MacroAssembler* masm, Register return_reg, Register return_value, Register context, Register tmp1, Register tmp2, Register tmp3) { + DCHECK(!AreAliased(tmp1, tmp2, tmp3)); Register active_stack = tmp1; __ LoadRootRelative(active_stack, IsolateData::active_stack_offset()); @@ -3250,7 +3251,10 @@ void ReloadParentStack(MacroAssembler* masm, Register return_reg, // Switch stack! SwitchStacks(masm, ExternalReference::wasm_return_jspi_stack(), parent, nullptr, no_reg, {return_reg, return_value, context, parent}); + __ Ld_d(tmp1, MemOperand(parent, wasm::kStackPcOffset)); LoadJumpBuffer(masm, parent, false, tmp3); + __ St_d(tmp1, + MemOperand(fp, WasmJspiFrameConstants::kParentReturnAddressOffset)); } void RestoreParentSuspender(MacroAssembler* masm, Register tmp1) { @@ -3519,6 +3523,9 @@ namespace { // forwards the value, the onRejected variant throws the value. void Generate_WasmResumeHelper(MacroAssembler* masm, wasm::OnResume on_resume) { + __ Check(eq, AbortReason::kJSSignatureMismatch, + kJavaScriptCallArgCountRegister, Operand(JSParameterCount(1))); + auto regs = RegisterAllocator::WithAllocatableGeneralRegisters(); __ EnterFrame(StackFrame::WASM_JSPI); @@ -3957,6 +3964,10 @@ void SwitchBackAndReturnPromise(MacroAssembler* masm, RegisterAllocator& regs, FREE_REG(return_value); __ bind(return_promise); + // The initial wrapper and a resume callback have different argument cleanup. + __ Ld_d(tmp, + MemOperand(fp, WasmJspiFrameConstants::kParentReturnAddressOffset)); + __ Jump(tmp); } void GenerateExceptionHandlingLandingPad(MacroAssembler* masm, @@ -4198,6 +4209,7 @@ void JSToWasmWrapperHelper(MacroAssembler* masm, wasm::Promise mode) { Label return_promise; if (stack_switch) { SwitchBackAndReturnPromise(masm, regs, mode, &return_promise); + __ Trap(); // Unreachable. } __ bind(&suspend); @@ -5353,7 +5365,7 @@ void Builtins::Generate_RestartFrameTrampoline(MacroAssembler* masm) { __ LeaveFrame(StackFrame::INTERPRETED); // The arguments are already in the stack, but we might need to adapt them - // if the function signature changed (e.g. via LiveEdit). + // if the function signature changed. __ InvokeFunction(a1, a0, InvokeType::kJump, ArgumentAdaptionMode::kAdapt); } diff --git a/deps/v8/src/builtins/mips64/builtins-mips64.cc b/deps/v8/src/builtins/mips64/builtins-mips64.cc index 3d7b34af866a..e811c841236e 100644 --- a/deps/v8/src/builtins/mips64/builtins-mips64.cc +++ b/deps/v8/src/builtins/mips64/builtins-mips64.cc @@ -391,8 +391,8 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { Register argc = kJavaScriptCallArgCountRegister; Register dispatch_handle = kJavaScriptCallDispatchHandleRegister; Register code = kJavaScriptCallCodeStartRegister; - __ Lw(dispatch_handle, - FieldMemOperand(a5, offsetof(JSFunction, dispatch_handle_))); + __ Lwu(dispatch_handle, + FieldMemOperand(a5, offsetof(JSFunction, dispatch_handle_))); __ LoadEntrypointAndParameterCountFromJSDispatchTable(code, argc, dispatch_handle, t3); // In case the formal parameter count is kDontAdaptArgumentsSentinel the @@ -4223,7 +4223,7 @@ void Builtins::Generate_RestartFrameTrampoline(MacroAssembler* masm) { __ LeaveFrame(StackFrame::INTERPRETED); // The arguments are already in the stack, but we might need to adapt them - // if the function signature changed (e.g. via LiveEdit). + // if the function signature changed. __ InvokeFunction(a1, a0, InvokeType::kJump, ArgumentAdaptionMode::kAdapt); } diff --git a/deps/v8/src/builtins/ppc/builtins-ppc.cc b/deps/v8/src/builtins/ppc/builtins-ppc.cc index b19567abf28e..60be0d9367c6 100644 --- a/deps/v8/src/builtins/ppc/builtins-ppc.cc +++ b/deps/v8/src/builtins/ppc/builtins-ppc.cc @@ -426,7 +426,9 @@ void OnStackReplacement(MacroAssembler* masm, OsrSourceTier source, Label next; __ Move(r4, ExternalReference::address_of_log_or_trace_osr()); __ LoadU8(r4, MemOperand(r4)); - __ andi(r0, r4, Operand(0xFF)); // Mask to the LSB. + UseScratchRegisterScope temps(masm); + Register scratch = temps.Acquire(); + __ andi(scratch, r4, Operand(0xFF)); // Mask to the LSB. __ beq(&next, cr0); { @@ -471,10 +473,12 @@ void OnStackReplacement(MacroAssembler* masm, OsrSourceTier source, LeaveRC); // Compute the target address = code start + osr_offset - __ add(r0, r3, r4); + UseScratchRegisterScope temps(masm); + Register scratch = temps.Acquire(); + __ add(scratch, r3, r4); // And "return" to the OSR entry point of the function. - __ mtlr(r0); + __ mtlr(scratch); __ blr(); } } @@ -1826,7 +1830,7 @@ void Builtins::Generate_InterpreterPushArgsThenFastConstructFunction( Label non_constructor; __ LoadMap(r5, r4); __ lbz(r5, FieldMemOperand(r5, offsetof(Map, bit_field_))); - __ TestBit(r5, Map::Bits1::IsConstructorBit::kShift, r0); + __ TestBit(r5, Map::Bits1::IsConstructorBit::kShift); __ beq(&non_constructor, cr0); // Add a stack check before pushing arguments. @@ -1993,7 +1997,7 @@ static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) { if (v8_flags.debug_code) { // Check function data field is actually a BytecodeArray object. - __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); + __ TestIfSmi(kInterpreterBytecodeArrayRegister); __ Assert(ne, AbortReason::kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, cr0); @@ -2208,7 +2212,7 @@ static void GenerateCall(MacroAssembler* masm, Register argc, Register target, DCHECK(!AreAliased(argc, target, flags)); __ lbz(flags, FieldMemOperand(map, offsetof(Map, bit_field_))); map = no_reg; - __ TestBit(flags, Map::Bits1::IsCallableBit::kShift, r0); + __ TestBit(flags, Map::Bits1::IsCallableBit::kShift); __ beq(&non_callable, cr0); } @@ -2588,7 +2592,7 @@ void Builtins::Generate_CallOrConstructForwardVarargs(MacroAssembler* masm, __ LoadTaggedField(scratch, FieldMemOperand(r6, offsetof(HeapObject, map_))); __ lbz(scratch, FieldMemOperand(scratch, offsetof(Map, bit_field_))); - __ TestBit(scratch, Map::Bits1::IsConstructorBit::kShift, r0); + __ TestBit(scratch, Map::Bits1::IsConstructorBit::kShift); __ bne(&new_target_constructor, cr0); __ bind(&new_target_not_constructor); { @@ -2937,7 +2941,7 @@ void Builtins::Generate_Construct(MacroAssembler* masm) { Register flags = r5; DCHECK(!AreAliased(r3, target, map, instance_type, flags)); __ lbz(flags, FieldMemOperand(map, offsetof(Map, bit_field_))); - __ TestBit(flags, Map::Bits1::IsConstructorBit::kShift, r0); + __ TestBit(flags, Map::Bits1::IsConstructorBit::kShift); __ beq(&non_constructor, cr0); } @@ -3271,6 +3275,7 @@ void SwitchStacks(MacroAssembler* masm, ExternalReference fn, void ReloadParentStack(MacroAssembler* masm, Register return_reg, Register return_value, Register context, Register tmp1, Register tmp2, Register tmp3) { + DCHECK(!AreAliased(tmp1, tmp2, tmp3)); Register active_stack = tmp1; __ LoadRootRelative(active_stack, IsolateData::active_stack_offset()); @@ -3283,7 +3288,10 @@ void ReloadParentStack(MacroAssembler* masm, Register return_reg, // Switch stack! SwitchStacks(masm, ExternalReference::wasm_return_jspi_stack(), parent, nullptr, no_reg, {return_reg, return_value, context, parent}); + __ LoadU64(tmp1, MemOperand(parent, wasm::kStackPcOffset)); LoadJumpBuffer(masm, parent, false, tmp3); + __ StoreU64( + tmp1, MemOperand(fp, WasmJspiFrameConstants::kParentReturnAddressOffset)); } void RestoreParentSuspender(MacroAssembler* masm, Register tmp1) { @@ -3527,6 +3535,9 @@ namespace { // forwards the value, the onRejected variant throws the value. void Generate_WasmResumeHelper(MacroAssembler* masm, wasm::OnResume on_resume) { + __ CmpS64(kJavaScriptCallArgCountRegister, Operand(JSParameterCount(1))); + __ Check(eq, AbortReason::kJSSignatureMismatch); + auto regs = RegisterAllocator::WithAllocatableGeneralRegisters(); __ EnterFrame(StackFrame::WASM_JSPI); @@ -3985,6 +3996,10 @@ void SwitchBackAndReturnPromise(MacroAssembler* masm, RegisterAllocator& regs, FREE_REG(promise); FREE_REG(return_value); __ bind(return_promise); + // The initial wrapper and a resume callback have different argument cleanup. + __ LoadU64( + tmp, MemOperand(fp, WasmJspiFrameConstants::kParentReturnAddressOffset)); + __ Jump(tmp); } void GenerateExceptionHandlingLandingPad(MacroAssembler* masm, @@ -4219,6 +4234,7 @@ void JSToWasmWrapperHelper(MacroAssembler* masm, wasm::Promise mode) { Label return_promise; if (stack_switch) { SwitchBackAndReturnPromise(masm, regs, mode, &return_promise); + __ Trap(); // Unreachable. } __ bind(&suspend); @@ -4476,9 +4492,7 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, // r14: still holds argc (C caller-saved). __ LeaveExitFrame(); if (argv_mode == ArgvMode::kStack) { - DCHECK(!AreAliased(scratch, argc_sav)); - __ ShiftLeftU64(scratch, argc_sav, Operand(kSystemPointerSizeLog2)); - __ AddS64(sp, sp, scratch); + __ Drop(argc_sav); } __ blr(); @@ -4609,7 +4623,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) { result_reg, d0); // Test for overflow - __ TestIfInt32(result_reg, r0); + __ TestIfInt32(result_reg); __ beq(&fastpath_done); __ Push(scratch_high, scratch_low); @@ -5251,7 +5265,7 @@ void Builtins::Generate_RestartFrameTrampoline(MacroAssembler* masm) { __ LeaveFrame(StackFrame::INTERPRETED); // The arguments are already in the stack, but we might need to adapt them - // if the function signature changed (e.g. via LiveEdit). + // if the function signature changed. __ LoadTaggedField( r5, FieldMemOperand(r4, offsetof(JSFunction, shared_function_info_))); __ LoadU16(r5, FieldMemOperand(r5, offsetof(SharedFunctionInfo, diff --git a/deps/v8/src/builtins/promise-try.tq b/deps/v8/src/builtins/promise-try.tq index f08df498552d..48a4506911f8 100644 --- a/deps/v8/src/builtins/promise-try.tq +++ b/deps/v8/src/builtins/promise-try.tq @@ -8,15 +8,47 @@ namespace promise { @incrementUseCounter('v8::Isolate::kPromiseTry') transitioning javascript builtin PromiseTry( js-implicit context: Context, receiver: JSAny)(...arguments): JSAny { - // 1. Let C be the this value. - // 2. If C is not an Object, throw a TypeError exception. + // 1. Let ctor be the this value. + // 2. If ctor is not an Object, throw a TypeError exception. const receiver = Cast(receiver) otherwise ThrowTypeError(MessageTemplate::kCalledOnNonObject, 'Promise.try'); - // 3. Let promiseCapability be ? NewPromiseCapability(C). - const capability = NewPromiseCapability(receiver, False); + if (!HasJsPr3883Flag()) { + // Legacy behavior before PR 3883: + // 3. Let promiseCapability be ? NewPromiseCapability(C). + const capability = NewPromiseCapability(receiver, False); - // 4. Let status be Completion(Call(callbackfn, undefined, args)). + // 4. Let status be Completion(Call(callbackfn, undefined, args)). + const callbackfn = arguments[0]; + let result: JSAny; + try { + if (arguments.length <= 1) { + result = Call(context, callbackfn, Undefined); + } else { + const rest = NewRestArgumentsFromArguments(arguments, 1); + result = Call( + context, GetReflectApply(), Undefined, callbackfn, Undefined, rest); + } + } catch (e, _message) { + // 5. If status is an abrupt completion, then + // a. Perform ? Call(promiseCapability.[[Reject]], undefined, « + // status.[[Value]] »). + Call(context, UnsafeCast(capability.reject), Undefined, e); + + // 7. Return promiseCapability.[[Promise]]. + return capability.promise; + } + + // 6. Else, + // a. Perform ? Call(promiseCapability.[[Resolve]], undefined, « + // status.[[Value]] »). + Call(context, UnsafeCast(capability.resolve), Undefined, result); + + // 7. Return promiseCapability.[[Promise]]. + return capability.promise; + } + + // 3. Let status be Completion(Call(callback, undefined, args)). const callbackfn = arguments[0]; let result: JSAny; try { @@ -28,22 +60,19 @@ transitioning javascript builtin PromiseTry( context, GetReflectApply(), Undefined, callbackfn, Undefined, rest); } } catch (e, _message) { - // 5. If status is an abrupt completion, then - // a. Perform ? Call(promiseCapability.[[Reject]], undefined, « + // 4. If status is an abrupt completion, then + // a. Let promiseCapability be ? NewPromiseCapability(ctor). + // b. Perform ? Call(promiseCapability.[[Reject]], undefined, « // status.[[Value]] »). + // c. Return promiseCapability.[[Promise]]. + const capability = NewPromiseCapability(receiver, False); Call(context, UnsafeCast(capability.reject), Undefined, e); - - // 7. Return promiseCapability.[[Promise]]. return capability.promise; } - // 6. Else, - // a. Perform ? Call(promiseCapability.[[Resolve]], undefined, « - // status.[[Value]] »). - Call(context, UnsafeCast(capability.resolve), Undefined, result); - - // 7. Return promiseCapability.[[Promise]]. - return capability.promise; + // 5. Else, + // a. Return ? PromiseResolve(ctor, ! status). + return PromiseResolve(receiver, result); } } // namespace promise diff --git a/deps/v8/src/builtins/regexp-match-all.tq b/deps/v8/src/builtins/regexp-match-all.tq index fa777e4cf7c0..9871d2604bf3 100644 --- a/deps/v8/src/builtins/regexp-match-all.tq +++ b/deps/v8/src/builtins/regexp-match-all.tq @@ -9,6 +9,11 @@ namespace regexp { extern transitioning macro RegExpMatchAllAssembler::CreateRegExpStringIterator( NativeContext, JSAny, String, bool, bool): JSAny; +const kRegExpMatcherFlagsMismatch: constexpr UseCounterFeature + generates 'v8::Isolate::kRegExpMatcherFlagsMismatch'; +const kRegExpCustomSpecies: constexpr UseCounterFeature + generates 'v8::Isolate::kRegExpCustomSpecies'; + @export transitioning macro RegExpPrototypeMatchAllImpl( implicit context: Context)(nativeContext: NativeContext, receiver: JSAny, @@ -62,6 +67,9 @@ transitioning macro RegExpPrototypeMatchAllImpl( const regexpFun = LoadRegExpFunction(nativeContext); const speciesConstructor = UnsafeCast(SpeciesConstructor(receiver, regexpFun)); + if (speciesConstructor != regexpFun) { + IncrementUseCounter(context, SmiConstant(kRegExpCustomSpecies)); + } // 5. Let flags be ? ToString(? Get(R, "flags")). const flags = GetProperty(receiver, 'flags'); @@ -91,6 +99,25 @@ transitioning macro RegExpPrototypeMatchAllImpl( const unicodeSetsIndex: Smi = StringIndexOf(flagsString, unicodeSetsCharString, 0); unicode = unicodeIndex != -1 || unicodeSetsIndex != -1; + + let hasFlagMismatch: bool = false; + typeswitch (matcher) { + case (matcherRegExp: JSRegExp): { + const isGlobal: bool = FastFlagGetter(matcherRegExp, Flag::kGlobal); + const isUnicode: bool = + FastFlagGetter(matcherRegExp, Flag::kUnicode) || + FastFlagGetter(matcherRegExp, Flag::kUnicodeSets); + if (isGlobal != global || isUnicode != unicode) { + hasFlagMismatch = true; + } + } + case (Object): { + hasFlagMismatch = true; + } + } + if (hasFlagMismatch) { + IncrementUseCounter(context, SmiConstant(kRegExpMatcherFlagsMismatch)); + } } } @@ -140,14 +167,27 @@ transitioning javascript builtin RegExpStringIteratorPrototypeNext( try { if (IsFastRegExpPermissive(iteratingRegExp)) { const regexp = UnsafeCast(iteratingRegExp); - const lastIndex = LoadLastIndexAsLength(regexp, true); - const matchIndices: RegExpMatchInfo = - RegExpPrototypeExecBodyWithoutResultFast( - regexp, iteratingString, lastIndex) - otherwise IfNoMatch; - match = ConstructNewResultFromMatchInfo( - regexp, matchIndices, iteratingString, lastIndex); - isFastRegExp = true; + // Only use the fast path if there aren't flag mismatches. + // Note that this condition uses bitwise operations to prevent + // short-circuit evaluation. + const isGlobal = FastFlagGetter(regexp, Flag::kGlobal); + const isUnicode = FastFlagGetter(regexp, Flag::kUnicode) | + FastFlagGetter(regexp, Flag::kUnicodeSets); + if ((isGlobal == flags.global) & (isUnicode == flags.unicode)) { + const lastIndex = LoadLastIndexAsLength(regexp, true); + const matchIndices: RegExpMatchInfo = + RegExpPrototypeExecBodyWithoutResultFast( + regexp, iteratingString, lastIndex) + otherwise IfNoMatch; + match = ConstructNewResultFromMatchInfo( + regexp, matchIndices, iteratingString, lastIndex); + isFastRegExp = true; + } else { + match = RegExpExec(iteratingRegExp, iteratingString); + if (match == Null) { + goto IfNoMatch; + } + } } else { match = RegExpExec(iteratingRegExp, iteratingString); if (match == Null) { diff --git a/deps/v8/src/builtins/riscv/builtins-riscv.cc b/deps/v8/src/builtins/riscv/builtins-riscv.cc index 34272b84539c..e35e8861d0d7 100644 --- a/deps/v8/src/builtins/riscv/builtins-riscv.cc +++ b/deps/v8/src/builtins/riscv/builtins-riscv.cc @@ -2178,8 +2178,7 @@ void OnStackReplacement(MacroAssembler* masm, OsrSourceTier source, // Check we are actually jumping to an OSR code object. This among other // things ensures that the object contains deoptimization data below. - __ Load32U(scratch, - FieldMemOperand(maybe_target_code, Code::kOsrOffsetOffset)); + __ Lw(scratch, FieldMemOperand(maybe_target_code, Code::kOsrOffsetOffset)); __ SbxCheck(ne, AbortReason::kExpectedOsrCode, scratch, Operand(BytecodeOffset::None().ToInt())); @@ -3572,8 +3571,6 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, // Stack unwinding and popchk shadow stack before function return. // The num_frames_above_handler been modified in // Runtime::kUnwindAndFindExceptionHandler. - ER num_frames_above_pending_handler_address = ER::Create( - IsolateAddressId::kNumFramesAbovePendingHandlerAddress, masm->isolate()); __ LoadWord(t1, __ AsMemOperand(IsolateFieldId::kNumFramesAbovePendingHandler)); Label popchk_start; @@ -3907,6 +3904,7 @@ void ReloadParentStack(MacroAssembler* masm, Register return_reg, Register return_value, Register context, Register tmp1, Register tmp2, Register tmp3) { ASM_CODE_COMMENT(masm); + DCHECK(!AreAliased(tmp1, tmp2, tmp3)); Register active_stack = tmp1; __ LoadRootRelative(active_stack, IsolateData::active_stack_offset()); @@ -3921,7 +3919,10 @@ void ReloadParentStack(MacroAssembler* masm, Register return_reg, SwitchStacks(masm, ExternalReference::wasm_return_jspi_stack(), parent, nullptr, no_reg, tmp3, {return_reg, return_value, context, parent}); + __ LoadWord(tmp1, MemOperand(parent, wasm::kStackPcOffset)); LoadJumpBuffer(masm, parent, false, tmp3); + __ StoreWord( + tmp1, MemOperand(fp, WasmJspiFrameConstants::kParentReturnAddressOffset)); } void RestoreParentSuspender(MacroAssembler* masm, Register tmp1) { @@ -4004,6 +4005,9 @@ namespace { // forwards the value, the onRejected variant throws the value. void Generate_WasmResumeHelper(MacroAssembler* masm, wasm::OnResume on_resume) { + __ Check(eq, AbortReason::kJSSignatureMismatch, + kJavaScriptCallArgCountRegister, Operand(JSParameterCount(1))); + auto regs = RegisterAllocator::WithAllocatableGeneralRegisters(); UseScratchRegisterScope temps(masm); __ EnterFrame(StackFrame::WASM_JSPI); @@ -4476,6 +4480,10 @@ void SwitchBackAndReturnPromise(MacroAssembler* masm, RegisterAllocator& regs, FREE_REG(promise); FREE_REG(return_value); __ bind(return_promise); + // The initial wrapper and a resume callback have different argument cleanup. + __ LoadWord( + tmp, MemOperand(fp, WasmJspiFrameConstants::kParentReturnAddressOffset)); + __ Jump(tmp); } void GenerateExceptionHandlingLandingPad(MacroAssembler* masm, @@ -4719,6 +4727,7 @@ void JSToWasmWrapperHelper(MacroAssembler* masm, wasm::Promise mode) { Label return_promise; if (stack_switch) { SwitchBackAndReturnPromise(masm, regs, mode, &return_promise); + __ Trap(); // Unreachable. } __ bind(&suspend); @@ -5540,7 +5549,7 @@ void Builtins::Generate_RestartFrameTrampoline(MacroAssembler* masm) { __ LeaveFrame(StackFrame::INTERPRETED); // The arguments are already in the stack, but we might need to adapt them - // if the function signature changed (e.g. via LiveEdit). + // if the function signature changed. #if defined(V8_TARGET_ARCH_RISCV64) __ InvokeFunction(a1, a0, InvokeType::kJump, ArgumentAdaptionMode::kAdapt); #else diff --git a/deps/v8/src/builtins/s390/builtins-s390.cc b/deps/v8/src/builtins/s390/builtins-s390.cc index 14661596fa9c..78f88bc4726e 100644 --- a/deps/v8/src/builtins/s390/builtins-s390.cc +++ b/deps/v8/src/builtins/s390/builtins-s390.cc @@ -3264,6 +3264,7 @@ void SwitchStacks(MacroAssembler* masm, ExternalReference fn, void ReloadParentStack(MacroAssembler* masm, Register return_reg, Register return_value, Register context, Register tmp1, Register tmp2, Register tmp3) { + DCHECK(!AreAliased(tmp1, tmp2, tmp3)); Register active_stack = tmp1; __ LoadRootRelative(active_stack, IsolateData::active_stack_offset()); @@ -3276,7 +3277,10 @@ void ReloadParentStack(MacroAssembler* masm, Register return_reg, // Switch stack! SwitchStacks(masm, ExternalReference::wasm_return_jspi_stack(), parent, nullptr, no_reg, {return_reg, return_value, context, parent}); + __ LoadU64(tmp1, MemOperand(parent, wasm::kStackPcOffset)); LoadJumpBuffer(masm, parent, false, tmp3); + __ StoreU64( + tmp1, MemOperand(fp, WasmJspiFrameConstants::kParentReturnAddressOffset)); } void RestoreParentSuspender(MacroAssembler* masm, Register tmp1) { @@ -3520,6 +3524,9 @@ namespace { // forwards the value, the onRejected variant throws the value. void Generate_WasmResumeHelper(MacroAssembler* masm, wasm::OnResume on_resume) { + __ CmpS64(kJavaScriptCallArgCountRegister, Operand(JSParameterCount(1))); + __ Check(eq, AbortReason::kJSSignatureMismatch); + auto regs = RegisterAllocator::WithAllocatableGeneralRegisters(); __ EnterFrame(StackFrame::WASM_JSPI); @@ -3980,6 +3987,10 @@ void SwitchBackAndReturnPromise(MacroAssembler* masm, RegisterAllocator& regs, FREE_REG(promise); FREE_REG(return_value); __ bind(return_promise); + // The initial wrapper and a resume callback have different argument cleanup. + __ LoadU64( + tmp, MemOperand(fp, WasmJspiFrameConstants::kParentReturnAddressOffset)); + __ Jump(tmp); } void GenerateExceptionHandlingLandingPad(MacroAssembler* masm, @@ -4213,6 +4224,7 @@ void JSToWasmWrapperHelper(MacroAssembler* masm, wasm::Promise mode) { Label return_promise; if (stack_switch) { SwitchBackAndReturnPromise(masm, regs, mode, &return_promise); + __ Trap(); // Unreachable. } __ bind(&suspend); @@ -5272,7 +5284,7 @@ void Builtins::Generate_RestartFrameTrampoline(MacroAssembler* masm) { __ LeaveFrame(StackFrame::INTERPRETED); // The arguments are already in the stack, but we might need to adapt them - // if the function signature changed (e.g. via LiveEdit). + // if the function signature changed. __ LoadTaggedField( r4, FieldMemOperand(r3, offsetof(JSFunction, shared_function_info_))); __ LoadU16(r4, FieldMemOperand(r4, offsetof(SharedFunctionInfo, diff --git a/deps/v8/src/builtins/typed-array-set.tq b/deps/v8/src/builtins/typed-array-set.tq index 51562299edc9..c77e07a0f423 100644 --- a/deps/v8/src/builtins/typed-array-set.tq +++ b/deps/v8/src/builtins/typed-array-set.tq @@ -55,14 +55,23 @@ transitioning javascript builtin TypedArrayPrototypeSet( arguments.length > 1 ? arguments[1] : SmiConstant(0); typeswitch (offsetArg) { case (offsetSmi: Smi): { - // 5. Let targetOffset be ? ToInteger(offset). + // 5. Let targetOffset be ? ToIntegerOrInfinity(offset). // 6. If targetOffset < 0, throw a RangeError exception. - if (offsetSmi < 0) goto OffsetOutOfBounds; + if (offsetSmi < 0) { + // For negative Smi offsets, integer conversion has no side effects, + // but we still need to perform step 4 before throwing a RangeError. + // 4. If IsImmutableBuffer(target.[[ViewedArrayBuffer]]) is true, + // throw a TypeError exception. + if (IsImmutableArrayBuffer(target.buffer)) deferred { + goto Fail; + } + goto OffsetOutOfBounds; + } targetOffset = Unsigned(SmiUntag(offsetSmi)); - // For Smi offsets, integer conversion has no side effects, so step 4 - // (IsImmutableBuffer check) can be deferred and combined with steps 7-9 - // in EnsureValidAndReadLength without observable differences. + // For non-negative Smi offsets, integer conversion has no side effects, + // so step 4 (IsImmutableBuffer check) can be deferred and combined with + // steps 7-9 in EnsureValidAndReadLength without observable differences. // 4. If IsImmutableBuffer(target.[[ViewedArrayBuffer]]) is true, throw // a TypeError exception. // 7. Let targetBuffer be target.[[ViewedArrayBuffer]]. @@ -79,7 +88,7 @@ transitioning javascript builtin TypedArrayPrototypeSet( goto Fail; } - // 5. Let targetOffset be ? ToInteger(offset). + // 5. Let targetOffset be ? ToIntegerOrInfinity(offset). // 6. If targetOffset < 0, throw a RangeError exception. try { targetOffset = ToUintPtr(offsetOther) diff --git a/deps/v8/src/builtins/wasm-strings.tq b/deps/v8/src/builtins/wasm-strings.tq index 9f8a4ab5ba62..7080bc11197f 100644 --- a/deps/v8/src/builtins/wasm-strings.tq +++ b/deps/v8/src/builtins/wasm-strings.tq @@ -27,6 +27,11 @@ transitioning javascript builtin WebAssemblyStringTest( extern runtime WasmCastToSpecialPrimitiveArray( Context, Object, Smi, Smi): WasmArray; +const kWtf16Unshared: constexpr int31 + generates 'UnicodeConfig::kWtf16Unshared().raw_as_int()'; +const kWtf16Shared: constexpr int31 + generates 'UnicodeConfig::kWtf16Shared().raw_as_int()'; + transitioning javascript builtin WebAssemblyStringFromWtf16Array( js-implicit context: Context)(arrayArg: JSAny, startArg: JSAny, endArg: JSAny): JSAny { @@ -34,7 +39,8 @@ transitioning javascript builtin WebAssemblyStringFromWtf16Array( context, arrayArg, SmiConstant(16), SmiConstant(0)); const start = NumberToUint32(ToNumber_Inline(startArg)); const end = NumberToUint32(ToNumber_Inline(endArg)); - return wasm::WasmStringNewWtf16Array(array, start, end); + return wasm::WasmStringNewWtf16Array( + array, start, end, SmiConstant(kWtf16Unshared)); } transitioning javascript builtin WebAssemblyStringFromWtf16ArrayShared( @@ -44,11 +50,16 @@ transitioning javascript builtin WebAssemblyStringFromWtf16ArrayShared( context, arrayArg, SmiConstant(16), SmiConstant(1)); const start = NumberToUint32(ToNumber_Inline(startArg)); const end = NumberToUint32(ToNumber_Inline(endArg)); - return wasm::WasmStringNewWtf16ArrayShared(array, start, end); + return wasm::WasmStringNewWtf16Array( + array, start, end, SmiConstant(kWtf16Shared)); } -const kLossyUtf8: - constexpr int31 generates 'unibrow::Utf8Variant::kLossyUtf8'; +const kLossyUtf8: constexpr int31 + generates 'unibrow::Utf8Variant::kLossyUtf8'; +const kLossyUtf8Unshared: constexpr int31 + generates 'UnicodeConfig::kLossyUtf8Unshared().raw_as_int()'; +const kLossyUtf8Shared: constexpr int31 + generates 'UnicodeConfig::kLossyUtf8Shared().raw_as_int()'; transitioning javascript builtin WebAssemblyStringFromUtf8Array( js-implicit context: Context)(arrayArg: JSAny, startArg: JSAny, @@ -58,7 +69,7 @@ transitioning javascript builtin WebAssemblyStringFromUtf8Array( const start = NumberToUint32(ToNumber_Inline(startArg)); const end = NumberToUint32(ToNumber_Inline(endArg)); const result = wasm::WasmStringNewWtf8Array( - start, end, array, SmiConstant(kLossyUtf8), SmiConstant(0) /* shared */); + start, end, array, SmiConstant(kLossyUtf8Unshared)); dcheck(Is(result)); return %RawDownCast(result); } @@ -71,7 +82,7 @@ transitioning javascript builtin WebAssemblyStringFromUtf8ArrayShared( const start = NumberToUint32(ToNumber_Inline(startArg)); const end = NumberToUint32(ToNumber_Inline(endArg)); const result = wasm::WasmStringNewWtf8Array( - start, end, array, SmiConstant(kLossyUtf8), SmiConstant(1) /* shared */); + start, end, array, SmiConstant(kLossyUtf8Shared)); dcheck(Is(result)); return %RawDownCast(result); } diff --git a/deps/v8/src/builtins/wasm.tq b/deps/v8/src/builtins/wasm.tq index 937c259d000a..9f06bebc51ad 100644 --- a/deps/v8/src/builtins/wasm.tq +++ b/deps/v8/src/builtins/wasm.tq @@ -60,10 +60,10 @@ extern runtime WasmArrayInitSegment( extern runtime WasmStringNewWtf8( Context, WasmTrustedInstanceData, Smi, Smi, Number, Number): String |WasmNull; -extern runtime WasmStringNewWtf8Array(Context, Smi, WasmArray, Smi, Smi, Smi): - String|WasmNull; +extern runtime WasmStringNewWtf8Array(Context, Smi, WasmArray, Smi, Smi): String + |WasmNull; extern runtime WasmStringNewWtf16( - Context, WasmTrustedInstanceData, Smi, Number, Number): String; + Context, WasmTrustedInstanceData, Smi, Number, Number, Smi): String; extern runtime WasmStringNewWtf16Array(Context, WasmArray, Smi, Smi, Smi): String; extern runtime WasmStringConst(Context, WasmTrustedInstanceData, Smi): String; @@ -107,6 +107,8 @@ extern macro Allocate(intptr): HeapObject; extern macro Allocate(intptr, constexpr AllocationFlag): HeapObject; } +extern macro Retain(Object): void; + macro NumberToInt32(input: Number): int32 { return Convert(input); } @@ -167,19 +169,15 @@ builtin WasmInt32ToSharedHeapNumber(val: int32): HeapNumber { builtin WasmFuncRefToJS( implicit context: Context)(val: WasmFuncRef|WasmNull): JSFunction|Null { - typeswitch (val) { - case (WasmNull): { - return Null; - } - case (func: WasmFuncRef): { - const internal: WasmInternalFunction = func.internal; - const maybeExternal: Object = internal.external; - if (maybeExternal != Undefined) { - return %RawDownCast(maybeExternal); - } - tail runtime::WasmInternalFunctionCreateExternal(context, internal); - } + if (val == kWasmNull) return Null; + + const func = Cast(val) otherwise unreachable; + const internal: WasmInternalFunction = func.internal; + const maybeExternal: Object = internal.external; + if (maybeExternal != Undefined) { + return %RawDownCast(maybeExternal); } + tail runtime::WasmInternalFunctionCreateExternal(context, internal); } builtin WasmTaggedNonSmiToInt32(implicit context: Context)(val: HeapObject): @@ -353,11 +351,10 @@ builtin WasmTableGetFuncRef(tableIndex: intptr, index: intptr): Object { const entry: HeapObject = UnsafeCast(LoadFixedArrayElement(entries, index)); - dcheck(Is(entry) || Is(entry) || Is(entry)); - if (IsTuple2Map(entry.map)) goto CallRuntime; - if (Is(entry)) return entry; - dcheck(Is(entry)); - return entry; + if (entry == kWasmNull) return entry; + if (Is(entry)) return entry; + dcheck(IsTuple2Map(entry.map)); + goto CallRuntime; } label CallRuntime deferred { tail runtime::WasmFunctionTableGet( LoadContextFromInstanceData(trustedData), trustedData, @@ -381,7 +378,7 @@ builtin WasmFunctionTableGet(tableIndex: intptr, index: intptr): Object { builtin WasmTableSetFuncRef( tableIndex: intptr, index: intptr, value: WasmFuncRef): Object { const trustedData: WasmTrustedInstanceData = LoadInstanceDataFromFrame(); - dcheck(Is(value) || Is(value)); + dcheck(value == kWasmNull || Is(value)); try { dcheck(IsValidPositiveSmi(tableIndex)); @@ -948,37 +945,36 @@ macro GetRefAt(base: From, offset: intptr): &T { extern macro LoadPointerFromRootRegister(intptr): RawPtr; builtin WasmStringNewWtf8( - offset: uintptr, size: uint32, memory: uint32, utf8Variant: Smi): String + offset: uintptr, size: uint32, memory: uint32, utf8Config: Smi): String |WasmNull { const trustedData = LoadInstanceDataFromFrame(); tail runtime::WasmStringNewWtf8( LoadContextFromInstanceData(trustedData), trustedData, - SmiFromUint32(memory), utf8Variant, UintPtrToNumberRounding(offset), + SmiFromUint32(memory), utf8Config, UintPtrToNumberRounding(offset), WasmUint32ToNumber(size)); } builtin WasmStringNewWtf8Array( - start: uint32, end: uint32, array: WasmArray, utf8Variant: Smi, - shared: Smi): String|WasmNull { + start: uint32, end: uint32, array: WasmArray, utf8Config: Smi): String + |WasmNull { // This can be called from Wasm and from "JS String Builtins". const context = LoadContextFromWasmOrJsFrame(); try { if (array.length < end) goto OffsetOutOfRange; if (end < start) goto OffsetOutOfRange; tail runtime::WasmStringNewWtf8Array( - context, utf8Variant, array, SmiFromUint32(start), SmiFromUint32(end), - shared); + context, utf8Config, array, SmiFromUint32(start), SmiFromUint32(end)); } label OffsetOutOfRange deferred { const error = MessageTemplate::kWasmTrapArrayOutOfBounds; runtime::ThrowWasmError(context, SmiConstant(error)); } } -builtin WasmStringNewWtf16(memory: uint32, offset: uintptr, size: uint32): - String { +builtin WasmStringNewWtf16( + memory: uint32, offset: uintptr, size: uint32, config: Smi): String { const trustedData = LoadInstanceDataFromFrame(); tail runtime::WasmStringNewWtf16( LoadContextFromInstanceData(trustedData), trustedData, SmiFromUint32(memory), UintPtrToNumberRounding(offset), - WasmUint32ToNumber(size)); + WasmUint32ToNumber(size), config); } struct TwoByteToOneByteIterator { @@ -1060,13 +1056,16 @@ macro StringFromTwoByteSlice(length: uint32, slice: ConstSlice): }); } -builtin WasmStringNewWtf16Array(array: WasmArray, start: uint32, end: uint32): - String { +builtin WasmStringNewWtf16Array( + array: WasmArray, start: uint32, end: uint32, config: Smi): String { try { if (array.length < end) goto OffsetOutOfRange; if (end < start) goto OffsetOutOfRange; const length: uint32 = end - start; if (length == 0) return kEmptyString; + // TODO(448741522): Support inline creation of short shared Strings. + // "config == 0" means both array and string are unshared. + if (config != SmiConstant(0)) goto Runtime; if (length == 1) { const offset = kWasmArrayHeaderSize + torque_internal::TimesSizeOf(Convert(start)); @@ -1095,31 +1094,7 @@ builtin WasmStringNewWtf16Array(array: WasmArray, start: uint32, end: uint32): } label Runtime deferred { const context = LoadContextFromWasmOrJsFrame(); tail runtime::WasmStringNewWtf16Array( - context, array, SmiFromUint32(start), SmiFromUint32(end), - SmiConstant(0) /* shared */); - } -} - -builtin WasmStringNewWtf16ArrayShared( - array: WasmArray, start: uint32, end: uint32): String { - try { - if (array.length < end) goto OffsetOutOfRange; - if (end < start) goto OffsetOutOfRange; - const length: uint32 = end - start; - if (length == 0) return kEmptyString; - // TODO(448741522): Inline creation of Strings of size 1 and small size - // (<32); - goto Runtime; - } label OffsetOutOfRange deferred { - // This can be called from Wasm and from "JS String Builtins". - const context = LoadContextFromWasmOrJsFrame(); - const error = MessageTemplate::kWasmTrapArrayOutOfBounds; - runtime::ThrowWasmError(context, SmiConstant(error)); - } label Runtime deferred { - const context = LoadContextFromWasmOrJsFrame(); - tail runtime::WasmStringNewWtf16Array( - context, array, SmiFromUint32(start), SmiFromUint32(end), - SmiConstant(1) /* shared */); + context, array, SmiFromUint32(start), SmiFromUint32(end), config); } } @@ -1434,13 +1409,17 @@ transitioning builtin WasmStringViewWtf16Slice( let subslice = Subslice( slice, Convert(start), Convert(clampedLength)) otherwise unreachable; - return AllocateNonEmptySeqOneByteString( - clampedLength, subslice.Iterator()); + const result = + AllocateNonEmptySeqOneByteString(clampedLength, subslice.Iterator()); + Retain(string); + return result; } label TwoByte(slice: ConstSlice) { let subslice = Subslice( slice, Convert(start), Convert(clampedLength)) otherwise unreachable; - return StringFromTwoByteSlice(clampedLength, subslice); + const result = StringFromTwoByteSlice(clampedLength, subslice); + Retain(string); + return result; } label Runtime deferred { const context = LoadContextFromWasmOrJsFrame(); tail runtime::WasmSubstring( @@ -1681,38 +1660,39 @@ builtin WasmStringIndexOf(s: String, searchString: String, start: Smi): Smi { // TODO(mliedtke): It would be nice to type the result as bool, however that is // not supported. builtin WasmLiftoffIsEqRefUnshared(obj: Object, nullSucceeds: bool): int32 { + if (Is(obj)) return 1; + if (obj == kWasmNull) return Convert(nullSucceeds); try { - if (Is(obj)) { - return 1; - } const heapObject: HeapObject = Cast(obj) otherwise ReturnFalse; return Convert( !InSharedSpace(heapObject) && - (Is(heapObject) || Is(heapObject) || - (nullSucceeds && Is(heapObject)))); - } label ReturnFalse {} - return 0; + (Is(heapObject) || Is(heapObject))); + } label ReturnFalse { + return 0; + } } builtin WasmLiftoffIsArrayRefUnshared(obj: Object, nullSucceeds: bool): int32 { + if (obj == kWasmNull) return Convert(nullSucceeds); try { const heapObject: HeapObject = Cast(obj) otherwise ReturnFalse; return Convert( - !InSharedSpace(heapObject) && Is(heapObject) || - (nullSucceeds && Is(heapObject))); - } label ReturnFalse {} - return 0; + !InSharedSpace(heapObject) && Is(heapObject)); + } label ReturnFalse { + return 0; + } } builtin WasmLiftoffIsStructRefUnshared(obj: Object, nullSucceeds: bool): int32 { + if (obj == kWasmNull) return Convert(nullSucceeds); try { const heapObject: HeapObject = Cast(obj) otherwise ReturnFalse; return Convert( - !InSharedSpace(heapObject) && Is(heapObject) || - (nullSucceeds && Is(heapObject))); - } label ReturnFalse {} - return 0; + !InSharedSpace(heapObject) && Is(heapObject)); + } label ReturnFalse { + return 0; + } } // Return type JSAny to be able to tail-call ThrowWasmTrapIllegalCast(). It must @@ -1722,22 +1702,31 @@ builtin WasmLiftoffCastEqRefUnshared(obj: Object, nullSucceeds: bool): JSAny { if (Is(obj)) { return SmiConstant(0); } - const heapObject: HeapObject = UnsafeCast(obj); - if (InSharedSpace(heapObject) || - (!Is(heapObject) && !Is(heapObject) && - (!nullSucceeds || !Is(heapObject)))) { + try { + if (obj == kWasmNull) { + if (nullSucceeds) return SmiConstant(0); + goto IllegalCast; + } + const heapObject: HeapObject = UnsafeCast(obj); + if (InSharedSpace(heapObject) || + (!Is(heapObject) && !Is(heapObject))) { + goto IllegalCast; + } + return SmiConstant(0); + } label IllegalCast { tail ThrowWasmTrapIllegalCast(); } - return SmiConstant(0); } builtin WasmLiftoffCastArrayRefUnshared(obj: Object, nullSucceeds: bool): JSAny { try { + if (obj == kWasmNull) { + if (nullSucceeds) return SmiConstant(0); + goto IllegalCast; + } const heapObject: HeapObject = Cast(obj) otherwise IllegalCast; - if (InSharedSpace(heapObject) || - (!Is(heapObject) && - (!nullSucceeds || !Is(heapObject)))) { + if (InSharedSpace(heapObject) || (!Is(heapObject))) { goto IllegalCast; } return SmiConstant(0); @@ -1749,10 +1738,12 @@ builtin WasmLiftoffCastArrayRefUnshared(obj: Object, nullSucceeds: bool): builtin WasmLiftoffCastStructRefUnshared(obj: Object, nullSucceeds: bool): JSAny { try { + if (obj == kWasmNull) { + if (nullSucceeds) return SmiConstant(0); + goto IllegalCast; + } const heapObject: HeapObject = Cast(obj) otherwise IllegalCast; - if (InSharedSpace(heapObject) || - (!Is(heapObject) && - (!nullSucceeds || !Is(heapObject)))) { + if (InSharedSpace(heapObject) || (!Is(heapObject))) { goto IllegalCast; } return SmiConstant(0); diff --git a/deps/v8/src/builtins/x64/builtins-x64.cc b/deps/v8/src/builtins/x64/builtins-x64.cc index 0d752755c0bc..c5cb7ddda099 100644 --- a/deps/v8/src/builtins/x64/builtins-x64.cc +++ b/deps/v8/src/builtins/x64/builtins-x64.cc @@ -3190,7 +3190,7 @@ void Builtins::Generate_AdaptShadowStackForDeopt(MacroAssembler* masm) { __ popq(count_reg); // Now `kReturnRegister0` is the address we want to jump to. - __ cmpl(count_reg, Immediate(0)); + __ Cmp(count_reg, 0); Label finished; __ j(equal, &finished, Label::kNear); // This will jump to CallToAdaptShadowStackForDeopt which call back into this @@ -3489,6 +3489,7 @@ void SwitchStacks(MacroAssembler* masm, ExternalReference fn, void ReloadParentStack(MacroAssembler* masm, Register promise, Register return_value, Register context, Register tmp1, Register tmp2) { + DCHECK_NE(tmp1, tmp2); Register active_stack = tmp1; __ LoadRootRelative(active_stack, IsolateData::active_stack_offset()); @@ -3497,7 +3498,10 @@ void ReloadParentStack(MacroAssembler* masm, Register promise, // Switch stack! SwitchStacks(masm, ExternalReference::wasm_return_jspi_stack(), parent, nullptr, no_reg, {promise, return_value, context, parent}); + __ movq(tmp1, MemOperand(parent, wasm::kStackPcOffset)); LoadJumpBuffer(masm, parent, false); + __ movq(MemOperand(rbp, WasmJspiFrameConstants::kParentReturnAddressOffset), + tmp1); } // Loads the context field of the WasmTrustedInstanceData or WasmImportData @@ -3621,6 +3625,8 @@ void SwitchBackAndReturnPromise(MacroAssembler* masm, Register tmp1, } __ bind(return_promise); + // The initial wrapper and a resume callback have different argument cleanup. + __ jmp(MemOperand(rbp, WasmJspiFrameConstants::kParentReturnAddressOffset)); } void GenerateExceptionHandlingLandingPad(MacroAssembler* masm, @@ -3820,6 +3826,7 @@ void JSToWasmWrapperHelper(MacroAssembler* masm, wasm::Promise mode) { Label return_promise; if (stack_switch) { SwitchBackAndReturnPromise(masm, r8, rdi, mode, &return_promise); + __ Trap(); // Unreachable. } __ bind(&suspend); __ endbr64(); @@ -3938,10 +3945,11 @@ namespace { // forwards the value, the onRejected variant throws the value. void Generate_WasmResumeHelper(MacroAssembler* masm, wasm::OnResume on_resume) { + __ cmpq(kJavaScriptCallArgCountRegister, Immediate(JSParameterCount(1))); + __ Check(equal, AbortReason::kJSSignatureMismatch); + __ EnterFrame(StackFrame::WASM_JSPI); - Register param_count = rax; - __ decq(param_count); // Exclude receiver. Register closure = kJSFunctionRegister; // rdi __ AllocateStackSpace(WasmJspiFrameConstants::kNumSpillSlots * @@ -3949,8 +3957,6 @@ void Generate_WasmResumeHelper(MacroAssembler* masm, wasm::OnResume on_resume) { // Set a sentinel value for the spill slots visited by the GC. ResetWasmJspiFrameStackSlots(masm); - param_count = no_reg; - // ------------------------------------------- // Load suspender from closure. // ------------------------------------------- @@ -4362,7 +4368,7 @@ void SwitchFromTheCentralStackIfNeeded(MacroAssembler* masm, using ER = ExternalReference; Label no_stack_change; - __ cmpq(kOldSPRegister, Immediate(0)); + __ Cmpq(kOldSPRegister, 0); __ j(equal, &no_stack_change); __ movq(rsp, kOldSPRegister); @@ -5670,7 +5676,7 @@ void Builtins::Generate_RestartFrameTrampoline(MacroAssembler* masm) { __ LeaveFrame(StackFrame::INTERPRETED); // The arguments are already in the stack, but we might need to adapt them - // if the function signature changed (e.g. via LiveEdit). + // if the function signature changed. __ InvokeFunction(rdi, no_reg, rax, InvokeType::kJump, ArgumentAdaptionMode::kAdapt); } diff --git a/deps/v8/src/codegen/arm64/interface-descriptors-arm64-inl.h b/deps/v8/src/codegen/arm64/interface-descriptors-arm64-inl.h index b3a40b3b02f4..d008fba1b2e7 100644 --- a/deps/v8/src/codegen/arm64/interface-descriptors-arm64-inl.h +++ b/deps/v8/src/codegen/arm64/interface-descriptors-arm64-inl.h @@ -326,6 +326,14 @@ constexpr auto BinaryOpAndTryPatchCodeDescriptor::registers() { // x3: feedback offset return RegisterArray(x1, x0, x2, x3); } + +// static +constexpr auto UnaryOpAndTryPatchCodeDescriptor::registers() { + // x0: value + // x2: current feedback value + // x3: feedback offset + return RegisterArray(x0, x2, x3); +} #endif // V8_ENABLE_SPARKPLUG_PLUS // static diff --git a/deps/v8/src/codegen/arm64/macro-assembler-arm64.cc b/deps/v8/src/codegen/arm64/macro-assembler-arm64.cc index f6af185086ba..a797c09ef530 100644 --- a/deps/v8/src/codegen/arm64/macro-assembler-arm64.cc +++ b/deps/v8/src/codegen/arm64/macro-assembler-arm64.cc @@ -3611,13 +3611,27 @@ void MacroAssembler::DecompressTagged(const Register& destination, void MacroAssembler::DecompressTagged(const Register& destination, const Register& source) { ASM_CODE_COMMENT(this); - Orr(destination, kPtrComprCageBaseRegister, Operand(source, UXTW)); + // Runtime values decompress with the cage base or'd in so that accidental + // double-decompression is idempotent, but Orr has no extended-register + // form, so or-ing a W source takes a scratch register and two instructions + // (ubfx + orr). The extended-register Add is a single instruction and + // computes the same function: Uxtw strips the high word -- an + // already-present cage base included, which is what keeps the idempotence + // -- and the 4GB-aligned cage base has no low bits to carry into, so + // adding equals or-ing for every source value. + Add(destination, kPtrComprCageBaseRegister, Operand(source, UXTW)); } void MacroAssembler::DecompressTagged(const Register& destination, Tagged_t immediate) { ASM_CODE_COMMENT(this); if (IsImmAddSub(immediate)) { + // Runtime values decompress with Orr so that accidental + // double-decompression is idempotent, but a constant has no input that + // could already be decompressed, and the 4GB-aligned cage base makes Add + // equal to Orr for any 32-bit offset. Only Add can encode the offset + // directly, though -- Orr would need a (rarely matching) logical + // immediate and otherwise materializes through a scratch register. Add(destination, kPtrComprCageBaseRegister, Immediate(immediate, RelocInfo::Mode::NO_INFO)); } else { @@ -3626,7 +3640,7 @@ void MacroAssembler::DecompressTagged(const Register& destination, DCHECK_NE(destination, sp); Operand imm_operand = MoveImmediateForShiftedOp(destination, immediate, kAnyShift); - Add(destination, kPtrComprCageBaseRegister, imm_operand); + Orr(destination, kPtrComprCageBaseRegister, imm_operand); } } @@ -3667,7 +3681,7 @@ int MacroAssembler::AtomicDecompressTagged(const Register& destination, Add(temp, base, index); int pc_offset_of_load = pc_offset(); Ldar(destination.W(), temp); - Add(destination, kPtrComprCageBaseRegister, destination); + Orr(destination, kPtrComprCageBaseRegister, destination); return pc_offset_of_load; } @@ -3819,22 +3833,13 @@ void MacroAssembler::RecordWriteField( Bind(&done); } -void MacroAssembler::DecodeSandboxedPointer(Register value) { - ASM_CODE_COMMENT(this); -#ifdef V8_ENABLE_SANDBOX - Add(value, kPtrComprCageBaseRegister, - Operand(value, LSR, kSandboxedPointerShift)); -#else - UNREACHABLE(); -#endif -} - void MacroAssembler::LoadSandboxedPointerField(Register destination, MemOperand field_operand) { #ifdef V8_ENABLE_SANDBOX ASM_CODE_COMMENT(this); Ldr(destination, field_operand); - DecodeSandboxedPointer(destination); + Add(destination, kPtrComprCageBaseRegister, + Operand(destination, LSR, kSandboxedPointerShift)); #else UNREACHABLE(); #endif @@ -4454,264 +4459,6 @@ void MacroAssembler::TryLoadOptimizedOsrCode(Register scratch_and_result, Mov(scratch_and_result, 0); } -// This is the main Printf implementation. All other Printf variants call -// PrintfNoPreserve after setting up one or more PreserveRegisterScopes. -void MacroAssembler::PrintfNoPreserve(const char* format, - const CPURegister& arg0, - const CPURegister& arg1, - const CPURegister& arg2, - const CPURegister& arg3) { - ASM_CODE_COMMENT(this); - // We cannot handle a caller-saved stack pointer. It doesn't make much sense - // in most cases anyway, so this restriction shouldn't be too serious. - DCHECK(!kCallerSaved.IncludesAliasOf(sp)); - - // The provided arguments, and their proper procedure-call standard registers. - CPURegister args[kPrintfMaxArgCount] = {arg0, arg1, arg2, arg3}; - CPURegister pcs[kPrintfMaxArgCount] = {NoReg, NoReg, NoReg, NoReg}; - - int arg_count = kPrintfMaxArgCount; - - // The PCS varargs registers for printf. Note that x0 is used for the printf - // format string. - static const CPURegList kPCSVarargs = - CPURegList(CPURegister::kRegister, kXRegSizeInBits, 1, arg_count); - static const CPURegList kPCSVarargsFP = - CPURegList(CPURegister::kVRegister, kDRegSizeInBits, 0, arg_count - 1); - - // We can use caller-saved registers as scratch values, except for the - // arguments and the PCS registers where they might need to go. - CPURegList tmp_list = kCallerSaved; - tmp_list.Remove(x0); // Used to pass the format string. - tmp_list.Remove(kPCSVarargs); - tmp_list.Remove(arg0, arg1, arg2, arg3); - - CPURegList fp_tmp_list = kCallerSavedV; - fp_tmp_list.Remove(kPCSVarargsFP); - fp_tmp_list.Remove(arg0, arg1, arg2, arg3); - - // Override the MacroAssembler's scratch register list. The lists will be - // reset automatically at the end of the UseScratchRegisterScope. - UseScratchRegisterScope temps(this); - TmpList()->set_bits(tmp_list.bits()); - FPTmpList()->set_bits(fp_tmp_list.bits()); - - // Copies of the printf vararg registers that we can pop from. - CPURegList pcs_varargs = kPCSVarargs; -#ifndef V8_OS_WIN - CPURegList pcs_varargs_fp = kPCSVarargsFP; -#endif - - // Place the arguments. There are lots of clever tricks and optimizations we - // could use here, but Printf is a debug tool so instead we just try to keep - // it simple: Move each input that isn't already in the right place to a - // scratch register, then move everything back. - for (unsigned i = 0; i < kPrintfMaxArgCount; i++) { - // Work out the proper PCS register for this argument. - if (args[i].IsRegister()) { - pcs[i] = pcs_varargs.PopLowestIndex().X(); - // We might only need a W register here. We need to know the size of the - // argument so we can properly encode it for the simulator call. - if (args[i].Is32Bits()) pcs[i] = pcs[i].W(); - } else if (args[i].IsVRegister()) { - // In C, floats are always cast to doubles for varargs calls. -#ifdef V8_OS_WIN - // In case of variadic functions SIMD and Floating-point registers - // aren't used. The general x0-x7 should be used instead. - // https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions - pcs[i] = pcs_varargs.PopLowestIndex().X(); -#else - pcs[i] = pcs_varargs_fp.PopLowestIndex().D(); -#endif - } else { - DCHECK(args[i].IsNone()); - arg_count = i; - break; - } - - // If the argument is already in the right place, leave it where it is. - if (args[i].Aliases(pcs[i])) continue; - - // Otherwise, if the argument is in a PCS argument register, allocate an - // appropriate scratch register and then move it out of the way. - if (kPCSVarargs.IncludesAliasOf(args[i]) || - kPCSVarargsFP.IncludesAliasOf(args[i])) { - if (args[i].IsRegister()) { - Register old_arg = args[i].Reg(); - Register new_arg = temps.AcquireSameSizeAs(old_arg); - Mov(new_arg, old_arg); - args[i] = new_arg; - } else { - VRegister old_arg = args[i].VReg(); - VRegister new_arg = temps.AcquireSameSizeAs(old_arg); - Fmov(new_arg, old_arg); - args[i] = new_arg; - } - } - } - - // Do a second pass to move values into their final positions and perform any - // conversions that may be required. - for (int i = 0; i < arg_count; i++) { -#ifdef V8_OS_WIN - if (args[i].IsVRegister()) { - if (pcs[i].SizeInBytes() != args[i].SizeInBytes()) { - // If the argument is half- or single-precision - // converts to double-precision before that is - // moved into the one of X scratch register. - VRegister temp0 = temps.AcquireD(); - Fcvt(temp0.VReg(), args[i].VReg()); - Fmov(pcs[i].Reg(), temp0); - } else { - Fmov(pcs[i].Reg(), args[i].VReg()); - } - } else { - Mov(pcs[i].Reg(), args[i].Reg(), kDiscardForSameWReg); - } -#else - DCHECK(pcs[i].type() == args[i].type()); - if (pcs[i].IsRegister()) { - Mov(pcs[i].Reg(), args[i].Reg(), kDiscardForSameWReg); - } else { - DCHECK(pcs[i].IsVRegister()); - if (pcs[i].SizeInBytes() == args[i].SizeInBytes()) { - Fmov(pcs[i].VReg(), args[i].VReg()); - } else { - Fcvt(pcs[i].VReg(), args[i].VReg()); - } - } -#endif - } - - // Load the format string into x0, as per the procedure-call standard. - // - // To make the code as portable as possible, the format string is encoded - // directly in the instruction stream. It might be cleaner to encode it in a - // literal pool, but since Printf is usually used for debugging, it is - // beneficial for it to be minimally dependent on other features. - Label format_address; - Adr(x0, &format_address); - - // Emit the format string directly in the instruction stream. - { - BlockPoolsScope scope(this); - Label after_data; - B(&after_data); - Bind(&format_address); - EmitStringData(format); - Unreachable(); - Bind(&after_data); - } - - CallPrintf(arg_count, pcs); -} - -void MacroAssembler::CallPrintf(int arg_count, const CPURegister* args) { - ASM_CODE_COMMENT(this); - // A call to printf needs special handling for the simulator, since the system - // printf function will use a different instruction set and the procedure-call - // standard will not be compatible. - if (options().enable_simulator_code) { - InstructionAccurateScope scope(this, kPrintfLength / kInstrSize); - hlt(kImmExceptionIsPrintf); - dc32(arg_count); // kPrintfArgCountOffset - - // Determine the argument pattern. - uint32_t arg_pattern_list = 0; - for (int i = 0; i < arg_count; i++) { - uint32_t arg_pattern; - if (args[i].IsRegister()) { - arg_pattern = args[i].Is32Bits() ? kPrintfArgW : kPrintfArgX; - } else { - DCHECK(args[i].Is64Bits()); - arg_pattern = kPrintfArgD; - } - DCHECK(arg_pattern < (1 << kPrintfArgPatternBits)); - arg_pattern_list |= (arg_pattern << (kPrintfArgPatternBits * i)); - } - dc32(arg_pattern_list); // kPrintfArgPatternListOffset - return; - } - - Call(ExternalReference::printf_function()); -} - -void MacroAssembler::Printf(const char* format, CPURegister arg0, - CPURegister arg1, CPURegister arg2, - CPURegister arg3) { - ASM_CODE_COMMENT(this); - // Printf is expected to preserve all registers, so make sure that none are - // available as scratch registers until we've preserved them. - uint64_t old_tmp_list = TmpList()->bits(); - uint64_t old_fp_tmp_list = FPTmpList()->bits(); - TmpList()->set_bits(0); - FPTmpList()->set_bits(0); - - CPURegList saved_registers = kCallerSaved; - saved_registers.Align(); - - // Preserve all caller-saved registers as well as NZCV. - // PushCPURegList asserts that the size of each list is a multiple of 16 - // bytes. - PushCPURegList(saved_registers); - PushCPURegList(kCallerSavedV); - - // We can use caller-saved registers as scratch values (except for argN). - CPURegList tmp_list = saved_registers; - CPURegList fp_tmp_list = kCallerSavedV; - tmp_list.Remove(arg0, arg1, arg2, arg3); - fp_tmp_list.Remove(arg0, arg1, arg2, arg3); - TmpList()->set_bits(tmp_list.bits()); - FPTmpList()->set_bits(fp_tmp_list.bits()); - - { - UseScratchRegisterScope temps(this); - // If any of the arguments are the current stack pointer, allocate a new - // register for them, and adjust the value to compensate for pushing the - // caller-saved registers. - bool arg0_sp = arg0.is_valid() && sp.Aliases(arg0); - bool arg1_sp = arg1.is_valid() && sp.Aliases(arg1); - bool arg2_sp = arg2.is_valid() && sp.Aliases(arg2); - bool arg3_sp = arg3.is_valid() && sp.Aliases(arg3); - if (arg0_sp || arg1_sp || arg2_sp || arg3_sp) { - // Allocate a register to hold the original stack pointer value, to pass - // to PrintfNoPreserve as an argument. - Register arg_sp = temps.AcquireX(); - Add(arg_sp, sp, - saved_registers.TotalSizeInBytes() + - kCallerSavedV.TotalSizeInBytes()); - if (arg0_sp) arg0 = Register::Create(arg_sp.code(), arg0.SizeInBits()); - if (arg1_sp) arg1 = Register::Create(arg_sp.code(), arg1.SizeInBits()); - if (arg2_sp) arg2 = Register::Create(arg_sp.code(), arg2.SizeInBits()); - if (arg3_sp) arg3 = Register::Create(arg_sp.code(), arg3.SizeInBits()); - } - - // Preserve NZCV. - { - UseScratchRegisterScope temps(this); - Register tmp = temps.AcquireX(); - Mrs(tmp, NZCV); - Push(tmp, xzr); - } - - PrintfNoPreserve(format, arg0, arg1, arg2, arg3); - - // Restore NZCV. - { - UseScratchRegisterScope temps(this); - Register tmp = temps.AcquireX(); - Pop(xzr, tmp); - Msr(NZCV, tmp); - } - } - - PopCPURegList(kCallerSavedV); - PopCPURegList(saved_registers); - - TmpList()->set_bits(old_tmp_list); - FPTmpList()->set_bits(old_fp_tmp_list); -} - void MacroAssembler::ComputeCodeStartAddress(const Register& rd) { // We can use adr to load a pc relative location. adr(rd, -pc_offset()); diff --git a/deps/v8/src/codegen/arm64/macro-assembler-arm64.h b/deps/v8/src/codegen/arm64/macro-assembler-arm64.h index 31b9c5be8e8d..9467b9b2cf2f 100644 --- a/deps/v8/src/codegen/arm64/macro-assembler-arm64.h +++ b/deps/v8/src/codegen/arm64/macro-assembler-arm64.h @@ -698,33 +698,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public MacroAssemblerBase { // Print a message to stderr and abort execution. void Abort(AbortReason reason); - // Like printf, but print at run-time from generated code. - // - // The caller must ensure that arguments for floating-point placeholders - // (such as %e, %f or %g) are VRegisters, and that arguments for integer - // placeholders are Registers. - // - // Format placeholders that refer to more than one argument, or to a specific - // argument, are not supported. This includes formats like "%1$d" or "%.*d". - // - // This function automatically preserves caller-saved registers so that - // calling code can use Printf at any point without having to worry about - // corruption. The preservation mechanism generates a lot of code. If this is - // a problem, preserve the important registers manually and then call - // PrintfNoPreserve. Callee-saved registers are not used by Printf, and are - // implicitly preserved. - void Printf(const char* format, CPURegister arg0 = NoCPUReg, - CPURegister arg1 = NoCPUReg, CPURegister arg2 = NoCPUReg, - CPURegister arg3 = NoCPUReg); - - // Like Printf, but don't preserve any caller-saved registers, not even 'lr'. - // - // The return code from the system printf call will be returned in x0. - void PrintfNoPreserve(const char* format, const CPURegister& arg0 = NoCPUReg, - const CPURegister& arg1 = NoCPUReg, - const CPURegister& arg2 = NoCPUReg, - const CPURegister& arg3 = NoCPUReg); - // Remaining instructions are simple pass-through calls to the assembler. inline void Asr(const Register& rd, const Register& rn, unsigned shift); inline void Asr(const Register& rd, const Register& rn, const Register& rm); @@ -1687,7 +1660,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public MacroAssemblerBase { // Transform a SandboxedPointer from/to its encoded form, which is used when // the pointer is stored on the heap and ensures that the pointer will always // point into the sandbox. - void DecodeSandboxedPointer(Register value); void LoadSandboxedPointerField(Register destination, MemOperand field_operand); void StoreSandboxedPointerField(Register value, MemOperand dst_field_operand); @@ -2077,9 +2049,20 @@ class V8_EXPORT_PRIVATE MacroAssembler : public MacroAssemblerBase { template void DecodeField(Register dst, Register src) { - static const int shift = Field::kShift; - static const int setbits = CountSetBits(Field::kMask, 32); - Ubfx(dst, src, shift, setbits); + static constexpr int shift = Field::kShift; + static constexpr uint64_t mask = + static_cast(Field::kMask) >> shift; + if constexpr ((mask & (mask + 1)) == 0) { + static const int setbits = CountSetBits(Field::kMask, 32); + Ubfx(dst, src, shift, setbits); + } else { + if constexpr (shift != 0) { + Lsr(dst, src, shift); + And(dst, dst, mask); + } else { + And(dst, src, mask); + } + } } template @@ -2411,16 +2394,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public MacroAssemblerBase { const Operand& operand, FlagsUpdate S, AddSubWithCarryOp op); - // Call Printf. On a native build, a simple call will be generated, but if the - // simulator is being used then a suitable pseudo-instruction is used. The - // arguments and stack must be prepared by the caller as for a normal AAPCS64 - // call to 'printf'. - // - // The 'args' argument should point to an array of variable arguments in their - // proper PCS registers (and in calling order). The argument registers can - // have mixed types. The format string (x0) should not be included. - void CallPrintf(int arg_count = 0, const CPURegister* args = nullptr); - private: #if DEBUG // Tell whether any of the macro instruction can be used. When false the diff --git a/deps/v8/src/codegen/code-stub-assembler.cc b/deps/v8/src/codegen/code-stub-assembler.cc index 08f6e6703f96..f5738d915f17 100644 --- a/deps/v8/src/codegen/code-stub-assembler.cc +++ b/deps/v8/src/codegen/code-stub-assembler.cc @@ -24,6 +24,7 @@ #include "src/heap/heap-inl.h" // For MutablePage. TODO(jkummerow): Drop. #include "src/heap/mutable-page.h" #include "src/ic/binary-op-assembler.h" +#include "src/ic/unary-op-assembler.h" #include "src/logging/counters.h" #include "src/numbers/integer-literal-inl.h" #include "src/numbers/math-random.h" @@ -2216,16 +2217,7 @@ TNode CodeStubAssembler::LoadCodeObjectFromJSDispatchTable( TNode shifted_value; if (JSDispatchEntry::kObjectPointerOffset == 0) { shifted_value = -#if defined(__illumos__) && defined(V8_HOST_ARCH_64_BIT) - // Pointers in illumos span both the low 2^47 range and the high 2^47 range - // as well. Checking the high bit being set in illumos means all higher bits - // need to be set to 1 after shifting right. - // Use WordSar() so any high-bit check wouldn't be necessary. - UncheckedCast(WordSar(UncheckedCast(value), - IntPtrConstant(JSDispatchEntry::kObjectPointerShift))); -#else WordShr(value, UintPtrConstant(JSDispatchEntry::kObjectPointerShift)); -#endif /* __illumos__ and 64-bit */ } else { shifted_value = UintPtrAdd( WordShr(value, UintPtrConstant(JSDispatchEntry::kObjectPointerShift)), @@ -4276,6 +4268,18 @@ void CodeStubAssembler::StoreMapNoWriteBarrier(TNode object, DcheckHasValidMap(object); } +void CodeStubAssembler::StoreMapReleaseNoWriteBarrier( + TNode object, RootIndex map_root_index) { + StoreMapReleaseNoWriteBarrier(object, CAST(LoadRoot(map_root_index))); +} + +void CodeStubAssembler::StoreMapReleaseNoWriteBarrier(TNode object, + TNode map) { + MemoryBarrier(AtomicMemoryOrder::kAcqRel); + OptimizedStoreMap(object, map); + DcheckHasValidMap(object); +} + void CodeStubAssembler::StoreObjectFieldRoot(TNode object, int offset, RootIndex root_index) { TNode root = LoadRoot(root_index); @@ -6693,7 +6697,12 @@ void CodeStubAssembler::CopyRange(TNode dst_object, int dst_offset, TNode value = LoadObjectField(src_object, current_src_offset); TNode current_dst_offset = IntPtrAdd(TimesTaggedSize(index), IntPtrConstant(dst_offset)); - if (mode == SKIP_WRITE_BARRIER) { + if (mode == UNSAFE_SKIP_WRITE_BARRIER) { + UnsafeStoreNoWriteBarrier( + MachineRepresentation::kTagged, dst_object, + IntPtrSub(current_dst_offset, IntPtrConstant(kHeapObjectTag)), + value); + } else if (mode == SKIP_WRITE_BARRIER) { StoreObjectFieldNoWriteBarrier(dst_object, current_dst_offset, value); } else { StoreObjectField(dst_object, current_dst_offset, value); @@ -9789,6 +9798,17 @@ TNode ToDirectStringAssembler::ToDirect() { return var_string_.value(); } +void ToDirectStringAssembler::BailIfTransitioned(Label* if_bailout) { +#if V8_STATIC_ROOTS_BOOL + GotoIfNot(TaggedEqual(LoadMap(var_string_.value()), var_map_.value()), + if_bailout); +#else + GotoIfNot(Word32Equal(LoadInstanceType(var_string_.value()), + var_instance_type_.value()), + if_bailout); +#endif +} + TNode ToDirectStringAssembler::IsOneByte() { #if V8_STATIC_ROOTS_BOOL return IsOneByteStringMap(var_map_.value()); @@ -12783,7 +12803,7 @@ TNode CodeStubAssembler::CallGetterIfAccessorAndBailoutOnLazyClosures( // signature and receiver is not a JSReceiver the signature check // in CallFunctionTemplate builtin will fail anyway, so we can // short cut it here and throw kIllegalInvocation immediately. - js_receiver = ToObject_Inline(context, receiver); + js_receiver = ConvertReceiver(context, receiver); break; } TNode holder_receiver = *holder; @@ -13586,10 +13606,16 @@ TNode CodeStubAssembler::OrdinaryHasInstance( CSA_DCHECK(this, IsJSReceiver(object)); // Throw TypeError in case of non-instance prototype. - TNode callable_prototype = CAST(LoadJSFunctionPrototype( + TNode maybe_callable_prototype = CAST(LoadJSFunctionPrototype( CAST(callable), &return_runtime, &if_non_instance_prototype, &var_non_instance_prototype)); + // Usually, we don't expect JSFunctions with prototypes to have initial + // maps with null prototype, however this is currently the case for shared + // struct constructors. + var_non_instance_prototype = maybe_callable_prototype; + GotoIf(IsNull(maybe_callable_prototype), &if_non_instance_prototype); + TNode callable_prototype = CAST(maybe_callable_prototype); // Loop through the prototype chain looking for the {callable} prototype. var_result = HasInPrototypeChain(context, object, callable_prototype); Goto(&return_result); @@ -15203,6 +15229,7 @@ TNode CodeStubAssembler::MemoryChunkFromAddress( IntPtrConstant(~MemoryChunk::GetAlignmentMaskForAssembler())); } +// LINT.IfChange(BasePageFromMemoryChunk) TNode CodeStubAssembler::BasePageFromMemoryChunk( TNode address) { #ifdef V8_ENABLE_SANDBOX @@ -15219,17 +15246,34 @@ TNode CodeStubAssembler::BasePageFromMemoryChunk( MemoryChunkConstants::kMetadataPointerTableSizeMask)); TNode offset = ChangeInt32ToIntPtr( Word32Shl(index, UniqueUint32Constant(kBasePageTableEntrySizeLog2))); + static_assert(offsetof(IsolateGroup::BasePageTableEntry, metadata_) == 0); TNode metadata = Load(table, offset); // Check that the Metadata belongs to this Chunk, since an attacker with write // inside the sandbox could've swapped the index. TNode metadata_chunk = MemoryChunkFromAddress( Load(metadata, IntPtrConstant(BasePage::AreaStartOffset()))); CSA_CHECK(this, WordEqual(metadata_chunk, address)); + + // Check that the page is accessible from the current isolate. + TNode isolate = Load( + table, + IntPtrAdd(offset, IntPtrConstant(offsetof( + IsolateGroup::BasePageTableEntry, isolate_)))); + TNode current_isolate = UncheckedCast( + ExternalConstant(ExternalReference::isolate_address())); + CSA_CHECK( + this, + Word32Or(WordEqual(isolate, current_isolate), + WordEqual( + isolate, + IntPtrConstant(IsolateGroup::BasePageTableEntry:: + kReadOnlyOrSharedEntryIsolateSentinel)))); return metadata; #else return Load(address, IntPtrConstant(MemoryChunk::MetadataOffset())); #endif } +// LINT.ThenChange(/src/heap/memory-chunk-inl.h:BasePageFromMemoryChunk) TNode CodeStubAssembler::BasePageFromAddress(TNode address) { return BasePageFromMemoryChunk(MemoryChunkFromAddress(address)); @@ -16953,8 +16997,7 @@ void CodeStubAssembler::GenerateNumberBinaryOp(Operation op, TNode lhs, } void CodeStubAssembler::GenerateStringAdd(TNode lhs, TNode rhs, - TNode feedback_offset, - Builtin fallback_builtin) { + TNode feedback_offset) { Label fallback(this, Label::kDeferred); GotoIf(TaggedIsSmi(lhs), &fallback); @@ -16971,10 +17014,11 @@ void CodeStubAssembler::GenerateStringAdd(TNode lhs, TNode rhs, BIND(&fallback); { - TailCallBuiltin(fallback_builtin, LoadContextFromBaseline(), lhs, rhs, - Int32Constant(static_cast( - BinaryOperationFeedback::TypeIndex::kString)), - feedback_offset); + TailCallBuiltin( + Builtin::kAddAndTryPatchCode, LoadContextFromBaseline(), lhs, rhs, + Int32Constant( + static_cast(BinaryOperationFeedback::TypeIndex::kString)), + feedback_offset); } } @@ -17071,6 +17115,149 @@ void CodeStubAssembler::GenerateBinaryOpAndTryPatchCode( ChangeUintPtrToTagged(feedback_offset)); } } + +void CodeStubAssembler::GenerateSmiUnaryOp(Operation op, TNode value, + TNode feedback_offset, + Builtin fallback_builtin) { + Label fallback(this, Label::kDeferred); + GotoIfNot(TaggedIsSmi(value), &fallback); + TNode smi = CAST(value); + + switch (op) { + case Operation::kIncrement: + Return(TrySmiAdd(smi, SmiConstant(1), &fallback)); + break; + case Operation::kDecrement: + Return(TrySmiAdd(smi, SmiConstant(-1), &fallback)); + break; + case Operation::kNegate: + // 0 negates to -0; kMinValue overflows. Both bail so feedback widens + // correctly. + GotoIf(SmiEqual(smi, SmiConstant(0)), &fallback); + GotoIf(SmiEqual(smi, SmiConstant(Smi::kMinValue)), &fallback); + Return(SmiSub(SmiConstant(0), smi)); + break; + case Operation::kBitwiseNot: { + TNode result = + ChangeInt32ToTagged(Word32BitwiseNot(SmiToInt32(smi))); + // On 32-bit Smi builds the result may not fit a Smi; bail if so. + GotoIfNot(TaggedIsSmi(result), &fallback); + Return(result); + break; + } + default: + UNREACHABLE(); + } + + BIND(&fallback); + { + TailCallBuiltin(fallback_builtin, LoadContextFromBaseline(), value, + Int32Constant(static_cast( + BinaryOperationFeedback::TypeIndex::kSignedSmall)), + feedback_offset); + } +} + +void CodeStubAssembler::GenerateNumberNegate(TNode value, + TNode feedback_offset) { + Label fallback(this, Label::kDeferred), do_float(this); + TVARIABLE(Float64T, var_float); + + Label if_smi(this); + GotoIf(TaggedIsSmi(value), &if_smi); + GotoIfNot(IsHeapNumber(CAST(value)), &fallback); + var_float = LoadHeapNumberValue(CAST(value)); + Goto(&do_float); + + BIND(&if_smi); + { + TNode smi = CAST(value); + Label if_zero(this), if_min(this); + GotoIf(SmiEqual(smi, SmiConstant(0)), &if_zero); + GotoIf(SmiEqual(smi, SmiConstant(Smi::kMinValue)), &if_min); + Return(SmiSub(SmiConstant(0), smi)); + + BIND(&if_zero); + Return(MinusZeroConstant()); + + BIND(&if_min); + var_float = SmiToFloat64(smi); + Goto(&do_float); + } + + BIND(&do_float); + Return(AllocateHeapNumberWithValue(Float64Neg(var_float.value()))); + + BIND(&fallback); + { + TailCallBuiltin( + Builtin::kNegateAndTryPatchCode, LoadContextFromBaseline(), value, + Int32Constant( + static_cast(BinaryOperationFeedback::TypeIndex::kNumber)), + feedback_offset); + } +} + +void CodeStubAssembler::GenerateUnaryOpAndTryPatchCode( + Operation op, TNode value, TNode current_type_feedback, + TNode feedback_offset) { + TVARIABLE(Smi, var_type_feedback, + SmiConstant(BinaryOperationFeedback::kNone)); + TVARIABLE(Object, var_exception); + TVARIABLE(Object, var_result); + TVARIABLE(Uint8T, new_feedback); + TVARIABLE(Int32T, feedback_index); + + auto bytecode_array = LoadBytecodeArrayFromBaseline(); + Label if_exception(this, Label::kDeferred); + { + ScopedExceptionHandler handler(this, &if_exception, &var_exception); + UnaryOpAssembler unary_asm(state()); + auto context = LoadContextFromBaseline(); + auto record_feedback = [&](TNode feedback) { + var_type_feedback = feedback; + }; + switch (op) { + case Operation::kIncrement: + var_result = unary_asm.Generate_IncrementWithFeedback(context, value, + record_feedback); + break; + case Operation::kDecrement: + var_result = unary_asm.Generate_DecrementWithFeedback(context, value, + record_feedback); + break; + case Operation::kNegate: + var_result = unary_asm.Generate_NegateWithFeedback(context, value, + record_feedback); + break; + case Operation::kBitwiseNot: + var_result = unary_asm.Generate_BitwiseNotWithFeedback(context, value, + record_feedback); + break; + default: + UNREACHABLE(); + } + } + feedback_index = EncodeEmbeddedFeedback( + var_type_feedback.value()); + new_feedback = CombineEmbeddedFeedback( + current_type_feedback, feedback_index.value()); + TailCallRuntime(Runtime::kPatchUnaryOpBaselineCode, NoContextConstant(), + SmiFromInt32(new_feedback.value()), var_result.value(), + bytecode_array, ChangeUintPtrToTagged(feedback_offset)); + + BIND(&if_exception); + { + feedback_index = EncodeEmbeddedFeedback( + var_type_feedback.value()); + new_feedback = CombineEmbeddedFeedback( + current_type_feedback, feedback_index.value()); + TailCallRuntime(Runtime::kPatchUnaryOpBaselineCodeAndThrow, + NoContextConstant(), SmiFromInt32(new_feedback.value()), + var_exception.value(), bytecode_array, + ChangeUintPtrToTagged(feedback_offset)); + } +} #endif // V8_ENABLE_SPARKPLUG_PLUS void CodeStubAssembler::GenerateEqual_Same(TNode value, Label* if_equal, diff --git a/deps/v8/src/codegen/code-stub-assembler.h b/deps/v8/src/codegen/code-stub-assembler.h index 8abea7ebc86b..968b1710583b 100644 --- a/deps/v8/src/codegen/code-stub-assembler.h +++ b/deps/v8/src/codegen/code-stub-assembler.h @@ -1871,6 +1871,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler void StoreMapNoWriteBarrier(TNode object, RootIndex map_root_index); void StoreMapNoWriteBarrier(TNode object, TNode map); + void StoreMapReleaseNoWriteBarrier(TNode object, + RootIndex map_root_index); + void StoreMapReleaseNoWriteBarrier(TNode object, TNode map); void StoreObjectFieldRoot(TNode object, int offset, RootIndex root); @@ -3082,6 +3085,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ExternalReference::address_of_builtin_subclassing_flag()); } + TNode HasJsPr3883Flag() { + return LoadRuntimeFlag(ExternalReference::address_of_js_pr_3883_flag()); + } + TNode HasSharedStringTableFlag() { return LoadRuntimeFlag( ExternalReference::address_of_shared_string_table_flag()); @@ -4287,13 +4294,23 @@ class V8_EXPORT_PRIVATE CodeStubAssembler Builtin fallback_builtin); void GenerateStringAdd(TNode lhs, TNode rhs, - TNode feedback_offset, - Builtin fallback_builtin); + TNode feedback_offset); void GenerateBinaryOpAndTryPatchCode(Operation op, TNode lhs, TNode rhs, TNode current_type_feedback, TNode feedback_offset); + + void GenerateSmiUnaryOp(Operation op, TNode value, + TNode feedback_offset, + Builtin fallback_builtin); + + void GenerateNumberNegate(TNode value, + TNode feedback_offset); + + void GenerateUnaryOpAndTryPatchCode(Operation op, TNode value, + TNode current_type_feedback, + TNode feedback_offset); #endif // V8_ENABLE_SPARKPLUG_PLUS TNode Equal(TNode lhs, TNode rhs, @@ -5285,6 +5302,12 @@ class ToDirectStringAssembler : public CodeStubAssembler { return TryToSequential(PTR_TO_STRING, if_bailout); } + // Jumps to {if_bailout} if the direct string's map changed since the last + // TryToDirect, i.e. if a GC thinned it or swapped in an external resource. + // Callers must re-check across an allocation before using string(), + // PointerToData() or PointerToString(). + void BailIfTransitioned(Label* if_bailout); + TNode IsOneByte(); TNode string() { return var_string_.value(); } diff --git a/deps/v8/src/codegen/compiler.cc b/deps/v8/src/codegen/compiler.cc index adfbf3f4a15c..7918e1548f8d 100644 --- a/deps/v8/src/codegen/compiler.cc +++ b/deps/v8/src/codegen/compiler.cc @@ -28,7 +28,6 @@ #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" #include "src/compiler/turbofan.h" #include "src/debug/debug.h" -#include "src/debug/liveedit.h" #include "src/diagnostics/code-tracer.h" #include "src/execution/frames-inl.h" #include "src/execution/isolate-inl.h" @@ -1177,6 +1176,35 @@ void RecordMaglevFunctionCompilation(Isolate* isolate, isolate, LogEventListener::CodeTag::kFunction, script, shared, feedback_vector, code, code->kind(), time_taken_ms); } + +// A bailout on a property of the function itself repeats on every attempt. +// Recording it stops the tiering manager from picking Maglev again, so the +// function tiers up to Turbofan instead of recompiling Maglev forever. +void MaybeMarkMaglevCompilationFailed(DirectHandle function, + BytecodeOffset osr_offset, + BailoutReason reason) { + // The bit lives on the SharedFunctionInfo, so an OSR-only bailout must not + // disable Maglev for the regular entry point too. + if (IsOSR(osr_offset)) return; + switch (reason) { + case BailoutReason::kMaglevGraphBuildingFailed: + function->shared()->set_maglev_compilation_failed(true); + break; + default: + break; + } +} + +void AbortMaglevCompilationJob(Isolate* isolate, + DirectHandle function, + BytecodeOffset osr_offset, + BailoutReason reason) { + CompilerTracer::TraceAbortedMaglevCompile(isolate, function, reason); + MaybeMarkMaglevCompilationFailed(function, osr_offset, reason); + function->SetTieringInProgress(isolate, false, osr_offset); + function->shared()->set_cached_tiering_decision( + CachedTieringDecision::kDelayMaglev); +} #endif // V8_ENABLE_MAGLEV MaybeHandle CompileMaglev(Isolate* isolate, Handle function, @@ -1228,6 +1256,12 @@ MaybeHandle CompileMaglev(Isolate* isolate, Handle function, job->ExecuteJob(isolate->counters()->runtime_call_stats(), isolate->main_thread_local_isolate()); if (status == CompilationJob::FAILED) { + // Synchronous compilation never sets tiering_in_progress, so unlike + // FinalizeMaglevCompilationJob this must not reset it. + CompilerTracer::TraceAbortedMaglevCompile(isolate, function, + job->bailout_reason_); + MaybeMarkMaglevCompilationFailed(function, osr_offset, + job->bailout_reason_); return {}; } CHECK_EQ(status, CompilationJob::SUCCEEDED); @@ -2680,6 +2714,9 @@ MaybeHandle BackgroundCompileTask::FinalizeScript( */ Tagged infos = script->infos(); uint32_t length = infos->ulength().value(); + bool may_have_parallel_tasks = + flags_.post_parallel_compile_tasks_for_eager_toplevel() || + flags_.post_parallel_compile_tasks_for_lazy(); for (uint32_t i = 0; i < length; ++i) { Tagged maybe_obj = infos->get(i); Tagged obj; @@ -2687,10 +2724,16 @@ MaybeHandle BackgroundCompileTask::FinalizeScript( if (Tagged shared; TryCast(obj, &shared)) { // Once all compilation jobs are over, and before merging, we expect that // a function is either compiled (HasBytecodeArray) or is ready for lazy - // compilation (HasUncompiledData). Function here are all user defined - // functions and should not have a builtin_id. - DCHECK(!shared->HasBuiltinId()); - DCHECK(shared->HasBytecodeArray() || shared->HasUncompiledData(isolate)); + // compilation (HasUncompiledData). Functions here are all user defined + // functions and should not have a builtin_id (unless parallel compilation + // is enabled and the function is still in the dispatcher queue). + DCHECK_IMPLIES(!may_have_parallel_tasks, !shared->HasBuiltinId()); + DCHECK_IMPLIES(may_have_parallel_tasks, + !shared->HasBuiltinId() || + shared->builtin_id() == Builtin::kCompileLazy); + DCHECK(shared->HasBytecodeArray() || shared->HasUncompiledData(isolate) || + (may_have_parallel_tasks && + shared->builtin_id() == Builtin::kCompileLazy)); } } #endif @@ -3256,8 +3299,7 @@ void Compiler::CompileOptimized(Isolate* isolate, DCHECK(function->is_compiled(isolate)); DCHECK(function->shared()->HasBytecodeArray()); - DCHECK_IMPLIES(function->IsTieringRequestedOrInProgress(isolate) && - !function->IsLoggingRequested(isolate), + DCHECK_IMPLIES(function->IsOptimizationRequested(isolate), function->tiering_in_progress()); DCHECK_IMPLIES(!tiering_was_in_progress && function->tiering_in_progress(), function->ChecksTieringState(isolate)); @@ -3266,15 +3308,6 @@ void Compiler::CompileOptimized(Isolate* isolate, #endif // DEBUG } -// static -MaybeDirectHandle Compiler::CompileForLiveEdit( - ParseInfo* parse_info, Handle