Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: src/code-stub-assembler.cc

Issue 2380563005: [code-stubs] Add LoadMapElementsKind helper (Closed)
Patch Set: comitting all files Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-stub-assembler.h" 5 #include "src/code-stub-assembler.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/frames-inl.h" 7 #include "src/frames-inl.h"
8 #include "src/frames.h" 8 #include "src/frames.h"
9 #include "src/ic/handler-configuration.h" 9 #include "src/ic/handler-configuration.h"
10 #include "src/ic/stub-cache.h" 10 #include "src/ic/stub-cache.h"
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 } 960 }
961 961
962 Node* CodeStubAssembler::LoadMapBitField3(Node* map) { 962 Node* CodeStubAssembler::LoadMapBitField3(Node* map) {
963 return LoadObjectField(map, Map::kBitField3Offset, MachineType::Uint32()); 963 return LoadObjectField(map, Map::kBitField3Offset, MachineType::Uint32());
964 } 964 }
965 965
966 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { 966 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) {
967 return LoadObjectField(map, Map::kInstanceTypeOffset, MachineType::Uint8()); 967 return LoadObjectField(map, Map::kInstanceTypeOffset, MachineType::Uint8());
968 } 968 }
969 969
970 Node* CodeStubAssembler::LoadMapElementsKind(Node* map) {
971 Node* bit_field2 = LoadMapBitField2(map);
972 return BitFieldDecode<Map::ElementsKindBits>(bit_field2);
973 }
974
970 Node* CodeStubAssembler::LoadMapDescriptors(Node* map) { 975 Node* CodeStubAssembler::LoadMapDescriptors(Node* map) {
971 return LoadObjectField(map, Map::kDescriptorsOffset); 976 return LoadObjectField(map, Map::kDescriptorsOffset);
972 } 977 }
973 978
974 Node* CodeStubAssembler::LoadMapPrototype(Node* map) { 979 Node* CodeStubAssembler::LoadMapPrototype(Node* map) {
975 return LoadObjectField(map, Map::kPrototypeOffset); 980 return LoadObjectField(map, Map::kPrototypeOffset);
976 } 981 }
977 982
978 Node* CodeStubAssembler::LoadMapInstanceSize(Node* map) { 983 Node* CodeStubAssembler::LoadMapInstanceSize(Node* map) {
979 return ChangeUint32ToWord( 984 return ChangeUint32ToWord(
(...skipping 2721 matching lines...) Expand 10 before | Expand all | Expand 10 after
3701 void CodeStubAssembler::TryLookupElement(Node* object, Node* map, 3706 void CodeStubAssembler::TryLookupElement(Node* object, Node* map,
3702 Node* instance_type, 3707 Node* instance_type,
3703 Node* intptr_index, Label* if_found, 3708 Node* intptr_index, Label* if_found,
3704 Label* if_not_found, 3709 Label* if_not_found,
3705 Label* if_bailout) { 3710 Label* if_bailout) {
3706 // Handle special objects in runtime. 3711 // Handle special objects in runtime.
3707 GotoIf(Int32LessThanOrEqual(instance_type, 3712 GotoIf(Int32LessThanOrEqual(instance_type,
3708 Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)), 3713 Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)),
3709 if_bailout); 3714 if_bailout);
3710 3715
3711 Node* bit_field2 = LoadMapBitField2(map); 3716 Node* elements_kind = LoadMapElementsKind(map);
3712 Node* elements_kind = BitFieldDecode<Map::ElementsKindBits>(bit_field2);
3713 3717
3714 // TODO(verwaest): Support other elements kinds as well. 3718 // TODO(verwaest): Support other elements kinds as well.
3715 Label if_isobjectorsmi(this), if_isdouble(this), if_isdictionary(this), 3719 Label if_isobjectorsmi(this), if_isdouble(this), if_isdictionary(this),
3716 if_isfaststringwrapper(this), if_isslowstringwrapper(this), if_oob(this); 3720 if_isfaststringwrapper(this), if_isslowstringwrapper(this), if_oob(this);
3717 // clang-format off 3721 // clang-format off
3718 int32_t values[] = { 3722 int32_t values[] = {
3719 // Handled by {if_isobjectorsmi}. 3723 // Handled by {if_isobjectorsmi}.
3720 FAST_SMI_ELEMENTS, FAST_HOLEY_SMI_ELEMENTS, FAST_ELEMENTS, 3724 FAST_SMI_ELEMENTS, FAST_HOLEY_SMI_ELEMENTS, FAST_ELEMENTS,
3721 FAST_HOLEY_ELEMENTS, 3725 FAST_HOLEY_ELEMENTS,
3722 // Handled by {if_isdouble}. 3726 // Handled by {if_isdouble}.
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
4812 &slow); 4816 &slow);
4813 4817
4814 Node* key = p->name; 4818 Node* key = p->name;
4815 TryToName(key, &if_index, &var_index, &if_unique_name, &slow); 4819 TryToName(key, &if_index, &var_index, &if_unique_name, &slow);
4816 4820
4817 Bind(&if_index); 4821 Bind(&if_index);
4818 { 4822 {
4819 Comment("integer index"); 4823 Comment("integer index");
4820 Node* index = var_index.value(); 4824 Node* index = var_index.value();
4821 Node* elements = LoadElements(receiver); 4825 Node* elements = LoadElements(receiver);
4822 Node* bitfield2 = LoadMapBitField2(receiver_map); 4826 Node* elements_kind = LoadMapElementsKind(receiver_map);
4823 Node* elements_kind = BitFieldDecode<Map::ElementsKindBits>(bitfield2);
4824 Node* is_jsarray_condition = 4827 Node* is_jsarray_condition =
4825 Word32Equal(instance_type, Int32Constant(JS_ARRAY_TYPE)); 4828 Word32Equal(instance_type, Int32Constant(JS_ARRAY_TYPE));
4826 Variable var_double_value(this, MachineRepresentation::kFloat64); 4829 Variable var_double_value(this, MachineRepresentation::kFloat64);
4827 Label rebox_double(this, &var_double_value); 4830 Label rebox_double(this, &var_double_value);
4828 4831
4829 // Unimplemented elements kinds fall back to a runtime call. 4832 // Unimplemented elements kinds fall back to a runtime call.
4830 Label* unimplemented_elements_kind = &slow; 4833 Label* unimplemented_elements_kind = &slow;
4831 IncrementCounter(isolate()->counters()->ic_keyed_load_generic_smi(), 1); 4834 IncrementCounter(isolate()->counters()->ic_keyed_load_generic_smi(), 1);
4832 EmitElementLoad(receiver, elements, elements_kind, index, 4835 EmitElementLoad(receiver, elements, elements_kind, index,
4833 is_jsarray_condition, &if_element_hole, &rebox_double, 4836 is_jsarray_condition, &if_element_hole, &rebox_double,
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
5722 Heap::kTheHoleValueRootIndex); 5725 Heap::kTheHoleValueRootIndex);
5723 5726
5724 // Store the WeakCell in the feedback vector. 5727 // Store the WeakCell in the feedback vector.
5725 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 5728 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER,
5726 CodeStubAssembler::SMI_PARAMETERS); 5729 CodeStubAssembler::SMI_PARAMETERS);
5727 return cell; 5730 return cell;
5728 } 5731 }
5729 5732
5730 } // namespace internal 5733 } // namespace internal
5731 } // namespace v8 5734 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698