[wasm] Implement Print and Verify for WasmInstanceObject
Drive-by: Fix some accessor definitions. R=mstarzinger@chromium.org Change-Id: I2457ac76c376d1e6ffcc19255e669cc7a9732883 Reviewed-on: https://chromium-review.googlesource.com/1063972 Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Cr-Commit-Position: refs/heads/master@{#53250}
This commit is contained in:
parent
b53d077206
commit
29ed5807b2
@ -199,12 +199,14 @@ void HeapObject::HeapObjectVerify() {
|
||||
case JS_SPECIAL_API_OBJECT_TYPE:
|
||||
case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
|
||||
case WASM_GLOBAL_TYPE:
|
||||
case WASM_INSTANCE_TYPE:
|
||||
case WASM_MEMORY_TYPE:
|
||||
case WASM_MODULE_TYPE:
|
||||
case WASM_TABLE_TYPE:
|
||||
JSObject::cast(this)->JSObjectVerify();
|
||||
break;
|
||||
case WASM_INSTANCE_TYPE:
|
||||
WasmInstanceObject::cast(this)->WasmInstanceObjectVerify();
|
||||
break;
|
||||
case JS_ARGUMENTS_TYPE:
|
||||
JSArgumentsObject::cast(this)->JSArgumentsObjectVerify();
|
||||
break;
|
||||
@ -1581,6 +1583,19 @@ void WasmDebugInfo::WasmDebugInfoVerify() {
|
||||
VerifyObjectField(kCWasmEntryMapOffset);
|
||||
}
|
||||
|
||||
void WasmInstanceObject::WasmInstanceObjectVerify() {
|
||||
JSObjectVerify();
|
||||
CHECK(IsWasmInstanceObject());
|
||||
|
||||
// Just generically check all tagged fields. Don't check the untagged fields,
|
||||
// as some of them might still contain the "undefined" value if the
|
||||
// WasmInstanceObject is not fully set up yet.
|
||||
for (int offset = kHeaderSize; offset < kFirstUntaggedOffset;
|
||||
offset += kPointerSize) {
|
||||
VerifyObjectField(offset);
|
||||
}
|
||||
}
|
||||
|
||||
void WasmExportedFunctionData::WasmExportedFunctionDataVerify() {
|
||||
CHECK(IsWasmExportedFunctionData());
|
||||
VerifyObjectField(kWrapperCodeOffset);
|
||||
|
@ -151,13 +151,16 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
|
||||
case JS_ASYNC_GENERATOR_OBJECT_TYPE:
|
||||
case JS_ARGUMENTS_TYPE:
|
||||
case JS_ERROR_TYPE:
|
||||
// TODO(titzer): debug printing for more wasm objects
|
||||
case WASM_GLOBAL_TYPE:
|
||||
case WASM_INSTANCE_TYPE: // TODO(titzer): debug printing for wasm objects
|
||||
case WASM_MEMORY_TYPE:
|
||||
case WASM_MODULE_TYPE:
|
||||
case WASM_TABLE_TYPE:
|
||||
JSObject::cast(this)->JSObjectPrint(os);
|
||||
break;
|
||||
case WASM_INSTANCE_TYPE:
|
||||
WasmInstanceObject::cast(this)->WasmInstanceObjectPrint(os);
|
||||
break;
|
||||
case JS_GENERATOR_OBJECT_TYPE:
|
||||
JSGeneratorObject::cast(this)->JSGeneratorObjectPrint(os);
|
||||
break;
|
||||
@ -1661,6 +1664,43 @@ void WasmDebugInfo::WasmDebugInfoPrint(std::ostream& os) { // NOLINT
|
||||
os << "\n";
|
||||
}
|
||||
|
||||
void WasmInstanceObject::WasmInstanceObjectPrint(std::ostream& os) { // NOLINT
|
||||
HeapObject::PrintHeader(os, "WasmInstanceObject");
|
||||
os << "\n - compiled_module: " << Brief(compiled_module());
|
||||
os << "\n - module_object: " << Brief(module_object());
|
||||
os << "\n - exports_object: " << Brief(exports_object());
|
||||
os << "\n - native_context: " << Brief(native_context());
|
||||
os << "\n - memory_object: " << Brief(memory_object());
|
||||
os << "\n - globals_buffer: " << Brief(globals_buffer());
|
||||
os << "\n - imported_mutable_globals_buffers: "
|
||||
<< Brief(imported_mutable_globals_buffers());
|
||||
os << "\n - debug_info: " << Brief(debug_info());
|
||||
os << "\n - table_object: " << Brief(table_object());
|
||||
os << "\n - imported_function_instances: "
|
||||
<< Brief(imported_function_instances());
|
||||
os << "\n - imported_function_callables: "
|
||||
<< Brief(imported_function_callables());
|
||||
os << "\n - indirect_function_table_instances: "
|
||||
<< Brief(indirect_function_table_instances());
|
||||
os << "\n - managed_native_allocations: "
|
||||
<< Brief(managed_native_allocations());
|
||||
os << "\n - managed_indirect_patcher: " << Brief(managed_indirect_patcher());
|
||||
os << "\n - memory_start: " << static_cast<void*>(memory_start());
|
||||
os << "\n - memory_size: " << memory_size();
|
||||
os << "\n - memory_mask: " << AsHex(memory_mask());
|
||||
os << "\n - imported_function_targets: "
|
||||
<< static_cast<void*>(imported_function_targets());
|
||||
os << "\n - globals_start: " << static_cast<void*>(globals_start());
|
||||
os << "\n - imported_mutable_globals: "
|
||||
<< static_cast<void*>(imported_mutable_globals());
|
||||
os << "\n - indirect_function_table_size: " << indirect_function_table_size();
|
||||
os << "\n - indirect_function_table_sig_ids: "
|
||||
<< static_cast<void*>(indirect_function_table_sig_ids());
|
||||
os << "\n - indirect_function_table_targets: "
|
||||
<< static_cast<void*>(indirect_function_table_targets());
|
||||
os << "\n";
|
||||
}
|
||||
|
||||
void WasmExportedFunctionData::WasmExportedFunctionDataPrint(
|
||||
std::ostream& os) { // NOLINT
|
||||
HeapObject::PrintHeader(os, "WasmExportedFunctionData");
|
||||
|
@ -137,10 +137,10 @@ ACCESSORS(WasmInstanceObject, exports_object, JSObject, kExportsObjectOffset)
|
||||
ACCESSORS(WasmInstanceObject, native_context, Context, kNativeContextOffset)
|
||||
OPTIONAL_ACCESSORS(WasmInstanceObject, memory_object, WasmMemoryObject,
|
||||
kMemoryObjectOffset)
|
||||
ACCESSORS(WasmInstanceObject, globals_buffer, JSArrayBuffer,
|
||||
kGlobalsBufferOffset)
|
||||
ACCESSORS(WasmInstanceObject, imported_mutable_globals_buffers, FixedArray,
|
||||
kImportedMutableGlobalsBuffersOffset)
|
||||
OPTIONAL_ACCESSORS(WasmInstanceObject, globals_buffer, JSArrayBuffer,
|
||||
kGlobalsBufferOffset)
|
||||
OPTIONAL_ACCESSORS(WasmInstanceObject, imported_mutable_globals_buffers,
|
||||
FixedArray, kImportedMutableGlobalsBuffersOffset)
|
||||
OPTIONAL_ACCESSORS(WasmInstanceObject, debug_info, WasmDebugInfo,
|
||||
kDebugInfoOffset)
|
||||
OPTIONAL_ACCESSORS(WasmInstanceObject, table_object, WasmTableObject,
|
||||
@ -151,8 +151,8 @@ ACCESSORS(WasmInstanceObject, imported_function_callables, FixedArray,
|
||||
kImportedFunctionCallablesOffset)
|
||||
OPTIONAL_ACCESSORS(WasmInstanceObject, indirect_function_table_instances,
|
||||
FixedArray, kIndirectFunctionTableInstancesOffset)
|
||||
ACCESSORS(WasmInstanceObject, managed_native_allocations, Foreign,
|
||||
kManagedNativeAllocationsOffset)
|
||||
OPTIONAL_ACCESSORS(WasmInstanceObject, managed_native_allocations, Foreign,
|
||||
kManagedNativeAllocationsOffset)
|
||||
OPTIONAL_ACCESSORS(WasmInstanceObject, managed_indirect_patcher, Foreign,
|
||||
kManagedIndirectPatcherOffset)
|
||||
|
||||
|
@ -298,6 +298,10 @@ class WasmInstanceObject : public JSObject {
|
||||
DECL_PRIMITIVE_ACCESSORS(indirect_function_table_sig_ids, uint32_t*)
|
||||
DECL_PRIMITIVE_ACCESSORS(indirect_function_table_targets, Address*)
|
||||
|
||||
// Dispatched behavior.
|
||||
DECL_PRINTER(WasmInstanceObject)
|
||||
DECL_VERIFIER(WasmInstanceObject)
|
||||
|
||||
// Layout description.
|
||||
#define WASM_INSTANCE_OBJECT_FIELDS(V) \
|
||||
V(kCompiledModuleOffset, kPointerSize) \
|
||||
|
Loading…
Reference in New Issue
Block a user