Chromium Code Reviews

Unified Diff: src/incremental-marking-inl.h

Issue 7834018: Support compaction for code space pages. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: port changes from ia32 to arm & x64 Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: src/incremental-marking-inl.h
diff --git a/src/incremental-marking-inl.h b/src/incremental-marking-inl.h
index f21b4d1ead8b6944c64742a96c9fc9a82d905c4a..b1b29ecbf0a522f4e533538004df1b49174a5fbd 100644
--- a/src/incremental-marking-inl.h
+++ b/src/incremental-marking-inl.h
@@ -34,9 +34,44 @@ namespace v8 {
namespace internal {
+bool IncrementalMarking::BaseRecordWrite(HeapObject* obj,
+ Object** slot,
+ Object* value) {
+ if (IsMarking() && value->IsHeapObject()) {
+ MarkBit value_bit = Marking::MarkBitFrom(HeapObject::cast(value));
+ if (Marking::IsWhite(value_bit)) {
+ MarkBit obj_bit = Marking::MarkBitFrom(obj);
+ if (Marking::IsBlack(obj_bit)) {
+ BlackToGreyAndUnshift(obj, obj_bit);
+ RestartIfNotMarking();
+ }
+
+ // Object is either grey or white it will be scanned if survives.
+ return false;
+ }
+ return true;
+ }
+ return false;
+}
+
+
void IncrementalMarking::RecordWrite(HeapObject* obj,
Object** slot,
Object* value) {
+ if (BaseRecordWrite(obj, slot, value) && is_compacting_ && slot != NULL) {
+ MarkBit obj_bit = Marking::MarkBitFrom(obj);
+ if (Marking::IsBlack(obj_bit)) {
+ // Object is not going to be rescanned we need to record the slot.
+ heap_->mark_compact_collector()->RecordSlot(
+ HeapObject::RawField(obj, 0), slot, value);
+ }
+ }
+}
+
+
+void IncrementalMarking::RecordWriteIntoCode(HeapObject* obj,
+ RelocInfo* rinfo,
+ Object* value) {
if (IsMarking() && value->IsHeapObject()) {
MarkBit value_bit = Marking::MarkBitFrom(HeapObject::cast(value));
if (Marking::IsWhite(value_bit)) {
@@ -50,31 +85,18 @@ void IncrementalMarking::RecordWrite(HeapObject* obj,
return;
}
- if (is_compacting_ && slot != NULL) {
+ if (is_compacting_) {
MarkBit obj_bit = Marking::MarkBitFrom(obj);
if (Marking::IsBlack(obj_bit)) {
// Object is not going to be rescanned we need to record the slot.
- heap_->mark_compact_collector()->RecordSlot(
- HeapObject::RawField(obj, 0), slot, value);
+ heap_->mark_compact_collector()->RecordRelocSlot(rinfo,
+ Code::cast(value));
}
}
}
}
-void IncrementalMarking::RecordWriteOf(HeapObject* value) {
- if (IsMarking()) {
- ASSERT(!MarkCompactCollector::IsOnEvacuationCandidate(value));
-
- MarkBit value_bit = Marking::MarkBitFrom(value);
- if (Marking::IsWhite(value_bit)) {
- WhiteToGreyAndPush(value, value_bit);
- RestartIfNotMarking();
- }
- }
-}
-
-
void IncrementalMarking::RecordWrites(HeapObject* obj) {
if (IsMarking()) {
MarkBit obj_bit = Marking::MarkBitFrom(obj);

Powered by Google App Engine