| Index: src/objects-inl.h
|
| diff --git a/src/objects-inl.h b/src/objects-inl.h
|
| index 9e9bd591b112a3cee24c911cc8ec50bca0f21ec1..05155441d2db023f69ba787a9ef336197fbb87cc 100644
|
| --- a/src/objects-inl.h
|
| +++ b/src/objects-inl.h
|
| @@ -1949,22 +1949,42 @@ void PropertyCell::set_type_raw(Object* val, WriteBarrierMode ignored) {
|
| }
|
|
|
|
|
| -Object* WeakCell::value() const { return READ_FIELD(this, kValueOffset); }
|
| +Object* WeakCell::value(Heap* heap) {
|
| + Object* pointer = READ_FIELD(this, kValueOffsetDontForgetTheReadBarrier);
|
| + NOBARRIER_WRITE_FIELD(this, kMapOffset, GetHeap()->used_weak_cell_map());
|
| + return pointer;
|
| +}
|
| +
|
| +
|
| +Object* WeakCell::ValueNoReadBarrier() {
|
| + return READ_FIELD(this, kValueOffsetDontForgetTheReadBarrier);
|
| +}
|
| +
|
| +
|
| +void WeakCell::TriggerReadBarrier(Object* possible_weak_cell) {
|
| + if (possible_weak_cell->IsWeakCell()) {
|
| + WeakCell* weak_cell = reinterpret_cast<WeakCell*>(possible_weak_cell);
|
| + weak_cell->value(weak_cell->GetHeap());
|
| + }
|
| +}
|
|
|
|
|
| void WeakCell::clear() {
|
| DCHECK(GetHeap()->gc_state() == Heap::MARK_COMPACT);
|
| - WRITE_FIELD(this, kValueOffset, Smi::FromInt(0));
|
| + WRITE_FIELD(this, kValueOffsetDontForgetTheReadBarrier, Smi::FromInt(0));
|
| }
|
|
|
|
|
| void WeakCell::initialize(HeapObject* val) {
|
| - WRITE_FIELD(this, kValueOffset, val);
|
| - WRITE_BARRIER(GetHeap(), this, kValueOffset, val);
|
| + WRITE_FIELD(this, kValueOffsetDontForgetTheReadBarrier, val);
|
| + WRITE_BARRIER(GetHeap(), this, kValueOffsetDontForgetTheReadBarrier, val);
|
| }
|
|
|
|
|
| -bool WeakCell::cleared() const { return value() == Smi::FromInt(0); }
|
| +bool WeakCell::cleared() const {
|
| + Object* pointer = READ_FIELD(this, kValueOffsetDontForgetTheReadBarrier);
|
| + return pointer == Smi::FromInt(0);
|
| +}
|
|
|
|
|
| Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); }
|
| @@ -2368,16 +2388,26 @@ void FixedDoubleArray::FillWithHoles(int from, int to) {
|
| }
|
|
|
|
|
| -Object* WeakFixedArray::Get(int index) const {
|
| +Object* WeakFixedArray::Get(Heap* heap, int index) const {
|
| Object* raw = FixedArray::cast(this)->get(index + kFirstIndex);
|
| if (raw->IsSmi()) return raw;
|
| - return WeakCell::cast(raw)->value();
|
| + return WeakCell::cast(raw)->value(heap);
|
| +}
|
| +
|
| +
|
| +bool WeakFixedArray::EqualAt(int index, Object* object) const {
|
| + DCHECK(index < Length());
|
| + Object* raw = FixedArray::cast(this)->get(index + kFirstIndex);
|
| + if (raw->IsSmi()) return raw == object;
|
| + return WeakCell::cast(raw)->ValueNoReadBarrier() == object;
|
| }
|
|
|
|
|
| bool WeakFixedArray::IsEmptySlot(int index) const {
|
| DCHECK(index < Length());
|
| - return Get(index)->IsSmi();
|
| + Object* raw = FixedArray::cast(this)->get(index + kFirstIndex);
|
| + if (raw->IsSmi()) return true;
|
| + return WeakCell::cast(raw)->cleared();
|
| }
|
|
|
|
|
| @@ -7605,7 +7635,6 @@ String::SubStringRange::iterator String::SubStringRange::end() {
|
| #undef FIELD_ADDR
|
| #undef FIELD_ADDR_CONST
|
| #undef READ_FIELD
|
| -#undef NOBARRIER_READ_FIELD
|
| #undef WRITE_FIELD
|
| #undef NOBARRIER_WRITE_FIELD
|
| #undef WRITE_BARRIER
|
|
|