| 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 3535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3546 enum FreeSpaceTreatmentMode { IGNORE_FREE_SPACE, ZAP_FREE_SPACE }; | 3546 enum FreeSpaceTreatmentMode { IGNORE_FREE_SPACE, ZAP_FREE_SPACE }; |
| 3547 | 3547 |
| 3548 | 3548 |
| 3549 template <MarkCompactCollector::SweepingParallelism mode> | 3549 template <MarkCompactCollector::SweepingParallelism mode> |
| 3550 static intptr_t Free(PagedSpace* space, FreeList* free_list, Address start, | 3550 static intptr_t Free(PagedSpace* space, FreeList* free_list, Address start, |
| 3551 int size) { | 3551 int size) { |
| 3552 if (mode == MarkCompactCollector::SWEEP_ON_MAIN_THREAD) { | 3552 if (mode == MarkCompactCollector::SWEEP_ON_MAIN_THREAD) { |
| 3553 DCHECK(free_list == NULL); | 3553 DCHECK(free_list == NULL); |
| 3554 return space->Free(start, size); | 3554 return space->Free(start, size); |
| 3555 } else { | 3555 } else { |
| 3556 // TODO(hpayer): account for wasted bytes in concurrent sweeping too. | |
| 3557 return size - free_list->Free(start, size); | 3556 return size - free_list->Free(start, size); |
| 3558 } | 3557 } |
| 3559 } | 3558 } |
| 3560 | 3559 |
| 3561 | 3560 |
| 3562 // Sweeps a page. After sweeping the page can be iterated. | 3561 // Sweeps a page. After sweeping the page can be iterated. |
| 3563 // Slots in live objects pointing into evacuation candidates are updated | 3562 // Slots in live objects pointing into evacuation candidates are updated |
| 3564 // if requested. | 3563 // if requested. |
| 3565 // Returns the size of the biggest continuous freed memory chunk in bytes. | 3564 // Returns the size of the biggest continuous freed memory chunk in bytes. |
| 3566 template <SweepingMode sweeping_mode, | 3565 template <SweepingMode sweeping_mode, |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4600 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4599 MarkBit mark_bit = Marking::MarkBitFrom(host); |
| 4601 if (Marking::IsBlack(mark_bit)) { | 4600 if (Marking::IsBlack(mark_bit)) { |
| 4602 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); | 4601 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); |
| 4603 RecordRelocSlot(&rinfo, target); | 4602 RecordRelocSlot(&rinfo, target); |
| 4604 } | 4603 } |
| 4605 } | 4604 } |
| 4606 } | 4605 } |
| 4607 | 4606 |
| 4608 } // namespace internal | 4607 } // namespace internal |
| 4609 } // namespace v8 | 4608 } // namespace v8 |
| OLD | NEW |