OLD | NEW |
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 #include "src/heap/store-buffer.h" | 5 #include "src/heap/store-buffer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/counters.h" | 9 #include "src/counters.h" |
10 #include "src/heap/incremental-marking.h" | 10 #include "src/heap/incremental-marking.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 void StoreBuffer::ConcurrentlyProcessStoreBuffer() { | 133 void StoreBuffer::ConcurrentlyProcessStoreBuffer() { |
134 base::LockGuard<base::Mutex> guard(&mutex_); | 134 base::LockGuard<base::Mutex> guard(&mutex_); |
135 int other = (current_ + 1) % kStoreBuffers; | 135 int other = (current_ + 1) % kStoreBuffers; |
136 MoveEntriesToRememberedSet(other); | 136 MoveEntriesToRememberedSet(other); |
137 task_running_ = false; | 137 task_running_ = false; |
138 } | 138 } |
139 | 139 |
140 void StoreBuffer::DeleteEntry(Address start, Address end) { | 140 void StoreBuffer::DeleteEntry(Address start, Address end) { |
141 if (top_ + sizeof(Address) * 2 > limit_[current_]) { | 141 // Deletions coming from the GC are directly deleted from the remembered |
142 StoreBufferOverflow(heap_->isolate()); | 142 // set. Deletions coming from the runtime are added to the store buffer |
| 143 // to allow concurrent processing. |
| 144 if (heap_->gc_state() == Heap::NOT_IN_GC) { |
| 145 if (top_ + sizeof(Address) * 2 > limit_[current_]) { |
| 146 StoreBufferOverflow(heap_->isolate()); |
| 147 } |
| 148 *top_ = MarkDeletionAddress(start); |
| 149 top_++; |
| 150 *top_ = end; |
| 151 top_++; |
| 152 } else { |
| 153 // In GC the store buffer has to be empty at any time. |
| 154 DCHECK(Empty()); |
| 155 Page* page = Page::FromAddress(start); |
| 156 if (end) { |
| 157 RememberedSet<OLD_TO_NEW>::RemoveRange(page, start, end, |
| 158 SlotSet::PREFREE_EMPTY_BUCKETS); |
| 159 } else { |
| 160 RememberedSet<OLD_TO_NEW>::Remove(page, start); |
| 161 } |
143 } | 162 } |
144 *top_ = MarkDeletionAddress(start); | |
145 top_++; | |
146 *top_ = end; | |
147 top_++; | |
148 } | 163 } |
149 | |
150 } // namespace internal | 164 } // namespace internal |
151 } // namespace v8 | 165 } // namespace v8 |
OLD | NEW |