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

Unified Diff: src/mark-compact.cc

Issue 8245007: Refactor how embedded pointers are visited. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Vyacheslav Egorov. Created 9 years, 2 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/mark-compact.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 6250e5439f17e52f129457dcd13b65ef45ece1a2..9fa79ca74629a406ea6a27181bfa296c23f47cee 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -847,10 +847,14 @@ class StaticMarkingVisitor : public StaticVisitorBase {
heap->mark_compact_collector()->MarkObject(cell, mark);
}
- static inline void VisitEmbeddedPointer(Heap* heap, Code* host, Object** p) {
- MarkObjectByPointer(heap->mark_compact_collector(),
- reinterpret_cast<Object**>(host),
- p);
+ static inline void VisitEmbeddedPointer(Heap* heap, RelocInfo* rinfo) {
+ ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT);
+ // TODO(mstarzinger): We do not short-circuit cons strings here, verify
+ // that there can be no such embedded pointers and add assertion here.
+ HeapObject* object = HeapObject::cast(rinfo->target_object());
+ heap->mark_compact_collector()->RecordRelocSlot(rinfo, object);
+ MarkBit mark = Marking::MarkBitFrom(object);
+ heap->mark_compact_collector()->MarkObject(object, mark);
}
static inline void VisitCodeTarget(Heap* heap, RelocInfo* rinfo) {
@@ -2458,8 +2462,11 @@ class PointersUpdatingVisitor: public ObjectVisitor {
for (Object** p = start; p < end; p++) UpdatePointer(p);
}
- void VisitEmbeddedPointer(Code* host, Object** p) {
- UpdatePointer(p);
+ void VisitEmbeddedPointer(RelocInfo* rinfo) {
+ ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT);
+ Object* target = rinfo->target_object();
+ VisitPointer(&target);
+ rinfo->set_target_object(target);
}
void VisitCodeTarget(RelocInfo* rinfo) {
@@ -2773,6 +2780,11 @@ static inline void UpdateSlot(ObjectVisitor* v,
if (rinfo.IsPatchedReturnSequence()) rinfo.Visit(v);
break;
}
+ case SlotsBuffer::EMBEDDED_OBJECT_SLOT: {
+ RelocInfo rinfo(addr, RelocInfo::EMBEDDED_OBJECT, 0, NULL);
+ rinfo.Visit(v);
+ break;
+ }
default:
UNREACHABLE();
break;
@@ -3706,6 +3718,8 @@ bool SlotsBuffer::AddTo(SlotsBufferAllocator* allocator,
static inline SlotsBuffer::SlotType SlotTypeForRMode(RelocInfo::Mode rmode) {
if (RelocInfo::IsCodeTarget(rmode)) {
return SlotsBuffer::CODE_TARGET_SLOT;
+ } else if (RelocInfo::IsEmbeddedObject(rmode)) {
+ return SlotsBuffer::EMBEDDED_OBJECT_SLOT;
} else if (RelocInfo::IsDebugBreakSlot(rmode)) {
return SlotsBuffer::DEBUG_TARGET_SLOT;
} else if (RelocInfo::IsJSReturn(rmode)) {
@@ -3716,9 +3730,8 @@ static inline SlotsBuffer::SlotType SlotTypeForRMode(RelocInfo::Mode rmode) {
}
-void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Code* target) {
- Page* target_page = Page::FromAddress(
- reinterpret_cast<Address>(target));
+void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Object* target) {
+ Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
if (target_page->IsEvacuationCandidate() &&
(rinfo->host() == NULL ||
!ShouldSkipEvacuationSlotRecording(rinfo->host()))) {
@@ -3734,8 +3747,7 @@ void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Code* target) {
void MarkCompactCollector::RecordCodeEntrySlot(Address slot, Code* target) {
- Page* target_page = Page::FromAddress(
- reinterpret_cast<Address>(target));
+ Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
if (target_page->IsEvacuationCandidate() &&
!ShouldSkipEvacuationSlotRecording(reinterpret_cast<Object**>(slot))) {
if (!SlotsBuffer::AddTo(&slots_buffer_allocator_,
« no previous file with comments | « src/mark-compact.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698