| 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.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 Loading... |
| 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 // TODO(koda): Calling Isolate::CheckForDuplicateThreadState(thread_state) | 137 #if defined(DEBUG) |
| 138 // here can lead to deadlock. Evaluate doing this check some other way. | 138 thread->set_thread_state(NULL); // Exclude thread itself from the dupe check. |
| 139 Isolate::CheckForDuplicateThreadState(thread_state); |
| 140 thread->set_thread_state(thread_state); |
| 141 #endif |
| 139 ASSERT(thread_state != NULL); | 142 ASSERT(thread_state != NULL); |
| 140 // TODO(koda): Migrate profiler interface to use Thread. | 143 // TODO(koda): Migrate profiler interface to use Thread. |
| 141 Profiler::BeginExecution(isolate); | 144 Profiler::BeginExecution(isolate); |
| 142 } | 145 } |
| 143 | 146 |
| 144 | 147 |
| 145 void Thread::ExitIsolate() { | 148 void Thread::ExitIsolate() { |
| 146 Thread* thread = Thread::Current(); | 149 Thread* thread = Thread::Current(); |
| 147 // TODO(koda): Audit callers; they should know whether they're in an isolate. | 150 // TODO(koda): Audit callers; they should know whether they're in an isolate. |
| 148 if (thread == NULL || thread->isolate() == NULL) return; | 151 if (thread == NULL || thread->isolate() == NULL) return; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ | 259 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ |
| 257 ASSERT((expr)->IsVMHeapObject()); \ | 260 ASSERT((expr)->IsVMHeapObject()); \ |
| 258 if (object.raw() == expr) return Thread::member_name##offset(); | 261 if (object.raw() == expr) return Thread::member_name##offset(); |
| 259 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) | 262 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) |
| 260 #undef COMPUTE_OFFSET | 263 #undef COMPUTE_OFFSET |
| 261 UNREACHABLE(); | 264 UNREACHABLE(); |
| 262 return -1; | 265 return -1; |
| 263 } | 266 } |
| 264 | 267 |
| 265 } // namespace dart | 268 } // namespace dart |
| OLD | NEW |