| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // to space. | 198 // to space. |
| 199 new_addr = scavenger_->TryAllocate(size); | 199 new_addr = scavenger_->TryAllocate(size); |
| 200 class_table->UpdateLiveNew(cid, size); | 200 class_table->UpdateLiveNew(cid, size); |
| 201 } else { | 201 } else { |
| 202 // TODO(iposva): Experiment with less aggressive promotion. For example | 202 // TODO(iposva): Experiment with less aggressive promotion. For example |
| 203 // a coin toss determines if an object is promoted or whether it should | 203 // a coin toss determines if an object is promoted or whether it should |
| 204 // survive in this generation. | 204 // survive in this generation. |
| 205 // | 205 // |
| 206 // This object is a survivor of a previous scavenge. Attempt to promote | 206 // This object is a survivor of a previous scavenge. Attempt to promote |
| 207 // the object. | 207 // the object. |
| 208 new_addr = page_space_->TryAllocateDataLocked(size, | 208 new_addr = |
| 209 PageSpace::kForceGrowth); | 209 page_space_->TryAllocatePromoLocked(size, PageSpace::kForceGrowth); |
| 210 if (new_addr != 0) { | 210 if (new_addr != 0) { |
| 211 // If promotion succeeded then we need to remember it so that it can | 211 // If promotion succeeded then we need to remember it so that it can |
| 212 // be traversed later. | 212 // be traversed later. |
| 213 scavenger_->PushToPromotedStack(new_addr); | 213 scavenger_->PushToPromotedStack(new_addr); |
| 214 bytes_promoted_ += size; | 214 bytes_promoted_ += size; |
| 215 class_table->UpdateAllocatedOld(cid, size); | 215 class_table->UpdateAllocatedOld(cid, size); |
| 216 } else { | 216 } else { |
| 217 // Promotion did not succeed. Copy into the to space instead. | 217 // Promotion did not succeed. Copy into the to space instead. |
| 218 new_addr = scavenger_->TryAllocate(size); | 218 new_addr = scavenger_->TryAllocate(size); |
| 219 class_table->UpdateLiveNew(cid, size); | 219 class_table->UpdateLiveNew(cid, size); |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 } | 887 } |
| 888 | 888 |
| 889 | 889 |
| 890 void Scavenger::FreeExternal(intptr_t size) { | 890 void Scavenger::FreeExternal(intptr_t size) { |
| 891 ASSERT(size >= 0); | 891 ASSERT(size >= 0); |
| 892 external_size_ -= size; | 892 external_size_ -= size; |
| 893 ASSERT(external_size_ >= 0); | 893 ASSERT(external_size_ >= 0); |
| 894 } | 894 } |
| 895 | 895 |
| 896 } // namespace dart | 896 } // namespace dart |
| OLD | NEW |