Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index 641293399e6297d6824c2d07ee1d0ecf6cddd91b..ebba22b44a875b01006d01f0fe790636775ed8bf 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -1471,6 +1471,11 @@ void MarkCompactCollector::PrepareThreadForCodeFlushing(Isolate* isolate, |
void MarkCompactCollector::PrepareForCodeFlushing() { |
ASSERT(heap() == Isolate::Current()->heap()); |
+ // Enable code flushing for non-incremental cycles. |
+ if (FLAG_flush_code && !FLAG_flush_code_incrementally) { |
+ EnableCodeFlushing(!was_marked_incrementally_); |
+ } |
+ |
// If code flushing is disabled, there is no need to prepare for it. |
if (!is_code_flushing_enabled()) return; |
@@ -2033,6 +2038,11 @@ void MarkCompactCollector::AfterMarking() { |
// Flush code from collected candidates. |
if (is_code_flushing_enabled()) { |
code_flusher_->ProcessCandidates(); |
+ // If incremental marker does not support code flushing, we need to |
+ // disable it before incremental marking steps for next cycle. |
+ if (FLAG_flush_code && !FLAG_flush_code_incrementally) { |
+ EnableCodeFlushing(false); |
+ } |
} |
if (!FLAG_watch_ic_patching) { |
@@ -3607,6 +3617,13 @@ void MarkCompactCollector::SweepSpaces() { |
void MarkCompactCollector::EnableCodeFlushing(bool enable) { |
+#ifdef ENABLE_DEBUGGER_SUPPORT |
+ if (heap()->isolate()->debug()->IsLoaded() || |
+ heap()->isolate()->debug()->has_break_points()) { |
+ enable = false; |
+ } |
+#endif |
+ |
if (enable) { |
if (code_flusher_ != NULL) return; |
code_flusher_ = new CodeFlusher(heap()->isolate()); |