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" |
11 #include "src/base/atomic-utils.h" | 11 #include "src/base/atomic-utils.h" |
12 #include "src/base/atomicops.h" | 12 #include "src/base/atomicops.h" |
13 #include "src/base/bits.h" | 13 #include "src/base/bits.h" |
14 #include "src/base/platform/mutex.h" | 14 #include "src/base/platform/mutex.h" |
15 #include "src/flags.h" | 15 #include "src/flags.h" |
16 #include "src/hashmap.h" | 16 #include "src/hashmap.h" |
17 #include "src/list.h" | 17 #include "src/list.h" |
18 #include "src/objects.h" | 18 #include "src/objects.h" |
19 #include "src/utils.h" | 19 #include "src/utils.h" |
20 | 20 |
21 namespace v8 { | 21 namespace v8 { |
22 namespace internal { | 22 namespace internal { |
23 | 23 |
24 class AllocationInfo; | 24 class AllocationInfo; |
25 class AllocationObserver; | 25 class AllocationObserver; |
26 class CompactionSpace; | 26 class CompactionSpace; |
27 class CompactionSpaceCollection; | 27 class CompactionSpaceCollection; |
28 class FreeList; | 28 class FreeList; |
29 class Isolate; | 29 class Isolate; |
| 30 class LocalArrayBufferTracker; |
30 class MemoryAllocator; | 31 class MemoryAllocator; |
31 class MemoryChunk; | 32 class MemoryChunk; |
32 class Page; | 33 class Page; |
33 class PagedSpace; | 34 class PagedSpace; |
34 class SemiSpace; | 35 class SemiSpace; |
35 class SkipList; | 36 class SkipList; |
36 class SlotsBuffer; | 37 class SlotsBuffer; |
37 class SlotSet; | 38 class SlotSet; |
38 class TypedSlotSet; | 39 class TypedSlotSet; |
39 class Space; | 40 class Space; |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 static const size_t kMinHeaderSize = | 522 static const size_t kMinHeaderSize = |
522 kWriteBarrierCounterOffset + | 523 kWriteBarrierCounterOffset + |
523 kIntptrSize // intptr_t write_barrier_counter_ | 524 kIntptrSize // intptr_t write_barrier_counter_ |
524 + kPointerSize // AtomicValue high_water_mark_ | 525 + kPointerSize // AtomicValue high_water_mark_ |
525 + kPointerSize // base::Mutex* mutex_ | 526 + kPointerSize // base::Mutex* mutex_ |
526 + kPointerSize // base::AtomicWord concurrent_sweeping_ | 527 + kPointerSize // base::AtomicWord concurrent_sweeping_ |
527 + 2 * kPointerSize // AtomicNumber free-list statistics | 528 + 2 * kPointerSize // AtomicNumber free-list statistics |
528 + kPointerSize // AtomicValue next_chunk_ | 529 + kPointerSize // AtomicValue next_chunk_ |
529 + kPointerSize // AtomicValue prev_chunk_ | 530 + kPointerSize // AtomicValue prev_chunk_ |
530 // FreeListCategory categories_[kNumberOfCategories] | 531 // FreeListCategory categories_[kNumberOfCategories] |
531 + FreeListCategory::kSize * kNumberOfCategories; | 532 + FreeListCategory::kSize * kNumberOfCategories + |
| 533 kPointerSize; // LocalArrayBufferTracker tracker_ |
532 | 534 |
533 // We add some more space to the computed header size to amount for missing | 535 // We add some more space to the computed header size to amount for missing |
534 // alignment requirements in our computation. | 536 // alignment requirements in our computation. |
535 // Try to get kHeaderSize properly aligned on 32-bit and 64-bit machines. | 537 // Try to get kHeaderSize properly aligned on 32-bit and 64-bit machines. |
536 static const size_t kHeaderSize = kMinHeaderSize; | 538 static const size_t kHeaderSize = kMinHeaderSize; |
537 | 539 |
538 static const int kBodyOffset = | 540 static const int kBodyOffset = |
539 CODE_POINTER_ALIGN(kHeaderSize + Bitmap::kSize); | 541 CODE_POINTER_ALIGN(kHeaderSize + Bitmap::kSize); |
540 | 542 |
541 // The start offset of the object area in a page. Aligned to both maps and | 543 // The start offset of the object area in a page. Aligned to both maps and |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 inline void set_skip_list(SkipList* skip_list) { skip_list_ = skip_list; } | 632 inline void set_skip_list(SkipList* skip_list) { skip_list_ = skip_list; } |
631 | 633 |
632 inline SlotSet* old_to_new_slots() { return old_to_new_slots_; } | 634 inline SlotSet* old_to_new_slots() { return old_to_new_slots_; } |
633 inline SlotSet* old_to_old_slots() { return old_to_old_slots_; } | 635 inline SlotSet* old_to_old_slots() { return old_to_old_slots_; } |
634 inline TypedSlotSet* typed_old_to_new_slots() { | 636 inline TypedSlotSet* typed_old_to_new_slots() { |
635 return typed_old_to_new_slots_; | 637 return typed_old_to_new_slots_; |
636 } | 638 } |
637 inline TypedSlotSet* typed_old_to_old_slots() { | 639 inline TypedSlotSet* typed_old_to_old_slots() { |
638 return typed_old_to_old_slots_; | 640 return typed_old_to_old_slots_; |
639 } | 641 } |
| 642 inline LocalArrayBufferTracker* local_tracker() { return local_tracker_; } |
640 | 643 |
641 void AllocateOldToNewSlots(); | 644 void AllocateOldToNewSlots(); |
642 void ReleaseOldToNewSlots(); | 645 void ReleaseOldToNewSlots(); |
643 void AllocateOldToOldSlots(); | 646 void AllocateOldToOldSlots(); |
644 void ReleaseOldToOldSlots(); | 647 void ReleaseOldToOldSlots(); |
645 void AllocateTypedOldToNewSlots(); | 648 void AllocateTypedOldToNewSlots(); |
646 void ReleaseTypedOldToNewSlots(); | 649 void ReleaseTypedOldToNewSlots(); |
647 void AllocateTypedOldToOldSlots(); | 650 void AllocateTypedOldToOldSlots(); |
648 void ReleaseTypedOldToOldSlots(); | 651 void ReleaseTypedOldToOldSlots(); |
| 652 void AllocateLocalTracker(); |
| 653 void ReleaseLocalTracker(); |
649 | 654 |
650 Address area_start() { return area_start_; } | 655 Address area_start() { return area_start_; } |
651 Address area_end() { return area_end_; } | 656 Address area_end() { return area_end_; } |
652 int area_size() { return static_cast<int>(area_end() - area_start()); } | 657 int area_size() { return static_cast<int>(area_end() - area_start()); } |
653 | 658 |
654 bool CommitArea(size_t requested); | 659 bool CommitArea(size_t requested); |
655 | 660 |
656 // Approximate amount of physical memory committed for this chunk. | 661 // Approximate amount of physical memory committed for this chunk. |
657 size_t CommittedPhysicalMemory() { return high_water_mark_.Value(); } | 662 size_t CommittedPhysicalMemory() { return high_water_mark_.Value(); } |
658 | 663 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 base::AtomicNumber<intptr_t> available_in_free_list_; | 830 base::AtomicNumber<intptr_t> available_in_free_list_; |
826 base::AtomicNumber<intptr_t> wasted_memory_; | 831 base::AtomicNumber<intptr_t> wasted_memory_; |
827 | 832 |
828 // next_chunk_ holds a pointer of type MemoryChunk | 833 // next_chunk_ holds a pointer of type MemoryChunk |
829 base::AtomicValue<MemoryChunk*> next_chunk_; | 834 base::AtomicValue<MemoryChunk*> next_chunk_; |
830 // prev_chunk_ holds a pointer of type MemoryChunk | 835 // prev_chunk_ holds a pointer of type MemoryChunk |
831 base::AtomicValue<MemoryChunk*> prev_chunk_; | 836 base::AtomicValue<MemoryChunk*> prev_chunk_; |
832 | 837 |
833 FreeListCategory categories_[kNumberOfCategories]; | 838 FreeListCategory categories_[kNumberOfCategories]; |
834 | 839 |
| 840 LocalArrayBufferTracker* local_tracker_; |
| 841 |
835 private: | 842 private: |
836 void InitializeReservedMemory() { reservation_.Reset(); } | 843 void InitializeReservedMemory() { reservation_.Reset(); } |
837 | 844 |
838 friend class MemoryAllocator; | 845 friend class MemoryAllocator; |
839 friend class MemoryChunkValidator; | 846 friend class MemoryChunkValidator; |
840 }; | 847 }; |
841 | 848 |
842 // ----------------------------------------------------------------------------- | 849 // ----------------------------------------------------------------------------- |
843 // A page is a memory chunk of a size 1MB. Large object pages may be larger. | 850 // A page is a memory chunk of a size 1MB. Large object pages may be larger. |
844 // | 851 // |
(...skipping 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3141 count = 0; | 3148 count = 0; |
3142 } | 3149 } |
3143 // Must be small, since an iteration is used for lookup. | 3150 // Must be small, since an iteration is used for lookup. |
3144 static const int kMaxComments = 64; | 3151 static const int kMaxComments = 64; |
3145 }; | 3152 }; |
3146 #endif | 3153 #endif |
3147 } // namespace internal | 3154 } // namespace internal |
3148 } // namespace v8 | 3155 } // namespace v8 |
3149 | 3156 |
3150 #endif // V8_HEAP_SPACES_H_ | 3157 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |