| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 next_object_must_be_here_or_later = current + object->Size(); | 99 next_object_must_be_here_or_later = current + object->Size(); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 | 104 |
| 105 static void VerifyMarking(NewSpace* space) { | 105 static void VerifyMarking(NewSpace* space) { |
| 106 Address end = space->top(); | 106 Address end = space->top(); |
| 107 NewSpacePageIterator it(space->bottom(), end); | 107 NewSpacePageIterator it(space->bottom(), end); |
| 108 // The bottom position is at the start of its page. Allows us to use | 108 // The bottom position is at the start of its page. Allows us to use |
| 109 // page->body() as start of range on all pages. | 109 // page->area_start() as start of range on all pages. |
| 110 ASSERT_EQ(space->bottom(), | 110 ASSERT_EQ(space->bottom(), |
| 111 NewSpacePage::FromAddress(space->bottom())->body()); | 111 NewSpacePage::FromAddress(space->bottom())->area_start()); |
| 112 while (it.has_next()) { | 112 while (it.has_next()) { |
| 113 NewSpacePage* page = it.next(); | 113 NewSpacePage* page = it.next(); |
| 114 Address limit = it.has_next() ? page->body_limit() : end; | 114 Address limit = it.has_next() ? page->area_end() : end; |
| 115 ASSERT(limit == end || !page->Contains(end)); | 115 ASSERT(limit == end || !page->Contains(end)); |
| 116 VerifyMarking(page->body(), limit); | 116 VerifyMarking(page->area_start(), limit); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 | 120 |
| 121 static void VerifyMarking(PagedSpace* space) { | 121 static void VerifyMarking(PagedSpace* space) { |
| 122 PageIterator it(space); | 122 PageIterator it(space); |
| 123 | 123 |
| 124 while (it.has_next()) { | 124 while (it.has_next()) { |
| 125 Page* p = it.next(); | 125 Page* p = it.next(); |
| 126 VerifyMarking(p->ObjectAreaStart(), p->ObjectAreaEnd()); | 126 VerifyMarking(p->area_start(), p->area_end()); |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 | 129 |
| 130 | 130 |
| 131 static void VerifyMarking(Heap* heap) { | 131 static void VerifyMarking(Heap* heap) { |
| 132 VerifyMarking(heap->old_pointer_space()); | 132 VerifyMarking(heap->old_pointer_space()); |
| 133 VerifyMarking(heap->old_data_space()); | 133 VerifyMarking(heap->old_data_space()); |
| 134 VerifyMarking(heap->code_space()); | 134 VerifyMarking(heap->code_space()); |
| 135 VerifyMarking(heap->cell_space()); | 135 VerifyMarking(heap->cell_space()); |
| 136 VerifyMarking(heap->map_space()); | 136 VerifyMarking(heap->map_space()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 | 182 |
| 183 static void VerifyEvacuation(NewSpace* space) { | 183 static void VerifyEvacuation(NewSpace* space) { |
| 184 NewSpacePageIterator it(space->bottom(), space->top()); | 184 NewSpacePageIterator it(space->bottom(), space->top()); |
| 185 VerifyEvacuationVisitor visitor; | 185 VerifyEvacuationVisitor visitor; |
| 186 | 186 |
| 187 while (it.has_next()) { | 187 while (it.has_next()) { |
| 188 NewSpacePage* page = it.next(); | 188 NewSpacePage* page = it.next(); |
| 189 Address current = page->body(); | 189 Address current = page->area_start(); |
| 190 Address limit = it.has_next() ? page->body_limit() : space->top(); | 190 Address limit = it.has_next() ? page->area_end() : space->top(); |
| 191 ASSERT(limit == space->top() || !page->Contains(space->top())); | 191 ASSERT(limit == space->top() || !page->Contains(space->top())); |
| 192 while (current < limit) { | 192 while (current < limit) { |
| 193 HeapObject* object = HeapObject::FromAddress(current); | 193 HeapObject* object = HeapObject::FromAddress(current); |
| 194 object->Iterate(&visitor); | 194 object->Iterate(&visitor); |
| 195 current += object->Size(); | 195 current += object->Size(); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 | 200 |
| 201 static void VerifyEvacuation(PagedSpace* space) { | 201 static void VerifyEvacuation(PagedSpace* space) { |
| 202 PageIterator it(space); | 202 PageIterator it(space); |
| 203 | 203 |
| 204 while (it.has_next()) { | 204 while (it.has_next()) { |
| 205 Page* p = it.next(); | 205 Page* p = it.next(); |
| 206 if (p->IsEvacuationCandidate()) continue; | 206 if (p->IsEvacuationCandidate()) continue; |
| 207 VerifyEvacuation(p->ObjectAreaStart(), p->ObjectAreaEnd()); | 207 VerifyEvacuation(p->area_start(), p->area_end()); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 | 211 |
| 212 static void VerifyEvacuation(Heap* heap) { | 212 static void VerifyEvacuation(Heap* heap) { |
| 213 VerifyEvacuation(heap->old_pointer_space()); | 213 VerifyEvacuation(heap->old_pointer_space()); |
| 214 VerifyEvacuation(heap->old_data_space()); | 214 VerifyEvacuation(heap->old_data_space()); |
| 215 VerifyEvacuation(heap->code_space()); | 215 VerifyEvacuation(heap->code_space()); |
| 216 VerifyEvacuation(heap->cell_space()); | 216 VerifyEvacuation(heap->cell_space()); |
| 217 VerifyEvacuation(heap->map_space()); | 217 VerifyEvacuation(heap->map_space()); |
| (...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1772 ASSERT(strcmp(Marking::kWhiteBitPattern, "00") == 0); | 1772 ASSERT(strcmp(Marking::kWhiteBitPattern, "00") == 0); |
| 1773 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0); | 1773 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0); |
| 1774 ASSERT(strcmp(Marking::kGreyBitPattern, "11") == 0); | 1774 ASSERT(strcmp(Marking::kGreyBitPattern, "11") == 0); |
| 1775 ASSERT(strcmp(Marking::kImpossibleBitPattern, "01") == 0); | 1775 ASSERT(strcmp(Marking::kImpossibleBitPattern, "01") == 0); |
| 1776 | 1776 |
| 1777 MarkBit::CellType* cells = p->markbits()->cells(); | 1777 MarkBit::CellType* cells = p->markbits()->cells(); |
| 1778 | 1778 |
| 1779 int last_cell_index = | 1779 int last_cell_index = |
| 1780 Bitmap::IndexToCell( | 1780 Bitmap::IndexToCell( |
| 1781 Bitmap::CellAlignIndex( | 1781 Bitmap::CellAlignIndex( |
| 1782 p->AddressToMarkbitIndex(p->ObjectAreaEnd()))); | 1782 p->AddressToMarkbitIndex(p->area_end()))); |
| 1783 | 1783 |
| 1784 int cell_index = Page::kFirstUsedCell; | 1784 Address cell_base = p->area_start(); |
| 1785 Address cell_base = p->ObjectAreaStart(); | 1785 int cell_index = Bitmap::IndexToCell( |
| 1786 Bitmap::CellAlignIndex( |
| 1787 p->AddressToMarkbitIndex(cell_base))); |
| 1786 | 1788 |
| 1787 for (cell_index = Page::kFirstUsedCell; | 1789 |
| 1790 for (; |
| 1788 cell_index < last_cell_index; | 1791 cell_index < last_cell_index; |
| 1789 cell_index++, cell_base += 32 * kPointerSize) { | 1792 cell_index++, cell_base += 32 * kPointerSize) { |
| 1790 ASSERT((unsigned)cell_index == | 1793 ASSERT((unsigned)cell_index == |
| 1791 Bitmap::IndexToCell( | 1794 Bitmap::IndexToCell( |
| 1792 Bitmap::CellAlignIndex( | 1795 Bitmap::CellAlignIndex( |
| 1793 p->AddressToMarkbitIndex(cell_base)))); | 1796 p->AddressToMarkbitIndex(cell_base)))); |
| 1794 | 1797 |
| 1795 const MarkBit::CellType current_cell = cells[cell_index]; | 1798 const MarkBit::CellType current_cell = cells[cell_index]; |
| 1796 if (current_cell == 0) continue; | 1799 if (current_cell == 0) continue; |
| 1797 | 1800 |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2576 } | 2579 } |
| 2577 | 2580 |
| 2578 return String::cast(*p); | 2581 return String::cast(*p); |
| 2579 } | 2582 } |
| 2580 | 2583 |
| 2581 | 2584 |
| 2582 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, | 2585 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, |
| 2583 int object_size) { | 2586 int object_size) { |
| 2584 Object* result; | 2587 Object* result; |
| 2585 | 2588 |
| 2586 if (object_size > heap()->MaxObjectSizeInPagedSpace()) { | 2589 if (object_size > Page::kMaxNonCodeHeapObjectSize) { |
| 2587 MaybeObject* maybe_result = | 2590 MaybeObject* maybe_result = |
| 2588 heap()->lo_space()->AllocateRaw(object_size, NOT_EXECUTABLE); | 2591 heap()->lo_space()->AllocateRaw(object_size, NOT_EXECUTABLE); |
| 2589 if (maybe_result->ToObject(&result)) { | 2592 if (maybe_result->ToObject(&result)) { |
| 2590 HeapObject* target = HeapObject::cast(result); | 2593 HeapObject* target = HeapObject::cast(result); |
| 2591 MigrateObject(target->address(), | 2594 MigrateObject(target->address(), |
| 2592 object->address(), | 2595 object->address(), |
| 2593 object_size, | 2596 object_size, |
| 2594 LO_SPACE); | 2597 LO_SPACE); |
| 2595 heap()->mark_compact_collector()->tracer()-> | 2598 heap()->mark_compact_collector()->tracer()-> |
| 2596 increment_promoted_objects_size(object_size); | 2599 increment_promoted_objects_size(object_size); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2690 void MarkCompactCollector::EvacuateLiveObjectsFromPage(Page* p) { | 2693 void MarkCompactCollector::EvacuateLiveObjectsFromPage(Page* p) { |
| 2691 AlwaysAllocateScope always_allocate; | 2694 AlwaysAllocateScope always_allocate; |
| 2692 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); | 2695 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); |
| 2693 ASSERT(p->IsEvacuationCandidate() && !p->WasSwept()); | 2696 ASSERT(p->IsEvacuationCandidate() && !p->WasSwept()); |
| 2694 MarkBit::CellType* cells = p->markbits()->cells(); | 2697 MarkBit::CellType* cells = p->markbits()->cells(); |
| 2695 p->MarkSweptPrecisely(); | 2698 p->MarkSweptPrecisely(); |
| 2696 | 2699 |
| 2697 int last_cell_index = | 2700 int last_cell_index = |
| 2698 Bitmap::IndexToCell( | 2701 Bitmap::IndexToCell( |
| 2699 Bitmap::CellAlignIndex( | 2702 Bitmap::CellAlignIndex( |
| 2700 p->AddressToMarkbitIndex(p->ObjectAreaEnd()))); | 2703 p->AddressToMarkbitIndex(p->area_end()))); |
| 2701 | 2704 |
| 2702 int cell_index = Page::kFirstUsedCell; | 2705 Address cell_base = p->area_start(); |
| 2703 Address cell_base = p->ObjectAreaStart(); | 2706 int cell_index = Bitmap::IndexToCell( |
| 2707 Bitmap::CellAlignIndex( |
| 2708 p->AddressToMarkbitIndex(cell_base))); |
| 2709 |
| 2704 int offsets[16]; | 2710 int offsets[16]; |
| 2705 | 2711 |
| 2706 for (cell_index = Page::kFirstUsedCell; | 2712 for (; |
| 2707 cell_index < last_cell_index; | 2713 cell_index < last_cell_index; |
| 2708 cell_index++, cell_base += 32 * kPointerSize) { | 2714 cell_index++, cell_base += 32 * kPointerSize) { |
| 2709 ASSERT((unsigned)cell_index == | 2715 ASSERT((unsigned)cell_index == |
| 2710 Bitmap::IndexToCell( | 2716 Bitmap::IndexToCell( |
| 2711 Bitmap::CellAlignIndex( | 2717 Bitmap::CellAlignIndex( |
| 2712 p->AddressToMarkbitIndex(cell_base)))); | 2718 p->AddressToMarkbitIndex(cell_base)))); |
| 2713 if (cells[cell_index] == 0) continue; | 2719 if (cells[cell_index] == 0) continue; |
| 2714 | 2720 |
| 2715 int live_objects = MarkWordToObjectStarts(cells[cell_index], offsets); | 2721 int live_objects = MarkWordToObjectStarts(cells[cell_index], offsets); |
| 2716 for (int i = 0; i < live_objects; i++) { | 2722 for (int i = 0; i < live_objects; i++) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2851 ASSERT_EQ(skip_list_mode == REBUILD_SKIP_LIST, | 2857 ASSERT_EQ(skip_list_mode == REBUILD_SKIP_LIST, |
| 2852 space->identity() == CODE_SPACE); | 2858 space->identity() == CODE_SPACE); |
| 2853 ASSERT((p->skip_list() == NULL) || (skip_list_mode == REBUILD_SKIP_LIST)); | 2859 ASSERT((p->skip_list() == NULL) || (skip_list_mode == REBUILD_SKIP_LIST)); |
| 2854 | 2860 |
| 2855 MarkBit::CellType* cells = p->markbits()->cells(); | 2861 MarkBit::CellType* cells = p->markbits()->cells(); |
| 2856 p->MarkSweptPrecisely(); | 2862 p->MarkSweptPrecisely(); |
| 2857 | 2863 |
| 2858 int last_cell_index = | 2864 int last_cell_index = |
| 2859 Bitmap::IndexToCell( | 2865 Bitmap::IndexToCell( |
| 2860 Bitmap::CellAlignIndex( | 2866 Bitmap::CellAlignIndex( |
| 2861 p->AddressToMarkbitIndex(p->ObjectAreaEnd()))); | 2867 p->AddressToMarkbitIndex(p->area_end()))); |
| 2862 | 2868 |
| 2863 int cell_index = Page::kFirstUsedCell; | 2869 Address free_start = p->area_start(); |
| 2864 Address free_start = p->ObjectAreaStart(); | 2870 int cell_index = |
| 2871 Bitmap::IndexToCell( |
| 2872 Bitmap::CellAlignIndex( |
| 2873 p->AddressToMarkbitIndex(free_start))); |
| 2874 |
| 2865 ASSERT(reinterpret_cast<intptr_t>(free_start) % (32 * kPointerSize) == 0); | 2875 ASSERT(reinterpret_cast<intptr_t>(free_start) % (32 * kPointerSize) == 0); |
| 2866 Address object_address = p->ObjectAreaStart(); | 2876 Address object_address = free_start; |
| 2867 int offsets[16]; | 2877 int offsets[16]; |
| 2868 | 2878 |
| 2869 SkipList* skip_list = p->skip_list(); | 2879 SkipList* skip_list = p->skip_list(); |
| 2870 int curr_region = -1; | 2880 int curr_region = -1; |
| 2871 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list) { | 2881 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list) { |
| 2872 skip_list->Clear(); | 2882 skip_list->Clear(); |
| 2873 } | 2883 } |
| 2874 | 2884 |
| 2875 for (cell_index = Page::kFirstUsedCell; | 2885 for (; |
| 2876 cell_index < last_cell_index; | 2886 cell_index < last_cell_index; |
| 2877 cell_index++, object_address += 32 * kPointerSize) { | 2887 cell_index++, object_address += 32 * kPointerSize) { |
| 2878 ASSERT((unsigned)cell_index == | 2888 ASSERT((unsigned)cell_index == |
| 2879 Bitmap::IndexToCell( | 2889 Bitmap::IndexToCell( |
| 2880 Bitmap::CellAlignIndex( | 2890 Bitmap::CellAlignIndex( |
| 2881 p->AddressToMarkbitIndex(object_address)))); | 2891 p->AddressToMarkbitIndex(object_address)))); |
| 2882 int live_objects = MarkWordToObjectStarts(cells[cell_index], offsets); | 2892 int live_objects = MarkWordToObjectStarts(cells[cell_index], offsets); |
| 2883 int live_index = 0; | 2893 int live_index = 0; |
| 2884 for ( ; live_objects != 0; live_objects--) { | 2894 for ( ; live_objects != 0; live_objects--) { |
| 2885 Address free_end = object_address + offsets[live_index++] * kPointerSize; | 2895 Address free_end = object_address + offsets[live_index++] * kPointerSize; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2902 new_region_end != curr_region) { | 2912 new_region_end != curr_region) { |
| 2903 skip_list->AddObject(free_end, size); | 2913 skip_list->AddObject(free_end, size); |
| 2904 curr_region = new_region_end; | 2914 curr_region = new_region_end; |
| 2905 } | 2915 } |
| 2906 } | 2916 } |
| 2907 free_start = free_end + size; | 2917 free_start = free_end + size; |
| 2908 } | 2918 } |
| 2909 // Clear marking bits for current cell. | 2919 // Clear marking bits for current cell. |
| 2910 cells[cell_index] = 0; | 2920 cells[cell_index] = 0; |
| 2911 } | 2921 } |
| 2912 if (free_start != p->ObjectAreaEnd()) { | 2922 if (free_start != p->area_end()) { |
| 2913 space->Free(free_start, static_cast<int>(p->ObjectAreaEnd() - free_start)); | 2923 space->Free(free_start, static_cast<int>(p->area_end() - free_start)); |
| 2914 } | 2924 } |
| 2915 p->ResetLiveBytes(); | 2925 p->ResetLiveBytes(); |
| 2916 } | 2926 } |
| 2917 | 2927 |
| 2918 | 2928 |
| 2919 static bool SetMarkBitsUnderInvalidatedCode(Code* code, bool value) { | 2929 static bool SetMarkBitsUnderInvalidatedCode(Code* code, bool value) { |
| 2920 Page* p = Page::FromAddress(code->address()); | 2930 Page* p = Page::FromAddress(code->address()); |
| 2921 | 2931 |
| 2922 if (p->IsEvacuationCandidate() || | 2932 if (p->IsEvacuationCandidate() || |
| 2923 p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { | 2933 p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3196 VerifyEvacuation(heap_); | 3206 VerifyEvacuation(heap_); |
| 3197 } | 3207 } |
| 3198 #endif | 3208 #endif |
| 3199 | 3209 |
| 3200 slots_buffer_allocator_.DeallocateChain(&migration_slots_buffer_); | 3210 slots_buffer_allocator_.DeallocateChain(&migration_slots_buffer_); |
| 3201 ASSERT(migration_slots_buffer_ == NULL); | 3211 ASSERT(migration_slots_buffer_ == NULL); |
| 3202 for (int i = 0; i < npages; i++) { | 3212 for (int i = 0; i < npages; i++) { |
| 3203 Page* p = evacuation_candidates_[i]; | 3213 Page* p = evacuation_candidates_[i]; |
| 3204 if (!p->IsEvacuationCandidate()) continue; | 3214 if (!p->IsEvacuationCandidate()) continue; |
| 3205 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); | 3215 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); |
| 3206 space->Free(p->ObjectAreaStart(), Page::kObjectAreaSize); | 3216 space->Free(p->area_start(), p->area_size()); |
| 3207 p->set_scan_on_scavenge(false); | 3217 p->set_scan_on_scavenge(false); |
| 3208 slots_buffer_allocator_.DeallocateChain(p->slots_buffer_address()); | 3218 slots_buffer_allocator_.DeallocateChain(p->slots_buffer_address()); |
| 3209 p->ClearEvacuationCandidate(); | 3219 p->ClearEvacuationCandidate(); |
| 3210 } | 3220 } |
| 3211 evacuation_candidates_.Rewind(0); | 3221 evacuation_candidates_.Rewind(0); |
| 3212 compacting_ = false; | 3222 compacting_ = false; |
| 3213 } | 3223 } |
| 3214 | 3224 |
| 3215 | 3225 |
| 3216 static const int kStartTableEntriesPerLine = 5; | 3226 static const int kStartTableEntriesPerLine = 5; |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3497 // memory that can be ignored when scanning. Dead objects other than free | 3507 // memory that can be ignored when scanning. Dead objects other than free |
| 3498 // spaces will not contain the free space map. | 3508 // spaces will not contain the free space map. |
| 3499 intptr_t MarkCompactCollector::SweepConservatively(PagedSpace* space, Page* p) { | 3509 intptr_t MarkCompactCollector::SweepConservatively(PagedSpace* space, Page* p) { |
| 3500 ASSERT(!p->IsEvacuationCandidate() && !p->WasSwept()); | 3510 ASSERT(!p->IsEvacuationCandidate() && !p->WasSwept()); |
| 3501 MarkBit::CellType* cells = p->markbits()->cells(); | 3511 MarkBit::CellType* cells = p->markbits()->cells(); |
| 3502 p->MarkSweptConservatively(); | 3512 p->MarkSweptConservatively(); |
| 3503 | 3513 |
| 3504 int last_cell_index = | 3514 int last_cell_index = |
| 3505 Bitmap::IndexToCell( | 3515 Bitmap::IndexToCell( |
| 3506 Bitmap::CellAlignIndex( | 3516 Bitmap::CellAlignIndex( |
| 3507 p->AddressToMarkbitIndex(p->ObjectAreaEnd()))); | 3517 p->AddressToMarkbitIndex(p->area_end()))); |
| 3508 | 3518 |
| 3509 int cell_index = Page::kFirstUsedCell; | 3519 int cell_index = |
| 3520 Bitmap::IndexToCell( |
| 3521 Bitmap::CellAlignIndex( |
| 3522 p->AddressToMarkbitIndex(p->area_start()))); |
| 3523 |
| 3510 intptr_t freed_bytes = 0; | 3524 intptr_t freed_bytes = 0; |
| 3511 | 3525 |
| 3512 // This is the start of the 32 word block that we are currently looking at. | 3526 // This is the start of the 32 word block that we are currently looking at. |
| 3513 Address block_address = p->ObjectAreaStart(); | 3527 Address block_address = p->area_start(); |
| 3514 | 3528 |
| 3515 // Skip over all the dead objects at the start of the page and mark them free. | 3529 // Skip over all the dead objects at the start of the page and mark them free. |
| 3516 for (cell_index = Page::kFirstUsedCell; | 3530 for (; |
| 3517 cell_index < last_cell_index; | 3531 cell_index < last_cell_index; |
| 3518 cell_index++, block_address += 32 * kPointerSize) { | 3532 cell_index++, block_address += 32 * kPointerSize) { |
| 3519 if (cells[cell_index] != 0) break; | 3533 if (cells[cell_index] != 0) break; |
| 3520 } | 3534 } |
| 3521 size_t size = block_address - p->ObjectAreaStart(); | 3535 size_t size = block_address - p->area_start(); |
| 3522 if (cell_index == last_cell_index) { | 3536 if (cell_index == last_cell_index) { |
| 3523 freed_bytes += static_cast<int>(space->Free(p->ObjectAreaStart(), | 3537 freed_bytes += static_cast<int>(space->Free(p->area_start(), |
| 3524 static_cast<int>(size))); | 3538 static_cast<int>(size))); |
| 3525 ASSERT_EQ(0, p->LiveBytes()); | 3539 ASSERT_EQ(0, p->LiveBytes()); |
| 3526 return freed_bytes; | 3540 return freed_bytes; |
| 3527 } | 3541 } |
| 3528 // Grow the size of the start-of-page free space a little to get up to the | 3542 // Grow the size of the start-of-page free space a little to get up to the |
| 3529 // first live object. | 3543 // first live object. |
| 3530 Address free_end = StartOfLiveObject(block_address, cells[cell_index]); | 3544 Address free_end = StartOfLiveObject(block_address, cells[cell_index]); |
| 3531 // Free the first free space. | 3545 // Free the first free space. |
| 3532 size = free_end - p->ObjectAreaStart(); | 3546 size = free_end - p->area_start(); |
| 3533 freed_bytes += space->Free(p->ObjectAreaStart(), | 3547 freed_bytes += space->Free(p->area_start(), |
| 3534 static_cast<int>(size)); | 3548 static_cast<int>(size)); |
| 3535 // The start of the current free area is represented in undigested form by | 3549 // The start of the current free area is represented in undigested form by |
| 3536 // the address of the last 32-word section that contained a live object and | 3550 // the address of the last 32-word section that contained a live object and |
| 3537 // the marking bitmap for that cell, which describes where the live object | 3551 // the marking bitmap for that cell, which describes where the live object |
| 3538 // started. Unless we find a large free space in the bitmap we will not | 3552 // started. Unless we find a large free space in the bitmap we will not |
| 3539 // digest this pair into a real address. We start the iteration here at the | 3553 // digest this pair into a real address. We start the iteration here at the |
| 3540 // first word in the marking bit map that indicates a live object. | 3554 // first word in the marking bit map that indicates a live object. |
| 3541 Address free_start = block_address; | 3555 Address free_start = block_address; |
| 3542 uint32_t free_start_cell = cells[cell_index]; | 3556 uint32_t free_start_cell = cells[cell_index]; |
| 3543 | 3557 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3899 while (buffer != NULL) { | 3913 while (buffer != NULL) { |
| 3900 SlotsBuffer* next_buffer = buffer->next(); | 3914 SlotsBuffer* next_buffer = buffer->next(); |
| 3901 DeallocateBuffer(buffer); | 3915 DeallocateBuffer(buffer); |
| 3902 buffer = next_buffer; | 3916 buffer = next_buffer; |
| 3903 } | 3917 } |
| 3904 *buffer_address = NULL; | 3918 *buffer_address = NULL; |
| 3905 } | 3919 } |
| 3906 | 3920 |
| 3907 | 3921 |
| 3908 } } // namespace v8::internal | 3922 } } // namespace v8::internal |
| OLD | NEW |