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

Side by Side Diff: src/heap.cc

Issue 15864010: Revert "Make more GCs in idle notification handler." because of performance (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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/heap.h ('k') | no next file » | 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 last_gc_end_timestamp_(0.0), 144 last_gc_end_timestamp_(0.0),
145 marking_time_(0.0), 145 marking_time_(0.0),
146 sweeping_time_(0.0), 146 sweeping_time_(0.0),
147 store_buffer_(this), 147 store_buffer_(this),
148 marking_(this), 148 marking_(this),
149 incremental_marking_(this), 149 incremental_marking_(this),
150 number_idle_notifications_(0), 150 number_idle_notifications_(0),
151 last_idle_notification_gc_count_(0), 151 last_idle_notification_gc_count_(0),
152 last_idle_notification_gc_count_init_(false), 152 last_idle_notification_gc_count_init_(false),
153 mark_sweeps_since_idle_round_started_(0), 153 mark_sweeps_since_idle_round_started_(0),
154 ms_count_at_last_idle_notification_(0),
154 gc_count_at_last_idle_gc_(0), 155 gc_count_at_last_idle_gc_(0),
155 scavenges_since_last_idle_round_(kIdleScavengeThreshold), 156 scavenges_since_last_idle_round_(kIdleScavengeThreshold),
156 gcs_since_last_deopt_(0), 157 gcs_since_last_deopt_(0),
157 #ifdef VERIFY_HEAP 158 #ifdef VERIFY_HEAP
158 no_weak_embedded_maps_verification_scope_depth_(0), 159 no_weak_embedded_maps_verification_scope_depth_(0),
159 #endif 160 #endif
160 promotion_queue_(this), 161 promotion_queue_(this),
161 configured_(false), 162 configured_(false),
162 chunks_queued_for_free_(NULL), 163 chunks_queued_for_free_(NULL),
163 relocation_mutex_(NULL) { 164 relocation_mutex_(NULL) {
(...skipping 5536 matching lines...) Expand 10 before | Expand all | Expand 10 after
5700 IncrementalMarking::NO_GC_VIA_STACK_GUARD); 5701 IncrementalMarking::NO_GC_VIA_STACK_GUARD);
5701 5702
5702 if (incremental_marking()->IsComplete()) { 5703 if (incremental_marking()->IsComplete()) {
5703 bool uncommit = false; 5704 bool uncommit = false;
5704 if (gc_count_at_last_idle_gc_ == gc_count_) { 5705 if (gc_count_at_last_idle_gc_ == gc_count_) {
5705 // No GC since the last full GC, the mutator is probably not active. 5706 // No GC since the last full GC, the mutator is probably not active.
5706 isolate_->compilation_cache()->Clear(); 5707 isolate_->compilation_cache()->Clear();
5707 uncommit = true; 5708 uncommit = true;
5708 } 5709 }
5709 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); 5710 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental");
5710 mark_sweeps_since_idle_round_started_++;
5711 gc_count_at_last_idle_gc_ = gc_count_; 5711 gc_count_at_last_idle_gc_ = gc_count_;
5712 if (uncommit) { 5712 if (uncommit) {
5713 new_space_.Shrink(); 5713 new_space_.Shrink();
5714 UncommitFromSpace(); 5714 UncommitFromSpace();
5715 } 5715 }
5716 } 5716 }
5717 } 5717 }
5718 5718
5719 5719
5720 bool Heap::IdleNotification(int hint) { 5720 bool Heap::IdleNotification(int hint) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
5776 } 5776 }
5777 5777
5778 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { 5778 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) {
5779 if (EnoughGarbageSinceLastIdleRound()) { 5779 if (EnoughGarbageSinceLastIdleRound()) {
5780 StartIdleRound(); 5780 StartIdleRound();
5781 } else { 5781 } else {
5782 return true; 5782 return true;
5783 } 5783 }
5784 } 5784 }
5785 5785
5786 int new_mark_sweeps = ms_count_ - ms_count_at_last_idle_notification_;
5787 mark_sweeps_since_idle_round_started_ += new_mark_sweeps;
5788 ms_count_at_last_idle_notification_ = ms_count_;
5789
5786 int remaining_mark_sweeps = kMaxMarkSweepsInIdleRound - 5790 int remaining_mark_sweeps = kMaxMarkSweepsInIdleRound -
5787 mark_sweeps_since_idle_round_started_; 5791 mark_sweeps_since_idle_round_started_;
5788 5792
5793 if (remaining_mark_sweeps <= 0) {
5794 FinishIdleRound();
5795 return true;
5796 }
5797
5789 if (incremental_marking()->IsStopped()) { 5798 if (incremental_marking()->IsStopped()) {
5790 // If there are no more than two GCs left in this idle round and we are 5799 // If there are no more than two GCs left in this idle round and we are
5791 // allowed to do a full GC, then make those GCs full in order to compact 5800 // allowed to do a full GC, then make those GCs full in order to compact
5792 // the code space. 5801 // the code space.
5793 // TODO(ulan): Once we enable code compaction for incremental marking, 5802 // TODO(ulan): Once we enable code compaction for incremental marking,
5794 // we can get rid of this special case and always start incremental marking. 5803 // we can get rid of this special case and always start incremental marking.
5795 if (remaining_mark_sweeps <= 2 && hint >= kMinHintForFullGC) { 5804 if (remaining_mark_sweeps <= 2 && hint >= kMinHintForFullGC) {
5796 CollectAllGarbage(kReduceMemoryFootprintMask, 5805 CollectAllGarbage(kReduceMemoryFootprintMask,
5797 "idle notification: finalize idle round"); 5806 "idle notification: finalize idle round");
5798 mark_sweeps_since_idle_round_started_++;
5799 } else { 5807 } else {
5800 incremental_marking()->Start(); 5808 incremental_marking()->Start();
5801 } 5809 }
5802 } 5810 }
5803 if (!incremental_marking()->IsStopped()) { 5811 if (!incremental_marking()->IsStopped()) {
5804 AdvanceIdleIncrementalMarking(step_size); 5812 AdvanceIdleIncrementalMarking(step_size);
5805 } 5813 }
5806
5807 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) {
5808 FinishIdleRound();
5809 return true;
5810 }
5811
5812 return false; 5814 return false;
5813 } 5815 }
5814 5816
5815 5817
5816 bool Heap::IdleGlobalGC() { 5818 bool Heap::IdleGlobalGC() {
5817 static const int kIdlesBeforeScavenge = 4; 5819 static const int kIdlesBeforeScavenge = 4;
5818 static const int kIdlesBeforeMarkSweep = 7; 5820 static const int kIdlesBeforeMarkSweep = 7;
5819 static const int kIdlesBeforeMarkCompact = 8; 5821 static const int kIdlesBeforeMarkCompact = 8;
5820 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1; 5822 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1;
5821 static const unsigned int kGCsBetweenCleanup = 4; 5823 static const unsigned int kGCsBetweenCleanup = 4;
(...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after
7887 if (FLAG_parallel_recompilation) { 7889 if (FLAG_parallel_recompilation) {
7888 heap_->relocation_mutex_->Lock(); 7890 heap_->relocation_mutex_->Lock();
7889 #ifdef DEBUG 7891 #ifdef DEBUG
7890 heap_->relocation_mutex_locked_by_optimizer_thread_ = 7892 heap_->relocation_mutex_locked_by_optimizer_thread_ =
7891 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 7893 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
7892 #endif // DEBUG 7894 #endif // DEBUG
7893 } 7895 }
7894 } 7896 }
7895 7897
7896 } } // namespace v8::internal 7898 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698