| 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 2677 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2688   Address dst_addr = dst->address(); |  2688   Address dst_addr = dst->address(); | 
|  2689   Address src_addr = src->address(); |  2689   Address src_addr = src->address(); | 
|  2690   DCHECK(heap()->AllowedToBeMigrated(src, dest)); |  2690   DCHECK(heap()->AllowedToBeMigrated(src, dest)); | 
|  2691   DCHECK(dest != LO_SPACE); |  2691   DCHECK(dest != LO_SPACE); | 
|  2692   if (dest == OLD_SPACE) { |  2692   if (dest == OLD_SPACE) { | 
|  2693     DCHECK_OBJECT_SIZE(size); |  2693     DCHECK_OBJECT_SIZE(size); | 
|  2694     DCHECK(evacuation_slots_buffer != nullptr); |  2694     DCHECK(evacuation_slots_buffer != nullptr); | 
|  2695     DCHECK(IsAligned(size, kPointerSize)); |  2695     DCHECK(IsAligned(size, kPointerSize)); | 
|  2696  |  2696  | 
|  2697     heap()->MoveBlock(dst->address(), src->address(), size); |  2697     heap()->MoveBlock(dst->address(), src->address(), size); | 
 |  2698     if (FLAG_ignition && dst->IsBytecodeArray()) { | 
 |  2699       PROFILE(isolate(), CodeMoveEvent(AbstractCode::cast(src), dst_addr)); | 
 |  2700     } | 
|  2698     RecordMigratedSlotVisitor visitor(this, evacuation_slots_buffer, |  2701     RecordMigratedSlotVisitor visitor(this, evacuation_slots_buffer, | 
|  2699                                       local_store_buffer); |  2702                                       local_store_buffer); | 
|  2700     dst->IterateBody(&visitor); |  2703     dst->IterateBody(&visitor); | 
|  2701   } else if (dest == CODE_SPACE) { |  2704   } else if (dest == CODE_SPACE) { | 
|  2702     DCHECK_CODEOBJECT_SIZE(size, heap()->code_space()); |  2705     DCHECK_CODEOBJECT_SIZE(size, heap()->code_space()); | 
|  2703     DCHECK(evacuation_slots_buffer != nullptr); |  2706     DCHECK(evacuation_slots_buffer != nullptr); | 
|  2704     PROFILE(isolate(), CodeMoveEvent(src_addr, dst_addr)); |  2707     PROFILE(isolate(), CodeMoveEvent(AbstractCode::cast(src), dst_addr)); | 
|  2705     heap()->MoveBlock(dst_addr, src_addr, size); |  2708     heap()->MoveBlock(dst_addr, src_addr, size); | 
|  2706     RecordMigratedCodeObjectSlot(dst_addr, evacuation_slots_buffer); |  2709     RecordMigratedCodeObjectSlot(dst_addr, evacuation_slots_buffer); | 
|  2707     Code::cast(dst)->Relocate(dst_addr - src_addr); |  2710     Code::cast(dst)->Relocate(dst_addr - src_addr); | 
|  2708   } else { |  2711   } else { | 
|  2709     DCHECK_OBJECT_SIZE(size); |  2712     DCHECK_OBJECT_SIZE(size); | 
|  2710     DCHECK(evacuation_slots_buffer == nullptr); |  2713     DCHECK(evacuation_slots_buffer == nullptr); | 
|  2711     DCHECK(dest == NEW_SPACE); |  2714     DCHECK(dest == NEW_SPACE); | 
|  2712     heap()->MoveBlock(dst_addr, src_addr, size); |  2715     heap()->MoveBlock(dst_addr, src_addr, size); | 
|  2713   } |  2716   } | 
|  2714   heap()->OnMoveEvent(dst, src, size); |  2717   heap()->OnMoveEvent(dst, src, size); | 
| (...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3992   } |  3995   } | 
|  3993 } |  3996 } | 
|  3994  |  3997  | 
|  3995  |  3998  | 
|  3996 void MarkCompactCollector::ParallelSweepSpacesComplete() { |  3999 void MarkCompactCollector::ParallelSweepSpacesComplete() { | 
|  3997   sweeping_list(heap()->old_space()).clear(); |  4000   sweeping_list(heap()->old_space()).clear(); | 
|  3998   sweeping_list(heap()->code_space()).clear(); |  4001   sweeping_list(heap()->code_space()).clear(); | 
|  3999   sweeping_list(heap()->map_space()).clear(); |  4002   sweeping_list(heap()->map_space()).clear(); | 
|  4000 } |  4003 } | 
|  4001  |  4004  | 
|  4002  |  | 
|  4003 // TODO(1466) ReportDeleteIfNeeded is not called currently. |  | 
|  4004 // Our profiling tools do not expect intersections between |  | 
|  4005 // code objects. We should either reenable it or change our tools. |  | 
|  4006 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj, |  | 
|  4007                                                 Isolate* isolate) { |  | 
|  4008   if (obj->IsCode()) { |  | 
|  4009     PROFILE(isolate, CodeDeleteEvent(obj->address())); |  | 
|  4010   } |  | 
|  4011 } |  | 
|  4012  |  | 
|  4013  |  | 
|  4014 Isolate* MarkCompactCollector::isolate() const { return heap_->isolate(); } |  4005 Isolate* MarkCompactCollector::isolate() const { return heap_->isolate(); } | 
|  4015  |  4006  | 
|  4016  |  4007  | 
|  4017 void MarkCompactCollector::Initialize() { |  4008 void MarkCompactCollector::Initialize() { | 
|  4018   MarkCompactMarkingVisitor::Initialize(); |  4009   MarkCompactMarkingVisitor::Initialize(); | 
|  4019   IncrementalMarking::Initialize(); |  4010   IncrementalMarking::Initialize(); | 
|  4020 } |  4011 } | 
|  4021  |  4012  | 
|  4022  |  4013  | 
|  4023 void MarkCompactCollector::EvictPopularEvacuationCandidate(Page* page) { |  4014 void MarkCompactCollector::EvictPopularEvacuationCandidate(Page* page) { | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4067     MarkBit mark_bit = Marking::MarkBitFrom(host); |  4058     MarkBit mark_bit = Marking::MarkBitFrom(host); | 
|  4068     if (Marking::IsBlack(mark_bit)) { |  4059     if (Marking::IsBlack(mark_bit)) { | 
|  4069       RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |  4060       RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 
|  4070       RecordRelocSlot(&rinfo, target); |  4061       RecordRelocSlot(&rinfo, target); | 
|  4071     } |  4062     } | 
|  4072   } |  4063   } | 
|  4073 } |  4064 } | 
|  4074  |  4065  | 
|  4075 }  // namespace internal |  4066 }  // namespace internal | 
|  4076 }  // namespace v8 |  4067 }  // namespace v8 | 
| OLD | NEW |