Revision: 9585
Author:   [email protected]
Date:     Tue Oct 11 09:50:58 2011
Log:      Fix free list node ending up on evacuation candidate.

This is a temporary fix which avoids compaction when incremental marking
is restarted during an old-space-step. That could turn the page that
holds the chosen free list node into an evacuation candidate. It could
also cause several other inconsistencies if it happens during scavenge.

[email protected]

Review URL: http://codereview.chromium.org/8228010
http://code.google.com/p/v8/source/detail?r=9585

Modified:
 /branches/bleeding_edge/src/incremental-marking.cc
 /branches/bleeding_edge/src/incremental-marking.h
 /branches/bleeding_edge/src/spaces.cc

=======================================
--- /branches/bleeding_edge/src/incremental-marking.cc Tue Oct 11 08:52:15 2011 +++ /branches/bleeding_edge/src/incremental-marking.cc Tue Oct 11 09:50:58 2011
@@ -411,7 +411,7 @@

   if (heap_->old_pointer_space()->IsSweepingComplete() &&
       heap_->old_data_space()->IsSweepingComplete()) {
-    StartMarking();
+    StartMarking(ALLOW_COMPACTION);
   } else {
     if (FLAG_trace_incremental_marking) {
       PrintF("[IncrementalMarking] Start sweeping.\n");
@@ -436,12 +436,12 @@
 }


-void IncrementalMarking::StartMarking() {
+void IncrementalMarking::StartMarking(CompactionFlag flag) {
   if (FLAG_trace_incremental_marking) {
     PrintF("[IncrementalMarking] Start marking\n");
   }

-  is_compacting_ = !FLAG_never_compact &&
+  is_compacting_ = !FLAG_never_compact && (flag == ALLOW_COMPACTION) &&
       heap_->mark_compact_collector()->StartCompaction();

   state_ = MARKING;
@@ -705,7 +705,7 @@
   if (state_ == SWEEPING) {
     if (heap_->old_pointer_space()->AdvanceSweeper(bytes_to_process) &&
         heap_->old_data_space()->AdvanceSweeper(bytes_to_process)) {
-      StartMarking();
+      StartMarking(PREVENT_COMPACTION);
     }
   } else if (state_ == MARKING) {
     Map* filler_map = heap_->one_pointer_filler_map();
=======================================
--- /branches/bleeding_edge/src/incremental-marking.h Wed Sep 28 10:45:58 2011 +++ /branches/bleeding_edge/src/incremental-marking.h Tue Oct 11 09:50:58 2011
@@ -206,7 +206,9 @@

   void ResetStepCounters();

-  void StartMarking();
+  enum CompactionFlag { ALLOW_COMPACTION, PREVENT_COMPACTION };
+
+  void StartMarking(CompactionFlag flag);

   void ActivateIncrementalWriteBarrier(PagedSpace* space);
   static void ActivateIncrementalWriteBarrier(NewSpace* space);
=======================================
--- /branches/bleeding_edge/src/spaces.cc       Thu Sep 29 06:36:34 2011
+++ /branches/bleeding_edge/src/spaces.cc       Tue Oct 11 09:50:58 2011
@@ -1798,6 +1798,11 @@
   owner_->heap()->incremental_marking()->OldSpaceStep(
       size_in_bytes - old_linear_size);

+  // The old-space-step might have finished sweeping and restarted marking.
+ // Verify that it did not turn the page of the new node into an evacuation
+  // candidate.
+  ASSERT(!MarkCompactCollector::IsOnEvacuationCandidate(new_node));
+
   const int kThreshold = IncrementalMarking::kAllocatedThreshold;

// Memory in the linear allocation area is counted as allocated. We may free

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

Reply via email to