| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 // Make sure that debugger is loaded and enter the debugger context. | 773 // Make sure that debugger is loaded and enter the debugger context. |
| 774 load_failed_ = !Debug::Load(); | 774 load_failed_ = !Debug::Load(); |
| 775 if (!load_failed_) { | 775 if (!load_failed_) { |
| 776 // NOTE the member variable save which saves the previous context before | 776 // NOTE the member variable save which saves the previous context before |
| 777 // this change. | 777 // this change. |
| 778 Top::set_context(*Debug::debug_context()); | 778 Top::set_context(*Debug::debug_context()); |
| 779 } | 779 } |
| 780 } | 780 } |
| 781 | 781 |
| 782 ~EnterDebugger() { | 782 ~EnterDebugger() { |
| 783 // TODO(isolates): Check to see if this is the same isolate as in the |
| 784 // constructor. |
| 785 Isolate* isolate = Isolate::Current(); |
| 786 |
| 783 // Restore to the previous break state. | 787 // Restore to the previous break state. |
| 784 Debug::SetBreak(break_frame_id_, break_id_); | 788 Debug::SetBreak(break_frame_id_, break_id_); |
| 785 | 789 |
| 786 // Check for leaving the debugger. | 790 // Check for leaving the debugger. |
| 787 if (prev_ == NULL) { | 791 if (prev_ == NULL) { |
| 788 // Clear mirror cache when leaving the debugger. Skip this if there is a | 792 // Clear mirror cache when leaving the debugger. Skip this if there is a |
| 789 // pending exception as clearing the mirror cache calls back into | 793 // pending exception as clearing the mirror cache calls back into |
| 790 // JavaScript. This can happen if the v8::Debug::Call is used in which | 794 // JavaScript. This can happen if the v8::Debug::Call is used in which |
| 791 // case the exception should end up in the calling code. | 795 // case the exception should end up in the calling code. |
| 792 if (!Top::has_pending_exception()) { | 796 if (!Top::has_pending_exception()) { |
| 793 // Try to avoid any pending debug break breaking in the clear mirror | 797 // Try to avoid any pending debug break breaking in the clear mirror |
| 794 // cache JavaScript code. | 798 // cache JavaScript code. |
| 795 if (StackGuard::IsDebugBreak()) { | 799 if (isolate->stack_guard()->IsDebugBreak()) { |
| 796 Debug::set_interrupts_pending(DEBUGBREAK); | 800 Debug::set_interrupts_pending(DEBUGBREAK); |
| 797 StackGuard::Continue(DEBUGBREAK); | 801 isolate->stack_guard()->Continue(DEBUGBREAK); |
| 798 } | 802 } |
| 799 Debug::ClearMirrorCache(); | 803 Debug::ClearMirrorCache(); |
| 800 } | 804 } |
| 801 | 805 |
| 802 // Request preemption and debug break when leaving the last debugger entry | 806 // Request preemption and debug break when leaving the last debugger entry |
| 803 // if any of these where recorded while debugging. | 807 // if any of these where recorded while debugging. |
| 804 if (Debug::is_interrupt_pending(PREEMPT)) { | 808 if (Debug::is_interrupt_pending(PREEMPT)) { |
| 805 // This re-scheduling of preemption is to avoid starvation in some | 809 // This re-scheduling of preemption is to avoid starvation in some |
| 806 // debugging scenarios. | 810 // debugging scenarios. |
| 807 Debug::clear_interrupt_pending(PREEMPT); | 811 Debug::clear_interrupt_pending(PREEMPT); |
| 808 StackGuard::Preempt(); | 812 isolate->stack_guard()->Preempt(); |
| 809 } | 813 } |
| 810 if (Debug::is_interrupt_pending(DEBUGBREAK)) { | 814 if (Debug::is_interrupt_pending(DEBUGBREAK)) { |
| 811 Debug::clear_interrupt_pending(DEBUGBREAK); | 815 Debug::clear_interrupt_pending(DEBUGBREAK); |
| 812 StackGuard::DebugBreak(); | 816 isolate->stack_guard()->DebugBreak(); |
| 813 } | 817 } |
| 814 | 818 |
| 815 // If there are commands in the queue when leaving the debugger request | 819 // If there are commands in the queue when leaving the debugger request |
| 816 // that these commands are processed. | 820 // that these commands are processed. |
| 817 if (Debugger::HasCommands()) { | 821 if (Debugger::HasCommands()) { |
| 818 StackGuard::DebugCommand(); | 822 isolate->stack_guard()->DebugCommand(); |
| 819 } | 823 } |
| 820 | 824 |
| 821 // If leaving the debugger with the debugger no longer active unload it. | 825 // If leaving the debugger with the debugger no longer active unload it. |
| 822 if (!Debugger::IsDebuggerActive()) { | 826 if (!Debugger::IsDebuggerActive()) { |
| 823 Debugger::UnloadDebugger(); | 827 Debugger::UnloadDebugger(); |
| 824 } | 828 } |
| 825 } | 829 } |
| 826 | 830 |
| 827 // Leaving this debugger entry. | 831 // Leaving this debugger entry. |
| 828 Debug::set_debugger_entry(prev_); | 832 Debug::set_debugger_entry(prev_); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 | 931 |
| 928 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); | 932 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); |
| 929 }; | 933 }; |
| 930 | 934 |
| 931 | 935 |
| 932 } } // namespace v8::internal | 936 } } // namespace v8::internal |
| 933 | 937 |
| 934 #endif // ENABLE_DEBUGGER_SUPPORT | 938 #endif // ENABLE_DEBUGGER_SUPPORT |
| 935 | 939 |
| 936 #endif // V8_DEBUG_H_ | 940 #endif // V8_DEBUG_H_ |
| OLD | NEW |