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/heap/spaces.h" | 5 #include "src/heap/spaces.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/base/platform/semaphore.h" | 9 #include "src/base/platform/semaphore.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2916 return 0; | 2916 return 0; |
2917 } | 2917 } |
2918 size_t used_size = RoundUp((object->address() - address()) + object->Size(), | 2918 size_t used_size = RoundUp((object->address() - address()) + object->Size(), |
2919 base::OS::CommitPageSize()); | 2919 base::OS::CommitPageSize()); |
2920 if (used_size < CommittedPhysicalMemory()) { | 2920 if (used_size < CommittedPhysicalMemory()) { |
2921 return address() + used_size; | 2921 return address() + used_size; |
2922 } | 2922 } |
2923 return 0; | 2923 return 0; |
2924 } | 2924 } |
2925 | 2925 |
| 2926 void LargePage::ClearOutOfLiveRangeSlots(Address free_start) { |
| 2927 if (old_to_new_slots() != nullptr) { |
| 2928 old_to_new_slots()->RemoveRange( |
| 2929 static_cast<int>(free_start - address()), |
| 2930 static_cast<int>(free_start + size() - address())); |
| 2931 } |
| 2932 if (old_to_old_slots() != nullptr) { |
| 2933 old_to_old_slots()->RemoveRange( |
| 2934 static_cast<int>(free_start - address()), |
| 2935 static_cast<int>(free_start + size() - address())); |
| 2936 } |
| 2937 } |
| 2938 |
2926 // ----------------------------------------------------------------------------- | 2939 // ----------------------------------------------------------------------------- |
2927 // LargeObjectIterator | 2940 // LargeObjectIterator |
2928 | 2941 |
2929 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space) { | 2942 LargeObjectIterator::LargeObjectIterator(LargeObjectSpace* space) { |
2930 current_ = space->first_page_; | 2943 current_ = space->first_page_; |
2931 } | 2944 } |
2932 | 2945 |
2933 | 2946 |
2934 HeapObject* LargeObjectIterator::Next() { | 2947 HeapObject* LargeObjectIterator::Next() { |
2935 if (current_ == NULL) return NULL; | 2948 if (current_ == NULL) return NULL; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3076 LargePage* previous = NULL; | 3089 LargePage* previous = NULL; |
3077 LargePage* current = first_page_; | 3090 LargePage* current = first_page_; |
3078 while (current != NULL) { | 3091 while (current != NULL) { |
3079 HeapObject* object = current->GetObject(); | 3092 HeapObject* object = current->GetObject(); |
3080 MarkBit mark_bit = Marking::MarkBitFrom(object); | 3093 MarkBit mark_bit = Marking::MarkBitFrom(object); |
3081 DCHECK(!Marking::IsGrey(mark_bit)); | 3094 DCHECK(!Marking::IsGrey(mark_bit)); |
3082 if (Marking::IsBlack(mark_bit)) { | 3095 if (Marking::IsBlack(mark_bit)) { |
3083 Address free_start; | 3096 Address free_start; |
3084 if ((free_start = current->GetAddressToShrink()) != 0) { | 3097 if ((free_start = current->GetAddressToShrink()) != 0) { |
3085 // TODO(hpayer): Perform partial free concurrently. | 3098 // TODO(hpayer): Perform partial free concurrently. |
| 3099 current->ClearOutOfLiveRangeSlots(free_start); |
3086 heap()->memory_allocator()->PartialFreeMemory(current, free_start); | 3100 heap()->memory_allocator()->PartialFreeMemory(current, free_start); |
3087 } | 3101 } |
3088 previous = current; | 3102 previous = current; |
3089 current = current->next_page(); | 3103 current = current->next_page(); |
3090 } else { | 3104 } else { |
3091 LargePage* page = current; | 3105 LargePage* page = current; |
3092 // Cut the chunk out from the chunk list. | 3106 // Cut the chunk out from the chunk list. |
3093 current = current->next_page(); | 3107 current = current->next_page(); |
3094 if (previous == NULL) { | 3108 if (previous == NULL) { |
3095 first_page_ = current; | 3109 first_page_ = current; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3240 object->ShortPrint(); | 3254 object->ShortPrint(); |
3241 PrintF("\n"); | 3255 PrintF("\n"); |
3242 } | 3256 } |
3243 printf(" --------------------------------------\n"); | 3257 printf(" --------------------------------------\n"); |
3244 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3258 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3245 } | 3259 } |
3246 | 3260 |
3247 #endif // DEBUG | 3261 #endif // DEBUG |
3248 } // namespace internal | 3262 } // namespace internal |
3249 } // namespace v8 | 3263 } // namespace v8 |
OLD | NEW |