Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/thread_registry.h" | 5 #include "vm/thread_registry.h" |
| 6 | 6 |
| 7 #include "vm/compiler.h" | |
| 7 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
| 8 #include "vm/lockers.h" | 9 #include "vm/lockers.h" |
| 9 | 10 |
| 10 namespace dart { | 11 namespace dart { |
| 11 | 12 |
| 12 ThreadRegistry::~ThreadRegistry() { | 13 ThreadRegistry::~ThreadRegistry() { |
| 13 ReclaimTimelineBlocks(); | 14 ReclaimTimelineBlocks(); |
| 14 // Delete monitor. | 15 // Delete monitor. |
| 15 delete monitor_; | 16 delete monitor_; |
| 16 } | 17 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 30 remaining_ = CountScheduledLocked(); | 31 remaining_ = CountScheduledLocked(); |
| 31 Isolate* isolate = Isolate::Current(); | 32 Isolate* isolate = Isolate::Current(); |
| 32 // We only expect this method to be called from within the isolate itself. | 33 // We only expect this method to be called from within the isolate itself. |
| 33 ASSERT(isolate->thread_registry() == this); | 34 ASSERT(isolate->thread_registry() == this); |
| 34 // TODO(koda): Rename Thread::PrepareForGC and call it here? | 35 // TODO(koda): Rename Thread::PrepareForGC and call it here? |
| 35 --remaining_; // Exclude this thread from the count. | 36 --remaining_; // Exclude this thread from the count. |
| 36 // Ensure the main mutator will reach a safepoint (could be running Dart). | 37 // Ensure the main mutator will reach a safepoint (could be running Dart). |
| 37 if (!isolate->MutatorThreadIsCurrentThread()) { | 38 if (!isolate->MutatorThreadIsCurrentThread()) { |
| 38 isolate->ScheduleInterrupts(Isolate::kVMInterrupt); | 39 isolate->ScheduleInterrupts(Isolate::kVMInterrupt); |
| 39 } | 40 } |
| 41 if (isolate->compile_optimized_task() != NULL) { | |
| 42 // Make sure the task moves from Wait to a safepoint. | |
|
koda
2015/10/01 22:27:02
This should not be needed anymore, now that you en
srdjan
2015/10/01 23:11:24
Done.
| |
| 43 MonitorLocker ml_comp(isolate->compile_optimized_task()->monitor()); | |
| 44 ml_comp.Notify(); | |
| 45 } | |
| 40 while (remaining_ > 0) { | 46 while (remaining_ > 0) { |
| 41 ml.Wait(Monitor::kNoTimeout); | 47 ml.Wait(Monitor::kNoTimeout); |
| 42 } | 48 } |
| 43 } | 49 } |
| 44 | 50 |
| 45 | 51 |
| 46 void ThreadRegistry::ResumeAllThreads() { | 52 void ThreadRegistry::ResumeAllThreads() { |
| 47 MonitorLocker ml(monitor_); | 53 MonitorLocker ml(monitor_); |
| 48 ASSERT(in_rendezvous_); | 54 ASSERT(in_rendezvous_); |
| 49 in_rendezvous_ = false; | 55 in_rendezvous_ = false; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 for (int i = 0; i < entries_.length(); ++i) { | 199 for (int i = 0; i < entries_.length(); ++i) { |
| 194 const Entry& entry = entries_[i]; | 200 const Entry& entry = entries_[i]; |
| 195 if (entry.scheduled) { | 201 if (entry.scheduled) { |
| 196 ++count; | 202 ++count; |
| 197 } | 203 } |
| 198 } | 204 } |
| 199 return count; | 205 return count; |
| 200 } | 206 } |
| 201 | 207 |
| 202 } // namespace dart | 208 } // namespace dart |
| OLD | NEW |