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

Side by Side Diff: src/heap/gc-idle-time-handler.cc

Issue 494203002: Revert "Start incremental marking in idle time handler only if it is worthwhile." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | src/heap/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/heap/gc-idle-time-handler.h" 5 #include "src/heap/gc-idle-time-handler.h"
6 #include "src/heap/gc-tracer.h" 6 #include "src/heap/gc-tracer.h"
7 #include "src/utils.h" 7 #include "src/utils.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 28 matching lines...) Expand all
39 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms) { 39 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms) {
40 if (mark_compact_speed_in_bytes_per_ms == 0) { 40 if (mark_compact_speed_in_bytes_per_ms == 0) {
41 mark_compact_speed_in_bytes_per_ms = kInitialConservativeMarkCompactSpeed; 41 mark_compact_speed_in_bytes_per_ms = kInitialConservativeMarkCompactSpeed;
42 } 42 }
43 size_t result = size_of_objects / mark_compact_speed_in_bytes_per_ms; 43 size_t result = size_of_objects / mark_compact_speed_in_bytes_per_ms;
44 return Min(result, kMaxMarkCompactTimeInMs); 44 return Min(result, kMaxMarkCompactTimeInMs);
45 } 45 }
46 46
47 47
48 GCIdleTimeAction GCIdleTimeHandler::Compute(int idle_time_in_ms, 48 GCIdleTimeAction GCIdleTimeHandler::Compute(int idle_time_in_ms,
49 HeapState heap_state, 49 int contexts_disposed,
50 size_t size_of_objects,
51 bool incremental_marking_stopped,
50 GCTracer* gc_tracer) { 52 GCTracer* gc_tracer) {
51 if (IsIdleRoundFinished()) { 53 if (IsIdleRoundFinished()) {
52 if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) { 54 if (EnoughGarbageSinceLastIdleRound() || contexts_disposed > 0) {
53 StartIdleRound(); 55 StartIdleRound();
54 } else { 56 } else {
55 return GCIdleTimeAction::Nothing(); 57 return GCIdleTimeAction::Nothing();
56 } 58 }
57 } 59 }
58 if (heap_state.incremental_marking_stopped) { 60 if (incremental_marking_stopped) {
59 size_t speed = 61 size_t speed =
60 static_cast<size_t>(gc_tracer->MarkCompactSpeedInBytesPerMillisecond()); 62 static_cast<size_t>(gc_tracer->MarkCompactSpeedInBytesPerMillisecond());
61 if (idle_time_in_ms >= static_cast<int>(EstimateMarkCompactTime( 63 if (idle_time_in_ms >=
62 heap_state.size_of_objects, speed))) { 64 static_cast<int>(EstimateMarkCompactTime(size_of_objects, speed))) {
63 // If there are no more than two GCs left in this idle round and we are 65 // If there are no more than two GCs left in this idle round and we are
64 // allowed to do a full GC, then make those GCs full in order to compact 66 // allowed to do a full GC, then make those GCs full in order to compact
65 // the code space. 67 // the code space.
66 // TODO(ulan): Once we enable code compaction for incremental marking, we 68 // TODO(ulan): Once we enable code compaction for incremental marking, we
67 // can get rid of this special case and always start incremental marking. 69 // can get rid of this special case and always start incremental marking.
68 int remaining_mark_sweeps = 70 int remaining_mark_sweeps =
69 kMaxMarkCompactsInIdleRound - mark_compacts_since_idle_round_started_; 71 kMaxMarkCompactsInIdleRound - mark_compacts_since_idle_round_started_;
70 if (heap_state.contexts_disposed > 0 || remaining_mark_sweeps <= 2 || 72 if (contexts_disposed > 0 || remaining_mark_sweeps <= 2) {
71 !heap_state.can_start_incremental_marking) {
72 return GCIdleTimeAction::FullGC(); 73 return GCIdleTimeAction::FullGC();
73 } 74 }
74 } 75 }
75 if (!heap_state.can_start_incremental_marking) {
76 return GCIdleTimeAction::Nothing();
77 }
78 } 76 }
79 intptr_t speed = gc_tracer->IncrementalMarkingSpeedInBytesPerMillisecond(); 77 intptr_t speed = gc_tracer->IncrementalMarkingSpeedInBytesPerMillisecond();
80 size_t step_size = 78 size_t step_size =
81 static_cast<size_t>(EstimateMarkingStepSize(idle_time_in_ms, speed)); 79 static_cast<size_t>(EstimateMarkingStepSize(idle_time_in_ms, speed));
82 return GCIdleTimeAction::IncrementalMarking(step_size); 80 return GCIdleTimeAction::IncrementalMarking(step_size);
83 } 81 }
84 } 82 }
85 } 83 }
OLDNEW
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698