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

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

Issue 2629823003: [wasm] Implement frame inspection for interpreted frames (Closed)
Patch Set: Document that the forward declaration is only needed for VS 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
Index: src/wasm/wasm-interpreter.cc
diff --git a/src/wasm/wasm-interpreter.cc b/src/wasm/wasm-interpreter.cc
index aa0884c50c2644c9f9d2d57e147eea0019cd6d2b..8709c0925b94686f67ec2f3a06c97d1642a297d4 100644
--- a/src/wasm/wasm-interpreter.cc
+++ b/src/wasm/wasm-interpreter.cc
@@ -1034,16 +1034,25 @@ class ThreadImpl : public WasmInterpreter::Thread {
possible_nondeterminism_ = false;
}
- virtual int GetFrameCount() { return static_cast<int>(frames_.size()); }
+ virtual int GetFrameCount() {
+ DCHECK_GE(kMaxInt, frames_.size());
+ return static_cast<int>(frames_.size());
+ }
- virtual const WasmFrame* GetFrame(int index) {
- UNIMPLEMENTED();
- return nullptr;
+ virtual const InterpretedFrame GetFrame(int index) {
+ return GetMutableFrame(index);
}
- virtual WasmFrame* GetMutableFrame(int index) {
- UNIMPLEMENTED();
- return nullptr;
+ virtual InterpretedFrame GetMutableFrame(int index) {
+ DCHECK_LE(0, index);
+ DCHECK_GT(frames_.size(), index);
+ Frame* fr = &frames_[index];
titzer 2017/01/16 10:18:25 Might as well spell out {frame} or call it {f}.
Clemens Hammacher 2017/01/16 11:53:26 Done. It's {frame} now.
+ DCHECK_GE(kMaxInt, fr->ret_pc);
+ DCHECK_GE(kMaxInt, fr->sp);
+ DCHECK_GE(kMaxInt, fr->llimit());
+ return InterpretedFrame(fr->code->function, static_cast<int>(fr->ret_pc),
+ static_cast<int>(fr->sp),
+ static_cast<int>(fr->llimit()));
}
virtual WasmVal GetReturnValue(int index) {
@@ -1837,29 +1846,6 @@ WasmInterpreter::Thread* WasmInterpreter::GetThread(int id) {
return internals_->threads_[id];
}
-WasmVal WasmInterpreter::GetLocalVal(const WasmFrame* frame, int index) {
- CHECK_GE(index, 0);
- UNIMPLEMENTED();
- WasmVal none;
- none.type = kWasmStmt;
- return none;
-}
-
-WasmVal WasmInterpreter::GetExprVal(const WasmFrame* frame, int pc) {
- UNIMPLEMENTED();
- WasmVal none;
- none.type = kWasmStmt;
- return none;
-}
-
-void WasmInterpreter::SetLocalVal(WasmFrame* frame, int index, WasmVal val) {
- UNIMPLEMENTED();
-}
-
-void WasmInterpreter::SetExprVal(WasmFrame* frame, int pc, WasmVal val) {
- UNIMPLEMENTED();
-}
-
size_t WasmInterpreter::GetMemorySize() {
return internals_->instance_->mem_size;
}
@@ -1889,6 +1875,33 @@ ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting(
return targets.map_;
}
+//============================================================================
+// Implementation of the frame inspection interface.
+//============================================================================
+int InterpretedFrame::GetParameterCount() const {
+ UNIMPLEMENTED();
+ return 0;
+}
+
+WasmVal InterpretedFrame::GetLocalVal(int index) const {
+ CHECK_GE(index, 0);
+ UNIMPLEMENTED();
+ WasmVal none;
+ none.type = kWasmStmt;
+ return none;
+}
+
+WasmVal InterpretedFrame::GetExprVal(int pc) const {
+ UNIMPLEMENTED();
+ WasmVal none;
+ none.type = kWasmStmt;
+ return none;
+}
+
+void InterpretedFrame::SetLocalVal(int index, WasmVal val) { UNIMPLEMENTED(); }
+
+void InterpretedFrame::SetExprVal(int pc, WasmVal val) { UNIMPLEMENTED(); }
+
} // namespace wasm
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698