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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 virtual HeapObject* AllocateInNextPage(Page* current_page, | 986 virtual HeapObject* AllocateInNextPage(Page* current_page, |
987 int size_in_bytes) = 0; | 987 int size_in_bytes) = 0; |
988 | 988 |
989 // Slow path of AllocateRaw. This function is space-dependent. | 989 // Slow path of AllocateRaw. This function is space-dependent. |
990 virtual HeapObject* SlowAllocateRaw(int size_in_bytes) = 0; | 990 virtual HeapObject* SlowAllocateRaw(int size_in_bytes) = 0; |
991 | 991 |
992 // Slow path of MCAllocateRaw. | 992 // Slow path of MCAllocateRaw. |
993 HeapObject* SlowMCAllocateRaw(int size_in_bytes); | 993 HeapObject* SlowMCAllocateRaw(int size_in_bytes); |
994 | 994 |
995 #ifdef DEBUG | 995 #ifdef DEBUG |
| 996 // Returns the number of total pages in this space. |
| 997 int CountTotalPages(); |
| 998 |
996 void DoPrintRSet(const char* space_name); | 999 void DoPrintRSet(const char* space_name); |
997 #endif | 1000 #endif |
998 private: | 1001 private: |
999 // Returns the page of the allocation pointer. | 1002 // Returns the page of the allocation pointer. |
1000 Page* AllocationTopPage() { return TopPageOf(allocation_info_); } | 1003 Page* AllocationTopPage() { return TopPageOf(allocation_info_); } |
1001 | 1004 |
1002 // Returns a pointer to the page of the relocation pointer. | 1005 // Returns a pointer to the page of the relocation pointer. |
1003 Page* MCRelocationTopPage() { return TopPageOf(mc_forwarding_info_); } | 1006 Page* MCRelocationTopPage() { return TopPageOf(mc_forwarding_info_); } |
1004 | 1007 |
1005 #ifdef DEBUG | |
1006 // Returns the number of total pages in this space. | |
1007 int CountTotalPages(); | |
1008 #endif | |
1009 | |
1010 friend class PageIterator; | 1008 friend class PageIterator; |
1011 }; | 1009 }; |
1012 | 1010 |
1013 | 1011 |
1014 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 1012 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
1015 class NumberAndSizeInfo BASE_EMBEDDED { | 1013 class NumberAndSizeInfo BASE_EMBEDDED { |
1016 public: | 1014 public: |
1017 NumberAndSizeInfo() : number_(0), bytes_(0) {} | 1015 NumberAndSizeInfo() : number_(0), bytes_(0) {} |
1018 | 1016 |
1019 int number() const { return number_; } | 1017 int number() const { return number_; } |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1733 | 1731 |
1734 // Prepares for a mark-compact GC. | 1732 // Prepares for a mark-compact GC. |
1735 virtual void PrepareForMarkCompact(bool will_compact); | 1733 virtual void PrepareForMarkCompact(bool will_compact); |
1736 | 1734 |
1737 // Given an index, returns the page address. | 1735 // Given an index, returns the page address. |
1738 Address PageAddress(int page_index) { return page_addresses_[page_index]; } | 1736 Address PageAddress(int page_index) { return page_addresses_[page_index]; } |
1739 | 1737 |
1740 // Constants. | 1738 // Constants. |
1741 static const int kMaxMapPageIndex = (1 << MapWord::kMapPageIndexBits) - 1; | 1739 static const int kMaxMapPageIndex = (1 << MapWord::kMapPageIndexBits) - 1; |
1742 | 1740 |
| 1741 // Are map pointers encodable into map word? |
| 1742 bool MapPointersEncodable() { |
| 1743 if (!FLAG_use_big_map_space) { |
| 1744 ASSERT(CountTotalPages() <= kMaxMapPageIndex); |
| 1745 return true; |
| 1746 } |
| 1747 int n_of_pages = Capacity() / Page::kObjectAreaSize; |
| 1748 ASSERT(n_of_pages == CountTotalPages()); |
| 1749 return n_of_pages <= kMaxMapPageIndex; |
| 1750 } |
| 1751 |
1743 protected: | 1752 protected: |
1744 #ifdef DEBUG | 1753 #ifdef DEBUG |
1745 virtual void VerifyObject(HeapObject* obj); | 1754 virtual void VerifyObject(HeapObject* obj); |
1746 #endif | 1755 #endif |
1747 | 1756 |
1748 private: | 1757 private: |
1749 // An array of page start address in a map space. | 1758 // An array of page start address in a map space. |
1750 Address page_addresses_[kMaxMapPageIndex + 1]; | 1759 Address page_addresses_[kMaxMapPageIndex + 1]; |
1751 | 1760 |
1752 public: | 1761 public: |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1946 | 1955 |
1947 private: | 1956 private: |
1948 LargeObjectChunk* current_; | 1957 LargeObjectChunk* current_; |
1949 HeapObjectCallback size_func_; | 1958 HeapObjectCallback size_func_; |
1950 }; | 1959 }; |
1951 | 1960 |
1952 | 1961 |
1953 } } // namespace v8::internal | 1962 } } // namespace v8::internal |
1954 | 1963 |
1955 #endif // V8_SPACES_H_ | 1964 #endif // V8_SPACES_H_ |
OLD | NEW |