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