| 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/mark-compact.h" | 10 #include "src/heap/mark-compact.h" |
| (...skipping 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2212 if (node != NULL && *node_size < size_in_bytes) { | 2212 if (node != NULL && *node_size < size_in_bytes) { |
| 2213 Free(node, *node_size); | 2213 Free(node, *node_size); |
| 2214 *node_size = 0; | 2214 *node_size = 0; |
| 2215 return NULL; | 2215 return NULL; |
| 2216 } | 2216 } |
| 2217 return node; | 2217 return node; |
| 2218 } | 2218 } |
| 2219 | 2219 |
| 2220 | 2220 |
| 2221 void FreeListCategory::Free(FreeSpace* free_space, int size_in_bytes) { | 2221 void FreeListCategory::Free(FreeSpace* free_space, int size_in_bytes) { |
| 2222 DCHECK_LE(FreeList::kSmallListMin, size_in_bytes); | |
| 2223 free_space->set_next(top()); | 2222 free_space->set_next(top()); |
| 2224 set_top(free_space); | 2223 set_top(free_space); |
| 2225 if (end_ == NULL) { | 2224 if (end_ == NULL) { |
| 2226 end_ = free_space; | 2225 end_ = free_space; |
| 2227 } | 2226 } |
| 2228 available_ += size_in_bytes; | 2227 available_ += size_in_bytes; |
| 2229 } | 2228 } |
| 2230 | 2229 |
| 2231 | 2230 |
| 2232 void FreeListCategory::RepairFreeList(Heap* heap) { | 2231 void FreeListCategory::RepairFreeList(Heap* heap) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2267 | 2266 |
| 2268 | 2267 |
| 2269 int FreeList::Free(Address start, int size_in_bytes) { | 2268 int FreeList::Free(Address start, int size_in_bytes) { |
| 2270 if (size_in_bytes == 0) return 0; | 2269 if (size_in_bytes == 0) return 0; |
| 2271 | 2270 |
| 2272 heap_->CreateFillerObjectAt(start, size_in_bytes); | 2271 heap_->CreateFillerObjectAt(start, size_in_bytes); |
| 2273 | 2272 |
| 2274 Page* page = Page::FromAddress(start); | 2273 Page* page = Page::FromAddress(start); |
| 2275 | 2274 |
| 2276 // Early return to drop too-small blocks on the floor. | 2275 // Early return to drop too-small blocks on the floor. |
| 2277 if (size_in_bytes < kSmallListMin) { | 2276 if (size_in_bytes <= kSmallListMin) { |
| 2278 page->add_non_available_small_blocks(size_in_bytes); | 2277 page->add_non_available_small_blocks(size_in_bytes); |
| 2279 return size_in_bytes; | 2278 return size_in_bytes; |
| 2280 } | 2279 } |
| 2281 | 2280 |
| 2282 FreeSpace* free_space = FreeSpace::cast(HeapObject::FromAddress(start)); | 2281 FreeSpace* free_space = FreeSpace::cast(HeapObject::FromAddress(start)); |
| 2283 // Insert other blocks at the head of a free list of the appropriate | 2282 // Insert other blocks at the head of a free list of the appropriate |
| 2284 // magnitude. | 2283 // magnitude. |
| 2285 if (size_in_bytes <= kSmallListMax) { | 2284 if (size_in_bytes <= kSmallListMax) { |
| 2286 small_list_.Free(free_space, size_in_bytes); | 2285 small_list_.Free(free_space, size_in_bytes); |
| 2287 page->add_available_in_small_free_list(size_in_bytes); | 2286 page->add_available_in_small_free_list(size_in_bytes); |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3184 object->ShortPrint(); | 3183 object->ShortPrint(); |
| 3185 PrintF("\n"); | 3184 PrintF("\n"); |
| 3186 } | 3185 } |
| 3187 printf(" --------------------------------------\n"); | 3186 printf(" --------------------------------------\n"); |
| 3188 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3187 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3189 } | 3188 } |
| 3190 | 3189 |
| 3191 #endif // DEBUG | 3190 #endif // DEBUG |
| 3192 } // namespace internal | 3191 } // namespace internal |
| 3193 } // namespace v8 | 3192 } // namespace v8 |
| OLD | NEW |