Revision: 12655
Author:   [email protected]
Date:     Tue Oct  2 08:46:55 2012
Log:      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.

[email protected]
BUG=chromium:152615,chromium:144230

Review URL: https://codereview.chromium.org/11040021
http://code.google.com/p/v8/source/detail?r=12655

Modified:
 /branches/bleeding_edge/src/ic-inl.h
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/src/mark-compact.h

=======================================
--- /branches/bleeding_edge/src/ic-inl.h        Thu Sep 20 03:45:38 2012
+++ /branches/bleeding_edge/src/ic-inl.h        Tue Oct  2 08:46:55 2012
@@ -91,12 +91,8 @@
   }
 #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);
   }
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Wed Sep 26 05:17:24 2012
+++ /branches/bleeding_edge/src/mark-compact.cc Tue Oct  2 08:46:55 2012
@@ -4077,6 +4077,20 @@
     }
   }
 }
+
+
+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(
=======================================
--- /branches/bleeding_edge/src/mark-compact.h  Wed Sep 26 05:17:24 2012
+++ /branches/bleeding_edge/src/mark-compact.h  Tue Oct  2 08:46:55 2012
@@ -574,6 +574,7 @@

   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));

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to