[wasm][liftoff] Implement elem.drop

R=clemensb@chromium.org

Bug: v8:10281
Change-Id: I2c49093585fbd6e9ba1fe777492188d64625dc92
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2111222
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66819}
This commit is contained in:
Andreas Haas 2020-03-20 16:22:56 +01:00 committed by Commit Bot
parent ebf2c49ae2
commit 2d8ca349f8

View File

@ -2937,7 +2937,21 @@ class LiftoffCompiler {
}
void ElemDrop(FullDecoder* decoder, const ElemDropImmediate<validate>& imm) {
unsupported(decoder, kBulkMemory, "elem.drop");
LiftoffRegList pinned;
Register seg_size_array =
pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp();
LOAD_INSTANCE_FIELD(seg_size_array, DroppedElemSegments,
kSystemPointerSize);
LiftoffRegister seg_index =
pinned.set(__ GetUnusedRegister(kGpReg, pinned));
__ LoadConstant(seg_index, WasmValue(imm.index));
// Set the length of the segment to '0' to drop it.
LiftoffRegister one_reg = pinned.set(__ GetUnusedRegister(kGpReg, pinned));
__ LoadConstant(one_reg, WasmValue(1));
__ Store(seg_size_array, seg_index.gp(), 0, one_reg, StoreType::kI32Store,
pinned);
}
void TableCopy(FullDecoder* decoder, const TableCopyImmediate<validate>& imm,