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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 Address allocateObject(size_t allocationSize, size_t gcInfoIndex); | 774 Address allocateObject(size_t allocationSize, size_t gcInfoIndex); |
775 | 775 |
776 void freePage(NormalPage*); | 776 void freePage(NormalPage*); |
777 | 777 |
778 bool coalesce(); | 778 bool coalesce(); |
779 void promptlyFreeObject(HeapObjectHeader*); | 779 void promptlyFreeObject(HeapObjectHeader*); |
780 bool expandObject(HeapObjectHeader*, size_t); | 780 bool expandObject(HeapObjectHeader*, size_t); |
781 bool shrinkObject(HeapObjectHeader*, size_t); | 781 bool shrinkObject(HeapObjectHeader*, size_t); |
782 void decreasePromptlyFreedSize(size_t size) { m_promptlyFreedSize -= size; } | 782 void decreasePromptlyFreedSize(size_t size) { m_promptlyFreedSize -= size; } |
783 | 783 |
| 784 bool isObjectAllocatedLast(HeapObjectHeader* header) |
| 785 { |
| 786 return header->payloadEnd() == m_currentAllocationPoint; |
| 787 } |
| 788 |
784 private: | 789 private: |
785 void allocatePage(); | 790 void allocatePage(); |
786 Address lazySweepPages(size_t, size_t gcInfoIndex) override; | 791 Address lazySweepPages(size_t, size_t gcInfoIndex) override; |
787 Address outOfLineAllocate(size_t allocationSize, size_t gcInfoIndex); | 792 Address outOfLineAllocate(size_t allocationSize, size_t gcInfoIndex); |
788 Address currentAllocationPoint() const { return m_currentAllocationPoint; } | 793 Address currentAllocationPoint() const { return m_currentAllocationPoint; } |
789 size_t remainingAllocationSize() const { return m_remainingAllocationSize; } | 794 size_t remainingAllocationSize() const { return m_remainingAllocationSize; } |
790 bool hasCurrentAllocationArea() const { return currentAllocationPoint() && r
emainingAllocationSize(); } | 795 bool hasCurrentAllocationArea() const { return currentAllocationPoint() && r
emainingAllocationSize(); } |
791 void setAllocationPoint(Address, size_t); | 796 void setAllocationPoint(Address, size_t); |
792 void updateRemainingAllocationSize(); | 797 void updateRemainingAllocationSize(); |
793 Address allocateFromFreeList(size_t, size_t gcInfoIndex); | 798 Address allocateFromFreeList(size_t, size_t gcInfoIndex); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 SET_MEMORY_ACCESSIBLE(result, allocationSize - sizeof(HeapObjectHeader))
; | 947 SET_MEMORY_ACCESSIBLE(result, allocationSize - sizeof(HeapObjectHeader))
; |
943 ASSERT(findPageFromAddress(headerAddress + allocationSize - 1)); | 948 ASSERT(findPageFromAddress(headerAddress + allocationSize - 1)); |
944 return result; | 949 return result; |
945 } | 950 } |
946 return outOfLineAllocate(allocationSize, gcInfoIndex); | 951 return outOfLineAllocate(allocationSize, gcInfoIndex); |
947 } | 952 } |
948 | 953 |
949 } // namespace blink | 954 } // namespace blink |
950 | 955 |
951 #endif // HeapPage_h | 956 #endif // HeapPage_h |
OLD | NEW |