| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 volatile int m_canResume; | 223 volatile int m_canResume; |
| 224 volatile int m_unparkedThreadCount; | 224 volatile int m_unparkedThreadCount; |
| 225 Mutex m_mutex; | 225 Mutex m_mutex; |
| 226 ThreadCondition m_parked; | 226 ThreadCondition m_parked; |
| 227 ThreadCondition m_resume; | 227 ThreadCondition m_resume; |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 ThreadState::ThreadState() | 230 ThreadState::ThreadState() |
| 231 : m_thread(currentThread()) | 231 : m_thread(currentThread()) |
| 232 , m_persistents(adoptPtr(new PersistentAnchor())) | |
| 233 , m_startOfStack(reinterpret_cast<intptr_t*>(getStackStart())) | 232 , m_startOfStack(reinterpret_cast<intptr_t*>(getStackStart())) |
| 234 , m_endOfStack(reinterpret_cast<intptr_t*>(getStackStart())) | 233 , m_endOfStack(reinterpret_cast<intptr_t*>(getStackStart())) |
| 235 , m_safePointScopeMarker(0) | 234 , m_safePointScopeMarker(0) |
| 236 , m_atSafePoint(false) | 235 , m_atSafePoint(false) |
| 237 , m_interruptors() | 236 , m_interruptors() |
| 238 , m_gcRequested(false) | 237 , m_gcRequested(false) |
| 239 , m_sweepRequested(0) | 238 , m_sweepRequested(0) |
| 240 , m_sweepInProgress(false) | 239 , m_sweepInProgress(false) |
| 241 , m_noAllocationCount(0) | 240 , m_noAllocationCount(0) |
| 242 , m_inGC(false) | 241 , m_inGC(false) |
| 243 , m_heapContainsCache(adoptPtr(new HeapContainsCache())) | 242 , m_heapContainsCache(new HeapContainsCache()) |
| 244 , m_isCleaningUp(false) | 243 , m_isCleaningUp(false) |
| 245 { | 244 { |
| 246 ASSERT(!**s_threadSpecific); | 245 ASSERT(!**s_threadSpecific); |
| 247 **s_threadSpecific = this; | 246 **s_threadSpecific = this; |
| 248 | 247 |
| 248 m_persistents = new PersistentAnchor(); |
| 249 m_stats.clear(); | 249 m_stats.clear(); |
| 250 m_statsAfterLastGC.clear(); | 250 m_statsAfterLastGC.clear(); |
| 251 // First allocate the general heap, second iterate through to | 251 // First allocate the general heap, second iterate through to |
| 252 // allocate the type specific heaps | 252 // allocate the type specific heaps |
| 253 m_heaps[GeneralHeap] = new ThreadHeap<FinalizedHeapObjectHeader>(this); | 253 m_heaps[GeneralHeap] = new ThreadHeap<FinalizedHeapObjectHeader>(this); |
| 254 for (int i = GeneralHeap + 1; i < NumberOfHeaps; i++) | 254 for (int i = GeneralHeap + 1; i < NumberOfHeaps; i++) |
| 255 m_heaps[i] = new ThreadHeap<HeapObjectHeader>(this); | 255 m_heaps[i] = new ThreadHeap<HeapObjectHeader>(this); |
| 256 } | 256 } |
| 257 | 257 |
| 258 ThreadState::~ThreadState() | 258 ThreadState::~ThreadState() |
| 259 { | 259 { |
| 260 checkThread(); | 260 checkThread(); |
| 261 for (int i = GeneralHeap; i < NumberOfHeaps; i++) | 261 for (int i = GeneralHeap; i < NumberOfHeaps; i++) |
| 262 delete m_heaps[i]; | 262 delete m_heaps[i]; |
| 263 delete m_persistents; |
| 264 m_persistents = 0; |
| 263 deleteAllValues(m_interruptors); | 265 deleteAllValues(m_interruptors); |
| 264 **s_threadSpecific = 0; | 266 **s_threadSpecific = 0; |
| 265 } | 267 } |
| 266 | 268 |
| 267 void ThreadState::init() | 269 void ThreadState::init() |
| 268 { | 270 { |
| 269 s_threadSpecific = new WTF::ThreadSpecific<ThreadState*>(); | 271 s_threadSpecific = new WTF::ThreadSpecific<ThreadState*>(); |
| 270 s_safePointBarrier = new SafePointBarrier; | 272 s_safePointBarrier = new SafePointBarrier; |
| 271 new(s_mainThreadStateStorage) ThreadState(); | 273 new(s_mainThreadStateStorage) ThreadState(); |
| 272 attachedThreads().add(mainThreadState()); | 274 attachedThreads().add(mainThreadState()); |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 state->safePoint(HeapPointersOnStack); | 702 state->safePoint(HeapPointersOnStack); |
| 701 } | 703 } |
| 702 | 704 |
| 703 ThreadState::AttachedThreadStateSet& ThreadState::attachedThreads() | 705 ThreadState::AttachedThreadStateSet& ThreadState::attachedThreads() |
| 704 { | 706 { |
| 705 DEFINE_STATIC_LOCAL(AttachedThreadStateSet, threads, ()); | 707 DEFINE_STATIC_LOCAL(AttachedThreadStateSet, threads, ()); |
| 706 return threads; | 708 return threads; |
| 707 } | 709 } |
| 708 | 710 |
| 709 } | 711 } |
| OLD | NEW |