Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index b9f633a43990dc6fef572677f5cdca8a7bb718c8..e9d179a2d6a01c084417992d0d310752c2b5c0b2 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -3481,8 +3481,10 @@ AllocationResult Heap::Allocate(Map* map, AllocationSpace space, |
HeapObject* result = nullptr; |
AllocationResult allocation = AllocateRaw(size, space); |
if (!allocation.To(&result)) return allocation; |
- // No need for write barrier since object is white and map is in old space. |
- result->set_map_after_allocation(map, SKIP_WRITE_BARRIER); |
+ // New space objects are allocated white. |
+ WriteBarrierMode write_barrier_mode = |
+ space == NEW_SPACE ? SKIP_WRITE_BARRIER : UPDATE_WRITE_BARRIER; |
+ result->set_map_after_allocation(map, write_barrier_mode); |
if (allocation_site != NULL) { |
AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>( |
reinterpret_cast<Address>(result) + map->instance_size()); |