| OLD | NEW |
| 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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 void RefillMarkingDeque(); | 662 void RefillMarkingDeque(); |
| 663 | 663 |
| 664 // After reachable maps have been marked process per context object | 664 // After reachable maps have been marked process per context object |
| 665 // literal map caches removing unmarked entries. | 665 // literal map caches removing unmarked entries. |
| 666 void ProcessMapCaches(); | 666 void ProcessMapCaches(); |
| 667 | 667 |
| 668 // Callback function for telling whether the object *p is an unmarked | 668 // Callback function for telling whether the object *p is an unmarked |
| 669 // heap object. | 669 // heap object. |
| 670 static bool IsUnmarkedHeapObject(Object** p); | 670 static bool IsUnmarkedHeapObject(Object** p); |
| 671 | 671 |
| 672 #ifdef DEBUG | |
| 673 void UpdateLiveObjectCount(HeapObject* obj); | |
| 674 #endif | |
| 675 | |
| 676 // Map transitions from a live map to a dead map must be killed. | 672 // Map transitions from a live map to a dead map must be killed. |
| 677 // We replace them with a null descriptor, with the same key. | 673 // We replace them with a null descriptor, with the same key. |
| 678 void ClearNonLiveTransitions(); | 674 void ClearNonLiveTransitions(); |
| 679 | 675 |
| 680 // Marking detaches initial maps from SharedFunctionInfo objects | 676 // Marking detaches initial maps from SharedFunctionInfo objects |
| 681 // to make this reference weak. We need to reattach initial maps | 677 // to make this reference weak. We need to reattach initial maps |
| 682 // back after collection. This is either done during | 678 // back after collection. This is either done during |
| 683 // ClearNonLiveTransitions pass or by calling this function. | 679 // ClearNonLiveTransitions pass or by calling this function. |
| 684 void ReattachInitialMaps(); | 680 void ReattachInitialMaps(); |
| 685 | 681 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 713 | 709 |
| 714 void EvacuateLiveObjectsFromPage(Page* p); | 710 void EvacuateLiveObjectsFromPage(Page* p); |
| 715 | 711 |
| 716 void EvacuatePages(); | 712 void EvacuatePages(); |
| 717 | 713 |
| 718 void EvacuateNewSpaceAndCandidates(); | 714 void EvacuateNewSpaceAndCandidates(); |
| 719 | 715 |
| 720 void SweepSpace(PagedSpace* space, SweeperType sweeper); | 716 void SweepSpace(PagedSpace* space, SweeperType sweeper); |
| 721 | 717 |
| 722 #ifdef DEBUG | 718 #ifdef DEBUG |
| 723 // ----------------------------------------------------------------------- | |
| 724 // Debugging variables, functions and classes | |
| 725 // Counters used for debugging the marking phase of mark-compact or | |
| 726 // mark-sweep collection. | |
| 727 | |
| 728 // Size of live objects in Heap::to_space_. | |
| 729 int live_young_objects_size_; | |
| 730 | |
| 731 // Size of live objects in Heap::old_pointer_space_. | |
| 732 int live_old_pointer_objects_size_; | |
| 733 | |
| 734 // Size of live objects in Heap::old_data_space_. | |
| 735 int live_old_data_objects_size_; | |
| 736 | |
| 737 // Size of live objects in Heap::code_space_. | |
| 738 int live_code_objects_size_; | |
| 739 | |
| 740 // Size of live objects in Heap::map_space_. | |
| 741 int live_map_objects_size_; | |
| 742 | |
| 743 // Size of live objects in Heap::cell_space_. | |
| 744 int live_cell_objects_size_; | |
| 745 | |
| 746 // Size of live objects in Heap::lo_space_. | |
| 747 int live_lo_objects_size_; | |
| 748 | |
| 749 // Number of live bytes in this collection. | |
| 750 int live_bytes_; | |
| 751 | |
| 752 friend class MarkObjectVisitor; | 719 friend class MarkObjectVisitor; |
| 753 static void VisitObject(HeapObject* obj); | 720 static void VisitObject(HeapObject* obj); |
| 754 | 721 |
| 755 friend class UnmarkObjectVisitor; | 722 friend class UnmarkObjectVisitor; |
| 756 static void UnmarkObject(HeapObject* obj); | 723 static void UnmarkObject(HeapObject* obj); |
| 757 #endif | 724 #endif |
| 758 | 725 |
| 759 Heap* heap_; | 726 Heap* heap_; |
| 760 MarkingDeque marking_deque_; | 727 MarkingDeque marking_deque_; |
| 761 CodeFlusher* code_flusher_; | 728 CodeFlusher* code_flusher_; |
| 762 Object* encountered_weak_maps_; | 729 Object* encountered_weak_maps_; |
| 763 | 730 |
| 764 List<Page*> evacuation_candidates_; | 731 List<Page*> evacuation_candidates_; |
| 765 List<Code*> invalidated_code_; | 732 List<Code*> invalidated_code_; |
| 766 | 733 |
| 767 friend class Heap; | 734 friend class Heap; |
| 768 }; | 735 }; |
| 769 | 736 |
| 770 | 737 |
| 771 const char* AllocationSpaceName(AllocationSpace space); | 738 const char* AllocationSpaceName(AllocationSpace space); |
| 772 | 739 |
| 773 } } // namespace v8::internal | 740 } } // namespace v8::internal |
| 774 | 741 |
| 775 #endif // V8_MARK_COMPACT_H_ | 742 #endif // V8_MARK_COMPACT_H_ |
| OLD | NEW |