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

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

Issue 1213133002: Oilpan: Reduce sizeof(Persistent) to 16 byte (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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
« no previous file with comments | « Source/platform/heap/PersistentNode.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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 466 }
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 // A region of PersistentNodes 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 // A region of PersistentNodes not owned by any particular thread.
479 // globalRootsMutex must be acquired before any modifications. 480 static CrossThreadPersistentRegion& crossThreadPersistentRegion();
480 static PersistentAnchor& globalRoots();
481 static Mutex& globalRootsMutex();
482 481
483 // Visit local thread stack and trace all pointers conservatively. 482 // Visit local thread stack and trace all pointers conservatively.
484 void visitStack(Visitor*); 483 void visitStack(Visitor*);
485 484
486 // Visit the asan fake stack frame corresponding to a slot on the 485 // Visit the asan fake stack frame corresponding to a slot on the
487 // real machine stack if there is one. 486 // real machine stack if there is one.
488 void visitAsanFakeStackForPointer(Visitor*, Address); 487 void visitAsanFakeStackForPointer(Visitor*, Address);
489 488
490 // Visit all persistents allocated on this thread. 489 // Visit all persistents allocated on this thread.
491 void visitPersistents(Visitor*); 490 void visitPersistents(Visitor*);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 // We can't create a static member of type ThreadState here 725 // We can't create a static member of type ThreadState here
727 // because it will introduce global constructor and destructor. 726 // because it will introduce global constructor and destructor.
728 // We would like to manage lifetime of the ThreadState attached 727 // We would like to manage lifetime of the ThreadState attached
729 // to the main thread explicitly instead and still use normal 728 // to the main thread explicitly instead and still use normal
730 // constructor and destructor for the ThreadState class. 729 // constructor and destructor for the ThreadState class.
731 // For this we reserve static storage for the main ThreadState 730 // For this we reserve static storage for the main ThreadState
732 // and lazily construct ThreadState in it using placement new. 731 // and lazily construct ThreadState in it using placement new.
733 static uint8_t s_mainThreadStateStorage[]; 732 static uint8_t s_mainThreadStateStorage[];
734 733
735 ThreadIdentifier m_thread; 734 ThreadIdentifier m_thread;
736 OwnPtr<PersistentAnchor> m_persistents; 735 OwnPtr<PersistentRegion> m_persistentRegion;
737 StackState m_stackState; 736 StackState m_stackState;
738 intptr_t* m_startOfStack; 737 intptr_t* m_startOfStack;
739 intptr_t* m_endOfStack; 738 intptr_t* m_endOfStack;
740 void* m_safePointScopeMarker; 739 void* m_safePointScopeMarker;
741 Vector<Address> m_safePointStackCopy; 740 Vector<Address> m_safePointStackCopy;
742 bool m_atSafePoint; 741 bool m_atSafePoint;
743 Vector<Interruptor*> m_interruptors; 742 Vector<Interruptor*> m_interruptors;
744 bool m_sweepForbidden; 743 bool m_sweepForbidden;
745 size_t m_noAllocationCount; 744 size_t m_noAllocationCount;
746 size_t m_gcForbiddenCount; 745 size_t m_gcForbiddenCount;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 }; 792 };
794 793
795 template<> class ThreadStateFor<AnyThread> { 794 template<> class ThreadStateFor<AnyThread> {
796 public: 795 public:
797 static ThreadState* state() { return ThreadState::current(); } 796 static ThreadState* state() { return ThreadState::current(); }
798 }; 797 };
799 798
800 } // namespace blink 799 } // namespace blink
801 800
802 #endif // ThreadState_h 801 #endif // ThreadState_h
OLDNEW
« no previous file with comments | « Source/platform/heap/PersistentNode.cpp ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698