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

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

Issue 6756006: Exponentially increase incremental marking factor each 512 steps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 8 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/incremental-marking.h ('k') | src/spaces.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 21 matching lines...) Expand all
32 #include "code-stubs.h" 32 #include "code-stubs.h"
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 IncrementalMarking::State IncrementalMarking::state_ = STOPPED; 37 IncrementalMarking::State IncrementalMarking::state_ = STOPPED;
38 MarkingStack IncrementalMarking::marking_stack_; 38 MarkingStack IncrementalMarking::marking_stack_;
39 39
40 double IncrementalMarking::steps_took_ = 0; 40 double IncrementalMarking::steps_took_ = 0;
41 int IncrementalMarking::steps_count_ = 0; 41 int IncrementalMarking::steps_count_ = 0;
42 intptr_t IncrementalMarking::allocation_marking_factor_ = 0;
42 43
43 static intptr_t allocated = 0; 44 static intptr_t allocated = 0;
44 45
45 class IncrementalMarkingMarkingVisitor : public ObjectVisitor { 46 class IncrementalMarkingMarkingVisitor : public ObjectVisitor {
46 public: 47 public:
47 void VisitPointer(Object** p) { 48 void VisitPointer(Object** p) {
48 MarkObjectByPointer(p); 49 MarkObjectByPointer(p);
49 } 50 }
50 51
51 void VisitPointers(Object** start, Object** end) { 52 void VisitPointers(Object** start, Object** end) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 Address new_space_high = Heap::new_space()->ToSpaceHigh(); 215 Address new_space_high = Heap::new_space()->ToSpaceHigh();
215 Marking::ClearRange(new_space_low, 216 Marking::ClearRange(new_space_low,
216 static_cast<int>(new_space_high - new_space_low)); 217 static_cast<int>(new_space_high - new_space_low));
217 218
218 ClearMarkbits(); 219 ClearMarkbits();
219 220
220 #ifdef DEBUG 221 #ifdef DEBUG
221 VerifyMarkbitsAreClean(); 222 VerifyMarkbitsAreClean();
222 #endif 223 #endif
223 224
225 Heap::new_space()->LowerInlineAllocationLimit(kAllocatedThreshold);
226
224 // Mark strong roots grey. 227 // Mark strong roots grey.
225 IncrementalMarkingRootMarkingVisitor visitor; 228 IncrementalMarkingRootMarkingVisitor visitor;
226 Heap::IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); 229 Heap::IterateStrongRoots(&visitor, VISIT_ONLY_STRONG);
227 230
228 // Ready to start incremental marking. 231 // Ready to start incremental marking.
229 if (FLAG_trace_incremental_marking) { 232 if (FLAG_trace_incremental_marking) {
230 PrintF("[IncrementalMarking] Running\n"); 233 PrintF("[IncrementalMarking] Running\n");
231 } 234 }
232 } 235 }
233 236
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 FLAG_incremental_marking_steps) { 328 FLAG_incremental_marking_steps) {
326 allocated += allocated_bytes; 329 allocated += allocated_bytes;
327 330
328 if (allocated >= kAllocatedThreshold) { 331 if (allocated >= kAllocatedThreshold) {
329 double start = 0; 332 double start = 0;
330 333
331 if (FLAG_trace_incremental_marking || FLAG_trace_gc) { 334 if (FLAG_trace_incremental_marking || FLAG_trace_gc) {
332 start = OS::TimeCurrentMillis(); 335 start = OS::TimeCurrentMillis();
333 } 336 }
334 337
335 intptr_t bytes_to_process = allocated * kAllocationMarkingFactor; 338 intptr_t bytes_to_process = allocated * allocation_marking_factor_;
336 int count = 0; 339 int count = 0;
337 340
338 Map* filler_map = Heap::one_pointer_filler_map(); 341 Map* filler_map = Heap::one_pointer_filler_map();
339 while (!marking_stack_.is_empty() && bytes_to_process > 0) { 342 while (!marking_stack_.is_empty() && bytes_to_process > 0) {
340 HeapObject* obj = marking_stack_.Pop(); 343 HeapObject* obj = marking_stack_.Pop();
341 344
342 // Explicitly skip one word fillers. Incremental markbit patterns are 345 // Explicitly skip one word fillers. Incremental markbit patterns are
343 // correct only for objects that occupy at least two words. 346 // correct only for objects that occupy at least two words.
344 Map* map = obj->map(); 347 Map* map = obj->map();
345 if (map != filler_map) { 348 if (map != filler_map) {
346 ASSERT(IsGrey(Marking::MarkBitFrom(obj))); 349 ASSERT(IsGrey(Marking::MarkBitFrom(obj)));
347 int size = obj->SizeFromMap(map); 350 int size = obj->SizeFromMap(map);
348 bytes_to_process -= size; 351 bytes_to_process -= size;
349 MarkBit map_mark_bit = Marking::MarkBitFromOldSpace(map); 352 MarkBit map_mark_bit = Marking::MarkBitFromOldSpace(map);
350 if (IsWhite(map_mark_bit)) WhiteToGreyAndPush(map, map_mark_bit); 353 if (IsWhite(map_mark_bit)) WhiteToGreyAndPush(map, map_mark_bit);
351 // TODO(gc) switch to static visitor instead of normal visitor. 354 // TODO(gc) switch to static visitor instead of normal visitor.
352 obj->IterateBody(map->instance_type(), size, &marking_visitor); 355 obj->IterateBody(map->instance_type(), size, &marking_visitor);
353 MarkBit obj_mark_bit = Marking::MarkBitFrom(obj); 356 MarkBit obj_mark_bit = Marking::MarkBitFrom(obj);
354 MarkBlack(obj_mark_bit); 357 MarkBlack(obj_mark_bit);
355 } 358 }
356 count++; 359 count++;
357 } 360 }
358 allocated = 0; 361 allocated = 0;
359 if (marking_stack_.is_empty()) MarkingComplete(); 362 if (marking_stack_.is_empty()) MarkingComplete();
360 if (FLAG_trace_incremental_marking || FLAG_trace_gc) { 363 if (FLAG_trace_incremental_marking || FLAG_trace_gc) {
361 double end = OS::TimeCurrentMillis(); 364 double end = OS::TimeCurrentMillis();
362 steps_took_ += (end - start); 365 steps_took_ += (end - start);
363 steps_count_++; 366 }
367
368 steps_count_++;
369
370 if ((steps_count_ % kAllocationMarkingFactorSpeedupInterval) == 0) {
371 allocation_marking_factor_ *= kAllocationMarkingFactorSpeedup;
364 } 372 }
365 } 373 }
366 } 374 }
367 } 375 }
368 376
369 377
370 } } // namespace v8::internal 378 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/incremental-marking.h ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698