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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const size_t largeObjectSizeThreshold = blinkPageSize / 2; | 78 const size_t largeObjectSizeThreshold = blinkPageSize / 2; |
79 | 79 |
80 // A zap value used for freed memory that is allowed to be added to the free | 80 // A zap value used for freed memory that is allowed to be added to the free |
81 // list in the next addToFreeList(). | 81 // list in the next addToFreeList(). |
82 const uint8_t reuseAllowedZapValue = 0x2a; | 82 const uint8_t reuseAllowedZapValue = 0x2a; |
83 // A zap value used for freed memory that is forbidden to be added to the free | 83 // A zap value used for freed memory that is forbidden to be added to the free |
84 // list in the next addToFreeList(). | 84 // list in the next addToFreeList(). |
85 const uint8_t reuseForbiddenZapValue = 0x2c; | 85 const uint8_t reuseForbiddenZapValue = 0x2c; |
86 | 86 |
87 // In non-production builds, memory is zapped when it's freed. The zapped | 87 // In non-production builds, memory is zapped when it's freed. The zapped |
88 // memory is zeroed out when the memory is reused in ThreadHeap::allocateObject(
). | 88 // memory is zeroed out when the memory is reused in Heap::allocateObject(). |
89 // In production builds, memory is not zapped (for performance). The memory | 89 // In production builds, memory is not zapped (for performance). The memory |
90 // is just zeroed out when it is added to the free list. | 90 // is just zeroed out when it is added to the free list. |
91 #if defined(MEMORY_SANITIZER) | 91 #if defined(MEMORY_SANITIZER) |
92 // TODO(kojii): We actually need __msan_poison/unpoison here, but it'll be | 92 // TODO(kojii): We actually need __msan_poison/unpoison here, but it'll be |
93 // added later. | 93 // added later. |
94 #define SET_MEMORY_INACCESSIBLE(address, size) \ | 94 #define SET_MEMORY_INACCESSIBLE(address, size) \ |
95 FreeList::zapFreedMemory(address, size); | 95 FreeList::zapFreedMemory(address, size); |
96 #define SET_MEMORY_ACCESSIBLE(address, size) \ | 96 #define SET_MEMORY_ACCESSIBLE(address, size) \ |
97 memset((address), 0, (size)) | 97 memset((address), 0, (size)) |
98 #define CHECK_MEMORY_INACCESSIBLE(address, size) \ | 98 #define CHECK_MEMORY_INACCESSIBLE(address, size) \ |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 SET_MEMORY_ACCESSIBLE(result, allocationSize - sizeof(HeapObjectHeader))
; | 886 SET_MEMORY_ACCESSIBLE(result, allocationSize - sizeof(HeapObjectHeader))
; |
887 ASSERT(findPageFromAddress(headerAddress + allocationSize - 1)); | 887 ASSERT(findPageFromAddress(headerAddress + allocationSize - 1)); |
888 return result; | 888 return result; |
889 } | 889 } |
890 return outOfLineAllocate(allocationSize, gcInfoIndex); | 890 return outOfLineAllocate(allocationSize, gcInfoIndex); |
891 } | 891 } |
892 | 892 |
893 } // namespace blink | 893 } // namespace blink |
894 | 894 |
895 #endif // HeapPage_h | 895 #endif // HeapPage_h |
OLD | NEW |