Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Unified Diff: src/heap/heap.cc

Issue 894703002: Add a flag to over approximate the weak closure during GC (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698