[heap] Provide memory order relaxed accessor of page flags.
Bug: chromium:874437,chromium:852420 Change-Id: I4f484a6bb7072804dbcaacab77d25ba7a3fe338f Reviewed-on: https://chromium-review.googlesource.com/1183188 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Hannes Payer <hpayer@chromium.org> Cr-Commit-Position: refs/heads/master@{#55287}
This commit is contained in:
parent
e987606a8a
commit
f29fbf35a9
@ -568,7 +568,10 @@ class MemoryChunk {
|
||||
|
||||
void SetFlag(Flag flag) { SetFlags(flag, flag); }
|
||||
|
||||
bool IsFlagSet(Flag flag) { return (flags() & flag) != 0; }
|
||||
template <AccessMode access_mode = AccessMode::NON_ATOMIC>
|
||||
bool IsFlagSet(Flag flag) {
|
||||
return (flags<access_mode>() & flag) != 0;
|
||||
}
|
||||
|
||||
void ClearFlag(Flag flag) { flags_ &= ~flag; }
|
||||
// Set or clear multiple flags at a time. The flags in the mask are set to
|
||||
@ -583,7 +586,14 @@ class MemoryChunk {
|
||||
}
|
||||
|
||||
// Return all current flags.
|
||||
uintptr_t flags() { return flags_; }
|
||||
template <AccessMode access_mode = AccessMode::NON_ATOMIC>
|
||||
uintptr_t flags() {
|
||||
if (access_mode == AccessMode::NON_ATOMIC) {
|
||||
return flags_;
|
||||
} else {
|
||||
return flags_.load(std::memory_order_relaxed);
|
||||
}
|
||||
}
|
||||
|
||||
bool NeverEvacuate() { return IsFlagSet(NEVER_EVACUATE); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user