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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 // For step-next, a tail call is like a return and should break. | 554 // For step-next, a tail call is like a return and should break. |
| 555 step_break = location.IsTailCall(); | 555 step_break = location.IsTailCall(); |
| 556 // Fall through. | 556 // Fall through. |
| 557 case StepIn: { | 557 case StepIn: { |
| 558 FrameSummary summary = FrameSummary::GetTop(frame); | 558 FrameSummary summary = FrameSummary::GetTop(frame); |
| 559 step_break = step_break || location.IsReturn() || current_fp != last_fp || | 559 step_break = step_break || location.IsReturn() || current_fp != last_fp || |
| 560 thread_local_.last_statement_position_ != | 560 thread_local_.last_statement_position_ != |
| 561 summary.SourceStatementPosition(); | 561 summary.SourceStatementPosition(); |
| 562 break; | 562 break; |
| 563 } | 563 } |
| 564 case StepFrame: | |
| 565 step_break = current_fp != last_fp; | |
| 566 break; | |
| 567 } | 564 } |
| 568 | 565 |
| 569 // Clear all current stepping setup. | 566 // Clear all current stepping setup. |
| 570 ClearStepping(); | 567 ClearStepping(); |
| 571 | 568 |
| 572 if (step_break) { | 569 if (step_break) { |
| 573 // Notify the debug event listeners. | 570 // Notify the debug event listeners. |
| 574 OnDebugBreak(isolate_->factory()->undefined_value()); | 571 OnDebugBreak(isolate_->factory()->undefined_value()); |
| 575 } else { | 572 } else { |
| 576 // Re-prepare to continue. | 573 // Re-prepare to continue. |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1075 thread_local_.last_fp_ = 0; | 1072 thread_local_.last_fp_ = 0; |
| 1076 break; | 1073 break; |
| 1077 case StepNext: | 1074 case StepNext: |
| 1078 thread_local_.target_fp_ = frame->UnpaddedFP(); | 1075 thread_local_.target_fp_ = frame->UnpaddedFP(); |
| 1079 FloodWithOneShot(function); | 1076 FloodWithOneShot(function); |
| 1080 break; | 1077 break; |
| 1081 case StepIn: | 1078 case StepIn: |
| 1082 // TODO(clemensh): Implement stepping from JS into WASM. | 1079 // TODO(clemensh): Implement stepping from JS into WASM. |
| 1083 FloodWithOneShot(function); | 1080 FloodWithOneShot(function); |
| 1084 break; | 1081 break; |
| 1085 case StepFrame: | |
| 1086 // TODO(clemensh): Implement stepping from JS into WASM or vice versa. | |
| 1087 // No point in setting one-shot breaks at places where we are not about | |
| 1088 // to leave the current frame. | |
| 1089 FloodWithOneShot(function, CALLS_AND_RETURNS); | |
|
kozy
2017/01/25 20:21:05
We could remove CALLS_AND_RETURNS as well. But as
| |
| 1090 break; | |
| 1091 } | 1082 } |
| 1092 } | 1083 } |
| 1093 | 1084 |
| 1094 // Simple function for returning the source positions for active break points. | 1085 // Simple function for returning the source positions for active break points. |
| 1095 Handle<Object> Debug::GetSourceBreakLocations( | 1086 Handle<Object> Debug::GetSourceBreakLocations( |
| 1096 Handle<SharedFunctionInfo> shared, | 1087 Handle<SharedFunctionInfo> shared, |
| 1097 BreakPositionAlignment position_alignment) { | 1088 BreakPositionAlignment position_alignment) { |
| 1098 Isolate* isolate = shared->GetIsolate(); | 1089 Isolate* isolate = shared->GetIsolate(); |
| 1099 if (!shared->HasDebugInfo()) { | 1090 if (!shared->HasDebugInfo()) { |
| 1100 return isolate->factory()->undefined_value(); | 1091 return isolate->factory()->undefined_value(); |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2146 is_active = Load(); | 2137 is_active = Load(); |
| 2147 } else if (is_loaded()) { | 2138 } else if (is_loaded()) { |
| 2148 isolate_->compilation_cache()->Enable(); | 2139 isolate_->compilation_cache()->Enable(); |
| 2149 Unload(); | 2140 Unload(); |
| 2150 } | 2141 } |
| 2151 is_active_ = is_active; | 2142 is_active_ = is_active; |
| 2152 isolate_->DebugStateUpdated(); | 2143 isolate_->DebugStateUpdated(); |
| 2153 } | 2144 } |
| 2154 | 2145 |
| 2155 void Debug::UpdateHookOnFunctionCall() { | 2146 void Debug::UpdateHookOnFunctionCall() { |
| 2156 STATIC_ASSERT(StepFrame > StepIn); | 2147 STATIC_ASSERT(LastStepAction == StepIn); |
| 2157 STATIC_ASSERT(LastStepAction == StepFrame); | 2148 hook_on_function_call_ = thread_local_.last_step_action_ == StepIn || |
| 2158 hook_on_function_call_ = thread_local_.last_step_action_ >= StepIn || | |
| 2159 isolate_->needs_side_effect_check(); | 2149 isolate_->needs_side_effect_check(); |
| 2160 } | 2150 } |
| 2161 | 2151 |
| 2162 MaybeHandle<Object> Debug::Call(Handle<Object> fun, Handle<Object> data) { | 2152 MaybeHandle<Object> Debug::Call(Handle<Object> fun, Handle<Object> data) { |
| 2163 DebugScope debug_scope(this); | 2153 DebugScope debug_scope(this); |
| 2164 if (debug_scope.failed()) return isolate_->factory()->undefined_value(); | 2154 if (debug_scope.failed()) return isolate_->factory()->undefined_value(); |
| 2165 | 2155 |
| 2166 // Create the execution state. | 2156 // Create the execution state. |
| 2167 Handle<Object> exec_state; | 2157 Handle<Object> exec_state; |
| 2168 if (!MakeExecutionState().ToHandle(&exec_state)) { | 2158 if (!MakeExecutionState().ToHandle(&exec_state)) { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2391 return v8::Utils::ToLocal(callback_data_); | 2381 return v8::Utils::ToLocal(callback_data_); |
| 2392 } | 2382 } |
| 2393 | 2383 |
| 2394 | 2384 |
| 2395 v8::Isolate* EventDetailsImpl::GetIsolate() const { | 2385 v8::Isolate* EventDetailsImpl::GetIsolate() const { |
| 2396 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); | 2386 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); |
| 2397 } | 2387 } |
| 2398 | 2388 |
| 2399 } // namespace internal | 2389 } // namespace internal |
| 2400 } // namespace v8 | 2390 } // namespace v8 |
| OLD | NEW |