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_INL_H_ | 5 #ifndef V8_STORE_BUFFER_INL_H_ |
6 #define V8_STORE_BUFFER_INL_H_ | 6 #define V8_STORE_BUFFER_INL_H_ |
7 | 7 |
8 #include "src/heap/heap.h" | 8 #include "src/heap/heap.h" |
9 #include "src/heap/remembered-set.h" | 9 #include "src/heap/remembered-set.h" |
10 #include "src/heap/spaces-inl.h" | 10 #include "src/heap/spaces-inl.h" |
11 #include "src/heap/store-buffer.h" | 11 #include "src/heap/store-buffer.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
| 16 void LocalStoreBuffer::Record(Address addr) { |
| 17 if (top_->is_full()) top_ = new Node(top_); |
| 18 top_->buffer[top_->count++] = addr; |
| 19 } |
| 20 |
| 21 void LocalStoreBuffer::Process(StoreBuffer* store_buffer) { |
| 22 Node* current = top_; |
| 23 while (current != nullptr) { |
| 24 for (int i = 0; i < current->count; i++) { |
| 25 Address slot = current->buffer[i]; |
| 26 Page* page = Page::FromAnyPointerAddress(heap_, slot); |
| 27 RememberedSet<OLD_TO_NEW>::Insert(page, slot); |
| 28 } |
| 29 current = current->next; |
| 30 } |
| 31 } |
16 | 32 |
17 } // namespace internal | 33 } // namespace internal |
18 } // namespace v8 | 34 } // namespace v8 |
19 | 35 |
20 #endif // V8_STORE_BUFFER_INL_H_ | 36 #endif // V8_STORE_BUFFER_INL_H_ |
OLD | NEW |