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

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

Issue 2639013002: [wasm] Use pimpl idiom for interpreter thread implementation (Closed)
Patch Set: Fix android and windows compile errors 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 | src/wasm/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.h
diff --git a/src/wasm/wasm-interpreter.h b/src/wasm/wasm-interpreter.h
index f4adf378efc1bf30edbc3c40b03ca827efd59ab9..ef74e5b32fb0e874a1c26a52420f7c9f324e5903 100644
--- a/src/wasm/wasm-interpreter.h
+++ b/src/wasm/wasm-interpreter.h
@@ -79,7 +79,12 @@ inline void WasmVal::to() {
class WasmFrame {
public:
const WasmFunction* function() const { return function_; }
- int pc() const { return pc_; }
+ int pc() const {
+ // TODO(wasm): Remove USE once we actually use them.
+ USE(fp_);
+ USE(sp_);
+ return pc_;
+ }
private:
friend class WasmInterpreter;
@@ -108,31 +113,36 @@ class V8_EXPORT_PRIVATE WasmInterpreter {
enum State { STOPPED, RUNNING, PAUSED, FINISHED, TRAPPED };
// Representation of a thread in the interpreter.
- class Thread {
+ class ThreadImpl;
+ class V8_EXPORT_PRIVATE Thread {
+ ThreadImpl* impl_;
+
public:
+ explicit Thread(ThreadImpl*);
+
// Execution control.
- virtual State state() = 0;
- virtual void PushFrame(const WasmFunction* function, WasmVal* args) = 0;
- virtual State Run() = 0;
- virtual State Step() = 0;
- virtual void Pause() = 0;
- virtual void Reset() = 0;
- virtual ~Thread() {}
+ State state();
+ void PushFrame(const WasmFunction* function, WasmVal* args);
+ State Run();
+ State Step();
+ void Pause();
+ void Reset();
// Stack inspection and modification.
- virtual pc_t GetBreakpointPc() = 0;
- virtual int GetFrameCount() = 0;
- virtual const WasmFrame* GetFrame(int index) = 0;
- virtual WasmFrame* GetMutableFrame(int index) = 0;
- virtual WasmVal GetReturnValue(int index = 0) = 0;
+ pc_t GetBreakpointPc();
+ int GetFrameCount();
+ const WasmFrame* GetFrame(int index);
+ WasmFrame* GetMutableFrame(int index);
+ WasmVal GetReturnValue(int index = 0);
// Returns true if the thread executed an instruction which may produce
// nondeterministic results, e.g. float div, float sqrt, and float mul,
// where the sign bit of a NaN is nondeterministic.
- virtual bool PossibleNondeterminism() = 0;
+ bool PossibleNondeterminism();
// Thread-specific breakpoints.
- bool SetBreakpoint(const WasmFunction* function, int pc, bool enabled);
- bool GetBreakpoint(const WasmFunction* function, int pc);
+ // TODO(wasm): Implement this once we support multiple threads.
+ // bool SetBreakpoint(const WasmFunction* function, int pc, bool enabled);
+ // bool GetBreakpoint(const WasmFunction* function, int pc);
};
WasmInterpreter(const ModuleBytesEnv& env, AccountingAllocator* allocator);
« no previous file with comments | « no previous file | src/wasm/wasm-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698