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 "src/api.h" | 7 #include "src/api.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 } | 724 } |
725 // Remove all debug info. | 725 // Remove all debug info. |
726 while (debug_info_list_ != NULL) { | 726 while (debug_info_list_ != NULL) { |
727 RemoveDebugInfoAndClearFromShared(debug_info_list_->debug_info()); | 727 RemoveDebugInfoAndClearFromShared(debug_info_list_->debug_info()); |
728 } | 728 } |
729 } | 729 } |
730 | 730 |
731 | 731 |
732 void Debug::FloodWithOneShot(Handle<JSFunction> function, | 732 void Debug::FloodWithOneShot(Handle<JSFunction> function, |
733 BreakLocatorType type) { | 733 BreakLocatorType type) { |
| 734 if (!function->shared()->IsSubjectToDebugging()) { |
| 735 // Builtin functions are not subject to stepping, but need to be |
| 736 // deoptimized, because optimized code does not check for debug |
| 737 // step in at call sites. |
| 738 Deoptimizer::DeoptimizeFunction(*function); |
| 739 return; |
| 740 } |
734 // Make sure the function is compiled and has set up the debug info. | 741 // Make sure the function is compiled and has set up the debug info. |
735 Handle<SharedFunctionInfo> shared(function->shared()); | 742 Handle<SharedFunctionInfo> shared(function->shared()); |
736 if (!EnsureDebugInfo(shared, function)) { | 743 if (!EnsureDebugInfo(shared, function)) { |
737 // Return if we failed to retrieve the debug info. | 744 // Return if we failed to retrieve the debug info. |
738 return; | 745 return; |
739 } | 746 } |
740 | 747 |
741 // Flood the function with break points. | 748 // Flood the function with break points. |
742 Handle<DebugInfo> debug_info(shared->GetDebugInfo()); | 749 Handle<DebugInfo> debug_info(shared->GetDebugInfo()); |
743 for (BreakLocation::Iterator it(debug_info, type); !it.Done(); it.Next()) { | 750 for (BreakLocation::Iterator it(debug_info, type); !it.Done(); it.Next()) { |
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2272 if (IsDebugGlobal(global)) return; | 2279 if (IsDebugGlobal(global)) return; |
2273 } | 2280 } |
2274 } | 2281 } |
2275 | 2282 |
2276 // Collect the break state before clearing the flags. | 2283 // Collect the break state before clearing the flags. |
2277 bool debug_command_only = isolate_->stack_guard()->CheckDebugCommand() && | 2284 bool debug_command_only = isolate_->stack_guard()->CheckDebugCommand() && |
2278 !isolate_->stack_guard()->CheckDebugBreak(); | 2285 !isolate_->stack_guard()->CheckDebugBreak(); |
2279 | 2286 |
2280 isolate_->stack_guard()->ClearDebugBreak(); | 2287 isolate_->stack_guard()->ClearDebugBreak(); |
2281 | 2288 |
| 2289 // Clear stepping to avoid duplicate breaks. |
| 2290 ClearStepping(); |
| 2291 |
2282 ProcessDebugMessages(debug_command_only); | 2292 ProcessDebugMessages(debug_command_only); |
2283 } | 2293 } |
2284 | 2294 |
2285 | 2295 |
2286 void Debug::ProcessDebugMessages(bool debug_command_only) { | 2296 void Debug::ProcessDebugMessages(bool debug_command_only) { |
2287 isolate_->stack_guard()->ClearDebugCommand(); | 2297 isolate_->stack_guard()->ClearDebugCommand(); |
2288 | 2298 |
2289 StackLimitCheck check(isolate_); | 2299 StackLimitCheck check(isolate_); |
2290 if (check.HasOverflowed()) return; | 2300 if (check.HasOverflowed()) return; |
2291 | 2301 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2602 } | 2612 } |
2603 | 2613 |
2604 | 2614 |
2605 void LockingCommandMessageQueue::Clear() { | 2615 void LockingCommandMessageQueue::Clear() { |
2606 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2616 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2607 queue_.Clear(); | 2617 queue_.Clear(); |
2608 } | 2618 } |
2609 | 2619 |
2610 } // namespace internal | 2620 } // namespace internal |
2611 } // namespace v8 | 2621 } // namespace v8 |
OLD | NEW |