| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 class ScavengerWeakVisitor : public HandleVisitor { | 272 class ScavengerWeakVisitor : public HandleVisitor { |
| 273 public: | 273 public: |
| 274 // 'prologue_weak_were_strong' is currently only used for sanity checking. | 274 // 'prologue_weak_were_strong' is currently only used for sanity checking. |
| 275 explicit ScavengerWeakVisitor(Scavenger* scavenger, | 275 explicit ScavengerWeakVisitor(Scavenger* scavenger, |
| 276 bool prologue_weak_were_strong) | 276 bool prologue_weak_were_strong) |
| 277 : HandleVisitor(Isolate::Current()), | 277 : HandleVisitor(Isolate::Current()), |
| 278 scavenger_(scavenger), | 278 scavenger_(scavenger), |
| 279 prologue_weak_were_strong_(prologue_weak_were_strong) { | 279 prologue_weak_were_strong_(prologue_weak_were_strong) { |
| 280 } | 280 } |
| 281 | 281 |
| 282 void VisitHandle(uword addr, bool is_prologue_weak) { | 282 void VisitHandle(uword addr) { |
| 283 FinalizablePersistentHandle* handle = | 283 FinalizablePersistentHandle* handle = |
| 284 reinterpret_cast<FinalizablePersistentHandle*>(addr); | 284 reinterpret_cast<FinalizablePersistentHandle*>(addr); |
| 285 RawObject** p = handle->raw_addr(); | 285 RawObject** p = handle->raw_addr(); |
| 286 if (scavenger_->IsUnreachable(p)) { | 286 if (scavenger_->IsUnreachable(p)) { |
| 287 ASSERT(!is_prologue_weak || !prologue_weak_were_strong_); | 287 ASSERT(!handle->IsPrologueWeakPersistent() || |
| 288 handle->UpdateUnreachable(isolate(), is_prologue_weak); | 288 !prologue_weak_were_strong_); |
| 289 handle->UpdateUnreachable(isolate()); |
| 289 } else { | 290 } else { |
| 290 handle->UpdateRelocated(isolate()); | 291 handle->UpdateRelocated(isolate()); |
| 291 } | 292 } |
| 292 } | 293 } |
| 293 | 294 |
| 294 private: | 295 private: |
| 295 Scavenger* scavenger_; | 296 Scavenger* scavenger_; |
| 296 bool prologue_weak_were_strong_; | 297 bool prologue_weak_were_strong_; |
| 297 | 298 |
| 298 DISALLOW_COPY_AND_ASSIGN(ScavengerWeakVisitor); | 299 DISALLOW_COPY_AND_ASSIGN(ScavengerWeakVisitor); |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 | 780 |
| 780 | 781 |
| 781 void Scavenger::FreeExternal(intptr_t size) { | 782 void Scavenger::FreeExternal(intptr_t size) { |
| 782 ASSERT(size >= 0); | 783 ASSERT(size >= 0); |
| 783 external_size_ -= size; | 784 external_size_ -= size; |
| 784 ASSERT(external_size_ >= 0); | 785 ASSERT(external_size_ >= 0); |
| 785 end_ = Utils::Minimum(to_->end(), end_ + size); | 786 end_ = Utils::Minimum(to_->end(), end_ + size); |
| 786 } | 787 } |
| 787 | 788 |
| 788 } // namespace dart | 789 } // namespace dart |
| OLD | NEW |