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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 static const int kSize = Page::kPageSize / kRegionSize; | 1109 static const int kSize = Page::kPageSize / kRegionSize; |
1110 | 1110 |
1111 STATIC_ASSERT(Page::kPageSize % kRegionSize == 0); | 1111 STATIC_ASSERT(Page::kPageSize % kRegionSize == 0); |
1112 | 1112 |
1113 Address starts_[kSize]; | 1113 Address starts_[kSize]; |
1114 }; | 1114 }; |
1115 | 1115 |
1116 | 1116 |
1117 // ---------------------------------------------------------------------------- | 1117 // ---------------------------------------------------------------------------- |
1118 // A space acquires chunks of memory from the operating system. The memory | 1118 // A space acquires chunks of memory from the operating system. The memory |
1119 // allocator allocated and deallocates pages for the paged heap spaces and large | 1119 // allocator allocates and deallocates pages for the paged heap spaces and large |
1120 // pages for large object space. | 1120 // pages for large object space. |
1121 class MemoryAllocator { | 1121 class MemoryAllocator { |
1122 public: | 1122 public: |
1123 // Unmapper takes care of concurrently unmapping and uncommitting memory | 1123 // Unmapper takes care of concurrently unmapping and uncommitting memory |
1124 // chunks. | 1124 // chunks. |
1125 class Unmapper { | 1125 class Unmapper { |
1126 public: | 1126 public: |
1127 class UnmapFreeMemoryTask; | 1127 class UnmapFreeMemoryTask; |
1128 | 1128 |
1129 explicit Unmapper(MemoryAllocator* allocator) | 1129 explicit Unmapper(MemoryAllocator* allocator) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 static size_t CodePageAreaSize() { | 1227 static size_t CodePageAreaSize() { |
1228 return CodePageAreaEndOffset() - CodePageAreaStartOffset(); | 1228 return CodePageAreaEndOffset() - CodePageAreaStartOffset(); |
1229 } | 1229 } |
1230 | 1230 |
1231 static size_t PageAreaSize(AllocationSpace space) { | 1231 static size_t PageAreaSize(AllocationSpace space) { |
1232 DCHECK_NE(LO_SPACE, space); | 1232 DCHECK_NE(LO_SPACE, space); |
1233 return (space == CODE_SPACE) ? CodePageAreaSize() | 1233 return (space == CODE_SPACE) ? CodePageAreaSize() |
1234 : Page::kAllocatableMemory; | 1234 : Page::kAllocatableMemory; |
1235 } | 1235 } |
1236 | 1236 |
| 1237 static intptr_t GetCommitPageSize(); |
| 1238 |
1237 explicit MemoryAllocator(Isolate* isolate); | 1239 explicit MemoryAllocator(Isolate* isolate); |
1238 | 1240 |
1239 // Initializes its internal bookkeeping structures. | 1241 // Initializes its internal bookkeeping structures. |
1240 // Max capacity of the total space and executable memory limit. | 1242 // Max capacity of the total space and executable memory limit. |
1241 bool SetUp(intptr_t max_capacity, intptr_t capacity_executable, | 1243 bool SetUp(intptr_t max_capacity, intptr_t capacity_executable, |
1242 intptr_t code_range_size); | 1244 intptr_t code_range_size); |
1243 | 1245 |
1244 void TearDown(); | 1246 void TearDown(); |
1245 | 1247 |
1246 // Allocates a Page from the allocator. AllocationMode is used to indicate | 1248 // Allocates a Page from the allocator. AllocationMode is used to indicate |
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2925 PageIterator old_iterator_; | 2927 PageIterator old_iterator_; |
2926 PageIterator code_iterator_; | 2928 PageIterator code_iterator_; |
2927 PageIterator map_iterator_; | 2929 PageIterator map_iterator_; |
2928 LargePageIterator lo_iterator_; | 2930 LargePageIterator lo_iterator_; |
2929 }; | 2931 }; |
2930 | 2932 |
2931 } // namespace internal | 2933 } // namespace internal |
2932 } // namespace v8 | 2934 } // namespace v8 |
2933 | 2935 |
2934 #endif // V8_HEAP_SPACES_H_ | 2936 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |