Commit 9a29c902 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[csa] Typify and generalize CSA::DescriptorLookup() implementation.

This CL prepares ground for adding CSA implementation of TransitionArray lookup.

Bug: v8:7310
Change-Id: Ie82e4db8f8a0cdb1dd7bbb759fd60ad55855fe72
Reviewed-on: https://chromium-review.googlesource.com/983920
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52298}
parent 93c92003
......@@ -314,7 +314,7 @@ TNode<JSArray> ObjectEntriesValuesBuiltinsAssembler::FastGetOwnValuesOrEntries(
CSA_ASSERT(this, WordEqual(map, LoadMap(object)));
TNode<Uint32T> descriptor_index = TNode<Uint32T>::UncheckedCast(
TruncateIntPtrToInt32(var_descriptor_number.value()));
Node* next_key = DescriptorArrayGetKey(descriptors, descriptor_index);
Node* next_key = GetKey(descriptors, descriptor_index);
// Skip Symbols.
GotoIf(IsSymbol(next_key), &loop_condition);
......@@ -332,8 +332,8 @@ TNode<JSArray> ObjectEntriesValuesBuiltinsAssembler::FastGetOwnValuesOrEntries(
VARIABLE(var_property_value, MachineRepresentation::kTagged,
UndefinedConstant());
Node* descriptor_name_index = DescriptorArrayToKeyIndex(
TruncateIntPtrToInt32(var_descriptor_number.value()));
TNode<IntPtrT> descriptor_name_index = ToKeyIndex<DescriptorArray>(
Unsigned(TruncateIntPtrToInt32(var_descriptor_number.value())));
// Let value be ? Get(O, key).
LoadPropertyFromFastObject(object, map, descriptors,
......
This diff is collapsed.
......@@ -1706,7 +1706,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
void TryLookupProperty(Node* object, Node* map, Node* instance_type,
Node* unique_name, Label* if_found_fast,
Label* if_found_dict, Label* if_found_global,
Variable* var_meta_storage, Variable* var_name_index,
TVariable<HeapObject>* var_meta_storage,
TVariable<IntPtrT>* var_name_index,
Label* if_not_found, Label* if_bailout);
// This method jumps to if_found if the element is known to exist. To
......@@ -2010,22 +2011,44 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
void PerformStackCheck(Node* context);
protected:
void DescriptorLookup(Node* unique_name, Node* descriptors, Node* bitfield3,
Label* if_found, Variable* var_name_index,
// Implements DescriptorArray::Search().
void DescriptorLookup(SloppyTNode<Name> unique_name,
SloppyTNode<DescriptorArray> descriptors,
SloppyTNode<Uint32T> bitfield3, Label* if_found,
TVariable<IntPtrT>* var_name_index,
Label* if_not_found);
void DescriptorLookupLinear(Node* unique_name, Node* descriptors, Node* nof,
Label* if_found, Variable* var_name_index,
Label* if_not_found);
void DescriptorLookupBinary(Node* unique_name, Node* descriptors, Node* nof,
Label* if_found, Variable* var_name_index,
Label* if_not_found);
Node* DescriptorNumberToIndex(SloppyTNode<Uint32T> descriptor_number);
// Implements DescriptorArray::ToKeyIndex.
// Returns an untagged IntPtr.
Node* DescriptorArrayToKeyIndex(Node* descriptor_number);
// Implements DescriptorArray::GetKey.
Node* DescriptorArrayGetKey(Node* descriptors, Node* descriptor_number);
// Implements DescriptorArray::GetKey.
// Implements generic search procedure like i::Search<Array>().
template <typename Array>
void Lookup(TNode<Name> unique_name, TNode<Array> array,
TNode<Uint32T> number_of_valid_entries, Label* if_found,
TVariable<IntPtrT>* var_name_index, Label* if_not_found);
// Implements generic linear search procedure like i::LinearSearch<Array>().
template <typename Array>
void LookupLinear(TNode<Name> unique_name, TNode<Array> array,
TNode<Uint32T> number_of_valid_entries, Label* if_found,
TVariable<IntPtrT>* var_name_index, Label* if_not_found);
// Implements generic binary search procedure like i::BinarySearch<Array>().
template <typename Array>
void LookupBinary(TNode<Name> unique_name, TNode<Array> array,
TNode<Uint32T> number_of_valid_entries, Label* if_found,
TVariable<IntPtrT>* var_name_index, Label* if_not_found);
// Converts [Descriptor/Transition]Array entry number to a fixed array index.
template <typename Array>
TNode<IntPtrT> EntryIndexToIndex(TNode<Uint32T> entry_index);
// Implements [Descriptor/Transition]Array::ToKeyIndex.
template <typename Array>
TNode<IntPtrT> ToKeyIndex(TNode<Uint32T> entry_index);
// Implements [Descriptor/Transition]Array::GetKey.
template <typename Array>
TNode<Name> GetKey(TNode<Array> array, TNode<Uint32T> entry_index);
// Implements DescriptorArray::GetDetails.
TNode<Uint32T> DescriptorArrayGetDetails(TNode<DescriptorArray> descriptors,
TNode<Uint32T> descriptor_number);
......@@ -2079,13 +2102,14 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Node* SelectImpl(TNode<BoolT> condition, const NodeGenerator& true_body,
const NodeGenerator& false_body, MachineRepresentation rep);
// Implements DescriptorArray::number_of_entries.
// Returns an untagged int32.
Node* DescriptorArrayNumberOfEntries(Node* descriptors);
// Implements DescriptorArray::GetSortedKeyIndex.
// Returns an untagged int32.
Node* DescriptorArrayGetSortedKeyIndex(Node* descriptors,
Node* descriptor_number);
// Implements [Descriptor/Transition]Array::number_of_entries.
template <typename Array>
TNode<Uint32T> NumberOfEntries(TNode<Array> array);
// Implements [Descriptor/Transition]Array::GetSortedKeyIndex.
template <typename Array>
TNode<Uint32T> GetSortedKeyIndex(TNode<Array> descriptors,
TNode<Uint32T> entry_index);
Node* CollectFeedbackForString(Node* instance_type);
void GenerateEqual_Same(Node* value, Label* if_equal, Label* if_notequal,
......
......@@ -2060,7 +2060,7 @@ void AccessorAssembler::GenericPropertyLoad(Node* receiver, Node* receiver_map,
Node* descriptors = LoadMapDescriptors(receiver_map);
Label if_descriptor_found(this), stub_cache(this);
VARIABLE(var_name_index, MachineType::PointerRepresentation());
TVARIABLE(IntPtrT, var_name_index);
Label* notfound =
use_stub_cache == kUseStubCache ? &stub_cache : &lookup_prototype_chain;
DescriptorLookup(p->name, descriptors, bitfield3, &if_descriptor_found,
......
......@@ -541,8 +541,8 @@ void KeyedStoreGenericAssembler::LookupPropertyOnPrototypeChain(
Label next_proto(this);
{
Label found(this), found_fast(this), found_dict(this), found_global(this);
VARIABLE(var_meta_storage, MachineRepresentation::kTagged);
VARIABLE(var_entry, MachineType::PointerRepresentation());
TVARIABLE(HeapObject, var_meta_storage);
TVARIABLE(IntPtrT, var_entry);
TryLookupProperty(holder, holder_map, instance_type, name, &found_fast,
&found_dict, &found_global, &var_meta_storage,
&var_entry, &next_proto, bailout);
......@@ -626,7 +626,7 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore(
Comment("fast property store");
Node* descriptors = LoadMapDescriptors(receiver_map);
Label descriptor_found(this), lookup_transition(this);
VARIABLE(var_name_index, MachineType::PointerRepresentation());
TVARIABLE(IntPtrT, var_name_index);
Label* notfound = use_stub_cache == kUseStubCache ? &stub_cache : slow;
DescriptorLookup(p->name, descriptors, bitfield3, &descriptor_found,
&var_name_index, &lookup_transition);
......
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