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 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2623 LocalSlotsBuffer* old_to_new_slots) { | 2623 LocalSlotsBuffer* old_to_new_slots) { |
2624 Address dst_addr = dst->address(); | 2624 Address dst_addr = dst->address(); |
2625 Address src_addr = src->address(); | 2625 Address src_addr = src->address(); |
2626 DCHECK(heap()->AllowedToBeMigrated(src, dest)); | 2626 DCHECK(heap()->AllowedToBeMigrated(src, dest)); |
2627 DCHECK(dest != LO_SPACE); | 2627 DCHECK(dest != LO_SPACE); |
2628 if (dest == OLD_SPACE) { | 2628 if (dest == OLD_SPACE) { |
2629 DCHECK_OBJECT_SIZE(size); | 2629 DCHECK_OBJECT_SIZE(size); |
2630 DCHECK(IsAligned(size, kPointerSize)); | 2630 DCHECK(IsAligned(size, kPointerSize)); |
2631 | 2631 |
2632 heap()->MoveBlock(dst->address(), src->address(), size); | 2632 heap()->MoveBlock(dst->address(), src->address(), size); |
| 2633 if (FLAG_ignition && dst->IsBytecodeArray()) { |
| 2634 PROFILE(isolate(), CodeMoveEvent(AbstractCode::cast(src), dst_addr)); |
| 2635 } |
2633 RecordMigratedSlotVisitor visitor(this, old_to_old_slots, old_to_new_slots); | 2636 RecordMigratedSlotVisitor visitor(this, old_to_old_slots, old_to_new_slots); |
2634 dst->IterateBody(&visitor); | 2637 dst->IterateBody(&visitor); |
2635 } else if (dest == CODE_SPACE) { | 2638 } else if (dest == CODE_SPACE) { |
2636 DCHECK_CODEOBJECT_SIZE(size, heap()->code_space()); | 2639 DCHECK_CODEOBJECT_SIZE(size, heap()->code_space()); |
2637 PROFILE(isolate(), CodeMoveEvent(src_addr, dst_addr)); | 2640 PROFILE(isolate(), CodeMoveEvent(AbstractCode::cast(src), dst_addr)); |
2638 heap()->MoveBlock(dst_addr, src_addr, size); | 2641 heap()->MoveBlock(dst_addr, src_addr, size); |
2639 old_to_old_slots->Record(RELOCATED_CODE_OBJECT, dst_addr); | 2642 old_to_old_slots->Record(RELOCATED_CODE_OBJECT, dst_addr); |
2640 Code::cast(dst)->Relocate(dst_addr - src_addr); | 2643 Code::cast(dst)->Relocate(dst_addr - src_addr); |
2641 } else { | 2644 } else { |
2642 DCHECK_OBJECT_SIZE(size); | 2645 DCHECK_OBJECT_SIZE(size); |
2643 DCHECK(old_to_old_slots == nullptr); | 2646 DCHECK(old_to_old_slots == nullptr); |
2644 DCHECK(dest == NEW_SPACE); | 2647 DCHECK(dest == NEW_SPACE); |
2645 heap()->MoveBlock(dst_addr, src_addr, size); | 2648 heap()->MoveBlock(dst_addr, src_addr, size); |
2646 } | 2649 } |
2647 heap()->OnMoveEvent(dst, src, size); | 2650 heap()->OnMoveEvent(dst, src, size); |
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3869 } | 3872 } |
3870 } | 3873 } |
3871 | 3874 |
3872 | 3875 |
3873 void MarkCompactCollector::ParallelSweepSpacesComplete() { | 3876 void MarkCompactCollector::ParallelSweepSpacesComplete() { |
3874 sweeping_list(heap()->old_space()).clear(); | 3877 sweeping_list(heap()->old_space()).clear(); |
3875 sweeping_list(heap()->code_space()).clear(); | 3878 sweeping_list(heap()->code_space()).clear(); |
3876 sweeping_list(heap()->map_space()).clear(); | 3879 sweeping_list(heap()->map_space()).clear(); |
3877 } | 3880 } |
3878 | 3881 |
3879 | |
3880 // TODO(1466) ReportDeleteIfNeeded is not called currently. | |
3881 // Our profiling tools do not expect intersections between | |
3882 // code objects. We should either reenable it or change our tools. | |
3883 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj, | |
3884 Isolate* isolate) { | |
3885 if (obj->IsCode()) { | |
3886 PROFILE(isolate, CodeDeleteEvent(obj->address())); | |
3887 } | |
3888 } | |
3889 | |
3890 | |
3891 Isolate* MarkCompactCollector::isolate() const { return heap_->isolate(); } | 3882 Isolate* MarkCompactCollector::isolate() const { return heap_->isolate(); } |
3892 | 3883 |
3893 | 3884 |
3894 void MarkCompactCollector::Initialize() { | 3885 void MarkCompactCollector::Initialize() { |
3895 MarkCompactMarkingVisitor::Initialize(); | 3886 MarkCompactMarkingVisitor::Initialize(); |
3896 IncrementalMarking::Initialize(); | 3887 IncrementalMarking::Initialize(); |
3897 } | 3888 } |
3898 | 3889 |
3899 void MarkCompactCollector::RecordCodeEntrySlot(HeapObject* host, Address slot, | 3890 void MarkCompactCollector::RecordCodeEntrySlot(HeapObject* host, Address slot, |
3900 Code* target) { | 3891 Code* target) { |
(...skipping 15 matching lines...) Expand all Loading... |
3916 MarkBit mark_bit = Marking::MarkBitFrom(host); | 3907 MarkBit mark_bit = Marking::MarkBitFrom(host); |
3917 if (Marking::IsBlack(mark_bit)) { | 3908 if (Marking::IsBlack(mark_bit)) { |
3918 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 3909 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
3919 RecordRelocSlot(host, &rinfo, target); | 3910 RecordRelocSlot(host, &rinfo, target); |
3920 } | 3911 } |
3921 } | 3912 } |
3922 } | 3913 } |
3923 | 3914 |
3924 } // namespace internal | 3915 } // namespace internal |
3925 } // namespace v8 | 3916 } // namespace v8 |
OLD | NEW |