| Index: runtime/vm/raw_object.h
|
| diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
|
| index cef2223f7a70706d4c2ee0ce8684a6ef12f7864f..5ffc2ff661a66b35dd32ee52372cb29d6ee8beb2 100644
|
| --- a/runtime/vm/raw_object.h
|
| +++ b/runtime/vm/raw_object.h
|
| @@ -344,6 +344,11 @@ class RawObject {
|
| ASSERT(IsMarked());
|
| UpdateTagBit<MarkBit>(false);
|
| }
|
| + // Returns false if the bit was already set.
|
| + // TODO(koda): Add "must use result" annotation here, after we add support.
|
| + bool TryAcquireMarkBit() {
|
| + return TryAcquireTagBit<MarkBit>();
|
| + }
|
|
|
| // Support for GC watched bit.
|
| // TODO(iposva): Get rid of this.
|
| @@ -397,6 +402,11 @@ class RawObject {
|
| uword tags = ptr()->tags_;
|
| ptr()->tags_ = RememberedBit::update(false, tags);
|
| }
|
| + // Returns false if the bit was already set.
|
| + // TODO(koda): Add "must use result" annotation here, after we add support.
|
| + bool TryAcquireRememberedBit() {
|
| + return TryAcquireTagBit<RememberedBit>();
|
| + }
|
|
|
| bool IsDartInstance() {
|
| return (!IsHeapObject() || (GetClassId() >= kInstanceCid));
|
| @@ -514,6 +524,20 @@ class RawObject {
|
| } while (tags != old_tags);
|
| }
|
|
|
| + template<class TagBitField>
|
| + bool TryAcquireTagBit() {
|
| + uword tags = ptr()->tags_;
|
| + uword old_tags;
|
| + do {
|
| + old_tags = tags;
|
| + if (TagBitField::decode(tags)) return false;
|
| + uword new_tags = TagBitField::update(true, old_tags);
|
| + tags = AtomicOperations::CompareAndSwapWord(
|
| + &ptr()->tags_, old_tags, new_tags);
|
| + } while (tags != old_tags);
|
| + return true;
|
| + }
|
| +
|
| // All writes to heap objects should ultimately pass through one of the
|
| // methods below or their counterparts in Object, to ensure that the
|
| // write barrier is correctly applied.
|
| @@ -574,7 +598,7 @@ class RawObject {
|
| friend class Heap;
|
| friend class HeapMapAsJSONVisitor;
|
| friend class ClassStatsVisitor;
|
| - friend class MarkingVisitor;
|
| + template<bool> friend class MarkingVisitorBase;
|
| friend class Mint;
|
| friend class Object;
|
| friend class OneByteString; // StoreSmi
|
| @@ -1047,7 +1071,7 @@ class RawCode : public RawObject {
|
| const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); }
|
|
|
| friend class Function;
|
| - friend class MarkingVisitor;
|
| + template<bool> friend class MarkingVisitorBase;
|
| friend class SkippedCodeFunctions;
|
| friend class StackFrame;
|
| };
|
| @@ -1100,7 +1124,7 @@ class RawInstructions : public RawObject {
|
| friend class RawFunction;
|
| friend class Code;
|
| friend class StackFrame;
|
| - friend class MarkingVisitor;
|
| + template<bool> friend class MarkingVisitorBase;
|
| friend class SkippedCodeFunctions;
|
| friend class Function;
|
| friend class InstructionsReader;
|
| @@ -1977,7 +2001,7 @@ class RawWeakProperty : public RawInstance {
|
|
|
| friend class DelaySet;
|
| friend class GCMarker;
|
| - friend class MarkingVisitor;
|
| + template<bool> friend class MarkingVisitorBase;
|
| friend class Scavenger;
|
| friend class ScavengerVisitor;
|
| };
|
|
|