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

Unified Diff: src/heap/mark-compact.cc

Issue 2773093002: Revert "[heap] Make SlotSet allocation thread-safe and refactor code." (Closed)
Patch Set: Created 3 years, 9 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/remembered-set.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 940ad6c283aa43479aef4781192439436066af83..8f67f8d0af94b3c0d977fcf33260c6c0f516ff06 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -684,8 +684,8 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) {
// of a GC all evacuation candidates are cleared and their slot buffers are
// released.
CHECK(!p->IsEvacuationCandidate());
- CHECK_NULL(p->slot_set<OLD_TO_OLD>());
- CHECK_NULL(p->typed_slot_set<OLD_TO_OLD>());
+ CHECK_NULL(p->old_to_old_slots());
+ CHECK_NULL(p->typed_old_to_old_slots());
CHECK(p->SweepingDone());
DCHECK(p->area_size() == area_size);
pages.push_back(std::make_pair(p->LiveBytesFromFreeList(), p));
@@ -3399,10 +3399,10 @@ class EvacuationWeakObjectRetainer : public WeakObjectRetainer {
MarkCompactCollector::Sweeper::ClearOldToNewSlotsMode
MarkCompactCollector::Sweeper::GetClearOldToNewSlotsMode(Page* p) {
AllocationSpace identity = p->owner()->identity();
- if (p->slot_set<OLD_TO_NEW>() &&
+ if (p->old_to_new_slots() &&
(identity == OLD_SPACE || identity == MAP_SPACE)) {
return MarkCompactCollector::Sweeper::CLEAR_REGULAR_SLOTS;
- } else if (p->typed_slot_set<OLD_TO_NEW>() && identity == CODE_SPACE) {
+ } else if (p->typed_old_to_new_slots() && identity == CODE_SPACE) {
return MarkCompactCollector::Sweeper::CLEAR_TYPED_SLOTS;
}
return MarkCompactCollector::Sweeper::DO_NOT_CLEAR;
@@ -3516,7 +3516,7 @@ int MarkCompactCollector::Sweeper::RawSweep(
// Clear invalid typed slots after collection all free ranges.
if (slots_clearing_mode == CLEAR_TYPED_SLOTS) {
- p->typed_slot_set<OLD_TO_NEW>()->RemoveInvaldSlots(free_ranges);
+ p->typed_old_to_new_slots()->RemoveInvaldSlots(free_ranges);
}
// Clear the mark bits of that page and reset live bytes count.
@@ -3575,14 +3575,15 @@ bool LiveObjectVisitor::VisitBlackObjects(MemoryChunk* chunk,
state.bitmap->ClearRange(
chunk->AddressToMarkbitIndex(chunk->area_start()),
chunk->AddressToMarkbitIndex(object->address()));
- SlotSet* slot_set = chunk->slot_set<OLD_TO_NEW>();
- if (slot_set != nullptr) {
- slot_set->RemoveRange(
+ if (chunk->old_to_new_slots() != nullptr) {
+ chunk->old_to_new_slots()->RemoveRange(
0, static_cast<int>(object->address() - chunk->address()),
SlotSet::PREFREE_EMPTY_BUCKETS);
}
- RememberedSet<OLD_TO_NEW>::RemoveRangeTyped(chunk, chunk->address(),
- object->address());
+ if (chunk->typed_old_to_new_slots() != nullptr) {
+ RememberedSet<OLD_TO_NEW>::RemoveRangeTyped(chunk, chunk->address(),
+ object->address());
+ }
RecomputeLiveBytes(chunk, state);
}
return false;
@@ -3682,7 +3683,7 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
#endif
}
-template <RememberedSetType type>
+template <PointerDirection direction>
class PointerUpdateJobTraits {
public:
typedef int PerPageData; // Per page data is not used in this job.
@@ -3700,7 +3701,7 @@ class PointerUpdateJobTraits {
private:
static void UpdateUntypedPointers(Heap* heap, MemoryChunk* chunk) {
- if (type == OLD_TO_NEW) {
+ if (direction == OLD_TO_NEW) {
RememberedSet<OLD_TO_NEW>::Iterate(chunk, [heap](Address slot) {
return CheckAndUpdateOldToNewSlot(heap, slot);
});
@@ -3712,21 +3713,20 @@ class PointerUpdateJobTraits {
}
static void UpdateTypedPointers(Heap* heap, MemoryChunk* chunk) {
- if (type == OLD_TO_OLD) {
+ if (direction == OLD_TO_OLD) {
Isolate* isolate = heap->isolate();
RememberedSet<OLD_TO_OLD>::IterateTyped(
- chunk,
- [isolate](SlotType slot_type, Address host_addr, Address slot) {
- return UpdateTypedSlotHelper::UpdateTypedSlot(isolate, slot_type,
- slot, UpdateSlot);
+ chunk, [isolate](SlotType type, Address host_addr, Address slot) {
+ return UpdateTypedSlotHelper::UpdateTypedSlot(isolate, type, slot,
+ UpdateSlot);
});
} else {
Isolate* isolate = heap->isolate();
RememberedSet<OLD_TO_NEW>::IterateTyped(
chunk,
- [isolate, heap](SlotType slot_type, Address host_addr, Address slot) {
+ [isolate, heap](SlotType type, Address host_addr, Address slot) {
return UpdateTypedSlotHelper::UpdateTypedSlot(
- isolate, slot_type, slot, [heap](Object** slot) {
+ isolate, type, slot, [heap](Object** slot) {
return CheckAndUpdateOldToNewSlot(
heap, reinterpret_cast<Address>(slot));
});
@@ -3791,11 +3791,11 @@ int NumberOfPointerUpdateTasks(int pages) {
return Min(available_cores, (pages + kPagesPerTask - 1) / kPagesPerTask);
}
-template <RememberedSetType type>
+template <PointerDirection direction>
void UpdatePointersInParallel(Heap* heap, base::Semaphore* semaphore) {
- PageParallelJob<PointerUpdateJobTraits<type> > job(
+ PageParallelJob<PointerUpdateJobTraits<direction> > job(
heap, heap->isolate()->cancelable_task_manager(), semaphore);
- RememberedSet<type>::IterateMemoryChunks(
+ RememberedSet<direction>::IterateMemoryChunks(
heap, [&job](MemoryChunk* chunk) { job.AddPage(chunk, 0); });
int num_pages = job.NumberOfPages();
int num_tasks = NumberOfPointerUpdateTasks(num_pages);
@@ -3951,13 +3951,11 @@ int MarkCompactCollector::Sweeper::ParallelSweepPage(Page* page,
DCHECK(page->SweepingDone());
// After finishing sweeping of a page we clean up its remembered set.
- TypedSlotSet* typed_slot_set = page->typed_slot_set<OLD_TO_NEW>();
- if (typed_slot_set) {
- page->typed_slot_set<OLD_TO_NEW>()->FreeToBeFreedChunks();
+ if (page->typed_old_to_new_slots()) {
+ page->typed_old_to_new_slots()->FreeToBeFreedChunks();
}
- SlotSet* slot_set = page->slot_set<OLD_TO_NEW>();
- if (slot_set) {
- page->slot_set<OLD_TO_NEW>()->FreeToBeFreedBuckets();
+ if (page->old_to_new_slots()) {
+ page->old_to_new_slots()->FreeToBeFreedBuckets();
}
}
« no previous file with comments | « no previous file | src/heap/remembered-set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698