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

Side by Side Diff: Source/wtf/PartitionAlloc.cpp

Issue 172533004: Add partitionAllocActualSize() for predicting actual size of allocation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 page->nextPage = 0; 519 page->nextPage = 0;
520 } 520 }
521 } 521 }
522 522
523 bucket->activePagesHead = 0; 523 bucket->activePagesHead = 0;
524 return false; 524 return false;
525 } 525 }
526 526
527 static ALWAYS_INLINE void* partitionDirectMap(PartitionRootBase* root, int flags , size_t size) 527 static ALWAYS_INLINE void* partitionDirectMap(PartitionRootBase* root, int flags , size_t size)
528 { 528 {
529 size += kSystemPageOffsetMask; 529 size = partitionDirectMapSize(size);
530 size &= kSystemPageBaseMask; 530
531 // Because we need to fake looking like a super page, We need to allocate 531 // Because we need to fake looking like a super page, We need to allocate
532 // a bunch of system pages more than "size": 532 // a bunch of system pages more than "size":
533 // - The first few system pages are the partition page in which the super 533 // - The first few system pages are the partition page in which the super
534 // page metadata is stored. We fault just one system page out of a partition 534 // page metadata is stored. We fault just one system page out of a partition
535 // page sized clump. 535 // page sized clump.
536 // - We add a trailing guard page. 536 // - We add a trailing guard page.
537 size_t mapSize = size + kPartitionPageSize + kSystemPageSize; 537 size_t mapSize = size + kPartitionPageSize + kSystemPageSize;
538 // Round up to the allocation granularity. 538 // Round up to the allocation granularity.
539 mapSize += kPageAllocationGranularityOffsetMask; 539 mapSize += kPageAllocationGranularityOffsetMask;
540 mapSize &= kPageAllocationGranularityBaseMask; 540 mapSize &= kPageAllocationGranularityBaseMask;
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 printf("total live: %zu bytes\n", totalLive); 855 printf("total live: %zu bytes\n", totalLive);
856 printf("total resident: %zu bytes\n", totalResident); 856 printf("total resident: %zu bytes\n", totalResident);
857 printf("total freeable: %zu bytes\n", totalFreeable); 857 printf("total freeable: %zu bytes\n", totalFreeable);
858 fflush(stdout); 858 fflush(stdout);
859 } 859 }
860 860
861 #endif // !NDEBUG 861 #endif // !NDEBUG
862 862
863 } // namespace WTF 863 } // namespace WTF
864 864
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698