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/mark-compact.h" | 5 #include "src/heap/mark-compact.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
695 CHECK(p->slots_buffer() == NULL); | 695 CHECK(p->slots_buffer() == NULL); |
696 DCHECK(p->area_size() == area_size); | 696 DCHECK(p->area_size() == area_size); |
697 int live_bytes = | 697 int live_bytes = |
698 p->WasSwept() ? p->LiveBytesFromFreeList() : p->LiveBytes(); | 698 p->WasSwept() ? p->LiveBytesFromFreeList() : p->LiveBytes(); |
699 pages.push_back(std::make_pair(live_bytes, p)); | 699 pages.push_back(std::make_pair(live_bytes, p)); |
700 } | 700 } |
701 | 701 |
702 int candidate_count = 0; | 702 int candidate_count = 0; |
703 int total_live_bytes = 0; | 703 int total_live_bytes = 0; |
704 | 704 |
705 bool reduce_memory = | 705 // The minimum about of memory to make aggresive compaction worthwhile. |
Hannes Payer (out of office)
2015/10/01 14:36:07
amount
| |
706 heap()->ShouldReduceMemory() || heap()->HasLowAllocationRate(); | 706 const int kMinPagesToReduceMemory = 16; |
707 | |
708 bool reduce_memory = heap()->ShouldReduceMemory() || | |
709 (heap()->HasLowAllocationRate() && | |
Hannes Payer (out of office)
2015/10/01 14:36:07
As you suggested offline, we can remove the alloca
| |
710 number_of_pages > kMinPageToReduceMemory); | |
707 if (FLAG_manual_evacuation_candidates_selection) { | 711 if (FLAG_manual_evacuation_candidates_selection) { |
708 for (size_t i = 0; i < pages.size(); i++) { | 712 for (size_t i = 0; i < pages.size(); i++) { |
709 Page* p = pages[i].second; | 713 Page* p = pages[i].second; |
710 if (p->IsFlagSet(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING)) { | 714 if (p->IsFlagSet(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING)) { |
711 candidate_count++; | 715 candidate_count++; |
712 total_live_bytes += pages[i].first; | 716 total_live_bytes += pages[i].first; |
713 p->ClearFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); | 717 p->ClearFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); |
714 AddEvacuationCandidate(p); | 718 AddEvacuationCandidate(p); |
715 } | 719 } |
716 } | 720 } |
(...skipping 3882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4599 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4603 MarkBit mark_bit = Marking::MarkBitFrom(host); |
4600 if (Marking::IsBlack(mark_bit)) { | 4604 if (Marking::IsBlack(mark_bit)) { |
4601 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); | 4605 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); |
4602 RecordRelocSlot(&rinfo, target); | 4606 RecordRelocSlot(&rinfo, target); |
4603 } | 4607 } |
4604 } | 4608 } |
4605 } | 4609 } |
4606 | 4610 |
4607 } // namespace internal | 4611 } // namespace internal |
4608 } // namespace v8 | 4612 } // namespace v8 |
OLD | NEW |