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

Side by Side Diff: Source/heap/Heap.h

Issue 199733009: Oilpan: tighten DISALLOW_ALLOCATION so it does not allow inline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comment Created 6 years, 9 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 | « no previous file | no next file » | 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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) && !defined(ADDRESS_SANITIZER) 1065 #if COMPILER(CLANG) && !defined(ADDRESS_SANITIZER)
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 void* operator new(size_t) = delete; \
1070 void* operator new(size_t, NotNullTag, void*) = delete; \
1071 void* operator new(size_t, void*) = delete;
1072
1054 #define GC_PLUGIN_IGNORE(bug) \ 1073 #define GC_PLUGIN_IGNORE(bug) \
1055 __attribute__((annotate("blink_gc_plugin_ignore"))) 1074 __attribute__((annotate("blink_gc_plugin_ignore")))
1056 #else 1075 #else
1057 #define STACK_ALLOCATED() DISALLOW_ALLOCATION() 1076 #define STACK_ALLOCATED() DISALLOW_ALLOCATION()
1058 #define GC_PLUGIN_IGNORE(bug) 1077 #define GC_PLUGIN_IGNORE(bug)
1059 #endif 1078 #endif
1060 1079
1061 NO_SANITIZE_ADDRESS 1080 NO_SANITIZE_ADDRESS
1062 void HeapObjectHeader::checkHeader() const 1081 void HeapObjectHeader::checkHeader() const
1063 { 1082 {
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 // to export. This forces it to export all the methods from ThreadHeap. 1734 // to export. This forces it to export all the methods from ThreadHeap.
1716 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf o*); 1735 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf o*);
1717 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*); 1736 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*);
1718 extern template class HEAP_EXPORT ThreadHeap<FinalizedHeapObjectHeader>; 1737 extern template class HEAP_EXPORT ThreadHeap<FinalizedHeapObjectHeader>;
1719 extern template class HEAP_EXPORT ThreadHeap<HeapObjectHeader>; 1738 extern template class HEAP_EXPORT ThreadHeap<HeapObjectHeader>;
1720 #endif 1739 #endif
1721 1740
1722 } 1741 }
1723 1742
1724 #endif // Heap_h 1743 #endif // Heap_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698