Chromium Code Reviews| 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 2610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2621 LocalSlotsBuffer* old_to_new_slots) { | 2621 LocalSlotsBuffer* old_to_new_slots) { |
| 2622 Address dst_addr = dst->address(); | 2622 Address dst_addr = dst->address(); |
| 2623 Address src_addr = src->address(); | 2623 Address src_addr = src->address(); |
| 2624 DCHECK(heap()->AllowedToBeMigrated(src, dest)); | 2624 DCHECK(heap()->AllowedToBeMigrated(src, dest)); |
| 2625 DCHECK(dest != LO_SPACE); | 2625 DCHECK(dest != LO_SPACE); |
| 2626 if (dest == OLD_SPACE) { | 2626 if (dest == OLD_SPACE) { |
| 2627 DCHECK_OBJECT_SIZE(size); | 2627 DCHECK_OBJECT_SIZE(size); |
| 2628 DCHECK(IsAligned(size, kPointerSize)); | 2628 DCHECK(IsAligned(size, kPointerSize)); |
| 2629 | 2629 |
| 2630 heap()->MoveBlock(dst->address(), src->address(), size); | 2630 heap()->MoveBlock(dst->address(), src->address(), size); |
| 2631 if (FLAG_ignition && dst->IsBytecodeArray()) { | |
| 2632 PROFILE(isolate(), CodeMoveEvent(AbstractCode::cast(src), dst_addr)); | |
| 2633 } | |
| 2631 RecordMigratedSlotVisitor visitor(this, old_to_old_slots, old_to_new_slots); | 2634 RecordMigratedSlotVisitor visitor(this, old_to_old_slots, old_to_new_slots); |
| 2632 dst->IterateBody(&visitor); | 2635 dst->IterateBody(&visitor); |
| 2633 } else if (dest == CODE_SPACE) { | 2636 } else if (dest == CODE_SPACE) { |
| 2634 DCHECK_CODEOBJECT_SIZE(size, heap()->code_space()); | 2637 DCHECK_CODEOBJECT_SIZE(size, heap()->code_space()); |
| 2635 PROFILE(isolate(), CodeMoveEvent(src_addr, dst_addr)); | 2638 PROFILE(isolate(), CodeMoveEvent(AbstractCode::cast(src), dst_addr)); |
| 2636 heap()->MoveBlock(dst_addr, src_addr, size); | 2639 heap()->MoveBlock(dst_addr, src_addr, size); |
| 2637 old_to_old_slots->Record(RELOCATED_CODE_OBJECT, dst_addr); | 2640 old_to_old_slots->Record(RELOCATED_CODE_OBJECT, dst_addr); |
| 2638 Code::cast(dst)->Relocate(dst_addr - src_addr); | 2641 Code::cast(dst)->Relocate(dst_addr - src_addr); |
| 2639 } else { | 2642 } else { |
| 2640 DCHECK_OBJECT_SIZE(size); | 2643 DCHECK_OBJECT_SIZE(size); |
| 2641 DCHECK(old_to_old_slots == nullptr); | 2644 DCHECK(old_to_old_slots == nullptr); |
| 2642 DCHECK(dest == NEW_SPACE); | 2645 DCHECK(dest == NEW_SPACE); |
| 2643 heap()->MoveBlock(dst_addr, src_addr, size); | 2646 heap()->MoveBlock(dst_addr, src_addr, size); |
| 2644 } | 2647 } |
| 2645 heap()->OnMoveEvent(dst, src, size); | 2648 heap()->OnMoveEvent(dst, src, size); |
| (...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3873 sweeping_list(heap()->code_space()).clear(); | 3876 sweeping_list(heap()->code_space()).clear(); |
| 3874 sweeping_list(heap()->map_space()).clear(); | 3877 sweeping_list(heap()->map_space()).clear(); |
| 3875 } | 3878 } |
| 3876 | 3879 |
| 3877 | 3880 |
| 3878 // TODO(1466) ReportDeleteIfNeeded is not called currently. | 3881 // TODO(1466) ReportDeleteIfNeeded is not called currently. |
| 3879 // Our profiling tools do not expect intersections between | 3882 // Our profiling tools do not expect intersections between |
| 3880 // code objects. We should either reenable it or change our tools. | 3883 // code objects. We should either reenable it or change our tools. |
| 3881 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj, | 3884 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj, |
| 3882 Isolate* isolate) { | 3885 Isolate* isolate) { |
| 3883 if (obj->IsCode()) { | 3886 if (obj->IsCode() && obj->IsBytecodeArray()) { |
|
ulan
2016/02/25 11:03:59
This condition seems to be always false.
Did you m
rmcilroy
2016/02/25 11:46:54
Opps, this should indeed be an '||', updated. This
Yang
2016/02/25 11:50:43
+1
ulan
2016/02/25 12:07:50
I would be fine with deleting the dead code.
rmcilroy
2016/02/25 15:06:54
Dead code removed.
| |
| 3884 PROFILE(isolate, CodeDeleteEvent(obj->address())); | 3887 PROFILE(isolate, CodeDeleteEvent(AbstractCode::cast(obj))); |
| 3885 } | 3888 } |
| 3886 } | 3889 } |
| 3887 | 3890 |
| 3888 | 3891 |
| 3889 Isolate* MarkCompactCollector::isolate() const { return heap_->isolate(); } | 3892 Isolate* MarkCompactCollector::isolate() const { return heap_->isolate(); } |
| 3890 | 3893 |
| 3891 | 3894 |
| 3892 void MarkCompactCollector::Initialize() { | 3895 void MarkCompactCollector::Initialize() { |
| 3893 MarkCompactMarkingVisitor::Initialize(); | 3896 MarkCompactMarkingVisitor::Initialize(); |
| 3894 IncrementalMarking::Initialize(); | 3897 IncrementalMarking::Initialize(); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 3914 MarkBit mark_bit = Marking::MarkBitFrom(host); | 3917 MarkBit mark_bit = Marking::MarkBitFrom(host); |
| 3915 if (Marking::IsBlack(mark_bit)) { | 3918 if (Marking::IsBlack(mark_bit)) { |
| 3916 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 3919 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
| 3917 RecordRelocSlot(host, &rinfo, target); | 3920 RecordRelocSlot(host, &rinfo, target); |
| 3918 } | 3921 } |
| 3919 } | 3922 } |
| 3920 } | 3923 } |
| 3921 | 3924 |
| 3922 } // namespace internal | 3925 } // namespace internal |
| 3923 } // namespace v8 | 3926 } // namespace v8 |
| OLD | NEW |