Fix slot recording of code target patches.

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
parent 64cc601e
......@@ -91,12 +91,8 @@ void IC::SetTargetAtAddress(Address address, Code* target) {
}
#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);
}
......
......@@ -4079,6 +4079,20 @@ void MarkCompactCollector::RecordCodeEntrySlot(Address slot, Code* 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));
......
......@@ -574,6 +574,7 @@ class MarkCompactCollector {
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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment