| Index: src/heap/heap.cc
|
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc
|
| index cec871403a718d8f2a88b8666af713e48ba56f54..16c6c5ad0e2b811d48d9c2dcc666f8081792626c 100644
|
| --- a/src/heap/heap.cc
|
| +++ b/src/heap/heap.cc
|
| @@ -735,6 +735,48 @@ void Heap::GarbageCollectionEpilogue() {
|
| }
|
|
|
|
|
| +void Heap::HandleGCRequest() {
|
| + if (incremental_marking()->IsComplete()) {
|
| + 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
|
|
|