Index: src/wasm/wasm-module.h |
diff --git a/src/wasm/wasm-module.h b/src/wasm/wasm-module.h |
index 635c76322f01a657e4d3d9cfa921c97f71672129..a53f86dc9913f7ce594a124d9d99a6bcf1963611 100644 |
--- a/src/wasm/wasm-module.h |
+++ b/src/wasm/wasm-module.h |
@@ -195,6 +195,11 @@ struct WasmModule { |
static_cast<int>(length)}; |
} |
+ // Get a string stored in the module bytes representing a function name. |
+ WasmName GetName(WasmFunction* function) const { |
+ return GetName(function->name_offset, function->name_length); |
+ } |
+ |
// Get a string stored in the module bytes representing a name. |
WasmName GetNameOrNull(uint32_t offset, uint32_t length) const { |
if (length == 0) return {NULL, 0}; // no name. |
@@ -204,6 +209,11 @@ struct WasmModule { |
static_cast<int>(length)}; |
} |
+ // Get a string stored in the module bytes representing a function name. |
+ WasmName GetNameOrNull(WasmFunction* function) const { |
+ return GetNameOrNull(function->name_offset, function->name_length); |
+ } |
+ |
// Checks the given offset range is contained within the module bytes. |
bool BoundsCheck(uint32_t start, uint32_t end) const { |
size_t size = module_end - module_start; |
@@ -321,6 +331,11 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
// given decoded module. |
int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module); |
+// Extract a function name from the given wasm object. |
+// Returns undefined if the function is unnamed or the function index is |
+// invalid. |
+Handle<Object> GetWasmFunctionName(Handle<JSObject> wasm, uint32_t func_index); |
+ |
} // namespace wasm |
} // namespace internal |
} // namespace v8 |