| OLD | NEW |
| 1 // Copyright (c) 2005, 2007, Google Inc. | 1 // Copyright (c) 2005, 2007, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserv
ed. | 3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserv
ed. |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // * malloc/free of small objects goes from ~300 ns to ~50 ns. | 73 // * malloc/free of small objects goes from ~300 ns to ~50 ns. |
| 74 // * allocation of a reasonably complicated struct | 74 // * allocation of a reasonably complicated struct |
| 75 // goes from about 1100 ns to about 300 ns. | 75 // goes from about 1100 ns to about 300 ns. |
| 76 | 76 |
| 77 #include "config.h" | 77 #include "config.h" |
| 78 #include "wtf/FastMalloc.h" | 78 #include "wtf/FastMalloc.h" |
| 79 | 79 |
| 80 #include "wtf/Assertions.h" | 80 #include "wtf/Assertions.h" |
| 81 #include "wtf/CPU.h" | 81 #include "wtf/CPU.h" |
| 82 #include "wtf/StdLibExtras.h" | 82 #include "wtf/StdLibExtras.h" |
| 83 #include "wtf/UnusedParam.h" | |
| 84 | 83 |
| 85 #if OS(MACOSX) | 84 #if OS(MACOSX) |
| 86 #include <AvailabilityMacros.h> | 85 #include <AvailabilityMacros.h> |
| 87 #endif | 86 #endif |
| 88 | 87 |
| 89 #include <limits> | 88 #include <limits> |
| 90 #if OS(WIN) | 89 #if OS(WIN) |
| 91 #include <windows.h> | 90 #include <windows.h> |
| 92 #else | 91 #else |
| 93 #include <pthread.h> | 92 #include <pthread.h> |
| (...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2312 length_--; | 2311 length_--; |
| 2313 if (length_ < lowater_) lowater_ = length_; | 2312 if (length_ < lowater_) lowater_ = length_; |
| 2314 return SLL_Pop(&list_, entropy_).value(); | 2313 return SLL_Pop(&list_, entropy_).value(); |
| 2315 } | 2314 } |
| 2316 | 2315 |
| 2317 // Runs through the linked list to ensure that | 2316 // Runs through the linked list to ensure that |
| 2318 // we can do that, and ensures that 'missing' | 2317 // we can do that, and ensures that 'missing' |
| 2319 // is not present | 2318 // is not present |
| 2320 NEVER_INLINE void Validate(HardenedSLL missing, size_t size) { | 2319 NEVER_INLINE void Validate(HardenedSLL missing, size_t size) { |
| 2321 HardenedSLL node = list_; | 2320 HardenedSLL node = list_; |
| 2322 UNUSED_PARAM(size); | |
| 2323 while (node) { | 2321 while (node) { |
| 2324 RELEASE_ASSERT(node != missing); | 2322 RELEASE_ASSERT(node != missing); |
| 2325 RELEASE_ASSERT(IS_DEFINITELY_POISONED(node.value(), size)); | 2323 RELEASE_ASSERT(IS_DEFINITELY_POISONED(node.value(), size)); |
| 2326 node = SLL_Next(node, entropy_); | 2324 node = SLL_Next(node, entropy_); |
| 2327 } | 2325 } |
| 2328 } | 2326 } |
| 2329 | 2327 |
| 2330 template <class Finder, class Reader> | 2328 template <class Finder, class Reader> |
| 2331 void enumerateFreeObjects(Finder& finder, const Reader& reader) | 2329 void enumerateFreeObjects(Finder& finder, const Reader& reader) |
| 2332 { | 2330 { |
| (...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3843 void FastMallocZone::init() | 3841 void FastMallocZone::init() |
| 3844 { | 3842 { |
| 3845 static FastMallocZone zone(pageheap, &thread_heaps, static_cast<TCMalloc_Cen
tral_FreeListPadded*>(central_cache), &span_allocator, &threadheap_allocator); | 3843 static FastMallocZone zone(pageheap, &thread_heaps, static_cast<TCMalloc_Cen
tral_FreeListPadded*>(central_cache), &span_allocator, &threadheap_allocator); |
| 3846 } | 3844 } |
| 3847 | 3845 |
| 3848 #endif // OS(MACOSX) | 3846 #endif // OS(MACOSX) |
| 3849 | 3847 |
| 3850 } // namespace WTF | 3848 } // namespace WTF |
| 3851 | 3849 |
| 3852 #endif // FORCE_SYSTEM_MALLOC | 3850 #endif // FORCE_SYSTEM_MALLOC |
| OLD | NEW |