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

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

Issue 492263002: 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 | « no previous file | src/heap/gc-idle-time-handler.cc » ('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 #ifndef V8_HEAP_GC_IDLE_TIME_HANDLER_H_ 5 #ifndef V8_HEAP_GC_IDLE_TIME_HANDLER_H_
6 #define V8_HEAP_GC_IDLE_TIME_HANDLER_H_ 6 #define V8_HEAP_GC_IDLE_TIME_HANDLER_H_
7 7
8 #include "src/globals.h" 8 #include "src/globals.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 GCIdleTimeAction result; 42 GCIdleTimeAction result;
43 result.type = DO_FULL_GC; 43 result.type = DO_FULL_GC;
44 result.parameter = 0; 44 result.parameter = 0;
45 return result; 45 return result;
46 } 46 }
47 47
48 GCIdleTimeActionType type; 48 GCIdleTimeActionType type;
49 intptr_t parameter; 49 intptr_t parameter;
50 }; 50 };
51 51
52
52 class GCTracer; 53 class GCTracer;
53 54
54 // The idle time handler makes decisions about which garbage collection 55 // The idle time handler makes decisions about which garbage collection
55 // operations are executing during IdleNotification. 56 // operations are executing during IdleNotification.
56 class GCIdleTimeHandler { 57 class GCIdleTimeHandler {
57 public: 58 public:
58 // If we haven't recorded any incremental marking events yet, we carefully 59 // If we haven't recorded any incremental marking events yet, we carefully
59 // mark with a conservative lower bound for the marking speed. 60 // mark with a conservative lower bound for the marking speed.
60 static const size_t kInitialConservativeMarkingSpeed = 100 * KB; 61 static const size_t kInitialConservativeMarkingSpeed = 100 * KB;
61 62
62 // Maximum marking step size returned by EstimateMarkingStepSize. 63 // Maximum marking step size returned by EstimateMarkingStepSize.
63 static const size_t kMaximumMarkingStepSize = 700 * MB; 64 static const size_t kMaximumMarkingStepSize = 700 * MB;
64 65
65 // We have to make sure that we finish the IdleNotification before 66 // We have to make sure that we finish the IdleNotification before
66 // idle_time_in_ms. Hence, we conservatively prune our workload estimate. 67 // idle_time_in_ms. Hence, we conservatively prune our workload estimate.
67 static const double kConservativeTimeRatio; 68 static const double kConservativeTimeRatio;
68 69
69 // If we haven't recorded any mark-compact events yet, we use 70 // If we haven't recorded any mark-compact events yet, we use
70 // conservative lower bound for the mark-compact speed. 71 // conservative lower bound for the mark-compact speed.
71 static const size_t kInitialConservativeMarkCompactSpeed = 2 * MB; 72 static const size_t kInitialConservativeMarkCompactSpeed = 2 * MB;
72 73
73 // Maximum mark-compact time returned by EstimateMarkCompactTime. 74 // Maximum mark-compact time returned by EstimateMarkCompactTime.
74 static const size_t kMaxMarkCompactTimeInMs; 75 static const size_t kMaxMarkCompactTimeInMs;
75 76
77 struct HeapState {
78 int contexts_disposed;
79 size_t size_of_objects;
80 bool incremental_marking_stopped;
81 bool can_start_incremental_marking;
82 };
83
76 GCIdleTimeHandler() 84 GCIdleTimeHandler()
77 : mark_compacts_since_idle_round_started_(0), 85 : mark_compacts_since_idle_round_started_(0),
78 scavenges_since_last_idle_round_(0) {} 86 scavenges_since_last_idle_round_(0) {}
79 87
80 GCIdleTimeAction Compute(int idle_time_in_ms, int contexts_disposed, 88 GCIdleTimeAction Compute(int idle_time_in_ms, HeapState heap_state,
81 size_t size_of_objects,
82 bool incremental_marking_stopped,
83 GCTracer* gc_tracer); 89 GCTracer* gc_tracer);
84 90
85 void NotifyIdleMarkCompact() { 91 void NotifyIdleMarkCompact() {
86 if (mark_compacts_since_idle_round_started_ < kMaxMarkCompactsInIdleRound) { 92 if (mark_compacts_since_idle_round_started_ < kMaxMarkCompactsInIdleRound) {
87 ++mark_compacts_since_idle_round_started_; 93 ++mark_compacts_since_idle_round_started_;
88 if (mark_compacts_since_idle_round_started_ == 94 if (mark_compacts_since_idle_round_started_ ==
89 kMaxMarkCompactsInIdleRound) { 95 kMaxMarkCompactsInIdleRound) {
90 scavenges_since_last_idle_round_ = 0; 96 scavenges_since_last_idle_round_ = 0;
91 } 97 }
92 } 98 }
(...skipping 22 matching lines...) Expand all
115 int mark_compacts_since_idle_round_started_; 121 int mark_compacts_since_idle_round_started_;
116 int scavenges_since_last_idle_round_; 122 int scavenges_since_last_idle_round_;
117 123
118 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); 124 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler);
119 }; 125 };
120 126
121 } // namespace internal 127 } // namespace internal
122 } // namespace v8 128 } // namespace v8
123 129
124 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ 130 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/gc-idle-time-handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698