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