| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 marking_parity_(ODD_MARKING_PARITY), | 55 marking_parity_(ODD_MARKING_PARITY), |
| 56 was_marked_incrementally_(false), | 56 was_marked_incrementally_(false), |
| 57 evacuation_(false), | 57 evacuation_(false), |
| 58 heap_(heap), | 58 heap_(heap), |
| 59 marking_deque_memory_(NULL), | 59 marking_deque_memory_(NULL), |
| 60 marking_deque_memory_committed_(0), | 60 marking_deque_memory_committed_(0), |
| 61 code_flusher_(nullptr), | 61 code_flusher_(nullptr), |
| 62 have_code_to_deoptimize_(false), | 62 have_code_to_deoptimize_(false), |
| 63 compacting_(false), | 63 compacting_(false), |
| 64 sweeping_in_progress_(false), | 64 sweeping_in_progress_(false), |
| 65 compaction_in_progress_(false), | |
| 66 pending_sweeper_tasks_semaphore_(0), | 65 pending_sweeper_tasks_semaphore_(0), |
| 67 pending_compaction_tasks_semaphore_(0) { | 66 pending_compaction_tasks_semaphore_(0) { |
| 68 } | 67 } |
| 69 | 68 |
| 70 #ifdef VERIFY_HEAP | 69 #ifdef VERIFY_HEAP |
| 71 class VerifyMarkingVisitor : public ObjectVisitor { | 70 class VerifyMarkingVisitor : public ObjectVisitor { |
| 72 public: | 71 public: |
| 73 explicit VerifyMarkingVisitor(Heap* heap) : heap_(heap) {} | 72 explicit VerifyMarkingVisitor(Heap* heap) : heap_(heap) {} |
| 74 | 73 |
| 75 void VisitPointers(Object** start, Object** end) override { | 74 void VisitPointers(Object** start, Object** end) override { |
| (...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2505 } | 2504 } |
| 2506 heap()->set_encountered_transition_arrays(Smi::FromInt(0)); | 2505 heap()->set_encountered_transition_arrays(Smi::FromInt(0)); |
| 2507 } | 2506 } |
| 2508 | 2507 |
| 2509 void MarkCompactCollector::RecordMigratedSlot( | 2508 void MarkCompactCollector::RecordMigratedSlot( |
| 2510 Object* value, Address slot, LocalSlotsBuffer* old_to_old_slots, | 2509 Object* value, Address slot, LocalSlotsBuffer* old_to_old_slots, |
| 2511 LocalSlotsBuffer* old_to_new_slots) { | 2510 LocalSlotsBuffer* old_to_new_slots) { |
| 2512 // When parallel compaction is in progress, store and slots buffer entries | 2511 // When parallel compaction is in progress, store and slots buffer entries |
| 2513 // require synchronization. | 2512 // require synchronization. |
| 2514 if (heap_->InNewSpace(value)) { | 2513 if (heap_->InNewSpace(value)) { |
| 2515 if (compaction_in_progress_) { | 2514 old_to_new_slots->Record(slot); |
| 2516 old_to_new_slots->Record(slot); | |
| 2517 } else { | |
| 2518 Page* page = Page::FromAddress(slot); | |
| 2519 RememberedSet<OLD_TO_NEW>::Insert(page, slot); | |
| 2520 } | |
| 2521 } else if (value->IsHeapObject() && IsOnEvacuationCandidate(value)) { | 2515 } else if (value->IsHeapObject() && IsOnEvacuationCandidate(value)) { |
| 2522 old_to_old_slots->Record(slot); | 2516 old_to_old_slots->Record(slot); |
| 2523 } | 2517 } |
| 2524 } | 2518 } |
| 2525 | 2519 |
| 2526 static inline SlotType SlotTypeForRMode(RelocInfo::Mode rmode) { | 2520 static inline SlotType SlotTypeForRMode(RelocInfo::Mode rmode) { |
| 2527 if (RelocInfo::IsCodeTarget(rmode)) { | 2521 if (RelocInfo::IsCodeTarget(rmode)) { |
| 2528 return CODE_TARGET_SLOT; | 2522 return CODE_TARGET_SLOT; |
| 2529 } else if (RelocInfo::IsCell(rmode)) { | 2523 } else if (RelocInfo::IsCell(rmode)) { |
| 2530 return CELL_TARGET_SLOT; | 2524 return CELL_TARGET_SLOT; |
| (...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3859 MarkBit mark_bit = Marking::MarkBitFrom(host); | 3853 MarkBit mark_bit = Marking::MarkBitFrom(host); |
| 3860 if (Marking::IsBlack(mark_bit)) { | 3854 if (Marking::IsBlack(mark_bit)) { |
| 3861 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 3855 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
| 3862 RecordRelocSlot(host, &rinfo, target); | 3856 RecordRelocSlot(host, &rinfo, target); |
| 3863 } | 3857 } |
| 3864 } | 3858 } |
| 3865 } | 3859 } |
| 3866 | 3860 |
| 3867 } // namespace internal | 3861 } // namespace internal |
| 3868 } // namespace v8 | 3862 } // namespace v8 |
| OLD | NEW |