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

Unified Diff: src/debug/debug.cc

Issue 1818873003: [Interpreter] Adds support to fetch return value on break at return. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed the bugs in earlier implementation. Changed full-codegen to match ignition for fetching the r… Created 4 years, 9 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/debug/debug.cc
diff --git a/src/debug/debug.cc b/src/debug/debug.cc
index b255bb81a1dd80db2b46599382491d05d74a2b99..c8bd707d31c5106d6a14b86f71cf239f78c59f58 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -474,6 +474,7 @@ void Debug::ThreadInit() {
thread_local_.last_fp_ = 0;
thread_local_.target_fp_ = 0;
thread_local_.step_in_enabled_ = false;
+ thread_local_.return_value_ = Handle<Object>();
// TODO(isolates): frames_are_dropped_?
base::NoBarrier_Store(&thread_local_.current_debug_scope_,
static_cast<base::AtomicWord>(0));
@@ -563,7 +564,11 @@ void Debug::Unload() {
void Debug::Break(Arguments args, JavaScriptFrame* frame) {
HandleScope scope(isolate_);
- DCHECK(args.length() == 0);
+ DCHECK(args.length() == 1);
+
+ // args[0] contains the return value (eax/rax/r0/accumulator) if we break
+ // on return.
+ thread_local_.return_value_ = args.at<Object>(0);
Yang 2016/03/22 12:22:57 Please introduce a method to set and retrieve the
// Initialize LiveEdit.
LiveEdit::InitializeThreadLocal(this);
@@ -1586,7 +1591,7 @@ Object* Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
// Continue just after the slot.
after_break_target_ = frame->pc();
}
- return isolate_->heap()->undefined_value();
+ return *thread_local_.return_value_;
mythria 2016/03/21 16:24:29 Returns the actual return value to avoid pushing a
Yang 2016/03/22 12:22:58 I forgot about this part. For the interpreter, the
mythria 2016/03/22 15:11:44 Done.
}
}
@@ -2327,9 +2332,10 @@ DebugScope::DebugScope(Debug* debug)
base::NoBarrier_Store(&debug_->thread_local_.current_debug_scope_,
reinterpret_cast<base::AtomicWord>(this));
- // Store the previous break id and frame id.
+ // Store the previous break id, frame id and return value.
break_id_ = debug_->break_id();
break_frame_id_ = debug_->break_frame_id();
+ return_value_ = debug_->get_return_value();
// Create the new break info. If there is no JavaScript frames there is no
// break frame id.
@@ -2367,6 +2373,7 @@ DebugScope::~DebugScope() {
// Restore to the previous break state.
debug_->thread_local_.break_frame_id_ = break_frame_id_;
debug_->thread_local_.break_id_ = break_id_;
+ debug_->thread_local_.return_value_ = return_value_;
debug_->UpdateState();
}

Powered by Google App Engine
This is Rietveld 408576698