Chromium Code Reviews

Unified Diff: src/heap/heap.cc

Issue 1255173002: Add regression test for 507979. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: GC: Refactor incremental marking w/ deadline into a separate call Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/heap/heap.h ('k') | no next file » | 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 4f5a064cca37a0f51ce644a815da5786008d664a..064ac32f58f36315f288bebb1ee6a26e6bfb5cfb 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4886,6 +4886,24 @@ GCIdleTimeHandler::HeapState Heap::ComputeHeapState() {
}
+double Heap::AdvanceIncrementalMarking(
+ double step_size_in_bytes, double deadline_in_ms,
+ IncrementalMarking::ForceCompletionAction completion) {
+ DCHECK(!incremental_marking()->IsStopped());
+ 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);
+ remaining_time_in_ms = deadline_in_ms - MonotonicallyIncreasingTimeInMs();
+ } while (remaining_time_in_ms >=
+ 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
+ !incremental_marking()->IsComplete() &&
+ !mark_compact_collector_.marking_deque()->IsEmpty());
+ return remaining_time_in_ms;
+}
+
+
bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
GCIdleTimeHandler::HeapState heap_state,
double deadline_in_ms) {
@@ -4895,19 +4913,9 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
result = true;
break;
case DO_INCREMENTAL_MARKING: {
- DCHECK(!incremental_marking()->IsStopped());
- double remaining_idle_time_in_ms = 0.0;
- do {
- incremental_marking()->Step(
- action.parameter, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- IncrementalMarking::FORCE_MARKING,
- IncrementalMarking::DO_NOT_FORCE_COMPLETION);
- remaining_idle_time_in_ms =
- deadline_in_ms - MonotonicallyIncreasingTimeInMs();
- } while (remaining_idle_time_in_ms >=
- 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
- !incremental_marking()->IsComplete() &&
- !mark_compact_collector_.marking_deque()->IsEmpty());
+ const double remaining_idle_time_in_ms = AdvanceIncrementalMarking(
+ action.parameter, deadline_in_ms,
+ IncrementalMarking::DO_NOT_FORCE_COMPLETION);
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') | no next file » | no next file with comments »

Powered by Google App Engine