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 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 | 2022 |
2023 void PropertyCell::set_property_details(PropertyDetails details) { | 2023 void PropertyCell::set_property_details(PropertyDetails details) { |
2024 set_property_details_raw(details.AsSmi()); | 2024 set_property_details_raw(details.AsSmi()); |
2025 } | 2025 } |
2026 | 2026 |
2027 | 2027 |
2028 Object* WeakCell::value() const { return READ_FIELD(this, kValueOffset); } | 2028 Object* WeakCell::value() const { return READ_FIELD(this, kValueOffset); } |
2029 | 2029 |
2030 | 2030 |
2031 void WeakCell::clear() { | 2031 void WeakCell::clear() { |
2032 DCHECK(GetHeap()->gc_state() == Heap::MARK_COMPACT); | 2032 // Either the garbage collector is clearing the cell or we are simply |
| 2033 // initializing the root empty weak cell. |
| 2034 DCHECK(GetHeap()->gc_state() == Heap::MARK_COMPACT || |
| 2035 this == GetHeap()->empty_weak_cell()); |
2033 WRITE_FIELD(this, kValueOffset, Smi::FromInt(0)); | 2036 WRITE_FIELD(this, kValueOffset, Smi::FromInt(0)); |
2034 } | 2037 } |
2035 | 2038 |
2036 | 2039 |
2037 void WeakCell::initialize(HeapObject* val) { | 2040 void WeakCell::initialize(HeapObject* val) { |
2038 WRITE_FIELD(this, kValueOffset, val); | 2041 WRITE_FIELD(this, kValueOffset, val); |
2039 Heap* heap = GetHeap(); | 2042 Heap* heap = GetHeap(); |
2040 // We just have to execute the generational barrier here because we never | 2043 // We just have to execute the generational barrier here because we never |
2041 // mark through a weak cell and collect evacuation candidates when we process | 2044 // mark through a weak cell and collect evacuation candidates when we process |
2042 // all weak cells. | 2045 // all weak cells. |
(...skipping 5820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7863 #undef WRITE_INT64_FIELD | 7866 #undef WRITE_INT64_FIELD |
7864 #undef READ_BYTE_FIELD | 7867 #undef READ_BYTE_FIELD |
7865 #undef WRITE_BYTE_FIELD | 7868 #undef WRITE_BYTE_FIELD |
7866 #undef NOBARRIER_READ_BYTE_FIELD | 7869 #undef NOBARRIER_READ_BYTE_FIELD |
7867 #undef NOBARRIER_WRITE_BYTE_FIELD | 7870 #undef NOBARRIER_WRITE_BYTE_FIELD |
7868 | 7871 |
7869 } // namespace internal | 7872 } // namespace internal |
7870 } // namespace v8 | 7873 } // namespace v8 |
7871 | 7874 |
7872 #endif // V8_OBJECTS_INL_H_ | 7875 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |