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

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

Issue 1104803002: Oilpan: expand size of vector backing container when finalizing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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
« 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 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 }; 2177 };
2178 2178
2179 template<typename T, typename Traits> 2179 template<typename T, typename Traits>
2180 void HeapVectorBacking<T, Traits>::finalize(void* pointer) 2180 void HeapVectorBacking<T, Traits>::finalize(void* pointer)
2181 { 2181 {
2182 ASSERT(!WTF::IsTriviallyDestructible<T>::value); 2182 ASSERT(!WTF::IsTriviallyDestructible<T>::value);
2183 HeapObjectHeader* header = HeapObjectHeader::fromPayload(pointer); 2183 HeapObjectHeader* header = HeapObjectHeader::fromPayload(pointer);
2184 // Use the payload size as recorded by the heap to determine how many 2184 // Use the payload size as recorded by the heap to determine how many
2185 // elements to finalize. 2185 // elements to finalize.
2186 size_t length = header->payloadSize() / sizeof(T); 2186 size_t length = header->payloadSize() / sizeof(T);
2187 T* array = reinterpret_cast<T*>(pointer); 2187 T* buffer = reinterpret_cast<T*>(pointer);
2188 for (unsigned i = 0; i < length; ++i) { 2188 #ifdef ANNOTATE_CONTIGUOUS_CONTAINER
2189 array[i].~T(); 2189 // Like for trace(), have no option but to mark the whole container
2190 } 2190 // as accessible.
2191 ANNOTATE_CHANGE_SIZE(buffer, length, 0, length);
2192 #endif
2193 for (unsigned i = 0; i < length; ++i)
2194 buffer[i].~T();
2191 } 2195 }
2192 2196
2193 template<typename Table> 2197 template<typename Table>
2194 void HeapHashTableBacking<Table>::finalize(void* pointer) 2198 void HeapHashTableBacking<Table>::finalize(void* pointer)
2195 { 2199 {
2196 using Value = typename Table::ValueType; 2200 using Value = typename Table::ValueType;
2197 ASSERT(!WTF::IsTriviallyDestructible<Value>::value); 2201 ASSERT(!WTF::IsTriviallyDestructible<Value>::value);
2198 HeapObjectHeader* header = HeapObjectHeader::fromPayload(pointer); 2202 HeapObjectHeader* header = HeapObjectHeader::fromPayload(pointer);
2199 // Use the payload size as recorded by the heap to determine how many 2203 // Use the payload size as recorded by the heap to determine how many
2200 // elements to finalize. 2204 // elements to finalize.
2201 size_t length = header->payloadSize() / sizeof(Value); 2205 size_t length = header->payloadSize() / sizeof(Value);
2202 Value* table = reinterpret_cast<Value*>(pointer); 2206 Value* table = reinterpret_cast<Value*>(pointer);
2203 for (unsigned i = 0; i < length; ++i) { 2207 for (unsigned i = 0; i < length; ++i) {
2204 if (!Table::isEmptyOrDeletedBucket(table[i])) 2208 if (!Table::isEmptyOrDeletedBucket(table[i]))
2205 table[i].~Value(); 2209 table[i].~Value();
2206 } 2210 }
2207 } 2211 }
2208 2212
2209 } // namespace blink 2213 } // namespace blink
2210 2214
2211 #endif // Heap_h 2215 #endif // Heap_h
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