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

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

Issue 3003063002: Fix the new generation growth criterion so it is not mislead into performing two growths in a row. (Closed)
Patch Set: speeling Created 3 years, 3 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
« no previous file with comments | « runtime/vm/scavenger.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 (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/scavenger.h" 5 #include "vm/scavenger.h"
6 6
7 #include "vm/dart.h" 7 #include "vm/dart.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/lockers.h" 10 #include "vm/lockers.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 Scavenger::~Scavenger() { 356 Scavenger::~Scavenger() {
357 ASSERT(!scavenging_); 357 ASSERT(!scavenging_);
358 to_->Delete(); 358 to_->Delete();
359 delete space_lock_; 359 delete space_lock_;
360 } 360 }
361 361
362 intptr_t Scavenger::NewSizeInWords(intptr_t old_size_in_words) const { 362 intptr_t Scavenger::NewSizeInWords(intptr_t old_size_in_words) const {
363 if (stats_history_.Size() == 0) { 363 if (stats_history_.Size() == 0) {
364 return old_size_in_words; 364 return old_size_in_words;
365 } 365 }
366 double garbage = stats_history_.Get(0).GarbageFraction(); 366 double garbage = stats_history_.Get(0).ExpectedGarbageFraction();
367 if (garbage < (FLAG_new_gen_garbage_threshold / 100.0)) { 367 if (garbage < (FLAG_new_gen_garbage_threshold / 100.0)) {
368 return Utils::Minimum(max_semi_capacity_in_words_, 368 return Utils::Minimum(max_semi_capacity_in_words_,
369 old_size_in_words * FLAG_new_gen_growth_factor); 369 old_size_in_words * FLAG_new_gen_growth_factor);
370 } else { 370 } else {
371 return old_size_in_words; 371 return old_size_in_words;
372 } 372 }
373 } 373 }
374 374
375 SemiSpace* Scavenger::Prologue(Isolate* isolate) { 375 SemiSpace* Scavenger::Prologue(Isolate* isolate) {
376 isolate->PrepareForGC(); 376 isolate->PrepareForGC();
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 return free_space >> kWordSizeLog2; 949 return free_space >> kWordSizeLog2;
950 } 950 }
951 951
952 int64_t Scavenger::UsedInWords() const { 952 int64_t Scavenger::UsedInWords() const {
953 int64_t free_space_in_tlab = FreeSpaceInWords(heap_->isolate()); 953 int64_t free_space_in_tlab = FreeSpaceInWords(heap_->isolate());
954 int64_t max_space_used = (top_ - FirstObjectStart()) >> kWordSizeLog2; 954 int64_t max_space_used = (top_ - FirstObjectStart()) >> kWordSizeLog2;
955 return max_space_used - free_space_in_tlab; 955 return max_space_used - free_space_in_tlab;
956 } 956 }
957 957
958 } // namespace dart 958 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scavenger.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698