OLD | NEW |
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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 const char* skip = " "; | 1196 const char* skip = " "; |
1197 int len = 1; | 1197 int len = 1; |
1198 byte opcode = code->start[pc]; | 1198 byte opcode = code->start[pc]; |
1199 byte orig = opcode; | 1199 byte orig = opcode; |
1200 if (V8_UNLIKELY(opcode == kInternalBreakpoint)) { | 1200 if (V8_UNLIKELY(opcode == kInternalBreakpoint)) { |
1201 orig = code->orig_start[pc]; | 1201 orig = code->orig_start[pc]; |
1202 if (SkipBreakpoint(code, pc)) { | 1202 if (SkipBreakpoint(code, pc)) { |
1203 // skip breakpoint by switching on original code. | 1203 // skip breakpoint by switching on original code. |
1204 skip = "[skip] "; | 1204 skip = "[skip] "; |
1205 } else { | 1205 } else { |
1206 state_ = WasmInterpreter::PAUSED; | |
1207 TRACE("@%-3zu: [break] %-24s:", pc, | 1206 TRACE("@%-3zu: [break] %-24s:", pc, |
1208 WasmOpcodes::OpcodeName(static_cast<WasmOpcode>(orig))); | 1207 WasmOpcodes::OpcodeName(static_cast<WasmOpcode>(orig))); |
1209 TraceValueStack(); | 1208 TraceValueStack(); |
1210 TRACE("\n"); | 1209 TRACE("\n"); |
1211 break_pc_ = pc; | 1210 break; |
1212 return CommitPc(pc); | |
1213 } | 1211 } |
1214 } | 1212 } |
1215 | 1213 |
1216 USE(skip); | 1214 USE(skip); |
1217 TRACE("@%-3zu: %s%-24s:", pc, skip, | 1215 TRACE("@%-3zu: %s%-24s:", pc, skip, |
1218 WasmOpcodes::OpcodeName(static_cast<WasmOpcode>(orig))); | 1216 WasmOpcodes::OpcodeName(static_cast<WasmOpcode>(orig))); |
1219 TraceValueStack(); | 1217 TraceValueStack(); |
1220 TRACE("\n"); | 1218 TRACE("\n"); |
1221 | 1219 |
1222 switch (orig) { | 1220 switch (orig) { |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 #undef EXECUTE_OTHER_UNOP_NAN | 1629 #undef EXECUTE_OTHER_UNOP_NAN |
1632 | 1630 |
1633 default: | 1631 default: |
1634 V8_Fatal(__FILE__, __LINE__, "Unknown or unimplemented opcode #%d:%s", | 1632 V8_Fatal(__FILE__, __LINE__, "Unknown or unimplemented opcode #%d:%s", |
1635 code->start[pc], OpcodeName(code->start[pc])); | 1633 code->start[pc], OpcodeName(code->start[pc])); |
1636 UNREACHABLE(); | 1634 UNREACHABLE(); |
1637 } | 1635 } |
1638 | 1636 |
1639 pc += len; | 1637 pc += len; |
1640 } | 1638 } |
| 1639 // Set break_pc_, even though we might have stopped because max was reached. |
| 1640 // We don't want to stop after executing zero instructions next time. |
| 1641 break_pc_ = pc; |
1641 state_ = WasmInterpreter::PAUSED; | 1642 state_ = WasmInterpreter::PAUSED; |
1642 CommitPc(pc); | 1643 CommitPc(pc); |
1643 } | 1644 } |
1644 | 1645 |
1645 WasmVal Pop() { | 1646 WasmVal Pop() { |
1646 DCHECK_GT(stack_.size(), 0); | 1647 DCHECK_GT(stack_.size(), 0); |
1647 DCHECK_GT(frames_.size(), 0); | 1648 DCHECK_GT(frames_.size(), 0); |
1648 DCHECK_GT(stack_.size(), frames_.back().llimit()); // can't pop into locals | 1649 DCHECK_GT(stack_.size(), frames_.back().llimit()); // can't pop into locals |
1649 WasmVal val = stack_.back(); | 1650 WasmVal val = stack_.back(); |
1650 stack_.pop_back(); | 1651 stack_.pop_back(); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1921 return none; | 1922 return none; |
1922 } | 1923 } |
1923 | 1924 |
1924 void InterpretedFrame::SetLocalVal(int index, WasmVal val) { UNIMPLEMENTED(); } | 1925 void InterpretedFrame::SetLocalVal(int index, WasmVal val) { UNIMPLEMENTED(); } |
1925 | 1926 |
1926 void InterpretedFrame::SetExprVal(int pc, WasmVal val) { UNIMPLEMENTED(); } | 1927 void InterpretedFrame::SetExprVal(int pc, WasmVal val) { UNIMPLEMENTED(); } |
1927 | 1928 |
1928 } // namespace wasm | 1929 } // namespace wasm |
1929 } // namespace internal | 1930 } // namespace internal |
1930 } // namespace v8 | 1931 } // namespace v8 |
OLD | NEW |