Reviewers: Erik Corry,

Description:
Fix bug in PointersUpdatingVisitor::UpdatePointer.

It was updating the same pointer twice (was using InNewSpace instead of
InFromSpace).

Also make FLAG_never_compact supercede FLAG_always_compact.

[email protected]
BUG=v8:1721


Please review this at http://codereview.chromium.org/8043021/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/flag-definitions.h
  M src/mark-compact.cc


Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 358d67e472fdcd7424d9a5d87a666efab1d45997..654c32271ba5f02b24d77a6bb98f2a5174ba95b9 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -287,8 +287,9 @@ DEFINE_bool(lazy_sweeping, true,
             "Use lazy sweeping for old pointer and data spaces")
 DEFINE_bool(cleanup_caches_in_maps_at_gc, true,
             "Flush code caches in maps during mark compact cycle.")
-DEFINE_bool(never_compact, false,
+DEFINE_bool(never_compact, true,
             "Never perform compaction on full GC - testing only")
+DEFINE_bool(compact_code_space, true, "Compact code space")
 DEFINE_bool(cleanup_code_caches_at_gc, true,
             "Flush inline caches prior to mark compact collection and "
             "flush code caches in maps during mark compact cycle.")
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 54a293685f2875b2a8935b6586b0cfe0788acc18..422d44b307af2d7e4bc444f1e148ec339234808f 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -244,7 +244,10 @@ bool MarkCompactCollector::StartCompaction() {

     CollectEvacuationCandidates(heap()->old_pointer_space());
     CollectEvacuationCandidates(heap()->old_data_space());
-    CollectEvacuationCandidates(heap()->code_space());
+
+    if (FLAG_compact_code_space) {
+      CollectEvacuationCandidates(heap()->code_space());
+    }

     heap()->old_pointer_space()->EvictEvacuationCandidatesFromFreeLists();
     heap()->old_data_space()->EvictEvacuationCandidatesFromFreeLists();
@@ -480,7 +483,7 @@ void MarkCompactCollector::Prepare(GCTracer* tracer) {
   ASSERT(state_ == IDLE);
   state_ = PREPARE_GC;
 #endif
-  ASSERT(!FLAG_always_compact || !FLAG_never_compact);
+  if (FLAG_never_compact) FLAG_always_compact = false;

   if (collect_maps_) CreateBackPointers();
 #ifdef ENABLE_GDB_JIT_INTERFACE
@@ -2451,11 +2454,13 @@ class PointersUpdatingVisitor: public ObjectVisitor {

     HeapObject* obj = HeapObject::cast(*p);

-    if (heap_->InNewSpace(obj) ||
-        MarkCompactCollector::IsOnEvacuationCandidate(obj)) {
-      ASSERT(obj->map_word().IsForwardingAddress());
+    MapWord map_word = obj->map_word();
+    if (map_word.IsForwardingAddress()) {
+      ASSERT(heap_->InFromSpace(obj) ||
+             MarkCompactCollector::IsOnEvacuationCandidate(obj));
       *p = obj->map_word().ToForwardingAddress();
-      ASSERT(!MarkCompactCollector::IsOnEvacuationCandidate(*p));
+      ASSERT(!heap_->InFromSpace(*p) &&
+             !MarkCompactCollector::IsOnEvacuationCandidate(*p));
     }
   }



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

Reply via email to