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 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 | 1032 |
1033 virtual bool ReserveSpace(int bytes); | 1033 virtual bool ReserveSpace(int bytes); |
1034 | 1034 |
1035 // Used by ReserveSpace. | 1035 // Used by ReserveSpace. |
1036 virtual void PutRestOfCurrentPageOnFreeList(Page* current_page) = 0; | 1036 virtual void PutRestOfCurrentPageOnFreeList(Page* current_page) = 0; |
1037 | 1037 |
1038 // Free all pages in range from prev (exclusive) to last (inclusive). | 1038 // Free all pages in range from prev (exclusive) to last (inclusive). |
1039 // Freed pages are moved to the end of page list. | 1039 // Freed pages are moved to the end of page list. |
1040 void FreePages(Page* prev, Page* last); | 1040 void FreePages(Page* prev, Page* last); |
1041 | 1041 |
| 1042 // Deallocates a block. |
| 1043 virtual void DeallocateBlock(Address start, |
| 1044 int size_in_bytes, |
| 1045 bool add_to_freelist) = 0; |
| 1046 |
1042 // Set space allocation info. | 1047 // Set space allocation info. |
1043 void SetTop(Address top) { | 1048 void SetTop(Address top) { |
1044 allocation_info_.top = top; | 1049 allocation_info_.top = top; |
1045 allocation_info_.limit = PageAllocationLimit(Page::FromAllocationTop(top)); | 1050 allocation_info_.limit = PageAllocationLimit(Page::FromAllocationTop(top)); |
1046 } | 1051 } |
1047 | 1052 |
1048 // --------------------------------------------------------------------------- | 1053 // --------------------------------------------------------------------------- |
1049 // Mark-compact collection support functions | 1054 // Mark-compact collection support functions |
1050 | 1055 |
1051 // Set the relocation point to the beginning of the space. | 1056 // Set the relocation point to the beginning of the space. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 | 1095 |
1091 // Report code object related statistics | 1096 // Report code object related statistics |
1092 void CollectCodeStatistics(); | 1097 void CollectCodeStatistics(); |
1093 static void ReportCodeStatistics(); | 1098 static void ReportCodeStatistics(); |
1094 static void ResetCodeStatistics(); | 1099 static void ResetCodeStatistics(); |
1095 #endif | 1100 #endif |
1096 | 1101 |
1097 // Returns the page of the allocation pointer. | 1102 // Returns the page of the allocation pointer. |
1098 Page* AllocationTopPage() { return TopPageOf(allocation_info_); } | 1103 Page* AllocationTopPage() { return TopPageOf(allocation_info_); } |
1099 | 1104 |
| 1105 void RelinkPageListInChunkOrder(bool deallocate_blocks); |
| 1106 |
1100 protected: | 1107 protected: |
1101 // Maximum capacity of this space. | 1108 // Maximum capacity of this space. |
1102 int max_capacity_; | 1109 int max_capacity_; |
1103 | 1110 |
1104 // Accounting information for this space. | 1111 // Accounting information for this space. |
1105 AllocationStats accounting_stats_; | 1112 AllocationStats accounting_stats_; |
1106 | 1113 |
1107 // The first page in this space. | 1114 // The first page in this space. |
1108 Page* first_page_; | 1115 Page* first_page_; |
1109 | 1116 |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1807 // no attempt to add area to free list is made. | 1814 // no attempt to add area to free list is made. |
1808 void Free(Address start, int size_in_bytes, bool add_to_freelist) { | 1815 void Free(Address start, int size_in_bytes, bool add_to_freelist) { |
1809 accounting_stats_.DeallocateBytes(size_in_bytes); | 1816 accounting_stats_.DeallocateBytes(size_in_bytes); |
1810 | 1817 |
1811 if (add_to_freelist) { | 1818 if (add_to_freelist) { |
1812 int wasted_bytes = free_list_.Free(start, size_in_bytes); | 1819 int wasted_bytes = free_list_.Free(start, size_in_bytes); |
1813 accounting_stats_.WasteBytes(wasted_bytes); | 1820 accounting_stats_.WasteBytes(wasted_bytes); |
1814 } | 1821 } |
1815 } | 1822 } |
1816 | 1823 |
| 1824 virtual void DeallocateBlock(Address start, |
| 1825 int size_in_bytes, |
| 1826 bool add_to_freelist); |
| 1827 |
1817 // Prepare for full garbage collection. Resets the relocation pointer and | 1828 // Prepare for full garbage collection. Resets the relocation pointer and |
1818 // clears the free list. | 1829 // clears the free list. |
1819 virtual void PrepareForMarkCompact(bool will_compact); | 1830 virtual void PrepareForMarkCompact(bool will_compact); |
1820 | 1831 |
1821 // Updates the allocation pointer to the relocation top after a mark-compact | 1832 // Updates the allocation pointer to the relocation top after a mark-compact |
1822 // collection. | 1833 // collection. |
1823 virtual void MCCommitRelocationInfo(); | 1834 virtual void MCCommitRelocationInfo(); |
1824 | 1835 |
1825 virtual void PutRestOfCurrentPageOnFreeList(Page* current_page); | 1836 virtual void PutRestOfCurrentPageOnFreeList(Page* current_page); |
1826 | 1837 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 | 1892 |
1882 // Prepares for a mark-compact GC. | 1893 // Prepares for a mark-compact GC. |
1883 virtual void PrepareForMarkCompact(bool will_compact); | 1894 virtual void PrepareForMarkCompact(bool will_compact); |
1884 | 1895 |
1885 // Updates the allocation pointer to the relocation top after a mark-compact | 1896 // Updates the allocation pointer to the relocation top after a mark-compact |
1886 // collection. | 1897 // collection. |
1887 virtual void MCCommitRelocationInfo(); | 1898 virtual void MCCommitRelocationInfo(); |
1888 | 1899 |
1889 virtual void PutRestOfCurrentPageOnFreeList(Page* current_page); | 1900 virtual void PutRestOfCurrentPageOnFreeList(Page* current_page); |
1890 | 1901 |
| 1902 virtual void DeallocateBlock(Address start, |
| 1903 int size_in_bytes, |
| 1904 bool add_to_freelist); |
1891 #ifdef DEBUG | 1905 #ifdef DEBUG |
1892 // Reports statistic info of the space | 1906 // Reports statistic info of the space |
1893 void ReportStatistics(); | 1907 void ReportStatistics(); |
1894 #endif | 1908 #endif |
1895 | 1909 |
1896 protected: | 1910 protected: |
1897 // Virtual function in the superclass. Slow path of AllocateRaw. | 1911 // Virtual function in the superclass. Slow path of AllocateRaw. |
1898 HeapObject* SlowAllocateRaw(int size_in_bytes); | 1912 HeapObject* SlowAllocateRaw(int size_in_bytes); |
1899 | 1913 |
1900 // Virtual function in the superclass. Allocate linearly at the start of | 1914 // Virtual function in the superclass. Allocate linearly at the start of |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 | 2216 |
2203 private: | 2217 private: |
2204 LargeObjectChunk* current_; | 2218 LargeObjectChunk* current_; |
2205 HeapObjectCallback size_func_; | 2219 HeapObjectCallback size_func_; |
2206 }; | 2220 }; |
2207 | 2221 |
2208 | 2222 |
2209 } } // namespace v8::internal | 2223 } } // namespace v8::internal |
2210 | 2224 |
2211 #endif // V8_SPACES_H_ | 2225 #endif // V8_SPACES_H_ |
OLD | NEW |