5 #ifndef V8_WASM_WASM_INTERPRETER_H_ 6 #define V8_WASM_WASM_INTERPRETER_H_ 8 #include "src/wasm/wasm-opcodes.h" 9 #include "src/wasm/wasm-value.h" 10 #include "src/zone/zone-containers.h" 15 class WasmInstanceObject;
20 struct ModuleWireBytes;
23 class WasmInterpreterInternals;
27 using pcdiff_t = int32_t;
30 constexpr pc_t kInvalidPc = 0x80000000;
64 int GetParameterCount()
const;
65 int GetLocalCount()
const;
66 int GetStackHeight()
const;
96 enum State { STOPPED, RUNNING, PAUSED, FINISHED, TRAPPED };
99 enum BreakFlag : uint8_t {
101 AfterReturn = 1 << 0,
105 using FramePtr = std::unique_ptr<InterpretedFrame, InterpretedFrameDeleter>;
114 enum ExceptionHandlingResult { HANDLED, UNWOUND };
120 State Run(
int num_steps = -1);
121 State Step() {
return Run(1); }
126 ExceptionHandlingResult HandleException(
Isolate* isolate);
129 pc_t GetBreakpointPc();
133 FramePtr GetFrame(
int index);
135 TrapReason GetTrapReason();
140 bool PossibleNondeterminism();
143 uint64_t NumInterpretedCalls();
150 void AddBreakFlags(uint8_t flags);
151 void ClearBreakFlags();
160 void FinishActivation(
uint32_t activation_id);
185 bool SetTracing(
const WasmFunction*
function,
bool enabled);
190 int GetThreadCount();
191 Thread* GetThread(
int id);
198 void AddFunctionForTesting(
const WasmFunction*
function);
200 void SetFunctionCodeForTesting(
const WasmFunction*
function,
201 const byte* start,
const byte* end);
202 void SetCallIndirectTestMode();
207 Zone* zone,
const WasmModule* module,
const byte* start,
const byte* end);
218 #endif // V8_WASM_WASM_INTERPRETER_H_