Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: Source/platform/heap/Heap.cpp

Issue 1184633005: Build fix: Add NO_SANITIZE_ADDRESS to addToFreeList (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
1047 void FreeList::addToFreeList(Address address, size_t size) 1048 void FreeList::addToFreeList(Address address, size_t size)
1048 { 1049 {
1049 ASSERT(size < blinkPagePayloadSize()); 1050 ASSERT(size < blinkPagePayloadSize());
1050 // The free list entries are only pointer aligned (but when we allocate 1051 // The free list entries are only pointer aligned (but when we allocate
1051 // from them we are 8 byte aligned due to the header size). 1052 // from them we are 8 byte aligned due to the header size).
1052 ASSERT(!((reinterpret_cast<uintptr_t>(address) + sizeof(HeapObjectHeader)) & allocationMask)); 1053 ASSERT(!((reinterpret_cast<uintptr_t>(address) + sizeof(HeapObjectHeader)) & allocationMask));
1053 ASSERT(!(size & allocationMask)); 1054 ASSERT(!(size & allocationMask));
1054 ASAN_POISON_MEMORY_REGION(address, size); 1055 ASAN_POISON_MEMORY_REGION(address, size);
sof 2015/06/12 07:01:23 Can't we delay this instead?
haraken 2015/06/12 07:08:25 We shouldn't delay the poisoning :) It is importan
sof 2015/06/12 07:11:26 That doesn't make sense if you immediately afterwa
haraken 2015/06/12 07:15:45 Maybe I'm not sure I get your point. - Memory in
1055 FreeListEntry* entry; 1056 FreeListEntry* entry;
1056 if (size < sizeof(*entry)) { 1057 if (size < sizeof(*entry)) {
1057 // Create a dummy header with only a size and freelist bit set. 1058 // Create a dummy header with only a size and freelist bit set.
1058 ASSERT(size >= sizeof(HeapObjectHeader)); 1059 ASSERT(size >= sizeof(HeapObjectHeader));
1059 // Free list encode the size to mark the lost memory as freelist memory. 1060 // Free list encode the size to mark the lost memory as freelist memory.
1060 new (NotNull, address) HeapObjectHeader(size, gcInfoIndexForFreeListHead er); 1061 new (NotNull, address) HeapObjectHeader(size, gcInfoIndexForFreeListHead er);
1061 // This memory gets lost. Sweeping can reclaim it. 1062 // This memory gets lost. Sweeping can reclaim it.
1062 return; 1063 return;
1063 } 1064 }
1064 entry = new (NotNull, address) FreeListEntry(size); 1065 entry = new (NotNull, address) FreeListEntry(size);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 // region to the free list and reuse it for another object. 1106 // region to the free list and reuse it for another object.
1106 #endif 1107 #endif
1107 1108
1108 int index = bucketIndexForSize(size); 1109 int index = bucketIndexForSize(size);
1109 entry->link(&m_freeLists[index]); 1110 entry->link(&m_freeLists[index]);
1110 if (index > m_biggestFreeListIndex) 1111 if (index > m_biggestFreeListIndex)
1111 m_biggestFreeListIndex = index; 1112 m_biggestFreeListIndex = index;
1112 } 1113 }
1113 1114
1114 #if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) 1115 #if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER)
1116 NO_SANITIZE_ADDRESS
1115 void FreeList::zapFreedMemory(Address address, size_t size) 1117 void FreeList::zapFreedMemory(Address address, size_t size)
1116 { 1118 {
1117 for (size_t i = 0; i < size; i++) { 1119 for (size_t i = 0; i < size; i++) {
1118 // See the comment in addToFreeList(). 1120 // See the comment in addToFreeList().
1119 if (address[i] != reuseAllowedZapValue) 1121 if (address[i] != reuseAllowedZapValue)
1120 address[i] = reuseForbiddenZapValue; 1122 address[i] = reuseForbiddenZapValue;
1121 } 1123 }
1122 } 1124 }
1123 #endif 1125 #endif
1124 1126
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
2355 size_t Heap::s_allocatedObjectSize = 0; 2357 size_t Heap::s_allocatedObjectSize = 0;
2356 size_t Heap::s_allocatedSpace = 0; 2358 size_t Heap::s_allocatedSpace = 0;
2357 size_t Heap::s_markedObjectSize = 0; 2359 size_t Heap::s_markedObjectSize = 0;
2358 // We don't want to use 0 KB for the initial value because it may end up 2360 // We don't want to use 0 KB for the initial value because it may end up
2359 // triggering the first GC of some thread too prematurely. 2361 // triggering the first GC of some thread too prematurely.
2360 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; 2362 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024;
2361 size_t Heap::s_externalObjectSizeAtLastGC = 0; 2363 size_t Heap::s_externalObjectSizeAtLastGC = 0;
2362 double Heap::s_estimatedMarkingTimePerByte = 0.0; 2364 double Heap::s_estimatedMarkingTimePerByte = 0.0;
2363 2365
2364 } // namespace blink 2366 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698