[wasm] Use WasmCompiledModule type in interfaces
Just a minor refactoring. We have the type for compiled modules, so use it where possible for better type safety. R=ahaas@chromium.org, titzer@chromium.org Review-Url: https://codereview.chromium.org/2405173002 Cr-Commit-Position: refs/heads/master@{#40156}
This commit is contained in:
parent
f2c0f97ad8
commit
1b58614135
@ -768,8 +768,9 @@ RUNTIME_FUNCTION(Runtime_DeserializeWasmModule) {
|
||||
if (!maybe_compiled_module.ToHandle(&compiled_module)) {
|
||||
return isolate->heap()->undefined_value();
|
||||
}
|
||||
return *wasm::CreateCompiledModuleObject(isolate, compiled_module,
|
||||
wasm::ModuleOrigin::kWasmOrigin);
|
||||
return *wasm::CreateCompiledModuleObject(
|
||||
isolate, Handle<wasm::WasmCompiledModule>::cast(compiled_module),
|
||||
wasm::kWasmOrigin);
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ValidateWasmInstancesChain) {
|
||||
|
@ -2093,9 +2093,9 @@ int GetNumberOfFunctions(Handle<JSObject> wasm) {
|
||||
return func_names_arr->get_int(0);
|
||||
}
|
||||
|
||||
Handle<JSObject> CreateCompiledModuleObject(Isolate* isolate,
|
||||
Handle<FixedArray> compiled_module,
|
||||
ModuleOrigin origin) {
|
||||
Handle<JSObject> CreateCompiledModuleObject(
|
||||
Isolate* isolate, Handle<WasmCompiledModule> compiled_module,
|
||||
ModuleOrigin origin) {
|
||||
Handle<JSObject> module_obj;
|
||||
if (origin == ModuleOrigin::kWasmOrigin) {
|
||||
Handle<JSFunction> module_cons(
|
||||
@ -2113,8 +2113,7 @@ Handle<JSObject> CreateCompiledModuleObject(Isolate* isolate,
|
||||
Object::SetProperty(module_obj, module_sym, module_obj, STRICT).Check();
|
||||
}
|
||||
Handle<WeakCell> link_to_module = isolate->factory()->NewWeakCell(module_obj);
|
||||
WasmCompiledModule::cast(*compiled_module)
|
||||
->set_weak_module_object(link_to_module);
|
||||
compiled_module->set_weak_module_object(link_to_module);
|
||||
return module_obj;
|
||||
}
|
||||
|
||||
@ -2132,7 +2131,7 @@ MaybeHandle<JSObject> CreateModuleObjectFromBytes(Isolate* isolate,
|
||||
thrower->Failed("Wasm decoding failed", result);
|
||||
return nothing;
|
||||
}
|
||||
MaybeHandle<FixedArray> compiled_module =
|
||||
MaybeHandle<WasmCompiledModule> compiled_module =
|
||||
decoded_module->CompileFunctions(isolate, thrower);
|
||||
if (compiled_module.is_null()) return nothing;
|
||||
|
||||
|
@ -516,9 +516,9 @@ Handle<FixedArray> BuildFunctionTable(Isolate* isolate, uint32_t index,
|
||||
void PopulateFunctionTable(Handle<FixedArray> table, uint32_t table_size,
|
||||
const std::vector<Handle<Code>>* code_table);
|
||||
|
||||
Handle<JSObject> CreateCompiledModuleObject(Isolate* isolate,
|
||||
Handle<FixedArray> compiled_module,
|
||||
ModuleOrigin origin);
|
||||
Handle<JSObject> CreateCompiledModuleObject(
|
||||
Isolate* isolate, Handle<WasmCompiledModule> compiled_module,
|
||||
ModuleOrigin origin);
|
||||
|
||||
V8_EXPORT_PRIVATE MaybeHandle<JSObject> CreateModuleObjectFromBytes(
|
||||
Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower,
|
||||
|
@ -209,7 +209,7 @@ TEST(Run_WasmModule_Serialization) {
|
||||
std::unique_ptr<const WasmModule> module(decoding_result.val);
|
||||
CHECK(!decoding_result.failed());
|
||||
|
||||
MaybeHandle<FixedArray> compiled_module =
|
||||
MaybeHandle<WasmCompiledModule> compiled_module =
|
||||
module->CompileFunctions(isolate, &thrower);
|
||||
CHECK(!compiled_module.is_null());
|
||||
Handle<JSObject> module_obj = CreateCompiledModuleObject(
|
||||
|
Loading…
Reference in New Issue
Block a user