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

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

Issue 1910213004: [wasm] Replace WasmName by Vector<const char> (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-offset-table-2
Patch Set: rebase and introduce typedef WasmName 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/compiler/wasm-compiler.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 78b780ace04bb5b87898cf301f771a8f6aaa29ac..50a5860f9223a0975c7d59cfe6edc4e5488cf006 100644
--- a/src/wasm/wasm-module.h
+++ b/src/wasm/wasm-module.h
@@ -193,14 +193,18 @@ struct WasmModule {
WasmName GetName(uint32_t offset, uint32_t length) const {
if (length == 0) return {"<?>", 3}; // no name.
CHECK(BoundsCheck(offset, offset + length));
- return {reinterpret_cast<const char*>(module_start + offset), length};
+ DCHECK_EQ(static_cast<int64_t>(length), static_cast<int>(length));
titzer 2016/04/26 13:01:43 Why is there an int64 in this DCHECK? Seems a litt
Clemens Hammacher 2016/04/26 13:12:21 The check ensures that there is no int-overflow. Y
titzer 2016/04/26 13:16:11 Might as well just DCHECK_GE(length, 0), as we ass
Clemens Hammacher 2016/04/26 13:20:09 Yep, that's nicer. Changed it accordingly.
+ return {reinterpret_cast<const char*>(module_start + offset),
+ static_cast<int>(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.
CHECK(BoundsCheck(offset, offset + length));
- return {reinterpret_cast<const char*>(module_start + offset), length};
+ DCHECK_EQ(static_cast<int64_t>(length), static_cast<int>(length));
+ return {reinterpret_cast<const char*>(module_start + offset),
+ static_cast<int>(length)};
}
// Checks the given offset range is contained within the module bytes.
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698