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

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

Issue 1279733003: Clean VM thread shutdown: (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge Created 5 years, 4 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
« no previous file with comments | « runtime/vm/service_isolate.cc ('k') | runtime/vm/thread_pool.h » ('j') | 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.h" 5 #include "vm/thread.h"
6 6
7 #include "vm/growable_array.h" 7 #include "vm/growable_array.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/lockers.h" 9 #include "vm/lockers.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 isolate->MakeCurrentThreadMutator(thread); 127 isolate->MakeCurrentThreadMutator(thread);
128 isolate->set_vm_tag(VMTag::kVMTagId); 128 isolate->set_vm_tag(VMTag::kVMTagId);
129 ASSERT(thread->store_buffer_block_ == NULL); 129 ASSERT(thread->store_buffer_block_ == NULL);
130 thread->store_buffer_block_ = isolate->store_buffer()->PopNonFullBlock(); 130 thread->store_buffer_block_ = isolate->store_buffer()->PopNonFullBlock();
131 ASSERT(isolate->heap() != NULL); 131 ASSERT(isolate->heap() != NULL);
132 thread->heap_ = isolate->heap(); 132 thread->heap_ = isolate->heap();
133 thread->Schedule(isolate); 133 thread->Schedule(isolate);
134 ASSERT(thread->thread_state() == NULL); 134 ASSERT(thread->thread_state() == NULL);
135 InterruptableThreadState* thread_state = 135 InterruptableThreadState* thread_state =
136 ThreadInterrupter::GetCurrentThreadState(); 136 ThreadInterrupter::GetCurrentThreadState();
137 #if defined(DEBUG) 137 // TODO(koda): Calling Isolate::CheckForDuplicateThreadState(thread_state)
138 thread->set_thread_state(NULL); // Exclude thread itself from the dupe check. 138 // here can lead to deadlock. Evaluate doing this check some other way.
139 Isolate::CheckForDuplicateThreadState(thread_state);
140 thread->set_thread_state(thread_state);
141 #endif
142 ASSERT(thread_state != NULL); 139 ASSERT(thread_state != NULL);
143 // TODO(koda): Migrate profiler interface to use Thread. 140 // TODO(koda): Migrate profiler interface to use Thread.
144 Profiler::BeginExecution(isolate); 141 Profiler::BeginExecution(isolate);
145 } 142 }
146 143
147 144
148 void Thread::ExitIsolate() { 145 void Thread::ExitIsolate() {
149 Thread* thread = Thread::Current(); 146 Thread* thread = Thread::Current();
150 // TODO(koda): Audit callers; they should know whether they're in an isolate. 147 // TODO(koda): Audit callers; they should know whether they're in an isolate.
151 if (thread == NULL || thread->isolate() == NULL) return; 148 if (thread == NULL || thread->isolate() == NULL) return;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ 256 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \
260 ASSERT((expr)->IsVMHeapObject()); \ 257 ASSERT((expr)->IsVMHeapObject()); \
261 if (object.raw() == expr) return Thread::member_name##offset(); 258 if (object.raw() == expr) return Thread::member_name##offset();
262 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) 259 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET)
263 #undef COMPUTE_OFFSET 260 #undef COMPUTE_OFFSET
264 UNREACHABLE(); 261 UNREACHABLE();
265 return -1; 262 return -1;
266 } 263 }
267 264
268 } // namespace dart 265 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service_isolate.cc ('k') | runtime/vm/thread_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698