| 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/object.h" | 10 #include "vm/object.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 void UpdateStoreBuffer(RawObject** p, RawObject* obj) { | 63 void UpdateStoreBuffer(RawObject** p, RawObject* obj) { |
| 64 // TODO(iposva): Implement store buffers. | 64 // TODO(iposva): Implement store buffers. |
| 65 } | 65 } |
| 66 | 66 |
| 67 void ScavengePointer(RawObject** p) { | 67 void ScavengePointer(RawObject** p) { |
| 68 RawObject* raw_obj = *p; | 68 RawObject* raw_obj = *p; |
| 69 | 69 |
| 70 // Fast exit if the raw object is a Smi. | 70 // Fast exit if the raw object is a Smi or an old object. |
| 71 if (!raw_obj->IsHeapObject()) return; | 71 if (!raw_obj->IsHeapObject() || raw_obj->IsOldObject()) { |
| 72 return; |
| 73 } |
| 72 | 74 |
| 73 uword raw_addr = RawObject::ToAddr(raw_obj); | 75 uword raw_addr = RawObject::ToAddr(raw_obj); |
| 74 // Objects should be contained in the heap. | 76 // Objects should be contained in the heap. |
| 75 // TODO(iposva): Add an appropriate assert here or in the return block | 77 // TODO(iposva): Add an appropriate assert here or in the return block |
| 76 // below. | 78 // below. |
| 77 // The scavenger is only interested in objects located in the from space. | 79 // The scavenger is only interested in objects located in the from space. |
| 78 if (!scavenger_->from_->Contains(raw_addr)) { | 80 if (!scavenger_->from_->Contains(raw_addr)) { |
| 79 return; | 81 return; |
| 80 } | 82 } |
| 81 | 83 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 OS::PrintErr(" done.\n"); | 409 OS::PrintErr(" done.\n"); |
| 408 } | 410 } |
| 409 | 411 |
| 410 count_++; | 412 count_++; |
| 411 // Done scavenging. Reset the marker. | 413 // Done scavenging. Reset the marker. |
| 412 ASSERT(scavenging_); | 414 ASSERT(scavenging_); |
| 413 scavenging_ = false; | 415 scavenging_ = false; |
| 414 } | 416 } |
| 415 | 417 |
| 416 } // namespace dart | 418 } // namespace dart |
| OLD | NEW |