4 Commits
Author SHA1 Message Date
Olivier Flückiger c795f59485 [immutable-array-buffer] Fix check order in TypedArray.prototype.set
According to the spec, TypedArray.prototype.set checks
IsImmutableBuffer(target.[[ViewedArrayBuffer]]) before converting
the offset argument to integer and before reading from the source
object.

Additionally, when setting from a TypedArray source, reading from an
immutable source TypedArray is permitted, so the source array should
be validated using TypedArrayAccessMode::kRead rather than kWrite.

Drive-By: Add a fast case for Smi indices where the steps are not
          observable and we can fold all checks.

TAG=agy
CONV=94aa3be8-9990-41fe-a565-c62e3daa9a42

Bug: 450237486
Change-Id: I21790be90cde9a96ba7c1f573f034016d9c29850
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8252528
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Olivier Flückiger <olivf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#109366}
2026-08-19 08:09:22 -07:00
Olivier Flückiger 3bdf8166e6 [immutable-arraybuffer] Support immutable AB in structured clone
* The serializer must preserve immutability.
* Transferring an immutable array buffer is not allowed.

Currently the backing store is always copied. Potentially it could be
shared for postMessage.

See: https://github.com/whatwg/html/pull/11033

Bug: 450237486
Change-Id: I0be6081a29454c8557b81c364b9f49332d15427c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7462754
Auto-Submit: Olivier Flückiger <olivf@chromium.org>
Commit-Queue: Olivier Flückiger <olivf@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#104746}
2026-01-16 06:53:56 -08:00
sahil a4e79f1059 [mjsunit] Strengthen immutable ArrayBuffer edge case coverage
- Add non-generic transferToImmutable validation tests
- Extend DataView setter coverage to ensure all write paths throw
- Fix duplicate test name for sliceToImmutable order checks

This improves coverage for invalid receivers, multi-byte DataView
writes, and ensures test clarity by removing duplicate test names.

Change-Id: I5ad8c50c7c39216f56ffe15beb66bf2c595fd305
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7257714
Commit-Queue: Seokho Song <seokho@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Seokho Song <seokho@chromium.org>
Cr-Commit-Position: refs/heads/main@{#104456}
2025-12-24 05:49:56 -08:00
Olivier Flückiger dc5908fd73 [immutable-arraybuffer] Implement immutable arraybuffer
Implements the TC39 immutable array buffer proposal
https://github.com/tc39/proposal-immutable-arraybuffer.

This CL mostly disables typed array support in the optimizing
compilers. This part still needs to be done.

Drive-By:
* Cleanup error messages for detached vs. out-of-bounds buffers
* Cleanup naming and implementation around ValidateTypedArray.

Bug: 450237486
Change-Id: I40444163c3b8fbd72e937dc27668a4c6675d7ff1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7223550
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Auto-Submit: Olivier Flückiger <olivf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#104246}
2025-12-10 07:21:32 -08:00