OLD | NEW |
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 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 this == GetHeap()->empty_weak_cell()); | 1988 this == GetHeap()->empty_weak_cell()); |
1989 WRITE_FIELD(this, kValueOffset, Smi::FromInt(0)); | 1989 WRITE_FIELD(this, kValueOffset, Smi::FromInt(0)); |
1990 } | 1990 } |
1991 | 1991 |
1992 | 1992 |
1993 void WeakCell::initialize(HeapObject* val) { | 1993 void WeakCell::initialize(HeapObject* val) { |
1994 WRITE_FIELD(this, kValueOffset, val); | 1994 WRITE_FIELD(this, kValueOffset, val); |
1995 // We just have to execute the generational barrier here because we never | 1995 // We just have to execute the generational barrier here because we never |
1996 // mark through a weak cell and collect evacuation candidates when we process | 1996 // mark through a weak cell and collect evacuation candidates when we process |
1997 // all weak cells. | 1997 // all weak cells. |
1998 WriteBarrierMode mode = | 1998 WriteBarrierMode mode = Marking::IsBlack(ObjectMarking::MarkBitFrom(this)) |
1999 Page::FromAddress(this->address())->IsFlagSet(Page::BLACK_PAGE) | 1999 ? UPDATE_WRITE_BARRIER |
2000 ? UPDATE_WRITE_BARRIER | 2000 : UPDATE_WEAK_WRITE_BARRIER; |
2001 : UPDATE_WEAK_WRITE_BARRIER; | |
2002 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kValueOffset, val, mode); | 2001 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kValueOffset, val, mode); |
2003 } | 2002 } |
2004 | 2003 |
2005 | 2004 |
2006 bool WeakCell::cleared() const { return value() == Smi::FromInt(0); } | 2005 bool WeakCell::cleared() const { return value() == Smi::FromInt(0); } |
2007 | 2006 |
2008 | 2007 |
2009 Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); } | 2008 Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); } |
2010 | 2009 |
2011 | 2010 |
(...skipping 6114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8126 #undef WRITE_INT64_FIELD | 8125 #undef WRITE_INT64_FIELD |
8127 #undef READ_BYTE_FIELD | 8126 #undef READ_BYTE_FIELD |
8128 #undef WRITE_BYTE_FIELD | 8127 #undef WRITE_BYTE_FIELD |
8129 #undef NOBARRIER_READ_BYTE_FIELD | 8128 #undef NOBARRIER_READ_BYTE_FIELD |
8130 #undef NOBARRIER_WRITE_BYTE_FIELD | 8129 #undef NOBARRIER_WRITE_BYTE_FIELD |
8131 | 8130 |
8132 } // namespace internal | 8131 } // namespace internal |
8133 } // namespace v8 | 8132 } // namespace v8 |
8134 | 8133 |
8135 #endif // V8_OBJECTS_INL_H_ | 8134 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |