| 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 27 matching lines...) Expand all Loading... |
| 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_pointer_space() || | 44 DCHECK(owner == page->heap()->old_pointer_space() || |
| 45 owner == page->heap()->old_data_space() || | 45 owner == page->heap()->old_data_space() || |
| 46 owner == page->heap()->map_space() || | 46 owner == page->heap()->map_space() || |
| 47 owner == page->heap()->cell_space() || | 47 owner == page->heap()->cell_space() || |
| 48 owner == page->heap()->property_cell_space() || | |
| 49 owner == page->heap()->code_space()); | 48 owner == page->heap()->code_space()); |
| 50 Initialize(reinterpret_cast<PagedSpace*>(owner), page->area_start(), | 49 Initialize(reinterpret_cast<PagedSpace*>(owner), page->area_start(), |
| 51 page->area_end(), kOnePageOnly, size_func); | 50 page->area_end(), kOnePageOnly, size_func); |
| 52 DCHECK(page->WasSwept() || page->SweepingCompleted()); | 51 DCHECK(page->WasSwept() || page->SweepingCompleted()); |
| 53 } | 52 } |
| 54 | 53 |
| 55 | 54 |
| 56 void HeapObjectIterator::Initialize(PagedSpace* space, Address cur, Address end, | 55 void HeapObjectIterator::Initialize(PagedSpace* space, Address cur, Address end, |
| 57 HeapObjectIterator::PageMode mode, | 56 HeapObjectIterator::PageMode mode, |
| 58 HeapObjectCallback size_f) { | 57 HeapObjectCallback size_f) { |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 ObjectSpace::kObjectSpaceNewSpace); | 927 ObjectSpace::kObjectSpaceNewSpace); |
| 929 STATIC_ASSERT(static_cast<ObjectSpace>(1 | 928 STATIC_ASSERT(static_cast<ObjectSpace>(1 |
| 930 << AllocationSpace::OLD_POINTER_SPACE) == | 929 << AllocationSpace::OLD_POINTER_SPACE) == |
| 931 ObjectSpace::kObjectSpaceOldPointerSpace); | 930 ObjectSpace::kObjectSpaceOldPointerSpace); |
| 932 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::OLD_DATA_SPACE) == | 931 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::OLD_DATA_SPACE) == |
| 933 ObjectSpace::kObjectSpaceOldDataSpace); | 932 ObjectSpace::kObjectSpaceOldDataSpace); |
| 934 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CODE_SPACE) == | 933 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CODE_SPACE) == |
| 935 ObjectSpace::kObjectSpaceCodeSpace); | 934 ObjectSpace::kObjectSpaceCodeSpace); |
| 936 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CELL_SPACE) == | 935 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CELL_SPACE) == |
| 937 ObjectSpace::kObjectSpaceCellSpace); | 936 ObjectSpace::kObjectSpaceCellSpace); |
| 938 STATIC_ASSERT( | |
| 939 static_cast<ObjectSpace>(1 << AllocationSpace::PROPERTY_CELL_SPACE) == | |
| 940 ObjectSpace::kObjectSpacePropertyCellSpace); | |
| 941 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) == | 937 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) == |
| 942 ObjectSpace::kObjectSpaceMapSpace); | 938 ObjectSpace::kObjectSpaceMapSpace); |
| 943 | 939 |
| 944 | 940 |
| 945 PagedSpace::PagedSpace(Heap* heap, intptr_t max_capacity, AllocationSpace space, | 941 PagedSpace::PagedSpace(Heap* heap, intptr_t max_capacity, AllocationSpace space, |
| 946 Executability executable) | 942 Executability executable) |
| 947 : Space(heap, space, executable), | 943 : Space(heap, space, executable), |
| 948 free_list_(this), | 944 free_list_(this), |
| 949 unswept_free_bytes_(0), | 945 unswept_free_bytes_(0), |
| 950 end_of_unswept_pages_(NULL), | 946 end_of_unswept_pages_(NULL), |
| (...skipping 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2788 // ----------------------------------------------------------------------------- | 2784 // ----------------------------------------------------------------------------- |
| 2789 // MapSpace implementation | 2785 // MapSpace implementation |
| 2790 // TODO(mvstanton): this is weird...the compiler can't make a vtable unless | 2786 // 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 | 2787 // there is at least one non-inlined virtual function. I would prefer to hide |
| 2792 // the VerifyObject definition behind VERIFY_HEAP. | 2788 // the VerifyObject definition behind VERIFY_HEAP. |
| 2793 | 2789 |
| 2794 void MapSpace::VerifyObject(HeapObject* object) { CHECK(object->IsMap()); } | 2790 void MapSpace::VerifyObject(HeapObject* object) { CHECK(object->IsMap()); } |
| 2795 | 2791 |
| 2796 | 2792 |
| 2797 // ----------------------------------------------------------------------------- | 2793 // ----------------------------------------------------------------------------- |
| 2798 // CellSpace and PropertyCellSpace implementation | 2794 // CellSpace implementation |
| 2799 // TODO(mvstanton): this is weird...the compiler can't make a vtable unless | 2795 // 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 | 2796 // there is at least one non-inlined virtual function. I would prefer to hide |
| 2801 // the VerifyObject definition behind VERIFY_HEAP. | 2797 // the VerifyObject definition behind VERIFY_HEAP. |
| 2802 | 2798 |
| 2803 void CellSpace::VerifyObject(HeapObject* object) { CHECK(object->IsCell()); } | 2799 void CellSpace::VerifyObject(HeapObject* object) { CHECK(object->IsCell()); } |
| 2804 | 2800 |
| 2805 | 2801 |
| 2806 void PropertyCellSpace::VerifyObject(HeapObject* object) { | |
| 2807 CHECK(object->IsPropertyCell()); | |
| 2808 } | |
| 2809 | |
| 2810 | |
| 2811 // ----------------------------------------------------------------------------- | 2802 // ----------------------------------------------------------------------------- |
| 2812 // LargeObjectIterator | 2803 // LargeObjectIterator |
| 2813 | 2804 |
| 2814 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space) { | 2805 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space) { |
| 2815 current_ = space->first_page_; | 2806 current_ = space->first_page_; |
| 2816 size_func_ = NULL; | 2807 size_func_ = NULL; |
| 2817 } | 2808 } |
| 2818 | 2809 |
| 2819 | 2810 |
| 2820 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space, | 2811 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space, |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3140 object->ShortPrint(); | 3131 object->ShortPrint(); |
| 3141 PrintF("\n"); | 3132 PrintF("\n"); |
| 3142 } | 3133 } |
| 3143 printf(" --------------------------------------\n"); | 3134 printf(" --------------------------------------\n"); |
| 3144 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3135 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3145 } | 3136 } |
| 3146 | 3137 |
| 3147 #endif // DEBUG | 3138 #endif // DEBUG |
| 3148 } | 3139 } |
| 3149 } // namespace v8::internal | 3140 } // namespace v8::internal |
| OLD | NEW |