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

[heap, runtime] Avoid redundant clearing of slots in a trimmed array.

The slots outside the trimmed array will be cleared by the sweeper and
will not be overwritten with an untagged value.

BUG=chromium:694255

Change-Id: I3e814b9934ca95a09e883e237687434e6bb58c80
Reviewed-on: https://chromium-review.googlesource.com/591651Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46998}
parent 2f897f56
......@@ -3404,7 +3404,8 @@ FixedArrayBase* Heap::LeftTrimFixedArray(FixedArrayBase* object,
// Technically in new space this write might be omitted (except for
// debug mode which iterates through the heap), but to play safer
// we still do it.
CreateFillerObjectAt(old_start, bytes_to_trim, ClearRecordedSlots::kYes);
// Recorded slots will be cleared by the sweeper.
CreateFillerObjectAt(old_start, bytes_to_trim, ClearRecordedSlots::kNo);
// Initialize header of the trimmed array. Since left trimming is only
// performed on pages which are not concurrently swept creating a filler
......@@ -3473,8 +3474,9 @@ void Heap::RightTrimFixedArray(FixedArrayBase* object, int elements_to_trim) {
// TODO(hpayer): We should shrink the large object page if the size
// of the object changed significantly.
if (!lo_space()->Contains(object)) {
// Recorded slots will be cleared by the sweeper.
HeapObject* filler =
CreateFillerObjectAt(new_end, bytes_to_trim, ClearRecordedSlots::kYes);
CreateFillerObjectAt(new_end, bytes_to_trim, ClearRecordedSlots::kNo);
DCHECK_NOT_NULL(filler);
// Clear the mark bits of the black area that belongs now to the filler.
// This is an optimization. The sweeper will release black fillers anyway.
......
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