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

Unified Diff: runtime/vm/object.h

Issue 529823002: - Add AtomicOperations::CompareAndSwapWord (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 39714)
+++ runtime/vm/object.h (working copy)
@@ -230,11 +230,18 @@
}
void set_tags(intptr_t value) const {
+ ASSERT(!IsNull());
// TODO(asiva): Remove the capability of setting tags in general. The mask
// here only allows for canonical and from_snapshot flags to be set.
koda 2014/09/02 04:18:31 Before masking (i.e., ignoring part of the input..
- ASSERT(!IsNull());
- uword tags = raw()->ptr()->tags_ & ~0x0000000c;
- raw()->ptr()->tags_ = tags | (value & 0x0000000c);
+ value = value & 0x0000000c;
+ uword tags = raw()->ptr()->tags_;
+ uword old_tags;
+ do {
+ old_tags = tags;
+ uword new_tags = (old_tags & ~0x0000000c) | value;
+ tags = AtomicOperations::CompareAndSwapWord(
+ &raw()->ptr()->tags_, old_tags, new_tags);
+ } while (tags != old_tags);
}
void SetCreatedFromSnapshot() const {
ASSERT(!IsNull());
« no previous file with comments | « runtime/vm/atomic_win.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698