Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(806)

Side by Side Diff: runtime/vm/thread_registry.cc

Issue 1386503002: Initial design for background compilation (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« runtime/vm/compiler.cc ('K') | « runtime/vm/isolate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« runtime/vm/compiler.cc ('K') | « runtime/vm/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698