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

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

Issue 1954603002: Move atomic-utils.h into base/ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/page-parallel-job.h ('k') | src/locked-queue-inl.h » ('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/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 {
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 bool Contains(Address addr) { 579 bool Contains(Address addr) {
580 return addr >= area_start() && addr < area_end(); 580 return addr >= area_start() && addr < area_end();
581 } 581 }
582 582
583 // Checks whether |addr| can be a limit of addresses in this page. It's a 583 // Checks whether |addr| can be a limit of addresses in this page. It's a
584 // limit if it's in the page, or if it's just after the last byte of the page. 584 // limit if it's in the page, or if it's just after the last byte of the page.
585 bool ContainsLimit(Address addr) { 585 bool ContainsLimit(Address addr) {
586 return addr >= area_start() && addr <= area_end(); 586 return addr >= area_start() && addr <= area_end();
587 } 587 }
588 588
589 AtomicValue<ConcurrentSweepingState>& concurrent_sweeping_state() { 589 base::AtomicValue<ConcurrentSweepingState>& concurrent_sweeping_state() {
590 return concurrent_sweeping_; 590 return concurrent_sweeping_;
591 } 591 }
592 592
593 // Manage live byte count, i.e., count of bytes in black objects. 593 // Manage live byte count, i.e., count of bytes in black objects.
594 inline void ResetLiveBytes(); 594 inline void ResetLiveBytes();
595 inline void IncrementLiveBytes(int by); 595 inline void IncrementLiveBytes(int by);
596 596
597 int LiveBytes() { 597 int LiveBytes() {
598 DCHECK_LE(static_cast<unsigned>(live_byte_count_), size_); 598 DCHECK_LE(static_cast<unsigned>(live_byte_count_), size_);
599 DCHECK(!IsFlagSet(BLACK_PAGE) || live_byte_count_ == 0); 599 DCHECK(!IsFlagSet(BLACK_PAGE) || live_byte_count_ == 0);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 SlotSet* old_to_new_slots_; 793 SlotSet* old_to_new_slots_;
794 SlotSet* old_to_old_slots_; 794 SlotSet* old_to_old_slots_;
795 TypedSlotSet* typed_old_to_old_slots_; 795 TypedSlotSet* typed_old_to_old_slots_;
796 796
797 SkipList* skip_list_; 797 SkipList* skip_list_;
798 798
799 intptr_t write_barrier_counter_; 799 intptr_t write_barrier_counter_;
800 800
801 // Assuming the initial allocation on a page is sequential, 801 // Assuming the initial allocation on a page is sequential,
802 // count highest number of bytes ever allocated on the page. 802 // count highest number of bytes ever allocated on the page.
803 AtomicValue<intptr_t> high_water_mark_; 803 base::AtomicValue<intptr_t> high_water_mark_;
804 804
805 base::Mutex* mutex_; 805 base::Mutex* mutex_;
806 806
807 AtomicValue<ConcurrentSweepingState> concurrent_sweeping_; 807 base::AtomicValue<ConcurrentSweepingState> concurrent_sweeping_;
808 808
809 // PagedSpace free-list statistics. 809 // PagedSpace free-list statistics.
810 AtomicNumber<intptr_t> available_in_free_list_; 810 base::AtomicNumber<intptr_t> available_in_free_list_;
811 AtomicNumber<intptr_t> wasted_memory_; 811 base::AtomicNumber<intptr_t> wasted_memory_;
812 812
813 // next_chunk_ holds a pointer of type MemoryChunk 813 // next_chunk_ holds a pointer of type MemoryChunk
814 AtomicValue<MemoryChunk*> next_chunk_; 814 base::AtomicValue<MemoryChunk*> next_chunk_;
815 // prev_chunk_ holds a pointer of type MemoryChunk 815 // prev_chunk_ holds a pointer of type MemoryChunk
816 AtomicValue<MemoryChunk*> prev_chunk_; 816 base::AtomicValue<MemoryChunk*> prev_chunk_;
817 817
818 FreeListCategory categories_[kNumberOfCategories]; 818 FreeListCategory categories_[kNumberOfCategories];
819 819
820 private: 820 private:
821 void InitializeReservedMemory() { reservation_.Reset(); } 821 void InitializeReservedMemory() { reservation_.Reset(); }
822 822
823 friend class MemoryAllocator; 823 friend class MemoryAllocator;
824 friend class MemoryChunkValidator; 824 friend class MemoryChunkValidator;
825 }; 825 };
826 826
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 Isolate* isolate_; 1497 Isolate* isolate_;
1498 1498
1499 CodeRange* code_range_; 1499 CodeRange* code_range_;
1500 1500
1501 // Maximum space size in bytes. 1501 // Maximum space size in bytes.
1502 intptr_t capacity_; 1502 intptr_t capacity_;
1503 // Maximum subset of capacity_ that can be executable 1503 // Maximum subset of capacity_ that can be executable
1504 intptr_t capacity_executable_; 1504 intptr_t capacity_executable_;
1505 1505
1506 // Allocated space size in bytes. 1506 // Allocated space size in bytes.
1507 AtomicNumber<intptr_t> size_; 1507 base::AtomicNumber<intptr_t> size_;
1508 // Allocated executable space size in bytes. 1508 // Allocated executable space size in bytes.
1509 AtomicNumber<intptr_t> size_executable_; 1509 base::AtomicNumber<intptr_t> size_executable_;
1510 1510
1511 // We keep the lowest and highest addresses allocated as a quick way 1511 // We keep the lowest and highest addresses allocated as a quick way
1512 // of determining that pointers are outside the heap. The estimate is 1512 // of determining that pointers are outside the heap. The estimate is
1513 // conservative, i.e. not all addrsses in 'allocated' space are allocated 1513 // conservative, i.e. not all addrsses in 'allocated' space are allocated
1514 // to our heap. The range is [lowest, highest[, inclusive on the low end 1514 // to our heap. The range is [lowest, highest[, inclusive on the low end
1515 // and exclusive on the high end. 1515 // and exclusive on the high end.
1516 AtomicValue<void*> lowest_ever_allocated_; 1516 base::AtomicValue<void*> lowest_ever_allocated_;
1517 AtomicValue<void*> highest_ever_allocated_; 1517 base::AtomicValue<void*> highest_ever_allocated_;
1518 1518
1519 struct MemoryAllocationCallbackRegistration { 1519 struct MemoryAllocationCallbackRegistration {
1520 MemoryAllocationCallbackRegistration(MemoryAllocationCallback callback, 1520 MemoryAllocationCallbackRegistration(MemoryAllocationCallback callback,
1521 ObjectSpace space, 1521 ObjectSpace space,
1522 AllocationAction action) 1522 AllocationAction action)
1523 : callback(callback), space(space), action(action) {} 1523 : callback(callback), space(space), action(action) {}
1524 MemoryAllocationCallback callback; 1524 MemoryAllocationCallback callback;
1525 ObjectSpace space; 1525 ObjectSpace space;
1526 AllocationAction action; 1526 AllocationAction action;
1527 }; 1527 };
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 return kMedium; 1971 return kMedium;
1972 } else if (size_in_bytes <= kLargeAllocationMax) { 1972 } else if (size_in_bytes <= kLargeAllocationMax) {
1973 return kLarge; 1973 return kLarge;
1974 } 1974 }
1975 return kHuge; 1975 return kHuge;
1976 } 1976 }
1977 1977
1978 FreeListCategory* top(FreeListCategoryType type) { return categories_[type]; } 1978 FreeListCategory* top(FreeListCategoryType type) { return categories_[type]; }
1979 1979
1980 PagedSpace* owner_; 1980 PagedSpace* owner_;
1981 AtomicNumber<intptr_t> wasted_bytes_; 1981 base::AtomicNumber<intptr_t> wasted_bytes_;
1982 FreeListCategory* categories_[kNumberOfCategories]; 1982 FreeListCategory* categories_[kNumberOfCategories];
1983 1983
1984 friend class FreeListCategory; 1984 friend class FreeListCategory;
1985 1985
1986 DISALLOW_IMPLICIT_CONSTRUCTORS(FreeList); 1986 DISALLOW_IMPLICIT_CONSTRUCTORS(FreeList);
1987 }; 1987 };
1988 1988
1989 1989
1990 class AllocationResult { 1990 class AllocationResult {
1991 public: 1991 public:
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
3142 count = 0; 3142 count = 0;
3143 } 3143 }
3144 // Must be small, since an iteration is used for lookup. 3144 // Must be small, since an iteration is used for lookup.
3145 static const int kMaxComments = 64; 3145 static const int kMaxComments = 64;
3146 }; 3146 };
3147 #endif 3147 #endif
3148 } // namespace internal 3148 } // namespace internal
3149 } // namespace v8 3149 } // namespace v8
3150 3150
3151 #endif // V8_HEAP_SPACES_H_ 3151 #endif // V8_HEAP_SPACES_H_
OLDNEW
« no previous file with comments | « src/heap/page-parallel-job.h ('k') | src/locked-queue-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698