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

Unified Diff: src/heap/incremental-marking.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/incremental-marking.h ('k') | src/heap/mark-compact.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/incremental-marking.cc
diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc
index a85d4a8489326ec84afcd2ca4191d45ebdda18fe..91f14160578e6af956ab72df64a7667adcaec769 100644
--- a/src/heap/incremental-marking.cc
+++ b/src/heap/incremental-marking.cc
@@ -28,7 +28,9 @@ IncrementalMarking::IncrementalMarking(Heap* heap)
idle_marking_delay_counter_(0),
no_marking_scope_depth_(0),
unscanned_bytes_of_large_object_(0),
- was_activated_(false) {}
+ was_activated_(false),
+ weak_closure_was_overapproximated_(false),
+ request_type_(COMPLETE_MARKING) {}
void IncrementalMarking::RecordWriteSlow(HeapObject* obj, Object** slot,
@@ -771,6 +773,18 @@ void IncrementalMarking::Finalize() {
}
+void IncrementalMarking::OverApproximateWeakClosure() {
+ DCHECK(FLAG_overapproximate_weak_closure);
+ DCHECK(!weak_closure_was_overapproximated_);
+ if (FLAG_trace_incremental_marking) {
+ PrintF("[IncrementalMarking] requesting weak closure overapproximation.\n");
+ }
+ set_should_hurry(true);
+ request_type_ = OVERAPPROXIMATION;
+ heap_->isolate()->stack_guard()->RequestGC();
+}
+
+
void IncrementalMarking::MarkingComplete(CompletionAction action) {
state_ = COMPLETE;
// We will set the stack guard to request a GC now. This will mean the rest
@@ -783,12 +797,16 @@ void IncrementalMarking::MarkingComplete(CompletionAction action) {
PrintF("[IncrementalMarking] Complete (normal).\n");
}
if (action == GC_VIA_STACK_GUARD) {
+ request_type_ = COMPLETE_MARKING;
heap_->isolate()->stack_guard()->RequestGC();
}
}
-void IncrementalMarking::Epilogue() { was_activated_ = false; }
+void IncrementalMarking::Epilogue() {
+ was_activated_ = false;
+ weak_closure_was_overapproximated_ = false;
+}
void IncrementalMarking::OldSpaceStep(intptr_t allocated) {
@@ -931,7 +949,13 @@ intptr_t IncrementalMarking::Step(intptr_t allocated_bytes,
if (heap_->mark_compact_collector()->marking_deque()->IsEmpty()) {
if (completion == FORCE_COMPLETION ||
IsIdleMarkingDelayCounterLimitReached()) {
- MarkingComplete(action);
+ if (FLAG_overapproximate_weak_closure &&
+ !weak_closure_was_overapproximated_ &&
+ action == GC_VIA_STACK_GUARD) {
+ OverApproximateWeakClosure();
+ } else {
+ MarkingComplete(action);
+ }
} else {
IncrementIdleMarkingDelayCounter();
}
« no previous file with comments | « src/heap/incremental-marking.h ('k') | src/heap/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698