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

Side by Side Diff: src/objects-inl.h

Issue 1420423009: [heap] Black allocation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 // Either the garbage collector is clearing the cell or we are simply 2031 // Either the garbage collector is clearing the cell or we are simply
2032 // initializing the root empty weak cell. 2032 // initializing the root empty weak cell.
2033 DCHECK(GetHeap()->gc_state() == Heap::MARK_COMPACT || 2033 DCHECK(GetHeap()->gc_state() == Heap::MARK_COMPACT ||
2034 this == GetHeap()->empty_weak_cell()); 2034 this == GetHeap()->empty_weak_cell());
2035 WRITE_FIELD(this, kValueOffset, Smi::FromInt(0)); 2035 WRITE_FIELD(this, kValueOffset, Smi::FromInt(0));
2036 } 2036 }
2037 2037
2038 2038
2039 void WeakCell::initialize(HeapObject* val) { 2039 void WeakCell::initialize(HeapObject* val) {
2040 WRITE_FIELD(this, kValueOffset, val); 2040 WRITE_FIELD(this, kValueOffset, val);
2041 Heap* heap = GetHeap();
2042 // We just have to execute the generational barrier here because we never 2041 // We just have to execute the generational barrier here because we never
2043 // mark through a weak cell and collect evacuation candidates when we process 2042 // mark through a weak cell and collect evacuation candidates when we process
2044 // all weak cells. 2043 // all weak cells.
2045 if (heap->InNewSpace(val)) { 2044 WriteBarrierMode mode =
2046 heap->RecordWrite(address(), kValueOffset); 2045 Page::FromAddress(this->address())->IsFlagSet(Page::BLACK_PAGE)
2047 } 2046 ? UPDATE_WRITE_BARRIER
ulan 2016/02/10 10:27:39 Invoking the marking visitor of the weak cell migh
Hannes Payer (out of office) 2016/02/11 18:18:07 As discussed offline, this change was done on purp
2047 : UPDATE_WEAK_WRITE_BARRIER;
2048 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kValueOffset, val, mode);
2048 } 2049 }
2049 2050
2050 2051
2051 bool WeakCell::cleared() const { return value() == Smi::FromInt(0); } 2052 bool WeakCell::cleared() const { return value() == Smi::FromInt(0); }
2052 2053
2053 2054
2054 Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); } 2055 Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); }
2055 2056
2056 2057
2057 void WeakCell::set_next(Object* val, WriteBarrierMode mode) { 2058 void WeakCell::set_next(Object* val, WriteBarrierMode mode) {
(...skipping 5781 matching lines...) Expand 10 before | Expand all | Expand 10 after
7839 #undef WRITE_INT64_FIELD 7840 #undef WRITE_INT64_FIELD
7840 #undef READ_BYTE_FIELD 7841 #undef READ_BYTE_FIELD
7841 #undef WRITE_BYTE_FIELD 7842 #undef WRITE_BYTE_FIELD
7842 #undef NOBARRIER_READ_BYTE_FIELD 7843 #undef NOBARRIER_READ_BYTE_FIELD
7843 #undef NOBARRIER_WRITE_BYTE_FIELD 7844 #undef NOBARRIER_WRITE_BYTE_FIELD
7844 7845
7845 } // namespace internal 7846 } // namespace internal
7846 } // namespace v8 7847 } // namespace v8
7847 7848
7848 #endif // V8_OBJECTS_INL_H_ 7849 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/heap/mark-compact.cc ('K') | « src/objects.cc ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698