Chromium Code Reviews| 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 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1020 Handle<JSFunction> function(summary.function()); | 1020 Handle<JSFunction> function(summary.function()); |
| 1021 Handle<SharedFunctionInfo> shared(function->shared()); | 1021 Handle<SharedFunctionInfo> shared(function->shared()); |
| 1022 if (!EnsureDebugInfo(shared, function)) { | 1022 if (!EnsureDebugInfo(shared, function)) { |
| 1023 // Return if ensuring debug info failed. | 1023 // Return if ensuring debug info failed. |
| 1024 return; | 1024 return; |
| 1025 } | 1025 } |
| 1026 | 1026 |
| 1027 Handle<DebugInfo> debug_info(shared->GetDebugInfo()); | 1027 Handle<DebugInfo> debug_info(shared->GetDebugInfo()); |
| 1028 BreakLocation location = BreakLocation::FromFrame(debug_info, js_frame); | 1028 BreakLocation location = BreakLocation::FromFrame(debug_info, js_frame); |
| 1029 | 1029 |
| 1030 // It is used at least in two cases: | |
| 1031 // - step-next at return position from first callback in microtask will break | |
| 1032 // in next callback, | |
| 1033 // - step-next at return position when caller frame is blackboxed will break | |
| 1034 // in next not blackboxed function called by caller frame if any. | |
| 1035 if (step_action == StepNext && location.IsReturn()) { | |
|
kozy
2017/02/01 07:29:43
Yang, WDYT about this part? This code is just move
Yang
2017/02/01 07:46:12
for the microtask case, we should make a check at
kozy
2017/02/02 06:58:56
I think that case with blackboxed code could be co
Yang
2017/02/02 12:10:49
You are right. Step-in at the return position to i
| |
| 1036 thread_local_.last_step_action_ = StepIn; | |
| 1037 UpdateHookOnFunctionCall(); | |
| 1038 } | |
| 1030 // Any step at a return is a step-out. | 1039 // Any step at a return is a step-out. |
| 1031 if (location.IsReturn()) step_action = StepOut; | 1040 if (location.IsReturn()) step_action = StepOut; |
| 1032 // A step-next at a tail call is a step-out. | 1041 // A step-next at a tail call is a step-out. |
| 1033 if (location.IsTailCall() && step_action == StepNext) step_action = StepOut; | 1042 if (location.IsTailCall() && step_action == StepNext) step_action = StepOut; |
| 1034 // A step-next in blackboxed function is a step-out. | 1043 // A step-next in blackboxed function is a step-out. |
| 1035 if (step_action == StepNext && IsBlackboxed(shared)) step_action = StepOut; | 1044 if (step_action == StepNext && IsBlackboxed(shared)) step_action = StepOut; |
| 1036 | 1045 |
| 1037 thread_local_.last_statement_position_ = | 1046 thread_local_.last_statement_position_ = |
| 1038 summary.abstract_code()->SourceStatementPosition(summary.code_offset()); | 1047 summary.abstract_code()->SourceStatementPosition(summary.code_offset()); |
| 1039 thread_local_.last_fp_ = frame->UnpaddedFP(); | 1048 thread_local_.last_fp_ = frame->UnpaddedFP(); |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1813 return; | 1822 return; |
| 1814 } | 1823 } |
| 1815 } | 1824 } |
| 1816 | 1825 |
| 1817 DebugScope debug_scope(this); | 1826 DebugScope debug_scope(this); |
| 1818 if (debug_scope.failed()) return; | 1827 if (debug_scope.failed()) return; |
| 1819 | 1828 |
| 1820 if (debug_delegate_) { | 1829 if (debug_delegate_) { |
| 1821 HandleScope scope(isolate_); | 1830 HandleScope scope(isolate_); |
| 1822 | 1831 |
| 1832 { | |
| 1833 // Exception from JavaScript should always contains at least one frame. | |
| 1834 JavaScriptFrameIterator it(isolate_); | |
| 1835 DCHECK(!it.done()); | |
| 1836 if (it.done()) return; | |
|
kozy
2017/02/01 07:29:43
Yang, do you know when we can have empty stack her
Yang
2017/02/01 07:46:12
might be possible, e.g. if we call directly into a
kozy
2017/02/02 06:58:55
Done.
| |
| 1837 } | |
| 1838 | |
| 1823 // Create the execution state. | 1839 // Create the execution state. |
| 1824 Handle<Object> exec_state; | 1840 Handle<Object> exec_state; |
| 1825 // Bail out and don't call debugger if exception. | 1841 // Bail out and don't call debugger if exception. |
| 1826 if (!MakeExecutionState().ToHandle(&exec_state)) return; | 1842 if (!MakeExecutionState().ToHandle(&exec_state)) return; |
| 1827 | 1843 |
| 1828 debug_delegate_->ExceptionThrown( | 1844 debug_delegate_->ExceptionThrown( |
| 1829 GetDebugEventContext(isolate_), | 1845 GetDebugEventContext(isolate_), |
| 1830 v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state)), | 1846 v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state)), |
| 1831 v8::Utils::ToLocal(exception), promise->IsJSObject(), uncaught); | 1847 v8::Utils::ToLocal(exception), promise->IsJSObject(), uncaught); |
| 1832 if (!non_inspector_listener_exists()) return; | 1848 if (!non_inspector_listener_exists()) return; |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2428 return v8::Utils::ToLocal(callback_data_); | 2444 return v8::Utils::ToLocal(callback_data_); |
| 2429 } | 2445 } |
| 2430 | 2446 |
| 2431 | 2447 |
| 2432 v8::Isolate* EventDetailsImpl::GetIsolate() const { | 2448 v8::Isolate* EventDetailsImpl::GetIsolate() const { |
| 2433 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); | 2449 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); |
| 2434 } | 2450 } |
| 2435 | 2451 |
| 2436 } // namespace internal | 2452 } // namespace internal |
| 2437 } // namespace v8 | 2453 } // namespace v8 |
| OLD | NEW |