[heap] Read gc_state() only once for DCHECK
That DCHECK could fail even though GC was in the right state. It could happen that the first load gets the old value NOT_IN_GC, since this isn't TEAR_DOWN a second load needs to be performed. The load then returns TEAR_DOWN but that doesn't match NOT_IN_GC either. Fix this by only loading gc_state() once. Bug: v8:10315 Change-Id: Ibcad540fa4d5f578c9936c472b294bbccebdc09a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2418719 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org> Cr-Commit-Position: refs/heads/master@{#70021}
This commit is contained in:
parent
3cb8b399fe
commit
aec2874d99
@ -15,13 +15,15 @@ namespace internal {
|
||||
AllocationResult LocalHeap::AllocateRaw(int size_in_bytes, AllocationType type,
|
||||
AllocationOrigin origin,
|
||||
AllocationAlignment alignment) {
|
||||
#if DEBUG
|
||||
DCHECK_EQ(LocalHeap::Current(), this);
|
||||
DCHECK(AllowHandleAllocation::IsAllowed());
|
||||
DCHECK(AllowHeapAllocation::IsAllowed());
|
||||
DCHECK_IMPLIES(type == AllocationType::kCode,
|
||||
alignment == AllocationAlignment::kCodeAligned);
|
||||
DCHECK(heap()->gc_state() == Heap::TEAR_DOWN ||
|
||||
heap()->gc_state() == Heap::NOT_IN_GC);
|
||||
Heap::HeapState state = heap()->gc_state();
|
||||
DCHECK(state == Heap::TEAR_DOWN || state == Heap::NOT_IN_GC);
|
||||
#endif
|
||||
|
||||
bool large_object = size_in_bytes > kMaxRegularHeapObjectSize;
|
||||
CHECK_EQ(type, AllocationType::kOld);
|
||||
|
Loading…
Reference in New Issue
Block a user