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