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

Side by Side Diff: src/incremental-marking.h

Issue 11035053: Rollback trunk to bleeding_edge revision 12525 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 2 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/ic-inl.h ('k') | src/incremental-marking.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void Finalize(); 88 void Finalize();
89 89
90 void Abort(); 90 void Abort();
91 91
92 void MarkingComplete(CompletionAction action); 92 void MarkingComplete(CompletionAction action);
93 93
94 // It's hard to know how much work the incremental marker should do to make 94 // It's hard to know how much work the incremental marker should do to make
95 // progress in the face of the mutator creating new work for it. We start 95 // progress in the face of the mutator creating new work for it. We start
96 // of at a moderate rate of work and gradually increase the speed of the 96 // of at a moderate rate of work and gradually increase the speed of the
97 // incremental marker until it completes. 97 // incremental marker until it completes.
98 // Do some marking every time this much memory has been allocated or that many 98 // Do some marking every time this much memory has been allocated.
99 // heavy (color-checking) write barriers have been invoked.
100 static const intptr_t kAllocatedThreshold = 65536; 99 static const intptr_t kAllocatedThreshold = 65536;
101 static const intptr_t kWriteBarriersInvokedThreshold = 65536;
102 // Start off by marking this many times more memory than has been allocated. 100 // Start off by marking this many times more memory than has been allocated.
103 static const intptr_t kInitialMarkingSpeed = 1; 101 static const intptr_t kInitialAllocationMarkingFactor = 1;
104 // But if we are promoting a lot of data we need to mark faster to keep up 102 // But if we are promoting a lot of data we need to mark faster to keep up
105 // with the data that is entering the old space through promotion. 103 // with the data that is entering the old space through promotion.
106 static const intptr_t kFastMarking = 3; 104 static const intptr_t kFastMarking = 3;
107 // After this many steps we increase the marking/allocating factor. 105 // After this many steps we increase the marking/allocating factor.
108 static const intptr_t kMarkingSpeedAccellerationInterval = 1024; 106 static const intptr_t kAllocationMarkingFactorSpeedupInterval = 1024;
109 // This is how much we increase the marking/allocating factor by. 107 // This is how much we increase the marking/allocating factor by.
110 static const intptr_t kMarkingSpeedAccelleration = 2; 108 static const intptr_t kAllocationMarkingFactorSpeedup = 2;
111 static const intptr_t kMaxMarkingSpeed = 1000; 109 static const intptr_t kMaxAllocationMarkingFactor = 1000;
112 110
113 void OldSpaceStep(intptr_t allocated) { 111 void OldSpaceStep(intptr_t allocated) {
114 Step(allocated * kFastMarking / kInitialMarkingSpeed, 112 Step(allocated * kFastMarking / kInitialAllocationMarkingFactor,
115 GC_VIA_STACK_GUARD); 113 GC_VIA_STACK_GUARD);
116 } 114 }
117 115
118 void Step(intptr_t allocated, CompletionAction action); 116 void Step(intptr_t allocated, CompletionAction action);
119 117
120 inline void RestartIfNotMarking() { 118 inline void RestartIfNotMarking() {
121 if (state_ == COMPLETE) { 119 if (state_ == COMPLETE) {
122 state_ = MARKING; 120 state_ = MARKING;
123 if (FLAG_trace_incremental_marking) { 121 if (FLAG_trace_incremental_marking) {
124 PrintF("[IncrementalMarking] Restarting (new grey objects)\n"); 122 PrintF("[IncrementalMarking] Restarting (new grey objects)\n");
125 } 123 }
126 } 124 }
127 } 125 }
128 126
129 static void RecordWriteFromCode(HeapObject* obj, 127 static void RecordWriteFromCode(HeapObject* obj,
130 Object* value, 128 Object* value,
131 Isolate* isolate); 129 Isolate* isolate);
132 130
133 static void RecordWriteForEvacuationFromCode(HeapObject* obj, 131 static void RecordWriteForEvacuationFromCode(HeapObject* obj,
134 Object** slot, 132 Object** slot,
135 Isolate* isolate); 133 Isolate* isolate);
136 134
137 // Record a slot for compaction. Returns false for objects that are 135 // Record a slot for compaction. Returns false for objects that are
138 // guaranteed to be rescanned or not guaranteed to survive. 136 // guaranteed to be rescanned or not guaranteed to survive.
139 // 137 //
140 // No slots in white objects should be recorded, as some slots are typed and 138 // No slots in white objects should be recorded, as some slots are typed and
141 // cannot be interpreted correctly if the underlying object does not survive 139 // cannot be interpreted corrrectly if the underlying object does not survive
142 // the incremental cycle (stays white). 140 // the incremental cycle (stays white).
143 INLINE(bool BaseRecordWrite(HeapObject* obj, Object** slot, Object* value)); 141 INLINE(bool BaseRecordWrite(HeapObject* obj, Object** slot, Object* value));
144 INLINE(void RecordWrite(HeapObject* obj, Object** slot, Object* value)); 142 INLINE(void RecordWrite(HeapObject* obj, Object** slot, Object* value));
145 INLINE(void RecordWriteIntoCode(HeapObject* obj, 143 INLINE(void RecordWriteIntoCode(HeapObject* obj,
146 RelocInfo* rinfo, 144 RelocInfo* rinfo,
147 Object* value)); 145 Object* value));
148 INLINE(void RecordWriteOfCodeEntry(JSFunction* host, 146 INLINE(void RecordWriteOfCodeEntry(JSFunction* host,
149 Object** slot, 147 Object** slot,
150 Code* value)); 148 Code* value));
151 149
(...skipping 18 matching lines...) Expand all
170 ASSERT(!Marking::IsImpossible(mark_bit)); 168 ASSERT(!Marking::IsImpossible(mark_bit));
171 if (mark_bit.Get()) { 169 if (mark_bit.Get()) {
172 // Grey or black: Keep the color. 170 // Grey or black: Keep the color.
173 return false; 171 return false;
174 } 172 }
175 mark_bit.Set(); 173 mark_bit.Set();
176 ASSERT(Marking::IsBlack(mark_bit)); 174 ASSERT(Marking::IsBlack(mark_bit));
177 return true; 175 return true;
178 } 176 }
179 177
178 // Marks the object grey and pushes it on the marking stack.
179 // Returns true if object needed marking and false otherwise.
180 // This is for incremental marking only.
181 INLINE(bool MarkObjectAndPush(HeapObject* obj));
182
183 // Marks the object black without pushing it on the marking stack.
184 // Returns true if object needed marking and false otherwise.
185 // This is for incremental marking only.
186 INLINE(bool MarkObjectWithoutPush(HeapObject* obj));
187
180 inline int steps_count() { 188 inline int steps_count() {
181 return steps_count_; 189 return steps_count_;
182 } 190 }
183 191
184 inline double steps_took() { 192 inline double steps_took() {
185 return steps_took_; 193 return steps_took_;
186 } 194 }
187 195
188 inline double longest_step() { 196 inline double longest_step() {
189 return longest_step_; 197 return longest_step_;
(...skipping 16 matching lines...) Expand all
206 } 214 }
207 215
208 MarkingDeque* marking_deque() { return &marking_deque_; } 216 MarkingDeque* marking_deque() { return &marking_deque_; }
209 217
210 bool IsCompacting() { return IsMarking() && is_compacting_; } 218 bool IsCompacting() { return IsMarking() && is_compacting_; }
211 219
212 void ActivateGeneratedStub(Code* stub); 220 void ActivateGeneratedStub(Code* stub);
213 221
214 void NotifyOfHighPromotionRate() { 222 void NotifyOfHighPromotionRate() {
215 if (IsMarking()) { 223 if (IsMarking()) {
216 if (marking_speed_ < kFastMarking) { 224 if (allocation_marking_factor_ < kFastMarking) {
217 if (FLAG_trace_gc) { 225 if (FLAG_trace_gc) {
218 PrintPID("Increasing marking speed to %d " 226 PrintPID("Increasing marking speed to %d "
219 "due to high promotion rate\n", 227 "due to high promotion rate\n",
220 static_cast<int>(kFastMarking)); 228 static_cast<int>(kFastMarking));
221 } 229 }
222 marking_speed_ = kFastMarking; 230 allocation_marking_factor_ = kFastMarking;
223 } 231 }
224 } 232 }
225 } 233 }
226 234
227 void EnterNoMarkingScope() { 235 void EnterNoMarkingScope() {
228 no_marking_scope_depth_++; 236 no_marking_scope_depth_++;
229 } 237 }
230 238
231 void LeaveNoMarkingScope() { 239 void LeaveNoMarkingScope() {
232 no_marking_scope_depth_--; 240 no_marking_scope_depth_--;
(...skipping 27 matching lines...) Expand all
260 void EnsureMarkingDequeIsCommitted(); 268 void EnsureMarkingDequeIsCommitted();
261 269
262 Heap* heap_; 270 Heap* heap_;
263 271
264 State state_; 272 State state_;
265 bool is_compacting_; 273 bool is_compacting_;
266 274
267 VirtualMemory* marking_deque_memory_; 275 VirtualMemory* marking_deque_memory_;
268 bool marking_deque_memory_committed_; 276 bool marking_deque_memory_committed_;
269 MarkingDeque marking_deque_; 277 MarkingDeque marking_deque_;
278 Marker<IncrementalMarking> marker_;
270 279
271 int steps_count_; 280 int steps_count_;
272 double steps_took_; 281 double steps_took_;
273 double longest_step_; 282 double longest_step_;
274 int64_t old_generation_space_available_at_start_of_incremental_; 283 int64_t old_generation_space_available_at_start_of_incremental_;
275 int64_t old_generation_space_used_at_start_of_incremental_; 284 int64_t old_generation_space_used_at_start_of_incremental_;
276 int steps_count_since_last_gc_; 285 int steps_count_since_last_gc_;
277 double steps_took_since_last_gc_; 286 double steps_took_since_last_gc_;
278 int64_t bytes_rescanned_; 287 int64_t bytes_rescanned_;
279 bool should_hurry_; 288 bool should_hurry_;
280 int marking_speed_; 289 int allocation_marking_factor_;
281 intptr_t bytes_scanned_; 290 intptr_t bytes_scanned_;
282 intptr_t allocated_; 291 intptr_t allocated_;
283 intptr_t write_barriers_invoked_since_last_step_;
284 292
285 int no_marking_scope_depth_; 293 int no_marking_scope_depth_;
286 294
287 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); 295 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking);
288 }; 296 };
289 297
290 } } // namespace v8::internal 298 } } // namespace v8::internal
291 299
292 #endif // V8_INCREMENTAL_MARKING_H_ 300 #endif // V8_INCREMENTAL_MARKING_H_
OLDNEW
« no previous file with comments | « src/ic-inl.h ('k') | src/incremental-marking.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698