[wasm-gc] Emit array offset as intptr

Bug: v8:7748
Change-Id: Id94edd934ff57a722012fabb729046dc7a8bc29c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2968944
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75236}
This commit is contained in:
Manos Koukoutos 2021-06-17 14:20:34 +00:00 committed by V8 LUCI CQ
parent acd567b8f9
commit b834c53067

View File

@ -409,9 +409,12 @@ class WasmGraphAssembler : public GraphAssembler {
}
Node* WasmArrayElementOffset(Node* index, wasm::ValueType element_type) {
return Int32Add(
Int32Constant(wasm::ObjectAccess::ToTagged(WasmArray::kHeaderSize)),
Int32Mul(index, Int32Constant(element_type.element_size_bytes())));
Node* index_intptr =
mcgraph()->machine()->Is64() ? ChangeInt32ToInt64(index) : index;
return IntAdd(
IntPtrConstant(wasm::ObjectAccess::ToTagged(WasmArray::kHeaderSize)),
IntMul(index_intptr,
IntPtrConstant(element_type.element_size_bytes())));
}
Node* LoadWasmArrayLength(Node* array) {