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 : StackResource(Thread::Current()), | 217 : StackResource(Thread::Current()), |
218 old_space_(isolate()->heap()->old_space()) { | 218 old_space_(isolate()->heap()->old_space()) { |
219 // It's not yet safe to iterate over a paged space while it's concurrently | 219 // It's not yet safe to iterate over a paged space while it's concurrently |
220 // sweeping, so wait for any such task to complete first. | 220 // sweeping, so wait for any such task to complete first. |
221 MonitorLocker ml(old_space_->tasks_lock()); | 221 MonitorLocker ml(old_space_->tasks_lock()); |
222 #if defined(DEBUG) | 222 #if defined(DEBUG) |
223 // We currently don't support nesting of HeapIterationScopes. | 223 // We currently don't support nesting of HeapIterationScopes. |
224 ASSERT(old_space_->iterating_thread_ != thread()); | 224 ASSERT(old_space_->iterating_thread_ != thread()); |
225 #endif | 225 #endif |
226 while (old_space_->tasks() > 0) { | 226 while (old_space_->tasks() > 0) { |
227 ml.Wait(); | 227 ml.WaitWithSafepointCheck(thread()); |
228 } | 228 } |
229 #if defined(DEBUG) | 229 #if defined(DEBUG) |
230 ASSERT(old_space_->iterating_thread_ == NULL); | 230 ASSERT(old_space_->iterating_thread_ == NULL); |
231 old_space_->iterating_thread_ = thread(); | 231 old_space_->iterating_thread_ = thread(); |
232 #endif | 232 #endif |
233 old_space_->set_tasks(1); | 233 old_space_->set_tasks(1); |
234 } | 234 } |
235 | 235 |
236 | 236 |
237 HeapIterationScope::~HeapIterationScope() { | 237 HeapIterationScope::~HeapIterationScope() { |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_); | 846 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_); |
847 } | 847 } |
848 | 848 |
849 | 849 |
850 WritableVMIsolateScope::~WritableVMIsolateScope() { | 850 WritableVMIsolateScope::~WritableVMIsolateScope() { |
851 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 851 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
852 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_); | 852 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_); |
853 } | 853 } |
854 | 854 |
855 } // namespace dart | 855 } // namespace dart |
OLD | NEW |