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 "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/atomic-utils.h" | 9 #include "src/atomic-utils.h" |
10 #include "src/base/atomicops.h" | 10 #include "src/base/atomicops.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 #define DCHECK_PAGE_ALIGNED(address) \ | 80 #define DCHECK_PAGE_ALIGNED(address) \ |
81 DCHECK((OffsetFrom(address) & Page::kPageAlignmentMask) == 0) | 81 DCHECK((OffsetFrom(address) & Page::kPageAlignmentMask) == 0) |
82 | 82 |
83 #define DCHECK_OBJECT_ALIGNED(address) \ | 83 #define DCHECK_OBJECT_ALIGNED(address) \ |
84 DCHECK((OffsetFrom(address) & kObjectAlignmentMask) == 0) | 84 DCHECK((OffsetFrom(address) & kObjectAlignmentMask) == 0) |
85 | 85 |
86 #define DCHECK_OBJECT_SIZE(size) \ | 86 #define DCHECK_OBJECT_SIZE(size) \ |
87 DCHECK((0 < size) && (size <= Page::kMaxRegularHeapObjectSize)) | 87 DCHECK((0 < size) && (size <= Page::kMaxRegularHeapObjectSize)) |
88 | 88 |
89 #define DCHECK_CODEOBJECT_SIZE(size, code_space) \ | |
90 DCHECK((0 < size) && (size <= code_space->AreaSize())) | |
91 | |
92 #define DCHECK_PAGE_OFFSET(offset) \ | 89 #define DCHECK_PAGE_OFFSET(offset) \ |
93 DCHECK((Page::kObjectStartOffset <= offset) && (offset <= Page::kPageSize)) | 90 DCHECK((Page::kObjectStartOffset <= offset) && (offset <= Page::kPageSize)) |
94 | 91 |
95 #define DCHECK_MAP_PAGE_INDEX(index) \ | 92 #define DCHECK_MAP_PAGE_INDEX(index) \ |
96 DCHECK((0 <= index) && (index <= MapSpace::kMaxMapPageIndex)) | 93 DCHECK((0 <= index) && (index <= MapSpace::kMaxMapPageIndex)) |
97 | 94 |
98 class AllocationInfo; | 95 class AllocationInfo; |
99 class CompactionSpace; | 96 class CompactionSpace; |
100 class FreeList; | 97 class FreeList; |
101 class MemoryAllocator; | 98 class MemoryAllocator; |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 // --------------------------------------------------------------------- | 833 // --------------------------------------------------------------------- |
837 | 834 |
838 // Page size in bytes. This must be a multiple of the OS page size. | 835 // Page size in bytes. This must be a multiple of the OS page size. |
839 static const int kPageSize = 1 << kPageSizeBits; | 836 static const int kPageSize = 1 << kPageSizeBits; |
840 | 837 |
841 // Maximum object size that gets allocated into regular pages. Objects larger | 838 // Maximum object size that gets allocated into regular pages. Objects larger |
842 // than that size are allocated in large object space and are never moved in | 839 // than that size are allocated in large object space and are never moved in |
843 // memory. This also applies to new space allocation, since objects are never | 840 // memory. This also applies to new space allocation, since objects are never |
844 // migrated from new space to large object space. Takes double alignment into | 841 // migrated from new space to large object space. Takes double alignment into |
845 // account. | 842 // account. |
846 static const int kMaxRegularHeapObjectSize = 128 * KB * (i::kPointerSize / 4); | 843 static const int kMaxRegularHeapObjectSize = kPageSize - kObjectStartOffset; |
847 | 844 |
848 static const int kAllocatableMemory = kPageSize - kObjectStartOffset; | 845 static const int kAllocatableMemory = kPageSize - kObjectStartOffset; |
849 | 846 |
850 // Page size mask. | 847 // Page size mask. |
851 static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1; | 848 static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1; |
852 | 849 |
853 inline void ClearGCFields(); | 850 inline void ClearGCFields(); |
854 | 851 |
855 static inline Page* Initialize(Heap* heap, MemoryChunk* chunk, | 852 static inline Page* Initialize(Heap* heap, MemoryChunk* chunk, |
856 Executability executable, PagedSpace* owner); | 853 Executability executable, PagedSpace* owner); |
(...skipping 2155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3012 count = 0; | 3009 count = 0; |
3013 } | 3010 } |
3014 // Must be small, since an iteration is used for lookup. | 3011 // Must be small, since an iteration is used for lookup. |
3015 static const int kMaxComments = 64; | 3012 static const int kMaxComments = 64; |
3016 }; | 3013 }; |
3017 #endif | 3014 #endif |
3018 } // namespace internal | 3015 } // namespace internal |
3019 } // namespace v8 | 3016 } // namespace v8 |
3020 | 3017 |
3021 #endif // V8_HEAP_SPACES_H_ | 3018 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |