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

Side by Side Diff: runtime/vm/pages.cc

Issue 2998473002: [vm] Revert changes related to triggering the 1st GC (Closed)
Patch Set: Created 3 years, 4 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
« runtime/vm/isolate.h ('K') | « runtime/vm/isolate.cc ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/pages.h" 5 #include "vm/pages.h"
6 6
7 #include "platform/address_sanitizer.h" 7 #include "platform/address_sanitizer.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/compiler_stats.h" 9 #include "vm/compiler_stats.h"
10 #include "vm/gc_marker.h" 10 #include "vm/gc_marker.h"
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 intptr_t capacity_increase_in_words = 1142 intptr_t capacity_increase_in_words =
1143 after.capacity_in_words - last_usage_.capacity_in_words; 1143 after.capacity_in_words - last_usage_.capacity_in_words;
1144 // The concurrent sweeper might have freed more capacity than was allocated. 1144 // The concurrent sweeper might have freed more capacity than was allocated.
1145 capacity_increase_in_words = 1145 capacity_increase_in_words =
1146 Utils::Maximum<intptr_t>(0, capacity_increase_in_words); 1146 Utils::Maximum<intptr_t>(0, capacity_increase_in_words);
1147 capacity_increase_in_words = 1147 capacity_increase_in_words =
1148 Utils::RoundUp(capacity_increase_in_words, PageSpace::kPageSizeInWords); 1148 Utils::RoundUp(capacity_increase_in_words, PageSpace::kPageSizeInWords);
1149 intptr_t capacity_increase_in_pages = 1149 intptr_t capacity_increase_in_pages =
1150 capacity_increase_in_words / PageSpace::kPageSizeInWords; 1150 capacity_increase_in_words / PageSpace::kPageSizeInWords;
1151 double multiplier = 1.0; 1151 double multiplier = 1.0;
1152 #if !defined(PRODUCT)
1153 // To avoid waste, the first GC should be triggered before too long. After 1152 // To avoid waste, the first GC should be triggered before too long. After
1154 // kInitialTimeoutSeconds, gradually lower the capacity limit. 1153 // kInitialTimeoutSeconds, gradually lower the capacity limit.
1155 static const double kInitialTimeoutSeconds = 1.00; 1154 static const double kInitialTimeoutSeconds = 1.00;
1156 if (history_.IsEmpty()) { 1155 if (history_.IsEmpty()) {
1157 double seconds_since_init = 1156 double seconds_since_init =
1158 MicrosecondsToSeconds(heap_->isolate()->UptimeMicros()); 1157 MicrosecondsToSeconds(heap_->isolate()->UptimeMicros());
1159 if (seconds_since_init > kInitialTimeoutSeconds) { 1158 if (seconds_since_init > kInitialTimeoutSeconds) {
1160 multiplier *= seconds_since_init / kInitialTimeoutSeconds; 1159 multiplier *= seconds_since_init / kInitialTimeoutSeconds;
1161 } 1160 }
1162 } 1161 }
1163 #endif // !defined(PRODUCT)
1164 bool needs_gc = capacity_increase_in_pages * multiplier > grow_heap_; 1162 bool needs_gc = capacity_increase_in_pages * multiplier > grow_heap_;
1165 if (FLAG_log_growth) { 1163 if (FLAG_log_growth) {
1166 OS::PrintErr("%s: %" Pd " * %f %s %" Pd "\n", 1164 OS::PrintErr("%s: %" Pd " * %f %s %" Pd "\n",
1167 needs_gc ? "NEEDS GC" : "grow", capacity_increase_in_pages, 1165 needs_gc ? "NEEDS GC" : "grow", capacity_increase_in_pages,
1168 multiplier, needs_gc ? ">" : "<=", grow_heap_); 1166 multiplier, needs_gc ? ">" : "<=", grow_heap_);
1169 } 1167 }
1170 return needs_gc; 1168 return needs_gc;
1171 } 1169 }
1172 1170
1173 void PageSpaceController::EvaluateGarbageCollection(SpaceUsage before, 1171 void PageSpaceController::EvaluateGarbageCollection(SpaceUsage before,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 return 0; 1272 return 0;
1275 } else { 1273 } else {
1276 ASSERT(total_time >= gc_time); 1274 ASSERT(total_time >= gc_time);
1277 int result = static_cast<int>( 1275 int result = static_cast<int>(
1278 (static_cast<double>(gc_time) / static_cast<double>(total_time)) * 100); 1276 (static_cast<double>(gc_time) / static_cast<double>(total_time)) * 100);
1279 return result; 1277 return result;
1280 } 1278 }
1281 } 1279 }
1282 1280
1283 } // namespace dart 1281 } // namespace dart
OLDNEW
« runtime/vm/isolate.h ('K') | « runtime/vm/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698