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

Side by Side Diff: src/heap/slots-buffer.h

Issue 1341973003: [heap] Scalable slots buffer for parallel compaction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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/mark-compact.cc ('k') | src/heap/slots-buffer.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_SLOTS_BUFFER_H_ 5 #ifndef V8_HEAP_SLOTS_BUFFER_H_
6 #define V8_HEAP_SLOTS_BUFFER_H_ 6 #define V8_HEAP_SLOTS_BUFFER_H_
7 7
8 #include "src/objects.h" 8 #include "src/objects.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 inline bool IsFull() { return idx_ == kNumberOfElements; } 115 inline bool IsFull() { return idx_ == kNumberOfElements; }
116 116
117 inline bool HasSpaceForTypedSlot() { return idx_ < kNumberOfElements - 1; } 117 inline bool HasSpaceForTypedSlot() { return idx_ < kNumberOfElements - 1; }
118 118
119 enum AdditionMode { FAIL_ON_OVERFLOW, IGNORE_OVERFLOW }; 119 enum AdditionMode { FAIL_ON_OVERFLOW, IGNORE_OVERFLOW };
120 120
121 static bool ChainLengthThresholdReached(SlotsBuffer* buffer) { 121 static bool ChainLengthThresholdReached(SlotsBuffer* buffer) {
122 return buffer != NULL && buffer->chain_length_ >= kChainLengthThreshold; 122 return buffer != NULL && buffer->chain_length_ >= kChainLengthThreshold;
123 } 123 }
124 124
125 INLINE(static bool AddToSynchronized(SlotsBufferAllocator* allocator,
126 SlotsBuffer** buffer_address,
127 base::Mutex* buffer_mutex,
128 ObjectSlot slot, AdditionMode mode)) {
129 base::LockGuard<base::Mutex> lock_guard(buffer_mutex);
130 return AddTo(allocator, buffer_address, slot, mode);
131 }
132
133 INLINE(static bool AddTo(SlotsBufferAllocator* allocator, 125 INLINE(static bool AddTo(SlotsBufferAllocator* allocator,
134 SlotsBuffer** buffer_address, ObjectSlot slot, 126 SlotsBuffer** buffer_address, ObjectSlot slot,
135 AdditionMode mode)) { 127 AdditionMode mode)) {
136 SlotsBuffer* buffer = *buffer_address; 128 SlotsBuffer* buffer = *buffer_address;
137 if (buffer == NULL || buffer->IsFull()) { 129 if (buffer == NULL || buffer->IsFull()) {
138 if (mode == FAIL_ON_OVERFLOW && ChainLengthThresholdReached(buffer)) { 130 if (mode == FAIL_ON_OVERFLOW && ChainLengthThresholdReached(buffer)) {
139 allocator->DeallocateChain(buffer_address); 131 allocator->DeallocateChain(buffer_address);
140 return false; 132 return false;
141 } 133 }
142 buffer = allocator->AllocateBuffer(buffer); 134 buffer = allocator->AllocateBuffer(buffer);
143 *buffer_address = buffer; 135 *buffer_address = buffer;
144 } 136 }
145 buffer->Add(slot); 137 buffer->Add(slot);
146 return true; 138 return true;
147 } 139 }
148 140
149 static bool IsTypedSlot(ObjectSlot slot); 141 static bool IsTypedSlot(ObjectSlot slot);
150 142
151 static bool AddToSynchronized(SlotsBufferAllocator* allocator,
152 SlotsBuffer** buffer_address,
153 base::Mutex* buffer_mutex, SlotType type,
154 Address addr, AdditionMode mode);
155
156 static bool AddTo(SlotsBufferAllocator* allocator, 143 static bool AddTo(SlotsBufferAllocator* allocator,
157 SlotsBuffer** buffer_address, SlotType type, Address addr, 144 SlotsBuffer** buffer_address, SlotType type, Address addr,
158 AdditionMode mode); 145 AdditionMode mode);
159 146
160 // Eliminates all stale entries from the slots buffer, i.e., slots that 147 // Eliminates all stale entries from the slots buffer, i.e., slots that
161 // are not part of live objects anymore. This method must be called after 148 // are not part of live objects anymore. This method must be called after
162 // marking, when the whole transitive closure is known and must be called 149 // marking, when the whole transitive closure is known and must be called
163 // before sweeping when mark bits are still intact. 150 // before sweeping when mark bits are still intact.
164 static void RemoveInvalidSlots(Heap* heap, SlotsBuffer* buffer); 151 static void RemoveInvalidSlots(Heap* heap, SlotsBuffer* buffer);
165 152
(...skipping 13 matching lines...) Expand all
179 intptr_t chain_length_; 166 intptr_t chain_length_;
180 SlotsBuffer* next_; 167 SlotsBuffer* next_;
181 ObjectSlot slots_[kNumberOfElements]; 168 ObjectSlot slots_[kNumberOfElements];
182 }; 169 };
183 170
184 171
185 } // namespace internal 172 } // namespace internal
186 } // namespace v8 173 } // namespace v8
187 174
188 #endif // V8_HEAP_SLOTS_BUFFER_H_ 175 #endif // V8_HEAP_SLOTS_BUFFER_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/slots-buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698