Bug 1546138 - Baldr: rename TableKind::TypedFunction to AsmJS (r=lth)

Differential Revision: https://phabricator.services.mozilla.com/D29299

--HG--
extra : rebase_source : 5e03322e1ebc5ffaa8f55de0fa5c359b492dc647
This commit is contained in:
Luke Wagner 2019-04-24 16:57:07 -05:00
Родитель 45279425f2
Коммит 88fdbed8e4
6 изменённых файлов: 18 добавлений и 16 удалений

Просмотреть файл

@ -2019,7 +2019,7 @@ class MOZ_STACK_CLASS JS_HAZ_ROOTED ModuleValidator
}
env_.asmJSSigToTableIndex[sigIndex] = env_.tables.length();
if (!env_.tables.emplaceBack(TableKind::TypedFunction, Limits(mask + 1))) {
if (!env_.tables.emplaceBack(TableKind::AsmJS, Limits(mask + 1))) {
return false;
}

Просмотреть файл

@ -436,9 +436,9 @@ size_t global_tlsOffset(const GlobalDesc* global) {
// TableDesc
size_t table_tlsOffset(const TableDesc* table) {
MOZ_RELEASE_ASSERT(table->kind == TableKind::FuncRef ||
table->kind == TableKind::TypedFunction,
"cranelift doesn't support AnyRef tables yet.");
MOZ_RELEASE_ASSERT(
table->kind == TableKind::FuncRef || table->kind == TableKind::AsmJS,
"cranelift doesn't support AnyRef tables yet.");
return globalToTlsOffset(table->globalDataOffset);
}

Просмотреть файл

@ -378,7 +378,7 @@ bool ModuleGenerator::init(Metadata* maybeAsmJSMetadata) {
addOrMerge(ExportedFunc(funcIndex, false));
}
break;
case TableKind::TypedFunction:
case TableKind::AsmJS:
// asm.js functions are not exported.
break;
case TableKind::AnyRef:

Просмотреть файл

@ -56,7 +56,7 @@ SharedTable Table::create(JSContext* cx, const TableDesc& desc,
HandleWasmTableObject maybeObject) {
switch (desc.kind) {
case TableKind::FuncRef:
case TableKind::TypedFunction: {
case TableKind::AsmJS: {
UniqueFuncRefArray functions(
cx->pod_calloc<FunctionTableElem>(desc.limits.initial));
if (!functions) {
@ -104,7 +104,7 @@ void Table::tracePrivate(JSTracer* trc) {
objects_.trace(trc);
break;
}
case TableKind::TypedFunction: {
case TableKind::AsmJS: {
#ifdef DEBUG
for (uint32_t i = 0; i < length_; i++) {
MOZ_ASSERT(!functions_[i].tls);
@ -169,7 +169,7 @@ void Table::setFuncRef(uint32_t index, void* code, const Instance* instance) {
MOZ_ASSERT(elem.tls->instance->objectUnbarriered()->isTenured(),
"no writeBarrierPost (Table::set)");
break;
case TableKind::TypedFunction:
case TableKind::AsmJS:
elem.code = code;
elem.tls = nullptr;
break;
@ -202,7 +202,7 @@ void Table::setNull(uint32_t index) {
setAnyRef(index, AnyRef::null());
break;
}
case TableKind::TypedFunction: {
case TableKind::AsmJS: {
MOZ_CRASH("Should not happen");
}
}
@ -233,7 +233,7 @@ void Table::copy(const Table& srcTable, uint32_t dstIndex, uint32_t srcIndex) {
setAnyRef(dstIndex, srcTable.getAnyRef(srcIndex));
break;
}
case TableKind::TypedFunction: {
case TableKind::AsmJS: {
MOZ_CRASH("Bad table type");
}
}
@ -285,7 +285,7 @@ uint32_t Table::grow(uint32_t delta, JSContext* cx) {
}
break;
}
case TableKind::TypedFunction: {
case TableKind::AsmJS: {
MOZ_CRASH("Bad table type");
}
}

Просмотреть файл

@ -70,9 +70,8 @@ class Table : public ShareableBase<Table> {
void trace(JSTracer* trc);
TableKind kind() const { return kind_; }
bool isTypedFunction() const { return kind_ == TableKind::TypedFunction; }
bool isFunction() const {
return kind_ == TableKind::FuncRef || kind_ == TableKind::TypedFunction;
return kind_ == TableKind::FuncRef || kind_ == TableKind::AsmJS;
}
uint32_t length() const { return length_; }
Maybe<uint32_t> maximum() const { return maximum_; }

Просмотреть файл

@ -1953,10 +1953,13 @@ struct Limits {
};
// TableDesc describes a table as well as the offset of the table's base pointer
// in global memory. Currently, wasm only has "any function" and asm.js only
// "typed function".
// in global memory. The TableKind determines the representation:
// - AnyRef: a wasm anyref word (wasm::AnyRef)
// - FuncRef: a two-word FunctionTableElem (wasm indirect call ABI)
// - AsmJS: a two-word FunctionTableElem (asm.js ABI)
// Eventually there should be a single unified AnyRef representation.
enum class TableKind { FuncRef, AnyRef, TypedFunction };
enum class TableKind { AnyRef, FuncRef, AsmJS };
struct TableDesc {
TableKind kind;