Commit 1d2a1dd6 authored by mlippautz's avatar mlippautz Committed by Commit bot

[heap] Prepare Heap::CopyFixedArrayWithMap for black allocation

With black allocation turned on we have no guarantee that the target array is
white and will be visited by the marker. Only execute the fast path when we are
allowed to skip the barrier.

R=hpayer@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2188713004
Cr-Commit-Position: refs/heads/master@{#38142}
parent 4ac08c97
......@@ -3822,17 +3822,20 @@ AllocationResult Heap::CopyFixedArrayWithMap(FixedArray* src, Map* map) {
if (!allocation.To(&obj)) return allocation;
}
obj->set_map_no_write_barrier(map);
if (InNewSpace(obj)) {
FixedArray* result = FixedArray::cast(obj);
DisallowHeapAllocation no_gc;
WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
// Eliminate the write barrier if possible.
if (mode == SKIP_WRITE_BARRIER) {
CopyBlock(obj->address() + kPointerSize, src->address() + kPointerSize,
FixedArray::SizeFor(len) - kPointerSize);
return obj;
}
FixedArray* result = FixedArray::cast(obj);
result->set_length(len);
// Copy the content.
DisallowHeapAllocation no_gc;
WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
// Slow case: Just copy the content one-by-one.
result->set_length(len);
for (int i = 0; i < len; i++) result->set(i, src->get(i), mode);
return result;
}
......
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