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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 #endif | 144 #endif |
145 // sizeof(HeapObjectHeader) must be equal to or smaller than | 145 // sizeof(HeapObjectHeader) must be equal to or smaller than |
146 // allocationGranurarity, because HeapObjectHeader is used as a header | 146 // allocationGranurarity, because HeapObjectHeader is used as a header |
147 // for an freed entry. Given that the smallest entry size is | 147 // for an freed entry. Given that the smallest entry size is |
148 // allocationGranurarity, HeapObjectHeader must fit into the size. | 148 // allocationGranurarity, HeapObjectHeader must fit into the size. |
149 static_assert(sizeof(HeapObjectHeader) <= allocationGranularity, "size o
f HeapObjectHeader must be smaller than allocationGranularity"); | 149 static_assert(sizeof(HeapObjectHeader) <= allocationGranularity, "size o
f HeapObjectHeader must be smaller than allocationGranularity"); |
150 #if CPU(64BIT) | 150 #if CPU(64BIT) |
151 static_assert(sizeof(HeapObjectHeader) == 8, "size of HeapObjectHeader m
ust be 8 byte aligned"); | 151 static_assert(sizeof(HeapObjectHeader) == 8, "size of HeapObjectHeader m
ust be 8 byte aligned"); |
152 #endif | 152 #endif |
153 | 153 |
154 ASSERT(gcInfoIndex < gcInfoIndexMax); | 154 ASSERT(gcInfoIndex < GCInfoTable::maxIndex); |
155 ASSERT(size < nonLargeObjectSizeMax); | 155 ASSERT(size < nonLargeObjectSizeMax); |
156 ASSERT(!(size & allocationMask)); | 156 ASSERT(!(size & allocationMask)); |
157 m_encoded = (gcInfoIndex << headerGCInfoIndexShift) | size | (gcInfoInde
x ? 0 : headerFreedBitMask); | 157 m_encoded = (gcInfoIndex << headerGCInfoIndexShift) | size | (gcInfoInde
x ? 0 : headerFreedBitMask); |
158 } | 158 } |
159 | 159 |
160 NO_SANITIZE_ADDRESS | 160 NO_SANITIZE_ADDRESS |
161 bool isFree() const { return m_encoded & headerFreedBitMask; } | 161 bool isFree() const { return m_encoded & headerFreedBitMask; } |
162 NO_SANITIZE_ADDRESS | 162 NO_SANITIZE_ADDRESS |
163 bool isPromptlyFreed() const { return (m_encoded & headerPromptlyFreedBitMas
k) == headerPromptlyFreedBitMask; } | 163 bool isPromptlyFreed() const { return (m_encoded & headerPromptlyFreedBitMas
k) == headerPromptlyFreedBitMask; } |
164 NO_SANITIZE_ADDRESS | 164 NO_SANITIZE_ADDRESS |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 // This look-up uses the region search tree and a negative contains cache to | 914 // This look-up uses the region search tree and a negative contains cache to |
915 // provide an efficient mapping from arbitrary addresses to the containing | 915 // provide an efficient mapping from arbitrary addresses to the containing |
916 // heap-page if one exists. | 916 // heap-page if one exists. |
917 static BaseHeapPage* lookup(Address); | 917 static BaseHeapPage* lookup(Address); |
918 static void addPageMemoryRegion(PageMemoryRegion*); | 918 static void addPageMemoryRegion(PageMemoryRegion*); |
919 static void removePageMemoryRegion(PageMemoryRegion*); | 919 static void removePageMemoryRegion(PageMemoryRegion*); |
920 | 920 |
921 static const GCInfo* gcInfo(size_t gcInfoIndex) | 921 static const GCInfo* gcInfo(size_t gcInfoIndex) |
922 { | 922 { |
923 ASSERT(gcInfoIndex >= 1); | 923 ASSERT(gcInfoIndex >= 1); |
924 ASSERT(gcInfoIndex < gcInfoIndexMax); | 924 ASSERT(gcInfoIndex < GCInfoTable::maxIndex); |
925 ASSERT(s_gcInfoTable); | 925 ASSERT(s_gcInfoTable); |
926 const GCInfo* info = s_gcInfoTable[gcInfoIndex]; | 926 const GCInfo* info = s_gcInfoTable[gcInfoIndex]; |
927 ASSERT(info); | 927 ASSERT(info); |
928 return info; | 928 return info; |
929 } | 929 } |
930 | 930 |
931 static void increaseAllocatedObjectSize(size_t delta) { atomicAdd(&s_allocat
edObjectSize, static_cast<long>(delta)); } | 931 static void increaseAllocatedObjectSize(size_t delta) { atomicAdd(&s_allocat
edObjectSize, static_cast<long>(delta)); } |
932 static void decreaseAllocatedObjectSize(size_t delta) { atomicSubtract(&s_al
locatedObjectSize, static_cast<long>(delta)); } | 932 static void decreaseAllocatedObjectSize(size_t delta) { atomicSubtract(&s_al
locatedObjectSize, static_cast<long>(delta)); } |
933 static size_t allocatedObjectSize() { return acquireLoad(&s_allocatedObjectS
ize); } | 933 static size_t allocatedObjectSize() { return acquireLoad(&s_allocatedObjectS
ize); } |
934 static void increaseMarkedObjectSize(size_t delta) { atomicAdd(&s_markedObje
ctSize, static_cast<long>(delta)); } | 934 static void increaseMarkedObjectSize(size_t delta) { atomicAdd(&s_markedObje
ctSize, static_cast<long>(delta)); } |
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2407 template<typename T, size_t inlineCapacity> | 2407 template<typename T, size_t inlineCapacity> |
2408 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T,
inlineCapacity, HeapAllocator>> { }; | 2408 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T,
inlineCapacity, HeapAllocator>> { }; |
2409 template<typename T, size_t inlineCapacity> | 2409 template<typename T, size_t inlineCapacity> |
2410 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i
nlineCapacity, HeapAllocator>> { }; | 2410 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i
nlineCapacity, HeapAllocator>> { }; |
2411 template<typename T, typename U, typename V> | 2411 template<typename T, typename U, typename V> |
2412 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted
Set<T, U, V, HeapAllocator>> { }; | 2412 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted
Set<T, U, V, HeapAllocator>> { }; |
2413 | 2413 |
2414 } // namespace blink | 2414 } // namespace blink |
2415 | 2415 |
2416 #endif // Heap_h | 2416 #endif // Heap_h |
OLD | NEW |