#if ENABLE(DFG_JIT)
#include "DFGCommon.h"
-#include <wtf/PageAllocationAligned.h>
#include <wtf/StdLibExtras.h>
namespace JSC { namespace DFG {
void* allocate(); // Use placement new to allocate, and avoid using this method.
void free(T*); // Call this method to delete; never use 'delete' directly.
- void freeAll(); // Only call this if T has a trivial destructor.
+ void freeAll(); // Only call this if you've either freed everything or if T has a trivial destructor.
void reset(); // Like freeAll(), but also returns all memory to the OS.
unsigned indexOf(const T*);
bool isInThisRegion(const T* pointer) { return static_cast<unsigned>(pointer - data()) < numberOfThingsPerRegion(); }
static Region* regionFor(const T* pointer) { return bitwise_cast<Region*>(bitwise_cast<uintptr_t>(pointer) & ~(size() - 1)); }
- PageAllocationAligned m_allocation;
+ void* m_allocation;
Allocator* m_allocator;
Region* m_next;
};
if (logCompilationChanges())
dataLog("Allocating another allocator region.\n");
-
- PageAllocationAligned allocation = PageAllocationAligned::allocate(Region::size(), Region::size(), OSAllocator::JSGCHeapPages);
- if (!static_cast<bool>(allocation))
- CRASH();
- Region* region = static_cast<Region*>(allocation.base());
+
+ void* allocation = fastAlignedMalloc(Region::size(), Region::size());
+ Region* region = static_cast<Region*>(allocation);
region->m_allocation = allocation;
region->m_allocator = this;
startBumpingIn(region);
{
while (region) {
Region* nextRegion = region->m_next;
- region->m_allocation.deallocate();
+ fastAlignedFree(region->m_allocation);
region = nextRegion;
}
}