| 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 19 matching lines...) Expand all Loading... |
| 30 // scavenger implements Cheney's copying algorithm. The old generation is | 30 // scavenger implements Cheney's copying algorithm. The old generation is |
| 31 // separated into a map space and an old object space. The map space contains | 31 // separated into a map space and an old object space. The map space contains |
| 32 // all (and only) map objects, the rest of old objects go into the old space. | 32 // all (and only) map objects, the rest of old objects go into the old space. |
| 33 // The old generation is collected by a mark-sweep-compact collector. | 33 // The old generation is collected by a mark-sweep-compact collector. |
| 34 // | 34 // |
| 35 // The semispaces of the young generation are contiguous. The old and map | 35 // The semispaces of the young generation are contiguous. The old and map |
| 36 // spaces consists of a list of pages. A page has a page header and an object | 36 // spaces consists of a list of pages. A page has a page header and an object |
| 37 // area. | 37 // area. |
| 38 // | 38 // |
| 39 // There is a separate large object space for objects larger than | 39 // There is a separate large object space for objects larger than |
| 40 // Page::kMaxHeapObjectSize, so that they do not have to move during | 40 // Page::kMaxRegularHeapObjectSize, so that they do not have to move during |
| 41 // collection. The large object space is paged. Pages in large object space | 41 // collection. The large object space is paged. Pages in large object space |
| 42 // may be larger than the page size. | 42 // may be larger than the page size. |
| 43 // | 43 // |
| 44 // A store-buffer based write barrier is used to keep track of intergenerational | 44 // A store-buffer based write barrier is used to keep track of intergenerational |
| 45 // references. See heap/store-buffer.h. | 45 // references. See heap/store-buffer.h. |
| 46 // | 46 // |
| 47 // During scavenges and mark-sweep collections we sometimes (after a store | 47 // During scavenges and mark-sweep collections we sometimes (after a store |
| 48 // buffer overflow) iterate intergenerational pointers without decoding heap | 48 // buffer overflow) iterate intergenerational pointers without decoding heap |
| 49 // object maps so if the page belongs to old space or large object space | 49 // object maps so if the page belongs to old space or large object space |
| 50 // it is essential to guarantee that the page does not contain any | 50 // it is essential to guarantee that the page does not contain any |
| (...skipping 2938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2989 // Do map space compaction if there is a page gap. | 2989 // Do map space compaction if there is a page gap. |
| 2990 int CompactionThreshold() { | 2990 int CompactionThreshold() { |
| 2991 return kMapsPerPage * (max_map_space_pages_ - 1); | 2991 return kMapsPerPage * (max_map_space_pages_ - 1); |
| 2992 } | 2992 } |
| 2993 | 2993 |
| 2994 const int max_map_space_pages_; | 2994 const int max_map_space_pages_; |
| 2995 }; | 2995 }; |
| 2996 | 2996 |
| 2997 | 2997 |
| 2998 // ----------------------------------------------------------------------------- | 2998 // ----------------------------------------------------------------------------- |
| 2999 // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by | 2999 // Large objects ( > Page::kMaxRegularHeapObjectSize ) are allocated and |
| 3000 // the large object space. A large object is allocated from OS heap with | 3000 // managed by the large object space. A large object is allocated from OS |
| 3001 // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). | 3001 // heap with extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). |
| 3002 // A large object always starts at Page::kObjectStartOffset to a page. | 3002 // A large object always starts at Page::kObjectStartOffset to a page. |
| 3003 // Large objects do not move during garbage collections. | 3003 // Large objects do not move during garbage collections. |
| 3004 | 3004 |
| 3005 class LargeObjectSpace : public Space { | 3005 class LargeObjectSpace : public Space { |
| 3006 public: | 3006 public: |
| 3007 LargeObjectSpace(Heap* heap, AllocationSpace id); | 3007 LargeObjectSpace(Heap* heap, AllocationSpace id); |
| 3008 virtual ~LargeObjectSpace(); | 3008 virtual ~LargeObjectSpace(); |
| 3009 | 3009 |
| 3010 // Initializes internal data structures. | 3010 // Initializes internal data structures. |
| 3011 bool SetUp(); | 3011 bool SetUp(); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3127 count = 0; | 3127 count = 0; |
| 3128 } | 3128 } |
| 3129 // Must be small, since an iteration is used for lookup. | 3129 // Must be small, since an iteration is used for lookup. |
| 3130 static const int kMaxComments = 64; | 3130 static const int kMaxComments = 64; |
| 3131 }; | 3131 }; |
| 3132 #endif | 3132 #endif |
| 3133 } // namespace internal | 3133 } // namespace internal |
| 3134 } // namespace v8 | 3134 } // namespace v8 |
| 3135 | 3135 |
| 3136 #endif // V8_HEAP_SPACES_H_ | 3136 #endif // V8_HEAP_SPACES_H_ |
| OLD | NEW |