| 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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 } | 1037 } |
| 1038 } | 1038 } |
| 1039 return result; | 1039 return result; |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 FreeList::FreeList() | 1042 FreeList::FreeList() |
| 1043 : m_biggestFreeListIndex(0) | 1043 : m_biggestFreeListIndex(0) |
| 1044 { | 1044 { |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 NO_SANITIZE_ADDRESS | |
| 1048 void FreeList::addToFreeList(Address address, size_t size) | 1047 void FreeList::addToFreeList(Address address, size_t size) |
| 1049 { | 1048 { |
| 1050 ASSERT(size < blinkPagePayloadSize()); | 1049 ASSERT(size < blinkPagePayloadSize()); |
| 1051 // The free list entries are only pointer aligned (but when we allocate | 1050 // The free list entries are only pointer aligned (but when we allocate |
| 1052 // from them we are 8 byte aligned due to the header size). | 1051 // from them we are 8 byte aligned due to the header size). |
| 1053 ASSERT(!((reinterpret_cast<uintptr_t>(address) + sizeof(HeapObjectHeader)) &
allocationMask)); | 1052 ASSERT(!((reinterpret_cast<uintptr_t>(address) + sizeof(HeapObjectHeader)) &
allocationMask)); |
| 1054 ASSERT(!(size & allocationMask)); | 1053 ASSERT(!(size & allocationMask)); |
| 1055 ASAN_POISON_MEMORY_REGION(address, size); | 1054 ASAN_POISON_MEMORY_REGION(address, size); |
| 1056 FreeListEntry* entry; | 1055 FreeListEntry* entry; |
| 1057 if (size < sizeof(*entry)) { | 1056 if (size < sizeof(*entry)) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 // region to the free list and reuse it for another object. | 1105 // region to the free list and reuse it for another object. |
| 1107 #endif | 1106 #endif |
| 1108 | 1107 |
| 1109 int index = bucketIndexForSize(size); | 1108 int index = bucketIndexForSize(size); |
| 1110 entry->link(&m_freeLists[index]); | 1109 entry->link(&m_freeLists[index]); |
| 1111 if (index > m_biggestFreeListIndex) | 1110 if (index > m_biggestFreeListIndex) |
| 1112 m_biggestFreeListIndex = index; | 1111 m_biggestFreeListIndex = index; |
| 1113 } | 1112 } |
| 1114 | 1113 |
| 1115 #if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) | 1114 #if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) |
| 1116 NO_SANITIZE_ADDRESS | |
| 1117 void FreeList::zapFreedMemory(Address address, size_t size) | 1115 void FreeList::zapFreedMemory(Address address, size_t size) |
| 1118 { | 1116 { |
| 1119 for (size_t i = 0; i < size; i++) { | 1117 for (size_t i = 0; i < size; i++) { |
| 1120 // See the comment in addToFreeList(). | 1118 // See the comment in addToFreeList(). |
| 1121 if (address[i] != reuseAllowedZapValue) | 1119 if (address[i] != reuseAllowedZapValue) |
| 1122 address[i] = reuseForbiddenZapValue; | 1120 address[i] = reuseForbiddenZapValue; |
| 1123 } | 1121 } |
| 1124 } | 1122 } |
| 1125 #endif | 1123 #endif |
| 1126 | 1124 |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 size_t Heap::s_allocatedObjectSize = 0; | 2355 size_t Heap::s_allocatedObjectSize = 0; |
| 2358 size_t Heap::s_allocatedSpace = 0; | 2356 size_t Heap::s_allocatedSpace = 0; |
| 2359 size_t Heap::s_markedObjectSize = 0; | 2357 size_t Heap::s_markedObjectSize = 0; |
| 2360 // We don't want to use 0 KB for the initial value because it may end up | 2358 // We don't want to use 0 KB for the initial value because it may end up |
| 2361 // triggering the first GC of some thread too prematurely. | 2359 // triggering the first GC of some thread too prematurely. |
| 2362 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; | 2360 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; |
| 2363 size_t Heap::s_externalObjectSizeAtLastGC = 0; | 2361 size_t Heap::s_externalObjectSizeAtLastGC = 0; |
| 2364 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 2362 double Heap::s_estimatedMarkingTimePerByte = 0.0; |
| 2365 | 2363 |
| 2366 } // namespace blink | 2364 } // namespace blink |
| OLD | NEW |