| Index: src/elements.cc
|
| diff --git a/src/elements.cc b/src/elements.cc
|
| index 3949747c62ebed39506e88b5699400534e35d7e7..8318d290f3603d4a81307fb38f66e7bcd41c2204 100644
|
| --- a/src/elements.cc
|
| +++ b/src/elements.cc
|
| @@ -1003,11 +1003,15 @@ class FastElementsAccessor
|
| if (length == 0) {
|
| array->initialize_elements();
|
| } else {
|
| - backing_store->set_length(length);
|
| + int filler_size = (old_capacity - length) * ElementSize;
|
| Address filler_start = backing_store->address() +
|
| BackingStore::OffsetOfElementAt(length);
|
| - int filler_size = (old_capacity - length) * ElementSize;
|
| array->GetHeap()->CreateFillerObjectAt(filler_start, filler_size);
|
| +
|
| + // We are storing the new length using release store after creating a
|
| + // filler for the left-over space to avoid races with the sweeper
|
| + // thread.
|
| + backing_store->synchronized_set_length(length);
|
| }
|
| } else {
|
| // Otherwise, fill the unused tail with holes.
|
|
|