summaryrefslogtreecommitdiff
path: root/chromium/v8/src/heap/marking.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-17 13:57:45 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-19 13:44:40 +0000
commit6ec7b8da05d21a3878bd21c691b41e675d74bb1c (patch)
treeb87f250bc19413750b9bb9cdbf2da20ef5014820 /chromium/v8/src/heap/marking.h
parentec02ee4181c49b61fce1c8fb99292dbb8139cc90 (diff)
downloadqtwebengine-chromium-6ec7b8da05d21a3878bd21c691b41e675d74bb1c.tar.gz
BASELINE: Update Chromium to 60.0.3112.70
Change-Id: I9911c2280a014d4632f254857876a395d4baed2d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/v8/src/heap/marking.h')
-rw-r--r--chromium/v8/src/heap/marking.h27
1 files changed, 13 insertions, 14 deletions
diff --git a/chromium/v8/src/heap/marking.h b/chromium/v8/src/heap/marking.h
index b20a4d86f14..ab98a124bc4 100644
--- a/chromium/v8/src/heap/marking.h
+++ b/chromium/v8/src/heap/marking.h
@@ -38,12 +38,16 @@ class MarkBit {
}
}
+ // The function returns true if it succeeded to
+ // transition the bit from 0 to 1.
template <AccessMode mode = NON_ATOMIC>
inline bool Set();
template <AccessMode mode = NON_ATOMIC>
inline bool Get();
+ // The function returns true if it succeeded to
+ // transition the bit from 1 to 0.
template <AccessMode mode = NON_ATOMIC>
inline bool Clear();
@@ -57,8 +61,9 @@ class MarkBit {
template <>
inline bool MarkBit::Set<MarkBit::NON_ATOMIC>() {
- *cell_ |= mask_;
- return true;
+ base::Atomic32 old_value = *cell_;
+ *cell_ = old_value | mask_;
+ return (old_value & mask_) == 0;
}
template <>
@@ -86,8 +91,9 @@ inline bool MarkBit::Get<MarkBit::ATOMIC>() {
template <>
inline bool MarkBit::Clear<MarkBit::NON_ATOMIC>() {
- *cell_ &= ~mask_;
- return true;
+ base::Atomic32 old_value = *cell_;
+ *cell_ = old_value & ~mask_;
+ return (old_value & mask_) == mask_;
}
template <>
@@ -412,24 +418,17 @@ class Marking : public AllStatic {
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
INLINE(static bool WhiteToGrey(MarkBit markbit)) {
- DCHECK(mode == MarkBit::ATOMIC || IsWhite(markbit));
return markbit.Set<mode>();
}
- // Warning: this method is not safe in general in concurrent scenarios.
- // If you know that nobody else will change the bits on the given location
- // then you may use it.
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
- INLINE(static void WhiteToBlack(MarkBit markbit)) {
- DCHECK(mode == MarkBit::ATOMIC || IsWhite(markbit));
- markbit.Set<mode>();
- markbit.Next().Set<mode>();
+ INLINE(static bool WhiteToBlack(MarkBit markbit)) {
+ return markbit.Set<mode>() && markbit.Next().Set<mode>();
}
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
INLINE(static bool GreyToBlack(MarkBit markbit)) {
- DCHECK(mode == MarkBit::ATOMIC || IsGrey(markbit));
- return markbit.Next().Set<mode>();
+ return markbit.Get<mode>() && markbit.Next().Set<mode>();
}
enum ObjectColor {