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 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2354 FreeSpace* node = nullptr; | 2354 FreeSpace* node = nullptr; |
2355 while (it.HasNext()) { | 2355 while (it.HasNext()) { |
2356 FreeListCategory* current = it.Next(); | 2356 FreeListCategory* current = it.Next(); |
2357 node = current->SearchForNodeInList(minimum_size, node_size); | 2357 node = current->SearchForNodeInList(minimum_size, node_size); |
2358 if (node != nullptr) { | 2358 if (node != nullptr) { |
2359 Page::FromAddress(node->address()) | 2359 Page::FromAddress(node->address()) |
2360 ->add_available_in_free_list(-(*node_size)); | 2360 ->add_available_in_free_list(-(*node_size)); |
2361 DCHECK(IsVeryLong() || Available() == SumFreeLists()); | 2361 DCHECK(IsVeryLong() || Available() == SumFreeLists()); |
2362 return node; | 2362 return node; |
2363 } | 2363 } |
| 2364 if (current->is_empty()) { |
| 2365 RemoveCategory(current); |
| 2366 } |
2364 } | 2367 } |
2365 return node; | 2368 return node; |
2366 } | 2369 } |
2367 | 2370 |
2368 FreeSpace* FreeList::FindNodeFor(int size_in_bytes, int* node_size) { | 2371 FreeSpace* FreeList::FindNodeFor(int size_in_bytes, int* node_size) { |
2369 FreeSpace* node = nullptr; | 2372 FreeSpace* node = nullptr; |
2370 | 2373 |
2371 // First try the allocation fast path: try to allocate the minimum element | 2374 // First try the allocation fast path: try to allocate the minimum element |
2372 // size of a free list category. This operation is constant time. | 2375 // size of a free list category. This operation is constant time. |
2373 FreeListCategoryType type = | 2376 FreeListCategoryType type = |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3220 object->ShortPrint(); | 3223 object->ShortPrint(); |
3221 PrintF("\n"); | 3224 PrintF("\n"); |
3222 } | 3225 } |
3223 printf(" --------------------------------------\n"); | 3226 printf(" --------------------------------------\n"); |
3224 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3227 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3225 } | 3228 } |
3226 | 3229 |
3227 #endif // DEBUG | 3230 #endif // DEBUG |
3228 } // namespace internal | 3231 } // namespace internal |
3229 } // namespace v8 | 3232 } // namespace v8 |
OLD | NEW |