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 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 static const int kSize = Page::kPageSize / kRegionSize; | 1083 static const int kSize = Page::kPageSize / kRegionSize; |
1084 | 1084 |
1085 STATIC_ASSERT(Page::kPageSize % kRegionSize == 0); | 1085 STATIC_ASSERT(Page::kPageSize % kRegionSize == 0); |
1086 | 1086 |
1087 Address starts_[kSize]; | 1087 Address starts_[kSize]; |
1088 }; | 1088 }; |
1089 | 1089 |
1090 | 1090 |
1091 // ---------------------------------------------------------------------------- | 1091 // ---------------------------------------------------------------------------- |
1092 // A space acquires chunks of memory from the operating system. The memory | 1092 // A space acquires chunks of memory from the operating system. The memory |
1093 // allocator allocated and deallocates pages for the paged heap spaces and large | 1093 // allocator allocates and deallocates pages for the paged heap spaces and large |
1094 // pages for large object space. | 1094 // pages for large object space. |
1095 class MemoryAllocator { | 1095 class MemoryAllocator { |
1096 public: | 1096 public: |
1097 // Unmapper takes care of concurrently unmapping and uncommitting memory | 1097 // Unmapper takes care of concurrently unmapping and uncommitting memory |
1098 // chunks. | 1098 // chunks. |
1099 class Unmapper { | 1099 class Unmapper { |
1100 public: | 1100 public: |
1101 class UnmapFreeMemoryTask; | 1101 class UnmapFreeMemoryTask; |
1102 | 1102 |
1103 explicit Unmapper(MemoryAllocator* allocator) | 1103 explicit Unmapper(MemoryAllocator* allocator) |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 static size_t CodePageAreaSize() { | 1202 static size_t CodePageAreaSize() { |
1203 return CodePageAreaEndOffset() - CodePageAreaStartOffset(); | 1203 return CodePageAreaEndOffset() - CodePageAreaStartOffset(); |
1204 } | 1204 } |
1205 | 1205 |
1206 static size_t PageAreaSize(AllocationSpace space) { | 1206 static size_t PageAreaSize(AllocationSpace space) { |
1207 DCHECK_NE(LO_SPACE, space); | 1207 DCHECK_NE(LO_SPACE, space); |
1208 return (space == CODE_SPACE) ? CodePageAreaSize() | 1208 return (space == CODE_SPACE) ? CodePageAreaSize() |
1209 : Page::kAllocatableMemory; | 1209 : Page::kAllocatableMemory; |
1210 } | 1210 } |
1211 | 1211 |
| 1212 static intptr_t GetCommitPageSize(); |
| 1213 |
1212 explicit MemoryAllocator(Isolate* isolate); | 1214 explicit MemoryAllocator(Isolate* isolate); |
1213 | 1215 |
1214 // Initializes its internal bookkeeping structures. | 1216 // Initializes its internal bookkeeping structures. |
1215 // Max capacity of the total space and executable memory limit. | 1217 // Max capacity of the total space and executable memory limit. |
1216 bool SetUp(size_t max_capacity, size_t capacity_executable, | 1218 bool SetUp(size_t max_capacity, size_t capacity_executable, |
1217 size_t code_range_size); | 1219 size_t code_range_size); |
1218 | 1220 |
1219 void TearDown(); | 1221 void TearDown(); |
1220 | 1222 |
1221 // Allocates a Page from the allocator. AllocationMode is used to indicate | 1223 // Allocates a Page from the allocator. AllocationMode is used to indicate |
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2907 PageIterator old_iterator_; | 2909 PageIterator old_iterator_; |
2908 PageIterator code_iterator_; | 2910 PageIterator code_iterator_; |
2909 PageIterator map_iterator_; | 2911 PageIterator map_iterator_; |
2910 LargePageIterator lo_iterator_; | 2912 LargePageIterator lo_iterator_; |
2911 }; | 2913 }; |
2912 | 2914 |
2913 } // namespace internal | 2915 } // namespace internal |
2914 } // namespace v8 | 2916 } // namespace v8 |
2915 | 2917 |
2916 #endif // V8_HEAP_SPACES_H_ | 2918 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |