Disable short-circuiting of cons-strings when compaction is pending.
authorvegorov@chromium.org <vegorov@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 10 Oct 2011 10:35:08 +0000 (10:35 +0000)
committervegorov@chromium.org <vegorov@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 10 Oct 2011 10:35:08 +0000 (10:35 +0000)
Otherwise fast path of scavenger gets a bit too complicated and heavy.

R=mstarzinger@chromium.org

Review URL: http://codereview.chromium.org/8217002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9561 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/heap.cc
src/objects-visiting.h

index b40b820..d90c54c 100644 (file)
@@ -1662,6 +1662,17 @@ void Heap::SelectScavengingVisitorsTable() {
           ScavengingVisitor<TRANSFER_MARKS,
                             LOGGING_AND_PROFILING_ENABLED>::GetTable());
     }
+
+    if (incremental_marking()->IsCompacting()) {
+      // When compacting forbid short-circuiting of cons-strings.
+      // Scavenging code relies on the fact that new space object
+      // can't be evacuated into evacuation candidate but
+      // short-circuiting violates this assumption.
+      scavenging_visitors_table_.Register(
+          StaticVisitorBase::kVisitShortcutCandidate,
+          scavenging_visitors_table_.GetVisitorById(
+              StaticVisitorBase::kVisitConsString));
+    }
   }
 }
 
index b8b1a25..e6ddfed 100644 (file)
@@ -157,6 +157,10 @@ class VisitorDispatchTable {
     }
   }
 
+  inline Callback GetVisitorById(StaticVisitorBase::VisitorId id) {
+    return reinterpret_cast<Callback>(callbacks_[id]);
+  }
+
   inline Callback GetVisitor(Map* map) {
     return reinterpret_cast<Callback>(callbacks_[map->visitor_id()]);
   }