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 127 matching lines...) Loading... |
138 max_alive_after_gc_(0), | 138 max_alive_after_gc_(0), |
139 min_in_mutator_(kMaxInt), | 139 min_in_mutator_(kMaxInt), |
140 alive_after_last_gc_(0), | 140 alive_after_last_gc_(0), |
141 last_gc_end_timestamp_(0.0), | 141 last_gc_end_timestamp_(0.0), |
142 store_buffer_(this), | 142 store_buffer_(this), |
143 marking_(this), | 143 marking_(this), |
144 incremental_marking_(this), | 144 incremental_marking_(this), |
145 number_idle_notifications_(0), | 145 number_idle_notifications_(0), |
146 last_idle_notification_gc_count_(0), | 146 last_idle_notification_gc_count_(0), |
147 last_idle_notification_gc_count_init_(false), | 147 last_idle_notification_gc_count_init_(false), |
148 idle_notification_will_schedule_next_gc_(false), | |
149 mark_sweeps_since_idle_round_started_(0), | 148 mark_sweeps_since_idle_round_started_(0), |
150 ms_count_at_last_idle_notification_(0), | 149 ms_count_at_last_idle_notification_(0), |
151 gc_count_at_last_idle_gc_(0), | 150 gc_count_at_last_idle_gc_(0), |
152 scavenges_since_last_idle_round_(kIdleScavengeThreshold), | 151 scavenges_since_last_idle_round_(kIdleScavengeThreshold), |
153 promotion_queue_(this), | 152 promotion_queue_(this), |
154 configured_(false), | 153 configured_(false), |
155 chunks_queued_for_free_(NULL) { | 154 chunks_queued_for_free_(NULL) { |
156 // Allow build-time customization of the max semispace size. Building | 155 // Allow build-time customization of the max semispace size. Building |
157 // V8 with snapshots and a non-default max semispace size is much | 156 // V8 with snapshots and a non-default max semispace size is much |
158 // easier if you can define it as part of the build environment. | 157 // easier if you can define it as part of the build environment. |
(...skipping 338 matching lines...) Loading... |
497 if (FLAG_trace_incremental_marking) { | 496 if (FLAG_trace_incremental_marking) { |
498 PrintF("[IncrementalMarking] Scavenge during marking.\n"); | 497 PrintF("[IncrementalMarking] Scavenge during marking.\n"); |
499 } | 498 } |
500 } | 499 } |
501 | 500 |
502 if (collector == MARK_COMPACTOR && | 501 if (collector == MARK_COMPACTOR && |
503 !mark_compact_collector()->abort_incremental_marking_ && | 502 !mark_compact_collector()->abort_incremental_marking_ && |
504 !incremental_marking()->IsStopped() && | 503 !incremental_marking()->IsStopped() && |
505 !incremental_marking()->should_hurry() && | 504 !incremental_marking()->should_hurry() && |
506 FLAG_incremental_marking_steps) { | 505 FLAG_incremental_marking_steps) { |
507 if (FLAG_trace_incremental_marking) { | 506 // Make progress in incremental marking. |
508 PrintF("[IncrementalMarking] Delaying MarkSweep.\n"); | 507 const intptr_t kStepSizeWhenDelayedByScavenge = 1 * MB; |
| 508 incremental_marking()->Step(kStepSizeWhenDelayedByScavenge, |
| 509 IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
| 510 if (!incremental_marking()->IsComplete()) { |
| 511 if (FLAG_trace_incremental_marking) { |
| 512 PrintF("[IncrementalMarking] Delaying MarkSweep.\n"); |
| 513 } |
| 514 collector = SCAVENGER; |
| 515 collector_reason = "incremental marking delaying mark-sweep"; |
509 } | 516 } |
510 collector = SCAVENGER; | |
511 collector_reason = "incremental marking delaying mark-sweep"; | |
512 } | 517 } |
513 | 518 |
514 bool next_gc_likely_to_collect_more = false; | 519 bool next_gc_likely_to_collect_more = false; |
515 | 520 |
516 { GCTracer tracer(this, gc_reason, collector_reason); | 521 { GCTracer tracer(this, gc_reason, collector_reason); |
517 GarbageCollectionPrologue(); | 522 GarbageCollectionPrologue(); |
518 // The GC count was incremented in the prologue. Tell the tracer about | 523 // The GC count was incremented in the prologue. Tell the tracer about |
519 // it. | 524 // it. |
520 tracer.set_gc_count(gc_count_); | 525 tracer.set_gc_count(gc_count_); |
521 | 526 |
(...skipping 4288 matching lines...) Loading... |
4810 void Heap::EnsureHeapIsIterable() { | 4815 void Heap::EnsureHeapIsIterable() { |
4811 ASSERT(IsAllocationAllowed()); | 4816 ASSERT(IsAllocationAllowed()); |
4812 if (!IsHeapIterable()) { | 4817 if (!IsHeapIterable()) { |
4813 CollectAllGarbage(kMakeHeapIterableMask, "Heap::EnsureHeapIsIterable"); | 4818 CollectAllGarbage(kMakeHeapIterableMask, "Heap::EnsureHeapIsIterable"); |
4814 } | 4819 } |
4815 ASSERT(IsHeapIterable()); | 4820 ASSERT(IsHeapIterable()); |
4816 } | 4821 } |
4817 | 4822 |
4818 | 4823 |
4819 void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) { | 4824 void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) { |
4820 // This flag prevents incremental marking from requesting GC via stack guard | 4825 incremental_marking()->Step(step_size, |
4821 idle_notification_will_schedule_next_gc_ = true; | 4826 IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
4822 incremental_marking()->Step(step_size); | |
4823 idle_notification_will_schedule_next_gc_ = false; | |
4824 | 4827 |
4825 if (incremental_marking()->IsComplete()) { | 4828 if (incremental_marking()->IsComplete()) { |
4826 bool uncommit = false; | 4829 bool uncommit = false; |
4827 if (gc_count_at_last_idle_gc_ == gc_count_) { | 4830 if (gc_count_at_last_idle_gc_ == gc_count_) { |
4828 // No GC since the last full GC, the mutator is probably not active. | 4831 // No GC since the last full GC, the mutator is probably not active. |
4829 isolate_->compilation_cache()->Clear(); | 4832 isolate_->compilation_cache()->Clear(); |
4830 uncommit = true; | 4833 uncommit = true; |
4831 } | 4834 } |
4832 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); | 4835 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); |
4833 gc_count_at_last_idle_gc_ = gc_count_; | 4836 gc_count_at_last_idle_gc_ = gc_count_; |
(...skipping 2143 matching lines...) Loading... |
6977 } else { | 6980 } else { |
6978 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. | 6981 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. |
6979 } | 6982 } |
6980 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = | 6983 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = |
6981 reinterpret_cast<Address>(p); | 6984 reinterpret_cast<Address>(p); |
6982 remembered_unmapped_pages_index_++; | 6985 remembered_unmapped_pages_index_++; |
6983 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; | 6986 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; |
6984 } | 6987 } |
6985 | 6988 |
6986 } } // namespace v8::internal | 6989 } } // namespace v8::internal |
OLD | NEW |