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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1018 template<typename T> | 1018 template<typename T> |
1019 T* adoptRefCountedGarbageCollected(T* ptr) | 1019 T* adoptRefCountedGarbageCollected(T* ptr) |
1020 { | 1020 { |
1021 ASSERT(ptr->hasOneRef()); | 1021 ASSERT(ptr->hasOneRef()); |
1022 ptr->deref(); | 1022 ptr->deref(); |
1023 WTF::adopted(ptr); | 1023 WTF::adopted(ptr); |
1024 return ptr; | 1024 return ptr; |
1025 } | 1025 } |
1026 | 1026 |
1027 #if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS) | 1027 #if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS) |
1028 #define DISALLOW_ALLOCATION() \ | 1028 #define DISALLOW_ALLOCATION() \ |
1029 private: \ | 1029 private: \ |
1030 void* operator new(size_t) = delete; | 1030 void* operator new(size_t) = delete; \ |
1031 #else | 1031 void* operator new(size_t, NotNullTag, void*) = delete; \ |
1032 #define DISALLOW_ALLOCATION() \ | 1032 void* operator new (size_t, void*) = delete; |
1033 private: \ | |
1034 void* operator new(size_t); | |
1035 #endif | |
1036 | 1033 |
1037 #define ALLOW_ONLY_INLINE_ALLOCATION() \ | 1034 #define ALLOW_ONLY_INLINE_ALLOCATION() \ |
1038 public: \ | 1035 public: \ |
1039 void* operator new(size_t, NotNullTag, void* location) { return location ; } \ | 1036 void* operator new(size_t, NotNullTag, void* location) { return location ; } \ |
1040 void* operator new(size_t, void* location) { return location; } \ | 1037 void* operator new(size_t, void* location) { return location; } \ |
1041 DISALLOW_ALLOCATION() | 1038 private: \ |
1039 void* operator new(size_t) = delete; | |
1040 | |
1041 #else | |
1042 | |
1043 #define DISALLOW_ALLOCATION() \ | |
1044 private: \ | |
1045 void* operator new(size_t); \ | |
1046 void* operator new(size_t, NotNullTag, void*); \ | |
1047 void* operator new(size_t, void*) | |
1048 | |
1049 #define ALLOW_ONLY_INLINE_ALLOCATION() \ | |
1050 public: \ | |
1051 void* operator new(size_t, NotNullTag, void* location) { return location ; } \ | |
1052 void* operator new(size_t, void* location) { return location; } \ | |
1053 private: \ | |
1054 void operator new(size_t); | |
1055 | |
1056 #endif | |
1057 | |
1042 | 1058 |
1043 // These macros insert annotations that the Blink GC plugin for clang uses for | 1059 // These macros insert annotations that the Blink GC plugin for clang uses for |
1044 // verification. STACK_ALLOCATED is used to declare that objects of this type | 1060 // verification. STACK_ALLOCATED is used to declare that objects of this type |
1045 // are always stack allocated. GC_PLUGIN_IGNORE is used to make the plugin | 1061 // are always stack allocated. GC_PLUGIN_IGNORE is used to make the plugin |
1046 // ignore a particular class or field when checking for proper usage. When using | 1062 // ignore a particular class or field when checking for proper usage. When using |
1047 // GC_PLUGIN_IGNORE a bug-number should be provided as an argument where the | 1063 // GC_PLUGIN_IGNORE a bug-number should be provided as an argument where the |
1048 // bug describes what needs to happen to remove the GC_PLUGIN_IGNORE again. | 1064 // bug describes what needs to happen to remove the GC_PLUGIN_IGNORE again. |
1049 #if COMPILER(CLANG) | 1065 #if COMPILER(CLANG) |
1050 #define STACK_ALLOCATED() \ | 1066 #define STACK_ALLOCATED() \ |
1051 private: \ | 1067 private: \ |
1052 __attribute__((annotate("blink_stack_allocated"))) \ | 1068 __attribute__((annotate("blink_stack_allocated"))) \ |
1053 void* operator new(size_t) = delete; | 1069 DISALLOW_ALLOCATION() |
Mads Ager (chromium)
2014/03/20 07:28:05
This doesn't work. I'll have to add them all here
zerny-chromium
2014/03/20 07:30:02
I'm not sure if this will work now that there is a
| |
1070 | |
1054 #define GC_PLUGIN_IGNORE(bug) \ | 1071 #define GC_PLUGIN_IGNORE(bug) \ |
1055 __attribute__((annotate("blink_gc_plugin_ignore"))) | 1072 __attribute__((annotate("blink_gc_plugin_ignore"))) |
1056 #else | 1073 #else |
1057 #define STACK_ALLOCATED() DISALLOW_ALLOCATION() | 1074 #define STACK_ALLOCATED() DISALLOW_ALLOCATION() |
1058 #define GC_PLUGIN_IGNORE(bug) | 1075 #define GC_PLUGIN_IGNORE(bug) |
1059 #endif | 1076 #endif |
1060 | 1077 |
1061 NO_SANITIZE_ADDRESS | 1078 NO_SANITIZE_ADDRESS |
1062 void HeapObjectHeader::checkHeader() const | 1079 void HeapObjectHeader::checkHeader() const |
1063 { | 1080 { |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1715 // to export. This forces it to export all the methods from ThreadHeap. | 1732 // to export. This forces it to export all the methods from ThreadHeap. |
1716 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf o*); | 1733 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf o*); |
1717 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*); | 1734 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*); |
1718 extern template class HEAP_EXPORT ThreadHeap<FinalizedHeapObjectHeader>; | 1735 extern template class HEAP_EXPORT ThreadHeap<FinalizedHeapObjectHeader>; |
1719 extern template class HEAP_EXPORT ThreadHeap<HeapObjectHeader>; | 1736 extern template class HEAP_EXPORT ThreadHeap<HeapObjectHeader>; |
1720 #endif | 1737 #endif |
1721 | 1738 |
1722 } | 1739 } |
1723 | 1740 |
1724 #endif // Heap_h | 1741 #endif // Heap_h |
OLD | NEW |