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 26 matching lines...) Expand all Loading... |
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()->cell_space() || |
47 owner == page->heap()->property_cell_space() || | |
48 owner == page->heap()->code_space()); | 47 owner == page->heap()->code_space()); |
49 Initialize(reinterpret_cast<PagedSpace*>(owner), page->area_start(), | 48 Initialize(reinterpret_cast<PagedSpace*>(owner), page->area_start(), |
50 page->area_end(), kOnePageOnly, size_func); | 49 page->area_end(), kOnePageOnly, size_func); |
51 DCHECK(page->WasSwept() || page->SweepingCompleted()); | 50 DCHECK(page->WasSwept() || page->SweepingCompleted()); |
52 } | 51 } |
53 | 52 |
54 | 53 |
55 void HeapObjectIterator::Initialize(PagedSpace* space, Address cur, Address end, | 54 void HeapObjectIterator::Initialize(PagedSpace* space, Address cur, Address end, |
56 HeapObjectIterator::PageMode mode, | 55 HeapObjectIterator::PageMode mode, |
57 HeapObjectCallback size_f) { | 56 HeapObjectCallback size_f) { |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 // PagedSpace implementation | 919 // PagedSpace implementation |
921 | 920 |
922 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::NEW_SPACE) == | 921 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::NEW_SPACE) == |
923 ObjectSpace::kObjectSpaceNewSpace); | 922 ObjectSpace::kObjectSpaceNewSpace); |
924 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::OLD_SPACE) == | 923 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::OLD_SPACE) == |
925 ObjectSpace::kObjectSpaceOldSpace); | 924 ObjectSpace::kObjectSpaceOldSpace); |
926 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CODE_SPACE) == | 925 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CODE_SPACE) == |
927 ObjectSpace::kObjectSpaceCodeSpace); | 926 ObjectSpace::kObjectSpaceCodeSpace); |
928 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CELL_SPACE) == | 927 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CELL_SPACE) == |
929 ObjectSpace::kObjectSpaceCellSpace); | 928 ObjectSpace::kObjectSpaceCellSpace); |
930 STATIC_ASSERT( | |
931 static_cast<ObjectSpace>(1 << AllocationSpace::PROPERTY_CELL_SPACE) == | |
932 ObjectSpace::kObjectSpacePropertyCellSpace); | |
933 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) == | 929 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) == |
934 ObjectSpace::kObjectSpaceMapSpace); | 930 ObjectSpace::kObjectSpaceMapSpace); |
935 | 931 |
936 | 932 |
937 PagedSpace::PagedSpace(Heap* heap, intptr_t max_capacity, AllocationSpace space, | 933 PagedSpace::PagedSpace(Heap* heap, intptr_t max_capacity, AllocationSpace space, |
938 Executability executable) | 934 Executability executable) |
939 : Space(heap, space, executable), | 935 : Space(heap, space, executable), |
940 free_list_(this), | 936 free_list_(this), |
941 unswept_free_bytes_(0), | 937 unswept_free_bytes_(0), |
942 end_of_unswept_pages_(NULL), | 938 end_of_unswept_pages_(NULL), |
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2776 // ----------------------------------------------------------------------------- | 2772 // ----------------------------------------------------------------------------- |
2777 // MapSpace implementation | 2773 // MapSpace implementation |
2778 // TODO(mvstanton): this is weird...the compiler can't make a vtable unless | 2774 // TODO(mvstanton): this is weird...the compiler can't make a vtable unless |
2779 // there is at least one non-inlined virtual function. I would prefer to hide | 2775 // there is at least one non-inlined virtual function. I would prefer to hide |
2780 // the VerifyObject definition behind VERIFY_HEAP. | 2776 // the VerifyObject definition behind VERIFY_HEAP. |
2781 | 2777 |
2782 void MapSpace::VerifyObject(HeapObject* object) { CHECK(object->IsMap()); } | 2778 void MapSpace::VerifyObject(HeapObject* object) { CHECK(object->IsMap()); } |
2783 | 2779 |
2784 | 2780 |
2785 // ----------------------------------------------------------------------------- | 2781 // ----------------------------------------------------------------------------- |
2786 // CellSpace and PropertyCellSpace implementation | 2782 // CellSpace implementation |
2787 // TODO(mvstanton): this is weird...the compiler can't make a vtable unless | 2783 // 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 | 2784 // there is at least one non-inlined virtual function. I would prefer to hide |
2789 // the VerifyObject definition behind VERIFY_HEAP. | 2785 // the VerifyObject definition behind VERIFY_HEAP. |
2790 | 2786 |
2791 void CellSpace::VerifyObject(HeapObject* object) { CHECK(object->IsCell()); } | 2787 void CellSpace::VerifyObject(HeapObject* object) { CHECK(object->IsCell()); } |
2792 | 2788 |
2793 | 2789 |
2794 void PropertyCellSpace::VerifyObject(HeapObject* object) { | |
2795 CHECK(object->IsPropertyCell()); | |
2796 } | |
2797 | |
2798 | |
2799 // ----------------------------------------------------------------------------- | 2790 // ----------------------------------------------------------------------------- |
2800 // LargeObjectIterator | 2791 // LargeObjectIterator |
2801 | 2792 |
2802 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space) { | 2793 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space) { |
2803 current_ = space->first_page_; | 2794 current_ = space->first_page_; |
2804 size_func_ = NULL; | 2795 size_func_ = NULL; |
2805 } | 2796 } |
2806 | 2797 |
2807 | 2798 |
2808 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space, | 2799 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space, |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3128 object->ShortPrint(); | 3119 object->ShortPrint(); |
3129 PrintF("\n"); | 3120 PrintF("\n"); |
3130 } | 3121 } |
3131 printf(" --------------------------------------\n"); | 3122 printf(" --------------------------------------\n"); |
3132 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3123 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3133 } | 3124 } |
3134 | 3125 |
3135 #endif // DEBUG | 3126 #endif // DEBUG |
3136 } | 3127 } |
3137 } // namespace v8::internal | 3128 } // namespace v8::internal |
OLD | NEW |