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

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: fix gcmole and signed/unsigned comparison issue 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
Index: src/wasm/wasm-module.h
diff --git a/src/wasm/wasm-module.h b/src/wasm/wasm-module.h
index 78b780ace04bb5b87898cf301f771a8f6aaa29ac..c97a182e6c1284a1d579010a05e2fd26e160b0e7 100644
--- a/src/wasm/wasm-module.h
+++ b/src/wasm/wasm-module.h
@@ -196,6 +196,11 @@ struct WasmModule {
return {reinterpret_cast<const char*>(module_start + offset), 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.
@@ -203,6 +208,11 @@ struct WasmModule {
return {reinterpret_cast<const char*>(module_start + offset), 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;
@@ -320,6 +330,9 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
// given decoded module.
int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module);
+// Extract the function name for the given func_index from the wasm module.
+Handle<Object> GetWasmFunctionName(Handle<JSObject> wasm, uint32_t func_index);
+
} // namespace wasm
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698