| 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/spaces-inl.h" | 9 #include "src/heap/spaces-inl.h" |
| 10 #include "src/heap/store-buffer.h" | 10 #include "src/heap/store-buffer.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 if (offset < Page::kPageSize) { | 25 if (offset < Page::kPageSize) { |
| 26 *slots = chunk->old_to_new_slots(); | 26 *slots = chunk->old_to_new_slots(); |
| 27 } else { | 27 } else { |
| 28 *slots = &chunk->old_to_new_slots()[offset / Page::kPageSize]; | 28 *slots = &chunk->old_to_new_slots()[offset / Page::kPageSize]; |
| 29 offset = offset % Page::kPageSize; | 29 offset = offset % Page::kPageSize; |
| 30 } | 30 } |
| 31 return static_cast<uint32_t>(offset); | 31 return static_cast<uint32_t>(offset); |
| 32 } | 32 } |
| 33 | 33 |
| 34 | |
| 35 void LocalStoreBuffer::Record(Address addr) { | 34 void LocalStoreBuffer::Record(Address addr) { |
| 36 if (top_->is_full()) top_ = new Node(top_); | 35 if (top_->is_full()) top_ = new Node(top_); |
| 37 top_->buffer[top_->count++] = addr; | 36 top_->buffer[top_->count++] = addr; |
| 38 } | 37 } |
| 39 | 38 |
| 40 void LocalStoreBuffer::Process(StoreBuffer* store_buffer) { | 39 void LocalStoreBuffer::Process(StoreBuffer* store_buffer) { |
| 41 Node* current = top_; | 40 Node* current = top_; |
| 42 while (current != nullptr) { | 41 while (current != nullptr) { |
| 43 for (int i = 0; i < current->count; i++) { | 42 for (int i = 0; i < current->count; i++) { |
| 44 store_buffer->Mark(current->buffer[i]); | 43 store_buffer->Mark(current->buffer[i]); |
| 45 } | 44 } |
| 46 current = current->next; | 45 current = current->next; |
| 47 } | 46 } |
| 48 } | 47 } |
| 49 | 48 |
| 50 void StoreBuffer::Mark(Address addr) { | 49 void StoreBuffer::Mark(Address addr) { |
| 51 SlotSet* slots; | 50 SlotSet* slots; |
| 52 uint32_t offset; | 51 uint32_t offset; |
| 53 offset = AddressToSlotSetAndOffset(addr, &slots); | 52 offset = AddressToSlotSetAndOffset(addr, &slots); |
| 54 slots->Insert(offset); | 53 slots->Insert(offset); |
| 55 } | 54 } |
| 56 | 55 |
| 57 } // namespace internal | 56 } // namespace internal |
| 58 } // namespace v8 | 57 } // namespace v8 |
| 59 | 58 |
| 60 #endif // V8_STORE_BUFFER_INL_H_ | 59 #endif // V8_STORE_BUFFER_INL_H_ |
| OLD | NEW |