| 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, bool invoke_api_callbacks) { | 375 SemiSpace* Scavenger::Prologue(Isolate* isolate, bool invoke_api_callbacks) { |
| 376 if (invoke_api_callbacks && (isolate->gc_prologue_callback() != NULL)) { | 376 if (invoke_api_callbacks && (isolate->gc_prologue_callback() != NULL)) { |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 return free_space >> kWordSizeLog2; | 963 return free_space >> kWordSizeLog2; |
| 964 } | 964 } |
| 965 | 965 |
| 966 int64_t Scavenger::UsedInWords() const { | 966 int64_t Scavenger::UsedInWords() const { |
| 967 int64_t free_space_in_tlab = FreeSpaceInWords(heap_->isolate()); | 967 int64_t free_space_in_tlab = FreeSpaceInWords(heap_->isolate()); |
| 968 int64_t max_space_used = (top_ - FirstObjectStart()) >> kWordSizeLog2; | 968 int64_t max_space_used = (top_ - FirstObjectStart()) >> kWordSizeLog2; |
| 969 return max_space_used - free_space_in_tlab; | 969 return max_space_used - free_space_in_tlab; |
| 970 } | 970 } |
| 971 | 971 |
| 972 } // namespace dart | 972 } // namespace dart |
| OLD | NEW |