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/full-codegen/full-codegen.h" | 9 #include "src/full-codegen/full-codegen.h" |
10 #include "src/heap/slots-buffer.h" | 10 #include "src/heap/slots-buffer.h" |
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2211 intptr_t FreeList::Concatenate(FreeList* free_list) { | 2211 intptr_t FreeList::Concatenate(FreeList* free_list) { |
2212 intptr_t free_bytes = 0; | 2212 intptr_t free_bytes = 0; |
2213 free_bytes += small_list_.Concatenate(free_list->small_list()); | 2213 free_bytes += small_list_.Concatenate(free_list->small_list()); |
2214 free_bytes += medium_list_.Concatenate(free_list->medium_list()); | 2214 free_bytes += medium_list_.Concatenate(free_list->medium_list()); |
2215 free_bytes += large_list_.Concatenate(free_list->large_list()); | 2215 free_bytes += large_list_.Concatenate(free_list->large_list()); |
2216 free_bytes += huge_list_.Concatenate(free_list->huge_list()); | 2216 free_bytes += huge_list_.Concatenate(free_list->huge_list()); |
2217 return free_bytes; | 2217 return free_bytes; |
2218 } | 2218 } |
2219 | 2219 |
2220 | 2220 |
| 2221 void FreeList::Divide(FreeList** free_lists, int num, intptr_t limit) { |
| 2222 CHECK(num > 0); |
| 2223 CHECK(free_lists != nullptr); |
| 2224 if (limit == 0) { |
| 2225 limit = std::numeric_limits<intptr_t>::max(); |
| 2226 } |
| 2227 int size = 0; |
| 2228 int cnt = 0; |
| 2229 FreeSpace* space = nullptr; |
| 2230 while (((space = huge_list_.PickNodeFromList(&size)) != nullptr) && |
| 2231 (free_lists[cnt % num]->available() < limit)) { |
| 2232 free_lists[cnt % num]->huge_list_.Free(space, size); |
| 2233 cnt++; |
| 2234 } |
| 2235 while (((space = large_list_.PickNodeFromList(&size)) != nullptr) && |
| 2236 (free_lists[cnt % num]->available() < limit)) { |
| 2237 free_lists[cnt % num]->large_list_.Free(space, size); |
| 2238 cnt++; |
| 2239 } |
| 2240 while (((space = medium_list_.PickNodeFromList(&size)) != nullptr) && |
| 2241 (free_lists[cnt % num]->available() < limit)) { |
| 2242 free_lists[cnt % num]->medium_list_.Free(space, size); |
| 2243 cnt++; |
| 2244 } |
| 2245 while (((space = small_list_.PickNodeFromList(&size)) != nullptr) && |
| 2246 (free_lists[cnt % num]->available() < limit)) { |
| 2247 free_lists[cnt % num]->small_list_.Free(space, size); |
| 2248 cnt++; |
| 2249 } |
| 2250 } |
| 2251 |
| 2252 |
2221 void FreeList::Reset() { | 2253 void FreeList::Reset() { |
2222 small_list_.Reset(); | 2254 small_list_.Reset(); |
2223 medium_list_.Reset(); | 2255 medium_list_.Reset(); |
2224 large_list_.Reset(); | 2256 large_list_.Reset(); |
2225 huge_list_.Reset(); | 2257 huge_list_.Reset(); |
2226 } | 2258 } |
2227 | 2259 |
2228 | 2260 |
2229 int FreeList::Free(Address start, int size_in_bytes) { | 2261 int FreeList::Free(Address start, int size_in_bytes) { |
2230 if (size_in_bytes == 0) return 0; | 2262 if (size_in_bytes == 0) return 0; |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3144 object->ShortPrint(); | 3176 object->ShortPrint(); |
3145 PrintF("\n"); | 3177 PrintF("\n"); |
3146 } | 3178 } |
3147 printf(" --------------------------------------\n"); | 3179 printf(" --------------------------------------\n"); |
3148 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3180 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3149 } | 3181 } |
3150 | 3182 |
3151 #endif // DEBUG | 3183 #endif // DEBUG |
3152 } // namespace internal | 3184 } // namespace internal |
3153 } // namespace v8 | 3185 } // namespace v8 |
OLD | NEW |