Commit c64ce984 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm][liftoff] Implement table.size

R=thibaudm@chromium.org

Bug: v8:7581
Change-Id: I023d7f9be1d7e2211c400cc5c774c0a681c4c190
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2735634Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73216}
parent e3acd9f8
......@@ -4396,8 +4396,30 @@ class LiftoffCompiler {
}
void TableSize(FullDecoder* decoder, const TableIndexImmediate<validate>& imm,
Value* result) {
unsupported(decoder, kRefTypes, "table.size");
Value*) {
// We have to look up instance->tables[table_index].length.
LiftoffRegList pinned;
// Get the number of calls array address.
Register tables = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp();
LOAD_TAGGED_PTR_INSTANCE_FIELD(tables, Tables, pinned);
Register table = tables;
__ LoadTaggedPointer(
table, tables, no_reg,
ObjectAccess::ElementOffsetInTaggedFixedArray(imm.index), pinned);
int length_field_size = WasmTableObject::kCurrentLengthOffsetEnd -
WasmTableObject::kCurrentLengthOffset + 1;
Register result = table;
__ Load(LiftoffRegister(result), table, no_reg,
wasm::ObjectAccess::ToTagged(WasmTableObject::kCurrentLengthOffset),
length_field_size == 4 ? LoadType::kI32Load : LoadType::kI64Load,
pinned);
__ SmiUntag(result);
__ PushRegister(kI32, LiftoffRegister(result));
}
void TableFill(FullDecoder* decoder, const TableIndexImmediate<validate>& imm,
......
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