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

Unified Diff: src/objects-inl.h

Issue 1156993018: GlobalDictionary now stores PropertyDetails in PropertyCells. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 12e30481d8e0723de87c6cfb82f648b1251e0d95..b21c900c1633a646fb6102dcf22d81c96cd46678 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1930,6 +1930,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); }
@@ -7124,7 +7125,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)));
}
@@ -7133,13 +7134,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);
}
@@ -7211,6 +7239,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);
+ DCHECK(raw_value->IsPropertyCell());
+ 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);
+ DCHECK(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();
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698