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

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

Issue 2650293003: [wasm] Interpreter: Don't pause on invalid position (Closed)
Patch Set: Rebase Created 3 years, 11 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 | « no previous file | test/cctest/wasm/test-run-wasm-interpreter.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 0c2886e7b1a21de066f2f187b26f576034dfa9df..9a1df93964e07791c11e6515a68d69aafdee81b6 100644
--- a/src/wasm/wasm-interpreter.cc
+++ b/src/wasm/wasm-interpreter.cc
@@ -1183,15 +1183,7 @@ class ThreadImpl {
#define PAUSE_IF_BREAK_FLAG(flag) \
if (V8_UNLIKELY(break_flags_ & WasmInterpreter::BreakFlag::flag)) max = 0;
- if (pc >= limit) {
- // Fell off end of code; do an implicit return.
- TRACE("@%-3zu: ImplicitReturn\n", pc);
- if (!DoReturn(&code, &pc, &limit, code->function->sig->return_count()))
- return;
- decoder.Reset(code->start, code->end);
- PAUSE_IF_BREAK_FLAG(AfterReturn);
- continue;
- }
+ DCHECK_GT(limit, pc);
const char* skip = " ";
int len = 1;
@@ -1635,6 +1627,14 @@ class ThreadImpl {
}
pc += len;
+ if (pc == limit) {
+ // Fell off end of code; do an implicit return.
+ TRACE("@%-3zu: ImplicitReturn\n", pc);
+ if (!DoReturn(&code, &pc, &limit, code->function->sig->return_count()))
+ return;
+ decoder.Reset(code->start, code->end);
+ PAUSE_IF_BREAK_FLAG(AfterReturn);
+ }
}
// Set break_pc_, even though we might have stopped because max was reached.
// We don't want to stop after executing zero instructions next time.
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698