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

Unified Diff: src/heap/heap-inl.h

Issue 2801073006: Decouple root visitors from object visitors. (Closed)
Patch Set: rebase 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 | « src/heap/heap.cc ('k') | src/heap/incremental-marking.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap-inl.h
diff --git a/src/heap/heap-inl.h b/src/heap/heap-inl.h
index a0e731119c6d66783951cfd0715e5d2249e1085c..12b19802237d8149d8499887e5ff389513147b71 100644
--- a/src/heap/heap-inl.h
+++ b/src/heap/heap-inl.h
@@ -706,18 +706,20 @@ void Heap::ExternalStringTable::AddString(String* string) {
}
}
-void Heap::ExternalStringTable::IterateNewSpaceStrings(ObjectVisitor* v) {
+void Heap::ExternalStringTable::IterateNewSpaceStrings(RootVisitor* v) {
if (!new_space_strings_.is_empty()) {
Object** start = &new_space_strings_[0];
- v->VisitPointers(start, start + new_space_strings_.length());
+ v->VisitRootPointers(Root::kExternalStringsTable, start,
+ start + new_space_strings_.length());
}
}
-void Heap::ExternalStringTable::IterateAll(ObjectVisitor* v) {
+void Heap::ExternalStringTable::IterateAll(RootVisitor* v) {
IterateNewSpaceStrings(v);
if (!old_space_strings_.is_empty()) {
Object** start = &old_space_strings_[0];
- v->VisitPointers(start, start + old_space_strings_.length());
+ v->VisitRootPointers(Root::kExternalStringsTable, start,
+ start + old_space_strings_.length());
}
}
@@ -850,13 +852,20 @@ AlwaysAllocateScope::AlwaysAllocateScope(Isolate* isolate)
heap_->always_allocate_scope_count_.Increment(1);
}
-
AlwaysAllocateScope::~AlwaysAllocateScope() {
heap_->always_allocate_scope_count_.Decrement(1);
}
-
void VerifyPointersVisitor::VisitPointers(Object** start, Object** end) {
+ VerifyPointers(start, end);
+}
+
+void VerifyPointersVisitor::VisitRootPointers(Root root, Object** start,
+ Object** end) {
+ VerifyPointers(start, end);
+}
+
+void VerifyPointersVisitor::VerifyPointers(Object** start, Object** end) {
for (Object** current = start; current < end; current++) {
if ((*current)->IsHeapObject()) {
HeapObject* object = HeapObject::cast(*current);
@@ -868,8 +877,8 @@ void VerifyPointersVisitor::VisitPointers(Object** start, Object** end) {
}
}
-
-void VerifySmisVisitor::VisitPointers(Object** start, Object** end) {
+void VerifySmisVisitor::VisitRootPointers(Root root, Object** start,
+ Object** end) {
for (Object** current = start; current < end; current++) {
CHECK((*current)->IsSmi());
}
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/incremental-marking.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698