| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/heap.h" | 5 #include "vm/heap.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 | 218 |
| 219 | 219 |
| 220 void Heap::VisitObjects(ObjectVisitor* visitor) const { | 220 void Heap::VisitObjects(ObjectVisitor* visitor) const { |
| 221 new_space_.VisitObjects(visitor); | 221 new_space_.VisitObjects(visitor); |
| 222 old_space_.VisitObjects(visitor); | 222 old_space_.VisitObjects(visitor); |
| 223 } | 223 } |
| 224 | 224 |
| 225 | 225 |
| 226 HeapIterationScope::HeapIterationScope() | 226 HeapIterationScope::HeapIterationScope() |
| 227 : StackResource(Thread::Current()->isolate()), | 227 : StackResource(Thread::Current()), |
| 228 old_space_(isolate()->heap()->old_space()) { | 228 old_space_(isolate()->heap()->old_space()) { |
| 229 // It's not yet safe to iterate over a paged space while it's concurrently | 229 // It's not yet safe to iterate over a paged space while it's concurrently |
| 230 // sweeping, so wait for any such task to complete first. | 230 // sweeping, so wait for any such task to complete first. |
| 231 MonitorLocker ml(old_space_->tasks_lock()); | 231 MonitorLocker ml(old_space_->tasks_lock()); |
| 232 #if defined(DEBUG) | 232 #if defined(DEBUG) |
| 233 // We currently don't support nesting of HeapIterationScopes. | 233 // We currently don't support nesting of HeapIterationScopes. |
| 234 ASSERT(!old_space_->is_iterating_); | 234 ASSERT(!old_space_->is_iterating_); |
| 235 old_space_->is_iterating_ = true; | 235 old_space_->is_iterating_ = true; |
| 236 #endif | 236 #endif |
| 237 while (old_space_->tasks() > 0) { | 237 while (old_space_->tasks() > 0) { |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 heap->DisableGrowthControl(); | 785 heap->DisableGrowthControl(); |
| 786 } | 786 } |
| 787 | 787 |
| 788 | 788 |
| 789 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { | 789 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { |
| 790 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); | 790 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
| 791 heap->SetGrowthControlState(current_growth_controller_state_); | 791 heap->SetGrowthControlState(current_growth_controller_state_); |
| 792 } | 792 } |
| 793 | 793 |
| 794 } // namespace dart | 794 } // namespace dart |
| OLD | NEW |