Revision: 21934
Author:   [email protected]
Date:     Mon Jun 23 12:18:13 2014 UTC
Log: Special case ConstantPoolArray in MarkCompactCollector::MigrateObject.

Special case the ConstantPoolArray in MarkCompactCollector::MigrateObject since it could contain
integer value entires which look like tagged pointers.

[email protected], [email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Mon Jun 23 08:50:54 2014 UTC
+++ /branches/bleeding_edge/src/mark-compact.cc Mon Jun 23 12:18:13 2014 UTC
@@ -2788,6 +2788,19 @@
 }


+void MarkCompactCollector::RecordMigratedSlot(Object* value, Address slot) {
+  if (heap_->InNewSpace(value)) {
+    heap_->store_buffer()->Mark(slot);
+  } else if (value->IsHeapObject() && IsOnEvacuationCandidate(value)) {
+    SlotsBuffer::AddTo(&slots_buffer_allocator_,
+                       &migration_slots_buffer_,
+                       reinterpret_cast<Object**>(slot),
+                       SlotsBuffer::IGNORE_OVERFLOW);
+  }
+}
+
+
+
 // We scavange new space simultaneously with sweeping. This is done in two
 // passes.
 //
@@ -2820,13 +2833,11 @@

       Memory::Object_at(dst_slot) = value;

-      if (heap_->InNewSpace(value)) {
-        heap_->store_buffer()->Mark(dst_slot);
-      } else if (value->IsHeapObject() && IsOnEvacuationCandidate(value)) {
-        SlotsBuffer::AddTo(&slots_buffer_allocator_,
-                           &migration_slots_buffer_,
-                           reinterpret_cast<Object**>(dst_slot),
-                           SlotsBuffer::IGNORE_OVERFLOW);
+      // We special case ConstantPoolArrays below since they could contain
+      // integers value entries which look like tagged pointers.
+ // TODO(mstarzinger): restructure this code to avoid this special-casing.
+      if (!src->IsConstantPoolArray()) {
+        RecordMigratedSlot(value, dst_slot);
       }

       src_slot += kPointerSize;
@@ -2844,7 +2855,7 @@
                            code_entry_slot,
                            SlotsBuffer::IGNORE_OVERFLOW);
       }
-    } else if (compacting_ && dst->IsConstantPoolArray()) {
+    } else if (dst->IsConstantPoolArray()) {
       ConstantPoolArray* array = ConstantPoolArray::cast(dst);
ConstantPoolArray::Iterator code_iter(array, ConstantPoolArray::CODE_PTR);
       while (!code_iter.is_finished()) {
@@ -2860,6 +2871,13 @@
                              SlotsBuffer::IGNORE_OVERFLOW);
         }
       }
+ ConstantPoolArray::Iterator heap_iter(array, ConstantPoolArray::HEAP_PTR);
+      while (!heap_iter.is_finished()) {
+        Address heap_slot =
+            dst_addr + array->OffsetOfElementAt(heap_iter.next_index());
+        Object* value = Memory::Object_at(heap_slot);
+        RecordMigratedSlot(value, heap_slot);
+      }
     }
   } else if (dest == CODE_SPACE) {
     PROFILE(isolate(), CodeMoveEvent(src_addr, dst_addr));
=======================================
--- /branches/bleeding_edge/src/mark-compact.h  Mon Jun 23 08:50:54 2014 UTC
+++ /branches/bleeding_edge/src/mark-compact.h  Mon Jun 23 12:18:13 2014 UTC
@@ -895,6 +895,9 @@

   void ParallelSweepSpaceComplete(PagedSpace* space);

+ // Updates store buffer and slot buffer for a pointer in a migrating object.
+  void RecordMigratedSlot(Object* value, Address slot);
+
 #ifdef DEBUG
   friend class MarkObjectVisitor;
   static void VisitObject(HeapObject* obj);

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to