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

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

Issue 2714373003: [wasm] Several unrelated cleanups (Closed)
Patch Set: Argh. Fix. Created 3 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
« no previous file with comments | « src/frames.h ('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/module-decoder.cc
diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc
index 440e5dcbb9becfef7e4f1f62906dbdf06518f0bd..feaca29d7e85079bd96aa75d847e8a4c0a05f476 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -575,9 +575,9 @@ class ModuleDecoder : public Decoder {
WasmIndirectFunctionTable* table = nullptr;
if (table_index >= module->function_tables.size()) {
error(pos, pos, "out of bounds table index %u", table_index);
- } else {
- table = &module->function_tables[table_index];
+ break;
}
+ table = &module->function_tables[table_index];
WasmInitExpr offset = consume_init_expr(module, kWasmI32);
uint32_t num_elem =
consume_count("number of elements", kV8MaxWasmTableEntries);
@@ -587,11 +587,12 @@ class ModuleDecoder : public Decoder {
for (uint32_t j = 0; ok() && j < num_elem; j++) {
WasmFunction* func = nullptr;
uint32_t index = consume_func_index(module, &func);
+ DCHECK_EQ(func != nullptr, ok());
+ if (!func) break;
+ DCHECK_EQ(index, func->func_index);
init->entries.push_back(index);
- if (table && index < module->functions.size()) {
- // Canonicalize signature indices during decoding.
- table->map.FindOrInsert(module->functions[index].sig);
- }
+ // Canonicalize signature indices during decoding.
+ table->map.FindOrInsert(func->sig);
}
}
« no previous file with comments | « src/frames.h ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698