| OLD | NEW | 
|---|
| 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  Loading... | 
| 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     ASSERT(s_gcInfoTable); \ | 
|  | 857     s_gcInfoTable[gcInfoIndex] = &gcInfo; \ | 
| 859     return gcInfoIndex; | 858     return gcInfoIndex; | 
| 860 | 859 | 
| 861 template<typename T> | 860 template<typename T> | 
| 862 struct GCInfoAtBase { | 861 struct GCInfoAtBase { | 
| 863     static size_t index() | 862     static size_t index() | 
| 864     { | 863     { | 
| 865         static const GCInfo gcInfo = { | 864         static const GCInfo gcInfo = { | 
| 866             TraceTrait<T>::trace, | 865             TraceTrait<T>::trace, | 
| 867             FinalizerTrait<T>::finalize, | 866             FinalizerTrait<T>::finalize, | 
| 868             FinalizerTrait<T>::nonTrivialFinalizer, | 867             FinalizerTrait<T>::nonTrivialFinalizer, | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 891 struct GCInfoTrait { | 890 struct GCInfoTrait { | 
| 892     static size_t index() | 891     static size_t index() | 
| 893     { | 892     { | 
| 894         return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::index(); | 893         return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::index(); | 
| 895     } | 894     } | 
| 896 }; | 895 }; | 
| 897 | 896 | 
| 898 } | 897 } | 
| 899 | 898 | 
| 900 #endif | 899 #endif | 
| OLD | NEW | 
|---|