| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // number of live objects. | 286 // number of live objects. |
| 287 static int IterateLiveObjectsInRange(Address start, Address end, | 287 static int IterateLiveObjectsInRange(Address start, Address end, |
| 288 HeapObjectCallback size_func); | 288 HeapObjectCallback size_func); |
| 289 | 289 |
| 290 // Callback functions for deallocating non-live blocks in the old | 290 // Callback functions for deallocating non-live blocks in the old |
| 291 // generation. | 291 // generation. |
| 292 static void DeallocateOldPointerBlock(Address start, int size_in_bytes); | 292 static void DeallocateOldPointerBlock(Address start, int size_in_bytes); |
| 293 static void DeallocateOldDataBlock(Address start, int size_in_bytes); | 293 static void DeallocateOldDataBlock(Address start, int size_in_bytes); |
| 294 static void DeallocateCodeBlock(Address start, int size_in_bytes); | 294 static void DeallocateCodeBlock(Address start, int size_in_bytes); |
| 295 static void DeallocateMapBlock(Address start, int size_in_bytes); | 295 static void DeallocateMapBlock(Address start, int size_in_bytes); |
| 296 static void DeallocateCellBlock(Address start, int size_in_bytes); |
| 296 | 297 |
| 297 // If we are not compacting the heap, we simply sweep the spaces except | 298 // If we are not compacting the heap, we simply sweep the spaces except |
| 298 // for the large object space, clearing mark bits and adding unmarked | 299 // for the large object space, clearing mark bits and adding unmarked |
| 299 // regions to each space's free list. | 300 // regions to each space's free list. |
| 300 static void SweepSpaces(); | 301 static void SweepSpaces(); |
| 301 | 302 |
| 302 // ----------------------------------------------------------------------- | 303 // ----------------------------------------------------------------------- |
| 303 // Phase 3: Updating pointers in live objects. | 304 // Phase 3: Updating pointers in live objects. |
| 304 // | 305 // |
| 305 // Before: Same as after phase 2 (compacting collection). | 306 // Before: Same as after phase 2 (compacting collection). |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 // address to target happens in the marking phase. | 346 // address to target happens in the marking phase. |
| 346 static int ConvertCodeICTargetToAddress(HeapObject* obj); | 347 static int ConvertCodeICTargetToAddress(HeapObject* obj); |
| 347 | 348 |
| 348 // Relocate a map object. | 349 // Relocate a map object. |
| 349 static int RelocateMapObject(HeapObject* obj); | 350 static int RelocateMapObject(HeapObject* obj); |
| 350 | 351 |
| 351 // Relocates an old object. | 352 // Relocates an old object. |
| 352 static int RelocateOldPointerObject(HeapObject* obj); | 353 static int RelocateOldPointerObject(HeapObject* obj); |
| 353 static int RelocateOldDataObject(HeapObject* obj); | 354 static int RelocateOldDataObject(HeapObject* obj); |
| 354 | 355 |
| 356 // Relocate a property cell object. |
| 357 static int RelocateCellObject(HeapObject* obj); |
| 358 |
| 355 // Helper function. | 359 // Helper function. |
| 356 static inline int RelocateOldNonCodeObject(HeapObject* obj, OldSpace* space); | 360 static inline int RelocateOldNonCodeObject(HeapObject* obj, PagedSpace* space)
; |
| 357 | 361 |
| 358 // Relocates an object in the code space. | 362 // Relocates an object in the code space. |
| 359 static int RelocateCodeObject(HeapObject* obj); | 363 static int RelocateCodeObject(HeapObject* obj); |
| 360 | 364 |
| 361 // Copy a new object. | 365 // Copy a new object. |
| 362 static int RelocateNewObject(HeapObject* obj); | 366 static int RelocateNewObject(HeapObject* obj); |
| 363 | 367 |
| 364 // ----------------------------------------------------------------------- | 368 // ----------------------------------------------------------------------- |
| 365 // Phase 5: Rebuilding remembered sets. | 369 // Phase 5: Rebuilding remembered sets. |
| 366 // | 370 // |
| (...skipping 19 matching lines...) Expand all Loading... |
| 386 | 390 |
| 387 // Number of live objects in Heap::old_data_space_. | 391 // Number of live objects in Heap::old_data_space_. |
| 388 static int live_old_data_objects_; | 392 static int live_old_data_objects_; |
| 389 | 393 |
| 390 // Number of live objects in Heap::code_space_. | 394 // Number of live objects in Heap::code_space_. |
| 391 static int live_code_objects_; | 395 static int live_code_objects_; |
| 392 | 396 |
| 393 // Number of live objects in Heap::map_space_. | 397 // Number of live objects in Heap::map_space_. |
| 394 static int live_map_objects_; | 398 static int live_map_objects_; |
| 395 | 399 |
| 400 // Number of live objects in Heap::cell_space_. |
| 401 static int live_cell_objects_; |
| 402 |
| 396 // Number of live objects in Heap::lo_space_. | 403 // Number of live objects in Heap::lo_space_. |
| 397 static int live_lo_objects_; | 404 static int live_lo_objects_; |
| 398 | 405 |
| 399 // Number of live bytes in this collection. | 406 // Number of live bytes in this collection. |
| 400 static int live_bytes_; | 407 static int live_bytes_; |
| 401 | 408 |
| 402 friend class MarkObjectVisitor; | 409 friend class MarkObjectVisitor; |
| 403 static void VisitObject(HeapObject* obj); | 410 static void VisitObject(HeapObject* obj); |
| 404 | 411 |
| 405 friend class UnmarkObjectVisitor; | 412 friend class UnmarkObjectVisitor; |
| 406 static void UnmarkObject(HeapObject* obj); | 413 static void UnmarkObject(HeapObject* obj); |
| 407 #endif | 414 #endif |
| 408 }; | 415 }; |
| 409 | 416 |
| 410 | 417 |
| 411 } } // namespace v8::internal | 418 } } // namespace v8::internal |
| 412 | 419 |
| 413 #endif // V8_MARK_COMPACT_H_ | 420 #endif // V8_MARK_COMPACT_H_ |
| OLD | NEW |