Commit ae00aa9e authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[cleanup][CSA] TNodify methods regarding loads from dictionaries

TNodified:
 * LoadValueByKeyIndex
 * LoadPropertyFromGlobalDictionary
 * LoadDetailsByKeyIndex

Bug: v8:10021
Change-Id: Ie992982d0b03962658f4ef30351f1f84e8ce027e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1995394Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65735}
parent d0650ae1
...@@ -540,8 +540,7 @@ class DeletePropertyBaseAssembler : public AccessorAssembler { ...@@ -540,8 +540,7 @@ class DeletePropertyBaseAssembler : public AccessorAssembler {
BIND(&dictionary_found); BIND(&dictionary_found);
TNode<IntPtrT> key_index = var_name_index.value(); TNode<IntPtrT> key_index = var_name_index.value();
TNode<Uint32T> details = TNode<Uint32T> details = LoadDetailsByKeyIndex(properties, key_index);
LoadDetailsByKeyIndex<NameDictionary>(properties, key_index);
GotoIf(IsSetWord32(details, PropertyDetails::kAttributesDontDeleteMask), GotoIf(IsSetWord32(details, PropertyDetails::kAttributesDontDeleteMask),
dont_delete); dont_delete);
// Overwrite the entry itself (see NameDictionary::SetEntry). // Overwrite the entry itself (see NameDictionary::SetEntry).
......
...@@ -7787,13 +7787,12 @@ TNode<Object> CodeStubAssembler::BasicLoadNumberDictionaryElement( ...@@ -7787,13 +7787,12 @@ TNode<Object> CodeStubAssembler::BasicLoadNumberDictionaryElement(
// Check that the value is a data property. // Check that the value is a data property.
TNode<IntPtrT> index = EntryToIndex<NumberDictionary>(var_entry.value()); TNode<IntPtrT> index = EntryToIndex<NumberDictionary>(var_entry.value());
TNode<Uint32T> details = TNode<Uint32T> details = LoadDetailsByKeyIndex(dictionary, index);
LoadDetailsByKeyIndex<NumberDictionary>(dictionary, index);
TNode<Uint32T> kind = DecodeWord32<PropertyDetails::KindField>(details); TNode<Uint32T> kind = DecodeWord32<PropertyDetails::KindField>(details);
// TODO(jkummerow): Support accessors without missing? // TODO(jkummerow): Support accessors without missing?
GotoIfNot(Word32Equal(kind, Int32Constant(kData)), not_data); GotoIfNot(Word32Equal(kind, Int32Constant(kData)), not_data);
// Finally, load the value. // Finally, load the value.
return LoadValueByKeyIndex<NumberDictionary>(dictionary, index); return LoadValueByKeyIndex(dictionary, index);
} }
template <class Dictionary> template <class Dictionary>
...@@ -8210,8 +8209,7 @@ void CodeStubAssembler::ForEachEnumerableOwnProperty( ...@@ -8210,8 +8209,7 @@ void CodeStubAssembler::ForEachEnumerableOwnProperty(
TNode<NameDictionary> dictionary = CAST(var_meta_storage.value()); TNode<NameDictionary> dictionary = CAST(var_meta_storage.value());
TNode<IntPtrT> entry = var_entry.value(); TNode<IntPtrT> entry = var_entry.value();
TNode<Uint32T> details = TNode<Uint32T> details = LoadDetailsByKeyIndex(dictionary, entry);
LoadDetailsByKeyIndex<NameDictionary>(dictionary, entry);
// Skip non-enumerable properties. // Skip non-enumerable properties.
GotoIf( GotoIf(
IsSetWord32(details, PropertyDetails::kAttributesDontEnumMask), IsSetWord32(details, PropertyDetails::kAttributesDontEnumMask),
...@@ -8607,16 +8605,12 @@ void CodeStubAssembler::LoadPropertyFromFastObject( ...@@ -8607,16 +8605,12 @@ void CodeStubAssembler::LoadPropertyFromFastObject(
Comment("] LoadPropertyFromFastObject"); Comment("] LoadPropertyFromFastObject");
} }
void CodeStubAssembler::LoadPropertyFromNameDictionary(Node* dictionary, void CodeStubAssembler::LoadPropertyFromNameDictionary(
Node* name_index, TNode<NameDictionary> dictionary, TNode<IntPtrT> name_index,
Variable* var_details, TVariable<Uint32T>* var_details, TVariable<Object>* var_value) {
Variable* var_value) {
Comment("LoadPropertyFromNameDictionary"); Comment("LoadPropertyFromNameDictionary");
CSA_ASSERT(this, IsNameDictionary(dictionary)); *var_details = LoadDetailsByKeyIndex(dictionary, name_index);
*var_value = LoadValueByKeyIndex(dictionary, name_index);
var_details->Bind(
LoadDetailsByKeyIndex<NameDictionary>(dictionary, name_index));
var_value->Bind(LoadValueByKeyIndex<NameDictionary>(dictionary, name_index));
Comment("] LoadPropertyFromNameDictionary"); Comment("] LoadPropertyFromNameDictionary");
} }
...@@ -8806,7 +8800,7 @@ void CodeStubAssembler::TryGetOwnProperty( ...@@ -8806,7 +8800,7 @@ void CodeStubAssembler::TryGetOwnProperty(
} }
BIND(&if_found_dict); BIND(&if_found_dict);
{ {
TNode<HeapObject> dictionary = var_meta_storage.value(); TNode<NameDictionary> dictionary = CAST(var_meta_storage.value());
TNode<IntPtrT> entry = var_entry.value(); TNode<IntPtrT> entry = var_entry.value();
LoadPropertyFromNameDictionary(dictionary, entry, var_details, var_value); LoadPropertyFromNameDictionary(dictionary, entry, var_details, var_value);
Goto(&if_found); Goto(&if_found);
......
...@@ -2942,26 +2942,28 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -2942,26 +2942,28 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// Loads the details for the entry with the given key_index. // Loads the details for the entry with the given key_index.
// Returns an untagged int32. // Returns an untagged int32.
template <class ContainerType> template <class ContainerType>
TNode<Uint32T> LoadDetailsByKeyIndex(Node* container, Node* key_index) { TNode<Uint32T> LoadDetailsByKeyIndex(TNode<ContainerType> container,
TNode<IntPtrT> key_index) {
static_assert(!std::is_same<ContainerType, DescriptorArray>::value, static_assert(!std::is_same<ContainerType, DescriptorArray>::value,
"Use the non-templatized version for DescriptorArray"); "Use the non-templatized version for DescriptorArray");
const int kKeyToDetailsOffset = const int kKeyToDetailsOffset =
(ContainerType::kEntryDetailsIndex - ContainerType::kEntryKeyIndex) * (ContainerType::kEntryDetailsIndex - ContainerType::kEntryKeyIndex) *
kTaggedSize; kTaggedSize;
return Unsigned(LoadAndUntagToWord32FixedArrayElement( return Unsigned(LoadAndUntagToWord32FixedArrayElement(container, key_index,
CAST(container), key_index, kKeyToDetailsOffset)); kKeyToDetailsOffset));
} }
// Loads the value for the entry with the given key_index. // Loads the value for the entry with the given key_index.
// Returns a tagged value. // Returns a tagged value.
template <class ContainerType> template <class ContainerType>
TNode<Object> LoadValueByKeyIndex(Node* container, Node* key_index) { TNode<Object> LoadValueByKeyIndex(TNode<ContainerType> container,
TNode<IntPtrT> key_index) {
static_assert(!std::is_same<ContainerType, DescriptorArray>::value, static_assert(!std::is_same<ContainerType, DescriptorArray>::value,
"Use the non-templatized version for DescriptorArray"); "Use the non-templatized version for DescriptorArray");
const int kKeyToValueOffset = const int kKeyToValueOffset =
(ContainerType::kEntryValueIndex - ContainerType::kEntryKeyIndex) * (ContainerType::kEntryValueIndex - ContainerType::kEntryKeyIndex) *
kTaggedSize; kTaggedSize;
return LoadFixedArrayElement(CAST(container), key_index, kKeyToValueOffset); return LoadFixedArrayElement(container, key_index, kKeyToValueOffset);
} }
// Stores the details for the entry with the given key_index. // Stores the details for the entry with the given key_index.
...@@ -3163,9 +3165,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -3163,9 +3165,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<IntPtrT> name_index, TNode<Uint32T>, TNode<IntPtrT> name_index, TNode<Uint32T>,
TVariable<Object>* var_value); TVariable<Object>* var_value);
void LoadPropertyFromNameDictionary(Node* dictionary, Node* entry, void LoadPropertyFromNameDictionary(TNode<NameDictionary> dictionary,
Variable* var_details, TNode<IntPtrT> name_index,
Variable* var_value); TVariable<Uint32T>* var_details,
TVariable<Object>* var_value);
void LoadPropertyFromGlobalDictionary(TNode<GlobalDictionary> dictionary, void LoadPropertyFromGlobalDictionary(TNode<GlobalDictionary> dictionary,
TNode<IntPtrT> name_index, TNode<IntPtrT> name_index,
TVariable<Uint32T>* var_details, TVariable<Uint32T>* var_details,
......
...@@ -1051,8 +1051,8 @@ void AccessorAssembler::HandleStoreICHandlerCase( ...@@ -1051,8 +1051,8 @@ void AccessorAssembler::HandleStoreICHandlerCase(
properties, CAST(p->name()), &dictionary_found, &var_name_index, miss); properties, CAST(p->name()), &dictionary_found, &var_name_index, miss);
BIND(&dictionary_found); BIND(&dictionary_found);
{ {
TNode<Uint32T> details = LoadDetailsByKeyIndex<NameDictionary>( TNode<Uint32T> details =
properties, var_name_index.value()); LoadDetailsByKeyIndex(properties, var_name_index.value());
// Check that the property is a writable data property (no accessor). // Check that the property is a writable data property (no accessor).
const int kTypeAndReadOnlyMask = PropertyDetails::KindField::kMask | const int kTypeAndReadOnlyMask = PropertyDetails::KindField::kMask |
PropertyDetails::kAttributesReadOnlyMask; PropertyDetails::kAttributesReadOnlyMask;
...@@ -1454,8 +1454,8 @@ void AccessorAssembler::OverwriteExistingFastDataProperty( ...@@ -1454,8 +1454,8 @@ void AccessorAssembler::OverwriteExistingFastDataProperty(
BIND(&if_descriptor); BIND(&if_descriptor);
{ {
// Check that constant matches value. // Check that constant matches value.
TNode<Object> constant = LoadValueByKeyIndex( TNode<Object> constant =
descriptors, UncheckedCast<IntPtrT>(descriptor_name_index)); LoadValueByKeyIndex(descriptors, descriptor_name_index);
GotoIf(TaggedNotEqual(value, constant), slow); GotoIf(TaggedNotEqual(value, constant), slow);
if (do_transitioning_store) { if (do_transitioning_store) {
...@@ -1539,8 +1539,7 @@ void AccessorAssembler::HandleStoreICProtoHandler( ...@@ -1539,8 +1539,7 @@ void AccessorAssembler::HandleStoreICProtoHandler(
p, handler, on_code_handler, p, handler, on_code_handler,
// on_found_on_receiver // on_found_on_receiver
[=](TNode<NameDictionary> properties, TNode<IntPtrT> name_index) { [=](TNode<NameDictionary> properties, TNode<IntPtrT> name_index) {
TNode<Uint32T> details = TNode<Uint32T> details = LoadDetailsByKeyIndex(properties, name_index);
LoadDetailsByKeyIndex<NameDictionary>(properties, name_index);
// Check that the property is a writable data property (no accessor). // Check that the property is a writable data property (no accessor).
const int kTypeAndReadOnlyMask = const int kTypeAndReadOnlyMask =
PropertyDetails::KindField::kMask | PropertyDetails::KindField::kMask |
......
...@@ -638,16 +638,14 @@ void KeyedStoreGenericAssembler::LookupPropertyOnPrototypeChain( ...@@ -638,16 +638,14 @@ void KeyedStoreGenericAssembler::LookupPropertyOnPrototypeChain(
BIND(&found_dict); BIND(&found_dict);
{ {
TNode<HeapObject> dictionary = var_meta_storage.value(); TNode<NameDictionary> dictionary = CAST(var_meta_storage.value());
TNode<IntPtrT> entry = var_entry.value(); TNode<IntPtrT> entry = var_entry.value();
TNode<Uint32T> details = TNode<Uint32T> details = LoadDetailsByKeyIndex(dictionary, entry);
LoadDetailsByKeyIndex<NameDictionary>(dictionary, entry);
JumpIfDataProperty(details, &ok_to_write, readonly); JumpIfDataProperty(details, &ok_to_write, readonly);
if (accessor != nullptr) { if (accessor != nullptr) {
// Accessor case. // Accessor case.
*var_accessor_pair = *var_accessor_pair = LoadValueByKeyIndex(dictionary, entry);
LoadValueByKeyIndex<NameDictionary>(dictionary, entry);
*var_accessor_holder = holder; *var_accessor_holder = holder;
Goto(accessor); Goto(accessor);
} else { } else {
...@@ -657,10 +655,10 @@ void KeyedStoreGenericAssembler::LookupPropertyOnPrototypeChain( ...@@ -657,10 +655,10 @@ void KeyedStoreGenericAssembler::LookupPropertyOnPrototypeChain(
BIND(&found_global); BIND(&found_global);
{ {
TNode<HeapObject> dictionary = var_meta_storage.value(); TNode<GlobalDictionary> dictionary = CAST(var_meta_storage.value());
TNode<IntPtrT> entry = var_entry.value(); TNode<IntPtrT> entry = var_entry.value();
TNode<PropertyCell> property_cell = TNode<PropertyCell> property_cell =
CAST(LoadValueByKeyIndex<GlobalDictionary>(dictionary, entry)); CAST(LoadValueByKeyIndex(dictionary, entry));
TNode<Object> value = TNode<Object> value =
LoadObjectField(property_cell, PropertyCell::kValueOffset); LoadObjectField(property_cell, PropertyCell::kValueOffset);
GotoIf(TaggedEqual(value, TheHoleConstant()), &next_proto); GotoIf(TaggedEqual(value, TheHoleConstant()), &next_proto);
...@@ -841,15 +839,15 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore( ...@@ -841,15 +839,15 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore(
BIND(&dictionary_found); BIND(&dictionary_found);
{ {
Label overwrite(this); Label overwrite(this);
TNode<Uint32T> details = LoadDetailsByKeyIndex<NameDictionary>( TNode<Uint32T> details =
properties, var_name_index.value()); LoadDetailsByKeyIndex(properties, var_name_index.value());
JumpIfDataProperty(details, &overwrite, JumpIfDataProperty(details, &overwrite,
ShouldReconfigureExisting() ? nullptr : &readonly); ShouldReconfigureExisting() ? nullptr : &readonly);
if (ShouldCallSetter()) { if (ShouldCallSetter()) {
// Accessor case. // Accessor case.
var_accessor_pair = LoadValueByKeyIndex<NameDictionary>( var_accessor_pair =
properties, var_name_index.value()); LoadValueByKeyIndex(properties, var_name_index.value());
var_accessor_holder = receiver; var_accessor_holder = receiver;
Goto(&accessor); Goto(&accessor);
} else { } else {
......
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