| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 start_ = limit_ = NULL; | 56 start_ = limit_ = NULL; |
| 57 heap_->set_store_buffer_top(reinterpret_cast<Smi*>(start_)); | 57 heap_->set_store_buffer_top(reinterpret_cast<Smi*>(start_)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 void StoreBuffer::StoreBufferOverflow(Isolate* isolate) { | 61 void StoreBuffer::StoreBufferOverflow(Isolate* isolate) { |
| 62 isolate->heap()->store_buffer()->InsertEntriesFromBuffer(); | 62 isolate->heap()->store_buffer()->InsertEntriesFromBuffer(); |
| 63 isolate->counters()->store_buffer_overflows()->Increment(); | 63 isolate->counters()->store_buffer_overflows()->Increment(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void StoreBuffer::Remove(Address addr) { |
| 67 InsertEntriesFromBuffer(); |
| 68 MemoryChunk* chunk = MemoryChunk::FromAddress(addr); |
| 69 DCHECK_EQ(chunk->owner()->identity(), OLD_SPACE); |
| 70 uintptr_t offset = addr - chunk->address(); |
| 71 DCHECK_LT(offset, static_cast<uintptr_t>(Page::kPageSize)); |
| 72 if (chunk->old_to_new_slots() == nullptr) return; |
| 73 chunk->old_to_new_slots()->Remove(static_cast<uint32_t>(offset)); |
| 74 } |
| 66 | 75 |
| 67 #ifdef VERIFY_HEAP | 76 #ifdef VERIFY_HEAP |
| 68 void StoreBuffer::VerifyPointers(LargeObjectSpace* space) { | 77 void StoreBuffer::VerifyPointers(LargeObjectSpace* space) { |
| 69 LargeObjectIterator it(space); | 78 LargeObjectIterator it(space); |
| 70 for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) { | 79 for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) { |
| 71 if (object->IsFixedArray()) { | 80 if (object->IsFixedArray()) { |
| 72 Address slot_address = object->address(); | 81 Address slot_address = object->address(); |
| 73 Address end = object->address() + object->Size(); | 82 Address end = object->address() + object->Size(); |
| 74 while (slot_address < end) { | 83 while (slot_address < end) { |
| 75 HeapObject** slot = reinterpret_cast<HeapObject**>(slot_address); | 84 HeapObject** slot = reinterpret_cast<HeapObject**>(slot_address); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 CHECK(heap->InNewSpace(object)); | 219 CHECK(heap->InNewSpace(object)); |
| 211 heap->mark_compact_collector()->VerifyIsSlotInLiveObject( | 220 heap->mark_compact_collector()->VerifyIsSlotInLiveObject( |
| 212 reinterpret_cast<Address>(slot), HeapObject::cast(object)); | 221 reinterpret_cast<Address>(slot), HeapObject::cast(object)); |
| 213 } | 222 } |
| 214 return SlotSet::KEEP_SLOT; | 223 return SlotSet::KEEP_SLOT; |
| 215 }); | 224 }); |
| 216 } | 225 } |
| 217 | 226 |
| 218 } // namespace internal | 227 } // namespace internal |
| 219 } // namespace v8 | 228 } // namespace v8 |
| OLD | NEW |