OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 private: | 165 private: |
166 volatile Atomic32 m_canResume; | 166 volatile Atomic32 m_canResume; |
167 volatile Atomic32 m_unparkedThreadCount; | 167 volatile Atomic32 m_unparkedThreadCount; |
168 Mutex m_mutex; | 168 Mutex m_mutex; |
169 ThreadCondition m_parked; | 169 ThreadCondition m_parked; |
170 ThreadCondition m_resume; | 170 ThreadCondition m_resume; |
171 }; | 171 }; |
172 | 172 |
173 | 173 |
| 174 intptr_t* ThreadState::s_mainThreadStackBottom = 0; |
| 175 intptr_t* ThreadState::s_mainThreadStackTop = 0; |
174 WTF::ThreadSpecific<ThreadState*>* ThreadState::s_threadSpecific = 0; | 176 WTF::ThreadSpecific<ThreadState*>* ThreadState::s_threadSpecific = 0; |
175 ThreadState ThreadState::s_mainThreadState; | 177 ThreadState ThreadState::s_mainThreadState; |
176 SafePointBarrier* ThreadState::s_safePointBarrier = 0; | 178 SafePointBarrier* ThreadState::s_safePointBarrier = 0; |
177 bool ThreadState::s_inGC = false; | 179 bool ThreadState::s_inGC = false; |
178 | 180 |
179 ThreadState::AttachedThreadStateSet& ThreadState::attachedThreads() | 181 ThreadState::AttachedThreadStateSet& ThreadState::attachedThreads() |
180 { | 182 { |
181 DEFINE_STATIC_LOCAL(HashSet<ThreadState*>, threads, ()); | 183 DEFINE_STATIC_LOCAL(HashSet<ThreadState*>, threads, ()); |
182 return threads; | 184 return threads; |
183 } | 185 } |
184 | 186 |
185 void ThreadState::safePoint() | 187 void ThreadState::safePoint() |
186 { | 188 { |
187 s_safePointBarrier->checkAndPark(this); | 189 s_safePointBarrier->checkAndPark(this); |
188 } | 190 } |
189 | 191 |
190 void ThreadState::init(intptr_t* startOfStack) | 192 void ThreadState::init(intptr_t* startOfStack) |
191 { | 193 { |
192 s_threadSpecific = new WTF::ThreadSpecific<ThreadState*>(); | 194 s_threadSpecific = new WTF::ThreadSpecific<ThreadState*>(); |
193 s_safePointBarrier = new SafePointBarrier(); | 195 s_safePointBarrier = new SafePointBarrier(); |
194 s_mainThreadState.create(startOfStack); | 196 s_mainThreadState.create(startOfStack); |
| 197 s_mainThreadStackBottom = startOfStack; |
| 198 s_mainThreadStackTop = reinterpret_cast<intptr_t*>(reinterpret_cast<Address>
(startOfStack) - (1 << 16)); |
195 attachedThreads().add(&s_mainThreadState); | 199 attachedThreads().add(&s_mainThreadState); |
196 } | 200 } |
197 | 201 |
198 void ThreadState::shutdown() | 202 void ThreadState::shutdown() |
199 { | 203 { |
200 s_mainThreadState.destroy(); | 204 s_mainThreadState.destroy(); |
201 } | 205 } |
202 | 206 |
203 void ThreadState::attach(intptr_t* startOfStack) | 207 void ThreadState::attach(intptr_t* startOfStack) |
204 { | 208 { |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 barrier->doPark(state, stackEnd); | 548 barrier->doPark(state, stackEnd); |
545 } | 549 } |
546 | 550 |
547 static void enterSafePointAfterPushRegisters(SafePointBarrier* barrier, ThreadSt
ate* state, intptr_t* stackEnd) | 551 static void enterSafePointAfterPushRegisters(SafePointBarrier* barrier, ThreadSt
ate* state, intptr_t* stackEnd) |
548 { | 552 { |
549 barrier->doEnterSafePoint(state, stackEnd); | 553 barrier->doEnterSafePoint(state, stackEnd); |
550 } | 554 } |
551 | 555 |
552 | 556 |
553 } | 557 } |
OLD | NEW |