Index: src/heap/mark-compact.cc |
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
index 8d4921f8d15e39d33d803866ee9d6d827176d2c6..b7bcf9e80035e8768c3a95eb9c13cf387f03e3f6 100644 |
--- a/src/heap/mark-compact.cc |
+++ b/src/heap/mark-compact.cc |
@@ -59,7 +59,7 @@ MarkCompactCollector::MarkCompactCollector(Heap* heap) |
heap_(heap), |
marking_deque_memory_(NULL), |
marking_deque_memory_committed_(0), |
- code_flusher_(NULL), |
+ code_flusher_(nullptr), |
have_code_to_deoptimize_(false), |
compacting_(false), |
sweeping_in_progress_(false), |
@@ -247,6 +247,13 @@ void MarkCompactCollector::SetUp() { |
EnsureMarkingDequeIsReserved(); |
EnsureMarkingDequeIsCommitted(kMinMarkingDequeSize); |
slots_buffer_allocator_ = new SlotsBufferAllocator(); |
+ |
+ if (FLAG_flush_code) { |
+ code_flusher_ = new CodeFlusher(isolate()); |
+ if (FLAG_trace_code_flushing) { |
+ PrintF("[code-flushing is now on]\n"); |
+ } |
+ } |
} |
@@ -254,6 +261,7 @@ void MarkCompactCollector::TearDown() { |
AbortCompaction(); |
delete marking_deque_memory_; |
delete slots_buffer_allocator_; |
+ delete code_flusher_; |
} |
@@ -1060,30 +1068,6 @@ void CodeFlusher::EvictCandidate(JSFunction* function) { |
} |
-void CodeFlusher::EvictJSFunctionCandidates() { |
- JSFunction* candidate = jsfunction_candidates_head_; |
- JSFunction* next_candidate; |
- while (candidate != NULL) { |
- next_candidate = GetNextCandidate(candidate); |
- EvictCandidate(candidate); |
- candidate = next_candidate; |
- } |
- DCHECK(jsfunction_candidates_head_ == NULL); |
-} |
- |
- |
-void CodeFlusher::EvictSharedFunctionInfoCandidates() { |
- SharedFunctionInfo* candidate = shared_function_info_candidates_head_; |
- SharedFunctionInfo* next_candidate; |
- while (candidate != NULL) { |
- next_candidate = GetNextCandidate(candidate); |
- EvictCandidate(candidate); |
- candidate = next_candidate; |
- } |
- DCHECK(shared_function_info_candidates_head_ == NULL); |
-} |
- |
- |
void CodeFlusher::IteratePointersToFromSpace(ObjectVisitor* v) { |
Heap* heap = isolate_->heap(); |
@@ -1099,14 +1083,6 @@ void CodeFlusher::IteratePointersToFromSpace(ObjectVisitor* v) { |
} |
-MarkCompactCollector::~MarkCompactCollector() { |
- if (code_flusher_ != NULL) { |
- delete code_flusher_; |
- code_flusher_ = NULL; |
- } |
-} |
- |
- |
class MarkCompactMarkingVisitor |
: public StaticMarkingVisitor<MarkCompactMarkingVisitor> { |
public: |
@@ -4082,25 +4058,6 @@ void MarkCompactCollector::ParallelSweepSpacesComplete() { |
} |
-void MarkCompactCollector::EnableCodeFlushing(bool enable) { |
- if (isolate()->debug()->is_active()) enable = false; |
- |
- if (enable) { |
- if (code_flusher_ != NULL) return; |
- code_flusher_ = new CodeFlusher(isolate()); |
- } else { |
- if (code_flusher_ == NULL) return; |
- code_flusher_->EvictAllCandidates(); |
- delete code_flusher_; |
- code_flusher_ = NULL; |
- } |
- |
- if (FLAG_trace_code_flushing) { |
- PrintF("[code-flushing is now %s]\n", enable ? "on" : "off"); |
- } |
-} |
- |
- |
// TODO(1466) ReportDeleteIfNeeded is not called currently. |
// Our profiling tools do not expect intersections between |
// code objects. We should either reenable it or change our tools. |