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