| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HEAP_SPACES_H_ | 5 #ifndef V8_HEAP_SPACES_H_ |
| 6 #define V8_HEAP_SPACES_H_ | 6 #define V8_HEAP_SPACES_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 2802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2813 | 2813 |
| 2814 // Approximate amount of physical memory committed for this space. | 2814 // Approximate amount of physical memory committed for this space. |
| 2815 size_t CommittedPhysicalMemory() override; | 2815 size_t CommittedPhysicalMemory() override; |
| 2816 | 2816 |
| 2817 int PageCount() { return page_count_; } | 2817 int PageCount() { return page_count_; } |
| 2818 | 2818 |
| 2819 // Finds an object for a given address, returns a Smi if it is not found. | 2819 // Finds an object for a given address, returns a Smi if it is not found. |
| 2820 // The function iterates through all objects in this space, may be slow. | 2820 // The function iterates through all objects in this space, may be slow. |
| 2821 Object* FindObject(Address a); | 2821 Object* FindObject(Address a); |
| 2822 | 2822 |
| 2823 // Takes the chunk_map_mutex_ and calls FindPage after that. |
| 2824 LargePage* FindPageThreadSafe(Address a); |
| 2825 |
| 2823 // Finds a large object page containing the given address, returns NULL | 2826 // Finds a large object page containing the given address, returns NULL |
| 2824 // if such a page doesn't exist. | 2827 // if such a page doesn't exist. |
| 2825 LargePage* FindPage(Address a); | 2828 LargePage* FindPage(Address a); |
| 2826 | 2829 |
| 2827 // Clears the marking state of live objects. | 2830 // Clears the marking state of live objects. |
| 2828 void ClearMarkingStateOfLiveObjects(); | 2831 void ClearMarkingStateOfLiveObjects(); |
| 2829 | 2832 |
| 2830 // Frees unmarked objects. | 2833 // Frees unmarked objects. |
| 2831 void FreeUnmarkedObjects(); | 2834 void FreeUnmarkedObjects(); |
| 2832 | 2835 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2863 void Print() override; | 2866 void Print() override; |
| 2864 void ReportStatistics(); | 2867 void ReportStatistics(); |
| 2865 #endif | 2868 #endif |
| 2866 | 2869 |
| 2867 private: | 2870 private: |
| 2868 // The head of the linked list of large object chunks. | 2871 // The head of the linked list of large object chunks. |
| 2869 LargePage* first_page_; | 2872 LargePage* first_page_; |
| 2870 size_t size_; // allocated bytes | 2873 size_t size_; // allocated bytes |
| 2871 int page_count_; // number of chunks | 2874 int page_count_; // number of chunks |
| 2872 size_t objects_size_; // size of objects | 2875 size_t objects_size_; // size of objects |
| 2876 // The chunk_map_mutex_ has to be used when the chunk map is accessed |
| 2877 // concurrently. |
| 2878 base::Mutex chunk_map_mutex_; |
| 2873 // Map MemoryChunk::kAlignment-aligned chunks to large pages covering them | 2879 // Map MemoryChunk::kAlignment-aligned chunks to large pages covering them |
| 2874 base::HashMap chunk_map_; | 2880 base::HashMap chunk_map_; |
| 2875 | 2881 |
| 2876 friend class LargeObjectIterator; | 2882 friend class LargeObjectIterator; |
| 2877 }; | 2883 }; |
| 2878 | 2884 |
| 2879 | 2885 |
| 2880 class LargeObjectIterator : public ObjectIterator { | 2886 class LargeObjectIterator : public ObjectIterator { |
| 2881 public: | 2887 public: |
| 2882 explicit LargeObjectIterator(LargeObjectSpace* space); | 2888 explicit LargeObjectIterator(LargeObjectSpace* space); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2909 PageIterator old_iterator_; | 2915 PageIterator old_iterator_; |
| 2910 PageIterator code_iterator_; | 2916 PageIterator code_iterator_; |
| 2911 PageIterator map_iterator_; | 2917 PageIterator map_iterator_; |
| 2912 LargePageIterator lo_iterator_; | 2918 LargePageIterator lo_iterator_; |
| 2913 }; | 2919 }; |
| 2914 | 2920 |
| 2915 } // namespace internal | 2921 } // namespace internal |
| 2916 } // namespace v8 | 2922 } // namespace v8 |
| 2917 | 2923 |
| 2918 #endif // V8_HEAP_SPACES_H_ | 2924 #endif // V8_HEAP_SPACES_H_ |
| OLD | NEW |