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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 void ThreadHeap<Header>::updateRemainingAllocationSize() | 694 void ThreadHeap<Header>::updateRemainingAllocationSize() |
695 { | 695 { |
696 if (m_lastRemainingAllocationSize > remainingAllocationSize()) { | 696 if (m_lastRemainingAllocationSize > remainingAllocationSize()) { |
697 stats().increaseObjectSpace(m_lastRemainingAllocationSize - remainingAll
ocationSize()); | 697 stats().increaseObjectSpace(m_lastRemainingAllocationSize - remainingAll
ocationSize()); |
698 m_lastRemainingAllocationSize = remainingAllocationSize(); | 698 m_lastRemainingAllocationSize = remainingAllocationSize(); |
699 } | 699 } |
700 ASSERT(m_lastRemainingAllocationSize == remainingAllocationSize()); | 700 ASSERT(m_lastRemainingAllocationSize == remainingAllocationSize()); |
701 } | 701 } |
702 | 702 |
703 template<typename Header> | 703 template<typename Header> |
704 Address ThreadHeap<Header>::outOfLineAllocate(size_t size, const GCInfo* gcInfo) | 704 Address ThreadHeap<Header>::outOfLineAllocate(size_t payloadSize, size_t allocat
ionSize, const GCInfo* gcInfo) |
705 { | 705 { |
706 size_t allocationSize = allocationSizeFromSize(size); | |
707 ASSERT(allocationSize > remainingAllocationSize()); | 706 ASSERT(allocationSize > remainingAllocationSize()); |
708 if (allocationSize > blinkPageSize / 2) | 707 if (allocationSize > blinkPageSize / 2) |
709 return allocateLargeObject(allocationSize, gcInfo); | 708 return allocateLargeObject(allocationSize, gcInfo); |
710 | 709 |
711 updateRemainingAllocationSize(); | 710 updateRemainingAllocationSize(); |
712 if (threadState()->shouldGC()) { | 711 if (threadState()->shouldGC()) { |
713 if (threadState()->shouldForceConservativeGC()) | 712 if (threadState()->shouldForceConservativeGC()) |
714 Heap::collectGarbage(ThreadState::HeapPointersOnStack); | 713 Heap::collectGarbage(ThreadState::HeapPointersOnStack); |
715 else | 714 else |
716 threadState()->setGCRequested(); | 715 threadState()->setGCRequested(); |
717 } | 716 } |
718 if (remainingAllocationSize() > 0) { | 717 if (remainingAllocationSize() > 0) { |
719 m_freeList.addToFreeList(currentAllocationPoint(), remainingAllocationSi
ze()); | 718 m_freeList.addToFreeList(currentAllocationPoint(), remainingAllocationSi
ze()); |
720 setAllocationPoint(0, 0); | 719 setAllocationPoint(0, 0); |
721 } | 720 } |
722 ensureCurrentAllocation(allocationSize, gcInfo); | 721 ensureCurrentAllocation(allocationSize, gcInfo); |
723 return allocate(size, gcInfo); | 722 return allocate(payloadSize, gcInfo); |
724 } | 723 } |
725 | 724 |
726 template<typename Header> | 725 template<typename Header> |
727 bool ThreadHeap<Header>::allocateFromFreeList(size_t minSize) | 726 bool ThreadHeap<Header>::allocateFromFreeList(size_t minSize) |
728 { | 727 { |
729 size_t bucketSize = 1 << m_freeList.m_biggestFreeListIndex; | 728 size_t bucketSize = 1 << m_freeList.m_biggestFreeListIndex; |
730 int i = m_freeList.m_biggestFreeListIndex; | 729 int i = m_freeList.m_biggestFreeListIndex; |
731 for (; i > 0; i--, bucketSize >>= 1) { | 730 for (; i > 0; i--, bucketSize >>= 1) { |
732 if (bucketSize < minSize) { | 731 if (bucketSize < minSize) { |
733 // A FreeListEntry for bucketSize might be larger than minSize. | 732 // A FreeListEntry for bucketSize might be larger than minSize. |
(...skipping 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2968 CallbackStack* Heap::s_weakCallbackStack; | 2967 CallbackStack* Heap::s_weakCallbackStack; |
2969 CallbackStack* Heap::s_ephemeronStack; | 2968 CallbackStack* Heap::s_ephemeronStack; |
2970 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; | 2969 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; |
2971 bool Heap::s_shutdownCalled = false; | 2970 bool Heap::s_shutdownCalled = false; |
2972 bool Heap::s_lastGCWasConservative = false; | 2971 bool Heap::s_lastGCWasConservative = false; |
2973 FreePagePool* Heap::s_freePagePool; | 2972 FreePagePool* Heap::s_freePagePool; |
2974 OrphanedPagePool* Heap::s_orphanedPagePool; | 2973 OrphanedPagePool* Heap::s_orphanedPagePool; |
2975 Heap::RegionTree* Heap::s_regionTree = 0; | 2974 Heap::RegionTree* Heap::s_regionTree = 0; |
2976 | 2975 |
2977 } // namespace blink | 2976 } // namespace blink |
OLD | NEW |