Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 344441dfdb4bd3cc7287bc0ba5f384af7833cff1..f01b1f6b0cd31576cb94cbf7cca3aed0be8bd2ed 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -286,6 +286,10 @@ GarbageCollector Heap::SelectGarbageCollector(AllocationSpace space, |
return YoungGenerationCollector(); |
} |
+void Heap::SetGCState(HeapState state) { |
+ gc_state_ = state; |
+ store_buffer_->SetMode(gc_state_); |
+} |
// TODO(1238405): Combine the infrastructure for --heap-stats and |
// --log-gc to avoid the complicated preprocessor and flag testing. |
@@ -1429,7 +1433,8 @@ void Heap::CallGCEpilogueCallbacks(GCType gc_type, |
void Heap::MarkCompact() { |
PauseAllocationObserversScope pause_observers(this); |
- gc_state_ = MARK_COMPACT; |
+ SetGCState(MARK_COMPACT); |
+ |
LOG(isolate_, ResourceEvent("markcompact", "begin")); |
uint64_t size_of_objects_before_gc = SizeOfObjects(); |
@@ -1455,7 +1460,7 @@ void Heap::MinorMarkCompact() { UNREACHABLE(); } |
void Heap::MarkCompactEpilogue() { |
TRACE_GC(tracer(), GCTracer::Scope::MC_EPILOGUE); |
- gc_state_ = NOT_IN_GC; |
+ SetGCState(NOT_IN_GC); |
isolate_->counters()->objs_since_last_full()->Set(0); |
@@ -1586,7 +1591,7 @@ void Heap::Scavenge() { |
mark_compact_collector()->sweeper().EnsureNewSpaceCompleted(); |
- gc_state_ = SCAVENGE; |
+ SetGCState(SCAVENGE); |
// Implements Cheney's copying algorithm |
LOG(isolate_, ResourceEvent("scavenge", "begin")); |
@@ -1712,7 +1717,7 @@ void Heap::Scavenge() { |
LOG(isolate_, ResourceEvent("scavenge", "end")); |
- gc_state_ = NOT_IN_GC; |
+ SetGCState(NOT_IN_GC); |
} |