Chromium Code Reviews| Index: src/objects-inl.h |
| diff --git a/src/objects-inl.h b/src/objects-inl.h |
| index 3477def2422ac1fd89d6a3a852522f6d04bd268a..b9b1a5a7dfff648520d93b12139fb4f2ce5486b6 100644 |
| --- a/src/objects-inl.h |
| +++ b/src/objects-inl.h |
| @@ -1928,6 +1928,7 @@ void Oddball::set_kind(byte value) { |
| ACCESSORS(Cell, value, Object, kValueOffset) |
| ACCESSORS(PropertyCell, dependent_code, DependentCode, kDependentCodeOffset) |
| +ACCESSORS(PropertyCell, property_details_raw, Object, kDetailsOffset) |
| ACCESSORS(PropertyCell, value, Object, kValueOffset) |
| Object* WeakCell::value() const { return READ_FIELD(this, kValueOffset); } |
| @@ -7122,7 +7123,7 @@ template<typename Derived, typename Shape, typename Key> |
| void Dictionary<Derived, Shape, Key>::SetEntry(int entry, |
| Handle<Object> key, |
| Handle<Object> value) { |
| - SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); |
| + this->SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); |
| } |
| @@ -7131,13 +7132,40 @@ void Dictionary<Derived, Shape, Key>::SetEntry(int entry, |
| Handle<Object> key, |
| Handle<Object> value, |
| PropertyDetails details) { |
| + Shape::SetEntry(static_cast<Derived*>(this), entry, key, value, details); |
| +} |
| + |
| + |
| +template <typename Key> |
| +template <typename Dictionary> |
| +void BaseDictionaryShape<Key>::SetEntry(Dictionary* dict, int entry, |
| + Handle<Object> key, |
| + Handle<Object> value, |
| + PropertyDetails details) { |
| + STATIC_ASSERT(Dictionary::kEntrySize == 3); |
| + DCHECK(!key->IsName() || details.dictionary_index() > 0); |
| + int index = dict->EntryToIndex(entry); |
| + DisallowHeapAllocation no_gc; |
| + WriteBarrierMode mode = dict->GetWriteBarrierMode(no_gc); |
| + dict->set(index, *key, mode); |
| + dict->set(index + 1, *value, mode); |
| + dict->set(index + 2, details.AsSmi()); |
| +} |
| + |
| + |
| +template <typename Dictionary> |
| +void GlobalDictionaryShape::SetEntry(Dictionary* dict, int entry, |
| + Handle<Object> key, Handle<Object> value, |
| + PropertyDetails details) { |
| + STATIC_ASSERT(Dictionary::kEntrySize == 2); |
| DCHECK(!key->IsName() || details.dictionary_index() > 0); |
| - int index = DerivedHashTable::EntryToIndex(entry); |
| + DCHECK(value->IsPropertyCell()); |
| + int index = dict->EntryToIndex(entry); |
| DisallowHeapAllocation no_gc; |
| - WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc); |
| - FixedArray::set(index, *key, mode); |
| - FixedArray::set(index+1, *value, mode); |
| - FixedArray::set(index+2, details.AsSmi()); |
| + WriteBarrierMode mode = dict->GetWriteBarrierMode(no_gc); |
| + dict->set(index, *key, mode); |
| + dict->set(index + 1, *value, mode); |
| + PropertyCell::cast(*value)->set_property_details(details); |
| } |
| @@ -7209,6 +7237,27 @@ Handle<FixedArray> NameDictionary::DoGenerateNewEnumerationIndices( |
| template <typename Dictionary> |
| +PropertyDetails GlobalDictionaryShape::DetailsAt(Dictionary* dict, int entry) { |
| + DCHECK(entry >= 0); // Not found is -1, which is not caught by get(). |
| + Object* raw_value = dict->ValueAt(entry); |
| + CHECK(raw_value->IsPropertyCell()); |
|
Jakob Kummerow
2015/06/02 07:18:09
Do we need to keep this CHECK forever? Maybe add a
Igor Sheludko
2015/06/02 09:57:14
Done.
|
| + PropertyCell* cell = PropertyCell::cast(raw_value); |
| + return cell->property_details(); |
| +} |
| + |
| + |
| +template <typename Dictionary> |
| +void GlobalDictionaryShape::DetailsAtPut(Dictionary* dict, int entry, |
| + PropertyDetails value) { |
| + DCHECK(entry >= 0); // Not found is -1, which is not caught by get(). |
| + Object* raw_value = dict->ValueAt(entry); |
| + CHECK(raw_value->IsPropertyCell()); |
| + PropertyCell* cell = PropertyCell::cast(raw_value); |
| + cell->set_property_details(value); |
| +} |
| + |
| + |
| +template <typename Dictionary> |
| bool GlobalDictionaryShape::IsDeleted(Dictionary* dict, int entry) { |
| DCHECK(dict->ValueAt(entry)->IsPropertyCell()); |
| return PropertyCell::cast(dict->ValueAt(entry))->value()->IsTheHole(); |