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

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

Issue 21042004: Make GlobalHandle::NodeBlock deletable (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: added weak callbacks to test Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/global-handles.cc » ('j') | src/global-handles.cc » ('J')
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 // Returns the current number of weak handles to global objects. 150 // Returns the current number of weak handles to global objects.
151 // These handles are also included in NumberOfWeakHandles(). 151 // These handles are also included in NumberOfWeakHandles().
152 int NumberOfGlobalObjectWeakHandles(); 152 int NumberOfGlobalObjectWeakHandles();
153 153
154 // Returns the current number of handles to global objects. 154 // Returns the current number of handles to global objects.
155 int global_handles_count() const { 155 int global_handles_count() const {
156 return number_of_global_handles_; 156 return number_of_global_handles_;
157 } 157 }
158 158
159 int block_count() const { return number_of_blocks_; }
Michael Starzinger 2013/08/01 12:29:02 nit: Let's add a short one-liner comment to the ac
160
159 // Clear the weakness of a global handle. 161 // Clear the weakness of a global handle.
160 static void ClearWeakness(Object** location); 162 static void ClearWeakness(Object** location);
161 163
162 // Clear the weakness of a global handle. 164 // Clear the weakness of a global handle.
163 static void MarkIndependent(Object** location); 165 static void MarkIndependent(Object** location);
164 166
165 // Mark the reference to this object externaly unreachable. 167 // Mark the reference to this object externaly unreachable.
166 static void MarkPartiallyDependent(Object** location); 168 static void MarkPartiallyDependent(Object** location);
167 169
168 static bool IsIndependent(Object** location); 170 static bool IsIndependent(Object** location);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 void RemoveImplicitRefGroups(); 270 void RemoveImplicitRefGroups();
269 271
270 // Tear down the global handle structure. 272 // Tear down the global handle structure.
271 void TearDown(); 273 void TearDown();
272 274
273 Isolate* isolate() { return isolate_; } 275 Isolate* isolate() { return isolate_; }
274 276
275 #ifdef DEBUG 277 #ifdef DEBUG
276 void PrintStats(); 278 void PrintStats();
277 void Print(); 279 void Print();
280 void VerifyBlockInvariants();
278 #endif 281 #endif
279 282
280 private: 283 private:
281 explicit GlobalHandles(Isolate* isolate); 284 explicit GlobalHandles(Isolate* isolate);
282 285
286 void SortBlocks(bool shouldPrune);
287
283 // Migrates data from the internal representation (object_group_connections_, 288 // Migrates data from the internal representation (object_group_connections_,
284 // retainer_infos_ and implicit_ref_connections_) to the public and more 289 // retainer_infos_ and implicit_ref_connections_) to the public and more
285 // efficient representation (object_groups_ and implicit_ref_groups_). 290 // efficient representation (object_groups_ and implicit_ref_groups_).
286 void ComputeObjectGroupsAndImplicitReferences(); 291 void ComputeObjectGroupsAndImplicitReferences();
287 292
288 // v8::internal::List is inefficient even for small number of elements, if we 293 // v8::internal::List is inefficient even for small number of elements, if we
289 // don't assign any initial capacity. 294 // don't assign any initial capacity.
290 static const int kObjectGroupConnectionsCapacity = 20; 295 static const int kObjectGroupConnectionsCapacity = 20;
291 296
292 // Internal node structures. 297 // Internal node structures.
293 class Node; 298 class Node;
294 class NodeBlock; 299 class NodeBlock;
295 class NodeIterator; 300 class NodeIterator;
296 301
297 Isolate* isolate_; 302 Isolate* isolate_;
298 303
304 // Field always containing the number of blocks allocated.
305 int number_of_blocks_;
299 // Field always containing the number of handles to global objects. 306 // Field always containing the number of handles to global objects.
300 int number_of_global_handles_; 307 int number_of_global_handles_;
301 308
302 // List of all allocated node blocks. 309 // Ends of a doubly-linked list of blocks
310 // which is sorted from fullest to emptiest during GC.
303 NodeBlock* first_block_; 311 NodeBlock* first_block_;
312 NodeBlock* last_block_;
304 313
305 // List of node blocks with used nodes. 314 // All blocks before this one will always be full
306 NodeBlock* first_used_block_; 315 // and none after this will be full.
307 316 NodeBlock* first_non_full_block_;
308 // Free list of nodes.
309 Node* first_free_;
310 317
311 // Contains all nodes holding new space objects. Note: when the list 318 // Contains all nodes holding new space objects. Note: when the list
312 // is accessed, some of the objects may have been promoted already. 319 // is accessed, some of the objects may have been promoted already.
313 List<Node*> new_space_nodes_; 320 List<Node*> new_space_nodes_;
314 321
315 int post_gc_processing_count_; 322 int post_gc_processing_count_;
316 323
317 // Object groups and implicit references, public and more efficient 324 // Object groups and implicit references, public and more efficient
318 // representation. 325 // representation.
319 List<ObjectGroup*> object_groups_; 326 List<ObjectGroup*> object_groups_;
320 List<ImplicitRefGroup*> implicit_ref_groups_; 327 List<ImplicitRefGroup*> implicit_ref_groups_;
321 328
322 // Object groups and implicit references, temporary representation while 329 // Object groups and implicit references, temporary representation while
323 // constructing the groups. 330 // constructing the groups.
324 List<ObjectGroupConnection> object_group_connections_; 331 List<ObjectGroupConnection> object_group_connections_;
325 List<ObjectGroupRetainerInfo> retainer_infos_; 332 List<ObjectGroupRetainerInfo> retainer_infos_;
326 List<ObjectGroupConnection> implicit_ref_connections_; 333 List<ObjectGroupConnection> implicit_ref_connections_;
327 334
328 friend class Isolate; 335 friend class Isolate;
329 336
330 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); 337 DISALLOW_COPY_AND_ASSIGN(GlobalHandles);
331 }; 338 };
332 339
333 340
334 } } // namespace v8::internal 341 } } // namespace v8::internal
335 342
336 #endif // V8_GLOBAL_HANDLES_H_ 343 #endif // V8_GLOBAL_HANDLES_H_
OLDNEW
« no previous file with comments | « no previous file | src/global-handles.cc » ('j') | src/global-handles.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698