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

Unified Diff: src/heap/heap.cc

Issue 2810653002: Add a host parameter to ObjectVisitor methods. (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.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 0a65f711849e90c0546cc618f56b2c7e04aa81cc..ea1c0b6efde5ee74f6cb82c22c976d8db89a19fa 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()) {
@@ -1758,8 +1758,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);
+ collector->code_flusher()
+ ->IteratePointersToFromSpace<StaticScavengeVisitor>();
}
}
@@ -4816,7 +4817,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);
@@ -4847,7 +4850,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()) {
@@ -4876,6 +4880,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
@@ -6120,7 +6126,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