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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 ASSERT(thread != NULL); | 124 ASSERT(thread != NULL); |
125 ASSERT(thread->isolate() == NULL); | 125 ASSERT(thread->isolate() == NULL); |
126 ASSERT(!isolate->HasMutatorThread()); | 126 ASSERT(!isolate->HasMutatorThread()); |
127 thread->isolate_ = isolate; | 127 thread->isolate_ = isolate; |
128 isolate->MakeCurrentThreadMutator(thread); | 128 isolate->MakeCurrentThreadMutator(thread); |
129 // TODO(koda): Migrate thread_state_ and profile_data_ to Thread, to allow | 129 // TODO(koda): Migrate thread_state_ and profile_data_ to Thread, to allow |
130 // helper threads concurrent with mutator. | 130 // helper threads concurrent with mutator. |
131 ASSERT(isolate->thread_state() == NULL); | 131 ASSERT(isolate->thread_state() == NULL); |
132 InterruptableThreadState* thread_state = | 132 InterruptableThreadState* thread_state = |
133 ThreadInterrupter::GetCurrentThreadState(); | 133 ThreadInterrupter::GetCurrentThreadState(); |
134 #if defined(DEBUG) | 134 // TODO(koda): Calling Isolate::CheckForDuplicateThreadState(thread_state) |
135 Isolate::CheckForDuplicateThreadState(thread_state); | 135 // here can lead to deadlock. Evaluate doing this check some other way. |
136 #endif | |
137 ASSERT(thread_state != NULL); | 136 ASSERT(thread_state != NULL); |
138 Profiler::BeginExecution(isolate); | 137 Profiler::BeginExecution(isolate); |
139 isolate->set_thread_state(thread_state); | 138 isolate->set_thread_state(thread_state); |
140 isolate->set_vm_tag(VMTag::kVMTagId); | 139 isolate->set_vm_tag(VMTag::kVMTagId); |
141 ASSERT(thread->store_buffer_block_ == NULL); | 140 ASSERT(thread->store_buffer_block_ == NULL); |
142 thread->store_buffer_block_ = isolate->store_buffer()->PopBlock(); | 141 thread->store_buffer_block_ = isolate->store_buffer()->PopBlock(); |
143 ASSERT(isolate->heap() != NULL); | 142 ASSERT(isolate->heap() != NULL); |
144 thread->heap_ = isolate->heap(); | 143 thread->heap_ = isolate->heap(); |
145 thread->Schedule(isolate); | 144 thread->Schedule(isolate); |
146 } | 145 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ | 257 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ |
259 ASSERT((expr)->IsVMHeapObject()); \ | 258 ASSERT((expr)->IsVMHeapObject()); \ |
260 if (object.raw() == expr) return Thread::member_name##offset(); | 259 if (object.raw() == expr) return Thread::member_name##offset(); |
261 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) | 260 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) |
262 #undef COMPUTE_OFFSET | 261 #undef COMPUTE_OFFSET |
263 UNREACHABLE(); | 262 UNREACHABLE(); |
264 return -1; | 263 return -1; |
265 } | 264 } |
266 | 265 |
267 } // namespace dart | 266 } // namespace dart |
OLD | NEW |