This makes sure that we only record relocation slots for code target
patches that happen in marked objects. Unmarked ones might be visited
again, whereas marked ones are alive and will not be visited again.
R=ulan@chromium.org
BUG=chromium:152615,chromium:144230
Review URL: https://codereview.chromium.org/
11040021
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12655
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
}
#endif
Assembler::set_target_address_at(address, target->instruction_start());
- if (heap->gc_state() == Heap::MARK_COMPACT &&
- heap->mark_compact_collector()->is_compacting()) {
- Code* host = heap->isolate()->inner_pointer_to_code_cache()->
- GcSafeFindCodeForInnerPointer(address);
- RelocInfo rinfo(address, RelocInfo::CODE_TARGET, 0, host);
- heap->mark_compact_collector()->RecordRelocSlot(&rinfo, target);
+ if (heap->gc_state() == Heap::MARK_COMPACT) {
+ heap->mark_compact_collector()->RecordCodeTargetPatch(address, target);
} else {
heap->incremental_marking()->RecordCodeTargetPatch(address, target);
}
}
+void MarkCompactCollector::RecordCodeTargetPatch(Address pc, Code* target) {
+ ASSERT(heap()->gc_state() == Heap::MARK_COMPACT);
+ if (is_compacting()) {
+ Code* host = heap()->isolate()->inner_pointer_to_code_cache()->
+ GcSafeFindCodeForInnerPointer(pc);
+ MarkBit mark_bit = Marking::MarkBitFrom(host);
+ if (Marking::IsBlack(mark_bit)) {
+ RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host);
+ RecordRelocSlot(&rinfo, target);
+ }
+ }
+}
+
+
static inline SlotsBuffer::SlotType DecodeSlotType(
SlotsBuffer::ObjectSlot slot) {
return static_cast<SlotsBuffer::SlotType>(reinterpret_cast<intptr_t>(slot));
void RecordRelocSlot(RelocInfo* rinfo, Object* target);
void RecordCodeEntrySlot(Address slot, Code* target);
+ void RecordCodeTargetPatch(Address pc, Code* target);
INLINE(void RecordSlot(Object** anchor_slot, Object** slot, Object* object));