Commit 9ddd819f authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[runtime] Refactor dictionary mode checks

Check the receiver_map for the dictionary mode bit instead of
comparing the properties map against the HashTableMap.

Bug: 
Change-Id: Iebf3118f00fd0afc8f7f13e88f373282c099f682
Reviewed-on: https://chromium-review.googlesource.com/578324
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46775}
parent 1f234d27
......@@ -245,16 +245,15 @@ TF_BUILTIN(DeleteProperty, DeletePropertyBaseAssembler) {
CheckForAssociatedProtector(unique, &slow);
Label dictionary(this), dont_delete(this);
Node* properties = LoadProperties(receiver);
Node* properties_map = LoadMap(properties);
GotoIf(WordEqual(properties_map, LoadRoot(Heap::kHashTableMapRootIndex)),
&dictionary);
GotoIf(IsDictionaryMap(receiver_map), &dictionary);
// Fast properties need to clear recorded slots, which can only be done
// in C++.
Goto(&slow);
BIND(&dictionary);
{
Node* properties = LoadProperties(receiver);
DeleteDictionaryProperty(receiver, properties, unique, context,
&dont_delete, &if_notfound);
}
......
......@@ -1482,14 +1482,11 @@ void AccessorAssembler::GenericPropertyLoad(Node* receiver, Node* receiver_map,
slow);
// Check if the receiver has fast or slow properties.
Node* properties = LoadProperties(receiver);
Node* properties_map = LoadMap(properties);
GotoIf(WordEqual(properties_map, LoadRoot(Heap::kHashTableMapRootIndex)),
&if_property_dictionary);
Node* bitfield3 = LoadMapBitField3(receiver_map);
GotoIf(IsSetWord32<Map::DictionaryMap>(bitfield3), &if_property_dictionary);
// Try looking up the property on the receiver; if unsuccessful, look
// for a handler in the stub cache.
Node* bitfield3 = LoadMapBitField3(receiver_map);
Node* descriptors = LoadMapDescriptors(receiver_map);
Label if_descriptor_found(this), stub_cache(this);
......@@ -1538,6 +1535,7 @@ void AccessorAssembler::GenericPropertyLoad(Node* receiver, Node* receiver_map,
VARIABLE(var_name_index, MachineType::PointerRepresentation());
Label dictionary_found(this, &var_name_index);
Node* properties = LoadProperties(receiver);
NameDictionaryLookup<NameDictionary>(properties, p->name, &dictionary_found,
&var_name_index,
&lookup_prototype_chain);
......
......@@ -753,15 +753,13 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore(
VARIABLE(var_accessor_holder, MachineRepresentation::kTagged);
Label stub_cache(this), fast_properties(this), dictionary_properties(this),
accessor(this), readonly(this);
Node* properties = LoadProperties(receiver);
Node* properties_map = LoadMap(properties);
Branch(WordEqual(properties_map, LoadRoot(Heap::kHashTableMapRootIndex)),
&dictionary_properties, &fast_properties);
Node* bitfield3 = LoadMapBitField3(receiver_map);
Branch(IsSetWord32<Map::DictionaryMap>(bitfield3), &dictionary_properties,
&fast_properties);
BIND(&fast_properties);
{
Comment("fast property store");
Node* bitfield3 = LoadMapBitField3(receiver_map);
Node* descriptors = LoadMapDescriptors(receiver_map);
Label descriptor_found(this);
VARIABLE(var_name_index, MachineType::PointerRepresentation());
......@@ -789,6 +787,7 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore(
BIND(&data_property);
{
CheckForAssociatedProtector(p->name, slow);
Node* properties = LoadProperties(receiver);
OverwriteExistingFastProperty(receiver, receiver_map, properties,
descriptors, name_index, details,
p->value, slow);
......@@ -805,6 +804,7 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore(
VARIABLE(var_name_index, MachineType::PointerRepresentation());
Label dictionary_found(this, &var_name_index), not_found(this);
Node* properties = LoadProperties(receiver);
NameDictionaryLookup<NameDictionary>(properties, p->name, &dictionary_found,
&var_name_index, &not_found);
BIND(&dictionary_found);
......
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