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

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

Issue 1970503004: [wasm] Differentiate unnamed and empty names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@add-utf8-check
Patch Set: Yang's last comments Created 4 years, 7 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 2ac04253d72b27b09897a5620f6a569b7bdf064f..a372d70d0511a943a6edb8d905a2a4846815dfb9 100644
--- a/src/wasm/wasm-module.h
+++ b/src/wasm/wasm-module.h
@@ -195,7 +195,7 @@ struct WasmModule {
// 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.
+ if (offset == 0 && length == 0) return {NULL, 0}; // no name.
CHECK(BoundsCheck(offset, offset + length));
DCHECK_GE(static_cast<int>(length), 0);
return {reinterpret_cast<const char*>(module_start + offset),
@@ -325,9 +325,10 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
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);
+// Returns a null handle if the function is unnamed or the name is not a valid
+// UTF-8 string.
+MaybeHandle<String> GetWasmFunctionName(Handle<JSObject> wasm,
+ uint32_t func_index);
} // namespace wasm
} // namespace internal
« 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