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

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

Issue 525353002: [oilpan]: optimize the way we allocate persistent handles in wrappers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 BaseHeap* heap(int index) const { return m_heaps[index]; } 522 BaseHeap* heap(int index) const { return m_heaps[index]; }
522 523
523 // Infrastructure to determine if an address is within one of the 524 // Infrastructure to determine if an address is within one of the
524 // address ranges for the Blink heap. If the address is in the Blink 525 // address ranges for the Blink heap. If the address is in the Blink
525 // heap the containing heap page is returned. 526 // heap the containing heap page is returned.
526 HeapContainsCache* heapContainsCache() { return m_heapContainsCache.get(); } 527 HeapContainsCache* heapContainsCache() { return m_heapContainsCache.get(); }
527 BaseHeapPage* contains(Address address) { return heapPageFromAddress(address ); } 528 BaseHeapPage* contains(Address address) { return heapPageFromAddress(address ); }
528 BaseHeapPage* contains(void* pointer) { return contains(reinterpret_cast<Add ress>(pointer)); } 529 BaseHeapPage* contains(void* pointer) { return contains(reinterpret_cast<Add ress>(pointer)); }
529 BaseHeapPage* contains(const void* pointer) { return contains(const_cast<voi d*>(pointer)); } 530 BaseHeapPage* contains(const void* pointer) { return contains(const_cast<voi d*>(pointer)); }
530 531
532 WrapperPersistentRegion* wrapperRoots() const
533 {
534 ASSERT(m_wrapperPersistents);
535 return m_wrapperPersistents;
536 }
537 WrapperPersistentRegion* addWrapperPersistentRegion();
538 void removeWrapperPersistentRegion(WrapperPersistentRegion*);
539
531 // List of persistent roots allocated on the given thread. 540 // List of persistent roots allocated on the given thread.
532 PersistentNode* roots() const { return m_persistents.get(); } 541 PersistentNode* roots() const { return m_persistents.get(); }
533 542
534 // List of global persistent roots not owned by any particular thread. 543 // List of global persistent roots not owned by any particular thread.
535 // globalRootsMutex must be acquired before any modifications. 544 // globalRootsMutex must be acquired before any modifications.
536 static PersistentNode* globalRoots(); 545 static PersistentNode* globalRoots();
537 static Mutex& globalRootsMutex(); 546 static Mutex& globalRootsMutex();
538 547
539 // Visit local thread stack and trace all pointers conservatively. 548 // Visit local thread stack and trace all pointers conservatively.
540 void visitStack(Visitor*); 549 void visitStack(Visitor*);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 // We can't create a static member of type ThreadState here 654 // We can't create a static member of type ThreadState here
646 // because it will introduce global constructor and destructor. 655 // because it will introduce global constructor and destructor.
647 // We would like to manage lifetime of the ThreadState attached 656 // We would like to manage lifetime of the ThreadState attached
648 // to the main thread explicitly instead and still use normal 657 // to the main thread explicitly instead and still use normal
649 // constructor and destructor for the ThreadState class. 658 // constructor and destructor for the ThreadState class.
650 // For this we reserve static storage for the main ThreadState 659 // For this we reserve static storage for the main ThreadState
651 // and lazily construct ThreadState in it using placement new. 660 // and lazily construct ThreadState in it using placement new.
652 static uint8_t s_mainThreadStateStorage[]; 661 static uint8_t s_mainThreadStateStorage[];
653 662
654 ThreadIdentifier m_thread; 663 ThreadIdentifier m_thread;
664 WrapperPersistentRegion* m_wrapperPersistents;
haraken 2014/09/02 05:22:06 m_wrapperPersistents => m_usedWrapperPersistents m
wibling-chromium 2014/09/02 11:19:38 Done. Changed them to m_liveWrapperPersistents m_
665 WrapperPersistentRegion* m_wrapperPersistentRegionPool;
haraken 2014/09/02 05:22:06 WrapperPersistentRegion is owned by either m_wrapp
wibling-chromium 2014/09/02 11:19:38 I would prefer to keep it a double-linked list to
666 size_t m_wrapperPersistentRegionPoolSize;
655 OwnPtr<PersistentNode> m_persistents; 667 OwnPtr<PersistentNode> m_persistents;
656 StackState m_stackState; 668 StackState m_stackState;
657 intptr_t* m_startOfStack; 669 intptr_t* m_startOfStack;
658 intptr_t* m_endOfStack; 670 intptr_t* m_endOfStack;
659 void* m_safePointScopeMarker; 671 void* m_safePointScopeMarker;
660 Vector<Address> m_safePointStackCopy; 672 Vector<Address> m_safePointStackCopy;
661 bool m_atSafePoint; 673 bool m_atSafePoint;
662 Vector<Interruptor*> m_interruptors; 674 Vector<Interruptor*> m_interruptors;
663 bool m_gcRequested; 675 bool m_gcRequested;
664 bool m_forcePreciseGCForTesting; 676 bool m_forcePreciseGCForTesting;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 // HeapPage header. We use some of the bits to determine 819 // HeapPage header. We use some of the bits to determine
808 // whether the page is part of a terminting thread or 820 // whether the page is part of a terminting thread or
809 // if the page is traced after being terminated (orphaned). 821 // if the page is traced after being terminated (orphaned).
810 uintptr_t m_terminating : 1; 822 uintptr_t m_terminating : 1;
811 uintptr_t m_tracedAfterOrphaned : 1; 823 uintptr_t m_tracedAfterOrphaned : 1;
812 }; 824 };
813 825
814 } 826 }
815 827
816 #endif // ThreadState_h 828 #endif // ThreadState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698