Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index 810c5fa9a0f022409722d593f792963a96aa76d4..f6b495a209d840efc735c55e6e47efd570ec3f3d 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -258,6 +258,22 @@ bool MarkCompactCollector::StartCompaction() { |
} |
+void MarkCompactCollector::AbortCompaction() { |
+ if (compacting_) { |
+ int npages = evacuation_candidates_.length(); |
+ for (int i = 0; i < npages; i++) { |
+ Page* p = evacuation_candidates_[i]; |
+ slots_buffer_allocator_.DeallocateChain(p->slots_buffer_address()); |
+ p->ClearEvacuationCandidate(); |
+ p->ClearFlag(MemoryChunk::RESCAN_ON_EVACUATION); |
+ } |
+ compacting_ = false; |
+ evacuation_candidates_.Rewind(0); |
+ } |
+ ASSERT_EQ(0, evacuation_candidates_.length()); |
+} |
+ |
+ |
void MarkCompactCollector::CollectGarbage() { |
// Make sure that Prepare() has been called. The individual steps below will |
// update the state as they proceed. |
@@ -478,6 +494,7 @@ void MarkCompactCollector::Prepare(GCTracer* tracer) { |
if (heap()->incremental_marking()->IsMarking() && PreciseSweepingRequired()) { |
heap()->incremental_marking()->Abort(); |
ClearMarkbits(heap_); |
+ AbortCompaction(); |
} |
if (!FLAG_never_compact) StartCompaction(); |