Skip to content

Commit

Permalink
Bug 1867753 - Fix ifdefs. r=bvisness
Browse files Browse the repository at this point in the history
  • Loading branch information
eqrion committed Dec 4, 2023
1 parent 90d48b9 commit d3423ed
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions js/src/wasm/WasmBuiltinModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,19 @@ bool CompileBuiltinModule(JSContext* cx,

static BuiltinModuleFuncId SelfTestFuncs[] = {BuiltinModuleFuncId::I8VecMul};

static BuiltinModuleFuncId IntGemmFuncs[] = {
#ifdef ENABLE_WASM_MOZ_INTGEMM
static BuiltinModuleFuncId IntGemmFuncs[] = {
BuiltinModuleFuncId::I8PrepareB,
BuiltinModuleFuncId::I8PrepareBFromTransposed,
BuiltinModuleFuncId::I8PrepareBFromQuantizedTransposed,
BuiltinModuleFuncId::I8PrepareA,
BuiltinModuleFuncId::I8PrepareBias,
BuiltinModuleFuncId::I8MultiplyAndAddBias,
BuiltinModuleFuncId::I8SelectColumnsOfB
BuiltinModuleFuncId::I8SelectColumnsOfB};
#endif // ENABLE_WASM_MOZ_INTGEMM
};

static BuiltinModuleFuncId JSStringFuncs[] = {
#ifdef ENABLE_WASM_JS_STRING_BUILTINS
static BuiltinModuleFuncId JSStringFuncs[] = {
BuiltinModuleFuncId::StringFromWTF16Array,
BuiltinModuleFuncId::StringToWTF16Array,
BuiltinModuleFuncId::StringFromCharCode,
Expand All @@ -278,24 +277,26 @@ static BuiltinModuleFuncId JSStringFuncs[] = {
BuiltinModuleFuncId::StringConcatenate,
BuiltinModuleFuncId::StringSubstring,
BuiltinModuleFuncId::StringEquals,
BuiltinModuleFuncId::StringCompare
#endif // ENABLE_WASM_JS_STRING_BUILTINS
};
BuiltinModuleFuncId::StringCompare};
static const char* JSStringModuleName = "wasm:js-string";
#endif // ENABLE_WASM_JS_STRING_BUILTINS

Maybe<BuiltinModuleId> wasm::ImportMatchesBuiltinModule(
Span<const char> importName, BuiltinModuleIds enabledBuiltins) {
#ifdef ENABLE_WASM_JS_STRING_BUILTINS
if (enabledBuiltins.jsString &&
importName == mozilla::MakeStringSpan(JSStringModuleName)) {
return Some(BuiltinModuleId::JSString);
}
#endif // ENABLE_WASM_JS_STRING_BUILTINS
// Not supported for implicit instantiation yet
MOZ_RELEASE_ASSERT(!enabledBuiltins.selfTest && !enabledBuiltins.intGemm);
return Nothing();
}

Maybe<const BuiltinModuleFunc*> wasm::ImportMatchesBuiltinModuleFunc(
mozilla::Span<const char> importName, BuiltinModuleId module) {
#ifdef ENABLE_WASM_JS_STRING_BUILTINS
// Not supported for implicit instantiation yet
MOZ_RELEASE_ASSERT(module == BuiltinModuleId::JSString);
for (BuiltinModuleFuncId funcId : JSStringFuncs) {
Expand All @@ -304,6 +305,7 @@ Maybe<const BuiltinModuleFunc*> wasm::ImportMatchesBuiltinModuleFunc(
return Some(&func);
}
}
#endif // ENABLE_WASM_JS_STRING_BUILTINS
return Nothing();
}

Expand Down

0 comments on commit d3423ed

Please sign in to comment.