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

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: updates Created 5 years, 10 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
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698