Commit e21933c1 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[csa] Extract LoadNumberDictionaryElement from AccessorAssembler

This CL extracts code for loading a NumberDictionary element
from "EmitElementLoad" to its own function in the CSA.

This is done in preparation for a fast path in Torque for dictionary
elements.

R=jgruber@chromium.org

Change-Id: I3bb9897910183cd50be127bae771e531a61d57be
Reviewed-on: https://chromium-review.googlesource.com/1090832Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#53586}
parent 8fcd3f8f
......@@ -7272,6 +7272,26 @@ void CodeStubAssembler::NumberDictionaryLookup(
}
}
TNode<Object> CodeStubAssembler::LoadNumberDictionaryElement(
TNode<NumberDictionary> dictionary, TNode<IntPtrT> intptr_index,
Label* not_data, Label* if_hole) {
TVARIABLE(IntPtrT, var_entry);
Label if_found(this);
NumberDictionaryLookup(dictionary, intptr_index, &if_found, &var_entry,
if_hole);
BIND(&if_found);
// 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> kind = DecodeWord32<PropertyDetails::KindField>(details);
// TODO(jkummerow): Support accessors without missing?
GotoIfNot(Word32Equal(kind, Int32Constant(kData)), not_data);
// Finally, load athe value.
return LoadValueByKeyIndex<NumberDictionary>(dictionary, index);
}
template <class Dictionary>
void CodeStubAssembler::FindInsertionEntry(TNode<Dictionary> dictionary,
TNode<Name> key,
......
......@@ -2044,6 +2044,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
TVariable<IntPtrT>* var_entry,
Label* if_not_found);
TNode<Object> LoadNumberDictionaryElement(TNode<NumberDictionary> dictionary,
TNode<IntPtrT> intptr_index,
Label* not_data, Label* if_hole);
template <class Dictionary>
void FindInsertionEntry(TNode<Dictionary> dictionary, TNode<Name> key,
TVariable<IntPtrT>* var_key_index);
......
......@@ -1800,19 +1800,10 @@ void AccessorAssembler::EmitElementLoad(
{
Comment("dictionary elements");
GotoIf(IntPtrLessThan(intptr_index, IntPtrConstant(0)), out_of_bounds);
TVARIABLE(IntPtrT, var_entry);
Label if_found(this);
NumberDictionaryLookup(CAST(elements), intptr_index, &if_found, &var_entry,
if_hole);
BIND(&if_found);
// Check that the value is a data property.
TNode<IntPtrT> index = EntryToIndex<NumberDictionary>(var_entry.value());
Node* details = LoadDetailsByKeyIndex<NumberDictionary>(elements, index);
Node* kind = DecodeWord32<PropertyDetails::KindField>(details);
// TODO(jkummerow): Support accessors without missing?
GotoIfNot(Word32Equal(kind, Int32Constant(kData)), miss);
// Finally, load the value.
exit_point->Return(LoadValueByKeyIndex<NumberDictionary>(elements, index));
TNode<Object> value = LoadNumberDictionaryElement(
CAST(elements), intptr_index, miss, if_hole);
exit_point->Return(value);
}
BIND(&if_typed_array);
......
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