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/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2574 SlotsBuffer::IGNORE_OVERFLOW); | 2574 SlotsBuffer::IGNORE_OVERFLOW); |
2575 } else { | 2575 } else { |
2576 SlotsBuffer::AddTo(slots_buffer_allocator_, &migration_slots_buffer_, | 2576 SlotsBuffer::AddTo(slots_buffer_allocator_, &migration_slots_buffer_, |
2577 reinterpret_cast<Object**>(slot), | 2577 reinterpret_cast<Object**>(slot), |
2578 SlotsBuffer::IGNORE_OVERFLOW); | 2578 SlotsBuffer::IGNORE_OVERFLOW); |
2579 } | 2579 } |
2580 } | 2580 } |
2581 } | 2581 } |
2582 | 2582 |
2583 | 2583 |
2584 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, | |
2585 Object* target) { | |
2586 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | |
2587 if (target_page->IsEvacuationCandidate() && | |
2588 !ShouldSkipEvacuationSlotRecording(object)) { | |
2589 if (!SlotsBuffer::AddTo(slots_buffer_allocator_, | |
2590 target_page->slots_buffer_address(), slot, | |
2591 SlotsBuffer::FAIL_ON_OVERFLOW)) { | |
2592 EvictPopularEvacuationCandidate(target_page); | |
2593 } | |
2594 } | |
2595 } | |
2596 | |
2597 | |
2598 void MarkCompactCollector::ForceRecordSlot(HeapObject* object, Object** slot, | |
2599 Object* target) { | |
2600 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | |
2601 if (target_page->IsEvacuationCandidate() && | |
2602 !ShouldSkipEvacuationSlotRecording(object)) { | |
2603 CHECK(SlotsBuffer::AddTo(slots_buffer_allocator_, | |
2604 target_page->slots_buffer_address(), slot, | |
2605 SlotsBuffer::IGNORE_OVERFLOW)); | |
2606 } | |
2607 } | |
2608 | |
2609 | |
2610 void MarkCompactCollector::RecordMigratedCodeEntrySlot( | 2584 void MarkCompactCollector::RecordMigratedCodeEntrySlot( |
2611 Address code_entry, Address code_entry_slot) { | 2585 Address code_entry, Address code_entry_slot) { |
2612 if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) { | 2586 if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) { |
2613 if (parallel_compaction_in_progress_) { | 2587 if (parallel_compaction_in_progress_) { |
2614 SlotsBuffer::AddToSynchronized( | 2588 SlotsBuffer::AddToSynchronized( |
2615 slots_buffer_allocator_, &migration_slots_buffer_, | 2589 slots_buffer_allocator_, &migration_slots_buffer_, |
2616 &migration_slots_buffer_mutex_, SlotsBuffer::CODE_ENTRY_SLOT, | 2590 &migration_slots_buffer_mutex_, SlotsBuffer::CODE_ENTRY_SLOT, |
2617 code_entry_slot, SlotsBuffer::IGNORE_OVERFLOW); | 2591 code_entry_slot, SlotsBuffer::IGNORE_OVERFLOW); |
2618 } else { | 2592 } else { |
2619 SlotsBuffer::AddTo(slots_buffer_allocator_, &migration_slots_buffer_, | 2593 SlotsBuffer::AddTo(slots_buffer_allocator_, &migration_slots_buffer_, |
(...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4516 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4490 MarkBit mark_bit = Marking::MarkBitFrom(host); |
4517 if (Marking::IsBlack(mark_bit)) { | 4491 if (Marking::IsBlack(mark_bit)) { |
4518 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); | 4492 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); |
4519 RecordRelocSlot(&rinfo, target); | 4493 RecordRelocSlot(&rinfo, target); |
4520 } | 4494 } |
4521 } | 4495 } |
4522 } | 4496 } |
4523 | 4497 |
4524 } // namespace internal | 4498 } // namespace internal |
4525 } // namespace v8 | 4499 } // namespace v8 |
OLD | NEW |