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

Side by Side Diff: src/wasm/wasm-interpreter.cc

Issue 2650293003: [wasm] Interpreter: Don't pause on invalid position (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm-interpreter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/wasm/wasm-interpreter.h" 5 #include "src/wasm/wasm-interpreter.h"
6 6
7 #include "src/utils.h" 7 #include "src/utils.h"
8 #include "src/wasm/decoder.h" 8 #include "src/wasm/decoder.h"
9 #include "src/wasm/function-body-decoder.h" 9 #include "src/wasm/function-body-decoder.h"
10 #include "src/wasm/wasm-external-refs.h" 10 #include "src/wasm/wasm-external-refs.h"
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 size_t pop_count = stack_.size() - dest - arity; 1172 size_t pop_count = stack_.size() - dest - arity;
1173 for (size_t i = 0; i < arity; i++) { 1173 for (size_t i = 0; i < arity; i++) {
1174 stack_[dest + i] = stack_[dest + pop_count + i]; 1174 stack_[dest + i] = stack_[dest + pop_count + i];
1175 } 1175 }
1176 stack_.resize(stack_.size() - pop_count); 1176 stack_.resize(stack_.size() - pop_count);
1177 } 1177 }
1178 1178
1179 void Execute(InterpreterCode* code, pc_t pc, int max) { 1179 void Execute(InterpreterCode* code, pc_t pc, int max) {
1180 Decoder decoder(code->start, code->end); 1180 Decoder decoder(code->start, code->end);
1181 pc_t limit = code->end - code->start; 1181 pc_t limit = code->end - code->start;
1182 while (--max >= 0) { 1182 while (pc >= limit || --max >= 0) {
titzer 2017/01/25 12:25:06 Hmm, that's weird. Why are we checking that the pc
Clemens Hammacher 2017/01/25 12:33:33 To run into the if 4 lines below. I can also make
1183 #define PAUSE_IF_BREAK_FLAG(flag) \ 1183 #define PAUSE_IF_BREAK_FLAG(flag) \
1184 if (V8_UNLIKELY(break_flags_ & WasmInterpreter::BreakFlag::flag)) max = 0; 1184 if (V8_UNLIKELY(break_flags_ & WasmInterpreter::BreakFlag::flag)) max = 0;
1185 1185
1186 if (pc >= limit) { 1186 if (pc >= limit) {
1187 DCHECK_EQ(pc, limit);
1187 // Fell off end of code; do an implicit return. 1188 // Fell off end of code; do an implicit return.
1188 TRACE("@%-3zu: ImplicitReturn\n", pc); 1189 TRACE("@%-3zu: ImplicitReturn\n", pc);
1189 if (!DoReturn(&code, &pc, &limit, code->function->sig->return_count())) 1190 if (!DoReturn(&code, &pc, &limit, code->function->sig->return_count()))
1190 return; 1191 return;
1191 decoder.Reset(code->start, code->end); 1192 decoder.Reset(code->start, code->end);
1192 PAUSE_IF_BREAK_FLAG(AfterReturn); 1193 PAUSE_IF_BREAK_FLAG(AfterReturn);
1193 continue; 1194 continue;
1194 } 1195 }
1195 1196
1196 const char* skip = " "; 1197 const char* skip = " ";
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 return none; 1923 return none;
1923 } 1924 }
1924 1925
1925 void InterpretedFrame::SetLocalVal(int index, WasmVal val) { UNIMPLEMENTED(); } 1926 void InterpretedFrame::SetLocalVal(int index, WasmVal val) { UNIMPLEMENTED(); }
1926 1927
1927 void InterpretedFrame::SetExprVal(int pc, WasmVal val) { UNIMPLEMENTED(); } 1928 void InterpretedFrame::SetExprVal(int pc, WasmVal val) { UNIMPLEMENTED(); }
1928 1929
1929 } // namespace wasm 1930 } // namespace wasm
1930 } // namespace internal 1931 } // namespace internal
1931 } // namespace v8 1932 } // namespace v8
OLDNEW
« 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