OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |