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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 397 |
398 void Page::ClearEvacuationCandidate() { | 398 void Page::ClearEvacuationCandidate() { |
399 if (!IsFlagSet(COMPACTION_WAS_ABORTED)) { | 399 if (!IsFlagSet(COMPACTION_WAS_ABORTED)) { |
400 DCHECK_NULL(old_to_old_slots_); | 400 DCHECK_NULL(old_to_old_slots_); |
401 DCHECK_NULL(typed_old_to_old_slots_); | 401 DCHECK_NULL(typed_old_to_old_slots_); |
402 } | 402 } |
403 ClearFlag(EVACUATION_CANDIDATE); | 403 ClearFlag(EVACUATION_CANDIDATE); |
404 InitializeFreeListCategories(); | 404 InitializeFreeListCategories(); |
405 } | 405 } |
406 | 406 |
407 MemoryChunkIterator::MemoryChunkIterator(Heap* heap, Mode mode) | 407 MemoryChunkIterator::MemoryChunkIterator(Heap* heap) |
408 : state_(kOldSpaceState), | 408 : state_(kOldSpaceState), |
409 mode_(mode), | |
410 old_iterator_(heap->old_space()), | 409 old_iterator_(heap->old_space()), |
411 code_iterator_(heap->code_space()), | 410 code_iterator_(heap->code_space()), |
412 map_iterator_(heap->map_space()), | 411 map_iterator_(heap->map_space()), |
413 lo_iterator_(heap->lo_space()) {} | 412 lo_iterator_(heap->lo_space()) {} |
414 | 413 |
415 MemoryChunk* MemoryChunkIterator::next() { | 414 MemoryChunk* MemoryChunkIterator::next() { |
416 switch (state_) { | 415 switch (state_) { |
417 case kOldSpaceState: { | 416 case kOldSpaceState: { |
418 if (old_iterator_.has_next()) { | 417 if (old_iterator_.has_next()) { |
419 return old_iterator_.next(); | 418 return old_iterator_.next(); |
420 } | 419 } |
421 state_ = kMapState; | 420 state_ = kMapState; |
422 // Fall through. | 421 // Fall through. |
423 } | 422 } |
424 case kMapState: { | 423 case kMapState: { |
425 if (mode_ != ALL_BUT_MAP_SPACE && map_iterator_.has_next()) { | 424 if (map_iterator_.has_next()) { |
426 return map_iterator_.next(); | 425 return map_iterator_.next(); |
427 } | 426 } |
428 state_ = kCodeState; | 427 state_ = kCodeState; |
429 // Fall through. | 428 // Fall through. |
430 } | 429 } |
431 case kCodeState: { | 430 case kCodeState: { |
432 if (mode_ != ALL_BUT_CODE_SPACE && code_iterator_.has_next()) { | 431 if (code_iterator_.has_next()) { |
433 return code_iterator_.next(); | 432 return code_iterator_.next(); |
434 } | 433 } |
435 state_ = kLargeObjectState; | 434 state_ = kLargeObjectState; |
436 // Fall through. | 435 // Fall through. |
437 } | 436 } |
438 case kLargeObjectState: { | 437 case kLargeObjectState: { |
439 MemoryChunk* answer = lo_iterator_.next(); | 438 MemoryChunk* answer = lo_iterator_.next(); |
440 if (answer != nullptr) { | 439 if (answer != nullptr) { |
441 return answer; | 440 return answer; |
442 } | 441 } |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 other->allocation_info_.Reset(nullptr, nullptr); | 713 other->allocation_info_.Reset(nullptr, nullptr); |
715 return true; | 714 return true; |
716 } | 715 } |
717 return false; | 716 return false; |
718 } | 717 } |
719 | 718 |
720 } // namespace internal | 719 } // namespace internal |
721 } // namespace v8 | 720 } // namespace v8 |
722 | 721 |
723 #endif // V8_HEAP_SPACES_INL_H_ | 722 #endif // V8_HEAP_SPACES_INL_H_ |
OLD | NEW |