Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: Source/platform/heap/ThreadState.h

Issue 651713002: Oilpan: DOM wrappers don't need to keep persistent handles (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
45 45
46 namespace blink { 46 namespace blink {
47 47
48 class BaseHeap; 48 class BaseHeap;
49 class BaseHeapPage; 49 class BaseHeapPage;
50 class FinalizedHeapObjectHeader; 50 class FinalizedHeapObjectHeader;
51 struct GCInfo; 51 struct GCInfo;
52 class HeapObjectHeader; 52 class HeapObjectHeader;
53 class PageMemory; 53 class PageMemory;
54 class PersistentNode; 54 class PersistentNode;
55 class WrapperPersistentRegion;
56 class Visitor; 55 class Visitor;
57 class SafePointBarrier; 56 class SafePointBarrier;
58 class SafePointAwareMutexLocker; 57 class SafePointAwareMutexLocker;
59 template<typename Header> class ThreadHeap; 58 template<typename Header> class ThreadHeap;
60 class CallbackStack; 59 class CallbackStack;
61 class PageMemoryRegion; 60 class PageMemoryRegion;
62 61
63 typedef uint8_t* Address; 62 typedef uint8_t* Address;
64 63
65 typedef void (*FinalizationCallback)(void*); 64 typedef void (*FinalizationCallback)(void*);
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 // HeapTypeTrait<Type>::index. 590 // HeapTypeTrait<Type>::index.
592 BaseHeap* heap(int index) const { return m_heaps[index]; } 591 BaseHeap* heap(int index) const { return m_heaps[index]; }
593 592
594 // Infrastructure to determine if an address is within one of the 593 // Infrastructure to determine if an address is within one of the
595 // address ranges for the Blink heap. If the address is in the Blink 594 // address ranges for the Blink heap. If the address is in the Blink
596 // heap the containing heap page is returned. 595 // heap the containing heap page is returned.
597 BaseHeapPage* contains(Address address) { return heapPageFromAddress(address ); } 596 BaseHeapPage* contains(Address address) { return heapPageFromAddress(address ); }
598 BaseHeapPage* contains(void* pointer) { return contains(reinterpret_cast<Add ress>(pointer)); } 597 BaseHeapPage* contains(void* pointer) { return contains(reinterpret_cast<Add ress>(pointer)); }
599 BaseHeapPage* contains(const void* pointer) { return contains(const_cast<voi d*>(pointer)); } 598 BaseHeapPage* contains(const void* pointer) { return contains(const_cast<voi d*>(pointer)); }
600 599
601 WrapperPersistentRegion* wrapperRoots() const
602 {
603 ASSERT(m_liveWrapperPersistents);
604 return m_liveWrapperPersistents;
605 }
606 WrapperPersistentRegion* takeWrapperPersistentRegion();
607 void freeWrapperPersistentRegion(WrapperPersistentRegion*);
608
609 // List of persistent roots allocated on the given thread. 600 // List of persistent roots allocated on the given thread.
610 PersistentNode* roots() const { return m_persistents.get(); } 601 PersistentNode* roots() const { return m_persistents.get(); }
611 602
612 // List of global persistent roots not owned by any particular thread. 603 // List of global persistent roots not owned by any particular thread.
613 // globalRootsMutex must be acquired before any modifications. 604 // globalRootsMutex must be acquired before any modifications.
614 static PersistentNode* globalRoots(); 605 static PersistentNode* globalRoots();
615 static Mutex& globalRootsMutex(); 606 static Mutex& globalRootsMutex();
616 607
617 // Visit local thread stack and trace all pointers conservatively. 608 // Visit local thread stack and trace all pointers conservatively.
618 void visitStack(Visitor*); 609 void visitStack(Visitor*);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 ASSERT(&T::invokePreFinalizer); 683 ASSERT(&T::invokePreFinalizer);
693 unregisterPreFinalizerInternal(&target); 684 unregisterPreFinalizerInternal(&target);
694 } 685 }
695 686
696 Mutex& sweepMutex() { return m_sweepMutex; } 687 Mutex& sweepMutex() { return m_sweepMutex; }
697 688
698 Vector<PageMemoryRegion*>& allocatedRegionsSinceLastGC() { return m_allocate dRegionsSinceLastGC; } 689 Vector<PageMemoryRegion*>& allocatedRegionsSinceLastGC() { return m_allocate dRegionsSinceLastGC; }
699 690
700 void shouldFlushHeapDoesNotContainCache() { m_shouldFlushHeapDoesNotContainC ache = true; } 691 void shouldFlushHeapDoesNotContainCache() { m_shouldFlushHeapDoesNotContainC ache = true; }
701 692
693 void registerTraceDOMWrappers(void (*traceDOMWrappers)(Visitor*))
694 {
695 m_traceDOMWrappers = traceDOMWrappers;
696 }
697
702 private: 698 private:
703 explicit ThreadState(); 699 explicit ThreadState();
704 ~ThreadState(); 700 ~ThreadState();
705 701
706 friend class SafePointBarrier; 702 friend class SafePointBarrier;
707 friend class SafePointAwareMutexLocker; 703 friend class SafePointAwareMutexLocker;
708 704
709 void enterSafePoint(StackState, void*); 705 void enterSafePoint(StackState, void*);
710 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); 706 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope();
711 void clearSafePointScopeMarker() 707 void clearSafePointScopeMarker()
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 // We can't create a static member of type ThreadState here 745 // We can't create a static member of type ThreadState here
750 // because it will introduce global constructor and destructor. 746 // because it will introduce global constructor and destructor.
751 // We would like to manage lifetime of the ThreadState attached 747 // We would like to manage lifetime of the ThreadState attached
752 // to the main thread explicitly instead and still use normal 748 // to the main thread explicitly instead and still use normal
753 // constructor and destructor for the ThreadState class. 749 // constructor and destructor for the ThreadState class.
754 // For this we reserve static storage for the main ThreadState 750 // For this we reserve static storage for the main ThreadState
755 // and lazily construct ThreadState in it using placement new. 751 // and lazily construct ThreadState in it using placement new.
756 static uint8_t s_mainThreadStateStorage[]; 752 static uint8_t s_mainThreadStateStorage[];
757 753
758 ThreadIdentifier m_thread; 754 ThreadIdentifier m_thread;
759 WrapperPersistentRegion* m_liveWrapperPersistents;
760 WrapperPersistentRegion* m_pooledWrapperPersistents;
761 size_t m_pooledWrapperPersistentRegionCount;
762 OwnPtr<PersistentNode> m_persistents; 755 OwnPtr<PersistentNode> m_persistents;
763 StackState m_stackState; 756 StackState m_stackState;
764 intptr_t* m_startOfStack; 757 intptr_t* m_startOfStack;
765 intptr_t* m_endOfStack; 758 intptr_t* m_endOfStack;
766 void* m_safePointScopeMarker; 759 void* m_safePointScopeMarker;
767 Vector<Address> m_safePointStackCopy; 760 Vector<Address> m_safePointStackCopy;
768 bool m_atSafePoint; 761 bool m_atSafePoint;
769 Vector<Interruptor*> m_interruptors; 762 Vector<Interruptor*> m_interruptors;
770 bool m_gcRequested; 763 bool m_gcRequested;
771 bool m_forcePreciseGCForTesting; 764 bool m_forcePreciseGCForTesting;
(...skipping 12 matching lines...) Expand all
784 bool m_lowCollectionRate; 777 bool m_lowCollectionRate;
785 778
786 OwnPtr<blink::WebThread> m_sweeperThread; 779 OwnPtr<blink::WebThread> m_sweeperThread;
787 int m_numberOfSweeperTasks; 780 int m_numberOfSweeperTasks;
788 Mutex m_sweepMutex; 781 Mutex m_sweepMutex;
789 ThreadCondition m_sweepThreadCondition; 782 ThreadCondition m_sweepThreadCondition;
790 783
791 CallbackStack* m_weakCallbackStack; 784 CallbackStack* m_weakCallbackStack;
792 HashMap<void*, bool (*)(void*, Visitor&)> m_preFinalizers; 785 HashMap<void*, bool (*)(void*, Visitor&)> m_preFinalizers;
793 786
787 void (*m_traceDOMWrappers)(Visitor*);
788
794 #if defined(ADDRESS_SANITIZER) 789 #if defined(ADDRESS_SANITIZER)
795 void* m_asanFakeStack; 790 void* m_asanFakeStack;
796 #endif 791 #endif
797 792
798 Vector<PageMemoryRegion*> m_allocatedRegionsSinceLastGC; 793 Vector<PageMemoryRegion*> m_allocatedRegionsSinceLastGC;
799 }; 794 };
800 795
801 template<ThreadAffinity affinity> class ThreadStateFor; 796 template<ThreadAffinity affinity> class ThreadStateFor;
802 797
803 template<> class ThreadStateFor<MainThreadOnly> { 798 template<> class ThreadStateFor<MainThreadOnly> {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 // whether the page is part of a terminting thread or 910 // whether the page is part of a terminting thread or
916 // if the page is traced after being terminated (orphaned). 911 // if the page is traced after being terminated (orphaned).
917 uintptr_t m_terminating : 1; 912 uintptr_t m_terminating : 1;
918 uintptr_t m_tracedAfterOrphaned : 1; 913 uintptr_t m_tracedAfterOrphaned : 1;
919 uintptr_t m_promptlyFreedSize : 17; // == blinkPageSizeLog2 914 uintptr_t m_promptlyFreedSize : 17; // == blinkPageSizeLog2
920 }; 915 };
921 916
922 } 917 }
923 918
924 #endif // ThreadState_h 919 #endif // ThreadState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698