diff --git a/src/flag-definitions.h b/src/flag-definitions.h index b8afb24319..50086fb7f4 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -307,6 +307,8 @@ DEFINE_bool(cleanup_caches_in_maps_at_gc, true, "Flush code caches in maps during mark compact cycle.") DEFINE_bool(never_compact, false, "Never perform compaction on full GC - testing only") +DEFINE_bool(compact_code_space, false, + "Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true, "Flush inline caches prior to mark compact collection and " "flush code caches in maps during mark compact cycle.") diff --git a/src/mark-compact.cc b/src/mark-compact.cc index 4aa4c6815f..bc7985ea5f 100644 --- a/src/mark-compact.cc +++ b/src/mark-compact.cc @@ -249,7 +249,7 @@ bool MarkCompactCollector::StartCompaction(CompactionMode mode) { CollectEvacuationCandidates(heap()->old_pointer_space()); CollectEvacuationCandidates(heap()->old_data_space()); - if (mode == NON_INCREMENTAL_COMPACTION) { + if (FLAG_compact_code_space && mode == NON_INCREMENTAL_COMPACTION) { CollectEvacuationCandidates(heap()->code_space()); } else if (FLAG_trace_fragmentation) { TraceFragmentation(heap()->code_space());