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

Unified Diff: src/mark-compact.h

Issue 3615009: Parallelize marking phase of mark-sweep/compact collection cycle. (Closed)
Patch Set: Created 10 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 | « src/ia32/assembler-ia32-inl.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mark-compact.h
diff --git a/src/mark-compact.h b/src/mark-compact.h
index 72a6fa3b624092cea830bedd7230e673f8844a23..0f7b477eb50daf0f882d83df43f1a0e9b9620036 100644
--- a/src/mark-compact.h
+++ b/src/mark-compact.h
@@ -39,8 +39,10 @@ typedef bool (*IsAliveFunction)(HeapObject* obj, int* size, int* offset);
// Forward declarations.
class RootMarkingVisitor;
class MarkingVisitor;
+class Marker;
-
+// ----------------------------------------------------------------------------
+// Marking stack for tracing live objects.
// -------------------------------------------------------------------------
// Mark-Compact collector
//
@@ -101,10 +103,6 @@ class MarkCompactCollector: public AllStatic {
#endif
}
- // The count of the number of objects left marked at the end of the last
- // completed full GC (expected to be zero).
- static int previous_marked_count() { return previous_marked_count_; }
-
// During a full GC, there is a stack-allocated GCTracer that is used for
// bookkeeping information. Return a pointer to that tracer.
static GCTracer* tracer() { return tracer_; }
@@ -148,10 +146,6 @@ class MarkCompactCollector: public AllStatic {
// Global flag indicating whether spaces will be compacted on the next GC.
static bool compact_on_next_gc_;
- // The number of objects left marked at the end of the last completed full
- // GC (expected to be zero).
- static int previous_marked_count_;
-
// A pointer to the current stack-allocated GC tracer object during a full
// collection (NULL before and after).
static GCTracer* tracer_;
@@ -174,25 +168,28 @@ class MarkCompactCollector: public AllStatic {
friend class StaticMarkingVisitor;
friend class CodeMarkingVisitor;
friend class SharedFunctionInfoMarkingVisitor;
+ friend class Marker;
static void PrepareForCodeFlushing();
- // Marking operations for objects reachable from roots.
- static void MarkLiveObjects();
-
- static void MarkUnmarkedObject(HeapObject* obj);
+ // Return total number of markers that will be used during
+ // marking phase.
+ static int NumberOfMarkers() {
+ // If parallel marking is enabled and atomic operations is supported
+ // on this platform use FLAG_number_of_markers otherwise use only
+ // main marker.
+#if ATOMIC_SUPPORTED
+ if (FLAG_parallel_marking) {
+ return 1 + FLAG_number_of_markers;
+ }
+#endif
- static inline void MarkObject(HeapObject* obj) {
- if (!obj->IsMarked()) MarkUnmarkedObject(obj);
+ return 1;
}
- static inline void SetMark(HeapObject* obj) {
- tracer_->increment_marked_count();
-#ifdef DEBUG
- UpdateLiveObjectCount(obj);
-#endif
- obj->SetMark();
- }
+
+ // Marking operations for objects reachable from roots.
+ static void MarkLiveObjects();
// Creates back pointers for all map transitions, stores them in
// the prototype field. The original prototype pointers are restored
@@ -202,15 +199,16 @@ class MarkCompactCollector: public AllStatic {
static void CreateBackPointers();
// Mark a Map and its DescriptorArray together, skipping transitions.
- static void MarkMapContents(Map* map);
- static void MarkDescriptorArray(DescriptorArray* descriptors);
+ static void MarkMapContents(Map* map, Marker* marker);
+
+ static void MarkDescriptorArray(DescriptorArray* descriptors, Marker* marker);
// Mark the heap roots and all objects reachable from them.
- static void MarkRoots(RootMarkingVisitor* visitor);
+ static void MarkRoots();
// Mark the symbol table specially. References to symbols from the
// symbol table are weak.
- static void MarkSymbolTable();
+ static void MarkSymbolTable(Marker* marker);
// Mark objects in object groups that have at least one object in the
// group marked.
@@ -221,21 +219,6 @@ class MarkCompactCollector: public AllStatic {
// groups, and repeat.
static void ProcessObjectGroups();
- // Mark objects reachable (transitively) from objects in the marking stack
- // or overflowed in the heap.
- static void ProcessMarkingStack();
-
- // Mark objects reachable (transitively) from objects in the marking
- // stack. This function empties the marking stack, but may leave
- // overflowed objects in the heap, in which case the marking stack's
- // overflow flag will be set.
- static void EmptyMarkingStack();
-
- // Refill the marking stack with overflowed objects from the heap. This
- // function either leaves the marking stack full or clears the overflow
- // flag on the marking stack.
- static void RefillMarkingStack();
-
// Callback function for telling whether the object *p is an unmarked
// heap object.
static bool IsUnmarkedHeapObject(Object** p);
« no previous file with comments | « src/ia32/assembler-ia32-inl.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698