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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 DISALLOW_COPY_AND_ASSIGN(ScavengerVisitor); | 252 DISALLOW_COPY_AND_ASSIGN(ScavengerVisitor); |
253 }; | 253 }; |
254 | 254 |
255 | 255 |
256 class ScavengerWeakVisitor : public HandleVisitor { | 256 class ScavengerWeakVisitor : public HandleVisitor { |
257 public: | 257 public: |
258 // 'prologue_weak_were_strong' is currently only used for sanity checking. | 258 // 'prologue_weak_were_strong' is currently only used for sanity checking. |
259 explicit ScavengerWeakVisitor(Scavenger* scavenger, | 259 explicit ScavengerWeakVisitor(Scavenger* scavenger, |
260 bool prologue_weak_were_strong) | 260 bool prologue_weak_were_strong) |
261 : HandleVisitor(scavenger->heap_->isolate()), | 261 : HandleVisitor(Thread::Current()), |
262 scavenger_(scavenger), | 262 scavenger_(scavenger), |
263 prologue_weak_were_strong_(prologue_weak_were_strong) { | 263 prologue_weak_were_strong_(prologue_weak_were_strong) { |
| 264 ASSERT(scavenger->heap_->isolate() == Thread::Current()->isolate()); |
264 } | 265 } |
265 | 266 |
266 void VisitHandle(uword addr) { | 267 void VisitHandle(uword addr) { |
267 FinalizablePersistentHandle* handle = | 268 FinalizablePersistentHandle* handle = |
268 reinterpret_cast<FinalizablePersistentHandle*>(addr); | 269 reinterpret_cast<FinalizablePersistentHandle*>(addr); |
269 RawObject** p = handle->raw_addr(); | 270 RawObject** p = handle->raw_addr(); |
270 if (scavenger_->IsUnreachable(p)) { | 271 if (scavenger_->IsUnreachable(p)) { |
271 ASSERT(!handle->IsPrologueWeakPersistent() || | 272 ASSERT(!handle->IsPrologueWeakPersistent() || |
272 !prologue_weak_were_strong_); | 273 !prologue_weak_were_strong_); |
273 handle->UpdateUnreachable(isolate()); | 274 handle->UpdateUnreachable(thread()->isolate()); |
274 } else { | 275 } else { |
275 handle->UpdateRelocated(isolate()); | 276 handle->UpdateRelocated(thread()->isolate()); |
276 } | 277 } |
277 } | 278 } |
278 | 279 |
279 private: | 280 private: |
280 Scavenger* scavenger_; | 281 Scavenger* scavenger_; |
281 bool prologue_weak_were_strong_; | 282 bool prologue_weak_were_strong_; |
282 | 283 |
283 DISALLOW_COPY_AND_ASSIGN(ScavengerWeakVisitor); | 284 DISALLOW_COPY_AND_ASSIGN(ScavengerWeakVisitor); |
284 }; | 285 }; |
285 | 286 |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 } | 952 } |
952 | 953 |
953 | 954 |
954 void Scavenger::FreeExternal(intptr_t size) { | 955 void Scavenger::FreeExternal(intptr_t size) { |
955 ASSERT(size >= 0); | 956 ASSERT(size >= 0); |
956 external_size_ -= size; | 957 external_size_ -= size; |
957 ASSERT(external_size_ >= 0); | 958 ASSERT(external_size_ >= 0); |
958 } | 959 } |
959 | 960 |
960 } // namespace dart | 961 } // namespace dart |
OLD | NEW |