OLD | NEW |
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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 allocation_timeout_ = Max(6, FLAG_gc_interval); | 608 allocation_timeout_ = Max(6, FLAG_gc_interval); |
609 #endif | 609 #endif |
610 | 610 |
611 if (collector == SCAVENGER && !incremental_marking()->IsStopped()) { | 611 if (collector == SCAVENGER && !incremental_marking()->IsStopped()) { |
612 if (FLAG_trace_incremental_marking) { | 612 if (FLAG_trace_incremental_marking) { |
613 PrintF("[IncrementalMarking] Scavenge during marking.\n"); | 613 PrintF("[IncrementalMarking] Scavenge during marking.\n"); |
614 } | 614 } |
615 } | 615 } |
616 | 616 |
617 if (collector == MARK_COMPACTOR && | 617 if (collector == MARK_COMPACTOR && |
618 !mark_compact_collector()->abort_incremental_marking_ && | 618 !mark_compact_collector()->abort_incremental_marking() && |
619 !incremental_marking()->IsStopped() && | 619 !incremental_marking()->IsStopped() && |
620 !incremental_marking()->should_hurry() && | 620 !incremental_marking()->should_hurry() && |
621 FLAG_incremental_marking_steps) { | 621 FLAG_incremental_marking_steps) { |
622 // Make progress in incremental marking. | 622 // Make progress in incremental marking. |
623 const intptr_t kStepSizeWhenDelayedByScavenge = 1 * MB; | 623 const intptr_t kStepSizeWhenDelayedByScavenge = 1 * MB; |
624 incremental_marking()->Step(kStepSizeWhenDelayedByScavenge, | 624 incremental_marking()->Step(kStepSizeWhenDelayedByScavenge, |
625 IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 625 IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
626 if (!incremental_marking()->IsComplete()) { | 626 if (!incremental_marking()->IsComplete()) { |
627 if (FLAG_trace_incremental_marking) { | 627 if (FLAG_trace_incremental_marking) { |
628 PrintF("[IncrementalMarking] Delaying MarkSweep.\n"); | 628 PrintF("[IncrementalMarking] Delaying MarkSweep.\n"); |
(...skipping 21 matching lines...) Expand all Loading... |
650 next_gc_likely_to_collect_more = | 650 next_gc_likely_to_collect_more = |
651 PerformGarbageCollection(collector, &tracer); | 651 PerformGarbageCollection(collector, &tracer); |
652 } | 652 } |
653 | 653 |
654 ASSERT(collector == SCAVENGER || incremental_marking()->IsStopped()); | 654 ASSERT(collector == SCAVENGER || incremental_marking()->IsStopped()); |
655 | 655 |
656 // This can do debug callbacks and restart incremental marking. | 656 // This can do debug callbacks and restart incremental marking. |
657 GarbageCollectionEpilogue(); | 657 GarbageCollectionEpilogue(); |
658 } | 658 } |
659 | 659 |
660 if (incremental_marking()->IsStopped()) { | 660 // Start incremental marking for the next cycle. The heap snapshot |
661 if (incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull()) { | 661 // generator needs incremental marking to stay off after it aborted. |
662 incremental_marking()->Start(); | 662 if (!mark_compact_collector()->abort_incremental_marking() && |
663 } | 663 incremental_marking()->IsStopped() && |
| 664 incremental_marking()->WorthActivating() && |
| 665 NextGCIsLikelyToBeFull()) { |
| 666 incremental_marking()->Start(); |
664 } | 667 } |
665 | 668 |
666 return next_gc_likely_to_collect_more; | 669 return next_gc_likely_to_collect_more; |
667 } | 670 } |
668 | 671 |
669 | 672 |
670 void Heap::PerformScavenge() { | 673 void Heap::PerformScavenge() { |
671 GCTracer tracer(this, NULL, NULL); | 674 GCTracer tracer(this, NULL, NULL); |
672 if (incremental_marking()->IsStopped()) { | 675 if (incremental_marking()->IsStopped()) { |
673 PerformGarbageCollection(SCAVENGER, &tracer); | 676 PerformGarbageCollection(SCAVENGER, &tracer); |
(...skipping 6655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7329 static_cast<int>(object_sizes_last_time_[index])); | 7332 static_cast<int>(object_sizes_last_time_[index])); |
7330 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7333 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7331 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7334 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7332 | 7335 |
7333 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7336 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7334 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7337 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7335 ClearObjectStats(); | 7338 ClearObjectStats(); |
7336 } | 7339 } |
7337 | 7340 |
7338 } } // namespace v8::internal | 7341 } } // namespace v8::internal |
OLD | NEW |