From 5b8a6c1e54aad944d5712df95af57899b854d46d Mon Sep 17 00:00:00 2001 From: "vegorov@chromium.org" Date: Wed, 21 Sep 2011 11:20:05 +0000 Subject: [PATCH] Make heap iterable in PrepareForBreakPoints. When aborting incremental marking with compaction discard all slots collected on evacuation candidates. R=ricow@chromium.org BUG=v8:1700 TEST=inspector/debugger/debugger-step-in.html Review URL: http://codereview.chromium.org/7977004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9360 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/debug.cc | 4 ++++ src/mark-compact.cc | 17 +++++++++++++++++ src/mark-compact.h | 2 ++ 3 files changed, 23 insertions(+) diff --git a/src/debug.cc b/src/debug.cc index 6df7574..6d6d1f0 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1733,6 +1733,10 @@ void Debug::PrepareForBreakPoints() { if (!has_break_points_) { Deoptimizer::DeoptimizeAll(); + // We are going to iterate heap to find all functions without + // debug break slots. + isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask); + AssertNoAllocation no_allocation; Builtins* builtins = isolate_->builtins(); Code* lazy_compile = builtins->builtin(Builtins::kLazyCompile); diff --git a/src/mark-compact.cc b/src/mark-compact.cc index 810c5fa..f6b495a 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(); diff --git a/src/mark-compact.h b/src/mark-compact.h index 7a504de..b4ee4e7 100644 --- a/src/mark-compact.h +++ b/src/mark-compact.h @@ -449,6 +449,8 @@ class MarkCompactCollector { bool StartCompaction(); + void AbortCompaction(); + // During a full GC, there is a stack-allocated GCTracer that is used for // bookkeeping information. Return a pointer to that tracer. GCTracer* tracer() { return tracer_; } -- 2.7.4