| 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 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2789 // ----------------------------------------------------------------------------- | 2786 // ----------------------------------------------------------------------------- |
| 2790 // MapSpace implementation | 2787 // MapSpace implementation |
| 2791 // TODO(mvstanton): this is weird...the compiler can't make a vtable unless | 2788 // TODO(mvstanton): this is weird...the compiler can't make a vtable unless |
| 2792 // there is at least one non-inlined virtual function. I would prefer to hide | 2789 // there is at least one non-inlined virtual function. I would prefer to hide |
| 2793 // the VerifyObject definition behind VERIFY_HEAP. | 2790 // the VerifyObject definition behind VERIFY_HEAP. |
| 2794 | 2791 |
| 2795 void MapSpace::VerifyObject(HeapObject* object) { CHECK(object->IsMap()); } | 2792 void MapSpace::VerifyObject(HeapObject* object) { CHECK(object->IsMap()); } |
| 2796 | 2793 |
| 2797 | 2794 |
| 2798 // ----------------------------------------------------------------------------- | 2795 // ----------------------------------------------------------------------------- |
| 2799 // CellSpace implementation | |
| 2800 // TODO(mvstanton): this is weird...the compiler can't make a vtable unless | |
| 2801 // there is at least one non-inlined virtual function. I would prefer to hide | |
| 2802 // the VerifyObject definition behind VERIFY_HEAP. | |
| 2803 | |
| 2804 void CellSpace::VerifyObject(HeapObject* object) { CHECK(object->IsCell()); } | |
| 2805 | |
| 2806 | |
| 2807 // ----------------------------------------------------------------------------- | |
| 2808 // LargeObjectIterator | 2796 // LargeObjectIterator |
| 2809 | 2797 |
| 2810 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space) { | 2798 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space) { |
| 2811 current_ = space->first_page_; | 2799 current_ = space->first_page_; |
| 2812 size_func_ = NULL; | 2800 size_func_ = NULL; |
| 2813 } | 2801 } |
| 2814 | 2802 |
| 2815 | 2803 |
| 2816 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space, | 2804 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space, |
| 2817 HeapObjectCallback size_func) { | 2805 HeapObjectCallback size_func) { |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3136 object->ShortPrint(); | 3124 object->ShortPrint(); |
| 3137 PrintF("\n"); | 3125 PrintF("\n"); |
| 3138 } | 3126 } |
| 3139 printf(" --------------------------------------\n"); | 3127 printf(" --------------------------------------\n"); |
| 3140 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3128 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3141 } | 3129 } |
| 3142 | 3130 |
| 3143 #endif // DEBUG | 3131 #endif // DEBUG |
| 3144 } | 3132 } |
| 3145 } // namespace v8::internal | 3133 } // namespace v8::internal |
| OLD | NEW |