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/v8.h" | 5 #include "src/v8.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/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 pages.push_back(std::make_pair(live_bytes, p)); | 671 pages.push_back(std::make_pair(live_bytes, p)); |
672 } | 672 } |
673 | 673 |
674 int candidate_count = 0; | 674 int candidate_count = 0; |
675 int total_live_bytes = 0; | 675 int total_live_bytes = 0; |
676 | 676 |
677 bool reduce_memory = | 677 bool reduce_memory = |
678 reduce_memory_footprint_ || | 678 reduce_memory_footprint_ || |
679 heap()->HasLowAllocationRate( | 679 heap()->HasLowAllocationRate( |
680 heap()->tracer()->CurrentAllocationThroughputInBytesPerMillisecond()); | 680 heap()->tracer()->CurrentAllocationThroughputInBytesPerMillisecond()); |
681 | 681 if (FLAG_manual_evacuation_candidates_selection) { |
682 if (FLAG_stress_compaction || FLAG_manual_evacuation_candidates_selection) { | |
683 for (size_t i = 0; i < pages.size(); i++) { | 682 for (size_t i = 0; i < pages.size(); i++) { |
684 Page* p = pages[i].second; | 683 Page* p = pages[i].second; |
685 if (((i % 2 == 0) && FLAG_stress_compaction) || | 684 if (p->IsFlagSet(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING)) { |
686 p->IsFlagSet(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING)) { | |
687 candidate_count++; | 685 candidate_count++; |
688 total_live_bytes += pages[i].first; | 686 total_live_bytes += pages[i].first; |
689 p->ClearFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); | 687 p->ClearFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); |
690 AddEvacuationCandidate(p); | 688 AddEvacuationCandidate(p); |
691 } | 689 } |
692 } | 690 } |
| 691 } else if (FLAG_stress_compaction) { |
| 692 for (size_t i = 0; i < pages.size(); i++) { |
| 693 Page* p = pages[i].second; |
| 694 if (i % 2 == 0) { |
| 695 candidate_count++; |
| 696 total_live_bytes += pages[i].first; |
| 697 AddEvacuationCandidate(p); |
| 698 } |
| 699 } |
693 } else { | 700 } else { |
694 const int kTargetFragmentationPercent = 50; | 701 const int kTargetFragmentationPercent = 50; |
695 const int kMaxEvacuatedBytes = 4 * Page::kPageSize; | 702 const int kMaxEvacuatedBytes = 4 * Page::kPageSize; |
696 | 703 |
697 const int kTargetFragmentationPercentForReduceMemory = 20; | 704 const int kTargetFragmentationPercentForReduceMemory = 20; |
698 const int kMaxEvacuatedBytesForReduceMemory = 12 * Page::kPageSize; | 705 const int kMaxEvacuatedBytesForReduceMemory = 12 * Page::kPageSize; |
699 | 706 |
700 int max_evacuated_bytes; | 707 int max_evacuated_bytes; |
701 int target_fragmentation_percent; | 708 int target_fragmentation_percent; |
702 | 709 |
(...skipping 3948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4651 SlotsBuffer* buffer = *buffer_address; | 4658 SlotsBuffer* buffer = *buffer_address; |
4652 while (buffer != NULL) { | 4659 while (buffer != NULL) { |
4653 SlotsBuffer* next_buffer = buffer->next(); | 4660 SlotsBuffer* next_buffer = buffer->next(); |
4654 DeallocateBuffer(buffer); | 4661 DeallocateBuffer(buffer); |
4655 buffer = next_buffer; | 4662 buffer = next_buffer; |
4656 } | 4663 } |
4657 *buffer_address = NULL; | 4664 *buffer_address = NULL; |
4658 } | 4665 } |
4659 } | 4666 } |
4660 } // namespace v8::internal | 4667 } // namespace v8::internal |
OLD | NEW |