// A Table is an indexable array of opaque values. Tables are first-class // stateful objects exposed to WebAssembly. asm.js also uses Tables to represent // its homogeneous function-pointer tables. // // A table of FuncRef holds FunctionTableElems, which are (code*,instance*) // pairs, where the instance must be traced. // // A table of AnyRef holds pointers, which must be traced.
using TableAnyRefVector = GCVector<HeapPtr<AnyRef>, 0, SystemAllocPolicy>;
class Table : public ShareableBase<Table> { using InstanceSet = JS::WeakCache<GCHashSet<
WeakHeapPtr<WasmInstanceObject*>,
StableCellHasher<WeakHeapPtr<WasmInstanceObject*>>, SystemAllocPolicy>>; using FuncRefVector = Vector<FunctionTableElem, 0, SystemAllocPolicy>;
WeakHeapPtr<WasmTableObject*> maybeObject_;
InstanceSet observers_;
FuncRefVector functions_; // either functions_ has data
TableAnyRefVector objects_; // or objects_, but not both const AddressType addressType_; const RefType elemType_; constbool isAsmJS_;
uint32_t length_; const mozilla::Maybe<uint64_t> maximum_;
// Sets ref automatically using the correct setter depending on the ref and // table type (setNull, setFuncRef, or setAnyRef) void setRef(uint32_t address, AnyRef ref);
// Get the element at address and convert it to a JS value.
[[nodiscard]] bool getValue(JSContext* cx, uint32_t address,
MutableHandleValue result) const;
void setNull(uint32_t address);
// Copy entry from |srcTable| at |srcIndex| to this table at |dstIndex|. Used // by table.copy. void copy(const Table& srcTable, uint32_t dstIndex, uint32_t srcIndex);
// grow() returns (uint32_t)-1 if it could not grow.
[[nodiscard]] uint32_t grow(uint32_t delta);
[[nodiscard]] bool movingGrowable() const;
[[nodiscard]] bool addMovingGrowObserver(JSContext* cx,
WasmInstanceObject* instance);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.