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

Side by Side Diff: src/heap.cc

Issue 10702059: Merged r11900, r11901, r11904 into 3.10 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.10
Patch Set: Fix presubmit Created 8 years, 5 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 | « no previous file | src/mark-compact.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 4977 matching lines...) Expand 10 before | Expand all | Expand 10 after
4988 gc_count_at_last_idle_gc_ = gc_count_; 4988 gc_count_at_last_idle_gc_ = gc_count_;
4989 if (uncommit) { 4989 if (uncommit) {
4990 new_space_.Shrink(); 4990 new_space_.Shrink();
4991 UncommitFromSpace(); 4991 UncommitFromSpace();
4992 } 4992 }
4993 } 4993 }
4994 } 4994 }
4995 4995
4996 4996
4997 bool Heap::IdleNotification(int hint) { 4997 bool Heap::IdleNotification(int hint) {
4998 // Hints greater than this value indicate that
4999 // the embedder is requesting a lot of GC work.
4998 const int kMaxHint = 1000; 5000 const int kMaxHint = 1000;
5001 // Minimal hint that allows to do full GC.
5002 const int kMinHintForFullGC = 100;
4999 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4; 5003 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4;
5000 // The size factor is in range [5..250]. The numbers here are chosen from 5004 // The size factor is in range [5..250]. The numbers here are chosen from
5001 // experiments. If you changes them, make sure to test with 5005 // experiments. If you changes them, make sure to test with
5002 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.* 5006 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.*
5003 intptr_t step_size = size_factor * IncrementalMarking::kAllocatedThreshold; 5007 intptr_t step_size = size_factor * IncrementalMarking::kAllocatedThreshold;
5004 5008
5005 if (contexts_disposed_ > 0) { 5009 if (contexts_disposed_ > 0) {
5006 if (hint >= kMaxHint) { 5010 if (hint >= kMaxHint) {
5007 // The embedder is requesting a lot of GC work after context disposal, 5011 // The embedder is requesting a lot of GC work after context disposal,
5008 // we age inline caches so that they don't keep objects from 5012 // we age inline caches so that they don't keep objects from
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
5056 StartIdleRound(); 5060 StartIdleRound();
5057 } else { 5061 } else {
5058 return true; 5062 return true;
5059 } 5063 }
5060 } 5064 }
5061 5065
5062 int new_mark_sweeps = ms_count_ - ms_count_at_last_idle_notification_; 5066 int new_mark_sweeps = ms_count_ - ms_count_at_last_idle_notification_;
5063 mark_sweeps_since_idle_round_started_ += new_mark_sweeps; 5067 mark_sweeps_since_idle_round_started_ += new_mark_sweeps;
5064 ms_count_at_last_idle_notification_ = ms_count_; 5068 ms_count_at_last_idle_notification_ = ms_count_;
5065 5069
5066 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { 5070 int remaining_mark_sweeps = kMaxMarkSweepsInIdleRound -
5071 mark_sweeps_since_idle_round_started_;
5072
5073 if (remaining_mark_sweeps <= 0) {
5067 FinishIdleRound(); 5074 FinishIdleRound();
5068 return true; 5075 return true;
5069 } 5076 }
5070 5077
5071 if (incremental_marking()->IsStopped()) { 5078 if (incremental_marking()->IsStopped()) {
5072 incremental_marking()->Start(); 5079 // If there are no more than two GCs left in this idle round and we are
5080 // allowed to do a full GC, then make those GCs full in order to compact
5081 // the code space.
5082 // TODO(ulan): Once we enable code compaction for incremental marking,
5083 // we can get rid of this special case and always start incremental marking.
5084 if (remaining_mark_sweeps <= 2 && hint >= kMinHintForFullGC) {
5085 CollectAllGarbage(kReduceMemoryFootprintMask,
5086 "idle notification: finalize idle round");
5087 } else {
5088 incremental_marking()->Start();
5089 }
5073 } 5090 }
5074 5091 if (!incremental_marking()->IsStopped()) {
5075 AdvanceIdleIncrementalMarking(step_size); 5092 AdvanceIdleIncrementalMarking(step_size);
5093 }
5076 return false; 5094 return false;
5077 } 5095 }
5078 5096
5079 5097
5080 bool Heap::IdleGlobalGC() { 5098 bool Heap::IdleGlobalGC() {
5081 static const int kIdlesBeforeScavenge = 4; 5099 static const int kIdlesBeforeScavenge = 4;
5082 static const int kIdlesBeforeMarkSweep = 7; 5100 static const int kIdlesBeforeMarkSweep = 7;
5083 static const int kIdlesBeforeMarkCompact = 8; 5101 static const int kIdlesBeforeMarkCompact = 8;
5084 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1; 5102 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1;
5085 static const unsigned int kGCsBetweenCleanup = 4; 5103 static const unsigned int kGCsBetweenCleanup = 4;
(...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after
7144 } else { 7162 } else {
7145 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. 7163 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died.
7146 } 7164 }
7147 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = 7165 remembered_unmapped_pages_[remembered_unmapped_pages_index_] =
7148 reinterpret_cast<Address>(p); 7166 reinterpret_cast<Address>(p);
7149 remembered_unmapped_pages_index_++; 7167 remembered_unmapped_pages_index_++;
7150 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; 7168 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages;
7151 } 7169 }
7152 7170
7153 } } // namespace v8::internal 7171 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698