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

Unified Diff: src/wasm/ast-decoder.h

Issue 2440953002: [wasm] Binary 0xD: update encoding of opcodes, types, and add immediates. (Closed)
Patch Set: Fix imported table kind. Created 4 years, 2 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/asmjs/asm-wasm-builder.cc ('k') | src/wasm/ast-decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/ast-decoder.h
diff --git a/src/wasm/ast-decoder.h b/src/wasm/ast-decoder.h
index feafa2618fa52990afea9178a54a6a780ac3d877..9ce323efcbab6d917e75f166d47637d2e70c3e05 100644
--- a/src/wasm/ast-decoder.h
+++ b/src/wasm/ast-decoder.h
@@ -186,14 +186,19 @@ struct BreakDepthOperand {
};
struct CallIndirectOperand {
+ uint32_t table_index;
uint32_t index;
FunctionSig* sig;
unsigned length;
inline CallIndirectOperand(Decoder* decoder, const byte* pc) {
- unsigned len1 = 0;
- unsigned len2 = 0;
- index = decoder->checked_read_u32v(pc, 1 + len1, &len2, "signature index");
- length = len1 + len2;
+ unsigned len = 0;
+ index = decoder->checked_read_u32v(pc, 1, &len, "signature index");
+ table_index = decoder->checked_read_u8(pc, 1 + len, "table index");
+ if (table_index != 0) {
+ decoder->error(pc, pc + 1 + len, "expected table index 0, found %u",
+ table_index);
+ }
+ length = 1 + len;
sig = nullptr;
}
};
@@ -211,6 +216,18 @@ struct CallFunctionOperand {
}
};
+struct MemoryIndexOperand {
+ uint32_t index;
+ unsigned length;
+ inline MemoryIndexOperand(Decoder* decoder, const byte* pc) {
+ index = decoder->checked_read_u8(pc, 1, "memory index");
+ if (index != 0) {
+ decoder->error(pc, pc + 1, "expected memory index 0, found %u", index);
+ }
+ length = 1;
+ }
+};
+
struct BranchTableOperand {
uint32_t table_count;
const byte* start;
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/wasm/ast-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698