Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index ec27d3563a38183e70f1c3d057a763da5fb30b90..523b819a37fe4d7d038ba3a0be40e0825e6e4924 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -734,6 +734,49 @@ void Heap::GarbageCollectionEpilogue() { |
} |
+void Heap::HandleGCRequest() { |
+ if (incremental_marking()->request_type() == |
+ IncrementalMarking::COMPLETE_MARKING) { |
+ CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt"); |
+ return; |
+ } |
+ DCHECK(FLAG_overapproximate_weak_closure); |
+ DCHECK(!incremental_marking()->weak_closure_was_overapproximated()); |
+ OverApproximateWeakClosure("GC interrupt"); |
+} |
+ |
+ |
+void Heap::OverApproximateWeakClosure(const char* gc_reason) { |
+ if (FLAG_trace_incremental_marking) { |
+ PrintF("[IncrementalMarking] Overapproximate weak closure (%s).\n", |
+ gc_reason); |
+ } |
+ { |
+ GCCallbacksScope scope(this); |
+ if (scope.CheckReenter()) { |
+ AllowHeapAllocation allow_allocation; |
+ GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL); |
+ VMState<EXTERNAL> state(isolate_); |
+ HandleScope handle_scope(isolate_); |
+ CallGCPrologueCallbacks(kGCTypeMarkSweepCompact, kNoGCCallbackFlags); |
+ } |
+ } |
+ mark_compact_collector()->OverApproximateWeakClosure(); |
+ incremental_marking()->set_should_hurry(false); |
+ incremental_marking()->set_weak_closure_was_overapproximated(true); |
+ { |
+ GCCallbacksScope scope(this); |
+ if (scope.CheckReenter()) { |
+ AllowHeapAllocation allow_allocation; |
+ GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL); |
+ VMState<EXTERNAL> state(isolate_); |
+ HandleScope handle_scope(isolate_); |
+ CallGCEpilogueCallbacks(kGCTypeMarkSweepCompact, kNoGCCallbackFlags); |
+ } |
+ } |
+} |
+ |
+ |
void Heap::CollectAllGarbage(int flags, const char* gc_reason, |
const v8::GCCallbackFlags gc_callback_flags) { |
// Since we are ignoring the return value, the exact choice of space does |