Commit 6e6af7e7 authored by hpayer's avatar hpayer Committed by Commit bot

Re-land new insertion write barrier.

BUG=

Review URL: https://codereview.chromium.org/1211513002

Cr-Commit-Position: refs/heads/master@{#29258}
parent 5989a374
......@@ -15,28 +15,14 @@ bool IncrementalMarking::BaseRecordWrite(HeapObject* obj, Object** slot,
Object* value) {
HeapObject* value_heap_obj = HeapObject::cast(value);
MarkBit value_bit = Marking::MarkBitFrom(value_heap_obj);
if (Marking::IsWhite(value_bit)) {
MarkBit obj_bit = Marking::MarkBitFrom(obj);
if (Marking::IsBlack(obj_bit)) {
MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
if (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR)) {
if (chunk->IsLeftOfProgressBar(slot)) {
WhiteToGreyAndPush(value_heap_obj, value_bit);
RestartIfNotMarking();
} else {
return false;
}
} else {
BlackToGreyAndUnshift(obj, obj_bit);
RestartIfNotMarking();
return false;
}
} else {
return false;
}
// Checking the obj marking state is not necessary, but reduces the marking
// load.
MarkBit obj_bit = Marking::MarkBitFrom(obj);
if (Marking::IsWhite(value_bit) && Marking::IsBlack(obj_bit)) {
WhiteToGreyAndPush(value_heap_obj, value_bit);
RestartIfNotMarking();
}
if (!is_compacting_) return false;
MarkBit obj_bit = Marking::MarkBitFrom(obj);
return Marking::IsBlack(obj_bit);
}
......
......@@ -508,13 +508,6 @@ class MemoryChunk {
}
}
bool IsLeftOfProgressBar(Object** slot) {
Address slot_address = reinterpret_cast<Address>(slot);
DCHECK(slot_address > this->address());
return (slot_address - (this->address() + kObjectStartOffset)) <
progress_bar();
}
static void IncrementLiveBytesFromGC(Address address, int by) {
MemoryChunk::FromAddress(address)->IncrementLiveBytes(by);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment