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

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

Issue 1775873002: [Wasm] Convert many of the fixed-size values to LEB128. (Closed) Base URL: http://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix windows 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/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 386f6f52b2d1456f28cb01232cfcdfaf47e8eaec..5c0e0f3b83a8d0babe9cf2b356bd387a5e7e625b 100644
--- a/src/wasm/ast-decoder.h
+++ b/src/wasm/ast-decoder.h
@@ -97,8 +97,7 @@ struct BreakDepthOperand {
Block* target;
int length;
inline BreakDepthOperand(Decoder* decoder, const byte* pc) {
- depth = decoder->checked_read_u8(pc, 1, "break depth");
- length = 1;
+ depth = decoder->checked_read_u32v(pc, 1, &length, "break depth");
target = nullptr;
}
};
@@ -107,8 +106,7 @@ struct BlockCountOperand {
uint32_t count;
int length;
inline BlockCountOperand(Decoder* decoder, const byte* pc) {
- count = decoder->checked_read_u8(pc, 1, "block count");
- length = 1;
+ count = decoder->checked_read_u32v(pc, 1, &length, "block count");
}
};
@@ -147,19 +145,22 @@ struct BranchTableOperand {
const byte* table;
int length;
inline BranchTableOperand(Decoder* decoder, const byte* pc) {
- table_count = decoder->checked_read_u16(pc, 1, "expected #entries");
- length = 2 + table_count * 2 + 2;
+ int varint_length;
+ table_count =
+ decoder->checked_read_u32v(pc, 1, &varint_length, "expected #entries");
+ length = varint_length + (table_count + 1) * sizeof(uint32_t);
- if (decoder->check(pc, 3, table_count * 2 + 2,
+ uint32_t table_start = 1 + varint_length;
+ if (decoder->check(pc, table_start, (table_count + 1) * sizeof(uint32_t),
"expected <table entries>")) {
- table = pc + 3;
+ table = pc + table_start;
} else {
table = nullptr;
}
}
- inline uint16_t read_entry(Decoder* decoder, int i) {
+ inline uint32_t read_entry(Decoder* decoder, int i) {
DCHECK(i >= 0 && static_cast<uint32_t>(i) <= table_count);
- return table ? decoder->read_u16(table + i * sizeof(uint16_t)) : 0;
+ return table ? decoder->read_u32(table + i * sizeof(uint32_t)) : 0;
}
};
« no previous file with comments | « src/wasm/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