| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 void ScavengePointer(RawObject** p) { | 141 void ScavengePointer(RawObject** p) { |
| 142 // ScavengePointer cannot be called recursively. | 142 // ScavengePointer cannot be called recursively. |
| 143 #ifdef DEBUG | 143 #ifdef DEBUG |
| 144 ASSERT(!in_scavenge_pointer_); | 144 ASSERT(!in_scavenge_pointer_); |
| 145 BoolScope bs(&in_scavenge_pointer_, true); | 145 BoolScope bs(&in_scavenge_pointer_, true); |
| 146 #endif | 146 #endif |
| 147 | 147 |
| 148 RawObject* raw_obj = *p; | 148 RawObject* raw_obj = *p; |
| 149 | 149 |
| 150 // Fast exit if the raw object is a Smi or an old object. | 150 if (raw_obj->IsSmiOrOldObject()) { |
| 151 if (!raw_obj->IsHeapObject() || raw_obj->IsOldObject()) { | |
| 152 return; | 151 return; |
| 153 } | 152 } |
| 154 | 153 |
| 155 uword raw_addr = RawObject::ToAddr(raw_obj); | 154 uword raw_addr = RawObject::ToAddr(raw_obj); |
| 156 // Objects should be contained in the heap. | 155 // Objects should be contained in the heap. |
| 157 // TODO(iposva): Add an appropriate assert here or in the return block | 156 // TODO(iposva): Add an appropriate assert here or in the return block |
| 158 // below. | 157 // below. |
| 159 // The scavenger is only interested in objects located in the from space. | 158 // The scavenger is only interested in objects located in the from space. |
| 160 if (!scavenger_->from_->Contains(raw_addr)) { | 159 if (!scavenger_->from_->Contains(raw_addr)) { |
| 161 return; | 160 return; |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 } | 860 } |
| 862 | 861 |
| 863 | 862 |
| 864 void Scavenger::FreeExternal(intptr_t size) { | 863 void Scavenger::FreeExternal(intptr_t size) { |
| 865 ASSERT(size >= 0); | 864 ASSERT(size >= 0); |
| 866 external_size_ -= size; | 865 external_size_ -= size; |
| 867 ASSERT(external_size_ >= 0); | 866 ASSERT(external_size_ >= 0); |
| 868 } | 867 } |
| 869 | 868 |
| 870 } // namespace dart | 869 } // namespace dart |
| OLD | NEW |