OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/heap.h" | 5 #include "src/heap/heap.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/ast/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 5867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5878 void Heap::CheckHandleCount() { | 5878 void Heap::CheckHandleCount() { |
5879 CheckHandleCountVisitor v; | 5879 CheckHandleCountVisitor v; |
5880 isolate_->handle_scope_implementer()->Iterate(&v); | 5880 isolate_->handle_scope_implementer()->Iterate(&v); |
5881 } | 5881 } |
5882 | 5882 |
5883 void Heap::ClearRecordedSlot(HeapObject* object, Object** slot) { | 5883 void Heap::ClearRecordedSlot(HeapObject* object, Object** slot) { |
5884 if (!InNewSpace(object)) { | 5884 if (!InNewSpace(object)) { |
5885 Address slot_addr = reinterpret_cast<Address>(slot); | 5885 Address slot_addr = reinterpret_cast<Address>(slot); |
5886 Page* page = Page::FromAddress(slot_addr); | 5886 Page* page = Page::FromAddress(slot_addr); |
5887 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); | 5887 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); |
5888 store_buffer()->DeleteEntry(slot_addr); | 5888 store_buffer()->MoveAllEntriesToRememberedSet(); |
| 5889 RememberedSet<OLD_TO_NEW>::Remove(page, slot_addr); |
5889 RememberedSet<OLD_TO_OLD>::Remove(page, slot_addr); | 5890 RememberedSet<OLD_TO_OLD>::Remove(page, slot_addr); |
5890 } | 5891 } |
5891 } | 5892 } |
5892 | 5893 |
5893 bool Heap::HasRecordedSlot(HeapObject* object, Object** slot) { | 5894 bool Heap::HasRecordedSlot(HeapObject* object, Object** slot) { |
5894 if (InNewSpace(object)) { | 5895 if (InNewSpace(object)) { |
5895 return false; | 5896 return false; |
5896 } | 5897 } |
5897 Address slot_addr = reinterpret_cast<Address>(slot); | 5898 Address slot_addr = reinterpret_cast<Address>(slot); |
5898 Page* page = Page::FromAddress(slot_addr); | 5899 Page* page = Page::FromAddress(slot_addr); |
5899 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); | 5900 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); |
5900 store_buffer()->MoveAllEntriesToRememberedSet(); | 5901 store_buffer()->MoveAllEntriesToRememberedSet(); |
5901 return RememberedSet<OLD_TO_NEW>::Contains(page, slot_addr) || | 5902 return RememberedSet<OLD_TO_NEW>::Contains(page, slot_addr) || |
5902 RememberedSet<OLD_TO_OLD>::Contains(page, slot_addr); | 5903 RememberedSet<OLD_TO_OLD>::Contains(page, slot_addr); |
5903 } | 5904 } |
5904 | 5905 |
5905 void Heap::ClearRecordedSlotRange(Address start, Address end) { | 5906 void Heap::ClearRecordedSlotRange(Address start, Address end) { |
5906 Page* page = Page::FromAddress(start); | 5907 Page* page = Page::FromAddress(start); |
5907 if (!page->InNewSpace()) { | 5908 if (!page->InNewSpace()) { |
5908 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); | 5909 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); |
5909 store_buffer()->DeleteEntry(start, end); | 5910 store_buffer()->MoveAllEntriesToRememberedSet(); |
| 5911 RememberedSet<OLD_TO_NEW>::RemoveRange(page, start, end, |
| 5912 SlotSet::PREFREE_EMPTY_BUCKETS); |
5910 RememberedSet<OLD_TO_OLD>::RemoveRange(page, start, end, | 5913 RememberedSet<OLD_TO_OLD>::RemoveRange(page, start, end, |
5911 SlotSet::FREE_EMPTY_BUCKETS); | 5914 SlotSet::FREE_EMPTY_BUCKETS); |
5912 } | 5915 } |
5913 } | 5916 } |
5914 | 5917 |
5915 void Heap::RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, | 5918 void Heap::RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, |
5916 Object* value) { | 5919 Object* value) { |
5917 DCHECK(InNewSpace(value)); | 5920 DCHECK(InNewSpace(value)); |
5918 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(host)); | 5921 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(host)); |
5919 RelocInfo::Mode rmode = rinfo->rmode(); | 5922 RelocInfo::Mode rmode = rinfo->rmode(); |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6476 } | 6479 } |
6477 | 6480 |
6478 | 6481 |
6479 // static | 6482 // static |
6480 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6483 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6481 return StaticVisitorBase::GetVisitorId(map); | 6484 return StaticVisitorBase::GetVisitorId(map); |
6482 } | 6485 } |
6483 | 6486 |
6484 } // namespace internal | 6487 } // namespace internal |
6485 } // namespace v8 | 6488 } // namespace v8 |
OLD | NEW |