Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: src/heap/heap.cc

Issue 2906313002: [heap] Fix a missing write barrier in Heap::Allocate. (Closed)
Patch Set: fix test Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/heap/heap-tester.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « no previous file | test/cctest/heap/heap-tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698