Chromium Code Reviews| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 #include "wtf/text/WTFString.h" | 45 #include "wtf/text/WTFString.h" |
| 46 | 46 |
| 47 namespace v8 { | 47 namespace v8 { |
| 48 class Isolate; | 48 class Isolate; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 namespace blink { | 51 namespace blink { |
| 52 | 52 |
| 53 class BasePage; | 53 class BasePage; |
| 54 class CallbackStack; | 54 class CallbackStack; |
| 55 class CrossThreadPersistentRegion; | |
| 55 struct GCInfo; | 56 struct GCInfo; |
| 56 class GarbageCollectedMixinConstructorMarker; | 57 class GarbageCollectedMixinConstructorMarker; |
| 57 class HeapObjectHeader; | 58 class HeapObjectHeader; |
| 58 class PageMemoryRegion; | 59 class PageMemoryRegion; |
| 59 class PageMemory; | 60 class PageMemory; |
| 60 class PersistentAnchor; | 61 class PersistentRegion; |
| 61 class BaseHeap; | 62 class BaseHeap; |
| 62 class SafePointAwareMutexLocker; | 63 class SafePointAwareMutexLocker; |
| 63 class SafePointBarrier; | 64 class SafePointBarrier; |
| 64 class ThreadState; | 65 class ThreadState; |
| 65 class Visitor; | 66 class Visitor; |
| 66 | 67 |
| 67 using Address = uint8_t*; | 68 using Address = uint8_t*; |
| 68 | 69 |
| 69 using FinalizationCallback = void (*)(void*); | 70 using FinalizationCallback = void (*)(void*); |
| 70 using VisitorCallback = void (*)(Visitor*, void* self); | 71 using VisitorCallback = void (*)(Visitor*, void* self); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 | 467 |
| 467 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 468 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| 468 // Infrastructure to determine if an address is within one of the | 469 // Infrastructure to determine if an address is within one of the |
| 469 // address ranges for the Blink heap. If the address is in the Blink | 470 // address ranges for the Blink heap. If the address is in the Blink |
| 470 // heap the containing heap page is returned. | 471 // heap the containing heap page is returned. |
| 471 BasePage* findPageFromAddress(Address); | 472 BasePage* findPageFromAddress(Address); |
| 472 BasePage* findPageFromAddress(const void* pointer) { return findPageFromAddr ess(reinterpret_cast<Address>(const_cast<void*>(pointer))); } | 473 BasePage* findPageFromAddress(const void* pointer) { return findPageFromAddr ess(reinterpret_cast<Address>(const_cast<void*>(pointer))); } |
| 473 #endif | 474 #endif |
| 474 | 475 |
| 475 // List of persistent roots allocated on the given thread. | 476 // List of persistent roots allocated on the given thread. |
| 476 PersistentAnchor* roots() const { return m_persistents.get(); } | 477 PersistentRegion* persistentRegion() const { return m_persistentRegion.get() ; } |
| 477 | 478 |
| 478 // List of global persistent roots not owned by any particular thread. | 479 // List of global persistent roots not owned by any particular thread. |
| 479 // globalRootsMutex must be acquired before any modifications. | 480 // globalRootsMutex must be acquired before any modifications. |
|
sof
2015/06/30 09:19:39
Comment still mentions globalRootsMutex.
haraken
2015/06/30 09:51:32
Done.
| |
| 480 static PersistentAnchor& globalRoots(); | 481 static CrossThreadPersistentRegion& crossThreadPersistentRegion(); |
| 481 static Mutex& globalRootsMutex(); | |
| 482 | 482 |
| 483 // Visit local thread stack and trace all pointers conservatively. | 483 // Visit local thread stack and trace all pointers conservatively. |
| 484 void visitStack(Visitor*); | 484 void visitStack(Visitor*); |
| 485 | 485 |
| 486 // Visit the asan fake stack frame corresponding to a slot on the | 486 // Visit the asan fake stack frame corresponding to a slot on the |
| 487 // real machine stack if there is one. | 487 // real machine stack if there is one. |
| 488 void visitAsanFakeStackForPointer(Visitor*, Address); | 488 void visitAsanFakeStackForPointer(Visitor*, Address); |
| 489 | 489 |
| 490 // Visit all persistents allocated on this thread. | 490 // Visit all persistents allocated on this thread. |
| 491 void visitPersistents(Visitor*); | 491 void visitPersistents(Visitor*); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 726 // We can't create a static member of type ThreadState here | 726 // We can't create a static member of type ThreadState here |
| 727 // because it will introduce global constructor and destructor. | 727 // because it will introduce global constructor and destructor. |
| 728 // We would like to manage lifetime of the ThreadState attached | 728 // We would like to manage lifetime of the ThreadState attached |
| 729 // to the main thread explicitly instead and still use normal | 729 // to the main thread explicitly instead and still use normal |
| 730 // constructor and destructor for the ThreadState class. | 730 // constructor and destructor for the ThreadState class. |
| 731 // For this we reserve static storage for the main ThreadState | 731 // For this we reserve static storage for the main ThreadState |
| 732 // and lazily construct ThreadState in it using placement new. | 732 // and lazily construct ThreadState in it using placement new. |
| 733 static uint8_t s_mainThreadStateStorage[]; | 733 static uint8_t s_mainThreadStateStorage[]; |
| 734 | 734 |
| 735 ThreadIdentifier m_thread; | 735 ThreadIdentifier m_thread; |
| 736 OwnPtr<PersistentAnchor> m_persistents; | 736 OwnPtr<PersistentRegion> m_persistentRegion; |
| 737 StackState m_stackState; | 737 StackState m_stackState; |
| 738 intptr_t* m_startOfStack; | 738 intptr_t* m_startOfStack; |
| 739 intptr_t* m_endOfStack; | 739 intptr_t* m_endOfStack; |
| 740 void* m_safePointScopeMarker; | 740 void* m_safePointScopeMarker; |
| 741 Vector<Address> m_safePointStackCopy; | 741 Vector<Address> m_safePointStackCopy; |
| 742 bool m_atSafePoint; | 742 bool m_atSafePoint; |
| 743 Vector<Interruptor*> m_interruptors; | 743 Vector<Interruptor*> m_interruptors; |
| 744 bool m_sweepForbidden; | 744 bool m_sweepForbidden; |
| 745 size_t m_noAllocationCount; | 745 size_t m_noAllocationCount; |
| 746 size_t m_gcForbiddenCount; | 746 size_t m_gcForbiddenCount; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 793 }; | 793 }; |
| 794 | 794 |
| 795 template<> class ThreadStateFor<AnyThread> { | 795 template<> class ThreadStateFor<AnyThread> { |
| 796 public: | 796 public: |
| 797 static ThreadState* state() { return ThreadState::current(); } | 797 static ThreadState* state() { return ThreadState::current(); } |
| 798 }; | 798 }; |
| 799 | 799 |
| 800 } // namespace blink | 800 } // namespace blink |
| 801 | 801 |
| 802 #endif // ThreadState_h | 802 #endif // ThreadState_h |
| OLD | NEW |