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

Side by Side Diff: src/heap.cc

Issue 10699051: Merged r11900, r11901, r11904 into 3.11 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.11
Patch Set: Remove change of tools/merge-to-branch.sh 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 4995 matching lines...) Expand 10 before | Expand all | Expand 10 after
5006 gc_count_at_last_idle_gc_ = gc_count_; 5006 gc_count_at_last_idle_gc_ = gc_count_;
5007 if (uncommit) { 5007 if (uncommit) {
5008 new_space_.Shrink(); 5008 new_space_.Shrink();
5009 UncommitFromSpace(); 5009 UncommitFromSpace();
5010 } 5010 }
5011 } 5011 }
5012 } 5012 }
5013 5013
5014 5014
5015 bool Heap::IdleNotification(int hint) { 5015 bool Heap::IdleNotification(int hint) {
5016 // Hints greater than this value indicate that
5017 // the embedder is requesting a lot of GC work.
5016 const int kMaxHint = 1000; 5018 const int kMaxHint = 1000;
5019 // Minimal hint that allows to do full GC.
5020 const int kMinHintForFullGC = 100;
5017 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4; 5021 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4;
5018 // The size factor is in range [5..250]. The numbers here are chosen from 5022 // The size factor is in range [5..250]. The numbers here are chosen from
5019 // experiments. If you changes them, make sure to test with 5023 // experiments. If you changes them, make sure to test with
5020 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.* 5024 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.*
5021 intptr_t step_size = size_factor * IncrementalMarking::kAllocatedThreshold; 5025 intptr_t step_size = size_factor * IncrementalMarking::kAllocatedThreshold;
5022 5026
5023 if (contexts_disposed_ > 0) { 5027 if (contexts_disposed_ > 0) {
5024 if (hint >= kMaxHint) { 5028 if (hint >= kMaxHint) {
5025 // The embedder is requesting a lot of GC work after context disposal, 5029 // The embedder is requesting a lot of GC work after context disposal,
5026 // we age inline caches so that they don't keep objects from 5030 // we age inline caches so that they don't keep objects from
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
5074 StartIdleRound(); 5078 StartIdleRound();
5075 } else { 5079 } else {
5076 return true; 5080 return true;
5077 } 5081 }
5078 } 5082 }
5079 5083
5080 int new_mark_sweeps = ms_count_ - ms_count_at_last_idle_notification_; 5084 int new_mark_sweeps = ms_count_ - ms_count_at_last_idle_notification_;
5081 mark_sweeps_since_idle_round_started_ += new_mark_sweeps; 5085 mark_sweeps_since_idle_round_started_ += new_mark_sweeps;
5082 ms_count_at_last_idle_notification_ = ms_count_; 5086 ms_count_at_last_idle_notification_ = ms_count_;
5083 5087
5084 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { 5088 int remaining_mark_sweeps = kMaxMarkSweepsInIdleRound -
5089 mark_sweeps_since_idle_round_started_;
5090
5091 if (remaining_mark_sweeps <= 0) {
5085 FinishIdleRound(); 5092 FinishIdleRound();
5086 return true; 5093 return true;
5087 } 5094 }
5088 5095
5089 if (incremental_marking()->IsStopped()) { 5096 if (incremental_marking()->IsStopped()) {
5090 incremental_marking()->Start(); 5097 // If there are no more than two GCs left in this idle round and we are
5098 // allowed to do a full GC, then make those GCs full in order to compact
5099 // the code space.
5100 // TODO(ulan): Once we enable code compaction for incremental marking,
5101 // we can get rid of this special case and always start incremental marking.
5102 if (remaining_mark_sweeps <= 2 && hint >= kMinHintForFullGC) {
5103 CollectAllGarbage(kReduceMemoryFootprintMask,
5104 "idle notification: finalize idle round");
5105 } else {
5106 incremental_marking()->Start();
5107 }
5091 } 5108 }
5092 5109 if (!incremental_marking()->IsStopped()) {
5093 AdvanceIdleIncrementalMarking(step_size); 5110 AdvanceIdleIncrementalMarking(step_size);
5111 }
5094 return false; 5112 return false;
5095 } 5113 }
5096 5114
5097 5115
5098 bool Heap::IdleGlobalGC() { 5116 bool Heap::IdleGlobalGC() {
5099 static const int kIdlesBeforeScavenge = 4; 5117 static const int kIdlesBeforeScavenge = 4;
5100 static const int kIdlesBeforeMarkSweep = 7; 5118 static const int kIdlesBeforeMarkSweep = 7;
5101 static const int kIdlesBeforeMarkCompact = 8; 5119 static const int kIdlesBeforeMarkCompact = 8;
5102 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1; 5120 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1;
5103 static const unsigned int kGCsBetweenCleanup = 4; 5121 static const unsigned int kGCsBetweenCleanup = 4;
(...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after
7152 } else { 7170 } else {
7153 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. 7171 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died.
7154 } 7172 }
7155 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = 7173 remembered_unmapped_pages_[remembered_unmapped_pages_index_] =
7156 reinterpret_cast<Address>(p); 7174 reinterpret_cast<Address>(p);
7157 remembered_unmapped_pages_index_++; 7175 remembered_unmapped_pages_index_++;
7158 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; 7176 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages;
7159 } 7177 }
7160 7178
7161 } } // namespace v8::internal 7179 } } // 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