X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/93a3786624b2768d89bfa27e46598dc64e2fb70a..refs/heads/master:/heap/CopiedAllocator.h diff --git a/heap/CopiedAllocator.h b/heap/CopiedAllocator.h index 32b84f0..3dfc9a7 100644 --- a/heap/CopiedAllocator.h +++ b/heap/CopiedAllocator.h @@ -38,6 +38,7 @@ public: bool fastPathShouldSucceed(size_t bytes) const; CheckedBoolean tryAllocate(size_t bytes, void** outPtr); + CheckedBoolean tryAllocateDuringCopying(size_t bytes, void** outPtr); CheckedBoolean tryReallocate(void *oldPtr, size_t oldBytes, size_t newBytes); void* forceAllocate(size_t bytes); CopiedBlock* resetCurrentBlock(); @@ -93,6 +94,14 @@ inline CheckedBoolean CopiedAllocator::tryAllocate(size_t bytes, void** outPtr) return true; } +inline CheckedBoolean CopiedAllocator::tryAllocateDuringCopying(size_t bytes, void** outPtr) +{ + if (!tryAllocate(bytes, outPtr)) + return false; + m_currentBlock->reportLiveBytesDuringCopying(bytes); + return true; +} + inline CheckedBoolean CopiedAllocator::tryReallocate( void* oldPtr, size_t oldBytes, size_t newBytes) {