OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/debug/debug.h" | 5 #include "src/debug/debug.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 | 993 |
994 // Get the debug info (create it if it does not exist). | 994 // Get the debug info (create it if it does not exist). |
995 auto summary = FrameSummary::GetTop(frame).AsJavaScript(); | 995 auto summary = FrameSummary::GetTop(frame).AsJavaScript(); |
996 Handle<JSFunction> function(summary.function()); | 996 Handle<JSFunction> function(summary.function()); |
997 Handle<SharedFunctionInfo> shared(function->shared()); | 997 Handle<SharedFunctionInfo> shared(function->shared()); |
998 if (!EnsureDebugInfo(shared)) return; | 998 if (!EnsureDebugInfo(shared)) return; |
999 Handle<DebugInfo> debug_info(shared->GetDebugInfo()); | 999 Handle<DebugInfo> debug_info(shared->GetDebugInfo()); |
1000 | 1000 |
1001 BreakLocation location = BreakLocation::FromFrame(debug_info, js_frame); | 1001 BreakLocation location = BreakLocation::FromFrame(debug_info, js_frame); |
1002 | 1002 |
| 1003 // It is used at least in two cases: |
| 1004 // - step-next at return position from first callback in microtask will break |
| 1005 // in next callback, |
| 1006 // - step-next at return position when caller frame is blackboxed will break |
| 1007 // in next not blackboxed function called by caller frame if any. |
| 1008 // TODO(kozyatinskiy): remove it. |
| 1009 if (step_action == StepNext && location.IsReturn()) { |
| 1010 thread_local_.last_step_action_ = StepIn; |
| 1011 UpdateHookOnFunctionCall(); |
| 1012 } |
| 1013 |
1003 // Any step at a return is a step-out. | 1014 // Any step at a return is a step-out. |
1004 if (location.IsReturn()) step_action = StepOut; | 1015 if (location.IsReturn()) step_action = StepOut; |
1005 // A step-next at a tail call is a step-out. | 1016 // A step-next at a tail call is a step-out. |
1006 if (location.IsTailCall() && step_action == StepNext) step_action = StepOut; | 1017 if (location.IsTailCall() && step_action == StepNext) step_action = StepOut; |
1007 // A step-next in blackboxed function is a step-out. | 1018 // A step-next in blackboxed function is a step-out. |
1008 if (step_action == StepNext && IsBlackboxed(shared)) step_action = StepOut; | 1019 if (step_action == StepNext && IsBlackboxed(shared)) step_action = StepOut; |
1009 | 1020 |
1010 thread_local_.last_statement_position_ = | 1021 thread_local_.last_statement_position_ = |
1011 summary.abstract_code()->SourceStatementPosition(summary.code_offset()); | 1022 summary.abstract_code()->SourceStatementPosition(summary.code_offset()); |
1012 int current_frame_count = CurrentFrameCount(); | 1023 int current_frame_count = CurrentFrameCount(); |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 if (uncaught) { | 1770 if (uncaught) { |
1760 // Uncaught exceptions are reported by either flags. | 1771 // Uncaught exceptions are reported by either flags. |
1761 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; | 1772 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; |
1762 } else { | 1773 } else { |
1763 // Caught exceptions are reported is activated. | 1774 // Caught exceptions are reported is activated. |
1764 if (!break_on_exception_) return; | 1775 if (!break_on_exception_) return; |
1765 } | 1776 } |
1766 | 1777 |
1767 { | 1778 { |
1768 JavaScriptFrameIterator it(isolate_); | 1779 JavaScriptFrameIterator it(isolate_); |
1769 // Check whether the top frame is blackboxed or the break location is muted. | 1780 // Check whether the top frame is blackboxed or the break location is muted |
1770 if (!it.done() && (IsMutedAtCurrentLocation(it.frame()) || | 1781 // or current JS stack trace is empty. |
1771 IsExceptionBlackboxed(uncaught))) { | 1782 if (it.done() || IsMutedAtCurrentLocation(it.frame()) || |
| 1783 IsExceptionBlackboxed(uncaught)) { |
1772 return; | 1784 return; |
1773 } | 1785 } |
1774 } | 1786 } |
1775 | 1787 |
1776 DebugScope debug_scope(this); | 1788 DebugScope debug_scope(this); |
1777 if (debug_scope.failed()) return; | 1789 if (debug_scope.failed()) return; |
1778 | 1790 |
1779 if (debug_delegate_) { | 1791 if (debug_delegate_) { |
1780 HandleScope scope(isolate_); | 1792 HandleScope scope(isolate_); |
1781 | 1793 |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 return v8::Utils::ToLocal(callback_data_); | 2408 return v8::Utils::ToLocal(callback_data_); |
2397 } | 2409 } |
2398 | 2410 |
2399 | 2411 |
2400 v8::Isolate* EventDetailsImpl::GetIsolate() const { | 2412 v8::Isolate* EventDetailsImpl::GetIsolate() const { |
2401 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); | 2413 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); |
2402 } | 2414 } |
2403 | 2415 |
2404 } // namespace internal | 2416 } // namespace internal |
2405 } // namespace v8 | 2417 } // namespace v8 |
OLD | NEW |