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

Unified Diff: runtime/vm/gc_marker.h

Issue 1309033007: Old-gen marking on separate thread (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Ready for review. Created 5 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
« no previous file with comments | « no previous file | runtime/vm/gc_marker.cc » ('j') | runtime/vm/gc_marker.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/gc_marker.h
diff --git a/runtime/vm/gc_marker.h b/runtime/vm/gc_marker.h
index 4280a65e97a0745fa0888050711125a2a2944cb2..40666579a608a4162344f12dc6472d3830380719 100644
--- a/runtime/vm/gc_marker.h
+++ b/runtime/vm/gc_marker.h
@@ -22,7 +22,8 @@ class RawWeakProperty;
// of the mark-sweep collection. The marking bit used is defined in RawObject.
class GCMarker : public ValueObject {
public:
- explicit GCMarker(Heap* heap) : heap_(heap), marked_bytes_(0) { }
+ explicit GCMarker(Heap* heap)
+ : heap_(heap), marked_bytes_(0), done_count_(0) { }
~GCMarker() { }
void MarkObjects(Isolate* isolate,
@@ -35,9 +36,9 @@ class GCMarker : public ValueObject {
private:
void Prologue(Isolate* isolate, bool invoke_api_callbacks);
void Epilogue(Isolate* isolate, bool invoke_api_callbacks);
- void IterateRoots(Isolate* isolate,
- ObjectPointerVisitor* visitor,
- bool visit_prologue_weak_persistent_handles);
+ static void IterateRoots(Isolate* isolate,
+ ObjectPointerVisitor* visitor,
+ bool visit_prologue_weak_persistent_handles);
void IterateWeakRoots(Isolate* isolate,
HandleVisitor* visitor,
bool visit_prologue_weak_persistent_handles);
@@ -45,10 +46,22 @@ class GCMarker : public ValueObject {
void ProcessWeakTables(PageSpace* page_space);
void ProcessObjectIdTable(Isolate* isolate);
+ // Synchronization between GCMarker's main thread and its marking tasks.
+ // Called by main thread: wait for 'num_tasks' tasks, then let them resume.
+ void MainSync(intptr_t num_tasks);
+ // Called by tasks: notify main thread; wait until it lets us continue.
+ void TaskSync();
+ // Called by tasks: notify main thread, but don't wait (used for exiting).
+ void TaskNotifyDone();
+ // Called by anyone: finalize and accumulate stats from 'visitor'.
+ void FinalizeResultsFrom(MarkingVisitor* visitor);
+ Monitor monitor_; // Protects marked_bytes_ and done_count_.
Heap* heap_;
uintptr_t marked_bytes_;
+ intptr_t done_count_;
+ friend class MarkTask;
DISALLOW_IMPLICIT_CONSTRUCTORS(GCMarker);
};
« no previous file with comments | « no previous file | runtime/vm/gc_marker.cc » ('j') | runtime/vm/gc_marker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698