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 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2650 } | 2650 } |
2651 | 2651 |
2652 const int max_map_space_pages_; | 2652 const int max_map_space_pages_; |
2653 | 2653 |
2654 public: | 2654 public: |
2655 TRACK_MEMORY("MapSpace") | 2655 TRACK_MEMORY("MapSpace") |
2656 }; | 2656 }; |
2657 | 2657 |
2658 | 2658 |
2659 // ----------------------------------------------------------------------------- | 2659 // ----------------------------------------------------------------------------- |
2660 // Old space for simple property cell objects | |
2661 | |
2662 class CellSpace : public PagedSpace { | |
2663 public: | |
2664 // Creates a property cell space object with a maximum capacity. | |
2665 CellSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id) | |
2666 : PagedSpace(heap, max_capacity, id, NOT_EXECUTABLE) {} | |
2667 | |
2668 virtual int RoundSizeDownToObjectAlignment(int size) { | |
2669 if (base::bits::IsPowerOfTwo32(Cell::kSize)) { | |
2670 return RoundDown(size, Cell::kSize); | |
2671 } else { | |
2672 return (size / Cell::kSize) * Cell::kSize; | |
2673 } | |
2674 } | |
2675 | |
2676 protected: | |
2677 virtual void VerifyObject(HeapObject* obj); | |
2678 | |
2679 public: | |
2680 TRACK_MEMORY("CellSpace") | |
2681 }; | |
2682 | |
2683 | |
2684 // ----------------------------------------------------------------------------- | |
2685 // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by | 2660 // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by |
2686 // the large object space. A large object is allocated from OS heap with | 2661 // the large object space. A large object is allocated from OS heap with |
2687 // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). | 2662 // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). |
2688 // A large object always starts at Page::kObjectStartOffset to a page. | 2663 // A large object always starts at Page::kObjectStartOffset to a page. |
2689 // Large objects do not move during garbage collections. | 2664 // Large objects do not move during garbage collections. |
2690 | 2665 |
2691 class LargeObjectSpace : public Space { | 2666 class LargeObjectSpace : public Space { |
2692 public: | 2667 public: |
2693 LargeObjectSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id); | 2668 LargeObjectSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id); |
2694 virtual ~LargeObjectSpace() {} | 2669 virtual ~LargeObjectSpace() {} |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2860 count = 0; | 2835 count = 0; |
2861 } | 2836 } |
2862 // Must be small, since an iteration is used for lookup. | 2837 // Must be small, since an iteration is used for lookup. |
2863 static const int kMaxComments = 64; | 2838 static const int kMaxComments = 64; |
2864 }; | 2839 }; |
2865 #endif | 2840 #endif |
2866 } | 2841 } |
2867 } // namespace v8::internal | 2842 } // namespace v8::internal |
2868 | 2843 |
2869 #endif // V8_HEAP_SPACES_H_ | 2844 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |