| 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 #ifndef V8_HEAP_SPACES_INL_H_ | 5 #ifndef V8_HEAP_SPACES_INL_H_ |
| 6 #define V8_HEAP_SPACES_INL_H_ | 6 #define V8_HEAP_SPACES_INL_H_ |
| 7 | 7 |
| 8 #include "src/heap/incremental-marking.h" | 8 #include "src/heap/incremental-marking.h" |
| 9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 page->InitializeFreeListCategories(); | 196 page->InitializeFreeListCategories(); |
| 197 // In the case we do not free the memory, we effectively account for the whole | 197 // In the case we do not free the memory, we effectively account for the whole |
| 198 // page as allocated memory that cannot be used for further allocations. | 198 // page as allocated memory that cannot be used for further allocations. |
| 199 if (mode == kFreeMemory) { | 199 if (mode == kFreeMemory) { |
| 200 owner->Free(page->area_start(), page->area_size()); | 200 owner->Free(page->area_start(), page->area_size()); |
| 201 } | 201 } |
| 202 | 202 |
| 203 return page; | 203 return page; |
| 204 } | 204 } |
| 205 | 205 |
| 206 Page* Page::ConvertNewToOld(Page* old_page, PagedSpace* new_owner) { | 206 Page* Page::ConvertNewToOld(Page* old_page) { |
| 207 OldSpace* old_space = old_page->heap()->old_space(); |
| 207 DCHECK(old_page->InNewSpace()); | 208 DCHECK(old_page->InNewSpace()); |
| 208 old_page->set_owner(new_owner); | 209 old_page->set_owner(old_space); |
| 209 old_page->SetFlags(0, ~0); | 210 old_page->SetFlags(0, ~0); |
| 210 new_owner->AccountCommitted(old_page->size()); | 211 old_space->AccountCommitted(old_page->size()); |
| 211 Page* new_page = Page::Initialize<kDoNotFreeMemory>( | 212 Page* new_page = Page::Initialize<kDoNotFreeMemory>( |
| 212 old_page->heap(), old_page, NOT_EXECUTABLE, new_owner); | 213 old_page->heap(), old_page, NOT_EXECUTABLE, old_space); |
| 213 new_page->InsertAfter(new_owner->anchor()->prev_page()); | 214 new_page->InsertAfter(old_space->anchor()->prev_page()); |
| 214 return new_page; | 215 return new_page; |
| 215 } | 216 } |
| 216 | 217 |
| 217 void Page::InitializeFreeListCategories() { | 218 void Page::InitializeFreeListCategories() { |
| 218 for (int i = kFirstCategory; i < kNumberOfCategories; i++) { | 219 for (int i = kFirstCategory; i < kNumberOfCategories; i++) { |
| 219 categories_[i].Initialize(static_cast<FreeListCategoryType>(i)); | 220 categories_[i].Initialize(static_cast<FreeListCategoryType>(i)); |
| 220 } | 221 } |
| 221 } | 222 } |
| 222 | 223 |
| 223 void MemoryChunk::IncrementLiveBytesFromGC(HeapObject* object, int by) { | 224 void MemoryChunk::IncrementLiveBytesFromGC(HeapObject* object, int by) { |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 other->allocation_info_.Reset(nullptr, nullptr); | 629 other->allocation_info_.Reset(nullptr, nullptr); |
| 629 return true; | 630 return true; |
| 630 } | 631 } |
| 631 return false; | 632 return false; |
| 632 } | 633 } |
| 633 | 634 |
| 634 } // namespace internal | 635 } // namespace internal |
| 635 } // namespace v8 | 636 } // namespace v8 |
| 636 | 637 |
| 637 #endif // V8_HEAP_SPACES_INL_H_ | 638 #endif // V8_HEAP_SPACES_INL_H_ |
| OLD | NEW |