| 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 14 matching lines...) Expand all  Loading... | 
| 25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
| 26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
| 27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
| 28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
| 29  */ | 29  */ | 
| 30 | 30 | 
| 31 #ifndef Heap_h | 31 #ifndef Heap_h | 
| 32 #define Heap_h | 32 #define Heap_h | 
| 33 | 33 | 
| 34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" | 
| 35 #include "platform/heap/AddressSanitizer.h" |  | 
| 36 #include "platform/heap/GCInfo.h" | 35 #include "platform/heap/GCInfo.h" | 
| 37 #include "platform/heap/ThreadState.h" | 36 #include "platform/heap/ThreadState.h" | 
| 38 #include "platform/heap/Visitor.h" | 37 #include "platform/heap/Visitor.h" | 
| 39 #include "public/platform/WebThread.h" | 38 #include "public/platform/WebThread.h" | 
|  | 39 #include "wtf/AddressSanitizer.h" | 
| 40 #include "wtf/Assertions.h" | 40 #include "wtf/Assertions.h" | 
| 41 #include "wtf/Atomics.h" | 41 #include "wtf/Atomics.h" | 
| 42 #include "wtf/ContainerAnnotations.h" | 42 #include "wtf/ContainerAnnotations.h" | 
| 43 #include "wtf/Forward.h" | 43 #include "wtf/Forward.h" | 
| 44 #include "wtf/PageAllocator.h" | 44 #include "wtf/PageAllocator.h" | 
| 45 #include <stdint.h> | 45 #include <stdint.h> | 
| 46 | 46 | 
| 47 namespace blink { | 47 namespace blink { | 
| 48 | 48 | 
| 49 const size_t blinkPageSizeLog2 = 17; | 49 const size_t blinkPageSizeLog2 = 17; | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 69 | 69 | 
| 70 const uint8_t freelistZapValue = 42; | 70 const uint8_t freelistZapValue = 42; | 
| 71 const uint8_t finalizedZapValue = 24; | 71 const uint8_t finalizedZapValue = 24; | 
| 72 // The orphaned zap value must be zero in the lowest bits to allow for using | 72 // The orphaned zap value must be zero in the lowest bits to allow for using | 
| 73 // the mark bit when tracing. | 73 // the mark bit when tracing. | 
| 74 const uint8_t orphanedZapValue = 240; | 74 const uint8_t orphanedZapValue = 240; | 
| 75 // A zap value for vtables should be < 4K to ensure it cannot be | 75 // A zap value for vtables should be < 4K to ensure it cannot be | 
| 76 // used for dispatch. | 76 // used for dispatch. | 
| 77 static const intptr_t zappedVTable = 0xd0d; | 77 static const intptr_t zappedVTable = 0xd0d; | 
| 78 | 78 | 
|  | 79 #if defined(ADDRESS_SANITIZER) | 
|  | 80 const size_t asanMagic = 0xabefeed0; | 
|  | 81 const size_t asanDeferMemoryReuseCount = 2; | 
|  | 82 const size_t asanDeferMemoryReuseMask = 0x3; | 
|  | 83 #endif | 
|  | 84 | 
| 79 #if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) | 85 #if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) | 
| 80 #define FILL_ZERO_IF_PRODUCTION(address, size) do { } while (false) | 86 #define FILL_ZERO_IF_PRODUCTION(address, size) do { } while (false) | 
| 81 #define FILL_ZERO_IF_NOT_PRODUCTION(address, size) memset((address), 0, (size)) | 87 #define FILL_ZERO_IF_NOT_PRODUCTION(address, size) memset((address), 0, (size)) | 
| 82 #else | 88 #else | 
| 83 #define FILL_ZERO_IF_PRODUCTION(address, size) memset((address), 0, (size)) | 89 #define FILL_ZERO_IF_PRODUCTION(address, size) memset((address), 0, (size)) | 
| 84 #define FILL_ZERO_IF_NOT_PRODUCTION(address, size) do { } while (false) | 90 #define FILL_ZERO_IF_NOT_PRODUCTION(address, size) do { } while (false) | 
| 85 #endif | 91 #endif | 
| 86 | 92 | 
| 87 class CallbackStack; | 93 class CallbackStack; | 
| 88 class FreePagePool; | 94 class FreePagePool; | 
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1238     size_t copySize = previousHeader->payloadSize(); | 1244     size_t copySize = previousHeader->payloadSize(); | 
| 1239     if (copySize > size) | 1245     if (copySize > size) | 
| 1240         copySize = size; | 1246         copySize = size; | 
| 1241     memcpy(address, previous, copySize); | 1247     memcpy(address, previous, copySize); | 
| 1242     return address; | 1248     return address; | 
| 1243 } | 1249 } | 
| 1244 | 1250 | 
| 1245 } // namespace blink | 1251 } // namespace blink | 
| 1246 | 1252 | 
| 1247 #endif // Heap_h | 1253 #endif // Heap_h | 
| OLD | NEW | 
|---|