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

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

Issue 1360763002: Sync m_lastRemainingAllocationSize on promptly freeing objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: invert the logic Created 5 years, 3 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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 size_t size = header->size(); 660 size_t size = header->size();
661 size_t payloadSize = header->payloadSize(); 661 size_t payloadSize = header->payloadSize();
662 ASSERT(size > 0); 662 ASSERT(size > 0);
663 ASSERT(pageFromObject(address) == findPageFromAddress(address)); 663 ASSERT(pageFromObject(address) == findPageFromAddress(address));
664 664
665 { 665 {
666 ThreadState::SweepForbiddenScope forbiddenScope(threadState()); 666 ThreadState::SweepForbiddenScope forbiddenScope(threadState());
667 header->finalize(payload, payloadSize); 667 header->finalize(payload, payloadSize);
668 if (address + size == m_currentAllocationPoint) { 668 if (address + size == m_currentAllocationPoint) {
669 m_currentAllocationPoint = address; 669 m_currentAllocationPoint = address;
670 if (m_lastRemainingAllocationSize == m_remainingAllocationSize) {
671 Heap::decreaseAllocatedObjectSize(size);
672 m_lastRemainingAllocationSize += size;
673 }
674 m_remainingAllocationSize += size; 670 m_remainingAllocationSize += size;
671 // Sync recorded allocated-object size:
672 // - if previous alloc checkpoint is larger, allocation size has in creased.
673 // - if smaller, a net reduction in size since last call to updateR emainingAllocationSize().
674 if (m_lastRemainingAllocationSize > m_remainingAllocationSize)
675 Heap::increaseAllocatedObjectSize(m_lastRemainingAllocationSize - m_remainingAllocationSize);
676 else if (m_lastRemainingAllocationSize != m_remainingAllocationSize)
677 Heap::decreaseAllocatedObjectSize(m_remainingAllocationSize - m_ lastRemainingAllocationSize);
678 m_lastRemainingAllocationSize = m_remainingAllocationSize;
675 SET_MEMORY_INACCESSIBLE(address, size); 679 SET_MEMORY_INACCESSIBLE(address, size);
676 return; 680 return;
677 } 681 }
678 SET_MEMORY_INACCESSIBLE(payload, payloadSize); 682 SET_MEMORY_INACCESSIBLE(payload, payloadSize);
679 header->markPromptlyFreed(); 683 header->markPromptlyFreed();
680 } 684 }
681 685
682 m_promptlyFreedSize += size; 686 m_promptlyFreedSize += size;
683 } 687 }
684 688
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 1823
1820 m_hasEntries = true; 1824 m_hasEntries = true;
1821 size_t index = hash(address); 1825 size_t index = hash(address);
1822 ASSERT(!(index & 1)); 1826 ASSERT(!(index & 1));
1823 Address cachePage = roundToBlinkPageStart(address); 1827 Address cachePage = roundToBlinkPageStart(address);
1824 m_entries[index + 1] = m_entries[index]; 1828 m_entries[index + 1] = m_entries[index];
1825 m_entries[index] = cachePage; 1829 m_entries[index] = cachePage;
1826 } 1830 }
1827 1831
1828 } // namespace blink 1832 } // 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