| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 #endif | 152 #endif |
| 153 | 153 |
| 154 RawObject* raw_obj = *p; | 154 RawObject* raw_obj = *p; |
| 155 | 155 |
| 156 if (raw_obj->IsSmiOrOldObject()) { | 156 if (raw_obj->IsSmiOrOldObject()) { |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 | 159 |
| 160 uword raw_addr = RawObject::ToAddr(raw_obj); | 160 uword raw_addr = RawObject::ToAddr(raw_obj); |
| 161 // The scavenger is only interested in objects located in the from space. | 161 // The scavenger is only interested in objects located in the from space. |
| 162 if (scavenger_->to_->Contains(raw_addr)) { |
| 163 return; |
| 164 } |
| 162 ASSERT(from_->Contains(raw_addr)); | 165 ASSERT(from_->Contains(raw_addr)); |
| 163 // Read the header word of the object and determine if the object has | 166 // Read the header word of the object and determine if the object has |
| 164 // already been copied. | 167 // already been copied. |
| 165 uword header = *reinterpret_cast<uword*>(raw_addr); | 168 uword header = *reinterpret_cast<uword*>(raw_addr); |
| 166 uword new_addr = 0; | 169 uword new_addr = 0; |
| 167 if (IsForwarding(header)) { | 170 if (IsForwarding(header)) { |
| 168 // Get the new location of the object. | 171 // Get the new location of the object. |
| 169 new_addr = ForwardedAddr(header); | 172 new_addr = ForwardedAddr(header); |
| 170 } else { | 173 } else { |
| 171 if (raw_obj->IsWatched()) { | 174 if (raw_obj->IsWatched()) { |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 } | 896 } |
| 894 | 897 |
| 895 | 898 |
| 896 void Scavenger::FreeExternal(intptr_t size) { | 899 void Scavenger::FreeExternal(intptr_t size) { |
| 897 ASSERT(size >= 0); | 900 ASSERT(size >= 0); |
| 898 external_size_ -= size; | 901 external_size_ -= size; |
| 899 ASSERT(external_size_ >= 0); | 902 ASSERT(external_size_ >= 0); |
| 900 } | 903 } |
| 901 | 904 |
| 902 } // namespace dart | 905 } // namespace dart |
| OLD | NEW |