OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_ZONE_ACCOUNTING_ALLOCATOR_H_ | 5 #ifndef V8_ZONE_ACCOUNTING_ALLOCATOR_H_ |
6 #define V8_ZONE_ACCOUNTING_ALLOCATOR_H_ | 6 #define V8_ZONE_ACCOUNTING_ALLOCATOR_H_ |
7 | 7 |
8 #include "include/v8-platform.h" | 8 #include "include/v8-platform.h" |
9 #include "src/base/atomic-utils.h" | 9 #include "src/base/atomic-utils.h" |
10 #include "src/base/atomicops.h" | 10 #include "src/base/atomicops.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 bool AddSegmentToPool(Segment* segment); | 52 bool AddSegmentToPool(Segment* segment); |
53 | 53 |
54 // Empties the pool and puts all its contents onto the garbage stack. | 54 // Empties the pool and puts all its contents onto the garbage stack. |
55 void ClearPool(); | 55 void ClearPool(); |
56 | 56 |
57 Segment* | 57 Segment* |
58 unused_segments_heads_[1 + kMaxSegmentSizePower - kMinSegmentSizePower]; | 58 unused_segments_heads_[1 + kMaxSegmentSizePower - kMinSegmentSizePower]; |
59 | 59 |
60 size_t unused_segments_sizes[1 + kMaxSegmentSizePower - kMinSegmentSizePower]; | 60 size_t unused_segments_sizes[1 + kMaxSegmentSizePower - kMinSegmentSizePower]; |
61 | 61 |
62 size_t unused_segments_size_ = 0; | |
63 | |
64 base::Mutex unused_segments_mutex_; | 62 base::Mutex unused_segments_mutex_; |
65 | 63 |
66 base::AtomicWord current_memory_usage_ = 0; | 64 base::AtomicWord current_memory_usage_ = 0; |
67 base::AtomicWord max_memory_usage_ = 0; | 65 base::AtomicWord max_memory_usage_ = 0; |
| 66 base::AtomicWord current_pool_size_ = 0; |
68 | 67 |
69 base::AtomicValue<MemoryPressureLevel> memory_pressure_level_; | 68 base::AtomicValue<MemoryPressureLevel> memory_pressure_level_; |
70 | 69 |
71 DISALLOW_COPY_AND_ASSIGN(AccountingAllocator); | 70 DISALLOW_COPY_AND_ASSIGN(AccountingAllocator); |
72 }; | 71 }; |
73 | 72 |
74 } // namespace internal | 73 } // namespace internal |
75 } // namespace v8 | 74 } // namespace v8 |
76 | 75 |
77 #endif // V8_ZONE_ACCOUNTING_ALLOCATOR_H_ | 76 #endif // V8_ZONE_ACCOUNTING_ALLOCATOR_H_ |
OLD | NEW |