| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/heap/mark-compact.h" | 5 #include "src/heap/mark-compact.h" |
| 6 | 6 |
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 MarkBit markbit = Marking::MarkBitFrom(object); | 1481 MarkBit markbit = Marking::MarkBitFrom(object); |
| 1482 if ((object->map() != filler_map) && Marking::IsGrey(markbit)) { | 1482 if ((object->map() != filler_map) && Marking::IsGrey(markbit)) { |
| 1483 Marking::GreyToBlack(markbit); | 1483 Marking::GreyToBlack(markbit); |
| 1484 PushBlack(object); | 1484 PushBlack(object); |
| 1485 if (marking_deque()->IsFull()) return; | 1485 if (marking_deque()->IsFull()) return; |
| 1486 } | 1486 } |
| 1487 } | 1487 } |
| 1488 } | 1488 } |
| 1489 | 1489 |
| 1490 | 1490 |
| 1491 static inline int MarkWordToObjectStarts(uint32_t mark_bits, int* starts); | 1491 static inline int MarkWordToObjectStarts(uint32_t mark_bits, Address base, |
| 1492 Address* starts); |
| 1492 | 1493 |
| 1493 | 1494 |
| 1494 void MarkCompactCollector::DiscoverGreyObjectsOnPage(MemoryChunk* p) { | 1495 void MarkCompactCollector::DiscoverGreyObjectsOnPage(MemoryChunk* p) { |
| 1495 DCHECK(!marking_deque()->IsFull()); | 1496 DCHECK(!marking_deque()->IsFull()); |
| 1496 DCHECK(strcmp(Marking::kWhiteBitPattern, "00") == 0); | 1497 DCHECK(strcmp(Marking::kWhiteBitPattern, "00") == 0); |
| 1497 DCHECK(strcmp(Marking::kBlackBitPattern, "10") == 0); | 1498 DCHECK(strcmp(Marking::kBlackBitPattern, "10") == 0); |
| 1498 DCHECK(strcmp(Marking::kGreyBitPattern, "11") == 0); | 1499 DCHECK(strcmp(Marking::kGreyBitPattern, "11") == 0); |
| 1499 DCHECK(strcmp(Marking::kImpossibleBitPattern, "01") == 0); | 1500 DCHECK(strcmp(Marking::kImpossibleBitPattern, "01") == 0); |
| 1500 | 1501 |
| 1501 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { | 1502 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { |
| (...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3169 base::LockGuard<base::Mutex> lock_guard(&evacuation_slots_buffers_mutex_); | 3170 base::LockGuard<base::Mutex> lock_guard(&evacuation_slots_buffers_mutex_); |
| 3170 evacuation_slots_buffers_.Add(evacuation_slots_buffer); | 3171 evacuation_slots_buffers_.Add(evacuation_slots_buffer); |
| 3171 } | 3172 } |
| 3172 | 3173 |
| 3173 | 3174 |
| 3174 bool MarkCompactCollector::EvacuateLiveObjectsFromPage( | 3175 bool MarkCompactCollector::EvacuateLiveObjectsFromPage( |
| 3175 Page* p, PagedSpace* target_space, SlotsBuffer** evacuation_slots_buffer) { | 3176 Page* p, PagedSpace* target_space, SlotsBuffer** evacuation_slots_buffer) { |
| 3176 AlwaysAllocateScope always_allocate(isolate()); | 3177 AlwaysAllocateScope always_allocate(isolate()); |
| 3177 DCHECK(p->IsEvacuationCandidate() && !p->WasSwept()); | 3178 DCHECK(p->IsEvacuationCandidate() && !p->WasSwept()); |
| 3178 | 3179 |
| 3179 int offsets[16]; | 3180 Address starts[16]; |
| 3180 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { | 3181 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { |
| 3181 Address cell_base = it.CurrentCellBase(); | 3182 Address cell_base = it.CurrentCellBase(); |
| 3182 MarkBit::CellType* cell = it.CurrentCell(); | 3183 MarkBit::CellType* cell = it.CurrentCell(); |
| 3183 | 3184 |
| 3184 if (*cell == 0) continue; | 3185 if (*cell == 0) continue; |
| 3185 | 3186 |
| 3186 int live_objects = MarkWordToObjectStarts(*cell, offsets); | 3187 int live_objects = MarkWordToObjectStarts(*cell, cell_base, starts); |
| 3187 for (int i = 0; i < live_objects; i++) { | 3188 for (int i = 0; i < live_objects; i++) { |
| 3188 Address object_addr = cell_base + offsets[i] * kPointerSize; | 3189 HeapObject* object = HeapObject::FromAddress(starts[i]); |
| 3189 HeapObject* object = HeapObject::FromAddress(object_addr); | |
| 3190 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); | 3190 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); |
| 3191 | 3191 |
| 3192 int size = object->Size(); | 3192 int size = object->Size(); |
| 3193 AllocationAlignment alignment = object->RequiredAlignment(); | 3193 AllocationAlignment alignment = object->RequiredAlignment(); |
| 3194 HeapObject* target_object = nullptr; | 3194 HeapObject* target_object = nullptr; |
| 3195 AllocationResult allocation = target_space->AllocateRaw(size, alignment); | 3195 AllocationResult allocation = target_space->AllocateRaw(size, alignment); |
| 3196 if (!allocation.To(&target_object)) { | 3196 if (!allocation.To(&target_object)) { |
| 3197 // We need to abort compaction for this page. Make sure that we reset | 3197 // We need to abort compaction for this page. Make sure that we reset |
| 3198 // the mark bits for objects that have already been migrated. | 3198 // the mark bits for objects that have already been migrated. |
| 3199 if (i > 0) { | 3199 if (i > 0) { |
| 3200 p->markbits()->ClearRange(p->AddressToMarkbitIndex(p->area_start()), | 3200 p->markbits()->ClearRange(p->AddressToMarkbitIndex(p->area_start()), |
| 3201 p->AddressToMarkbitIndex(object_addr)); | 3201 p->AddressToMarkbitIndex(starts[i])); |
| 3202 } | 3202 } |
| 3203 return false; | 3203 return false; |
| 3204 } | 3204 } |
| 3205 | 3205 |
| 3206 MigrateObject(target_object, object, size, target_space->identity(), | 3206 MigrateObject(target_object, object, size, target_space->identity(), |
| 3207 evacuation_slots_buffer); | 3207 evacuation_slots_buffer); |
| 3208 DCHECK(object->map_word().IsForwardingAddress()); | 3208 DCHECK(object->map_word().IsForwardingAddress()); |
| 3209 } | 3209 } |
| 3210 | 3210 |
| 3211 // Clear marking bits for current cell. | 3211 // Clear marking bits for current cell. |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3462 ObjectVisitor* v) { | 3462 ObjectVisitor* v) { |
| 3463 DCHECK(!p->IsEvacuationCandidate() && !p->WasSwept()); | 3463 DCHECK(!p->IsEvacuationCandidate() && !p->WasSwept()); |
| 3464 DCHECK_EQ(skip_list_mode == REBUILD_SKIP_LIST, | 3464 DCHECK_EQ(skip_list_mode == REBUILD_SKIP_LIST, |
| 3465 space->identity() == CODE_SPACE); | 3465 space->identity() == CODE_SPACE); |
| 3466 DCHECK((p->skip_list() == NULL) || (skip_list_mode == REBUILD_SKIP_LIST)); | 3466 DCHECK((p->skip_list() == NULL) || (skip_list_mode == REBUILD_SKIP_LIST)); |
| 3467 DCHECK(parallelism == MarkCompactCollector::SWEEP_ON_MAIN_THREAD || | 3467 DCHECK(parallelism == MarkCompactCollector::SWEEP_ON_MAIN_THREAD || |
| 3468 sweeping_mode == SWEEP_ONLY); | 3468 sweeping_mode == SWEEP_ONLY); |
| 3469 | 3469 |
| 3470 Address free_start = p->area_start(); | 3470 Address free_start = p->area_start(); |
| 3471 DCHECK(reinterpret_cast<intptr_t>(free_start) % (32 * kPointerSize) == 0); | 3471 DCHECK(reinterpret_cast<intptr_t>(free_start) % (32 * kPointerSize) == 0); |
| 3472 int offsets[16]; | 3472 Address starts[16]; |
| 3473 | 3473 |
| 3474 // If we use the skip list for code space pages, we have to lock the skip | 3474 // If we use the skip list for code space pages, we have to lock the skip |
| 3475 // list because it could be accessed concurrently by the runtime or the | 3475 // list because it could be accessed concurrently by the runtime or the |
| 3476 // deoptimizer. | 3476 // deoptimizer. |
| 3477 SkipList* skip_list = p->skip_list(); | 3477 SkipList* skip_list = p->skip_list(); |
| 3478 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list) { | 3478 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list) { |
| 3479 skip_list->Clear(); | 3479 skip_list->Clear(); |
| 3480 } | 3480 } |
| 3481 | 3481 |
| 3482 intptr_t freed_bytes = 0; | 3482 intptr_t freed_bytes = 0; |
| 3483 intptr_t max_freed_bytes = 0; | 3483 intptr_t max_freed_bytes = 0; |
| 3484 int curr_region = -1; | 3484 int curr_region = -1; |
| 3485 | 3485 |
| 3486 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { | 3486 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { |
| 3487 Address cell_base = it.CurrentCellBase(); | 3487 Address cell_base = it.CurrentCellBase(); |
| 3488 MarkBit::CellType* cell = it.CurrentCell(); | 3488 MarkBit::CellType* cell = it.CurrentCell(); |
| 3489 int live_objects = MarkWordToObjectStarts(*cell, offsets); | 3489 int live_objects = MarkWordToObjectStarts(*cell, cell_base, starts); |
| 3490 int live_index = 0; | 3490 int live_index = 0; |
| 3491 for (; live_objects != 0; live_objects--) { | 3491 for (; live_objects != 0; live_objects--) { |
| 3492 Address free_end = cell_base + offsets[live_index++] * kPointerSize; | 3492 Address free_end = starts[live_index++]; |
| 3493 if (free_end != free_start) { | 3493 if (free_end != free_start) { |
| 3494 int size = static_cast<int>(free_end - free_start); | 3494 int size = static_cast<int>(free_end - free_start); |
| 3495 if (free_space_mode == ZAP_FREE_SPACE) { | 3495 if (free_space_mode == ZAP_FREE_SPACE) { |
| 3496 memset(free_start, 0xcc, size); | 3496 memset(free_start, 0xcc, size); |
| 3497 } | 3497 } |
| 3498 freed_bytes = Free<parallelism>(space, free_list, free_start, size); | 3498 freed_bytes = Free<parallelism>(space, free_list, free_start, size); |
| 3499 max_freed_bytes = Max(freed_bytes, max_freed_bytes); | 3499 max_freed_bytes = Max(freed_bytes, max_freed_bytes); |
| 3500 } | 3500 } |
| 3501 HeapObject* live_object = HeapObject::FromAddress(free_end); | 3501 HeapObject* live_object = HeapObject::FromAddress(free_end); |
| 3502 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(live_object))); | 3502 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(live_object))); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3577 SlotsBuffer::RemoveObjectSlots(heap_, p->slots_buffer(), start_slot, | 3577 SlotsBuffer::RemoveObjectSlots(heap_, p->slots_buffer(), start_slot, |
| 3578 end_slot); | 3578 end_slot); |
| 3579 } | 3579 } |
| 3580 } | 3580 } |
| 3581 } | 3581 } |
| 3582 | 3582 |
| 3583 | 3583 |
| 3584 void MarkCompactCollector::VisitLiveObjects(Page* page, | 3584 void MarkCompactCollector::VisitLiveObjects(Page* page, |
| 3585 ObjectVisitor* visitor) { | 3585 ObjectVisitor* visitor) { |
| 3586 // First pass on aborted pages. | 3586 // First pass on aborted pages. |
| 3587 int offsets[16]; | 3587 Address starts[16]; |
| 3588 for (MarkBitCellIterator it(page); !it.Done(); it.Advance()) { | 3588 for (MarkBitCellIterator it(page); !it.Done(); it.Advance()) { |
| 3589 Address cell_base = it.CurrentCellBase(); | 3589 Address cell_base = it.CurrentCellBase(); |
| 3590 MarkBit::CellType* cell = it.CurrentCell(); | 3590 MarkBit::CellType* cell = it.CurrentCell(); |
| 3591 if (*cell == 0) continue; | 3591 if (*cell == 0) continue; |
| 3592 int live_objects = MarkWordToObjectStarts(*cell, offsets); | 3592 int live_objects = MarkWordToObjectStarts(*cell, cell_base, starts); |
| 3593 for (int i = 0; i < live_objects; i++) { | 3593 for (int i = 0; i < live_objects; i++) { |
| 3594 Address object_addr = cell_base + offsets[i] * kPointerSize; | 3594 HeapObject* live_object = HeapObject::FromAddress(starts[i]); |
| 3595 HeapObject* live_object = HeapObject::FromAddress(object_addr); | |
| 3596 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(live_object))); | 3595 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(live_object))); |
| 3597 Map* map = live_object->synchronized_map(); | 3596 Map* map = live_object->synchronized_map(); |
| 3598 int size = live_object->SizeFromMap(map); | 3597 int size = live_object->SizeFromMap(map); |
| 3599 live_object->IterateBody(map->instance_type(), size, visitor); | 3598 live_object->IterateBody(map->instance_type(), size, visitor); |
| 3600 } | 3599 } |
| 3601 } | 3600 } |
| 3602 } | 3601 } |
| 3603 | 3602 |
| 3604 | 3603 |
| 3605 void MarkCompactCollector::SweepAbortedPages() { | 3604 void MarkCompactCollector::SweepAbortedPages() { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3822 CHECK(p->WasSwept()); | 3821 CHECK(p->WasSwept()); |
| 3823 space->ReleasePage(p); | 3822 space->ReleasePage(p); |
| 3824 } | 3823 } |
| 3825 evacuation_candidates_.Rewind(0); | 3824 evacuation_candidates_.Rewind(0); |
| 3826 compacting_ = false; | 3825 compacting_ = false; |
| 3827 heap()->FilterStoreBufferEntriesOnAboutToBeFreedPages(); | 3826 heap()->FilterStoreBufferEntriesOnAboutToBeFreedPages(); |
| 3828 heap()->FreeQueuedChunks(); | 3827 heap()->FreeQueuedChunks(); |
| 3829 } | 3828 } |
| 3830 | 3829 |
| 3831 | 3830 |
| 3832 static const int kStartTableEntriesPerLine = 5; | 3831 // Takes a word of mark bits and a base address. Returns the number of objects |
| 3833 static const int kStartTableLines = 171; | 3832 // that start in the range. Puts the object starts in the supplied array. |
| 3834 static const int kStartTableInvalidLine = 127; | 3833 static inline int MarkWordToObjectStarts(uint32_t mark_bits, Address base, |
| 3835 static const int kStartTableUnusedEntry = 126; | 3834 Address* starts) { |
| 3836 | |
| 3837 #define _ kStartTableUnusedEntry | |
| 3838 #define X kStartTableInvalidLine | |
| 3839 // Mark-bit to object start offset table. | |
| 3840 // | |
| 3841 // The line is indexed by the mark bits in a byte. The first number on | |
| 3842 // the line describes the number of live object starts for the line and the | |
| 3843 // other numbers on the line describe the offsets (in words) of the object | |
| 3844 // starts. | |
| 3845 // | |
| 3846 // Since objects are at least 2 words large we don't have entries for two | |
| 3847 // consecutive 1 bits. All entries after 170 have at least 2 consecutive bits. | |
| 3848 char kStartTable[kStartTableLines * kStartTableEntriesPerLine] = { | |
| 3849 0, _, _, | |
| 3850 _, _, // 0 | |
| 3851 1, 0, _, | |
| 3852 _, _, // 1 | |
| 3853 1, 1, _, | |
| 3854 _, _, // 2 | |
| 3855 X, _, _, | |
| 3856 _, _, // 3 | |
| 3857 1, 2, _, | |
| 3858 _, _, // 4 | |
| 3859 2, 0, 2, | |
| 3860 _, _, // 5 | |
| 3861 X, _, _, | |
| 3862 _, _, // 6 | |
| 3863 X, _, _, | |
| 3864 _, _, // 7 | |
| 3865 1, 3, _, | |
| 3866 _, _, // 8 | |
| 3867 2, 0, 3, | |
| 3868 _, _, // 9 | |
| 3869 2, 1, 3, | |
| 3870 _, _, // 10 | |
| 3871 X, _, _, | |
| 3872 _, _, // 11 | |
| 3873 X, _, _, | |
| 3874 _, _, // 12 | |
| 3875 X, _, _, | |
| 3876 _, _, // 13 | |
| 3877 X, _, _, | |
| 3878 _, _, // 14 | |
| 3879 X, _, _, | |
| 3880 _, _, // 15 | |
| 3881 1, 4, _, | |
| 3882 _, _, // 16 | |
| 3883 2, 0, 4, | |
| 3884 _, _, // 17 | |
| 3885 2, 1, 4, | |
| 3886 _, _, // 18 | |
| 3887 X, _, _, | |
| 3888 _, _, // 19 | |
| 3889 2, 2, 4, | |
| 3890 _, _, // 20 | |
| 3891 3, 0, 2, | |
| 3892 4, _, // 21 | |
| 3893 X, _, _, | |
| 3894 _, _, // 22 | |
| 3895 X, _, _, | |
| 3896 _, _, // 23 | |
| 3897 X, _, _, | |
| 3898 _, _, // 24 | |
| 3899 X, _, _, | |
| 3900 _, _, // 25 | |
| 3901 X, _, _, | |
| 3902 _, _, // 26 | |
| 3903 X, _, _, | |
| 3904 _, _, // 27 | |
| 3905 X, _, _, | |
| 3906 _, _, // 28 | |
| 3907 X, _, _, | |
| 3908 _, _, // 29 | |
| 3909 X, _, _, | |
| 3910 _, _, // 30 | |
| 3911 X, _, _, | |
| 3912 _, _, // 31 | |
| 3913 1, 5, _, | |
| 3914 _, _, // 32 | |
| 3915 2, 0, 5, | |
| 3916 _, _, // 33 | |
| 3917 2, 1, 5, | |
| 3918 _, _, // 34 | |
| 3919 X, _, _, | |
| 3920 _, _, // 35 | |
| 3921 2, 2, 5, | |
| 3922 _, _, // 36 | |
| 3923 3, 0, 2, | |
| 3924 5, _, // 37 | |
| 3925 X, _, _, | |
| 3926 _, _, // 38 | |
| 3927 X, _, _, | |
| 3928 _, _, // 39 | |
| 3929 2, 3, 5, | |
| 3930 _, _, // 40 | |
| 3931 3, 0, 3, | |
| 3932 5, _, // 41 | |
| 3933 3, 1, 3, | |
| 3934 5, _, // 42 | |
| 3935 X, _, _, | |
| 3936 _, _, // 43 | |
| 3937 X, _, _, | |
| 3938 _, _, // 44 | |
| 3939 X, _, _, | |
| 3940 _, _, // 45 | |
| 3941 X, _, _, | |
| 3942 _, _, // 46 | |
| 3943 X, _, _, | |
| 3944 _, _, // 47 | |
| 3945 X, _, _, | |
| 3946 _, _, // 48 | |
| 3947 X, _, _, | |
| 3948 _, _, // 49 | |
| 3949 X, _, _, | |
| 3950 _, _, // 50 | |
| 3951 X, _, _, | |
| 3952 _, _, // 51 | |
| 3953 X, _, _, | |
| 3954 _, _, // 52 | |
| 3955 X, _, _, | |
| 3956 _, _, // 53 | |
| 3957 X, _, _, | |
| 3958 _, _, // 54 | |
| 3959 X, _, _, | |
| 3960 _, _, // 55 | |
| 3961 X, _, _, | |
| 3962 _, _, // 56 | |
| 3963 X, _, _, | |
| 3964 _, _, // 57 | |
| 3965 X, _, _, | |
| 3966 _, _, // 58 | |
| 3967 X, _, _, | |
| 3968 _, _, // 59 | |
| 3969 X, _, _, | |
| 3970 _, _, // 60 | |
| 3971 X, _, _, | |
| 3972 _, _, // 61 | |
| 3973 X, _, _, | |
| 3974 _, _, // 62 | |
| 3975 X, _, _, | |
| 3976 _, _, // 63 | |
| 3977 1, 6, _, | |
| 3978 _, _, // 64 | |
| 3979 2, 0, 6, | |
| 3980 _, _, // 65 | |
| 3981 2, 1, 6, | |
| 3982 _, _, // 66 | |
| 3983 X, _, _, | |
| 3984 _, _, // 67 | |
| 3985 2, 2, 6, | |
| 3986 _, _, // 68 | |
| 3987 3, 0, 2, | |
| 3988 6, _, // 69 | |
| 3989 X, _, _, | |
| 3990 _, _, // 70 | |
| 3991 X, _, _, | |
| 3992 _, _, // 71 | |
| 3993 2, 3, 6, | |
| 3994 _, _, // 72 | |
| 3995 3, 0, 3, | |
| 3996 6, _, // 73 | |
| 3997 3, 1, 3, | |
| 3998 6, _, // 74 | |
| 3999 X, _, _, | |
| 4000 _, _, // 75 | |
| 4001 X, _, _, | |
| 4002 _, _, // 76 | |
| 4003 X, _, _, | |
| 4004 _, _, // 77 | |
| 4005 X, _, _, | |
| 4006 _, _, // 78 | |
| 4007 X, _, _, | |
| 4008 _, _, // 79 | |
| 4009 2, 4, 6, | |
| 4010 _, _, // 80 | |
| 4011 3, 0, 4, | |
| 4012 6, _, // 81 | |
| 4013 3, 1, 4, | |
| 4014 6, _, // 82 | |
| 4015 X, _, _, | |
| 4016 _, _, // 83 | |
| 4017 3, 2, 4, | |
| 4018 6, _, // 84 | |
| 4019 4, 0, 2, | |
| 4020 4, 6, // 85 | |
| 4021 X, _, _, | |
| 4022 _, _, // 86 | |
| 4023 X, _, _, | |
| 4024 _, _, // 87 | |
| 4025 X, _, _, | |
| 4026 _, _, // 88 | |
| 4027 X, _, _, | |
| 4028 _, _, // 89 | |
| 4029 X, _, _, | |
| 4030 _, _, // 90 | |
| 4031 X, _, _, | |
| 4032 _, _, // 91 | |
| 4033 X, _, _, | |
| 4034 _, _, // 92 | |
| 4035 X, _, _, | |
| 4036 _, _, // 93 | |
| 4037 X, _, _, | |
| 4038 _, _, // 94 | |
| 4039 X, _, _, | |
| 4040 _, _, // 95 | |
| 4041 X, _, _, | |
| 4042 _, _, // 96 | |
| 4043 X, _, _, | |
| 4044 _, _, // 97 | |
| 4045 X, _, _, | |
| 4046 _, _, // 98 | |
| 4047 X, _, _, | |
| 4048 _, _, // 99 | |
| 4049 X, _, _, | |
| 4050 _, _, // 100 | |
| 4051 X, _, _, | |
| 4052 _, _, // 101 | |
| 4053 X, _, _, | |
| 4054 _, _, // 102 | |
| 4055 X, _, _, | |
| 4056 _, _, // 103 | |
| 4057 X, _, _, | |
| 4058 _, _, // 104 | |
| 4059 X, _, _, | |
| 4060 _, _, // 105 | |
| 4061 X, _, _, | |
| 4062 _, _, // 106 | |
| 4063 X, _, _, | |
| 4064 _, _, // 107 | |
| 4065 X, _, _, | |
| 4066 _, _, // 108 | |
| 4067 X, _, _, | |
| 4068 _, _, // 109 | |
| 4069 X, _, _, | |
| 4070 _, _, // 110 | |
| 4071 X, _, _, | |
| 4072 _, _, // 111 | |
| 4073 X, _, _, | |
| 4074 _, _, // 112 | |
| 4075 X, _, _, | |
| 4076 _, _, // 113 | |
| 4077 X, _, _, | |
| 4078 _, _, // 114 | |
| 4079 X, _, _, | |
| 4080 _, _, // 115 | |
| 4081 X, _, _, | |
| 4082 _, _, // 116 | |
| 4083 X, _, _, | |
| 4084 _, _, // 117 | |
| 4085 X, _, _, | |
| 4086 _, _, // 118 | |
| 4087 X, _, _, | |
| 4088 _, _, // 119 | |
| 4089 X, _, _, | |
| 4090 _, _, // 120 | |
| 4091 X, _, _, | |
| 4092 _, _, // 121 | |
| 4093 X, _, _, | |
| 4094 _, _, // 122 | |
| 4095 X, _, _, | |
| 4096 _, _, // 123 | |
| 4097 X, _, _, | |
| 4098 _, _, // 124 | |
| 4099 X, _, _, | |
| 4100 _, _, // 125 | |
| 4101 X, _, _, | |
| 4102 _, _, // 126 | |
| 4103 X, _, _, | |
| 4104 _, _, // 127 | |
| 4105 1, 7, _, | |
| 4106 _, _, // 128 | |
| 4107 2, 0, 7, | |
| 4108 _, _, // 129 | |
| 4109 2, 1, 7, | |
| 4110 _, _, // 130 | |
| 4111 X, _, _, | |
| 4112 _, _, // 131 | |
| 4113 2, 2, 7, | |
| 4114 _, _, // 132 | |
| 4115 3, 0, 2, | |
| 4116 7, _, // 133 | |
| 4117 X, _, _, | |
| 4118 _, _, // 134 | |
| 4119 X, _, _, | |
| 4120 _, _, // 135 | |
| 4121 2, 3, 7, | |
| 4122 _, _, // 136 | |
| 4123 3, 0, 3, | |
| 4124 7, _, // 137 | |
| 4125 3, 1, 3, | |
| 4126 7, _, // 138 | |
| 4127 X, _, _, | |
| 4128 _, _, // 139 | |
| 4129 X, _, _, | |
| 4130 _, _, // 140 | |
| 4131 X, _, _, | |
| 4132 _, _, // 141 | |
| 4133 X, _, _, | |
| 4134 _, _, // 142 | |
| 4135 X, _, _, | |
| 4136 _, _, // 143 | |
| 4137 2, 4, 7, | |
| 4138 _, _, // 144 | |
| 4139 3, 0, 4, | |
| 4140 7, _, // 145 | |
| 4141 3, 1, 4, | |
| 4142 7, _, // 146 | |
| 4143 X, _, _, | |
| 4144 _, _, // 147 | |
| 4145 3, 2, 4, | |
| 4146 7, _, // 148 | |
| 4147 4, 0, 2, | |
| 4148 4, 7, // 149 | |
| 4149 X, _, _, | |
| 4150 _, _, // 150 | |
| 4151 X, _, _, | |
| 4152 _, _, // 151 | |
| 4153 X, _, _, | |
| 4154 _, _, // 152 | |
| 4155 X, _, _, | |
| 4156 _, _, // 153 | |
| 4157 X, _, _, | |
| 4158 _, _, // 154 | |
| 4159 X, _, _, | |
| 4160 _, _, // 155 | |
| 4161 X, _, _, | |
| 4162 _, _, // 156 | |
| 4163 X, _, _, | |
| 4164 _, _, // 157 | |
| 4165 X, _, _, | |
| 4166 _, _, // 158 | |
| 4167 X, _, _, | |
| 4168 _, _, // 159 | |
| 4169 2, 5, 7, | |
| 4170 _, _, // 160 | |
| 4171 3, 0, 5, | |
| 4172 7, _, // 161 | |
| 4173 3, 1, 5, | |
| 4174 7, _, // 162 | |
| 4175 X, _, _, | |
| 4176 _, _, // 163 | |
| 4177 3, 2, 5, | |
| 4178 7, _, // 164 | |
| 4179 4, 0, 2, | |
| 4180 5, 7, // 165 | |
| 4181 X, _, _, | |
| 4182 _, _, // 166 | |
| 4183 X, _, _, | |
| 4184 _, _, // 167 | |
| 4185 3, 3, 5, | |
| 4186 7, _, // 168 | |
| 4187 4, 0, 3, | |
| 4188 5, 7, // 169 | |
| 4189 4, 1, 3, | |
| 4190 5, 7 // 170 | |
| 4191 }; | |
| 4192 #undef _ | |
| 4193 #undef X | |
| 4194 | |
| 4195 | |
| 4196 // Takes a word of mark bits. Returns the number of objects that start in the | |
| 4197 // range. Puts the offsets of the words in the supplied array. | |
| 4198 static inline int MarkWordToObjectStarts(uint32_t mark_bits, int* starts) { | |
| 4199 int objects = 0; | 3835 int objects = 0; |
| 4200 int offset = 0; | |
| 4201 | 3836 |
| 4202 // No consecutive 1 bits. | 3837 // No consecutive 1 bits. |
| 4203 DCHECK((mark_bits & 0x180) != 0x180); | 3838 DCHECK((mark_bits & 0x180) != 0x180); |
| 4204 DCHECK((mark_bits & 0x18000) != 0x18000); | 3839 DCHECK((mark_bits & 0x18000) != 0x18000); |
| 4205 DCHECK((mark_bits & 0x1800000) != 0x1800000); | 3840 DCHECK((mark_bits & 0x1800000) != 0x1800000); |
| 4206 | 3841 |
| 4207 while (mark_bits != 0) { | 3842 unsigned index = 0; |
| 4208 int byte = (mark_bits & 0xff); | 3843 while ((index = base::bits::CountTrailingZeros32(mark_bits)) != 32) { |
| 4209 mark_bits >>= 8; | 3844 starts[objects++] = base + kPointerSize * index; |
| 4210 if (byte != 0) { | 3845 mark_bits &= ~(1u << index); |
| 4211 DCHECK(byte < kStartTableLines); // No consecutive 1 bits. | |
| 4212 char* table = kStartTable + byte * kStartTableEntriesPerLine; | |
| 4213 int objects_in_these_8_words = table[0]; | |
| 4214 DCHECK(objects_in_these_8_words != kStartTableInvalidLine); | |
| 4215 DCHECK(objects_in_these_8_words < kStartTableEntriesPerLine); | |
| 4216 for (int i = 0; i < objects_in_these_8_words; i++) { | |
| 4217 starts[objects++] = offset + table[1 + i]; | |
| 4218 } | |
| 4219 } | |
| 4220 offset += 8; | |
| 4221 } | 3846 } |
| 4222 return objects; | 3847 return objects; |
| 4223 } | 3848 } |
| 4224 | 3849 |
| 4225 | 3850 |
| 4226 int MarkCompactCollector::SweepInParallel(PagedSpace* space, | 3851 int MarkCompactCollector::SweepInParallel(PagedSpace* space, |
| 4227 int required_freed_bytes) { | 3852 int required_freed_bytes) { |
| 4228 int max_freed = 0; | 3853 int max_freed = 0; |
| 4229 int max_freed_overall = 0; | 3854 int max_freed_overall = 0; |
| 4230 PageIterator it(space); | 3855 PageIterator it(space); |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4554 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4179 MarkBit mark_bit = Marking::MarkBitFrom(host); |
| 4555 if (Marking::IsBlack(mark_bit)) { | 4180 if (Marking::IsBlack(mark_bit)) { |
| 4556 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); | 4181 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); |
| 4557 RecordRelocSlot(&rinfo, target); | 4182 RecordRelocSlot(&rinfo, target); |
| 4558 } | 4183 } |
| 4559 } | 4184 } |
| 4560 } | 4185 } |
| 4561 | 4186 |
| 4562 } // namespace internal | 4187 } // namespace internal |
| 4563 } // namespace v8 | 4188 } // namespace v8 |
| OLD | NEW |