[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:
clemensh 2016-10-11 01:27:53 -07:00 committed by Commit bot
parent f2c0f97ad8
commit 1b58614135
4 changed files with 12 additions and 12 deletions

View File

@ -768,8 +768,9 @@ RUNTIME_FUNCTION(Runtime_DeserializeWasmModule) {
if (!maybe_compiled_module.ToHandle(&compiled_module)) { if (!maybe_compiled_module.ToHandle(&compiled_module)) {
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
return *wasm::CreateCompiledModuleObject(isolate, compiled_module, return *wasm::CreateCompiledModuleObject(
wasm::ModuleOrigin::kWasmOrigin); isolate, Handle<wasm::WasmCompiledModule>::cast(compiled_module),
wasm::kWasmOrigin);
} }
RUNTIME_FUNCTION(Runtime_ValidateWasmInstancesChain) { RUNTIME_FUNCTION(Runtime_ValidateWasmInstancesChain) {

View File

@ -2093,9 +2093,9 @@ int GetNumberOfFunctions(Handle<JSObject> wasm) {
return func_names_arr->get_int(0); return func_names_arr->get_int(0);
} }
Handle<JSObject> CreateCompiledModuleObject(Isolate* isolate, Handle<JSObject> CreateCompiledModuleObject(
Handle<FixedArray> compiled_module, Isolate* isolate, Handle<WasmCompiledModule> compiled_module,
ModuleOrigin origin) { ModuleOrigin origin) {
Handle<JSObject> module_obj; Handle<JSObject> module_obj;
if (origin == ModuleOrigin::kWasmOrigin) { if (origin == ModuleOrigin::kWasmOrigin) {
Handle<JSFunction> module_cons( Handle<JSFunction> module_cons(
@ -2113,8 +2113,7 @@ Handle<JSObject> CreateCompiledModuleObject(Isolate* isolate,
Object::SetProperty(module_obj, module_sym, module_obj, STRICT).Check(); Object::SetProperty(module_obj, module_sym, module_obj, STRICT).Check();
} }
Handle<WeakCell> link_to_module = isolate->factory()->NewWeakCell(module_obj); Handle<WeakCell> link_to_module = isolate->factory()->NewWeakCell(module_obj);
WasmCompiledModule::cast(*compiled_module) compiled_module->set_weak_module_object(link_to_module);
->set_weak_module_object(link_to_module);
return module_obj; return module_obj;
} }
@ -2132,7 +2131,7 @@ MaybeHandle<JSObject> CreateModuleObjectFromBytes(Isolate* isolate,
thrower->Failed("Wasm decoding failed", result); thrower->Failed("Wasm decoding failed", result);
return nothing; return nothing;
} }
MaybeHandle<FixedArray> compiled_module = MaybeHandle<WasmCompiledModule> compiled_module =
decoded_module->CompileFunctions(isolate, thrower); decoded_module->CompileFunctions(isolate, thrower);
if (compiled_module.is_null()) return nothing; if (compiled_module.is_null()) return nothing;

View File

@ -516,9 +516,9 @@ Handle<FixedArray> BuildFunctionTable(Isolate* isolate, uint32_t index,
void PopulateFunctionTable(Handle<FixedArray> table, uint32_t table_size, void PopulateFunctionTable(Handle<FixedArray> table, uint32_t table_size,
const std::vector<Handle<Code>>* code_table); const std::vector<Handle<Code>>* code_table);
Handle<JSObject> CreateCompiledModuleObject(Isolate* isolate, Handle<JSObject> CreateCompiledModuleObject(
Handle<FixedArray> compiled_module, Isolate* isolate, Handle<WasmCompiledModule> compiled_module,
ModuleOrigin origin); ModuleOrigin origin);
V8_EXPORT_PRIVATE MaybeHandle<JSObject> CreateModuleObjectFromBytes( V8_EXPORT_PRIVATE MaybeHandle<JSObject> CreateModuleObjectFromBytes(
Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower, Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower,

View File

@ -209,7 +209,7 @@ TEST(Run_WasmModule_Serialization) {
std::unique_ptr<const WasmModule> module(decoding_result.val); std::unique_ptr<const WasmModule> module(decoding_result.val);
CHECK(!decoding_result.failed()); CHECK(!decoding_result.failed());
MaybeHandle<FixedArray> compiled_module = MaybeHandle<WasmCompiledModule> compiled_module =
module->CompileFunctions(isolate, &thrower); module->CompileFunctions(isolate, &thrower);
CHECK(!compiled_module.is_null()); CHECK(!compiled_module.is_null());
Handle<JSObject> module_obj = CreateCompiledModuleObject( Handle<JSObject> module_obj = CreateCompiledModuleObject(