| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // need, so unless we have this class we get compile errors. | 187 // need, so unless we have this class we get compile errors. |
| 188 class PartitionAllocatorDummyVisitor { | 188 class PartitionAllocatorDummyVisitor { |
| 189 public: | 189 public: |
| 190 template<typename T> inline bool isHeapObjectAlive(T obj) | 190 template<typename T> inline bool isHeapObjectAlive(T obj) |
| 191 { | 191 { |
| 192 ASSERT_NOT_REACHED(); | 192 ASSERT_NOT_REACHED(); |
| 193 return false; | 193 return false; |
| 194 } | 194 } |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 // Specializations for heap profiling, so type profiling of |char| is possible |
| 198 // even in official builds (because |char| makes up a large portion of the heap.
) |
| 199 template <> char* PartitionAllocator::allocateVectorBacking<char>(size_t size); |
| 200 template <> char* PartitionAllocator::allocateExpandedVectorBacking<char>(size_t
size); |
| 201 |
| 197 } // namespace WTF | 202 } // namespace WTF |
| 198 | 203 |
| 199 #define WTF_USE_ALLOCATOR(ClassName, Allocator) \ | 204 #define WTF_USE_ALLOCATOR(ClassName, Allocator) \ |
| 200 public: \ | 205 public: \ |
| 201 void* operator new(size_t size) \ | 206 void* operator new(size_t size) \ |
| 202 { \ | 207 { \ |
| 203 return Allocator::template malloc<void*, ClassName>(size, WTF_HEAP_PROFI
LER_TYPE_NAME(ClassName)); \ | 208 return Allocator::template malloc<void*, ClassName>(size, WTF_HEAP_PROFI
LER_TYPE_NAME(ClassName)); \ |
| 204 } \ | 209 } \ |
| 205 void operator delete(void* p) { Allocator::free(p); } \ | 210 void operator delete(void* p) { Allocator::free(p); } \ |
| 206 void* operator new[](size_t size) { return Allocator::template newArray<Clas
sName>(size); } \ | 211 void* operator new[](size_t size) { return Allocator::template newArray<Clas
sName>(size); } \ |
| 207 void operator delete[](void* p) { Allocator::deleteArray(p); } \ | 212 void operator delete[](void* p) { Allocator::deleteArray(p); } \ |
| 208 void* operator new(size_t, NotNullTag, void* location) \ | 213 void* operator new(size_t, NotNullTag, void* location) \ |
| 209 { \ | 214 { \ |
| 210 ASSERT(location); \ | 215 ASSERT(location); \ |
| 211 return location; \ | 216 return location; \ |
| 212 } \ | 217 } \ |
| 213 private: \ | 218 private: \ |
| 214 typedef int __thisIsHereToForceASemicolonAfterThisMacro | 219 typedef int __thisIsHereToForceASemicolonAfterThisMacro |
| 215 | 220 |
| 216 using WTF::PartitionAllocator; | 221 using WTF::PartitionAllocator; |
| 217 | 222 |
| 218 #endif // WTF_PartitionAllocator_h | 223 #endif // WTF_PartitionAllocator_h |
| OLD | NEW |