Index: src/debug/debug.cc |
diff --git a/src/debug/debug.cc b/src/debug/debug.cc |
index 8c85e4b2497f66317f7152ed786b977056d76557..3e344efb6149ba4565b62196fb50d011791845eb 100644 |
--- a/src/debug/debug.cc |
+++ b/src/debug/debug.cc |
@@ -386,6 +386,7 @@ void Debug::ThreadInit() { |
thread_local_.break_count_ = 0; |
thread_local_.break_id_ = 0; |
thread_local_.break_frame_id_ = StackFrame::NO_ID; |
+ thread_local_.last_step_frame_id_ = StackFrame::NO_ID; |
thread_local_.last_step_action_ = StepNone; |
thread_local_.last_statement_position_ = kNoSourcePosition; |
thread_local_.last_frame_count_ = -1; |
@@ -876,10 +877,22 @@ MaybeHandle<FixedArray> Debug::GetHitBreakPointObjects( |
} |
void Debug::PrepareStepIn(Handle<JSFunction> function) { |
- CHECK(last_step_action() >= StepIn); |
+ CHECK(last_step_action() != StepNone); |
if (ignore_events()) return; |
if (in_debug_scope()) return; |
if (break_disabled()) return; |
+ if (last_step_action() == StepIn) { |
+ FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared(), isolate_)); |
+ } |
+ if (thread_local_.last_step_frame_id_ == StackFrame::NO_ID) return; |
+ if (last_step_action() == StepOut || last_step_action() == StepNext) { |
+ int count = 0; |
+ for (StackTraceFrameIterator it(isolate_); !it.done(); it.Advance()) { |
+ if (it.frame()->id() == thread_local_.last_step_frame_id_) return; |
+ ++count; |
+ } |
+ thread_local_.target_frame_count_ = count + 1; |
+ } |
FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared(), isolate_)); |
} |
@@ -990,6 +1003,10 @@ void Debug::PrepareStep(StepAction step_action) { |
StackTraceFrameIterator frames_it(isolate_, frame_id); |
StandardFrame* frame = frames_it.frame(); |
+ if (step_action == StepOut || step_action == StepNext) { |
+ thread_local_.last_step_frame_id_ = frame->id(); |
+ } |
+ |
// Handle stepping in wasm functions via the wasm interpreter. |
if (frame->is_wasm()) { |
// If the top frame is compiled, we cannot step. |
@@ -1124,6 +1141,7 @@ void Debug::ClearStepping() { |
thread_local_.last_step_action_ = StepNone; |
thread_local_.last_statement_position_ = kNoSourcePosition; |
+ thread_local_.last_step_frame_id_ = StackFrame::NO_ID; |
thread_local_.last_frame_count_ = -1; |
thread_local_.target_frame_count_ = -1; |
UpdateHookOnFunctionCall(); |
@@ -2109,7 +2127,7 @@ void Debug::UpdateState() { |
void Debug::UpdateHookOnFunctionCall() { |
STATIC_ASSERT(LastStepAction == StepIn); |
- hook_on_function_call_ = thread_local_.last_step_action_ == StepIn || |
+ hook_on_function_call_ = thread_local_.last_step_action_ != StepNone || |
isolate_->needs_side_effect_check(); |
} |