Translator: Remove global allocator lock/unlock ... around built-in function emulation helper. The context in which this lock was added [1], where the allocator had scoped that were pushed and popped, is no longer there and the scope functionality is removed [2]. [1]:crbug.com/40473368 [2]:https://chromium-review.googlesource.com/c/angle/angle/+/6701153 Bug: chromium:40473368 Change-Id: Ib06ae27909dc5009a7dd9ac18204209c96e596d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/7613302 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
diff --git a/src/common/PoolAlloc.cpp b/src/common/PoolAlloc.cpp index a512771..ff5909f 100644 --- a/src/common/PoolAlloc.cpp +++ b/src/common/PoolAlloc.cpp
@@ -152,7 +152,7 @@ // is documented in PoolAlloc.h. // PoolAllocator::PoolAllocator(int growthIncrement, int allocationAlignment) - : mAlignment(allocationAlignment), + : #if !defined(ANGLE_DISABLE_POOL_ALLOC) mPageSize(growthIncrement), mFreeList(nullptr), @@ -160,7 +160,7 @@ mNumCalls(0), mTotalBytes(0), #endif - mLocked(false) + mAlignment(allocationAlignment) { #if !defined(ANGLE_DISABLE_POOL_ALLOC) mPageHeaderSkip = sizeof(PageHeader); @@ -276,8 +276,6 @@ void *PoolAllocator::allocate(size_t numBytes) { - ASSERT(!mLocked); - #if !defined(ANGLE_DISABLE_POOL_ALLOC) // // Just keep some interesting statistics. @@ -398,18 +396,6 @@ } #endif -void PoolAllocator::lock() -{ - ASSERT(!mLocked); - mLocked = true; -} - -void PoolAllocator::unlock() -{ - ASSERT(mLocked); - mLocked = false; -} - // // Check all allocations in a list for damage by calling check on each. //
diff --git a/src/common/PoolAlloc.h b/src/common/PoolAlloc.h index dab10d9..016783a 100644 --- a/src/common/PoolAlloc.h +++ b/src/common/PoolAlloc.h
@@ -106,14 +106,7 @@ // user of it, as the model of use is to simultaneously deallocate everything at once by // destroying the instance or reset(). - // Catch unwanted allocations. - // TODO(jmadill): Remove this when we remove the global allocator. - void lock(); - void unlock(); - private: - size_t mAlignment; // all returned allocations will be aligned at - // this granularity, which will be a power of 2 #if !defined(ANGLE_DISABLE_POOL_ALLOC) // Slow path of allocation when we have to get a new page. uint8_t *allocateNewPage(size_t numBytes); @@ -143,7 +136,8 @@ std::vector<std::unique_ptr<uint8_t[]>> mStack; #endif - bool mLocked; + size_t mAlignment; // all returned allocations will be aligned at + // this granularity, which will be a power of 2 }; } // namespace angle
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp index f646ca1..a400dfd 100644 --- a/src/compiler/translator/Compiler.cpp +++ b/src/compiler/translator/Compiler.cpp
@@ -1096,9 +1096,7 @@ } } - GetGlobalPoolAllocator()->lock(); initBuiltInFunctionEmulator(&mBuiltInFunctionEmulator, compileOptions); - GetGlobalPoolAllocator()->unlock(); mBuiltInFunctionEmulator.markBuiltInFunctionsForEmulation(root); collectVariables(root);