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

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

Issue 1780483002: [wasm] Support a two-level namespace for imports. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/module-decoder.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 cce704f4feeb3cd5b0c566f373769d519319dc20..99acf75dc5c94045bf797bcb8b63abe066766572 100644
--- a/src/wasm/wasm-module.h
+++ b/src/wasm/wasm-module.h
@@ -141,6 +141,13 @@ struct WasmModule {
return reinterpret_cast<const char*>(module_start + offset);
}
+ // Get a pointer to a string stored in the module bytes representing a name.
+ const char* GetNameOrNull(uint32_t offset) const {
+ if (offset == 0) return nullptr; // no name.
+ CHECK(BoundsCheck(offset, offset + 1));
+ return reinterpret_cast<const char*>(module_start + offset);
+ }
+
// 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;
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698