Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: src/wasm/wasm-module.h

Issue 1912103002: [wasm] Store function names in the wasm object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-offset-table-2
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-function-name-table.cc ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/wasm/wasm-function-name-table.cc ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698