Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: src/heap/spaces.h

Issue 2036643002: Reland "[heap] Fine-grained JSArrayBuffer tracking" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove unneeded locking to avoid lock-inversion-order errors in TSAN Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/scavenger.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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* local_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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 inline void set_skip_list(SkipList* skip_list) { skip_list_ = skip_list; } 633 inline void set_skip_list(SkipList* skip_list) { skip_list_ = skip_list; }
632 634
633 inline SlotSet* old_to_new_slots() { return old_to_new_slots_; } 635 inline SlotSet* old_to_new_slots() { return old_to_new_slots_; }
634 inline SlotSet* old_to_old_slots() { return old_to_old_slots_; } 636 inline SlotSet* old_to_old_slots() { return old_to_old_slots_; }
635 inline TypedSlotSet* typed_old_to_new_slots() { 637 inline TypedSlotSet* typed_old_to_new_slots() {
636 return typed_old_to_new_slots_; 638 return typed_old_to_new_slots_;
637 } 639 }
638 inline TypedSlotSet* typed_old_to_old_slots() { 640 inline TypedSlotSet* typed_old_to_old_slots() {
639 return typed_old_to_old_slots_; 641 return typed_old_to_old_slots_;
640 } 642 }
643 inline LocalArrayBufferTracker* local_tracker() { return local_tracker_; }
641 644
642 void AllocateOldToNewSlots(); 645 void AllocateOldToNewSlots();
643 void ReleaseOldToNewSlots(); 646 void ReleaseOldToNewSlots();
644 void AllocateOldToOldSlots(); 647 void AllocateOldToOldSlots();
645 void ReleaseOldToOldSlots(); 648 void ReleaseOldToOldSlots();
646 void AllocateTypedOldToNewSlots(); 649 void AllocateTypedOldToNewSlots();
647 void ReleaseTypedOldToNewSlots(); 650 void ReleaseTypedOldToNewSlots();
648 void AllocateTypedOldToOldSlots(); 651 void AllocateTypedOldToOldSlots();
649 void ReleaseTypedOldToOldSlots(); 652 void ReleaseTypedOldToOldSlots();
653 void AllocateLocalTracker();
654 void ReleaseLocalTracker();
650 655
651 Address area_start() { return area_start_; } 656 Address area_start() { return area_start_; }
652 Address area_end() { return area_end_; } 657 Address area_end() { return area_end_; }
653 int area_size() { return static_cast<int>(area_end() - area_start()); } 658 int area_size() { return static_cast<int>(area_end() - area_start()); }
654 659
655 bool CommitArea(size_t requested); 660 bool CommitArea(size_t requested);
656 661
657 // Approximate amount of physical memory committed for this chunk. 662 // Approximate amount of physical memory committed for this chunk.
658 size_t CommittedPhysicalMemory(); 663 size_t CommittedPhysicalMemory();
659 664
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 base::AtomicNumber<intptr_t> available_in_free_list_; 831 base::AtomicNumber<intptr_t> available_in_free_list_;
827 base::AtomicNumber<intptr_t> wasted_memory_; 832 base::AtomicNumber<intptr_t> wasted_memory_;
828 833
829 // next_chunk_ holds a pointer of type MemoryChunk 834 // next_chunk_ holds a pointer of type MemoryChunk
830 base::AtomicValue<MemoryChunk*> next_chunk_; 835 base::AtomicValue<MemoryChunk*> next_chunk_;
831 // prev_chunk_ holds a pointer of type MemoryChunk 836 // prev_chunk_ holds a pointer of type MemoryChunk
832 base::AtomicValue<MemoryChunk*> prev_chunk_; 837 base::AtomicValue<MemoryChunk*> prev_chunk_;
833 838
834 FreeListCategory categories_[kNumberOfCategories]; 839 FreeListCategory categories_[kNumberOfCategories];
835 840
841 LocalArrayBufferTracker* local_tracker_;
842
836 private: 843 private:
837 void InitializeReservedMemory() { reservation_.Reset(); } 844 void InitializeReservedMemory() { reservation_.Reset(); }
838 845
839 friend class MemoryAllocator; 846 friend class MemoryAllocator;
840 friend class MemoryChunkValidator; 847 friend class MemoryChunkValidator;
841 }; 848 };
842 849
843 // ----------------------------------------------------------------------------- 850 // -----------------------------------------------------------------------------
844 // A page is a memory chunk of a size 1MB. Large object pages may be larger. 851 // A page is a memory chunk of a size 1MB. Large object pages may be larger.
845 // 852 //
(...skipping 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
3147 count = 0; 3154 count = 0;
3148 } 3155 }
3149 // Must be small, since an iteration is used for lookup. 3156 // Must be small, since an iteration is used for lookup.
3150 static const int kMaxComments = 64; 3157 static const int kMaxComments = 64;
3151 }; 3158 };
3152 #endif 3159 #endif
3153 } // namespace internal 3160 } // namespace internal
3154 } // namespace v8 3161 } // namespace v8
3155 3162
3156 #endif // V8_HEAP_SPACES_H_ 3163 #endif // V8_HEAP_SPACES_H_
OLDNEW
« no previous file with comments | « src/heap/scavenger.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698