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

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

Issue 2087463004: Revert of [heap] Avoid the use of cells to point from code to new-space objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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-inl.h ('k') | 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 b92dfef288acde4cf10818b9b7d7493fbfbb6246..5bf94e41ca5a017dda93d7d660f22ad990eebc78 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -1615,9 +1615,6 @@
DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode()));
Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address());
Code* host = rinfo->host();
- // The target is always in old space, we don't have to record the slot in
- // the old-to-new remembered set.
- DCHECK(!collector_->heap()->InNewSpace(target));
collector_->RecordRelocSlot(host, rinfo, target);
}
@@ -1626,9 +1623,6 @@
rinfo->IsPatchedDebugBreakSlotSequence());
Code* target = Code::GetCodeFromTargetAddress(rinfo->debug_call_address());
Code* host = rinfo->host();
- // The target is always in old space, we don't have to record the slot in
- // the old-to-new remembered set.
- DCHECK(!collector_->heap()->InNewSpace(target));
collector_->RecordRelocSlot(host, rinfo, target);
}
@@ -1636,7 +1630,6 @@
DCHECK(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT);
HeapObject* object = HeapObject::cast(rinfo->target_object());
Code* host = rinfo->host();
- collector_->heap()->RecordWriteIntoCode(host, rinfo, object);
collector_->RecordRelocSlot(host, rinfo, object);
}
@@ -1644,9 +1637,6 @@
DCHECK(rinfo->rmode() == RelocInfo::CELL);
Cell* cell = rinfo->target_cell();
Code* host = rinfo->host();
- // The cell is always in old space, we don't have to record the slot in
- // the old-to-new remembered set.
- DCHECK(!collector_->heap()->InNewSpace(cell));
collector_->RecordRelocSlot(host, rinfo, cell);
}
@@ -2514,35 +2504,6 @@
have_code_to_deoptimize_ |= current->MarkCodeForDeoptimization(
isolate, DependentCode::kWeakCodeGroup);
current = current->next_link();
- }
-
- {
- ArrayList* list = heap_->weak_new_space_object_to_code_list();
- int counter = 0;
- for (int i = 0; i < list->Length(); i += 2) {
- WeakCell* obj = WeakCell::cast(list->Get(i));
- WeakCell* dep = WeakCell::cast(list->Get(i + 1));
- if (obj->cleared() || dep->cleared()) {
- if (!dep->cleared()) {
- Code* code = Code::cast(dep->value());
- if (!code->marked_for_deoptimization()) {
- DependentCode::SetMarkedForDeoptimization(
- code, DependentCode::DependencyGroup::kWeakCodeGroup);
- code->InvalidateEmbeddedObjects();
- have_code_to_deoptimize_ = true;
- }
- }
- } else {
- // We record the slot manually because marking is finished at this
- // point and the write barrier would bailout.
- list->Set(counter, obj, SKIP_WRITE_BARRIER);
- RecordSlot(list, list->Slot(counter), obj);
- counter++;
- list->Set(counter, dep, SKIP_WRITE_BARRIER);
- RecordSlot(list, list->Slot(counter), dep);
- counter++;
- }
- }
}
WeakHashTable* table = heap_->weak_object_to_code_table();
@@ -2889,16 +2850,30 @@
heap()->set_encountered_transition_arrays(Smi::FromInt(0));
}
+static inline SlotType SlotTypeForRMode(RelocInfo::Mode rmode) {
+ if (RelocInfo::IsCodeTarget(rmode)) {
+ return CODE_TARGET_SLOT;
+ } else if (RelocInfo::IsCell(rmode)) {
+ return CELL_TARGET_SLOT;
+ } else if (RelocInfo::IsEmbeddedObject(rmode)) {
+ return EMBEDDED_OBJECT_SLOT;
+ } else if (RelocInfo::IsDebugBreakSlot(rmode)) {
+ return DEBUG_TARGET_SLOT;
+ }
+ UNREACHABLE();
+ return NUMBER_OF_SLOT_TYPES;
+}
+
void MarkCompactCollector::RecordRelocSlot(Code* host, RelocInfo* rinfo,
Object* target) {
Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
Page* source_page = Page::FromAddress(reinterpret_cast<Address>(host));
+ RelocInfo::Mode rmode = rinfo->rmode();
if (target_page->IsEvacuationCandidate() &&
(rinfo->host() == NULL ||
!ShouldSkipEvacuationSlotRecording(rinfo->host()))) {
- RelocInfo::Mode rmode = rinfo->rmode();
Address addr = rinfo->pc();
- SlotType slot_type = SlotTypeForRelocInfoMode(rmode);
+ SlotType slot_type = SlotTypeForRMode(rmode);
if (rinfo->IsInConstantPool()) {
addr = rinfo->constant_pool_entry_address();
if (RelocInfo::IsCodeTarget(rmode)) {
@@ -3523,12 +3498,6 @@
}
void MarkCompactCollector::InvalidateCode(Code* code) {
- Page* page = Page::FromAddress(code->address());
- Address start = code->instruction_start();
- Address end = code->address() + code->Size();
-
- RememberedSet<OLD_TO_NEW>::RemoveRangeTyped(page, start, end);
-
if (heap_->incremental_marking()->IsCompacting() &&
!ShouldSkipEvacuationSlotRecording(code)) {
DCHECK(compacting_);
@@ -3540,7 +3509,11 @@
// Ignore all slots that might have been recorded in the body of the
// deoptimized code object. Assumption: no slots will be recorded for
// this object after invalidating it.
+ Page* page = Page::FromAddress(code->address());
+ Address start = code->instruction_start();
+ Address end = code->address() + code->Size();
RememberedSet<OLD_TO_OLD>::RemoveRangeTyped(page, start, end);
+ RememberedSet<OLD_TO_NEW>::RemoveRangeTyped(page, start, end);
}
}
@@ -4144,9 +4117,6 @@
MarkBit mark_bit = Marking::MarkBitFrom(host);
if (Marking::IsBlack(mark_bit)) {
RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host);
- // The target is always in old space, we don't have to record the slot in
- // the old-to-new remembered set.
- DCHECK(!heap()->InNewSpace(target));
RecordRelocSlot(host, &rinfo, target);
}
}
« no previous file with comments | « src/heap/heap-inl.h ('k') | src/heap/remembered-set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698