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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 namespace blink { | 49 namespace blink { |
50 | 50 |
51 class BaseHeap; | 51 class BaseHeap; |
52 class BaseHeapPage; | 52 class BaseHeapPage; |
53 class FinalizedHeapObjectHeader; | 53 class FinalizedHeapObjectHeader; |
54 struct GCInfo; | 54 struct GCInfo; |
55 class HeapContainsCache; | 55 class HeapContainsCache; |
56 class HeapObjectHeader; | 56 class HeapObjectHeader; |
57 class PageMemory; | 57 class PageMemory; |
58 class PersistentNode; | 58 class PersistentNode; |
| 59 class WrapperPersistentRegion; |
59 class Visitor; | 60 class Visitor; |
60 class SafePointBarrier; | 61 class SafePointBarrier; |
61 class SafePointAwareMutexLocker; | 62 class SafePointAwareMutexLocker; |
62 template<typename Header> class ThreadHeap; | 63 template<typename Header> class ThreadHeap; |
63 class CallbackStack; | 64 class CallbackStack; |
64 | 65 |
65 typedef uint8_t* Address; | 66 typedef uint8_t* Address; |
66 | 67 |
67 typedef void (*FinalizationCallback)(void*); | 68 typedef void (*FinalizationCallback)(void*); |
68 typedef void (*VisitorCallback)(Visitor*, void* self); | 69 typedef void (*VisitorCallback)(Visitor*, void* self); |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 BaseHeap* heap(int index) const { return m_heaps[index]; } | 540 BaseHeap* heap(int index) const { return m_heaps[index]; } |
540 | 541 |
541 // Infrastructure to determine if an address is within one of the | 542 // Infrastructure to determine if an address is within one of the |
542 // address ranges for the Blink heap. If the address is in the Blink | 543 // address ranges for the Blink heap. If the address is in the Blink |
543 // heap the containing heap page is returned. | 544 // heap the containing heap page is returned. |
544 HeapContainsCache* heapContainsCache() { return m_heapContainsCache.get(); } | 545 HeapContainsCache* heapContainsCache() { return m_heapContainsCache.get(); } |
545 BaseHeapPage* contains(Address address) { return heapPageFromAddress(address
); } | 546 BaseHeapPage* contains(Address address) { return heapPageFromAddress(address
); } |
546 BaseHeapPage* contains(void* pointer) { return contains(reinterpret_cast<Add
ress>(pointer)); } | 547 BaseHeapPage* contains(void* pointer) { return contains(reinterpret_cast<Add
ress>(pointer)); } |
547 BaseHeapPage* contains(const void* pointer) { return contains(const_cast<voi
d*>(pointer)); } | 548 BaseHeapPage* contains(const void* pointer) { return contains(const_cast<voi
d*>(pointer)); } |
548 | 549 |
| 550 WrapperPersistentRegion* wrapperRoots() const |
| 551 { |
| 552 ASSERT(m_liveWrapperPersistents); |
| 553 return m_liveWrapperPersistents; |
| 554 } |
| 555 WrapperPersistentRegion* takeWrapperPersistentRegion(); |
| 556 void freeWrapperPersistentRegion(WrapperPersistentRegion*); |
| 557 |
549 // List of persistent roots allocated on the given thread. | 558 // List of persistent roots allocated on the given thread. |
550 PersistentNode* roots() const { return m_persistents.get(); } | 559 PersistentNode* roots() const { return m_persistents.get(); } |
551 | 560 |
552 // List of global persistent roots not owned by any particular thread. | 561 // List of global persistent roots not owned by any particular thread. |
553 // globalRootsMutex must be acquired before any modifications. | 562 // globalRootsMutex must be acquired before any modifications. |
554 static PersistentNode* globalRoots(); | 563 static PersistentNode* globalRoots(); |
555 static Mutex& globalRootsMutex(); | 564 static Mutex& globalRootsMutex(); |
556 | 565 |
557 // Visit local thread stack and trace all pointers conservatively. | 566 // Visit local thread stack and trace all pointers conservatively. |
558 void visitStack(Visitor*); | 567 void visitStack(Visitor*); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 // We can't create a static member of type ThreadState here | 672 // We can't create a static member of type ThreadState here |
664 // because it will introduce global constructor and destructor. | 673 // because it will introduce global constructor and destructor. |
665 // We would like to manage lifetime of the ThreadState attached | 674 // We would like to manage lifetime of the ThreadState attached |
666 // to the main thread explicitly instead and still use normal | 675 // to the main thread explicitly instead and still use normal |
667 // constructor and destructor for the ThreadState class. | 676 // constructor and destructor for the ThreadState class. |
668 // For this we reserve static storage for the main ThreadState | 677 // For this we reserve static storage for the main ThreadState |
669 // and lazily construct ThreadState in it using placement new. | 678 // and lazily construct ThreadState in it using placement new. |
670 static uint8_t s_mainThreadStateStorage[]; | 679 static uint8_t s_mainThreadStateStorage[]; |
671 | 680 |
672 ThreadIdentifier m_thread; | 681 ThreadIdentifier m_thread; |
| 682 WrapperPersistentRegion* m_liveWrapperPersistents; |
| 683 WrapperPersistentRegion* m_pooledWrapperPersistents; |
| 684 size_t m_pooledWrapperPersistentRegionCount; |
673 OwnPtr<PersistentNode> m_persistents; | 685 OwnPtr<PersistentNode> m_persistents; |
674 StackState m_stackState; | 686 StackState m_stackState; |
675 intptr_t* m_startOfStack; | 687 intptr_t* m_startOfStack; |
676 intptr_t* m_endOfStack; | 688 intptr_t* m_endOfStack; |
677 void* m_safePointScopeMarker; | 689 void* m_safePointScopeMarker; |
678 Vector<Address> m_safePointStackCopy; | 690 Vector<Address> m_safePointStackCopy; |
679 bool m_atSafePoint; | 691 bool m_atSafePoint; |
680 Vector<Interruptor*> m_interruptors; | 692 Vector<Interruptor*> m_interruptors; |
681 bool m_gcRequested; | 693 bool m_gcRequested; |
682 bool m_forcePreciseGCForTesting; | 694 bool m_forcePreciseGCForTesting; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 // whether the page is part of a terminting thread or | 841 // whether the page is part of a terminting thread or |
830 // if the page is traced after being terminated (orphaned). | 842 // if the page is traced after being terminated (orphaned). |
831 uintptr_t m_terminating : 1; | 843 uintptr_t m_terminating : 1; |
832 uintptr_t m_tracedAfterOrphaned : 1; | 844 uintptr_t m_tracedAfterOrphaned : 1; |
833 uintptr_t m_promptlyFreedSize : 17; // == blinkPageSizeLog2 | 845 uintptr_t m_promptlyFreedSize : 17; // == blinkPageSizeLog2 |
834 }; | 846 }; |
835 | 847 |
836 } | 848 } |
837 | 849 |
838 #endif // ThreadState_h | 850 #endif // ThreadState_h |
OLD | NEW |