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