Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: src/debug.h

Issue 261253005: Clean up debugger flags. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler.cc ('k') | src/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef V8_DEBUG_H_ 5 #ifndef V8_DEBUG_H_
6 #define V8_DEBUG_H_ 6 #define V8_DEBUG_H_
7 7
8 #include "allocation.h" 8 #include "allocation.h"
9 #include "arguments.h" 9 #include "arguments.h"
10 #include "assembler.h" 10 #include "assembler.h"
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 815
816 void CallMessageDispatchHandler(); 816 void CallMessageDispatchHandler();
817 817
818 Handle<Context> GetDebugContext(); 818 Handle<Context> GetDebugContext();
819 819
820 // Unload the debugger if possible. Only called when no debugger is currently 820 // Unload the debugger if possible. Only called when no debugger is currently
821 // active. 821 // active.
822 void UnloadDebugger(); 822 void UnloadDebugger();
823 friend void ForceUnloadDebugger(); // In test-debug.cc 823 friend void ForceUnloadDebugger(); // In test-debug.cc
824 824
825 inline bool EventActive(v8::DebugEvent event) { 825 inline bool EventActive() {
826 LockGuard<RecursiveMutex> lock_guard(debugger_access_); 826 LockGuard<RecursiveMutex> lock_guard(&debugger_access_);
827 827
828 // Check whether the message handler was been cleared. 828 // Check whether the message handler was been cleared.
829 // TODO(yangguo): handle loading and unloading of the debugger differently.
829 if (debugger_unload_pending_) { 830 if (debugger_unload_pending_) {
830 if (isolate_->debug()->debugger_entry() == NULL) { 831 if (isolate_->debug()->debugger_entry() == NULL) {
831 UnloadDebugger(); 832 UnloadDebugger();
832 } 833 }
833 } 834 }
834 835
835 if (((event == v8::BeforeCompile) || (event == v8::AfterCompile)) &&
836 !FLAG_debug_compile_events) {
837 return false;
838
839 } else if ((event == v8::ScriptCollected) &&
840 !FLAG_debug_script_collected_events) {
841 return false;
842 }
843
844 // Currently argument event is not used. 836 // Currently argument event is not used.
845 return !compiling_natives_ && Debugger::IsDebuggerActive(); 837 return !ignore_debugger_ && is_active_;
846 } 838 }
847 839
848 void set_compiling_natives(bool compiling_natives) { 840 bool ignore_debugger() const { return ignore_debugger_; }
849 compiling_natives_ = compiling_natives;
850 }
851 bool compiling_natives() const { return compiling_natives_; }
852 void set_loading_debugger(bool v) { is_loading_debugger_ = v; }
853 bool is_loading_debugger() const { return is_loading_debugger_; }
854 void set_live_edit_enabled(bool v) { live_edit_enabled_ = v; } 841 void set_live_edit_enabled(bool v) { live_edit_enabled_ = v; }
855 bool live_edit_enabled() const { 842 bool live_edit_enabled() const {
856 return FLAG_enable_liveedit && live_edit_enabled_ ; 843 return FLAG_enable_liveedit && live_edit_enabled_ ;
857 } 844 }
858 void set_force_debugger_active(bool force_debugger_active) { 845
859 force_debugger_active_ = force_debugger_active; 846 bool is_active() {
847 LockGuard<RecursiveMutex> lock_guard(&debugger_access_);
848 return is_active_;
860 } 849 }
861 bool force_debugger_active() const { return force_debugger_active_; }
862 850
863 bool IsDebuggerActive(); 851 class IgnoreScope {
852 public:
853 explicit IgnoreScope(Debugger* debugger)
854 : debugger_(debugger),
855 old_state_(debugger_->ignore_debugger_) {
856 debugger_->ignore_debugger_ = true;
857 }
858
859 ~IgnoreScope() {
860 debugger_->ignore_debugger_ = old_state_;
861 }
862
863 private:
864 Debugger* debugger_;
865 bool old_state_;
866 DISALLOW_COPY_AND_ASSIGN(IgnoreScope);
867 };
864 868
865 private: 869 private:
866 explicit Debugger(Isolate* isolate); 870 explicit Debugger(Isolate* isolate);
867 871
868 void CallEventCallback(v8::DebugEvent event, 872 void CallEventCallback(v8::DebugEvent event,
869 Handle<Object> exec_state, 873 Handle<Object> exec_state,
870 Handle<Object> event_data, 874 Handle<Object> event_data,
871 v8::Debug::ClientData* client_data); 875 v8::Debug::ClientData* client_data);
872 void CallCEventCallback(v8::DebugEvent event, 876 void CallCEventCallback(v8::DebugEvent event,
873 Handle<Object> exec_state, 877 Handle<Object> exec_state,
874 Handle<Object> event_data, 878 Handle<Object> event_data,
875 v8::Debug::ClientData* client_data); 879 v8::Debug::ClientData* client_data);
876 void CallJSEventCallback(v8::DebugEvent event, 880 void CallJSEventCallback(v8::DebugEvent event,
877 Handle<Object> exec_state, 881 Handle<Object> exec_state,
878 Handle<Object> event_data); 882 Handle<Object> event_data);
879 void ListenersChanged(); 883 void ListenersChanged();
880 884
881 RecursiveMutex* debugger_access_; // Mutex guarding debugger variables. 885 RecursiveMutex debugger_access_; // Mutex guarding debugger variables.
882 Handle<Object> event_listener_; // Global handle to listener. 886 Handle<Object> event_listener_; // Global handle to listener.
883 Handle<Object> event_listener_data_; 887 Handle<Object> event_listener_data_;
884 bool compiling_natives_; // Are we compiling natives? 888 bool is_active_;
885 bool is_loading_debugger_; // Are we loading the debugger? 889 bool ignore_debugger_; // Are we temporarily ignoring the debugger?
886 bool live_edit_enabled_; // Enable LiveEdit. 890 bool live_edit_enabled_; // Enable LiveEdit.
887 bool never_unload_debugger_; // Can we unload the debugger? 891 bool never_unload_debugger_; // Can we unload the debugger?
888 bool force_debugger_active_; // Activate debugger without event listeners.
889 v8::Debug::MessageHandler2 message_handler_; 892 v8::Debug::MessageHandler2 message_handler_;
890 bool debugger_unload_pending_; // Was message handler cleared? 893 bool debugger_unload_pending_; // Was message handler cleared?
891 894
892 Mutex dispatch_handler_access_; // Mutex guarding dispatch handler. 895 Mutex dispatch_handler_access_; // Mutex guarding dispatch handler.
893 v8::Debug::DebugMessageDispatchHandler debug_message_dispatch_handler_; 896 v8::Debug::DebugMessageDispatchHandler debug_message_dispatch_handler_;
894 MessageDispatchHelperThread* message_dispatch_helper_thread_; 897 MessageDispatchHelperThread* message_dispatch_helper_thread_;
895 898
896 DebuggerAgent* agent_; 899 DebuggerAgent* agent_;
897 900
898 static const int kQueueInitialSize = 4; 901 static const int kQueueInitialSize = 4;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 Mutex mutex_; 1013 Mutex mutex_;
1011 bool already_signalled_; 1014 bool already_signalled_;
1012 1015
1013 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); 1016 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread);
1014 }; 1017 };
1015 1018
1016 1019
1017 } } // namespace v8::internal 1020 } } // namespace v8::internal
1018 1021
1019 #endif // V8_DEBUG_H_ 1022 #endif // V8_DEBUG_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698