Chromium Code Reviews| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 size_t i; | 289 size_t i; |
| 290 for (i = 0; i < kGenericNumBucketedOrders * kGenericNumBucketsPerOrder; ++i) { | 290 for (i = 0; i < kGenericNumBucketedOrders * kGenericNumBucketsPerOrder; ++i) { |
| 291 PartitionBucket* bucket = &root->buckets[i]; | 291 PartitionBucket* bucket = &root->buckets[i]; |
| 292 if (!partitionAllocShutdownBucket(bucket)) | 292 if (!partitionAllocShutdownBucket(bucket)) |
| 293 noLeaks = false; | 293 noLeaks = false; |
| 294 } | 294 } |
| 295 partitionAllocBaseShutdown(root); | 295 partitionAllocBaseShutdown(root); |
| 296 return noLeaks; | 296 return noLeaks; |
| 297 } | 297 } |
| 298 | 298 |
| 299 static NEVER_INLINE void partitionOutOfMemory() | 299 static NEVER_INLINE void partitionOutOfMemory(const PartitionRootBase* root) |
| 300 { | 300 { |
| 301 if ((uint64_t)root->totalSizeOfCommittedPages + 1000000000 < (uint64_t)root- >totalSizeOfSuperPages) { | |
|
kouhei (in TOK)
2014/10/29 09:34:32
1000000000 should be named as "static const size_t
hiroshige
2014/11/06 10:59:13
Done.
| |
| 302 // OOMs where a lot of super pages are allocated but not committed, | |
| 303 // probably due to http://crbug.com/421387. | |
| 304 // Crash at a special address (0x9b) | |
| 305 // to be easily distinguished on crash reports. | |
| 306 ((void(*)())0x0000009b)(); | |
| 307 } | |
| 308 // Ordinary OOMs (where super pages are consumed and mostly committed). | |
| 301 IMMEDIATE_CRASH(); | 309 IMMEDIATE_CRASH(); |
| 302 } | 310 } |
| 303 | 311 |
| 304 static ALWAYS_INLINE void partitionDecommitSystemPages(PartitionRootBase* root, void* addr, size_t len) | 312 static ALWAYS_INLINE void partitionDecommitSystemPages(PartitionRootBase* root, void* addr, size_t len) |
| 305 { | 313 { |
| 306 decommitSystemPages(addr, len); | 314 decommitSystemPages(addr, len); |
| 307 ASSERT(root->totalSizeOfCommittedPages > len); | 315 ASSERT(root->totalSizeOfCommittedPages > len); |
| 308 root->totalSizeOfCommittedPages -= len; | 316 root->totalSizeOfCommittedPages -= len; |
| 309 } | 317 } |
| 310 | 318 |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 694 newPage = partitionPointerToPageNoAlignmentCheck(rawNewPage); | 702 newPage = partitionPointerToPageNoAlignmentCheck(rawNewPage); |
| 695 } | 703 } |
| 696 | 704 |
| 697 partitionPageReset(newPage, bucket); | 705 partitionPageReset(newPage, bucket); |
| 698 bucket->activePagesHead = newPage; | 706 bucket->activePagesHead = newPage; |
| 699 return partitionPageAllocAndFillFreelist(newPage); | 707 return partitionPageAllocAndFillFreelist(newPage); |
| 700 | 708 |
| 701 partitionAllocSlowPathFailed: | 709 partitionAllocSlowPathFailed: |
| 702 if (returnNull) | 710 if (returnNull) |
| 703 return nullptr; | 711 return nullptr; |
| 704 partitionOutOfMemory(); | 712 partitionOutOfMemory(root); |
| 705 return nullptr; | 713 return nullptr; |
| 706 } | 714 } |
| 707 | 715 |
| 708 static ALWAYS_INLINE void partitionFreePage(PartitionRootBase* root, PartitionPa ge* page) | 716 static ALWAYS_INLINE void partitionFreePage(PartitionRootBase* root, PartitionPa ge* page) |
| 709 { | 717 { |
| 710 ASSERT(page->freelistHead); | 718 ASSERT(page->freelistHead); |
| 711 ASSERT(!page->numAllocatedSlots); | 719 ASSERT(!page->numAllocatedSlots); |
| 712 partitionUnusePage(root, page); | 720 partitionUnusePage(root, page); |
| 713 // We actually leave the freed page in the active list. We'll sweep it on | 721 // We actually leave the freed page in the active list. We'll sweep it on |
| 714 // to the free page list when we next walk the active page list. Pulling | 722 // to the free page list when we next walk the active page list. Pulling |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 973 printf("total live: %zu bytes\n", totalLive); | 981 printf("total live: %zu bytes\n", totalLive); |
| 974 printf("total resident: %zu bytes\n", totalResident); | 982 printf("total resident: %zu bytes\n", totalResident); |
| 975 printf("total freeable: %zu bytes\n", totalFreeable); | 983 printf("total freeable: %zu bytes\n", totalFreeable); |
| 976 fflush(stdout); | 984 fflush(stdout); |
| 977 } | 985 } |
| 978 | 986 |
| 979 #endif // !NDEBUG | 987 #endif // !NDEBUG |
| 980 | 988 |
| 981 } // namespace WTF | 989 } // namespace WTF |
| 982 | 990 |
| OLD | NEW |