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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 static const int kObjectStartOffset = | 360 static const int kObjectStartOffset = |
361 kBodyOffset - 1 + | 361 kBodyOffset - 1 + |
362 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment); | 362 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment); |
363 | 363 |
364 // Page size in bytes. This must be a multiple of the OS page size. | 364 // Page size in bytes. This must be a multiple of the OS page size. |
365 static const int kPageSize = 1 << kPageSizeBits; | 365 static const int kPageSize = 1 << kPageSizeBits; |
366 static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1; | 366 static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1; |
367 | 367 |
368 static const int kAllocatableMemory = kPageSize - kObjectStartOffset; | 368 static const int kAllocatableMemory = kPageSize - kObjectStartOffset; |
369 | 369 |
370 static inline void IncrementLiveBytesFromMutator(HeapObject* object, int by); | 370 static inline void IncrementLiveBytes(HeapObject* object, int by); |
371 static inline void IncrementLiveBytesFromGC(HeapObject* object, int by); | |
372 | 371 |
373 // Only works if the pointer is in the first kPageSize of the MemoryChunk. | 372 // Only works if the pointer is in the first kPageSize of the MemoryChunk. |
374 static MemoryChunk* FromAddress(Address a) { | 373 static MemoryChunk* FromAddress(Address a) { |
375 return reinterpret_cast<MemoryChunk*>(OffsetFrom(a) & ~kAlignmentMask); | 374 return reinterpret_cast<MemoryChunk*>(OffsetFrom(a) & ~kAlignmentMask); |
376 } | 375 } |
377 | 376 |
378 static inline MemoryChunk* FromAnyPointerAddress(Heap* heap, Address addr); | 377 static inline MemoryChunk* FromAnyPointerAddress(Heap* heap, Address addr); |
379 | 378 |
380 static inline void UpdateHighWaterMark(Address mark) { | 379 static inline void UpdateHighWaterMark(Address mark) { |
381 if (mark == nullptr) return; | 380 if (mark == nullptr) return; |
(...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 allocation_info_.Reset(top, limit); | 2026 allocation_info_.Reset(top, limit); |
2028 } | 2027 } |
2029 | 2028 |
2030 void SetAllocationInfo(Address top, Address limit); | 2029 void SetAllocationInfo(Address top, Address limit); |
2031 | 2030 |
2032 // Empty space allocation info, returning unused area to free list. | 2031 // Empty space allocation info, returning unused area to free list. |
2033 void EmptyAllocationInfo(); | 2032 void EmptyAllocationInfo(); |
2034 | 2033 |
2035 void MarkAllocationInfoBlack(); | 2034 void MarkAllocationInfoBlack(); |
2036 | 2035 |
2037 void Allocate(int bytes) { accounting_stats_.AllocateBytes(bytes); } | 2036 void AccountAllocatedBytes(size_t bytes) { |
| 2037 accounting_stats_.AllocateBytes(bytes); |
| 2038 } |
2038 | 2039 |
2039 void IncreaseCapacity(size_t bytes); | 2040 void IncreaseCapacity(size_t bytes); |
2040 | 2041 |
2041 // Releases an unused page and shrinks the space. | 2042 // Releases an unused page and shrinks the space. |
2042 void ReleasePage(Page* page); | 2043 void ReleasePage(Page* page); |
2043 | 2044 |
2044 // The dummy page that anchors the linked list of pages. | 2045 // The dummy page that anchors the linked list of pages. |
2045 Page* anchor() { return &anchor_; } | 2046 Page* anchor() { return &anchor_; } |
2046 | 2047 |
2047 | 2048 |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2915 PageIterator old_iterator_; | 2916 PageIterator old_iterator_; |
2916 PageIterator code_iterator_; | 2917 PageIterator code_iterator_; |
2917 PageIterator map_iterator_; | 2918 PageIterator map_iterator_; |
2918 LargePageIterator lo_iterator_; | 2919 LargePageIterator lo_iterator_; |
2919 }; | 2920 }; |
2920 | 2921 |
2921 } // namespace internal | 2922 } // namespace internal |
2922 } // namespace v8 | 2923 } // namespace v8 |
2923 | 2924 |
2924 #endif // V8_HEAP_SPACES_H_ | 2925 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |