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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 ReportStatisticsBeforeGC(); | 433 ReportStatisticsBeforeGC(); |
434 #endif // DEBUG | 434 #endif // DEBUG |
435 | 435 |
436 if (new_space_->IsAtMaximumCapacity()) { | 436 if (new_space_->IsAtMaximumCapacity()) { |
437 maximum_size_scavenges_++; | 437 maximum_size_scavenges_++; |
438 } else { | 438 } else { |
439 maximum_size_scavenges_ = 0; | 439 maximum_size_scavenges_ = 0; |
440 } | 440 } |
441 CheckNewSpaceExpansionCriteria(); | 441 CheckNewSpaceExpansionCriteria(); |
442 UpdateNewSpaceAllocationCounter(); | 442 UpdateNewSpaceAllocationCounter(); |
443 store_buffer()->MoveAllEntriesToRememberedSet(); | 443 store_buffer()->MoveEntriesToRememberedSet(); |
444 } | 444 } |
445 | 445 |
446 | 446 |
447 intptr_t Heap::SizeOfObjects() { | 447 intptr_t Heap::SizeOfObjects() { |
448 intptr_t total = 0; | 448 intptr_t total = 0; |
449 AllSpaces spaces(this); | 449 AllSpaces spaces(this); |
450 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { | 450 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { |
451 total += space->SizeOfObjects(); | 451 total += space->SizeOfObjects(); |
452 } | 452 } |
453 return total; | 453 return total; |
(...skipping 5445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5899 }; | 5899 }; |
5900 | 5900 |
5901 | 5901 |
5902 void Heap::CheckHandleCount() { | 5902 void Heap::CheckHandleCount() { |
5903 CheckHandleCountVisitor v; | 5903 CheckHandleCountVisitor v; |
5904 isolate_->handle_scope_implementer()->Iterate(&v); | 5904 isolate_->handle_scope_implementer()->Iterate(&v); |
5905 } | 5905 } |
5906 | 5906 |
5907 void Heap::ClearRecordedSlot(HeapObject* object, Object** slot) { | 5907 void Heap::ClearRecordedSlot(HeapObject* object, Object** slot) { |
5908 if (!InNewSpace(object)) { | 5908 if (!InNewSpace(object)) { |
| 5909 store_buffer()->MoveEntriesToRememberedSet(); |
5909 Address slot_addr = reinterpret_cast<Address>(slot); | 5910 Address slot_addr = reinterpret_cast<Address>(slot); |
5910 Page* page = Page::FromAddress(slot_addr); | 5911 Page* page = Page::FromAddress(slot_addr); |
5911 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); | 5912 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); |
5912 if (gc_state_ == NOT_IN_GC) { | 5913 RememberedSet<OLD_TO_NEW>::Remove(page, slot_addr); |
5913 store_buffer()->DeleteEntry(slot_addr); | |
5914 } else { | |
5915 DCHECK(store_buffer()->Empty()); | |
5916 RememberedSet<OLD_TO_NEW>::Remove(page, slot_addr); | |
5917 } | |
5918 RememberedSet<OLD_TO_OLD>::Remove(page, slot_addr); | 5914 RememberedSet<OLD_TO_OLD>::Remove(page, slot_addr); |
5919 } | 5915 } |
5920 } | 5916 } |
5921 | 5917 |
5922 void Heap::ClearRecordedSlotRange(Address start, Address end) { | 5918 void Heap::ClearRecordedSlotRange(Address start, Address end) { |
5923 Page* page = Page::FromAddress(start); | 5919 Page* page = Page::FromAddress(start); |
5924 if (!page->InNewSpace()) { | 5920 if (!page->InNewSpace()) { |
| 5921 store_buffer()->MoveEntriesToRememberedSet(); |
5925 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); | 5922 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); |
5926 if (gc_state_ == NOT_IN_GC) { | 5923 RememberedSet<OLD_TO_NEW>::RemoveRange(page, start, end, |
5927 store_buffer()->DeleteEntry(start, end); | 5924 SlotSet::PREFREE_EMPTY_BUCKETS); |
5928 } else { | |
5929 DCHECK(store_buffer()->Empty()); | |
5930 RememberedSet<OLD_TO_NEW>::RemoveRange(page, start, end, | |
5931 SlotSet::PREFREE_EMPTY_BUCKETS); | |
5932 } | |
5933 RememberedSet<OLD_TO_OLD>::RemoveRange(page, start, end, | 5925 RememberedSet<OLD_TO_OLD>::RemoveRange(page, start, end, |
5934 SlotSet::FREE_EMPTY_BUCKETS); | 5926 SlotSet::FREE_EMPTY_BUCKETS); |
5935 } | 5927 } |
5936 } | 5928 } |
5937 | 5929 |
5938 void Heap::RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, | 5930 void Heap::RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, |
5939 Object* value) { | 5931 Object* value) { |
5940 DCHECK(InNewSpace(value)); | 5932 DCHECK(InNewSpace(value)); |
5941 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(host)); | 5933 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(host)); |
5942 RelocInfo::Mode rmode = rinfo->rmode(); | 5934 RelocInfo::Mode rmode = rinfo->rmode(); |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6495 } | 6487 } |
6496 | 6488 |
6497 | 6489 |
6498 // static | 6490 // static |
6499 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6491 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6500 return StaticVisitorBase::GetVisitorId(map); | 6492 return StaticVisitorBase::GetVisitorId(map); |
6501 } | 6493 } |
6502 | 6494 |
6503 } // namespace internal | 6495 } // namespace internal |
6504 } // namespace v8 | 6496 } // namespace v8 |
OLD | NEW |