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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 bool NewSpace::FromSpaceContains(Object* o) { return from_space_.Contains(o); } | 244 bool NewSpace::FromSpaceContains(Object* o) { return from_space_.Contains(o); } |
245 | 245 |
246 // -------------------------------------------------------------------------- | 246 // -------------------------------------------------------------------------- |
247 // AllocationResult | 247 // AllocationResult |
248 | 248 |
249 AllocationSpace AllocationResult::RetrySpace() { | 249 AllocationSpace AllocationResult::RetrySpace() { |
250 DCHECK(IsRetry()); | 250 DCHECK(IsRetry()); |
251 return static_cast<AllocationSpace>(Smi::cast(object_)->value()); | 251 return static_cast<AllocationSpace>(Smi::cast(object_)->value()); |
252 } | 252 } |
253 | 253 |
| 254 NewSpacePage* NewSpacePage::Initialize(Heap* heap, MemoryChunk* chunk, |
| 255 Executability executable, |
| 256 SemiSpace* owner) { |
| 257 DCHECK_EQ(executable, Executability::NOT_EXECUTABLE); |
| 258 bool in_to_space = (owner->id() != kFromSpace); |
| 259 chunk->SetFlag(in_to_space ? MemoryChunk::IN_TO_SPACE |
| 260 : MemoryChunk::IN_FROM_SPACE); |
| 261 DCHECK(!chunk->IsFlagSet(in_to_space ? MemoryChunk::IN_FROM_SPACE |
| 262 : MemoryChunk::IN_TO_SPACE)); |
| 263 NewSpacePage* page = static_cast<NewSpacePage*>(chunk); |
| 264 heap->incremental_marking()->SetNewSpacePageFlags(page); |
| 265 return page; |
| 266 } |
254 | 267 |
255 // -------------------------------------------------------------------------- | 268 // -------------------------------------------------------------------------- |
256 // PagedSpace | 269 // PagedSpace |
257 | 270 |
258 Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable, | 271 Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable, |
259 PagedSpace* owner) { | 272 PagedSpace* owner) { |
260 Page* page = reinterpret_cast<Page*>(chunk); | 273 Page* page = reinterpret_cast<Page*>(chunk); |
261 page->mutex_ = new base::Mutex(); | 274 page->mutex_ = new base::Mutex(); |
262 DCHECK(page->area_size() <= kAllocatableMemory); | 275 DCHECK(page->area_size() <= kAllocatableMemory); |
263 DCHECK(chunk->owner() == owner); | 276 DCHECK(chunk->owner() == owner); |
| 277 |
264 owner->IncreaseCapacity(page->area_size()); | 278 owner->IncreaseCapacity(page->area_size()); |
265 heap->incremental_marking()->SetOldSpacePageFlags(chunk); | 279 heap->incremental_marking()->SetOldSpacePageFlags(chunk); |
266 | 280 |
267 // Make sure that categories are initialized before freeing the area. | 281 // Make sure that categories are initialized before freeing the area. |
268 page->InitializeFreeListCategories(); | 282 page->InitializeFreeListCategories(); |
269 owner->Free(page->area_start(), page->area_size()); | 283 owner->Free(page->area_start(), page->area_size()); |
270 | 284 |
271 return page; | 285 return page; |
272 } | 286 } |
273 | 287 |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 other->allocation_info_.Reset(nullptr, nullptr); | 704 other->allocation_info_.Reset(nullptr, nullptr); |
691 return true; | 705 return true; |
692 } | 706 } |
693 return false; | 707 return false; |
694 } | 708 } |
695 | 709 |
696 } // namespace internal | 710 } // namespace internal |
697 } // namespace v8 | 711 } // namespace v8 |
698 | 712 |
699 #endif // V8_HEAP_SPACES_INL_H_ | 713 #endif // V8_HEAP_SPACES_INL_H_ |
OLD | NEW |