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

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

Issue 1842263004: Large heap collection type hits assertion in Heap::allocationSizeFromSize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | third_party/WebKit/Source/platform/heap/HeapTest.cpp » ('j') | 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 static void registerWeakTable(void* containerObject, EphemeronCallback, Ephe meronCallback); 212 static void registerWeakTable(void* containerObject, EphemeronCallback, Ephe meronCallback);
213 #if ENABLE(ASSERT) 213 #if ENABLE(ASSERT)
214 static bool weakTableRegistered(const void*); 214 static bool weakTableRegistered(const void*);
215 #endif 215 #endif
216 216
217 static inline size_t allocationSizeFromSize(size_t size) 217 static inline size_t allocationSizeFromSize(size_t size)
218 { 218 {
219 // Check the size before computing the actual allocation size. The 219 // Check the size before computing the actual allocation size. The
220 // allocation size calculation can overflow for large sizes and the chec k 220 // allocation size calculation can overflow for large sizes and the chec k
221 // therefore has to happen before any calculation on the size. 221 // therefore has to happen before any calculation on the size.
222 RELEASE_ASSERT(size < maxHeapObjectSize); 222 RELEASE_ASSERT(size < std::numeric_limits<size_t>::max() - sizeof(HeapOb jectHeader));
haraken 2016/03/31 08:00:41 Can we remove the maxHeapObjectSize definition?
keishi 2016/03/31 08:07:39 HeapAllocator::quantizedSize is using it.
haraken 2016/03/31 08:00:41 A better assert would be: size_t allocationSize =
keishi 2016/03/31 08:07:39 Done.
223 223
224 // Add space for header. 224 // Add space for header.
225 size_t allocationSize = size + sizeof(HeapObjectHeader); 225 size_t allocationSize = size + sizeof(HeapObjectHeader);
226 // Align size with allocation granularity. 226 // Align size with allocation granularity.
227 allocationSize = (allocationSize + allocationMask) & ~allocationMask; 227 allocationSize = (allocationSize + allocationMask) & ~allocationMask;
228 return allocationSize; 228 return allocationSize;
229 } 229 }
230 static Address allocateOnArenaIndex(ThreadState*, size_t, int arenaIndex, si ze_t gcInfoIndex, const char* typeName); 230 static Address allocateOnArenaIndex(ThreadState*, size_t, int arenaIndex, si ze_t gcInfoIndex, const char* typeName);
231 template<typename T> static Address allocate(size_t, bool eagerlySweep = fal se); 231 template<typename T> static Address allocate(size_t, bool eagerlySweep = fal se);
232 template<typename T> static Address reallocate(void* previous, size_t); 232 template<typename T> static Address reallocate(void* previous, size_t);
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) 530 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object)
531 { 531 {
532 T** cell = reinterpret_cast<T**>(object); 532 T** cell = reinterpret_cast<T**>(object);
533 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) 533 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell))
534 *cell = nullptr; 534 *cell = nullptr;
535 } 535 }
536 536
537 } // namespace blink 537 } // namespace blink
538 538
539 #endif // Heap_h 539 #endif // Heap_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/HeapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698