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

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

Issue 1640563004: Reland of "[heap] Parallel newspace evacuation, semispace copy, and compaction \o/" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Convert bogus DCHECK into proper branch Created 4 years, 11 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/spaces.h ('k') | src/heap/store-buffer-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_STORE_BUFFER_H_ 5 #ifndef V8_STORE_BUFFER_H_
6 #define V8_STORE_BUFFER_H_ 6 #define V8_STORE_BUFFER_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/base/logging.h" 9 #include "src/base/logging.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 15 matching lines...) Expand all
26 explicit StoreBuffer(Heap* heap); 26 explicit StoreBuffer(Heap* heap);
27 27
28 static void StoreBufferOverflow(Isolate* isolate); 28 static void StoreBufferOverflow(Isolate* isolate);
29 29
30 void SetUp(); 30 void SetUp();
31 void TearDown(); 31 void TearDown();
32 32
33 // This is used to add addresses to the store buffer non-concurrently. 33 // This is used to add addresses to the store buffer non-concurrently.
34 inline void Mark(Address addr); 34 inline void Mark(Address addr);
35 35
36 // This is used to add addresses to the store buffer when multiple threads
37 // may operate on the store buffer.
38 inline void MarkSynchronized(Address addr);
39
40 // This is used by the heap traversal to enter the addresses into the store 36 // This is used by the heap traversal to enter the addresses into the store
41 // buffer that should still be in the store buffer after GC. It enters 37 // buffer that should still be in the store buffer after GC. It enters
42 // addresses directly into the old buffer because the GC starts by wiping the 38 // addresses directly into the old buffer because the GC starts by wiping the
43 // old buffer and thereafter only visits each cell once so there is no need 39 // old buffer and thereafter only visits each cell once so there is no need
44 // to attempt to remove any dupes. During the first part of a GC we 40 // to attempt to remove any dupes. During the first part of a GC we
45 // are using the store buffer to access the old spaces and at the same time 41 // are using the store buffer to access the old spaces and at the same time
46 // we are rebuilding the store buffer using this function. There is, however 42 // we are rebuilding the store buffer using this function. There is, however
47 // no issue of overwriting the buffer we are iterating over, because this 43 // no issue of overwriting the buffer we are iterating over, because this
48 // stage of the scavenge can only reduce the number of addresses in the store 44 // stage of the scavenge can only reduce the number of addresses in the store
49 // buffer (some objects are promoted so pointers to them do not need to be in 45 // buffer (some objects are promoted so pointers to them do not need to be in
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 205 }
210 206
211 ~DontMoveStoreBufferEntriesScope() { 207 ~DontMoveStoreBufferEntriesScope() {
212 store_buffer_->may_move_store_buffer_entries_ = stored_state_; 208 store_buffer_->may_move_store_buffer_entries_ = stored_state_;
213 } 209 }
214 210
215 private: 211 private:
216 StoreBuffer* store_buffer_; 212 StoreBuffer* store_buffer_;
217 bool stored_state_; 213 bool stored_state_;
218 }; 214 };
215
216 class LocalStoreBuffer BASE_EMBEDDED {
217 public:
218 LocalStoreBuffer() : top_(new Node(nullptr)) {}
219
220 ~LocalStoreBuffer() {
221 Node* current = top_;
222 while (current != nullptr) {
223 Node* tmp = current->next;
224 delete current;
225 current = tmp;
226 }
227 }
228
229 inline void Record(Address addr);
230 inline void Process(StoreBuffer* store_buffer);
231
232 private:
233 static const int kBufferSize = 16 * KB;
234
235 struct Node : Malloced {
236 explicit Node(Node* next_node) : next(next_node), count(0) {}
237
238 inline bool is_full() { return count == kBufferSize; }
239
240 Node* next;
241 Address buffer[kBufferSize];
242 int count;
243 };
244
245 Node* top_;
246 };
247
219 } // namespace internal 248 } // namespace internal
220 } // namespace v8 249 } // namespace v8
221 250
222 #endif // V8_STORE_BUFFER_H_ 251 #endif // V8_STORE_BUFFER_H_
OLDNEW
« no previous file with comments | « src/heap/spaces.h ('k') | src/heap/store-buffer-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698