| 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/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // scavenger implements Cheney's copying algorithm. The old generation is | 27 // scavenger implements Cheney's copying algorithm. The old generation is |
| 28 // separated into a map space and an old object space. The map space contains | 28 // separated into a map space and an old object space. The map space contains |
| 29 // all (and only) map objects, the rest of old objects go into the old space. | 29 // all (and only) map objects, the rest of old objects go into the old space. |
| 30 // The old generation is collected by a mark-sweep-compact collector. | 30 // The old generation is collected by a mark-sweep-compact collector. |
| 31 // | 31 // |
| 32 // The semispaces of the young generation are contiguous. The old and map | 32 // The semispaces of the young generation are contiguous. The old and map |
| 33 // spaces consists of a list of pages. A page has a page header and an object | 33 // spaces consists of a list of pages. A page has a page header and an object |
| 34 // area. | 34 // area. |
| 35 // | 35 // |
| 36 // There is a separate large object space for objects larger than | 36 // There is a separate large object space for objects larger than |
| 37 // Page::kMaxHeapObjectSize, so that they do not have to move during | 37 // Page::kMaxRegularHeapObjectSize, so that they do not have to move during |
| 38 // collection. The large object space is paged. Pages in large object space | 38 // collection. The large object space is paged. Pages in large object space |
| 39 // may be larger than the page size. | 39 // may be larger than the page size. |
| 40 // | 40 // |
| 41 // A store-buffer based write barrier is used to keep track of intergenerational | 41 // A store-buffer based write barrier is used to keep track of intergenerational |
| 42 // references. See heap/store-buffer.h. | 42 // references. See heap/store-buffer.h. |
| 43 // | 43 // |
| 44 // During scavenges and mark-sweep collections we sometimes (after a store | 44 // During scavenges and mark-sweep collections we sometimes (after a store |
| 45 // buffer overflow) iterate intergenerational pointers without decoding heap | 45 // buffer overflow) iterate intergenerational pointers without decoding heap |
| 46 // object maps so if the page belongs to old pointer space or large object | 46 // object maps so if the page belongs to old pointer space or large object |
| 47 // space it is essential to guarantee that the page does not contain any | 47 // space it is essential to guarantee that the page does not contain any |
| (...skipping 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2685 | 2685 |
| 2686 protected: | 2686 protected: |
| 2687 virtual void VerifyObject(HeapObject* obj); | 2687 virtual void VerifyObject(HeapObject* obj); |
| 2688 | 2688 |
| 2689 public: | 2689 public: |
| 2690 TRACK_MEMORY("CellSpace") | 2690 TRACK_MEMORY("CellSpace") |
| 2691 }; | 2691 }; |
| 2692 | 2692 |
| 2693 | 2693 |
| 2694 // ----------------------------------------------------------------------------- | 2694 // ----------------------------------------------------------------------------- |
| 2695 // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by | 2695 // Large objects ( > Page::kMaxRegularHeapObjectSize ) are allocated and |
| 2696 // the large object space. A large object is allocated from OS heap with | 2696 // managed by the large object space. A large object is allocated from OS |
| 2697 // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). | 2697 // heap with extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). |
| 2698 // A large object always starts at Page::kObjectStartOffset to a page. | 2698 // A large object always starts at Page::kObjectStartOffset to a page. |
| 2699 // Large objects do not move during garbage collections. | 2699 // Large objects do not move during garbage collections. |
| 2700 | 2700 |
| 2701 class LargeObjectSpace : public Space { | 2701 class LargeObjectSpace : public Space { |
| 2702 public: | 2702 public: |
| 2703 LargeObjectSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id); | 2703 LargeObjectSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id); |
| 2704 virtual ~LargeObjectSpace() {} | 2704 virtual ~LargeObjectSpace() {} |
| 2705 | 2705 |
| 2706 // Initializes internal data structures. | 2706 // Initializes internal data structures. |
| 2707 bool SetUp(); | 2707 bool SetUp(); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2870 count = 0; | 2870 count = 0; |
| 2871 } | 2871 } |
| 2872 // Must be small, since an iteration is used for lookup. | 2872 // Must be small, since an iteration is used for lookup. |
| 2873 static const int kMaxComments = 64; | 2873 static const int kMaxComments = 64; |
| 2874 }; | 2874 }; |
| 2875 #endif | 2875 #endif |
| 2876 } | 2876 } |
| 2877 } // namespace v8::internal | 2877 } // namespace v8::internal |
| 2878 | 2878 |
| 2879 #endif // V8_HEAP_SPACES_H_ | 2879 #endif // V8_HEAP_SPACES_H_ |
| OLD | NEW |