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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 // Verify that current thread was set. | 86 // Verify that current thread was set. |
87 ASSERT(Thread::Current() == thread); | 87 ASSERT(Thread::Current() == thread); |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 | 91 |
92 #if defined(TARGET_OS_WINDOWS) | 92 #if defined(TARGET_OS_WINDOWS) |
93 void Thread::CleanUp() { | 93 void Thread::CleanUp() { |
94 Thread* current = Current(); | 94 Thread* current = Current(); |
95 if (current != NULL) { | 95 if (current != NULL) { |
96 SetCurrent(NULL); | |
96 delete current; | 97 delete current; |
Ivan Posva
2015/08/21 03:23:56
Are we sure the destructor will not touch anything
koda
2015/08/21 17:15:42
I can't guarantee it won't, but if it did, we'd al
| |
97 } | 98 } |
98 SetCurrent(NULL); | |
99 } | 99 } |
100 #endif | 100 #endif |
101 | 101 |
102 | 102 |
103 Thread::Thread(bool init_vm_constants) | 103 Thread::Thread(bool init_vm_constants) |
104 : id_(OSThread::GetCurrentThreadId()), | 104 : id_(OSThread::GetCurrentThreadId()), |
105 isolate_(NULL), | 105 isolate_(NULL), |
106 store_buffer_block_(NULL) { | 106 store_buffer_block_(NULL) { |
107 ClearState(); | 107 ClearState(); |
108 #define DEFAULT_INIT(type_name, member_name, init_expr, default_init_value) \ | 108 #define DEFAULT_INIT(type_name, member_name, init_expr, default_init_value) \ |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ | 317 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ |
318 ASSERT((expr)->IsVMHeapObject()); \ | 318 ASSERT((expr)->IsVMHeapObject()); \ |
319 if (object.raw() == expr) return Thread::member_name##offset(); | 319 if (object.raw() == expr) return Thread::member_name##offset(); |
320 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) | 320 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) |
321 #undef COMPUTE_OFFSET | 321 #undef COMPUTE_OFFSET |
322 UNREACHABLE(); | 322 UNREACHABLE(); |
323 return -1; | 323 return -1; |
324 } | 324 } |
325 | 325 |
326 } // namespace dart | 326 } // namespace dart |
OLD | NEW |