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_H_ | 5 #ifndef V8_HEAP_SPACES_H_ |
6 #define V8_HEAP_SPACES_H_ | 6 #define V8_HEAP_SPACES_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 + kPointerSize // Address owner_ | 502 + kPointerSize // Address owner_ |
503 + kPointerSize // Heap* heap_ | 503 + kPointerSize // Heap* heap_ |
504 + kIntSize; // int progress_bar_ | 504 + kIntSize; // int progress_bar_ |
505 | 505 |
506 static const size_t kOldToNewSlotsOffset = | 506 static const size_t kOldToNewSlotsOffset = |
507 kLiveBytesOffset + kIntSize; // int live_byte_count_ | 507 kLiveBytesOffset + kIntSize; // int live_byte_count_ |
508 | 508 |
509 static const size_t kWriteBarrierCounterOffset = | 509 static const size_t kWriteBarrierCounterOffset = |
510 kOldToNewSlotsOffset + kPointerSize // SlotSet* old_to_new_slots_; | 510 kOldToNewSlotsOffset + kPointerSize // SlotSet* old_to_new_slots_; |
511 + kPointerSize // SlotSet* old_to_old_slots_; | 511 + kPointerSize // SlotSet* old_to_old_slots_; |
| 512 + kPointerSize // TypedSlotSet* typed_old_to_new_slots_; |
512 + kPointerSize // TypedSlotSet* typed_old_to_old_slots_; | 513 + kPointerSize // TypedSlotSet* typed_old_to_old_slots_; |
513 + kPointerSize; // SkipList* skip_list_; | 514 + kPointerSize; // SkipList* skip_list_; |
514 | 515 |
515 static const size_t kMinHeaderSize = | 516 static const size_t kMinHeaderSize = |
516 kWriteBarrierCounterOffset + | 517 kWriteBarrierCounterOffset + |
517 kIntptrSize // intptr_t write_barrier_counter_ | 518 kIntptrSize // intptr_t write_barrier_counter_ |
518 + kPointerSize // AtomicValue high_water_mark_ | 519 + kPointerSize // AtomicValue high_water_mark_ |
519 + kPointerSize // base::Mutex* mutex_ | 520 + kPointerSize // base::Mutex* mutex_ |
520 + kPointerSize // base::AtomicWord concurrent_sweeping_ | 521 + kPointerSize // base::AtomicWord concurrent_sweeping_ |
521 + 2 * kPointerSize // AtomicNumber free-list statistics | 522 + 2 * kPointerSize // AtomicNumber free-list statistics |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 size_t size() const { return size_; } | 619 size_t size() const { return size_; } |
619 | 620 |
620 inline Heap* heap() const { return heap_; } | 621 inline Heap* heap() const { return heap_; } |
621 | 622 |
622 inline SkipList* skip_list() { return skip_list_; } | 623 inline SkipList* skip_list() { return skip_list_; } |
623 | 624 |
624 inline void set_skip_list(SkipList* skip_list) { skip_list_ = skip_list; } | 625 inline void set_skip_list(SkipList* skip_list) { skip_list_ = skip_list; } |
625 | 626 |
626 inline SlotSet* old_to_new_slots() { return old_to_new_slots_; } | 627 inline SlotSet* old_to_new_slots() { return old_to_new_slots_; } |
627 inline SlotSet* old_to_old_slots() { return old_to_old_slots_; } | 628 inline SlotSet* old_to_old_slots() { return old_to_old_slots_; } |
| 629 inline TypedSlotSet* typed_old_to_new_slots() { |
| 630 return typed_old_to_new_slots_; |
| 631 } |
628 inline TypedSlotSet* typed_old_to_old_slots() { | 632 inline TypedSlotSet* typed_old_to_old_slots() { |
629 return typed_old_to_old_slots_; | 633 return typed_old_to_old_slots_; |
630 } | 634 } |
631 | 635 |
632 void AllocateOldToNewSlots(); | 636 void AllocateOldToNewSlots(); |
633 void ReleaseOldToNewSlots(); | 637 void ReleaseOldToNewSlots(); |
634 void AllocateOldToOldSlots(); | 638 void AllocateOldToOldSlots(); |
635 void ReleaseOldToOldSlots(); | 639 void ReleaseOldToOldSlots(); |
| 640 void AllocateTypedOldToNewSlots(); |
| 641 void ReleaseTypedOldToNewSlots(); |
636 void AllocateTypedOldToOldSlots(); | 642 void AllocateTypedOldToOldSlots(); |
637 void ReleaseTypedOldToOldSlots(); | 643 void ReleaseTypedOldToOldSlots(); |
638 | 644 |
639 Address area_start() { return area_start_; } | 645 Address area_start() { return area_start_; } |
640 Address area_end() { return area_end_; } | 646 Address area_end() { return area_end_; } |
641 int area_size() { return static_cast<int>(area_end() - area_start()); } | 647 int area_size() { return static_cast<int>(area_end() - area_start()); } |
642 | 648 |
643 bool CommitArea(size_t requested); | 649 bool CommitArea(size_t requested); |
644 | 650 |
645 // Approximate amount of physical memory committed for this chunk. | 651 // Approximate amount of physical memory committed for this chunk. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 int progress_bar_; | 791 int progress_bar_; |
786 | 792 |
787 // Count of bytes marked black on page. | 793 // Count of bytes marked black on page. |
788 int live_byte_count_; | 794 int live_byte_count_; |
789 | 795 |
790 // A single slot set for small pages (of size kPageSize) or an array of slot | 796 // A single slot set for small pages (of size kPageSize) or an array of slot |
791 // set for large pages. In the latter case the number of entries in the array | 797 // set for large pages. In the latter case the number of entries in the array |
792 // is ceil(size() / kPageSize). | 798 // is ceil(size() / kPageSize). |
793 SlotSet* old_to_new_slots_; | 799 SlotSet* old_to_new_slots_; |
794 SlotSet* old_to_old_slots_; | 800 SlotSet* old_to_old_slots_; |
| 801 TypedSlotSet* typed_old_to_new_slots_; |
795 TypedSlotSet* typed_old_to_old_slots_; | 802 TypedSlotSet* typed_old_to_old_slots_; |
796 | 803 |
797 SkipList* skip_list_; | 804 SkipList* skip_list_; |
798 | 805 |
799 intptr_t write_barrier_counter_; | 806 intptr_t write_barrier_counter_; |
800 | 807 |
801 // Assuming the initial allocation on a page is sequential, | 808 // Assuming the initial allocation on a page is sequential, |
802 // count highest number of bytes ever allocated on the page. | 809 // count highest number of bytes ever allocated on the page. |
803 base::AtomicValue<intptr_t> high_water_mark_; | 810 base::AtomicValue<intptr_t> high_water_mark_; |
804 | 811 |
(...skipping 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3104 inline LargePage* next(); | 3111 inline LargePage* next(); |
3105 | 3112 |
3106 private: | 3113 private: |
3107 LargePage* next_page_; | 3114 LargePage* next_page_; |
3108 }; | 3115 }; |
3109 | 3116 |
3110 // Iterates over the chunks (pages and large object pages) that can contain | 3117 // Iterates over the chunks (pages and large object pages) that can contain |
3111 // pointers to new space or to evacuation candidates. | 3118 // pointers to new space or to evacuation candidates. |
3112 class MemoryChunkIterator BASE_EMBEDDED { | 3119 class MemoryChunkIterator BASE_EMBEDDED { |
3113 public: | 3120 public: |
3114 enum Mode { ALL, ALL_BUT_MAP_SPACE, ALL_BUT_CODE_SPACE }; | 3121 inline explicit MemoryChunkIterator(Heap* heap); |
3115 inline explicit MemoryChunkIterator(Heap* heap, Mode mode); | |
3116 | 3122 |
3117 // Return NULL when the iterator is done. | 3123 // Return NULL when the iterator is done. |
3118 inline MemoryChunk* next(); | 3124 inline MemoryChunk* next(); |
3119 | 3125 |
3120 private: | 3126 private: |
3121 enum State { | 3127 enum State { |
3122 kOldSpaceState, | 3128 kOldSpaceState, |
3123 kMapState, | 3129 kMapState, |
3124 kCodeState, | 3130 kCodeState, |
3125 kLargeObjectState, | 3131 kLargeObjectState, |
3126 kFinishedState | 3132 kFinishedState |
3127 }; | 3133 }; |
3128 State state_; | 3134 State state_; |
3129 const Mode mode_; | |
3130 PageIterator old_iterator_; | 3135 PageIterator old_iterator_; |
3131 PageIterator code_iterator_; | 3136 PageIterator code_iterator_; |
3132 PageIterator map_iterator_; | 3137 PageIterator map_iterator_; |
3133 LargePageIterator lo_iterator_; | 3138 LargePageIterator lo_iterator_; |
3134 }; | 3139 }; |
3135 | 3140 |
3136 #ifdef DEBUG | 3141 #ifdef DEBUG |
3137 struct CommentStatistic { | 3142 struct CommentStatistic { |
3138 const char* comment; | 3143 const char* comment; |
3139 int size; | 3144 int size; |
3140 int count; | 3145 int count; |
3141 void Clear() { | 3146 void Clear() { |
3142 comment = NULL; | 3147 comment = NULL; |
3143 size = 0; | 3148 size = 0; |
3144 count = 0; | 3149 count = 0; |
3145 } | 3150 } |
3146 // Must be small, since an iteration is used for lookup. | 3151 // Must be small, since an iteration is used for lookup. |
3147 static const int kMaxComments = 64; | 3152 static const int kMaxComments = 64; |
3148 }; | 3153 }; |
3149 #endif | 3154 #endif |
3150 } // namespace internal | 3155 } // namespace internal |
3151 } // namespace v8 | 3156 } // namespace v8 |
3152 | 3157 |
3153 #endif // V8_HEAP_SPACES_H_ | 3158 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |