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

Side by Side Diff: runtime/vm/gc_marker.h

Issue 1351453008: Parallel marking. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add TODO about smi/new check. Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/gc_marker.cc » ('j') | runtime/vm/gc_marker.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_GC_MARKER_H_ 5 #ifndef VM_GC_MARKER_H_
6 #define VM_GC_MARKER_H_ 6 #define VM_GC_MARKER_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 // Forward declarations. 12 // Forward declarations.
13 class HandleVisitor; 13 class HandleVisitor;
14 class Heap; 14 class Heap;
15 class Isolate; 15 class Isolate;
16 class MarkingVisitor;
17 class ObjectPointerVisitor; 16 class ObjectPointerVisitor;
18 class PageSpace; 17 class PageSpace;
19 class RawWeakProperty; 18 class RawWeakProperty;
20 19
21 // The class GCMarker is used to mark reachable old generation objects as part 20 // The class GCMarker is used to mark reachable old generation objects as part
22 // of the mark-sweep collection. The marking bit used is defined in RawObject. 21 // of the mark-sweep collection. The marking bit used is defined in RawObject.
23 class GCMarker : public ValueObject { 22 class GCMarker : public ValueObject {
24 public: 23 public:
25 explicit GCMarker(Heap* heap) 24 explicit GCMarker(Heap* heap)
26 : heap_(heap), marked_bytes_(0) { } 25 : heap_(heap), marked_bytes_(0) { }
27 ~GCMarker() { } 26 ~GCMarker() { }
28 27
29 void MarkObjects(Isolate* isolate, 28 void MarkObjects(Isolate* isolate,
30 PageSpace* page_space, 29 PageSpace* page_space,
31 bool invoke_api_callbacks, 30 bool invoke_api_callbacks,
32 bool collect_code); 31 bool collect_code);
33 32
34 intptr_t marked_words() { return marked_bytes_ >> kWordSizeLog2; } 33 intptr_t marked_words() { return marked_bytes_ >> kWordSizeLog2; }
35 34
36 private: 35 private:
37 void Prologue(Isolate* isolate, bool invoke_api_callbacks); 36 void Prologue(Isolate* isolate, bool invoke_api_callbacks);
38 void Epilogue(Isolate* isolate, bool invoke_api_callbacks); 37 void Epilogue(Isolate* isolate, bool invoke_api_callbacks);
39 void IterateRoots(Isolate* isolate, 38 void IterateRoots(Isolate* isolate,
40 ObjectPointerVisitor* visitor, 39 ObjectPointerVisitor* visitor,
41 bool visit_prologue_weak_persistent_handles); 40 bool visit_prologue_weak_persistent_handles,
41 intptr_t slice_index, intptr_t num_slices);
42 void IterateWeakRoots(Isolate* isolate, 42 void IterateWeakRoots(Isolate* isolate,
43 HandleVisitor* visitor, 43 HandleVisitor* visitor,
44 bool visit_prologue_weak_persistent_handles); 44 bool visit_prologue_weak_persistent_handles);
45 void IterateWeakReferences(Isolate* isolate, MarkingVisitor* visitor); 45 template<class MarkingVisitorType>
46 void IterateWeakReferences(Isolate* isolate, MarkingVisitorType* visitor);
46 void ProcessWeakTables(PageSpace* page_space); 47 void ProcessWeakTables(PageSpace* page_space);
47 void ProcessObjectIdTable(Isolate* isolate); 48 void ProcessObjectIdTable(Isolate* isolate);
48 49
49 // Called by anyone: finalize and accumulate stats from 'visitor'. 50 // Called by anyone: finalize and accumulate stats from 'visitor'.
50 void FinalizeResultsFrom(MarkingVisitor* visitor); 51 template<class MarkingVisitorType>
52 void FinalizeResultsFrom(MarkingVisitorType* visitor);
51 53
52 Heap* heap_; 54 Heap* heap_;
53 55
54 Mutex stats_mutex_; 56 Mutex stats_mutex_;
55 // TODO(koda): Remove after verifying it's redundant w.r.t. ClassHeapStats. 57 // TODO(koda): Remove after verifying it's redundant w.r.t. ClassHeapStats.
56 uintptr_t marked_bytes_; 58 uintptr_t marked_bytes_;
57 59
58 friend class MarkTask; 60 friend class MarkTask;
59 DISALLOW_IMPLICIT_CONSTRUCTORS(GCMarker); 61 DISALLOW_IMPLICIT_CONSTRUCTORS(GCMarker);
60 }; 62 };
61 63
62 } // namespace dart 64 } // namespace dart
63 65
64 #endif // VM_GC_MARKER_H_ 66 #endif // VM_GC_MARKER_H_
OLDNEW
« 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