| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 next_object_must_be_here_or_later = current + object->Size(); | 100 next_object_must_be_here_or_later = current + object->Size(); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 | 105 |
| 106 static void VerifyMarking(NewSpace* space) { | 106 static void VerifyMarking(NewSpace* space) { |
| 107 Address end = space->top(); | 107 Address end = space->top(); |
| 108 NewSpacePageIterator it(space->bottom(), end); | 108 NewSpacePageIterator it(space->bottom(), end); |
| 109 // The bottom position is at the start of its page. Allows us to use | 109 // The bottom position is at the start of its page. Allows us to use |
| 110 // page->body() as start of range on all pages. | 110 // page->area_start() as start of range on all pages. |
| 111 ASSERT_EQ(space->bottom(), | 111 ASSERT_EQ(space->bottom(), |
| 112 NewSpacePage::FromAddress(space->bottom())->body()); | 112 NewSpacePage::FromAddress(space->bottom())->area_start()); |
| 113 while (it.has_next()) { | 113 while (it.has_next()) { |
| 114 NewSpacePage* page = it.next(); | 114 NewSpacePage* page = it.next(); |
| 115 Address limit = it.has_next() ? page->body_limit() : end; | 115 Address limit = it.has_next() ? page->area_end() : end; |
| 116 ASSERT(limit == end || !page->Contains(end)); | 116 ASSERT(limit == end || !page->Contains(end)); |
| 117 VerifyMarking(page->body(), limit); | 117 VerifyMarking(page->area_start(), limit); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 | 121 |
| 122 static void VerifyMarking(PagedSpace* space) { | 122 static void VerifyMarking(PagedSpace* space) { |
| 123 PageIterator it(space); | 123 PageIterator it(space); |
| 124 | 124 |
| 125 while (it.has_next()) { | 125 while (it.has_next()) { |
| 126 Page* p = it.next(); | 126 Page* p = it.next(); |
| 127 VerifyMarking(p->ObjectAreaStart(), p->ObjectAreaEnd()); | 127 VerifyMarking(p->area_start(), p->area_end()); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 | 131 |
| 132 static void VerifyMarking(Heap* heap) { | 132 static void VerifyMarking(Heap* heap) { |
| 133 VerifyMarking(heap->old_pointer_space()); | 133 VerifyMarking(heap->old_pointer_space()); |
| 134 VerifyMarking(heap->old_data_space()); | 134 VerifyMarking(heap->old_data_space()); |
| 135 VerifyMarking(heap->code_space()); | 135 VerifyMarking(heap->code_space()); |
| 136 VerifyMarking(heap->cell_space()); | 136 VerifyMarking(heap->cell_space()); |
| 137 VerifyMarking(heap->map_space()); | 137 VerifyMarking(heap->map_space()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 | 183 |
| 184 static void VerifyEvacuation(NewSpace* space) { | 184 static void VerifyEvacuation(NewSpace* space) { |
| 185 NewSpacePageIterator it(space->bottom(), space->top()); | 185 NewSpacePageIterator it(space->bottom(), space->top()); |
| 186 VerifyEvacuationVisitor visitor; | 186 VerifyEvacuationVisitor visitor; |
| 187 | 187 |
| 188 while (it.has_next()) { | 188 while (it.has_next()) { |
| 189 NewSpacePage* page = it.next(); | 189 NewSpacePage* page = it.next(); |
| 190 Address current = page->body(); | 190 Address current = page->area_start(); |
| 191 Address limit = it.has_next() ? page->body_limit() : space->top(); | 191 Address limit = it.has_next() ? page->area_end() : space->top(); |
| 192 ASSERT(limit == space->top() || !page->Contains(space->top())); | 192 ASSERT(limit == space->top() || !page->Contains(space->top())); |
| 193 while (current < limit) { | 193 while (current < limit) { |
| 194 HeapObject* object = HeapObject::FromAddress(current); | 194 HeapObject* object = HeapObject::FromAddress(current); |
| 195 object->Iterate(&visitor); | 195 object->Iterate(&visitor); |
| 196 current += object->Size(); | 196 current += object->Size(); |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 | 200 |
| 201 | 201 |
| 202 static void VerifyEvacuation(PagedSpace* space) { | 202 static void VerifyEvacuation(PagedSpace* space) { |
| 203 PageIterator it(space); | 203 PageIterator it(space); |
| 204 | 204 |
| 205 while (it.has_next()) { | 205 while (it.has_next()) { |
| 206 Page* p = it.next(); | 206 Page* p = it.next(); |
| 207 if (p->IsEvacuationCandidate()) continue; | 207 if (p->IsEvacuationCandidate()) continue; |
| 208 VerifyEvacuation(p->ObjectAreaStart(), p->ObjectAreaEnd()); | 208 VerifyEvacuation(p->area_start(), p->area_end()); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 | 212 |
| 213 static void VerifyEvacuation(Heap* heap) { | 213 static void VerifyEvacuation(Heap* heap) { |
| 214 VerifyEvacuation(heap->old_pointer_space()); | 214 VerifyEvacuation(heap->old_pointer_space()); |
| 215 VerifyEvacuation(heap->old_data_space()); | 215 VerifyEvacuation(heap->old_data_space()); |
| 216 VerifyEvacuation(heap->code_space()); | 216 VerifyEvacuation(heap->code_space()); |
| 217 VerifyEvacuation(heap->cell_space()); | 217 VerifyEvacuation(heap->cell_space()); |
| 218 VerifyEvacuation(heap->map_space()); | 218 VerifyEvacuation(heap->map_space()); |
| (...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 ASSERT(strcmp(Marking::kWhiteBitPattern, "00") == 0); | 1799 ASSERT(strcmp(Marking::kWhiteBitPattern, "00") == 0); |
| 1800 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0); | 1800 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0); |
| 1801 ASSERT(strcmp(Marking::kGreyBitPattern, "11") == 0); | 1801 ASSERT(strcmp(Marking::kGreyBitPattern, "11") == 0); |
| 1802 ASSERT(strcmp(Marking::kImpossibleBitPattern, "01") == 0); | 1802 ASSERT(strcmp(Marking::kImpossibleBitPattern, "01") == 0); |
| 1803 | 1803 |
| 1804 MarkBit::CellType* cells = p->markbits()->cells(); | 1804 MarkBit::CellType* cells = p->markbits()->cells(); |
| 1805 | 1805 |
| 1806 int last_cell_index = | 1806 int last_cell_index = |
| 1807 Bitmap::IndexToCell( | 1807 Bitmap::IndexToCell( |
| 1808 Bitmap::CellAlignIndex( | 1808 Bitmap::CellAlignIndex( |
| 1809 p->AddressToMarkbitIndex(p->ObjectAreaEnd()))); | 1809 p->AddressToMarkbitIndex(p->area_end()))); |
| 1810 | 1810 |
| 1811 int cell_index = Page::kFirstUsedCell; | 1811 Address cell_base = p->area_start(); |
| 1812 Address cell_base = p->ObjectAreaStart(); | 1812 int cell_index = Bitmap::IndexToCell( |
| 1813 Bitmap::CellAlignIndex( |
| 1814 p->AddressToMarkbitIndex(cell_base))); |
| 1813 | 1815 |
| 1814 for (cell_index = Page::kFirstUsedCell; | 1816 |
| 1817 for (; |
| 1815 cell_index < last_cell_index; | 1818 cell_index < last_cell_index; |
| 1816 cell_index++, cell_base += 32 * kPointerSize) { | 1819 cell_index++, cell_base += 32 * kPointerSize) { |
| 1817 ASSERT((unsigned)cell_index == | 1820 ASSERT((unsigned)cell_index == |
| 1818 Bitmap::IndexToCell( | 1821 Bitmap::IndexToCell( |
| 1819 Bitmap::CellAlignIndex( | 1822 Bitmap::CellAlignIndex( |
| 1820 p->AddressToMarkbitIndex(cell_base)))); | 1823 p->AddressToMarkbitIndex(cell_base)))); |
| 1821 | 1824 |
| 1822 const MarkBit::CellType current_cell = cells[cell_index]; | 1825 const MarkBit::CellType current_cell = cells[cell_index]; |
| 1823 if (current_cell == 0) continue; | 1826 if (current_cell == 0) continue; |
| 1824 | 1827 |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2606 } | 2609 } |
| 2607 | 2610 |
| 2608 return String::cast(*p); | 2611 return String::cast(*p); |
| 2609 } | 2612 } |
| 2610 | 2613 |
| 2611 | 2614 |
| 2612 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, | 2615 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, |
| 2613 int object_size) { | 2616 int object_size) { |
| 2614 Object* result; | 2617 Object* result; |
| 2615 | 2618 |
| 2616 if (object_size > heap()->MaxObjectSizeInPagedSpace()) { | 2619 if (object_size > Page::kMaxNonCodeHeapObjectSize) { |
| 2617 MaybeObject* maybe_result = | 2620 MaybeObject* maybe_result = |
| 2618 heap()->lo_space()->AllocateRaw(object_size, NOT_EXECUTABLE); | 2621 heap()->lo_space()->AllocateRaw(object_size, NOT_EXECUTABLE); |
| 2619 if (maybe_result->ToObject(&result)) { | 2622 if (maybe_result->ToObject(&result)) { |
| 2620 HeapObject* target = HeapObject::cast(result); | 2623 HeapObject* target = HeapObject::cast(result); |
| 2621 MigrateObject(target->address(), | 2624 MigrateObject(target->address(), |
| 2622 object->address(), | 2625 object->address(), |
| 2623 object_size, | 2626 object_size, |
| 2624 LO_SPACE); | 2627 LO_SPACE); |
| 2625 heap()->mark_compact_collector()->tracer()-> | 2628 heap()->mark_compact_collector()->tracer()-> |
| 2626 increment_promoted_objects_size(object_size); | 2629 increment_promoted_objects_size(object_size); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2724 void MarkCompactCollector::EvacuateLiveObjectsFromPage(Page* p) { | 2727 void MarkCompactCollector::EvacuateLiveObjectsFromPage(Page* p) { |
| 2725 AlwaysAllocateScope always_allocate; | 2728 AlwaysAllocateScope always_allocate; |
| 2726 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); | 2729 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); |
| 2727 ASSERT(p->IsEvacuationCandidate() && !p->WasSwept()); | 2730 ASSERT(p->IsEvacuationCandidate() && !p->WasSwept()); |
| 2728 MarkBit::CellType* cells = p->markbits()->cells(); | 2731 MarkBit::CellType* cells = p->markbits()->cells(); |
| 2729 p->MarkSweptPrecisely(); | 2732 p->MarkSweptPrecisely(); |
| 2730 | 2733 |
| 2731 int last_cell_index = | 2734 int last_cell_index = |
| 2732 Bitmap::IndexToCell( | 2735 Bitmap::IndexToCell( |
| 2733 Bitmap::CellAlignIndex( | 2736 Bitmap::CellAlignIndex( |
| 2734 p->AddressToMarkbitIndex(p->ObjectAreaEnd()))); | 2737 p->AddressToMarkbitIndex(p->area_end()))); |
| 2735 | 2738 |
| 2736 int cell_index = Page::kFirstUsedCell; | 2739 Address cell_base = p->area_start(); |
| 2737 Address cell_base = p->ObjectAreaStart(); | 2740 int cell_index = Bitmap::IndexToCell( |
| 2741 Bitmap::CellAlignIndex( |
| 2742 p->AddressToMarkbitIndex(cell_base))); |
| 2743 |
| 2738 int offsets[16]; | 2744 int offsets[16]; |
| 2739 | 2745 |
| 2740 for (cell_index = Page::kFirstUsedCell; | 2746 for (; |
| 2741 cell_index < last_cell_index; | 2747 cell_index < last_cell_index; |
| 2742 cell_index++, cell_base += 32 * kPointerSize) { | 2748 cell_index++, cell_base += 32 * kPointerSize) { |
| 2743 ASSERT((unsigned)cell_index == | 2749 ASSERT((unsigned)cell_index == |
| 2744 Bitmap::IndexToCell( | 2750 Bitmap::IndexToCell( |
| 2745 Bitmap::CellAlignIndex( | 2751 Bitmap::CellAlignIndex( |
| 2746 p->AddressToMarkbitIndex(cell_base)))); | 2752 p->AddressToMarkbitIndex(cell_base)))); |
| 2747 if (cells[cell_index] == 0) continue; | 2753 if (cells[cell_index] == 0) continue; |
| 2748 | 2754 |
| 2749 int live_objects = MarkWordToObjectStarts(cells[cell_index], offsets); | 2755 int live_objects = MarkWordToObjectStarts(cells[cell_index], offsets); |
| 2750 for (int i = 0; i < live_objects; i++) { | 2756 for (int i = 0; i < live_objects; i++) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2885 ASSERT_EQ(skip_list_mode == REBUILD_SKIP_LIST, | 2891 ASSERT_EQ(skip_list_mode == REBUILD_SKIP_LIST, |
| 2886 space->identity() == CODE_SPACE); | 2892 space->identity() == CODE_SPACE); |
| 2887 ASSERT((p->skip_list() == NULL) || (skip_list_mode == REBUILD_SKIP_LIST)); | 2893 ASSERT((p->skip_list() == NULL) || (skip_list_mode == REBUILD_SKIP_LIST)); |
| 2888 | 2894 |
| 2889 MarkBit::CellType* cells = p->markbits()->cells(); | 2895 MarkBit::CellType* cells = p->markbits()->cells(); |
| 2890 p->MarkSweptPrecisely(); | 2896 p->MarkSweptPrecisely(); |
| 2891 | 2897 |
| 2892 int last_cell_index = | 2898 int last_cell_index = |
| 2893 Bitmap::IndexToCell( | 2899 Bitmap::IndexToCell( |
| 2894 Bitmap::CellAlignIndex( | 2900 Bitmap::CellAlignIndex( |
| 2895 p->AddressToMarkbitIndex(p->ObjectAreaEnd()))); | 2901 p->AddressToMarkbitIndex(p->area_end()))); |
| 2896 | 2902 |
| 2897 int cell_index = Page::kFirstUsedCell; | 2903 Address free_start = p->area_start(); |
| 2898 Address free_start = p->ObjectAreaStart(); | 2904 int cell_index = |
| 2905 Bitmap::IndexToCell( |
| 2906 Bitmap::CellAlignIndex( |
| 2907 p->AddressToMarkbitIndex(free_start))); |
| 2908 |
| 2899 ASSERT(reinterpret_cast<intptr_t>(free_start) % (32 * kPointerSize) == 0); | 2909 ASSERT(reinterpret_cast<intptr_t>(free_start) % (32 * kPointerSize) == 0); |
| 2900 Address object_address = p->ObjectAreaStart(); | 2910 Address object_address = free_start; |
| 2901 int offsets[16]; | 2911 int offsets[16]; |
| 2902 | 2912 |
| 2903 SkipList* skip_list = p->skip_list(); | 2913 SkipList* skip_list = p->skip_list(); |
| 2904 int curr_region = -1; | 2914 int curr_region = -1; |
| 2905 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list) { | 2915 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list) { |
| 2906 skip_list->Clear(); | 2916 skip_list->Clear(); |
| 2907 } | 2917 } |
| 2908 | 2918 |
| 2909 for (cell_index = Page::kFirstUsedCell; | 2919 for (; |
| 2910 cell_index < last_cell_index; | 2920 cell_index < last_cell_index; |
| 2911 cell_index++, object_address += 32 * kPointerSize) { | 2921 cell_index++, object_address += 32 * kPointerSize) { |
| 2912 ASSERT((unsigned)cell_index == | 2922 ASSERT((unsigned)cell_index == |
| 2913 Bitmap::IndexToCell( | 2923 Bitmap::IndexToCell( |
| 2914 Bitmap::CellAlignIndex( | 2924 Bitmap::CellAlignIndex( |
| 2915 p->AddressToMarkbitIndex(object_address)))); | 2925 p->AddressToMarkbitIndex(object_address)))); |
| 2916 int live_objects = MarkWordToObjectStarts(cells[cell_index], offsets); | 2926 int live_objects = MarkWordToObjectStarts(cells[cell_index], offsets); |
| 2917 int live_index = 0; | 2927 int live_index = 0; |
| 2918 for ( ; live_objects != 0; live_objects--) { | 2928 for ( ; live_objects != 0; live_objects--) { |
| 2919 Address free_end = object_address + offsets[live_index++] * kPointerSize; | 2929 Address free_end = object_address + offsets[live_index++] * kPointerSize; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2936 new_region_end != curr_region) { | 2946 new_region_end != curr_region) { |
| 2937 skip_list->AddObject(free_end, size); | 2947 skip_list->AddObject(free_end, size); |
| 2938 curr_region = new_region_end; | 2948 curr_region = new_region_end; |
| 2939 } | 2949 } |
| 2940 } | 2950 } |
| 2941 free_start = free_end + size; | 2951 free_start = free_end + size; |
| 2942 } | 2952 } |
| 2943 // Clear marking bits for current cell. | 2953 // Clear marking bits for current cell. |
| 2944 cells[cell_index] = 0; | 2954 cells[cell_index] = 0; |
| 2945 } | 2955 } |
| 2946 if (free_start != p->ObjectAreaEnd()) { | 2956 if (free_start != p->area_end()) { |
| 2947 space->Free(free_start, static_cast<int>(p->ObjectAreaEnd() - free_start)); | 2957 space->Free(free_start, static_cast<int>(p->area_end() - free_start)); |
| 2948 } | 2958 } |
| 2949 p->ResetLiveBytes(); | 2959 p->ResetLiveBytes(); |
| 2950 } | 2960 } |
| 2951 | 2961 |
| 2952 | 2962 |
| 2953 static bool SetMarkBitsUnderInvalidatedCode(Code* code, bool value) { | 2963 static bool SetMarkBitsUnderInvalidatedCode(Code* code, bool value) { |
| 2954 Page* p = Page::FromAddress(code->address()); | 2964 Page* p = Page::FromAddress(code->address()); |
| 2955 | 2965 |
| 2956 if (p->IsEvacuationCandidate() || | 2966 if (p->IsEvacuationCandidate() || |
| 2957 p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { | 2967 p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3230 VerifyEvacuation(heap_); | 3240 VerifyEvacuation(heap_); |
| 3231 } | 3241 } |
| 3232 #endif | 3242 #endif |
| 3233 | 3243 |
| 3234 slots_buffer_allocator_.DeallocateChain(&migration_slots_buffer_); | 3244 slots_buffer_allocator_.DeallocateChain(&migration_slots_buffer_); |
| 3235 ASSERT(migration_slots_buffer_ == NULL); | 3245 ASSERT(migration_slots_buffer_ == NULL); |
| 3236 for (int i = 0; i < npages; i++) { | 3246 for (int i = 0; i < npages; i++) { |
| 3237 Page* p = evacuation_candidates_[i]; | 3247 Page* p = evacuation_candidates_[i]; |
| 3238 if (!p->IsEvacuationCandidate()) continue; | 3248 if (!p->IsEvacuationCandidate()) continue; |
| 3239 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); | 3249 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); |
| 3240 space->Free(p->ObjectAreaStart(), Page::kObjectAreaSize); | 3250 space->Free(p->area_start(), p->area_size()); |
| 3241 p->set_scan_on_scavenge(false); | 3251 p->set_scan_on_scavenge(false); |
| 3242 slots_buffer_allocator_.DeallocateChain(p->slots_buffer_address()); | 3252 slots_buffer_allocator_.DeallocateChain(p->slots_buffer_address()); |
| 3243 p->ClearEvacuationCandidate(); | 3253 p->ClearEvacuationCandidate(); |
| 3244 } | 3254 } |
| 3245 evacuation_candidates_.Rewind(0); | 3255 evacuation_candidates_.Rewind(0); |
| 3246 compacting_ = false; | 3256 compacting_ = false; |
| 3247 } | 3257 } |
| 3248 | 3258 |
| 3249 | 3259 |
| 3250 static const int kStartTableEntriesPerLine = 5; | 3260 static const int kStartTableEntriesPerLine = 5; |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3531 // memory that can be ignored when scanning. Dead objects other than free | 3541 // memory that can be ignored when scanning. Dead objects other than free |
| 3532 // spaces will not contain the free space map. | 3542 // spaces will not contain the free space map. |
| 3533 intptr_t MarkCompactCollector::SweepConservatively(PagedSpace* space, Page* p) { | 3543 intptr_t MarkCompactCollector::SweepConservatively(PagedSpace* space, Page* p) { |
| 3534 ASSERT(!p->IsEvacuationCandidate() && !p->WasSwept()); | 3544 ASSERT(!p->IsEvacuationCandidate() && !p->WasSwept()); |
| 3535 MarkBit::CellType* cells = p->markbits()->cells(); | 3545 MarkBit::CellType* cells = p->markbits()->cells(); |
| 3536 p->MarkSweptConservatively(); | 3546 p->MarkSweptConservatively(); |
| 3537 | 3547 |
| 3538 int last_cell_index = | 3548 int last_cell_index = |
| 3539 Bitmap::IndexToCell( | 3549 Bitmap::IndexToCell( |
| 3540 Bitmap::CellAlignIndex( | 3550 Bitmap::CellAlignIndex( |
| 3541 p->AddressToMarkbitIndex(p->ObjectAreaEnd()))); | 3551 p->AddressToMarkbitIndex(p->area_end()))); |
| 3542 | 3552 |
| 3543 int cell_index = Page::kFirstUsedCell; | 3553 int cell_index = |
| 3554 Bitmap::IndexToCell( |
| 3555 Bitmap::CellAlignIndex( |
| 3556 p->AddressToMarkbitIndex(p->area_start()))); |
| 3557 |
| 3544 intptr_t freed_bytes = 0; | 3558 intptr_t freed_bytes = 0; |
| 3545 | 3559 |
| 3546 // This is the start of the 32 word block that we are currently looking at. | 3560 // This is the start of the 32 word block that we are currently looking at. |
| 3547 Address block_address = p->ObjectAreaStart(); | 3561 Address block_address = p->area_start(); |
| 3548 | 3562 |
| 3549 // Skip over all the dead objects at the start of the page and mark them free. | 3563 // Skip over all the dead objects at the start of the page and mark them free. |
| 3550 for (cell_index = Page::kFirstUsedCell; | 3564 for (; |
| 3551 cell_index < last_cell_index; | 3565 cell_index < last_cell_index; |
| 3552 cell_index++, block_address += 32 * kPointerSize) { | 3566 cell_index++, block_address += 32 * kPointerSize) { |
| 3553 if (cells[cell_index] != 0) break; | 3567 if (cells[cell_index] != 0) break; |
| 3554 } | 3568 } |
| 3555 size_t size = block_address - p->ObjectAreaStart(); | 3569 size_t size = block_address - p->area_start(); |
| 3556 if (cell_index == last_cell_index) { | 3570 if (cell_index == last_cell_index) { |
| 3557 freed_bytes += static_cast<int>(space->Free(p->ObjectAreaStart(), | 3571 freed_bytes += static_cast<int>(space->Free(p->area_start(), |
| 3558 static_cast<int>(size))); | 3572 static_cast<int>(size))); |
| 3559 ASSERT_EQ(0, p->LiveBytes()); | 3573 ASSERT_EQ(0, p->LiveBytes()); |
| 3560 return freed_bytes; | 3574 return freed_bytes; |
| 3561 } | 3575 } |
| 3562 // Grow the size of the start-of-page free space a little to get up to the | 3576 // Grow the size of the start-of-page free space a little to get up to the |
| 3563 // first live object. | 3577 // first live object. |
| 3564 Address free_end = StartOfLiveObject(block_address, cells[cell_index]); | 3578 Address free_end = StartOfLiveObject(block_address, cells[cell_index]); |
| 3565 // Free the first free space. | 3579 // Free the first free space. |
| 3566 size = free_end - p->ObjectAreaStart(); | 3580 size = free_end - p->area_start(); |
| 3567 freed_bytes += space->Free(p->ObjectAreaStart(), | 3581 freed_bytes += space->Free(p->area_start(), |
| 3568 static_cast<int>(size)); | 3582 static_cast<int>(size)); |
| 3569 // The start of the current free area is represented in undigested form by | 3583 // The start of the current free area is represented in undigested form by |
| 3570 // the address of the last 32-word section that contained a live object and | 3584 // the address of the last 32-word section that contained a live object and |
| 3571 // the marking bitmap for that cell, which describes where the live object | 3585 // the marking bitmap for that cell, which describes where the live object |
| 3572 // started. Unless we find a large free space in the bitmap we will not | 3586 // started. Unless we find a large free space in the bitmap we will not |
| 3573 // digest this pair into a real address. We start the iteration here at the | 3587 // digest this pair into a real address. We start the iteration here at the |
| 3574 // first word in the marking bit map that indicates a live object. | 3588 // first word in the marking bit map that indicates a live object. |
| 3575 Address free_start = block_address; | 3589 Address free_start = block_address; |
| 3576 uint32_t free_start_cell = cells[cell_index]; | 3590 uint32_t free_start_cell = cells[cell_index]; |
| 3577 | 3591 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3938 while (buffer != NULL) { | 3952 while (buffer != NULL) { |
| 3939 SlotsBuffer* next_buffer = buffer->next(); | 3953 SlotsBuffer* next_buffer = buffer->next(); |
| 3940 DeallocateBuffer(buffer); | 3954 DeallocateBuffer(buffer); |
| 3941 buffer = next_buffer; | 3955 buffer = next_buffer; |
| 3942 } | 3956 } |
| 3943 *buffer_address = NULL; | 3957 *buffer_address = NULL; |
| 3944 } | 3958 } |
| 3945 | 3959 |
| 3946 | 3960 |
| 3947 } } // namespace v8::internal | 3961 } } // namespace v8::internal |
| OLD | NEW |