Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Unified Diff: src/objects/object-macros.h

Issue 2912773002: Rename "NoBarrier" memory operations to "Relaxed". (Closed)
Patch Set: comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/objects/object-macros-undef.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects/object-macros.h
diff --git a/src/objects/object-macros.h b/src/objects/object-macros.h
index 127223b86dbc1e04d3e2c7fe5bf8f30db063bc8f..2957f541fc087c604938afc1982a3103ee92dec1 100644
--- a/src/objects/object-macros.h
+++ b/src/objects/object-macros.h
@@ -8,6 +8,10 @@
// Note 2: This file is deliberately missing the include guards (the undeffing
// approach wouldn't work otherwise).
+// The accessors with RELAXED_, ACQUIRE_, and RELEASE_ prefixes should be used
+// for fields that can be written to and read from multiple threads at the same
+// time. See comments in src/base/atomicops.h for the memory ordering sematics.
+
#define DECL_BOOLEAN_ACCESSORS(name) \
inline bool name() const; \
inline void set_##name(bool value);
@@ -80,13 +84,13 @@
RELEASE_WRITE_FIELD(this, offset, Smi::FromInt(value)); \
}
-#define NOBARRIER_SMI_ACCESSORS(holder, name, offset) \
- int holder::nobarrier_##name() const { \
- Object* value = NOBARRIER_READ_FIELD(this, offset); \
- return Smi::cast(value)->value(); \
- } \
- void holder::nobarrier_set_##name(int value) { \
- NOBARRIER_WRITE_FIELD(this, offset, Smi::FromInt(value)); \
+#define RELAXED_SMI_ACCESSORS(holder, name, offset) \
+ int holder::relaxed_read_##name() const { \
+ Object* value = RELAXED_READ_FIELD(this, offset); \
+ return Smi::cast(value)->value(); \
+ } \
+ void holder::relaxed_write_##name(int value) { \
+ RELAXED_WRITE_FIELD(this, offset, Smi::FromInt(value)); \
}
#define BOOL_GETTER(holder, field, name, offset) \
@@ -116,13 +120,13 @@
reinterpret_cast<Object*>(base::Acquire_Load( \
reinterpret_cast<const base::AtomicWord*>(FIELD_ADDR_CONST(p, offset))))
-#define NOBARRIER_READ_FIELD(p, offset) \
- reinterpret_cast<Object*>(base::NoBarrier_Load( \
+#define RELAXED_READ_FIELD(p, offset) \
+ reinterpret_cast<Object*>(base::Relaxed_Load( \
reinterpret_cast<const base::AtomicWord*>(FIELD_ADDR_CONST(p, offset))))
#ifdef V8_CONCURRENT_MARKING
#define WRITE_FIELD(p, offset, value) \
- base::NoBarrier_Store( \
+ base::Relaxed_Store( \
reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)), \
reinterpret_cast<base::AtomicWord>(value));
#else
@@ -135,8 +139,8 @@
reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)), \
reinterpret_cast<base::AtomicWord>(value));
-#define NOBARRIER_WRITE_FIELD(p, offset, value) \
- base::NoBarrier_Store( \
+#define RELAXED_WRITE_FIELD(p, offset, value) \
+ base::Relaxed_Store( \
reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)), \
reinterpret_cast<base::AtomicWord>(value));
@@ -229,17 +233,16 @@
#define READ_BYTE_FIELD(p, offset) \
(*reinterpret_cast<const byte*>(FIELD_ADDR_CONST(p, offset)))
-#define NOBARRIER_READ_BYTE_FIELD(p, offset) \
- static_cast<byte>(base::NoBarrier_Load( \
+#define RELAXED_READ_BYTE_FIELD(p, offset) \
+ static_cast<byte>(base::Relaxed_Load( \
reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset))))
#define WRITE_BYTE_FIELD(p, offset, value) \
(*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value)
-#define NOBARRIER_WRITE_BYTE_FIELD(p, offset, value) \
- base::NoBarrier_Store( \
- reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset)), \
- static_cast<base::Atomic8>(value));
+#define RELAXED_WRITE_BYTE_FIELD(p, offset, value) \
+ base::Relaxed_Store(reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset)), \
+ static_cast<base::Atomic8>(value));
#ifdef VERIFY_HEAP
#define DECLARE_VERIFIER(Name) void Name##Verify();
« no previous file with comments | « src/objects-inl.h ('k') | src/objects/object-macros-undef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698