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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 #else | 94 #else |
95 #error Unsupported getStackStart on this platform. | 95 #error Unsupported getStackStart on this platform. |
96 #endif | 96 #endif |
97 } | 97 } |
98 | 98 |
99 // The maximum number of WrapperPersistentRegions to keep around in the | 99 // The maximum number of WrapperPersistentRegions to keep around in the |
100 // m_pooledWrapperPersistentRegions pool. | 100 // m_pooledWrapperPersistentRegions pool. |
101 static const size_t MaxPooledWrapperPersistentRegionCount = 2; | 101 static const size_t MaxPooledWrapperPersistentRegionCount = 2; |
102 | 102 |
103 WTF::ThreadSpecific<ThreadState*>* ThreadState::s_threadSpecific = 0; | 103 WTF::ThreadSpecific<ThreadState*>* ThreadState::s_threadSpecific = 0; |
| 104 intptr_t ThreadState::s_mainThreadStackStart = 0; |
104 uint8_t ThreadState::s_mainThreadStateStorage[sizeof(ThreadState)]; | 105 uint8_t ThreadState::s_mainThreadStateStorage[sizeof(ThreadState)]; |
105 SafePointBarrier* ThreadState::s_safePointBarrier = 0; | 106 SafePointBarrier* ThreadState::s_safePointBarrier = 0; |
106 bool ThreadState::s_inGC = false; | 107 bool ThreadState::s_inGC = false; |
107 | 108 |
108 static Mutex& threadAttachMutex() | 109 static Mutex& threadAttachMutex() |
109 { | 110 { |
110 AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex); | 111 AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex); |
111 return mutex; | 112 return mutex; |
112 } | 113 } |
113 | 114 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 , m_shouldFlushHeapDoesNotContainCache(false) | 305 , m_shouldFlushHeapDoesNotContainCache(false) |
305 , m_lowCollectionRate(false) | 306 , m_lowCollectionRate(false) |
306 , m_numberOfSweeperTasks(0) | 307 , m_numberOfSweeperTasks(0) |
307 #if defined(ADDRESS_SANITIZER) | 308 #if defined(ADDRESS_SANITIZER) |
308 , m_asanFakeStack(__asan_get_current_fake_stack()) | 309 , m_asanFakeStack(__asan_get_current_fake_stack()) |
309 #endif | 310 #endif |
310 { | 311 { |
311 ASSERT(!**s_threadSpecific); | 312 ASSERT(!**s_threadSpecific); |
312 **s_threadSpecific = this; | 313 **s_threadSpecific = this; |
313 | 314 |
| 315 if (isMainThread()) |
| 316 s_mainThreadStackStart = reinterpret_cast<intptr_t>(m_startOfStack); |
| 317 |
314 InitializeHeaps<NumberOfHeaps>::init(m_heaps, this); | 318 InitializeHeaps<NumberOfHeaps>::init(m_heaps, this); |
315 | 319 |
316 m_weakCallbackStack = new CallbackStack(); | 320 m_weakCallbackStack = new CallbackStack(); |
317 | 321 |
318 if (blink::Platform::current()) | 322 if (blink::Platform::current()) |
319 m_sweeperThread = adoptPtr(blink::Platform::current()->createThread("Bli
nk GC Sweeper")); | 323 m_sweeperThread = adoptPtr(blink::Platform::current()->createThread("Bli
nk GC Sweeper")); |
320 } | 324 } |
321 | 325 |
322 ThreadState::~ThreadState() | 326 ThreadState::~ThreadState() |
323 { | 327 { |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 return gcInfo; | 1265 return gcInfo; |
1262 } | 1266 } |
1263 } | 1267 } |
1264 if (needLockForIteration) | 1268 if (needLockForIteration) |
1265 threadAttachMutex().unlock(); | 1269 threadAttachMutex().unlock(); |
1266 return 0; | 1270 return 0; |
1267 } | 1271 } |
1268 #endif | 1272 #endif |
1269 | 1273 |
1270 } | 1274 } |
OLD | NEW |