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 #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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 #ifdef VERIFY_HEAP | 156 #ifdef VERIFY_HEAP |
157 void VerifyPointers(LargeObjectSpace* space); | 157 void VerifyPointers(LargeObjectSpace* space); |
158 #endif | 158 #endif |
159 | 159 |
160 friend class StoreBufferRebuildScope; | 160 friend class StoreBufferRebuildScope; |
161 friend class DontMoveStoreBufferEntriesScope; | 161 friend class DontMoveStoreBufferEntriesScope; |
162 }; | 162 }; |
163 | 163 |
164 | 164 |
| 165 class StoreBufferRebuilder { |
| 166 public: |
| 167 explicit StoreBufferRebuilder(StoreBuffer* store_buffer) |
| 168 : store_buffer_(store_buffer) {} |
| 169 |
| 170 void Callback(MemoryChunk* page, StoreBufferEvent event); |
| 171 |
| 172 private: |
| 173 StoreBuffer* store_buffer_; |
| 174 |
| 175 // We record in this variable how full the store buffer was when we started |
| 176 // iterating over the current page, finding pointers to new space. If the |
| 177 // store buffer overflows again we can exempt the page from the store buffer |
| 178 // by rewinding to this point instead of having to search the store buffer. |
| 179 Object*** start_of_current_page_; |
| 180 // The current page we are scanning in the store buffer iterator. |
| 181 MemoryChunk* current_page_; |
| 182 }; |
| 183 |
| 184 |
165 class StoreBufferRebuildScope { | 185 class StoreBufferRebuildScope { |
166 public: | 186 public: |
167 explicit StoreBufferRebuildScope(Heap* heap, StoreBuffer* store_buffer, | 187 explicit StoreBufferRebuildScope(Heap* heap, StoreBuffer* store_buffer, |
168 StoreBufferCallback callback) | 188 StoreBufferCallback callback) |
169 : store_buffer_(store_buffer), | 189 : store_buffer_(store_buffer), |
170 stored_state_(store_buffer->store_buffer_rebuilding_enabled_), | 190 stored_state_(store_buffer->store_buffer_rebuilding_enabled_), |
171 stored_callback_(store_buffer->callback_) { | 191 stored_callback_(store_buffer->callback_) { |
172 store_buffer_->store_buffer_rebuilding_enabled_ = true; | 192 store_buffer_->store_buffer_rebuilding_enabled_ = true; |
173 store_buffer_->callback_ = callback; | 193 store_buffer_->callback_ = callback; |
174 (*callback)(heap, NULL, kStoreBufferStartScanningPagesEvent); | 194 (*callback)(heap, NULL, kStoreBufferStartScanningPagesEvent); |
(...skipping 24 matching lines...) Expand all Loading... |
199 } | 219 } |
200 | 220 |
201 private: | 221 private: |
202 StoreBuffer* store_buffer_; | 222 StoreBuffer* store_buffer_; |
203 bool stored_state_; | 223 bool stored_state_; |
204 }; | 224 }; |
205 } | 225 } |
206 } // namespace v8::internal | 226 } // namespace v8::internal |
207 | 227 |
208 #endif // V8_STORE_BUFFER_H_ | 228 #endif // V8_STORE_BUFFER_H_ |
OLD | NEW |