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

Unified Diff: src/heap/concurrent-marking.cc

Issue 2808093003: [heap] Introduce HeapVisitor interface. (Closed)
Patch Set: fix compile error Created 3 years, 8 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 | src/heap/heap.cc » ('j') | src/heap/objects-visiting.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/concurrent-marking.cc
diff --git a/src/heap/concurrent-marking.cc b/src/heap/concurrent-marking.cc
index 887676ded888e13a8a749c8483777f0056572bbb..2a3377da3e3f703818ded8368720c485a14a3903 100644
--- a/src/heap/concurrent-marking.cc
+++ b/src/heap/concurrent-marking.cc
@@ -10,6 +10,8 @@
#include "src/heap/heap-inl.h"
#include "src/heap/heap.h"
#include "src/heap/marking.h"
+#include "src/heap/objects-visiting-inl.h"
+#include "src/heap/objects-visiting.h"
#include "src/isolate.h"
#include "src/locked-queue-inl.h"
#include "src/utils-inl.h"
@@ -50,8 +52,11 @@ class ConcurrentMarkingMarkbits {
std::unordered_map<MemoryChunk*, Bitmap*> bitmap_;
};
-class ConcurrentMarkingVisitor : public ObjectVisitor {
+class ConcurrentMarkingVisitor final
+ : public HeapVisitor<int, ConcurrentMarkingVisitor> {
public:
+ using BaseClass = HeapVisitor<int, ConcurrentMarkingVisitor>;
+
ConcurrentMarkingVisitor() : bytes_marked_(0) {}
void VisitPointers(HeapObject* host, Object** start, Object** end) override {
@@ -61,9 +66,95 @@ class ConcurrentMarkingVisitor : public ObjectVisitor {
}
}
+ // ===========================================================================
+ // JS object =================================================================
+ // ===========================================================================
+
+ int VisitJSObject(Map* map, JSObject* object) override {
+ // TODO(ulan): impement snapshot iteration.
+ return BaseClass::VisitJSObject(map, object);
+ }
+
+ int VisitJSObjectFast(Map* map, JSObject* object) override {
+ return VisitJSObject(map, object);
+ }
+
+ int VisitJSApiObject(Map* map, JSObject* object) override {
+ return VisitJSObject(map, object);
+ }
+
+ // ===========================================================================
+ // Fixed array object ========================================================
+ // ===========================================================================
+
+ int VisitFixedArray(Map* map, FixedArray* object) override {
+ // TODO(ulan): implement iteration with prefetched length.
+ return BaseClass::VisitFixedArray(map, object);
+ }
+
+ // ===========================================================================
+ // Code object ===============================================================
+ // ===========================================================================
+
+ int VisitCode(Map* map, Code* object) override {
+ // TODO(ulan): push the object to the bail-out deque.
+ return 0;
+ }
+
+ // ===========================================================================
+ // Objects with weak fields and/or side-effectiful visitation.
+ // ===========================================================================
+
+ int VisitBytecodeArray(Map* map, BytecodeArray* object) override {
+ // TODO(ulan): implement iteration of strong fields and push the object to
+ // the bailout deque.
+ return 0;
+ }
+
+ int VisitJSFunction(Map* map, JSFunction* object) override {
+ // TODO(ulan): implement iteration of strong fields and push the object to
+ // the bailout deque.
+ return 0;
+ }
+
+ int VisitMap(Map* map, Map* object) override {
+ // TODO(ulan): implement iteration of strong fields and push the object to
+ // the bailout deque.
+ return 0;
+ }
+
+ int VisitNativeContext(Map* map, Context* object) override {
+ // TODO(ulan): implement iteration of strong fields and push the object to
+ // the bailout deque.
+ return 0;
+ }
+
+ int VisitSharedFunctionInfo(Map* map, SharedFunctionInfo* object) override {
+ // TODO(ulan): implement iteration of strong fields and push the object to
+ // the bailout deque.
+ return 0;
+ }
+
+ int VisitTransitionArray(Map* map, TransitionArray* object) override {
+ // TODO(ulan): implement iteration of strong fields and push the object to
+ // the bailout deque.
+ return 0;
+ }
+
+ int VisitWeakCell(Map* map, WeakCell* object) override {
+ // TODO(ulan): implement iteration of strong fields and push the object to
+ // the bailout deque.
+ return 0;
+ }
+
+ int VisitJSWeakCollection(Map* map, JSWeakCollection* object) override {
+ // TODO(ulan): implement iteration of strong fields and push the object to
+ // the bailout deque.
+ return 0;
+ }
+
void MarkObject(HeapObject* obj) {
if (markbits_.Mark(obj)) {
- bytes_marked_ += obj->Size();
marking_stack_.push(obj);
}
}
@@ -72,7 +163,7 @@ class ConcurrentMarkingVisitor : public ObjectVisitor {
while (!marking_stack_.empty()) {
HeapObject* obj = marking_stack_.top();
marking_stack_.pop();
- obj->Iterate(this);
+ bytes_marked_ += IterateBody(obj);
}
}
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | src/heap/objects-visiting.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698