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