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

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 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 // Either the garbage collector is clearing the cell or we are simply 2027 // Either the garbage collector is clearing the cell or we are simply
2028 // initializing the root empty weak cell. 2028 // initializing the root empty weak cell.
2029 DCHECK(GetHeap()->gc_state() == Heap::MARK_COMPACT || 2029 DCHECK(GetHeap()->gc_state() == Heap::MARK_COMPACT ||
2030 this == GetHeap()->empty_weak_cell()); 2030 this == GetHeap()->empty_weak_cell());
2031 WRITE_FIELD(this, kValueOffset, Smi::FromInt(0)); 2031 WRITE_FIELD(this, kValueOffset, Smi::FromInt(0));
2032 } 2032 }
2033 2033
2034 2034
2035 void WeakCell::initialize(HeapObject* val) { 2035 void WeakCell::initialize(HeapObject* val) {
2036 WRITE_FIELD(this, kValueOffset, val); 2036 WRITE_FIELD(this, kValueOffset, val);
2037 Heap* heap = GetHeap();
2038 // We just have to execute the generational barrier here because we never 2037 // We just have to execute the generational barrier here because we never
2039 // mark through a weak cell and collect evacuation candidates when we process 2038 // mark through a weak cell and collect evacuation candidates when we process
2040 // all weak cells. 2039 // all weak cells.
2041 heap->RecordWrite(this, kValueOffset, val); 2040 WriteBarrierMode mode =
2041 Page::FromAddress(this->address())->IsFlagSet(Page::BLACK_PAGE)
2042 ? UPDATE_WRITE_BARRIER
2043 : UPDATE_WEAK_WRITE_BARRIER;
2044 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kValueOffset, val, mode);
2042 } 2045 }
2043 2046
2044 2047
2045 bool WeakCell::cleared() const { return value() == Smi::FromInt(0); } 2048 bool WeakCell::cleared() const { return value() == Smi::FromInt(0); }
2046 2049
2047 2050
2048 Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); } 2051 Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); }
2049 2052
2050 2053
2051 void WeakCell::set_next(Object* val, WriteBarrierMode mode) { 2054 void WeakCell::set_next(Object* val, WriteBarrierMode mode) {
(...skipping 5786 matching lines...) Expand 10 before | Expand all | Expand 10 after
7838 #undef WRITE_INT64_FIELD 7841 #undef WRITE_INT64_FIELD
7839 #undef READ_BYTE_FIELD 7842 #undef READ_BYTE_FIELD
7840 #undef WRITE_BYTE_FIELD 7843 #undef WRITE_BYTE_FIELD
7841 #undef NOBARRIER_READ_BYTE_FIELD 7844 #undef NOBARRIER_READ_BYTE_FIELD
7842 #undef NOBARRIER_WRITE_BYTE_FIELD 7845 #undef NOBARRIER_WRITE_BYTE_FIELD
7843 7846
7844 } // namespace internal 7847 } // namespace internal
7845 } // namespace v8 7848 } // namespace v8
7846 7849
7847 #endif // V8_OBJECTS_INL_H_ 7850 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/heap/heap.cc ('K') | « src/objects.cc ('k') | src/snapshot/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698