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

Unified Diff: src/heap/heap.cc

Issue 1273483002: GC: Refactor public incremental marking interface in heap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed nit Created 5 years, 4 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 6a4acda903ed8cb6e7a95288b041f79197114b81..047795058fcad0666ffe03ae7aec56f5263597eb 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -769,7 +769,8 @@ void Heap::PreprocessStackTraces() {
void Heap::HandleGCRequest() {
if (incremental_marking()->request_type() ==
IncrementalMarking::COMPLETE_MARKING) {
- CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt");
+ CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt",
+ incremental_marking()->CallbackFlags());
return;
}
DCHECK(FLAG_overapproximate_weak_closure);
@@ -979,7 +980,7 @@ bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason,
if (!mark_compact_collector()->abort_incremental_marking() &&
incremental_marking()->IsStopped() &&
incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) {
- incremental_marking()->Start(kNoGCFlags);
+ incremental_marking()->Start(kNoGCFlags, kNoGCCallbackFlags, "GC epilogue");
}
return next_gc_likely_to_collect_more;
@@ -1006,9 +1007,18 @@ int Heap::NotifyContextDisposed(bool dependant_context) {
}
+void Heap::StartIncrementalMarking(int gc_flags,
+ const GCCallbackFlags gc_callback_flags,
+ const char* reason) {
+ DCHECK(incremental_marking()->IsStopped());
+ incremental_marking()->Start(gc_flags, gc_callback_flags, reason);
+}
+
+
void Heap::StartIdleIncrementalMarking() {
gc_idle_time_handler_.ResetNoProgressCounter();
- incremental_marking()->Start(kReduceMemoryFootprintMask);
+ StartIncrementalMarking(kReduceMemoryFootprintMask, kNoGCCallbackFlags,
+ "idle");
}
@@ -4790,13 +4800,21 @@ GCIdleTimeHandler::HeapState Heap::ComputeHeapState() {
double Heap::AdvanceIncrementalMarking(
intptr_t step_size_in_bytes, double deadline_in_ms,
- IncrementalMarking::ForceCompletionAction completion) {
+ IncrementalMarking::StepActions step_actions) {
DCHECK(!incremental_marking()->IsStopped());
+
+ if (step_size_in_bytes == 0) {
+ step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize(
+ static_cast<size_t>(GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs),
+ static_cast<size_t>(
+ tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()));
+ }
+
double remaining_time_in_ms = 0.0;
do {
- incremental_marking()->Step(step_size_in_bytes,
- IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- IncrementalMarking::FORCE_MARKING, completion);
+ incremental_marking()->Step(
+ step_size_in_bytes, step_actions.completion_action,
+ step_actions.force_marking, step_actions.force_completion);
remaining_time_in_ms = deadline_in_ms - MonotonicallyIncreasingTimeInMs();
} while (remaining_time_in_ms >=
2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
@@ -4815,9 +4833,9 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
result = true;
break;
case DO_INCREMENTAL_MARKING: {
- const double remaining_idle_time_in_ms = AdvanceIncrementalMarking(
- action.parameter, deadline_in_ms,
- IncrementalMarking::DO_NOT_FORCE_COMPLETION);
+ const double remaining_idle_time_in_ms =
+ AdvanceIncrementalMarking(action.parameter, deadline_in_ms,
+ IncrementalMarking::NoForcedStepActions());
if (remaining_idle_time_in_ms > 0.0) {
action.additional_work = TryFinalizeIdleIncrementalMarking(
remaining_idle_time_in_ms, heap_state.size_of_objects,
« 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