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

Unified Diff: runtime/vm/heap.h

Issue 1212943010: Safer interface for heap iteration. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix release mode. Created 5 years, 5 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/dart_api_impl.cc ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/heap.h
diff --git a/runtime/vm/heap.h b/runtime/vm/heap.h
index 6d8752ca98d3ddd8b27f1762578daf030f13b968..43858837d33cfb7ea2bf7aeddaa5614f3a84cc77 100644
--- a/runtime/vm/heap.h
+++ b/runtime/vm/heap.h
@@ -105,14 +105,9 @@ class Heap {
bool CodeContains(uword addr) const;
bool StubCodeContains(uword addr) const;
- // Visit all pointers. Caller must ensure concurrent sweeper is not running,
- // and the visitor must not allocate (see issue 21620).
- void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
-
- // Visit all objects, including FreeListElement "objects". Caller must ensure
- // concurrent sweeper is not running, and the visitor must not allocate (see
- // issue 21620).
- void VisitObjects(ObjectVisitor* visitor) const;
+ void IterateObjects(ObjectVisitor* visitor) const;
+ void IterateOldObjects(ObjectVisitor* visitor) const;
+ void IterateObjectPointers(ObjectVisitor* visitor) const;
// Find an object by visiting all pointers in the specified heap space,
// the 'visitor' is used to determine if an object is found or not.
@@ -121,8 +116,7 @@ class Heap {
// point.
// The 'visitor' function should return false if the object is not found,
// traversal through the heap space continues.
- // Returns null object if nothing is found. Must be called within a
- // NoSafepointScope.
+ // Returns null object if nothing is found.
RawInstructions* FindObjectInCodeSpace(FindObjectVisitor* visitor) const;
RawObject* FindOldObject(FindObjectVisitor* visitor) const;
RawObject* FindNewObject(FindObjectVisitor* visitor) const;
@@ -284,6 +278,18 @@ class Heap {
uword AllocateOld(intptr_t size, HeapPage::PageType type);
uword AllocatePretenured(intptr_t size);
+ // Visit all pointers. Caller must ensure concurrent sweeper is not running,
+ // and the visitor must not allocate.
+ void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
+
+ // Visit all objects, including FreeListElement "objects". Caller must ensure
+ // concurrent sweeper is not running, and the visitor must not allocate.
+ void VisitObjects(ObjectVisitor* visitor) const;
+
+ // Like Verify, but does not wait for concurrent sweeper, so caller must
+ // ensure thread-safety.
+ bool VerifyGC(MarkExpectation mark_expectation = kForbidMarked) const;
+
// GC stats collection.
void RecordBeforeGC(Space space, GCReason reason);
void RecordAfterGC();
@@ -318,6 +324,7 @@ class Heap {
friend class ServiceEvent;
friend class GCTestHelper;
+ friend class PageSpace; // VerifyGC
DISALLOW_COPY_AND_ASSIGN(Heap);
};
@@ -342,6 +349,18 @@ class NoSafepointScope : public ValueObject {
#endif // defined(DEBUG)
+class HeapIterationScope : public StackResource {
+ public:
+ HeapIterationScope();
+ ~HeapIterationScope();
+ private:
+ NoSafepointScope no_safepoint_scope_;
+ PageSpace* old_space_;
+
+ DISALLOW_COPY_AND_ASSIGN(HeapIterationScope);
+};
+
+
class NoHeapGrowthControlScope : public StackResource {
public:
NoHeapGrowthControlScope();
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698