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

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

Issue 808803007: Allocate GCInfo descriptor table during Oilpan 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
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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 template<typename T> 835 template<typename T>
836 struct TypenameStringTrait { 836 struct TypenameStringTrait {
837 static const String& get() 837 static const String& get()
838 { 838 {
839 DEFINE_STATIC_LOCAL(String, typenameString, (WTF::extractTypeNameFromFun ctionName(WTF::extractNameFunction<T>()))); 839 DEFINE_STATIC_LOCAL(String, typenameString, (WTF::extractTypeNameFromFun ctionName(WTF::extractNameFunction<T>())));
840 return typenameString; 840 return typenameString;
841 } 841 }
842 }; 842 };
843 #endif 843 #endif
844 844
845 // s_gcInfoMap is a map used to encode a GCInfo* into a 15 bit integer. 845 // s_gcInfoTable is a map used to encode a GCInfo* into a 15 bit integer.
846 // FIXME: Currently we only allow 2^12 types of GCInfos because 846 const size_t gcInfoIndexMax = 1 << 15;
847 // s_gcInfoMap[2^15] increases the bss size unacceptably.
848 const size_t gcInfoIndexMax = 1 << 12;
849 extern PLATFORM_EXPORT int s_gcInfoIndex; 847 extern PLATFORM_EXPORT int s_gcInfoIndex;
850 extern PLATFORM_EXPORT const GCInfo* s_gcInfoMap[gcInfoIndexMax]; 848 extern PLATFORM_EXPORT GCInfo const** s_gcInfoTable;
851 849
852 // This macro should be used when returning a unique 15 bit integer 850 // This macro should be used when returning a unique 15 bit integer
853 // for a given gcInfo. 851 // for a given gcInfo.
854 #define RETURN_GCINFO_INDEX() \ 852 #define RETURN_GCINFO_INDEX() \
855 static const size_t gcInfoIndex = atomicIncrement(&s_gcInfoIndex); \ 853 static const size_t gcInfoIndex = atomicIncrement(&s_gcInfoIndex); \
856 ASSERT(gcInfoIndex >= 1); \ 854 ASSERT(gcInfoIndex >= 1); \
857 ASSERT(gcInfoIndex < gcInfoIndexMax); \ 855 ASSERT(gcInfoIndex < gcInfoIndexMax); \
858 s_gcInfoMap[gcInfoIndex] = &gcInfo; \ 856 s_gcInfoTable[gcInfoIndex] = &gcInfo; \
haraken 2015/01/06 08:08:04 Add ASSERT(s_gcInfoTable)
sof 2015/01/06 08:19:19 Done.
859 return gcInfoIndex; 857 return gcInfoIndex;
860 858
861 template<typename T> 859 template<typename T>
862 struct GCInfoAtBase { 860 struct GCInfoAtBase {
863 static size_t index() 861 static size_t index()
864 { 862 {
865 static const GCInfo gcInfo = { 863 static const GCInfo gcInfo = {
866 TraceTrait<T>::trace, 864 TraceTrait<T>::trace,
867 FinalizerTrait<T>::finalize, 865 FinalizerTrait<T>::finalize,
868 FinalizerTrait<T>::nonTrivialFinalizer, 866 FinalizerTrait<T>::nonTrivialFinalizer,
(...skipping 22 matching lines...) Expand all
891 struct GCInfoTrait { 889 struct GCInfoTrait {
892 static size_t index() 890 static size_t index()
893 { 891 {
894 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::index(); 892 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::index();
895 } 893 }
896 }; 894 };
897 895
898 } 896 }
899 897
900 #endif 898 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698