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