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 2667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2678 | 2678 |
2679 protected: | 2679 protected: |
2680 virtual void VerifyObject(HeapObject* obj); | 2680 virtual void VerifyObject(HeapObject* obj); |
2681 | 2681 |
2682 public: | 2682 public: |
2683 TRACK_MEMORY("CellSpace") | 2683 TRACK_MEMORY("CellSpace") |
2684 }; | 2684 }; |
2685 | 2685 |
2686 | 2686 |
2687 // ----------------------------------------------------------------------------- | 2687 // ----------------------------------------------------------------------------- |
2688 // Old space for all global object property cell objects | |
2689 | |
2690 class PropertyCellSpace : public PagedSpace { | |
2691 public: | |
2692 // Creates a property cell space object with a maximum capacity. | |
2693 PropertyCellSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id) | |
2694 : PagedSpace(heap, max_capacity, id, NOT_EXECUTABLE) {} | |
2695 | |
2696 virtual int RoundSizeDownToObjectAlignment(int size) { | |
2697 if (base::bits::IsPowerOfTwo32(PropertyCell::kSize)) { | |
2698 return RoundDown(size, PropertyCell::kSize); | |
2699 } else { | |
2700 return (size / PropertyCell::kSize) * PropertyCell::kSize; | |
2701 } | |
2702 } | |
2703 | |
2704 protected: | |
2705 virtual void VerifyObject(HeapObject* obj); | |
2706 | |
2707 public: | |
2708 TRACK_MEMORY("PropertyCellSpace") | |
2709 }; | |
2710 | |
2711 | |
2712 // ----------------------------------------------------------------------------- | |
2713 // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by | 2688 // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by |
2714 // the large object space. A large object is allocated from OS heap with | 2689 // the large object space. A large object is allocated from OS heap with |
2715 // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). | 2690 // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). |
2716 // A large object always starts at Page::kObjectStartOffset to a page. | 2691 // A large object always starts at Page::kObjectStartOffset to a page. |
2717 // Large objects do not move during garbage collections. | 2692 // Large objects do not move during garbage collections. |
2718 | 2693 |
2719 class LargeObjectSpace : public Space { | 2694 class LargeObjectSpace : public Space { |
2720 public: | 2695 public: |
2721 LargeObjectSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id); | 2696 LargeObjectSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id); |
2722 virtual ~LargeObjectSpace() {} | 2697 virtual ~LargeObjectSpace() {} |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2888 count = 0; | 2863 count = 0; |
2889 } | 2864 } |
2890 // Must be small, since an iteration is used for lookup. | 2865 // Must be small, since an iteration is used for lookup. |
2891 static const int kMaxComments = 64; | 2866 static const int kMaxComments = 64; |
2892 }; | 2867 }; |
2893 #endif | 2868 #endif |
2894 } | 2869 } |
2895 } // namespace v8::internal | 2870 } // namespace v8::internal |
2896 | 2871 |
2897 #endif // V8_HEAP_SPACES_H_ | 2872 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |