[wasm-simd][interpreter] Fix decoding memory imm for atomic op

The immediate might not be 2 bytes from start of instruction, because
the opcode is leb encoded.

Bug: chromium:1143053
Change-Id: I3c514e771419470ce34e02d4faa24e9e59676aa6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2504852
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70828}
This commit is contained in:
Zhi An Ng 2020-10-28 02:08:58 +00:00 committed by Commit Bot
parent 06b59094d5
commit 1b9ecebb69

View File

@ -1590,8 +1590,8 @@ class WasmInterpreterInternals {
bool ExtractAtomicOpParams(Decoder* decoder, InterpreterCode* code,
Address* address, pc_t pc, int* const len,
type* val = nullptr, type* val2 = nullptr) {
MemoryAccessImmediate<Decoder::kNoValidation> imm(decoder, code->at(pc + 2),
sizeof(type));
MemoryAccessImmediate<Decoder::kNoValidation> imm(
decoder, code->at(pc + *len), sizeof(type));
if (val2) *val2 = static_cast<type>(Pop().to<op_type>());
if (val) *val = static_cast<type>(Pop().to<op_type>());
uint32_t index = Pop().to<uint32_t>();