Changeset 66150 in webkit for trunk/JavaScriptCore/jit/ExecutableAllocator.h
- Timestamp:
- Aug 26, 2010, 4:21:24 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/ExecutableAllocator.h
r65042 r66150 108 108 typedef Vector<Allocation, 2> AllocationList; 109 109 110 static PassRefPtr<ExecutablePool> create(size_t n); 110 static PassRefPtr<ExecutablePool> create(size_t n) 111 { 112 return adoptRef(new ExecutablePool(n)); 113 } 111 114 112 115 void* alloc(size_t n) … … 147 150 static void systemRelease(Allocation& alloc); 148 151 149 ExecutablePool( Allocation&);152 ExecutablePool(size_t n); 150 153 151 154 void* poolAllocate(size_t n); … … 165 168 if (!pageSize) 166 169 intializePageSize(); 167 if (isValid()) {170 if (isValid()) 168 171 m_smallAllocationPool = ExecutablePool::create(JIT_ALLOCATOR_LARGE_ALLOC_SIZE); 169 if (!m_smallAllocationPool)170 CRASH();171 }172 172 #if !ENABLE(INTERPRETER) 173 173 else … … 186 186 187 187 // If the request is large, we just provide a unshared allocator 188 if (n > JIT_ALLOCATOR_LARGE_ALLOC_SIZE) 188 if (n > JIT_ALLOCATOR_LARGE_ALLOC_SIZE) 189 189 return ExecutablePool::create(n); 190 190 … … 309 309 }; 310 310 311 inline PassRefPtr<ExecutablePool> ExecutablePool::create(size_t n) 312 { 313 Allocation mem = systemAlloc(roundUpAllocationSize(n, JIT_ALLOCATOR_PAGE_SIZE)); 314 if (!mem) 315 return 0; 316 return adoptRef(new ExecutablePool(mem)); 317 } 318 319 inline ExecutablePool::ExecutablePool(Allocation& mem) 311 inline ExecutablePool::ExecutablePool(size_t n) 320 312 { 321 ASSERT(!!mem); 313 size_t allocSize = roundUpAllocationSize(n, JIT_ALLOCATOR_PAGE_SIZE); 314 Allocation mem = systemAlloc(allocSize); 322 315 m_pools.append(mem); 323 316 m_freePtr = static_cast<char*>(mem.base()); 324 m_end = m_freePtr + mem.size(); 317 if (!m_freePtr) 318 CRASH(); // Failed to allocate 319 m_end = m_freePtr + allocSize; 325 320 } 326 321 … … 331 326 Allocation result = systemAlloc(allocSize); 332 327 if (!result.base()) 333 return 0; // Failed to allocate334 328 CRASH(); // Failed to allocate 329 335 330 ASSERT(m_end >= m_freePtr); 336 331 if ((allocSize - n) > static_cast<size_t>(m_end - m_freePtr)) {
Note:
See TracChangeset
for help on using the changeset viewer.