Bug 1518210 - Wasm: Remove unused wasm::DeserializeModule API. r=luke

This API is no longer used by IndexDB and can be removed.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ryan Hunt 2019-08-30 02:32:44 +00:00
parent bda6e43374
commit 442874c425
4 changed files with 0 additions and 69 deletions

View File

@ -5872,11 +5872,6 @@ JS_PUBLIC_API RefPtr<JS::WasmModule> JS::GetWasmModule(HandleObject obj) {
return const_cast<wasm::Module*>(&mobj.module());
}
JS_PUBLIC_API RefPtr<JS::WasmModule> JS::DeserializeWasmModule(
const uint8_t* bytecode, size_t bytecodeLength) {
return wasm::DeserializeModule(bytecode, bytecodeLength);
}
JS_PUBLIC_API void JS::SetProcessLargeAllocationFailureCallback(
JS::LargeAllocationFailureCallback lafc) {
MOZ_ASSERT(!OnLargeAllocationFailure);

View File

@ -3032,14 +3032,6 @@ extern JS_PUBLIC_API bool IsWasmModuleObject(HandleObject obj);
extern JS_PUBLIC_API RefPtr<WasmModule> GetWasmModule(HandleObject obj);
/**
* This function will be removed when bug 1487479 expunges the last remaining
* bits of wasm IDB support.
*/
extern JS_PUBLIC_API RefPtr<WasmModule> DeserializeWasmModule(
const uint8_t* bytecode, size_t bytecodeLength);
/**
* If a large allocation fails when calling pod_{calloc,realloc}CanGC, the JS
* engine may call the large-allocation-failure callback, if set, to allow the

View File

@ -359,59 +359,6 @@ bool wasm::GetOptimizedEncodingBuildId(JS::BuildIdCharVector* buildId) {
return true;
}
RefPtr<JS::WasmModule> wasm::DeserializeModule(const uint8_t* bytecode,
size_t bytecodeLength) {
// We have to compile new code here so if we're fundamentally unable to
// compile, we have to fail. If you change this code, update the
// MutableCompileArgs setting below.
if (!BaselineCanCompile() && !IonCanCompile()) {
return nullptr;
}
MutableBytes bytecodeCopy = js_new<ShareableBytes>();
if (!bytecodeCopy ||
!bytecodeCopy->bytes.initLengthUninitialized(bytecodeLength)) {
return nullptr;
}
memcpy(bytecodeCopy->bytes.begin(), bytecode, bytecodeLength);
ScriptedCaller scriptedCaller;
scriptedCaller.filename = nullptr;
scriptedCaller.line = 0;
MutableCompileArgs args = js_new<CompileArgs>(std::move(scriptedCaller));
if (!args) {
return nullptr;
}
// The true answer to whether various flags are enabled is provided by
// the JSContext that originated the call that caused this deserialization
// attempt to happen. We don't have that context here, so we assume that
// shared memory is enabled; we will catch a wrong assumption later, during
// instantiation.
//
// (We would prefer to store this value with the Assumptions when
// serializing, and for the caller of the deserialization machinery to
// provide the value from the originating context.)
//
// Note this is guarded at the top of this function.
args->ionEnabled = IonCanCompile();
args->baselineEnabled = BaselineCanCompile();
args->sharedMemoryEnabled = true;
UniqueChars error;
UniqueCharsVector warnings;
SharedModule module = CompileBuffer(*args, *bytecodeCopy, &error, &warnings);
if (!module) {
return nullptr;
}
// The public interface is effectively const.
return RefPtr<JS::WasmModule>(const_cast<Module*>(module.get()));
}
/* virtual */
void Module::addSizeOfMisc(MallocSizeOf mallocSizeOf,
Metadata::SeenSet* seenMetadata,

View File

@ -235,9 +235,6 @@ typedef RefPtr<const Module> SharedModule;
MOZ_MUST_USE bool GetOptimizedEncodingBuildId(JS::BuildIdCharVector* buildId);
RefPtr<JS::WasmModule> DeserializeModule(const uint8_t* bytecode,
size_t bytecodeLength);
} // namespace wasm
} // namespace js