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

Side by Side Diff: src/heap/heap.cc

Issue 2906313002: [heap] Fix a missing write barrier in Heap::Allocate. (Closed)
Patch Set: fix test Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/heap/heap-tester.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/heap/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include <unordered_map> 7 #include <unordered_map>
8 #include <unordered_set> 8 #include <unordered_set>
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 3463 matching lines...) Expand 10 before | Expand all | Expand 10 after
3474 AllocationSite* allocation_site) { 3474 AllocationSite* allocation_site) {
3475 DCHECK(gc_state_ == NOT_IN_GC); 3475 DCHECK(gc_state_ == NOT_IN_GC);
3476 DCHECK(map->instance_type() != MAP_TYPE); 3476 DCHECK(map->instance_type() != MAP_TYPE);
3477 int size = map->instance_size(); 3477 int size = map->instance_size();
3478 if (allocation_site != NULL) { 3478 if (allocation_site != NULL) {
3479 size += AllocationMemento::kSize; 3479 size += AllocationMemento::kSize;
3480 } 3480 }
3481 HeapObject* result = nullptr; 3481 HeapObject* result = nullptr;
3482 AllocationResult allocation = AllocateRaw(size, space); 3482 AllocationResult allocation = AllocateRaw(size, space);
3483 if (!allocation.To(&result)) return allocation; 3483 if (!allocation.To(&result)) return allocation;
3484 // No need for write barrier since object is white and map is in old space. 3484 // New space objects are allocated white.
3485 result->set_map_after_allocation(map, SKIP_WRITE_BARRIER); 3485 WriteBarrierMode write_barrier_mode =
3486 space == NEW_SPACE ? SKIP_WRITE_BARRIER : UPDATE_WRITE_BARRIER;
3487 result->set_map_after_allocation(map, write_barrier_mode);
3486 if (allocation_site != NULL) { 3488 if (allocation_site != NULL) {
3487 AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>( 3489 AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>(
3488 reinterpret_cast<Address>(result) + map->instance_size()); 3490 reinterpret_cast<Address>(result) + map->instance_size());
3489 InitializeAllocationMemento(alloc_memento, allocation_site); 3491 InitializeAllocationMemento(alloc_memento, allocation_site);
3490 } 3492 }
3491 return result; 3493 return result;
3492 } 3494 }
3493 3495
3494 3496
3495 void Heap::InitializeJSObjectFromMap(JSObject* obj, FixedArray* properties, 3497 void Heap::InitializeJSObjectFromMap(JSObject* obj, FixedArray* properties,
(...skipping 3076 matching lines...) Expand 10 before | Expand all | Expand 10 after
6572 case LO_SPACE: 6574 case LO_SPACE:
6573 return "LO_SPACE"; 6575 return "LO_SPACE";
6574 default: 6576 default:
6575 UNREACHABLE(); 6577 UNREACHABLE();
6576 } 6578 }
6577 return NULL; 6579 return NULL;
6578 } 6580 }
6579 6581
6580 } // namespace internal 6582 } // namespace internal
6581 } // namespace v8 6583 } // namespace v8
OLDNEW
« 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