Commit 4f586850 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran

[dict] Add helper methods to SmallorderedNameDictionary


Bug: v8:6443, v8:7569
Change-Id: Ia7f0550500b19e93d78983db2e20d020bc0ff164
Reviewed-on: https://chromium-review.googlesource.com/c/1329700Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57440}
parent cdfc65ab
......@@ -1613,6 +1613,7 @@ void Foreign::set_foreign_address(Address value) {
template <class Derived>
void SmallOrderedHashTable<Derived>::SetDataEntry(int entry, int relative_index,
Object* value) {
DCHECK_NE(kNotFound, entry);
Address entry_offset = GetDataEntryOffset(entry, relative_index);
RELAXED_WRITE_FIELD(this, entry_offset, value);
WRITE_BARRIER(this, static_cast<int>(entry_offset), value);
......
......@@ -65,7 +65,6 @@ inline PropertyDetails OrderedNameDictionary::DetailsAt(int entry) {
Smi::cast(get(EntryToIndex(entry) + kPropertyDetailsOffset)));
}
// Set the details for entry.
inline void OrderedNameDictionary::DetailsAtPut(int entry,
PropertyDetails value) {
DCHECK_NE(entry, kNotFound);
......@@ -74,6 +73,29 @@ inline void OrderedNameDictionary::DetailsAtPut(int entry,
this->set(EntryToIndex(entry) + kPropertyDetailsOffset, value.AsSmi());
}
inline Object* SmallOrderedNameDictionary::ValueAt(int entry) {
return this->GetDataEntry(entry, kValueIndex);
}
// Set the value for entry.
inline void SmallOrderedNameDictionary::ValueAtPut(int entry, Object* value) {
this->SetDataEntry(entry, kValueIndex, value);
}
// Returns the property details for the property at entry.
inline PropertyDetails SmallOrderedNameDictionary::DetailsAt(int entry) {
// TODO(gsathya): Optimize the cast away. And store this in the data table.
return PropertyDetails(
Smi::cast(this->GetDataEntry(entry, kPropertyDetailsIndex)));
}
// Set the details for entry.
inline void SmallOrderedNameDictionary::DetailsAtPut(int entry,
PropertyDetails value) {
// TODO(gsathya): Optimize the cast away. And store this in the data table.
this->SetDataEntry(entry, kPropertyDetailsIndex, value.AsSmi());
}
inline bool OrderedHashSet::Is(Handle<HeapObject> table) {
return table->IsOrderedHashSet();
}
......
......@@ -613,6 +613,18 @@ class SmallOrderedNameDictionary
DECL_PRINTER(SmallOrderedNameDictionary)
// Returns the value for entry.
inline Object* ValueAt(int entry);
// Set the value for entry.
inline void ValueAtPut(int entry, Object* value);
// Returns the property details for the property at entry.
inline PropertyDetails DetailsAt(int entry);
// Set the details for entry.
inline void DetailsAtPut(int entry, PropertyDetails value);
static const int kKeyIndex = 0;
static const int kValueIndex = 1;
static const int kPropertyDetailsIndex = 2;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment