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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 , m_noAllocationCount(0) | 242 , m_noAllocationCount(0) |
243 , m_inGC(false) | 243 , m_inGC(false) |
244 , m_heapContainsCache(adoptPtr(new HeapContainsCache())) | 244 , m_heapContainsCache(adoptPtr(new HeapContainsCache())) |
245 , m_isCleaningUp(false) | 245 , m_isCleaningUp(false) |
246 #if defined(ADDRESS_SANITIZER) && !OS(WIN) | 246 #if defined(ADDRESS_SANITIZER) && !OS(WIN) |
247 , m_asanFakeStack(__asan_get_current_fake_stack()) | 247 , m_asanFakeStack(__asan_get_current_fake_stack()) |
248 #endif | 248 #endif |
249 { | 249 { |
250 ASSERT(!**s_threadSpecific); | 250 ASSERT(!**s_threadSpecific); |
251 **s_threadSpecific = this; | 251 **s_threadSpecific = this; |
252 | |
tkent
2014/04/24 04:02:40
This change is unnecessary.
keishi
2014/05/06 20:00:03
Done.
| |
253 m_stats.clear(); | 252 m_stats.clear(); |
254 m_statsAfterLastGC.clear(); | 253 m_statsAfterLastGC.clear(); |
255 // First allocate the general heap, second iterate through to | 254 // First allocate the general heap, second iterate through to |
256 // allocate the type specific heaps | 255 // allocate the type specific heaps |
257 m_heaps[GeneralHeap] = new ThreadHeap<FinalizedHeapObjectHeader>(this); | 256 m_heaps[GeneralHeap] = new ThreadHeap<FinalizedHeapObjectHeader>(this); |
258 for (int i = GeneralHeap + 1; i < NumberOfHeaps; i++) | 257 for (int i = GeneralHeap + 1; i < NumberOfHeaps; i++) |
259 m_heaps[i] = new ThreadHeap<HeapObjectHeader>(this); | 258 m_heaps[i] = new ThreadHeap<HeapObjectHeader>(this); |
260 | 259 |
261 CallbackStack::init(&m_weakCallbackStack); | 260 CallbackStack::init(&m_weakCallbackStack); |
262 } | 261 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
330 for (size_t i = 0; i < m_cleanupTasks.size(); i++) | 329 for (size_t i = 0; i < m_cleanupTasks.size(); i++) |
331 m_cleanupTasks[i]->postCleanup(); | 330 m_cleanupTasks[i]->postCleanup(); |
332 | 331 |
333 m_cleanupTasks.clear(); | 332 m_cleanupTasks.clear(); |
334 } | 333 } |
335 | 334 |
336 void ThreadState::detach() | 335 void ThreadState::detach() |
337 { | 336 { |
338 ThreadState* state = current(); | 337 ThreadState* state = current(); |
339 state->cleanup(); | 338 state->cleanup(); |
340 | |
tkent
2014/04/24 04:02:40
This change is unnecessary.
keishi
2014/05/06 20:00:03
Done.
| |
341 // Enter safe point before trying to acquire threadAttachMutex | 339 // Enter safe point before trying to acquire threadAttachMutex |
342 // to avoid dead lock if another thread is preparing for GC, has acquired | 340 // to avoid dead lock if another thread is preparing for GC, has acquired |
343 // threadAttachMutex and waiting for other threads to pause or reach a | 341 // threadAttachMutex and waiting for other threads to pause or reach a |
344 // safepoint. | 342 // safepoint. |
345 if (!state->isAtSafePoint()) | 343 if (!state->isAtSafePoint()) |
346 state->enterSafePointWithoutPointers(); | 344 state->enterSafePointWithoutPointers(); |
347 MutexLocker locker(threadAttachMutex()); | 345 MutexLocker locker(threadAttachMutex()); |
348 state->leaveSafePoint(); | 346 state->leaveSafePoint(); |
349 ASSERT(attachedThreads().contains(state)); | 347 ASSERT(attachedThreads().contains(state)); |
350 attachedThreads().remove(state); | 348 attachedThreads().remove(state); |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
798 state->safePoint(HeapPointersOnStack); | 796 state->safePoint(HeapPointersOnStack); |
799 } | 797 } |
800 | 798 |
801 ThreadState::AttachedThreadStateSet& ThreadState::attachedThreads() | 799 ThreadState::AttachedThreadStateSet& ThreadState::attachedThreads() |
802 { | 800 { |
803 DEFINE_STATIC_LOCAL(AttachedThreadStateSet, threads, ()); | 801 DEFINE_STATIC_LOCAL(AttachedThreadStateSet, threads, ()); |
804 return threads; | 802 return threads; |
805 } | 803 } |
806 | 804 |
807 } | 805 } |
OLD | NEW |