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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/full-codegen.h" | 9 #include "src/full-codegen.h" |
10 #include "src/heap/mark-compact.h" | 10 #include "src/heap/mark-compact.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // to the first page. | 36 // to the first page. |
37 Initialize(space, NULL, NULL, kAllPagesInSpace, size_func); | 37 Initialize(space, NULL, NULL, kAllPagesInSpace, size_func); |
38 } | 38 } |
39 | 39 |
40 | 40 |
41 HeapObjectIterator::HeapObjectIterator(Page* page, | 41 HeapObjectIterator::HeapObjectIterator(Page* page, |
42 HeapObjectCallback size_func) { | 42 HeapObjectCallback size_func) { |
43 Space* owner = page->owner(); | 43 Space* owner = page->owner(); |
44 DCHECK(owner == page->heap()->old_space() || | 44 DCHECK(owner == page->heap()->old_space() || |
45 owner == page->heap()->map_space() || | 45 owner == page->heap()->map_space() || |
| 46 owner == page->heap()->cell_space() || |
46 owner == page->heap()->code_space()); | 47 owner == page->heap()->code_space()); |
47 Initialize(reinterpret_cast<PagedSpace*>(owner), page->area_start(), | 48 Initialize(reinterpret_cast<PagedSpace*>(owner), page->area_start(), |
48 page->area_end(), kOnePageOnly, size_func); | 49 page->area_end(), kOnePageOnly, size_func); |
49 DCHECK(page->WasSwept() || page->SweepingCompleted()); | 50 DCHECK(page->WasSwept() || page->SweepingCompleted()); |
50 } | 51 } |
51 | 52 |
52 | 53 |
53 void HeapObjectIterator::Initialize(PagedSpace* space, Address cur, Address end, | 54 void HeapObjectIterator::Initialize(PagedSpace* space, Address cur, Address end, |
54 HeapObjectIterator::PageMode mode, | 55 HeapObjectIterator::PageMode mode, |
55 HeapObjectCallback size_f) { | 56 HeapObjectCallback size_f) { |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 | 917 |
917 // ----------------------------------------------------------------------------- | 918 // ----------------------------------------------------------------------------- |
918 // PagedSpace implementation | 919 // PagedSpace implementation |
919 | 920 |
920 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::NEW_SPACE) == | 921 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::NEW_SPACE) == |
921 ObjectSpace::kObjectSpaceNewSpace); | 922 ObjectSpace::kObjectSpaceNewSpace); |
922 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::OLD_SPACE) == | 923 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::OLD_SPACE) == |
923 ObjectSpace::kObjectSpaceOldSpace); | 924 ObjectSpace::kObjectSpaceOldSpace); |
924 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CODE_SPACE) == | 925 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CODE_SPACE) == |
925 ObjectSpace::kObjectSpaceCodeSpace); | 926 ObjectSpace::kObjectSpaceCodeSpace); |
| 927 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CELL_SPACE) == |
| 928 ObjectSpace::kObjectSpaceCellSpace); |
926 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) == | 929 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) == |
927 ObjectSpace::kObjectSpaceMapSpace); | 930 ObjectSpace::kObjectSpaceMapSpace); |
928 | 931 |
929 | 932 |
930 PagedSpace::PagedSpace(Heap* heap, intptr_t max_capacity, AllocationSpace space, | 933 PagedSpace::PagedSpace(Heap* heap, intptr_t max_capacity, AllocationSpace space, |
931 Executability executable) | 934 Executability executable) |
932 : Space(heap, space, executable), | 935 : Space(heap, space, executable), |
933 free_list_(this), | 936 free_list_(this), |
934 unswept_free_bytes_(0), | 937 unswept_free_bytes_(0), |
935 end_of_unswept_pages_(NULL), | 938 end_of_unswept_pages_(NULL), |
(...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2785 // ----------------------------------------------------------------------------- | 2788 // ----------------------------------------------------------------------------- |
2786 // MapSpace implementation | 2789 // MapSpace implementation |
2787 // TODO(mvstanton): this is weird...the compiler can't make a vtable unless | 2790 // TODO(mvstanton): this is weird...the compiler can't make a vtable unless |
2788 // there is at least one non-inlined virtual function. I would prefer to hide | 2791 // there is at least one non-inlined virtual function. I would prefer to hide |
2789 // the VerifyObject definition behind VERIFY_HEAP. | 2792 // the VerifyObject definition behind VERIFY_HEAP. |
2790 | 2793 |
2791 void MapSpace::VerifyObject(HeapObject* object) { CHECK(object->IsMap()); } | 2794 void MapSpace::VerifyObject(HeapObject* object) { CHECK(object->IsMap()); } |
2792 | 2795 |
2793 | 2796 |
2794 // ----------------------------------------------------------------------------- | 2797 // ----------------------------------------------------------------------------- |
| 2798 // CellSpace implementation |
| 2799 // TODO(mvstanton): this is weird...the compiler can't make a vtable unless |
| 2800 // there is at least one non-inlined virtual function. I would prefer to hide |
| 2801 // the VerifyObject definition behind VERIFY_HEAP. |
| 2802 |
| 2803 void CellSpace::VerifyObject(HeapObject* object) { CHECK(object->IsCell()); } |
| 2804 |
| 2805 |
| 2806 // ----------------------------------------------------------------------------- |
2795 // LargeObjectIterator | 2807 // LargeObjectIterator |
2796 | 2808 |
2797 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space) { | 2809 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space) { |
2798 current_ = space->first_page_; | 2810 current_ = space->first_page_; |
2799 size_func_ = NULL; | 2811 size_func_ = NULL; |
2800 } | 2812 } |
2801 | 2813 |
2802 | 2814 |
2803 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space, | 2815 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space, |
2804 HeapObjectCallback size_func) { | 2816 HeapObjectCallback size_func) { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3123 object->ShortPrint(); | 3135 object->ShortPrint(); |
3124 PrintF("\n"); | 3136 PrintF("\n"); |
3125 } | 3137 } |
3126 printf(" --------------------------------------\n"); | 3138 printf(" --------------------------------------\n"); |
3127 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3139 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3128 } | 3140 } |
3129 | 3141 |
3130 #endif // DEBUG | 3142 #endif // DEBUG |
3131 } | 3143 } |
3132 } // namespace v8::internal | 3144 } // namespace v8::internal |
OLD | NEW |