Commit 64206b2d authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

cppgc: Mark object as constructed using std::atomic::fetch_or

Replace a manual fetch/or/store sequence with fetch_or.

Bug: chromium:1056170
Change-Id: Ib18d26686aa6e822f91b5b6662dd0bdcfafe5092
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2531788
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarOmer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71129}
parent e210b196
......@@ -39,9 +39,8 @@ class V8_EXPORT MakeGarbageCollectedTraitInternal {
const_cast<uint16_t*>(reinterpret_cast<const uint16_t*>(
reinterpret_cast<const uint8_t*>(payload) -
api_constants::kFullyConstructedBitFieldOffsetFromPayload)));
uint16_t value = atomic_mutable_bitfield->load(std::memory_order_relaxed);
value = value | api_constants::kFullyConstructedBitMask;
atomic_mutable_bitfield->store(value, std::memory_order_release);
atomic_mutable_bitfield->fetch_or(api_constants::kFullyConstructedBitMask,
std::memory_order_release);
}
static void* Allocate(cppgc::AllocationHandle& handle, size_t size,
......
......@@ -28,7 +28,7 @@ constexpr size_t kGB = kMB * 1024;
static constexpr size_t kFullyConstructedBitFieldOffsetFromPayload =
2 * sizeof(uint16_t);
// Mask for in-construction bit.
static constexpr size_t kFullyConstructedBitMask = size_t{1};
static constexpr uint16_t kFullyConstructedBitMask = uint16_t{1};
static constexpr size_t kPageSize = size_t{1} << 17;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment