OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 bool terminate_on_restore() { return terminate_on_restore_; } | 50 bool terminate_on_restore() { return terminate_on_restore_; } |
51 void set_terminate_on_restore(bool terminate_on_restore) { | 51 void set_terminate_on_restore(bool terminate_on_restore) { |
52 terminate_on_restore_ = terminate_on_restore; | 52 terminate_on_restore_ = terminate_on_restore; |
53 } | 53 } |
54 | 54 |
55 // Get data area for archiving a thread. | 55 // Get data area for archiving a thread. |
56 char* data() { return data_; } | 56 char* data() { return data_; } |
57 | 57 |
58 private: | 58 private: |
59 explicit ThreadState(ThreadManager* thread_manager); | 59 explicit ThreadState(ThreadManager* thread_manager); |
| 60 ~ThreadState(); |
60 | 61 |
61 void AllocateSpace(); | 62 void AllocateSpace(); |
62 | 63 |
63 ThreadId id_; | 64 ThreadId id_; |
64 bool terminate_on_restore_; | 65 bool terminate_on_restore_; |
65 char* data_; | 66 char* data_; |
66 ThreadState* next_; | 67 ThreadState* next_; |
67 ThreadState* previous_; | 68 ThreadState* previous_; |
68 | 69 |
69 ThreadManager* thread_manager_; | 70 ThreadManager* thread_manager_; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void TerminateExecution(ThreadId thread_id); | 108 void TerminateExecution(ThreadId thread_id); |
108 | 109 |
109 // Iterate over in-use states. | 110 // Iterate over in-use states. |
110 ThreadState* FirstThreadStateInUse(); | 111 ThreadState* FirstThreadStateInUse(); |
111 ThreadState* GetFreeThreadState(); | 112 ThreadState* GetFreeThreadState(); |
112 | 113 |
113 private: | 114 private: |
114 ThreadManager(); | 115 ThreadManager(); |
115 ~ThreadManager(); | 116 ~ThreadManager(); |
116 | 117 |
| 118 void DeleteThreadStateList(ThreadState* anchor); |
| 119 |
117 void EagerlyArchiveThread(); | 120 void EagerlyArchiveThread(); |
118 | 121 |
119 Mutex* mutex_; | 122 Mutex* mutex_; |
120 ThreadId mutex_owner_; | 123 ThreadId mutex_owner_; |
121 ThreadId lazily_archived_thread_; | 124 ThreadId lazily_archived_thread_; |
122 ThreadState* lazily_archived_thread_state_; | 125 ThreadState* lazily_archived_thread_state_; |
123 | 126 |
124 // In the following two lists there is always at least one object on the list. | 127 // In the following two lists there is always at least one object on the list. |
125 // The first object is a flying anchor that is only there to simplify linking | 128 // The first object is a flying anchor that is only there to simplify linking |
126 // and unlinking. | 129 // and unlinking. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 void Run(); | 163 void Run(); |
161 | 164 |
162 bool keep_going_; | 165 bool keep_going_; |
163 int sleep_ms_; | 166 int sleep_ms_; |
164 Isolate* isolate_; | 167 Isolate* isolate_; |
165 }; | 168 }; |
166 | 169 |
167 } } // namespace v8::internal | 170 } } // namespace v8::internal |
168 | 171 |
169 #endif // V8_V8THREADS_H_ | 172 #endif // V8_V8THREADS_H_ |
OLD | NEW |