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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2845 identity(), size_in_bytes, kMaxPagesToSweep); | 2845 identity(), size_in_bytes, kMaxPagesToSweep); |
2846 RefillFreeList(); | 2846 RefillFreeList(); |
2847 if (max_freed >= size_in_bytes) { | 2847 if (max_freed >= size_in_bytes) { |
2848 object = free_list_.Allocate(static_cast<size_t>(size_in_bytes)); | 2848 object = free_list_.Allocate(static_cast<size_t>(size_in_bytes)); |
2849 if (object != nullptr) return object; | 2849 if (object != nullptr) return object; |
2850 } | 2850 } |
2851 } | 2851 } |
2852 | 2852 |
2853 if (heap()->ShouldExpandOldGenerationOnAllocationFailure() && Expand()) { | 2853 if (heap()->ShouldExpandOldGenerationOnAllocationFailure() && Expand()) { |
2854 DCHECK((CountTotalPages() > 1) || | 2854 DCHECK((CountTotalPages() > 1) || |
2855 (size_in_bytes <= free_list_.Available())); | 2855 (static_cast<size_t>(size_in_bytes) <= free_list_.Available())); |
2856 return free_list_.Allocate(static_cast<size_t>(size_in_bytes)); | 2856 return free_list_.Allocate(static_cast<size_t>(size_in_bytes)); |
2857 } | 2857 } |
2858 | 2858 |
2859 // If sweeper threads are active, wait for them at that point and steal | 2859 // If sweeper threads are active, wait for them at that point and steal |
2860 // elements form their free-lists. Allocation may still fail their which | 2860 // elements form their free-lists. Allocation may still fail their which |
2861 // would indicate that there is not enough memory for the given allocation. | 2861 // would indicate that there is not enough memory for the given allocation. |
2862 return SweepAndRetryAllocation(size_in_bytes); | 2862 return SweepAndRetryAllocation(size_in_bytes); |
2863 } | 2863 } |
2864 | 2864 |
2865 #ifdef DEBUG | 2865 #ifdef DEBUG |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3232 object->ShortPrint(); | 3232 object->ShortPrint(); |
3233 PrintF("\n"); | 3233 PrintF("\n"); |
3234 } | 3234 } |
3235 printf(" --------------------------------------\n"); | 3235 printf(" --------------------------------------\n"); |
3236 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3236 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3237 } | 3237 } |
3238 | 3238 |
3239 #endif // DEBUG | 3239 #endif // DEBUG |
3240 } // namespace internal | 3240 } // namespace internal |
3241 } // namespace v8 | 3241 } // namespace v8 |
OLD | NEW |