Index: src/ic-inl.h |
diff --git a/src/ic-inl.h b/src/ic-inl.h |
index 6a86921a415759c40ee0eaf60ed882b62c1981be..779dfcdf4dcde5ac3ce97d584422af58968e157c 100644 |
--- a/src/ic-inl.h |
+++ b/src/ic-inl.h |
@@ -79,6 +79,7 @@ Code* IC::GetTargetAtAddress(Address address) { |
void IC::SetTargetAtAddress(Address address, Code* target) { |
ASSERT(target->is_inline_cache_stub() || target->is_compare_ic_stub()); |
+ Heap* heap = target->GetHeap(); |
Code* old_target = GetTargetAtAddress(address); |
#ifdef DEBUG |
// STORE_IC and KEYED_STORE_IC use Code::extra_ic_state() to mark |
@@ -90,8 +91,15 @@ void IC::SetTargetAtAddress(Address address, Code* target) { |
} |
#endif |
Assembler::set_target_address_at(address, target->instruction_start()); |
- target->GetHeap()->incremental_marking()->RecordCodeTargetPatch(address, |
- target); |
+ 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); |
+ } else { |
+ heap->incremental_marking()->RecordCodeTargetPatch(address, target); |
+ } |
PostPatching(address, target, old_target); |
} |