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

Unified Diff: src/wasm/module-decoder.cc

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/encoder.cc ('k') | src/wasm/wasm-macro-gen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/module-decoder.cc
diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc
index f81b8f440b410219a523c64ee2245d5cac7bb8e3..b245e1e07928d996cd19bf7f08c5bf363b009994 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -195,7 +195,7 @@ class ModuleDecoder : public Decoder {
if (failed()) break;
TRACE("DecodeFunctionTable[%d] module+%d\n", i,
static_cast<int>(pc_ - start_));
- uint16_t index = consume_u16();
+ uint16_t index = consume_u32v(&length);
if (index >= module->functions.size()) {
error(pc_ - 2, "invalid function index");
break;
@@ -244,7 +244,7 @@ class ModuleDecoder : public Decoder {
WasmImport* import = &module->import_table.back();
const byte* sigpos = pc_;
- import->sig_index = consume_u16("signature index");
+ import->sig_index = consume_u32v(&length, "signature index");
if (import->sig_index >= module->signatures.size()) {
error(sigpos, "invalid signature index");
@@ -278,7 +278,7 @@ class ModuleDecoder : public Decoder {
WasmExport* exp = &module->export_table.back();
const byte* sigpos = pc_;
- exp->func_index = consume_u16("function index");
+ exp->func_index = consume_u32v(&length, "function index");
if (exp->func_index >= module->functions.size()) {
error(sigpos, sigpos,
"function index %u out of bounds (%d functions)",
@@ -566,7 +566,8 @@ class ModuleDecoder : public Decoder {
// Parses an inline function signature.
FunctionSig* consume_sig() {
- byte count = consume_u8("param count");
+ int length;
+ byte count = consume_u32v(&length, "param count");
LocalType ret = consume_local_type();
FunctionSig::Builder builder(module_zone, ret == kAstStmt ? 0 : 1, count);
if (ret != kAstStmt) builder.AddReturn(ret);
« no previous file with comments | « src/wasm/encoder.cc ('k') | src/wasm/wasm-macro-gen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698