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 #ifndef VM_THREAD_H_ | 5 #ifndef VM_THREAD_H_ |
6 #define VM_THREAD_H_ | 6 #define VM_THREAD_H_ |
7 | 7 |
8 #include "vm/base_isolate.h" | 8 #include "vm/base_isolate.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/os_thread.h" | 10 #include "vm/os_thread.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // Called at VM startup. | 49 // Called at VM startup. |
50 static void InitOnce(); | 50 static void InitOnce(); |
51 | 51 |
52 // The topmost zone used for allocation in this thread. | 52 // The topmost zone used for allocation in this thread. |
53 Zone* zone() { | 53 Zone* zone() { |
54 return reinterpret_cast<BaseIsolate*>(isolate())->current_zone(); | 54 return reinterpret_cast<BaseIsolate*>(isolate())->current_zone(); |
55 } | 55 } |
56 | 56 |
57 // The isolate that this thread is operating on, or NULL if none. | 57 // The isolate that this thread is operating on, or NULL if none. |
58 Isolate* isolate() const { return isolate_; } | 58 Isolate* isolate() const { return isolate_; } |
| 59 static intptr_t isolate_offset() { |
| 60 return OFFSET_OF(Thread, isolate_); |
| 61 } |
59 | 62 |
60 // The (topmost) CHA for the compilation in the isolate of this thread. | 63 // The (topmost) CHA for the compilation in the isolate of this thread. |
61 // TODO(23153): Move this out of Isolate/Thread. | 64 // TODO(23153): Move this out of Isolate/Thread. |
62 CHA* cha() const; | 65 CHA* cha() const; |
63 void set_cha(CHA* value); | 66 void set_cha(CHA* value); |
64 | 67 |
65 private: | 68 private: |
66 static ThreadLocalKey thread_key_; | 69 static ThreadLocalKey thread_key_; |
67 | 70 |
68 Isolate* isolate_; | 71 Isolate* isolate_; |
69 | 72 |
70 Thread() | 73 Thread() |
71 : isolate_(NULL) {} | 74 : isolate_(NULL) {} |
72 | 75 |
73 static void SetCurrent(Thread* current); | 76 static void SetCurrent(Thread* current); |
74 | 77 |
75 DISALLOW_COPY_AND_ASSIGN(Thread); | 78 DISALLOW_COPY_AND_ASSIGN(Thread); |
76 }; | 79 }; |
77 | 80 |
78 } // namespace dart | 81 } // namespace dart |
79 | 82 |
80 #endif // VM_THREAD_H_ | 83 #endif // VM_THREAD_H_ |
OLD | NEW |