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

Side by Side Diff: src/debug.h

Issue 151603004: A64: Synchronize with r16587. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/d8-debug.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 // 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 DISALLOW_COPY_AND_ASSIGN(BreakLocationIterator); 167 DISALLOW_COPY_AND_ASSIGN(BreakLocationIterator);
168 }; 168 };
169 169
170 170
171 // Cache of all script objects in the heap. When a script is added a weak handle 171 // Cache of all script objects in the heap. When a script is added a weak handle
172 // to it is created and that weak handle is stored in the cache. The weak handle 172 // to it is created and that weak handle is stored in the cache. The weak handle
173 // callback takes care of removing the script from the cache. The key used in 173 // callback takes care of removing the script from the cache. The key used in
174 // the cache is the script id. 174 // the cache is the script id.
175 class ScriptCache : private HashMap { 175 class ScriptCache : private HashMap {
176 public: 176 public:
177 ScriptCache() : HashMap(ScriptMatch), collected_scripts_(10) {} 177 explicit ScriptCache(Isolate* isolate)
178 : HashMap(ScriptMatch), isolate_(isolate), collected_scripts_(10) {}
178 virtual ~ScriptCache() { Clear(); } 179 virtual ~ScriptCache() { Clear(); }
179 180
180 // Add script to the cache. 181 // Add script to the cache.
181 void Add(Handle<Script> script); 182 void Add(Handle<Script> script);
182 183
183 // Return the scripts in the cache. 184 // Return the scripts in the cache.
184 Handle<FixedArray> GetScripts(); 185 Handle<FixedArray> GetScripts();
185 186
186 // Generate debugger events for collected scripts. 187 // Generate debugger events for collected scripts.
187 void ProcessCollectedScripts(); 188 void ProcessCollectedScripts();
188 189
189 private: 190 private:
190 // Calculate the hash value from the key (script id). 191 // Calculate the hash value from the key (script id).
191 static uint32_t Hash(int key) { 192 static uint32_t Hash(int key) {
192 return ComputeIntegerHash(key, v8::internal::kZeroHashSeed); 193 return ComputeIntegerHash(key, v8::internal::kZeroHashSeed);
193 } 194 }
194 195
195 // Scripts match if their keys (script id) match. 196 // Scripts match if their keys (script id) match.
196 static bool ScriptMatch(void* key1, void* key2) { return key1 == key2; } 197 static bool ScriptMatch(void* key1, void* key2) { return key1 == key2; }
197 198
198 // Clear the cache releasing all the weak handles. 199 // Clear the cache releasing all the weak handles.
199 void Clear(); 200 void Clear();
200 201
201 // Weak handle callback for scripts in the cache. 202 // Weak handle callback for scripts in the cache.
202 static void HandleWeakScript(v8::Isolate* isolate, 203 static void HandleWeakScript(v8::Isolate* isolate,
203 v8::Persistent<v8::Value>* obj, 204 v8::Persistent<v8::Value>* obj,
204 void* data); 205 void* data);
205 206
207 Isolate* isolate_;
206 // List used during GC to temporarily store id's of collected scripts. 208 // List used during GC to temporarily store id's of collected scripts.
207 List<int> collected_scripts_; 209 List<int> collected_scripts_;
208 }; 210 };
209 211
210 212
211 // Linked list holding debug info objects. The debug info objects are kept as 213 // Linked list holding debug info objects. The debug info objects are kept as
212 // weak handles to avoid a debug info object to keep a function alive. 214 // weak handles to avoid a debug info object to keep a function alive.
213 class DebugInfoListNode { 215 class DebugInfoListNode {
214 public: 216 public:
215 explicit DebugInfoListNode(DebugInfo* debug_info); 217 explicit DebugInfoListNode(DebugInfo* debug_info);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 Handle<Object> break_point_object, 254 Handle<Object> break_point_object,
253 int* source_position, 255 int* source_position,
254 BreakPositionAlignment alignment); 256 BreakPositionAlignment alignment);
255 void ClearBreakPoint(Handle<Object> break_point_object); 257 void ClearBreakPoint(Handle<Object> break_point_object);
256 void ClearAllBreakPoints(); 258 void ClearAllBreakPoints();
257 void FloodWithOneShot(Handle<JSFunction> function); 259 void FloodWithOneShot(Handle<JSFunction> function);
258 void FloodBoundFunctionWithOneShot(Handle<JSFunction> function); 260 void FloodBoundFunctionWithOneShot(Handle<JSFunction> function);
259 void FloodHandlerWithOneShot(); 261 void FloodHandlerWithOneShot();
260 void ChangeBreakOnException(ExceptionBreakType type, bool enable); 262 void ChangeBreakOnException(ExceptionBreakType type, bool enable);
261 bool IsBreakOnException(ExceptionBreakType type); 263 bool IsBreakOnException(ExceptionBreakType type);
262 void PrepareStep(StepAction step_action, int step_count); 264 void PrepareStep(StepAction step_action,
265 int step_count,
266 StackFrame::Id frame_id);
263 void ClearStepping(); 267 void ClearStepping();
264 void ClearStepOut(); 268 void ClearStepOut();
265 bool IsStepping() { return thread_local_.step_count_ > 0; } 269 bool IsStepping() { return thread_local_.step_count_ > 0; }
266 bool StepNextContinue(BreakLocationIterator* break_location_iterator, 270 bool StepNextContinue(BreakLocationIterator* break_location_iterator,
267 JavaScriptFrame* frame); 271 JavaScriptFrame* frame);
268 static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared); 272 static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared);
269 static bool HasDebugInfo(Handle<SharedFunctionInfo> shared); 273 static bool HasDebugInfo(Handle<SharedFunctionInfo> shared);
270 274
271 void PrepareForBreakPoints(); 275 void PrepareForBreakPoints();
272 276
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 static const int kInitialSize; 529 static const int kInitialSize;
526 // A value that padding words are filled with (in form of Smi). Going 530 // A value that padding words are filled with (in form of Smi). Going
527 // bottom-top, the first word not having this value is a counter word. 531 // bottom-top, the first word not having this value is a counter word.
528 static const int kPaddingValue; 532 static const int kPaddingValue;
529 }; 533 };
530 534
531 private: 535 private:
532 explicit Debug(Isolate* isolate); 536 explicit Debug(Isolate* isolate);
533 ~Debug(); 537 ~Debug();
534 538
535 static bool CompileDebuggerScript(int index); 539 static bool CompileDebuggerScript(Isolate* isolate, int index);
536 void ClearOneShot(); 540 void ClearOneShot();
537 void ActivateStepIn(StackFrame* frame); 541 void ActivateStepIn(StackFrame* frame);
538 void ClearStepIn(); 542 void ClearStepIn();
539 void ActivateStepOut(StackFrame* frame); 543 void ActivateStepOut(StackFrame* frame);
540 void ClearStepNext(); 544 void ClearStepNext();
541 // Returns whether the compile succeeded. 545 // Returns whether the compile succeeded.
542 void RemoveDebugInfo(Handle<DebugInfo> debug_info); 546 void RemoveDebugInfo(Handle<DebugInfo> debug_info);
543 void SetAfterBreakTarget(JavaScriptFrame* frame); 547 void SetAfterBreakTarget(JavaScriptFrame* frame);
544 Handle<Object> CheckBreakPoints(Handle<Object> break_point); 548 Handle<Object> CheckBreakPoints(Handle<Object> break_point);
545 bool CheckBreakPoint(Handle<Object> break_point_object); 549 bool CheckBreakPoint(Handle<Object> break_point_object);
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 DISALLOW_COPY_AND_ASSIGN(Debugger); 952 DISALLOW_COPY_AND_ASSIGN(Debugger);
949 }; 953 };
950 954
951 955
952 // This class is used for entering the debugger. Create an instance in the stack 956 // This class is used for entering the debugger. Create an instance in the stack
953 // to enter the debugger. This will set the current break state, make sure the 957 // to enter the debugger. This will set the current break state, make sure the
954 // debugger is loaded and switch to the debugger context. If the debugger for 958 // debugger is loaded and switch to the debugger context. If the debugger for
955 // some reason could not be entered FailedToEnter will return true. 959 // some reason could not be entered FailedToEnter will return true.
956 class EnterDebugger BASE_EMBEDDED { 960 class EnterDebugger BASE_EMBEDDED {
957 public: 961 public:
958 EnterDebugger(); 962 explicit EnterDebugger(Isolate* isolate);
959 ~EnterDebugger(); 963 ~EnterDebugger();
960 964
961 // Check whether the debugger could be entered. 965 // Check whether the debugger could be entered.
962 inline bool FailedToEnter() { return load_failed_; } 966 inline bool FailedToEnter() { return load_failed_; }
963 967
964 // Check whether there are any JavaScript frames on the stack. 968 // Check whether there are any JavaScript frames on the stack.
965 inline bool HasJavaScriptFrames() { return has_js_frames_; } 969 inline bool HasJavaScriptFrames() { return has_js_frames_; }
966 970
967 // Get the active context from before entering the debugger. 971 // Get the active context from before entering the debugger.
968 inline Handle<Context> GetContext() { return save_.context(); } 972 inline Handle<Context> GetContext() { return save_.context(); }
969 973
970 private: 974 private:
971 Isolate* isolate_; 975 Isolate* isolate_;
972 EnterDebugger* prev_; // Previous debugger entry if entered recursively. 976 EnterDebugger* prev_; // Previous debugger entry if entered recursively.
973 JavaScriptFrameIterator it_; 977 JavaScriptFrameIterator it_;
974 const bool has_js_frames_; // Were there any JavaScript frames? 978 const bool has_js_frames_; // Were there any JavaScript frames?
975 StackFrame::Id break_frame_id_; // Previous break frame id. 979 StackFrame::Id break_frame_id_; // Previous break frame id.
976 int break_id_; // Previous break id. 980 int break_id_; // Previous break id.
977 bool load_failed_; // Did the debugger fail to load? 981 bool load_failed_; // Did the debugger fail to load?
978 SaveContext save_; // Saves previous context. 982 SaveContext save_; // Saves previous context.
979 }; 983 };
980 984
981 985
982 // Stack allocated class for disabling break. 986 // Stack allocated class for disabling break.
983 class DisableBreak BASE_EMBEDDED { 987 class DisableBreak BASE_EMBEDDED {
984 public: 988 public:
985 explicit DisableBreak(bool disable_break) : isolate_(Isolate::Current()) { 989 explicit DisableBreak(Isolate* isolate, bool disable_break)
990 : isolate_(isolate) {
986 prev_disable_break_ = isolate_->debug()->disable_break(); 991 prev_disable_break_ = isolate_->debug()->disable_break();
987 isolate_->debug()->set_disable_break(disable_break); 992 isolate_->debug()->set_disable_break(disable_break);
988 } 993 }
989 ~DisableBreak() { 994 ~DisableBreak() {
990 ASSERT(Isolate::Current() == isolate_);
991 isolate_->debug()->set_disable_break(prev_disable_break_); 995 isolate_->debug()->set_disable_break(prev_disable_break_);
992 } 996 }
993 997
994 private: 998 private:
995 Isolate* isolate_; 999 Isolate* isolate_;
996 // The previous state of the disable break used to restore the value when this 1000 // The previous state of the disable break used to restore the value when this
997 // object is destructed. 1001 // object is destructed.
998 bool prev_disable_break_; 1002 bool prev_disable_break_;
999 }; 1003 };
1000 1004
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 1064
1061 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); 1065 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread);
1062 }; 1066 };
1063 1067
1064 1068
1065 } } // namespace v8::internal 1069 } } // namespace v8::internal
1066 1070
1067 #endif // ENABLE_DEBUGGER_SUPPORT 1071 #endif // ENABLE_DEBUGGER_SUPPORT
1068 1072
1069 #endif // V8_DEBUG_H_ 1073 #endif // V8_DEBUG_H_
OLDNEW
« no previous file with comments | « src/d8-debug.cc ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698