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

Side by Side Diff: src/debug/debug.h

Issue 1297273005: Keep track of script objects in a weak fixed array. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: do not remove gc. Created 5 years, 4 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
« no previous file with comments | « no previous file | src/debug/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_DEBUG_H_ 5 #ifndef V8_DEBUG_DEBUG_H_
6 #define V8_DEBUG_DEBUG_H_ 6 #define V8_DEBUG_DEBUG_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/assembler.h" 10 #include "src/assembler.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 Handle<DebugInfo> debug_info_; 180 Handle<DebugInfo> debug_info_;
181 int pc_offset_; 181 int pc_offset_;
182 RelocInfo::Mode rmode_; 182 RelocInfo::Mode rmode_;
183 intptr_t data_; 183 intptr_t data_;
184 int position_; 184 int position_;
185 int statement_position_; 185 int statement_position_;
186 }; 186 };
187 187
188 188
189 // Cache of all script objects in the heap. When a script is added a weak handle
190 // to it is created and that weak handle is stored in the cache. The weak handle
191 // callback takes care of removing the script from the cache. The key used in
192 // the cache is the script id.
193 class ScriptCache {
194 public:
195 explicit ScriptCache(Isolate* isolate);
196 ~ScriptCache();
197
198 // Add script to the cache.
199 void Add(Handle<Script> script);
200
201 // Return the scripts in the cache.
202 Handle<FixedArray> GetScripts() {
203 return WeakValueHashTable::GetWeakValues(table_);
204 }
205
206 private:
207 Isolate* isolate_;
208 Handle<WeakValueHashTable> table_;
209 };
210
211
212 // Linked list holding debug info objects. The debug info objects are kept as 189 // Linked list holding debug info objects. The debug info objects are kept as
213 // weak handles to avoid a debug info object to keep a function alive. 190 // weak handles to avoid a debug info object to keep a function alive.
214 class DebugInfoListNode { 191 class DebugInfoListNode {
215 public: 192 public:
216 explicit DebugInfoListNode(DebugInfo* debug_info); 193 explicit DebugInfoListNode(DebugInfo* debug_info);
217 ~DebugInfoListNode(); 194 ~DebugInfoListNode();
218 195
219 DebugInfoListNode* next() { return next_; } 196 DebugInfoListNode* next() { return next_; }
220 void set_next(DebugInfoListNode* next) { next_ = next; } 197 void set_next(DebugInfoListNode* next) { next_ = next; }
221 Handle<DebugInfo> debug_info() { return Handle<DebugInfo>(debug_info_); } 198 Handle<DebugInfo> debug_info() { return Handle<DebugInfo>(debug_info_); }
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 592
616 bool is_active_; 593 bool is_active_;
617 bool is_suppressed_; 594 bool is_suppressed_;
618 bool live_edit_enabled_; 595 bool live_edit_enabled_;
619 bool has_break_points_; 596 bool has_break_points_;
620 bool break_disabled_; 597 bool break_disabled_;
621 bool in_debug_event_listener_; 598 bool in_debug_event_listener_;
622 bool break_on_exception_; 599 bool break_on_exception_;
623 bool break_on_uncaught_exception_; 600 bool break_on_uncaught_exception_;
624 601
625 ScriptCache* script_cache_; // Cache of all scripts in the heap.
626 DebugInfoListNode* debug_info_list_; // List of active debug info objects. 602 DebugInfoListNode* debug_info_list_; // List of active debug info objects.
627 603
628 // Storage location for jump when exiting debug break calls. 604 // Storage location for jump when exiting debug break calls.
629 // Note that this address is not GC safe. It should be computed immediately 605 // Note that this address is not GC safe. It should be computed immediately
630 // before returning to the DebugBreakCallHelper. 606 // before returning to the DebugBreakCallHelper.
631 Address after_break_target_; 607 Address after_break_target_;
632 608
633 // Per-thread data. 609 // Per-thread data.
634 class ThreadLocal { 610 class ThreadLocal {
635 public: 611 public:
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 int call_argc = -1); 760 int call_argc = -1);
785 761
786 static void PatchDebugBreakSlot(Address pc, Handle<Code> code); 762 static void PatchDebugBreakSlot(Address pc, Handle<Code> code);
787 static void ClearDebugBreakSlot(Address pc); 763 static void ClearDebugBreakSlot(Address pc);
788 }; 764 };
789 765
790 766
791 } } // namespace v8::internal 767 } } // namespace v8::internal
792 768
793 #endif // V8_DEBUG_DEBUG_H_ 769 #endif // V8_DEBUG_DEBUG_H_
OLDNEW
« no previous file with comments | « no previous file | src/debug/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698