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

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

Issue 851723002: Oilpan: avoid data race on gcInfo index initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | Source/platform/heap/Visitor.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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef Visitor_h 31 #ifndef Visitor_h
32 #define Visitor_h 32 #define Visitor_h
33 33
34 #include "platform/PlatformExport.h" 34 #include "platform/PlatformExport.h"
35 #include "platform/heap/ThreadState.h" 35 #include "platform/heap/ThreadState.h"
36 #include "wtf/Assertions.h" 36 #include "wtf/Assertions.h"
37 #include "wtf/Atomics.h"
37 #include "wtf/Deque.h" 38 #include "wtf/Deque.h"
38 #include "wtf/Forward.h" 39 #include "wtf/Forward.h"
39 #include "wtf/HashMap.h" 40 #include "wtf/HashMap.h"
40 #include "wtf/HashTraits.h" 41 #include "wtf/HashTraits.h"
41 #include "wtf/InstanceCounter.h" 42 #include "wtf/InstanceCounter.h"
42 #include "wtf/OwnPtr.h" 43 #include "wtf/OwnPtr.h"
43 #include "wtf/RefPtr.h" 44 #include "wtf/RefPtr.h"
44 #include "wtf/TypeTraits.h" 45 #include "wtf/TypeTraits.h"
45 #include "wtf/WeakPtr.h" 46 #include "wtf/WeakPtr.h"
46 #if ENABLE(GC_PROFILING) 47 #if ENABLE(GC_PROFILING)
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 875
875 static int s_gcInfoIndex; 876 static int s_gcInfoIndex;
876 static size_t s_gcInfoTableSize; 877 static size_t s_gcInfoTableSize;
877 }; 878 };
878 879
879 // This macro should be used when returning a unique 15 bit integer 880 // This macro should be used when returning a unique 15 bit integer
880 // for a given gcInfo. 881 // for a given gcInfo.
881 #define RETURN_GCINFO_INDEX() \ 882 #define RETURN_GCINFO_INDEX() \
882 static size_t gcInfoIndex = 0; \ 883 static size_t gcInfoIndex = 0; \
883 ASSERT(s_gcInfoTable); \ 884 ASSERT(s_gcInfoTable); \
884 if (!gcInfoIndex) \ 885 if (!acquireLoad(&gcInfoIndex)) \
885 GCInfoTable::ensureGCInfoIndex(&gcInfo, &gcInfoIndex); \ 886 GCInfoTable::ensureGCInfoIndex(&gcInfo, &gcInfoIndex); \
886 ASSERT(gcInfoIndex >= 1); \ 887 ASSERT(gcInfoIndex >= 1); \
887 ASSERT(gcInfoIndex < GCInfoTable::maxIndex); \ 888 ASSERT(gcInfoIndex < GCInfoTable::maxIndex); \
888 return gcInfoIndex; 889 return gcInfoIndex;
889 890
890 template<typename T> 891 template<typename T>
891 struct GCInfoAtBase { 892 struct GCInfoAtBase {
892 static size_t index() 893 static size_t index()
893 { 894 {
894 static const GCInfo gcInfo = { 895 static const GCInfo gcInfo = {
(...skipping 25 matching lines...) Expand all
920 struct GCInfoTrait { 921 struct GCInfoTrait {
921 static size_t index() 922 static size_t index()
922 { 923 {
923 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::index(); 924 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::index();
924 } 925 }
925 }; 926 };
926 927
927 } 928 }
928 929
929 #endif 930 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/platform/heap/Visitor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698