| 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 <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 | 189 |
| 190 class ScavengerWeakVisitor : public HandleVisitor { | 190 class ScavengerWeakVisitor : public HandleVisitor { |
| 191 public: | 191 public: |
| 192 explicit ScavengerWeakVisitor(Scavenger* scavenger) : scavenger_(scavenger) { | 192 explicit ScavengerWeakVisitor(Scavenger* scavenger) : scavenger_(scavenger) { |
| 193 } | 193 } |
| 194 | 194 |
| 195 void VisitHandle(uword addr) { | 195 void VisitHandle(uword addr) { |
| 196 FinalizablePersistentHandle* handle = | 196 FinalizablePersistentHandle* handle = |
| 197 reinterpret_cast<FinalizablePersistentHandle*>(addr); | 197 reinterpret_cast<FinalizablePersistentHandle*>(addr); |
| 198 RawObject** p = reinterpret_cast<RawObject**>(handle); | 198 RawObject** p = handle->raw_addr(); |
| 199 if (scavenger_->IsUnreachable(p)) { | 199 if (scavenger_->IsUnreachable(p)) { |
| 200 FinalizablePersistentHandle::Finalize(handle); | 200 FinalizablePersistentHandle::Finalize(handle); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 private: | 204 private: |
| 205 Scavenger* scavenger_; | 205 Scavenger* scavenger_; |
| 206 | 206 |
| 207 DISALLOW_COPY_AND_ASSIGN(ScavengerWeakVisitor); | 207 DISALLOW_COPY_AND_ASSIGN(ScavengerWeakVisitor); |
| 208 }; | 208 }; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 scavenging_ = false; | 583 scavenging_ = false; |
| 584 } | 584 } |
| 585 | 585 |
| 586 | 586 |
| 587 void Scavenger::WriteProtect(bool read_only) { | 587 void Scavenger::WriteProtect(bool read_only) { |
| 588 space_->Protect( | 588 space_->Protect( |
| 589 read_only ? VirtualMemory::kReadOnly : VirtualMemory::kReadWrite); | 589 read_only ? VirtualMemory::kReadOnly : VirtualMemory::kReadWrite); |
| 590 } | 590 } |
| 591 | 591 |
| 592 } // namespace dart | 592 } // namespace dart |
| OLD | NEW |