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

Unified Diff: src/heap/heap.cc

Issue 2810653002: Add a host parameter to ObjectVisitor methods. (Closed)
Patch Set: remove code 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.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index db69962fe0d45342781a2e68bd57b540162c4437..e4240e382a289d5a22426ab173898694dd682f9b 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1137,7 +1137,7 @@ void Heap::MoveElements(FixedArray* array, int dst_index, int src_index,
// Helper class for verifying the string table.
class StringTableVerifier : public ObjectVisitor {
public:
- void VisitPointers(Object** start, Object** end) override {
+ void VisitPointers(HeapObject* host, Object** start, Object** end) override {
// Visit all HeapObject pointers in [start, end).
for (Object** p = start; p < end; p++) {
if ((*p)->IsHeapObject()) {
@@ -1753,8 +1753,9 @@ void Heap::Scavenge() {
TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_CODE_FLUSH_CANDIDATES);
MarkCompactCollector* collector = mark_compact_collector();
if (collector->is_code_flushing_enabled()) {
- collector->code_flusher()->IteratePointersToFromSpace(
- &root_scavenge_visitor);
+ collector->code_flusher()->VisitListHeads(&root_scavenge_visitor);
ulan 2017/04/10 10:59:37 This is the only non-mechanical change: we first v
+ collector->code_flusher()
+ ->IteratePointersToFromSpace<StaticScavengeVisitor>();
}
}
@@ -4821,7 +4822,9 @@ class IterateAndScavengePromotedObjectsVisitor final : public ObjectVisitor {
bool record_slots)
: heap_(heap), target_(target), record_slots_(record_slots) {}
- inline void VisitPointers(Object** start, Object** end) override {
+ inline void VisitPointers(HeapObject* host, Object** start,
+ Object** end) override {
+ DCHECK_EQ(host, target_);
Address slot_address = reinterpret_cast<Address>(start);
Page* page = Page::FromAddress(slot_address);
@@ -4852,7 +4855,8 @@ class IterateAndScavengePromotedObjectsVisitor final : public ObjectVisitor {
}
}
- inline void VisitCodeEntry(Address code_entry_slot) override {
+ inline void VisitCodeEntry(JSFunction* host,
+ Address code_entry_slot) override {
// Black allocation requires us to process objects referenced by
// promoted objects.
if (heap_->incremental_marking()->black_allocation()) {
@@ -4881,6 +4885,8 @@ void Heap::IterateAndScavengePromotedObject(HeapObject* target, int size,
ObjectMarking::IsBlack(target, MarkingState::Internal(target));
}
+ // TODO(ulan): remove the target, the visitor now gets the host object
+ // in each visit method.
IterateAndScavengePromotedObjectsVisitor visitor(this, target, record_slots);
if (target->IsJSFunction()) {
// JSFunctions reachable through kNextFunctionLinkOffset are weak. Slots for
@@ -6125,7 +6131,8 @@ class UnreachableObjectsFilter : public HeapObjectsFilter {
public:
MarkingVisitor() : marking_stack_(10) {}
- void VisitPointers(Object** start, Object** end) override {
+ void VisitPointers(HeapObject* host, Object** start,
+ Object** end) override {
MarkPointers(start, end);
}
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698