Commit bd3d091d authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Make write barrier safe for the concurrent marker.

With concurrent marking the write barrier should trigger even if the
object is black because the concurrent marker could have fetched
object field before marking the object black.

BUG=chromium:694255

Change-Id: Icacc5672defeec85936e37d7d06780c74b97732c
Reviewed-on: https://chromium-review.googlesource.com/533614Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45938}
parent e459d4b1
......@@ -2173,10 +2173,11 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,
OnNoNeedToInformIncrementalMarker on_no_need,
Mode mode) {
Label on_black;
Label need_incremental;
Label need_incremental_pop_scratch;
#ifndef V8_CONCURRENT_MARKING
Label on_black;
// Let's look at the color of the object: If it is not black we don't have
// to inform the incremental marker.
__ JumpIfBlack(regs_.object(), regs_.scratch0(), regs_.scratch1(), &on_black);
......@@ -2190,6 +2191,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
}
__ bind(&on_black);
#endif
// Get the value from the slot.
__ ldr(regs_.scratch0(), MemOperand(regs_.address(), 0));
......
......@@ -2128,10 +2128,11 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,
OnNoNeedToInformIncrementalMarker on_no_need,
Mode mode) {
Label on_black;
Label need_incremental;
Label need_incremental_pop_scratch;
#ifndef V8_CONCURRENT_MARKING
Label on_black;
// If the object is not black we don't have to inform the incremental marker.
__ JumpIfBlack(regs_.object(), regs_.scratch0(), regs_.scratch1(), &on_black);
......@@ -2145,6 +2146,8 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
}
__ Bind(&on_black);
#endif
// Get the value from the slot.
Register val = regs_.scratch0();
__ Ldr(val, MemOperand(regs_.address()));
......
......@@ -55,13 +55,14 @@ bool IncrementalMarking::BaseRecordWrite(HeapObject* obj, Object* value) {
DCHECK(!ObjectMarking::IsImpossible<kAtomicity>(
value_heap_obj, marking_state(value_heap_obj)));
DCHECK(!ObjectMarking::IsImpossible<kAtomicity>(obj, marking_state(obj)));
const bool is_black =
const bool need_recording =
FLAG_concurrent_marking ||
ObjectMarking::IsBlack<kAtomicity>(obj, marking_state(obj));
if (is_black && WhiteToGreyAndPush(value_heap_obj)) {
if (need_recording && WhiteToGreyAndPush(value_heap_obj)) {
RestartIfNotMarking();
}
return is_compacting_ && is_black;
return is_compacting_ && need_recording;
}
......
......@@ -2118,8 +2118,10 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,
OnNoNeedToInformIncrementalMarker on_no_need,
Mode mode) {
Label object_is_black, need_incremental, need_incremental_pop_object;
Label need_incremental, need_incremental_pop_object;
#ifndef V8_CONCURRENT_MARKING
Label object_is_black;
// Let's look at the color of the object: If it is not black we don't have
// to inform the incremental marker.
__ JumpIfBlack(regs_.object(),
......@@ -2137,6 +2139,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
}
__ bind(&object_is_black);
#endif
// Get the value from the slot.
__ mov(regs_.scratch0(), Operand(regs_.address(), 0));
......
......@@ -2354,10 +2354,11 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,
OnNoNeedToInformIncrementalMarker on_no_need,
Mode mode) {
Label on_black;
Label need_incremental;
Label need_incremental_pop_scratch;
#ifndef V8_CONCURRENT_MARKING
Label on_black;
// Let's look at the color of the object: If it is not black we don't have
// to inform the incremental marker.
__ JumpIfBlack(regs_.object(), regs_.scratch0(), regs_.scratch1(), &on_black);
......@@ -2374,6 +2375,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
}
__ bind(&on_black);
#endif
// Get the value from the slot.
__ lw(regs_.scratch0(), MemOperand(regs_.address(), 0));
......
......@@ -2357,10 +2357,11 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,
OnNoNeedToInformIncrementalMarker on_no_need,
Mode mode) {
Label on_black;
Label need_incremental;
Label need_incremental_pop_scratch;
#ifndef V8_CONCURRENT_MARKING
Label on_black;
// Let's look at the color of the object: If it is not black we don't have
// to inform the incremental marker.
__ JumpIfBlack(regs_.object(), regs_.scratch0(), regs_.scratch1(), &on_black);
......@@ -2377,6 +2378,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
}
__ bind(&on_black);
#endif
// Get the value from the slot.
__ Ld(regs_.scratch0(), MemOperand(regs_.address(), 0));
......
......@@ -2235,10 +2235,11 @@ void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm) {
void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm, OnNoNeedToInformIncrementalMarker on_no_need,
Mode mode) {
Label on_black;
Label need_incremental;
Label need_incremental_pop_scratch;
#ifndef V8_CONCURRENT_MARKING
Label on_black;
// Let's look at the color of the object: If it is not black we don't have
// to inform the incremental marker.
__ JumpIfBlack(regs_.object(), regs_.scratch0(), regs_.scratch1(), &on_black);
......@@ -2252,6 +2253,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
}
__ bind(&on_black);
#endif
// Get the value from the slot.
__ LoadP(regs_.scratch0(), MemOperand(regs_.address(), 0));
......
......@@ -2074,10 +2074,11 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,
OnNoNeedToInformIncrementalMarker on_no_need,
Mode mode) {
Label on_black;
Label need_incremental;
Label need_incremental_pop_object;
#ifndef V8_CONCURRENT_MARKING
Label on_black;
// Let's look at the color of the object: If it is not black we don't have
// to inform the incremental marker.
__ JumpIfBlack(regs_.object(),
......@@ -2095,6 +2096,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
}
__ bind(&on_black);
#endif
// Get the value from the slot.
__ movp(regs_.scratch0(), Operand(regs_.address(), 0));
......
......@@ -2134,8 +2134,10 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,
OnNoNeedToInformIncrementalMarker on_no_need,
Mode mode) {
Label object_is_black, need_incremental, need_incremental_pop_object;
Label need_incremental, need_incremental_pop_object;
#ifndef V8_CONCURRENT_MARKING
Label object_is_black;
// Let's look at the color of the object: If it is not black we don't have
// to inform the incremental marker.
__ JumpIfBlack(regs_.object(),
......@@ -2153,6 +2155,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
}
__ bind(&object_is_black);
#endif
// Get the value from the slot.
__ mov(regs_.scratch0(), Operand(regs_.address(), 0));
......
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