Changeset 94814 in webkit for trunk/Source/JavaScriptCore/heap/NewSpace.h
- Timestamp:
- Sep 8, 2011, 3:52:04 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/NewSpace.h
r94522 r94814 47 47 public: 48 48 static const size_t maxCellSize = 1024; 49 static const size_t PropertyStorageNurserySize = 4 * MB; 49 50 50 51 struct SizeClass { … … 64 65 SizeClass& sizeClassFor(size_t); 65 66 void* allocate(SizeClass&); 67 inline void* allocatePropertyStorage(size_t); 68 inline bool inPropertyStorageNursery(void* ptr); 69 inline void resetPropertyStorageNursery(); 70 66 71 void resetAllocator(); 67 72 … … 92 97 SizeClass m_preciseSizeClasses[preciseCount]; 93 98 SizeClass m_impreciseSizeClasses[impreciseCount]; 99 char* m_propertyStorageNursery; 100 char* m_propertyStorageAllocationPoint; 94 101 size_t m_waterMark; 95 102 size_t m_highWaterMark; … … 161 168 } 162 169 170 inline void NewSpace::resetPropertyStorageNursery() 171 { 172 m_propertyStorageAllocationPoint = m_propertyStorageNursery; 173 } 174 175 inline void* NewSpace::allocatePropertyStorage(size_t size) 176 { 177 char* result = m_propertyStorageAllocationPoint; 178 if (size > PropertyStorageNurserySize) 179 CRASH(); 180 m_propertyStorageAllocationPoint += size; 181 if (static_cast<size_t>(m_propertyStorageAllocationPoint - m_propertyStorageNursery) > PropertyStorageNurserySize) { 182 m_propertyStorageAllocationPoint = result; 183 return 0; 184 } 185 return result; 186 } 187 188 inline bool NewSpace::inPropertyStorageNursery(void* ptr) 189 { 190 char* addr = static_cast<char*>(ptr); 191 return static_cast<size_t>(addr - m_propertyStorageNursery) < PropertyStorageNurserySize; 192 } 193 163 194 template <typename Functor> inline typename Functor::ReturnType NewSpace::forEachBlock(Functor& functor) 164 195 {
Note:
See TracChangeset
for help on using the changeset viewer.