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

Unified Diff: runtime/vm/raw_object.h

Issue 1351453008: Parallel marking. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments. Created 5 years, 2 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 | « runtime/vm/heap_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
« no previous file with comments | « runtime/vm/heap_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698