From b834c53067e4f1b23e8efd19ad88e11d99be84f7 Mon Sep 17 00:00:00 2001 From: Manos Koukoutos Date: Thu, 17 Jun 2021 14:20:34 +0000 Subject: [PATCH] [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 Commit-Queue: Manos Koukoutos Cr-Commit-Position: refs/heads/master@{#75236} --- src/compiler/wasm-compiler.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc index a454010394..d0cb1cefc4 100644 --- a/src/compiler/wasm-compiler.cc +++ b/src/compiler/wasm-compiler.cc @@ -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) {