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

Side by Side Diff: src/global-handles.h

Issue 11190011: Add an API for enumerating persistent handles (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 2 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/api.cc ('k') | src/global-handles.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // handle. When the garbage collector recognizes that only weak global 124 // handle. When the garbage collector recognizes that only weak global
125 // handles point to an object the handles are cleared and the callback 125 // handles point to an object the handles are cleared and the callback
126 // function is invoked (for each handle) with the handle and corresponding 126 // function is invoked (for each handle) with the handle and corresponding
127 // parameter as arguments. Note: cleared means set to Smi::FromInt(0). The 127 // parameter as arguments. Note: cleared means set to Smi::FromInt(0). The
128 // reason is that Smi::FromInt(0) does not change during garage collection. 128 // reason is that Smi::FromInt(0) does not change during garage collection.
129 void MakeWeak(Object** location, 129 void MakeWeak(Object** location,
130 void* parameter, 130 void* parameter,
131 WeakReferenceCallback callback); 131 WeakReferenceCallback callback);
132 132
133 static void SetWrapperClassId(Object** location, uint16_t class_id); 133 static void SetWrapperClassId(Object** location, uint16_t class_id);
134 static uint16_t GetWrapperClassId(Object** location);
134 135
135 // Returns the current number of weak handles. 136 // Returns the current number of weak handles.
136 int NumberOfWeakHandles() { return number_of_weak_handles_; } 137 int NumberOfWeakHandles() { return number_of_weak_handles_; }
137 138
138 void RecordStats(HeapStats* stats); 139 void RecordStats(HeapStats* stats);
139 140
140 // Returns the current number of weak handles to global objects. 141 // Returns the current number of weak handles to global objects.
141 // These handles are also included in NumberOfWeakHandles(). 142 // These handles are also included in NumberOfWeakHandles().
142 int NumberOfGlobalObjectWeakHandles() { 143 int NumberOfGlobalObjectWeakHandles() {
143 return number_of_global_object_weak_handles_; 144 return number_of_global_object_weak_handles_;
144 } 145 }
145 146
146 // Returns the current number of handles to global objects. 147 // Returns the current number of handles to global objects.
147 int NumberOfGlobalHandles() { 148 int NumberOfGlobalHandles() {
148 return number_of_global_handles_; 149 return number_of_global_handles_;
149 } 150 }
150 151
151 // Clear the weakness of a global handle. 152 // Clear the weakness of a global handle.
152 void ClearWeakness(Object** location); 153 void ClearWeakness(Object** location);
153 154
154 // Clear the weakness of a global handle. 155 // Clear the weakness of a global handle.
155 void MarkIndependent(Object** location); 156 void MarkIndependent(Object** location);
156 157
158 static bool IsIndependent(Object** location);
159
157 // Tells whether global handle is near death. 160 // Tells whether global handle is near death.
158 static bool IsNearDeath(Object** location); 161 static bool IsNearDeath(Object** location);
159 162
160 // Tells whether global handle is weak. 163 // Tells whether global handle is weak.
161 static bool IsWeak(Object** location); 164 static bool IsWeak(Object** location);
162 165
163 // Process pending weak handles. 166 // Process pending weak handles.
164 // Returns true if next major GC is likely to collect more garbage. 167 // Returns true if next major GC is likely to collect more garbage.
165 bool PostGarbageCollectionProcessing(GarbageCollector collector); 168 bool PostGarbageCollectionProcessing(GarbageCollector collector);
166 169
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 279
277 friend class Isolate; 280 friend class Isolate;
278 281
279 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); 282 DISALLOW_COPY_AND_ASSIGN(GlobalHandles);
280 }; 283 };
281 284
282 285
283 } } // namespace v8::internal 286 } } // namespace v8::internal
284 287
285 #endif // V8_GLOBAL_HANDLES_H_ 288 #endif // V8_GLOBAL_HANDLES_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/global-handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698