Commit 52c539e3 authored by Jakob Kummerow's avatar Jakob Kummerow Committed by V8 LUCI CQ

[wasm-gc] Don't sign-extend indices for array accesses

We treat array indices as unsigned, so we should use
`ChangeUint32ToUint64` before using them for computing memory
offsets on 64-bit platforms.
The signed version is currently an inefficiency; if we actually
allowed arrays of such huge sizes, it would become a bug.

Bug: v8:7748
Change-Id: I5c89ef82755a9987c4e5a8c9b3b630534bb3424f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3440661
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarManos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78993}
parent d053afc9
......@@ -471,7 +471,7 @@ class WasmGraphAssembler : public GraphAssembler {
Node* WasmArrayElementOffset(Node* index, wasm::ValueType element_type) {
Node* index_intptr =
mcgraph()->machine()->Is64() ? ChangeInt32ToInt64(index) : index;
mcgraph()->machine()->Is64() ? ChangeUint32ToUint64(index) : index;
return IntAdd(
IntPtrConstant(wasm::ObjectAccess::ToTagged(WasmArray::kHeaderSize)),
IntMul(index_intptr,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment