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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |