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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 | 210 |
211 ~DontMoveStoreBufferEntriesScope() { | 211 ~DontMoveStoreBufferEntriesScope() { |
212 store_buffer_->may_move_store_buffer_entries_ = stored_state_; | 212 store_buffer_->may_move_store_buffer_entries_ = stored_state_; |
213 } | 213 } |
214 | 214 |
215 private: | 215 private: |
216 StoreBuffer* store_buffer_; | 216 StoreBuffer* store_buffer_; |
217 bool stored_state_; | 217 bool stored_state_; |
218 }; | 218 }; |
| 219 |
| 220 |
| 221 class LocalStoreBuffer BASE_EMBEDDED { |
| 222 public: |
| 223 LocalStoreBuffer() : top_(new Node(nullptr)) {} |
| 224 |
| 225 ~LocalStoreBuffer() { |
| 226 Node* current = top_; |
| 227 while (current != nullptr) { |
| 228 Node* tmp = current->next; |
| 229 delete current; |
| 230 current = tmp; |
| 231 } |
| 232 } |
| 233 |
| 234 inline void Record(Address addr); |
| 235 inline void Process(StoreBuffer* store_buffer); |
| 236 |
| 237 private: |
| 238 static const int kBufferSize = 16 * KB; |
| 239 |
| 240 struct Node : Malloced { |
| 241 explicit Node(Node* next_node) : next(next_node), count(0) {} |
| 242 |
| 243 inline bool is_full() { return count == kBufferSize; } |
| 244 |
| 245 Node* next; |
| 246 Address buffer[kBufferSize]; |
| 247 int count; |
| 248 }; |
| 249 |
| 250 Node* top_; |
| 251 }; |
| 252 |
219 } // namespace internal | 253 } // namespace internal |
220 } // namespace v8 | 254 } // namespace v8 |
221 | 255 |
222 #endif // V8_STORE_BUFFER_H_ | 256 #endif // V8_STORE_BUFFER_H_ |
OLD | NEW |