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()->MoveEntriesToRememberedSet(); | 443 store_buffer()->MoveAllEntriesToRememberedSet(); |
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(); | |
5910 Address slot_addr = reinterpret_cast<Address>(slot); | 5909 Address slot_addr = reinterpret_cast<Address>(slot); |
5911 Page* page = Page::FromAddress(slot_addr); | 5910 Page* page = Page::FromAddress(slot_addr); |
5912 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); | 5911 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); |
5913 RememberedSet<OLD_TO_NEW>::Remove(page, slot_addr); | 5912 if (gc_state_ == NOT_IN_GC) { |
| 5913 store_buffer()->DeleteEntry(slot_addr); |
| 5914 } else { |
| 5915 DCHECK(store_buffer()->Empty()); |
| 5916 RememberedSet<OLD_TO_NEW>::Remove(page, slot_addr); |
| 5917 } |
5914 RememberedSet<OLD_TO_OLD>::Remove(page, slot_addr); | 5918 RememberedSet<OLD_TO_OLD>::Remove(page, slot_addr); |
5915 } | 5919 } |
5916 } | 5920 } |
5917 | 5921 |
5918 void Heap::ClearRecordedSlotRange(Address start, Address end) { | 5922 void Heap::ClearRecordedSlotRange(Address start, Address end) { |
5919 Page* page = Page::FromAddress(start); | 5923 Page* page = Page::FromAddress(start); |
5920 if (!page->InNewSpace()) { | 5924 if (!page->InNewSpace()) { |
5921 store_buffer()->MoveEntriesToRememberedSet(); | |
5922 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); | 5925 DCHECK_EQ(page->owner()->identity(), OLD_SPACE); |
5923 RememberedSet<OLD_TO_NEW>::RemoveRange(page, start, end, | 5926 if (gc_state_ == NOT_IN_GC) { |
5924 SlotSet::PREFREE_EMPTY_BUCKETS); | 5927 store_buffer()->DeleteEntry(start, end); |
| 5928 } else { |
| 5929 DCHECK(store_buffer()->Empty()); |
| 5930 RememberedSet<OLD_TO_NEW>::RemoveRange(page, start, end, |
| 5931 SlotSet::PREFREE_EMPTY_BUCKETS); |
| 5932 } |
5925 RememberedSet<OLD_TO_OLD>::RemoveRange(page, start, end, | 5933 RememberedSet<OLD_TO_OLD>::RemoveRange(page, start, end, |
5926 SlotSet::FREE_EMPTY_BUCKETS); | 5934 SlotSet::FREE_EMPTY_BUCKETS); |
5927 } | 5935 } |
5928 } | 5936 } |
5929 | 5937 |
5930 void Heap::RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, | 5938 void Heap::RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, |
5931 Object* value) { | 5939 Object* value) { |
5932 DCHECK(InNewSpace(value)); | 5940 DCHECK(InNewSpace(value)); |
5933 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(host)); | 5941 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(host)); |
5934 RelocInfo::Mode rmode = rinfo->rmode(); | 5942 RelocInfo::Mode rmode = rinfo->rmode(); |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6487 } | 6495 } |
6488 | 6496 |
6489 | 6497 |
6490 // static | 6498 // static |
6491 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6499 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6492 return StaticVisitorBase::GetVisitorId(map); | 6500 return StaticVisitorBase::GetVisitorId(map); |
6493 } | 6501 } |
6494 | 6502 |
6495 } // namespace internal | 6503 } // namespace internal |
6496 } // namespace v8 | 6504 } // namespace v8 |
OLD | NEW |