Revision: 22270
Author:   [email protected]
Date:     Tue Jul  8 08:44:45 2014 UTC
Log: Reland "Precisely sweep scan on scavenge pages and use heap iterator to iterate over them."

BUG=
[email protected]

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

Modified:
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/spaces.cc
 /branches/bleeding_edge/src/store-buffer.cc

=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Wed Jul  2 13:00:36 2014 UTC
+++ /branches/bleeding_edge/src/mark-compact.cc Tue Jul  8 08:44:45 2014 UTC
@@ -4146,12 +4146,23 @@
           pages_swept++;
           parallel_sweeping_active = true;
         } else {
-          if (FLAG_gc_verbose) {
- PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n",
-                   reinterpret_cast<intptr_t>(p));
+          if (p->scan_on_scavenge()) {
+ SweepPrecisely<SWEEP_ONLY, IGNORE_SKIP_LIST, IGNORE_FREE_SPACE>(
+                space, p, NULL);
+            pages_swept++;
+            if (FLAG_gc_verbose) {
+              PrintF("Sweeping 0x%" V8PRIxPTR
+                  " scan on scavenge page precisely.\n",
+                  reinterpret_cast<intptr_t>(p));
+            }
+          } else {
+            if (FLAG_gc_verbose) {
+ PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n",
+                  reinterpret_cast<intptr_t>(p));
+            }
+ p->set_parallel_sweeping(MemoryChunk::PARALLEL_SWEEPING_PENDING);
+            space->IncreaseUnsweptFreeBytes(p);
           }
-          p->set_parallel_sweeping(MemoryChunk::PARALLEL_SWEEPING_PENDING);
-          space->IncreaseUnsweptFreeBytes(p);
         }
         space->set_end_of_unswept_pages(p);
         break;
=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Mon Jul  7 09:57:29 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h   Tue Jul  8 08:44:45 2014 UTC
@@ -1478,6 +1478,22 @@
 int HeapObject::Size() {
   return SizeFromMap(map());
 }
+
+
+bool HeapObject::ContainsPointers() {
+  InstanceType type = map()->instance_type();
+  if (type <= LAST_NAME_TYPE) {
+    if (type == SYMBOL_TYPE) {
+      return true;
+    }
+    ASSERT(type < FIRST_NONSTRING_TYPE);
+    // There are four string representations: sequential strings, external
+    // strings, cons strings, and sliced strings.
+    // Only the latter two contain non-map-word pointers to heap objects.
+    return ((type & kIsIndirectStringMask) == kIsIndirectStringTag);
+  }
+  return (type > LAST_DATA_TYPE);
+}


 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) {
=======================================
--- /branches/bleeding_edge/src/objects.h       Tue Jul  8 08:43:20 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Tue Jul  8 08:44:45 2014 UTC
@@ -714,6 +714,7 @@
   FIXED_UINT8_CLAMPED_ARRAY_TYPE,  // LAST_FIXED_TYPED_ARRAY_TYPE

   FIXED_DOUBLE_ARRAY_TYPE,
+  CONSTANT_POOL_ARRAY_TYPE,
   FILLER_TYPE,  // LAST_DATA_TYPE

   // Structs.
@@ -740,7 +741,6 @@
   BREAK_POINT_INFO_TYPE,

   FIXED_ARRAY_TYPE,
-  CONSTANT_POOL_ARRAY_TYPE,
   SHARED_FUNCTION_INFO_TYPE,

// All the following types are subtypes of JSReceiver, which corresponds to
@@ -1716,6 +1716,10 @@
   // Returns the heap object's size in bytes
   inline int Size();

+  // Returns true if this heap object contains only references to other
+  // heap objects.
+  inline bool ContainsPointers();
+
   // Given a heap object's map pointer, returns the heap size in bytes
   // Useful when the map pointer field is used for other purposes.
   // GC internal.
=======================================
--- /branches/bleeding_edge/src/spaces.cc       Mon Jul  7 09:57:29 2014 UTC
+++ /branches/bleeding_edge/src/spaces.cc       Tue Jul  8 08:44:45 2014 UTC
@@ -18,6 +18,9 @@
 // HeapObjectIterator

 HeapObjectIterator::HeapObjectIterator(PagedSpace* space) {
+  // Check that we actually can iterate this space.
+  ASSERT(space->is_iterable());
+
// You can't actually iterate over the anchor page. It is not a real page, // just an anchor for the double linked page list. Initialize as if we have // reached the end of the anchor page, then the first iteration will move on
@@ -32,6 +35,9 @@

 HeapObjectIterator::HeapObjectIterator(PagedSpace* space,
                                        HeapObjectCallback size_func) {
+  // Check that we actually can iterate this space.
+  ASSERT(space->is_iterable());
+
// You can't actually iterate over the anchor page. It is not a real page, // just an anchor for the double linked page list. Initialize the current
   // address and end as NULL, then the first iteration will move on
@@ -66,9 +72,6 @@
                                     Address cur, Address end,
                                     HeapObjectIterator::PageMode mode,
                                     HeapObjectCallback size_f) {
-  // Check that we actually can iterate this space.
-  ASSERT(space->is_iterable());
-
   space_ = space;
   cur_addr_ = cur;
   cur_end_ = end;
=======================================
--- /branches/bleeding_edge/src/store-buffer.cc Tue Jul  8 08:20:22 2014 UTC
+++ /branches/bleeding_edge/src/store-buffer.cc Tue Jul  8 08:44:45 2014 UTC
@@ -519,25 +519,22 @@
FindPointersToNewSpaceInRegion(start, end, slot_callback, clear_maps);
         } else {
           Page* page = reinterpret_cast<Page*>(chunk);
-          PagedSpace* owner = reinterpret_cast<PagedSpace*>(page->owner());
-          Address start = page->area_start();
-          Address end = page->area_end();
-          if (owner == heap_->map_space()) {
-            ASSERT(page->WasSweptPrecisely());
-            HeapObjectIterator iterator(page, NULL);
- for (HeapObject* heap_object = iterator.Next(); heap_object != NULL;
-                 heap_object = iterator.Next()) {
-              // We skip free space objects.
-              if (!heap_object->IsFiller()) {
-                FindPointersToNewSpaceInRegion(
-                    heap_object->address() + HeapObject::kHeaderSize,
- heap_object->address() + heap_object->Size(), slot_callback,
-                    clear_maps);
-              }
+          ASSERT(page->owner() == heap_->map_space() ||
+                 page->owner() == heap_->old_pointer_space());
+          CHECK(page->WasSweptPrecisely());
+
+          HeapObjectIterator iterator(page, NULL);
+          for (HeapObject* heap_object = iterator.Next();
+               heap_object != NULL;
+               heap_object = iterator.Next()) {
+            // We iterate over objects that contain pointers only.
+            if (heap_object->ContainsPointers()) {
+              FindPointersToNewSpaceInRegion(
+                  heap_object->address() + HeapObject::kHeaderSize,
+                  heap_object->address() + heap_object->Size(),
+                  slot_callback,
+                  clear_maps);
             }
-          } else {
-            FindPointersToNewSpaceInRegion(
-                start, end, slot_callback, clear_maps);
           }
         }
       }

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