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

Unified Diff: src/wasm/wasm-interpreter.cc

Issue 2463063002: [wasm] Fix br_table in the wasm interpreter to use varuint32. (Closed)
Patch Set: Remove unused variable Created 4 years, 1 month 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 | « no previous file | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-interpreter.cc
diff --git a/src/wasm/wasm-interpreter.cc b/src/wasm/wasm-interpreter.cc
index e88832a544a3d4b7ee996fbcb56899f4587d50b9..741298f57a1171b63a0bddea87492d3207466371 100644
--- a/src/wasm/wasm-interpreter.cc
+++ b/src/wasm/wasm-interpreter.cc
@@ -1331,9 +1331,15 @@ class ThreadImpl : public WasmInterpreter::Thread {
}
case kExprBrTable: {
BranchTableOperand operand(&decoder, code->at(pc));
+ BranchTableIterator iterator(&decoder, operand);
uint32_t key = Pop().to<uint32_t>();
+ uint32_t depth = 0;
if (key >= operand.table_count) key = operand.table_count;
- len = key + DoBreak(code, pc + key, operand.table[key]);
+ for (uint32_t i = 0; i <= key; i++) {
+ DCHECK(iterator.has_next());
+ depth = iterator.next();
+ }
+ len = key + DoBreak(code, pc + key, static_cast<size_t>(depth));
TRACE(" br[%u] => @%zu\n", key, pc + key + len);
break;
}
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698