[wasm][cleanup] Stronger typing for managed_module

Instead of just {Object}, this field can be typed as
{Managed<wasm::Module>}.

R=herhut@chromium.org

Change-Id: Iad47f75ae823846394b6ad04e8829961e924f33d
Reviewed-on: https://chromium-review.googlesource.com/1102333
Reviewed-by: Stephan Herhut <herhut@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53762}
This commit is contained in:
Clemens Hammacher 2018-06-15 12:46:57 +02:00 committed by Commit Bot
parent 586786630c
commit 16f186974f
3 changed files with 11 additions and 9 deletions

View File

@ -52,13 +52,17 @@ CAST_ACCESSOR(WasmTableObject)
ACCESSORS(WasmModuleObject, compiled_module, WasmCompiledModule,
kCompiledModuleOffset)
ACCESSORS(WasmModuleObject, export_wrappers, FixedArray, kExportWrappersOffset)
ACCESSORS(WasmModuleObject, managed_module, Object, kManagedModuleOffset)
ACCESSORS(WasmModuleObject, managed_module, Managed<wasm::WasmModule>,
kManagedModuleOffset)
ACCESSORS(WasmModuleObject, module_bytes, SeqOneByteString, kModuleBytesOffset)
ACCESSORS(WasmModuleObject, script, Script, kScriptOffset)
OPTIONAL_ACCESSORS(WasmModuleObject, asm_js_offset_table, ByteArray,
kAsmJsOffsetTableOffset)
OPTIONAL_ACCESSORS(WasmModuleObject, breakpoint_infos, FixedArray,
kBreakPointInfosOffset)
wasm::WasmModule* WasmModuleObject::module() const {
return managed_module()->raw();
}
void WasmModuleObject::reset_breakpoint_infos() {
WRITE_FIELD(this, kBreakPointInfosOffset, GetHeap()->undefined_value());
}

View File

@ -273,7 +273,8 @@ enum DispatchTableElements : int {
Handle<WasmModuleObject> WasmModuleObject::New(
Isolate* isolate, Handle<WasmCompiledModule> compiled_module,
Handle<FixedArray> export_wrappers, Handle<Foreign> managed_module,
Handle<FixedArray> export_wrappers,
Handle<Managed<wasm::WasmModule>> managed_module,
Handle<SeqOneByteString> module_bytes, Handle<Script> script,
Handle<ByteArray> asm_js_offset_table) {
Handle<JSFunction> module_cons(
@ -337,10 +338,6 @@ void WasmModuleObject::ValidateStateForTesting(
CHECK(!compiled_module->has_instance());
}
WasmModule* WasmModuleObject::module() const {
return Managed<WasmModule>::cast(managed_module())->raw();
}
bool WasmModuleObject::is_asm_js() {
bool asm_js = module()->origin == wasm::kAsmJsOrigin;
DCHECK_EQ(asm_js, script()->IsUserJavaScript());

View File

@ -108,8 +108,8 @@ class WasmModuleObject : public JSObject {
// Shared compiled code between multiple WebAssembly.Module objects.
DECL_ACCESSORS(compiled_module, WasmCompiledModule)
DECL_ACCESSORS(export_wrappers, FixedArray)
DECL_ACCESSORS(managed_module, Object)
wasm::WasmModule* module() const;
DECL_ACCESSORS(managed_module, Managed<wasm::WasmModule>)
inline wasm::WasmModule* module() const;
DECL_ACCESSORS(module_bytes, SeqOneByteString)
DECL_ACCESSORS(script, Script)
DECL_OPTIONAL_ACCESSORS(asm_js_offset_table, ByteArray)
@ -137,7 +137,8 @@ class WasmModuleObject : public JSObject {
static Handle<WasmModuleObject> New(
Isolate* isolate, Handle<WasmCompiledModule> compiled_module,
Handle<FixedArray> export_wrappers, Handle<Foreign> managed_module,
Handle<FixedArray> export_wrappers,
Handle<Managed<wasm::WasmModule>> managed_module,
Handle<SeqOneByteString> module_bytes, Handle<Script> script,
Handle<ByteArray> asm_js_offset_table);