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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 Min(kMaxMaxEvacuationCandidates, max_evacuation_candidates); | 716 Min(kMaxMaxEvacuationCandidates, max_evacuation_candidates); |
717 | 717 |
718 int count = 0; | 718 int count = 0; |
719 int fragmentation = 0; | 719 int fragmentation = 0; |
720 Candidate* least = NULL; | 720 Candidate* least = NULL; |
721 | 721 |
722 PageIterator it(space); | 722 PageIterator it(space); |
723 while (it.has_next()) { | 723 while (it.has_next()) { |
724 Page* p = it.next(); | 724 Page* p = it.next(); |
725 if (p->NeverEvacuate()) continue; | 725 if (p->NeverEvacuate()) continue; |
726 p->ClearEvacuationCandidate(); | 726 |
| 727 // Invariant: Evacuation candidates are just created when marking is |
| 728 // started. At the end of a GC all evacuation candidates are cleared and |
| 729 // their slot buffers are released. |
| 730 CHECK(!p->IsEvacuationCandidate()); |
| 731 CHECK(p->slots_buffer() == NULL); |
727 | 732 |
728 if (FLAG_stress_compaction) { | 733 if (FLAG_stress_compaction) { |
729 unsigned int counter = space->heap()->ms_count(); | 734 unsigned int counter = space->heap()->ms_count(); |
730 uintptr_t page_number = reinterpret_cast<uintptr_t>(p) >> kPageSizeBits; | 735 uintptr_t page_number = reinterpret_cast<uintptr_t>(p) >> kPageSizeBits; |
731 if ((counter & 1) == (page_number & 1)) fragmentation = 1; | 736 if ((counter & 1) == (page_number & 1)) fragmentation = 1; |
732 } else if (mode == REDUCE_MEMORY_FOOTPRINT) { | 737 } else if (mode == REDUCE_MEMORY_FOOTPRINT) { |
733 // Don't try to release too many pages. | 738 // Don't try to release too many pages. |
734 if (estimated_release >= over_reserved) { | 739 if (estimated_release >= over_reserved) { |
735 continue; | 740 continue; |
736 } | 741 } |
(...skipping 3681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4418 SlotsBuffer* buffer = *buffer_address; | 4423 SlotsBuffer* buffer = *buffer_address; |
4419 while (buffer != NULL) { | 4424 while (buffer != NULL) { |
4420 SlotsBuffer* next_buffer = buffer->next(); | 4425 SlotsBuffer* next_buffer = buffer->next(); |
4421 DeallocateBuffer(buffer); | 4426 DeallocateBuffer(buffer); |
4422 buffer = next_buffer; | 4427 buffer = next_buffer; |
4423 } | 4428 } |
4424 *buffer_address = NULL; | 4429 *buffer_address = NULL; |
4425 } | 4430 } |
4426 } | 4431 } |
4427 } // namespace v8::internal | 4432 } // namespace v8::internal |
OLD | NEW |