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

Unified Diff: src/debug/debug.cc

Issue 2068603002: [debugger] simplify debug stepping. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove declaration Created 4 years, 6 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 214d72e7c27abd486a994b5f33b7f7149d29071a..0b7b8421f1fc9bcfa25fb2c3c06c7eeef0090735 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -477,7 +477,6 @@ void Debug::ThreadInit() {
thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
thread_local_.last_fp_ = 0;
thread_local_.target_fp_ = 0;
- thread_local_.step_in_enabled_ = false;
thread_local_.return_value_ = Handle<Object>();
clear_suspended_generator();
// TODO(isolates): frames_are_dropped_?
@@ -935,9 +934,7 @@ void Debug::PrepareStepIn(Handle<JSFunction> function) {
if (!is_active()) return;
if (last_step_action() < StepIn) return;
if (in_debug_scope()) return;
- if (thread_local_.step_in_enabled_) {
- FloodWithOneShot(function);
- }
+ FloodWithOneShot(function);
}
void Debug::PrepareStepInSuspendedGenerator() {
@@ -945,7 +942,6 @@ void Debug::PrepareStepInSuspendedGenerator() {
if (in_debug_scope()) return;
DCHECK(has_suspended_generator());
thread_local_.last_step_action_ = StepIn;
- thread_local_.step_in_enabled_ = true;
Handle<JSFunction> function(
JSGeneratorObject::cast(thread_local_.suspended_generator_)->function());
FloodWithOneShot(function);
@@ -1005,10 +1001,7 @@ void Debug::PrepareStep(StepAction step_action) {
feature_tracker()->Track(DebugFeatureTracker::kStepping);
- // Remember this step action and count.
thread_local_.last_step_action_ = step_action;
- STATIC_ASSERT(StepFrame > StepIn);
- thread_local_.step_in_enabled_ = (step_action >= StepIn);
// If the function on the top frame is unresolved perform step out. This will
// be the case when calling unknown function and having the debugger stopped
@@ -1043,10 +1036,11 @@ void Debug::PrepareStep(StepAction step_action) {
BreakLocation location =
BreakLocation::FromCodeOffset(debug_info, call_offset);
- // Any step at a return is a step-out.
- if (location.IsReturn()) step_action = StepOut;
- // A step-next at a tail call is a step-out.
- if (location.IsTailCall() && step_action == StepNext) step_action = StepOut;
+ // Any step at a return or a step-next at a tail call is a step-out.
+ if (location.IsReturn() ||
+ (location.IsTailCall() && thread_local_.last_step_action_ == StepNext)) {
+ thread_local_.last_step_action_ = StepOut;
+ }
thread_local_.last_statement_position_ =
debug_info->abstract_code()->SourceStatementPosition(
@@ -1055,7 +1049,7 @@ void Debug::PrepareStep(StepAction step_action) {
// No longer perform the current async step.
clear_suspended_generator();
- switch (step_action) {
+ switch (thread_local_.last_step_action_) {
case StepNone:
UNREACHABLE();
break;
@@ -1070,11 +1064,7 @@ void Debug::PrepareStep(StepAction step_action) {
Deoptimizer::DeoptimizeFunction(frames_it.frame()->function());
frames_it.Advance();
}
- if (frames_it.done()) {
- // Stepping out to the embedder. Disable step-in to avoid stepping into
- // the next (unrelated) call that the embedder makes.
- thread_local_.step_in_enabled_ = false;
- } else {
+ if (!frames_it.done()) {
// Fill the caller function to return to with one-shot break points.
Handle<JSFunction> caller_function(frames_it.frame()->function());
FloodWithOneShot(caller_function);
@@ -1142,7 +1132,6 @@ void Debug::ClearStepping() {
ClearOneShot();
thread_local_.last_step_action_ = StepNone;
- thread_local_.step_in_enabled_ = false;
thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
thread_local_.last_fp_ = 0;
thread_local_.target_fp_ = 0;
@@ -1167,12 +1156,6 @@ void Debug::ClearOneShot() {
}
-void Debug::EnableStepIn() {
- STATIC_ASSERT(StepFrame > StepIn);
- thread_local_.step_in_enabled_ = (last_step_action() >= StepIn);
-}
-
-
bool MatchingCodeTargets(Code* target1, Code* target2) {
if (target1 == target2) return true;
if (target1->kind() != target2->kind()) return false;
« no previous file with comments | « src/debug/debug.h ('k') | src/external-reference-table.cc » ('j') | src/x87/builtins-x87.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698