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 #ifndef V8_WASM_INTERPRETER_H_ | 5 #ifndef V8_WASM_INTERPRETER_H_ |
6 #define V8_WASM_INTERPRETER_H_ | 6 #define V8_WASM_INTERPRETER_H_ |
7 | 7 |
8 #include "src/wasm/wasm-opcodes.h" | 8 #include "src/wasm/wasm-opcodes.h" |
9 #include "src/zone/zone-containers.h" | 9 #include "src/zone/zone-containers.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace base { | 12 namespace base { |
13 class AccountingAllocator; | 13 class AccountingAllocator; |
14 } | 14 } |
15 | 15 |
16 namespace internal { | 16 namespace internal { |
17 namespace wasm { | 17 namespace wasm { |
18 | 18 |
19 // forward declarations. | 19 // forward declarations. |
| 20 struct ModuleBytesEnv; |
20 struct WasmFunction; | 21 struct WasmFunction; |
21 struct WasmInstance; | |
22 class WasmInterpreterInternals; | 22 class WasmInterpreterInternals; |
23 | 23 |
24 typedef size_t pc_t; | 24 typedef size_t pc_t; |
25 typedef size_t sp_t; | 25 typedef size_t sp_t; |
26 typedef int32_t pcdiff_t; | 26 typedef int32_t pcdiff_t; |
27 typedef uint32_t spdiff_t; | 27 typedef uint32_t spdiff_t; |
28 | 28 |
29 const pc_t kInvalidPc = 0x80000000; | 29 const pc_t kInvalidPc = 0x80000000; |
30 | 30 |
31 typedef ZoneMap<pc_t, pcdiff_t> ControlTransferMap; | 31 typedef ZoneMap<pc_t, pcdiff_t> ControlTransferMap; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Returns true if the thread executed an instruction which may produce | 128 // Returns true if the thread executed an instruction which may produce |
129 // nondeterministic results, e.g. float div, float sqrt, and float mul, | 129 // nondeterministic results, e.g. float div, float sqrt, and float mul, |
130 // where the sign bit of a NaN is nondeterministic. | 130 // where the sign bit of a NaN is nondeterministic. |
131 virtual bool PossibleNondeterminism() = 0; | 131 virtual bool PossibleNondeterminism() = 0; |
132 | 132 |
133 // Thread-specific breakpoints. | 133 // Thread-specific breakpoints. |
134 bool SetBreakpoint(const WasmFunction* function, int pc, bool enabled); | 134 bool SetBreakpoint(const WasmFunction* function, int pc, bool enabled); |
135 bool GetBreakpoint(const WasmFunction* function, int pc); | 135 bool GetBreakpoint(const WasmFunction* function, int pc); |
136 }; | 136 }; |
137 | 137 |
138 WasmInterpreter(WasmInstance* instance, AccountingAllocator* allocator); | 138 WasmInterpreter(const ModuleBytesEnv& env, AccountingAllocator* allocator); |
139 ~WasmInterpreter(); | 139 ~WasmInterpreter(); |
140 | 140 |
141 //========================================================================== | 141 //========================================================================== |
142 // Execution controls. | 142 // Execution controls. |
143 //========================================================================== | 143 //========================================================================== |
144 void Run(); | 144 void Run(); |
145 void Pause(); | 145 void Pause(); |
146 | 146 |
147 // Set a breakpoint at {pc} in {function} to be {enabled}. Returns the | 147 // Set a breakpoint at {pc} in {function} to be {enabled}. Returns the |
148 // previous state of the breakpoint at {pc}. | 148 // previous state of the breakpoint at {pc}. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 private: | 194 private: |
195 Zone zone_; | 195 Zone zone_; |
196 WasmInterpreterInternals* internals_; | 196 WasmInterpreterInternals* internals_; |
197 }; | 197 }; |
198 | 198 |
199 } // namespace wasm | 199 } // namespace wasm |
200 } // namespace internal | 200 } // namespace internal |
201 } // namespace v8 | 201 } // namespace v8 |
202 | 202 |
203 #endif // V8_WASM_INTERPRETER_H_ | 203 #endif // V8_WASM_INTERPRETER_H_ |
OLD | NEW |