Commit e82ad05c authored by cbruni's avatar cbruni Committed by Commit bot

[stubs] Add LoadMapElementsKind helper

Review-Url: https://codereview.chromium.org/2380563005
Cr-Commit-Position: refs/heads/master@{#39914}
parent c615b6ee
......@@ -1381,9 +1381,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
&if_packed_doubles, &if_holey_doubles};
Node* map = assembler->LoadMap(array);
Node* bit_field2 = assembler->LoadMapBitField2(map);
Node* elements_kind =
assembler->BitFieldDecode<Map::ElementsKindBits>(bit_field2);
Node* elements_kind = assembler->LoadMapElementsKind(map);
Node* elements = assembler->LoadElements(array);
assembler->Switch(elements_kind, &return_false, kElementsKind,
element_kind_handlers, arraysize(kElementsKind));
......@@ -1828,9 +1826,7 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
&if_packed_doubles, &if_holey_doubles};
Node* map = assembler->LoadMap(array);
Node* bit_field2 = assembler->LoadMapBitField2(map);
Node* elements_kind =
assembler->BitFieldDecode<Map::ElementsKindBits>(bit_field2);
Node* elements_kind = assembler->LoadMapElementsKind(map);
Node* elements = assembler->LoadElements(array);
assembler->Switch(elements_kind, &return_not_found, kElementsKind,
element_kind_handlers, arraysize(kElementsKind));
......
......@@ -937,6 +937,11 @@ Node* CodeStubAssembler::LoadMapInstanceType(Node* map) {
return LoadObjectField(map, Map::kInstanceTypeOffset, MachineType::Uint8());
}
Node* CodeStubAssembler::LoadMapElementsKind(Node* map) {
Node* bit_field2 = LoadMapBitField2(map);
return BitFieldDecode<Map::ElementsKindBits>(bit_field2);
}
Node* CodeStubAssembler::LoadMapDescriptors(Node* map) {
return LoadObjectField(map, Map::kDescriptorsOffset);
}
......@@ -3678,8 +3683,7 @@ void CodeStubAssembler::TryLookupElement(Node* object, Node* map,
Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)),
if_bailout);
Node* bit_field2 = LoadMapBitField2(map);
Node* elements_kind = BitFieldDecode<Map::ElementsKindBits>(bit_field2);
Node* elements_kind = LoadMapElementsKind(map);
// TODO(verwaest): Support other elements kinds as well.
Label if_isobjectorsmi(this), if_isdouble(this), if_isdictionary(this),
......@@ -4789,8 +4793,7 @@ void CodeStubAssembler::KeyedLoadICGeneric(const LoadICParameters* p) {
Comment("integer index");
Node* index = var_index.value();
Node* elements = LoadElements(receiver);
Node* bitfield2 = LoadMapBitField2(receiver_map);
Node* elements_kind = BitFieldDecode<Map::ElementsKindBits>(bitfield2);
Node* elements_kind = LoadMapElementsKind(receiver_map);
Node* is_jsarray_condition =
Word32Equal(instance_type, Int32Constant(JS_ARRAY_TYPE));
Variable var_double_value(this, MachineRepresentation::kFloat64);
......
......@@ -246,6 +246,8 @@ class CodeStubAssembler : public compiler::CodeAssembler {
compiler::Node* LoadMapBitField3(compiler::Node* map);
// Load the instance type of a map.
compiler::Node* LoadMapInstanceType(compiler::Node* map);
// Load the ElementsKind of a map.
compiler::Node* LoadMapElementsKind(compiler::Node* map);
// Load the instance descriptors of a map.
compiler::Node* LoadMapDescriptors(compiler::Node* map);
// Load the prototype of a map.
......
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