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

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

Issue 1743773002: WebAssembly: skip unknown sections, add names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 5f5777cebebe4c5a865aaa11dd37472eb61ea3f5..2e990da65357c6fa46a9bb6ee2f3591c6c944693 100644
--- a/src/wasm/wasm-module.h
+++ b/src/wasm/wasm-module.h
@@ -23,21 +23,28 @@ const size_t kMaxModuleSize = 1024 * 1024 * 1024;
const size_t kMaxFunctionSize = 128 * 1024;
const size_t kMaxStringSize = 256;
+// WebAssembly sections are named as strings in the binary format, but
+// internally V8 uses an enum to handle them.
+//
+// Entries have the form F(enumerator, string).
+#define FOR_EACH_WASM_SECTION_TYPE(F) \
+ F(kDeclMemory, "memory") \
+ F(kDeclSignatures, "signatures") \
+ F(kDeclFunctions, "functions") \
+ F(kDeclGlobals, "globals") \
+ F(kDeclDataSegments, "data_segments") \
+ F(kDeclFunctionTable, "function_tables") \
titzer 2016/02/26 22:54:17 function_table
JF 2016/02/26 23:42:41 Done.
+ F(kDeclEnd, "end") \
+ F(kDeclStartFunction, "start_function") \
+ F(kDeclImportTable, "import_table")
+
enum WasmSectionDeclCode {
- kDeclMemory = 0x00,
- kDeclSignatures = 0x01,
- kDeclFunctions = 0x02,
- kDeclGlobals = 0x03,
- kDeclDataSegments = 0x04,
- kDeclFunctionTable = 0x05,
- kDeclEnd = 0x06,
- kDeclStartFunction = 0x07,
- kDeclImportTable = 0x08,
- kDeclWLL = 0x11,
+#define F(enumerator, string) enumerator,
+ FOR_EACH_WASM_SECTION_TYPE(F)
+#undef F
+ kMaxModuleSectionCode
};
-static const int kMaxModuleSectionCode = 0x11;
-
enum WasmFunctionDeclBit {
kDeclFunctionName = 0x01,
kDeclFunctionImport = 0x02,

Powered by Google App Engine
This is Rietveld 408576698