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

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

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

Powered by Google App Engine
This is Rietveld 408576698